mirror of
https://github.com/Oreolek/ifhub.club.git
synced 2024-06-16 23:00:51 +03:00
Компонент blog
This commit is contained in:
parent
8421a043f6
commit
a936f15ea4
|
@ -115,7 +115,7 @@ class ActionBlogs extends Action {
|
|||
$oViewer->Assign('bUseMore', true);
|
||||
$oViewer->Assign('bHideMore', $bHideMore);
|
||||
$oViewer->Assign('iSearchCount', $aResult['count']);
|
||||
$this->Viewer_AssignAjax('sText',$oViewer->Fetch("actions/ActionBlogs/blog_list.tpl"));
|
||||
$this->Viewer_AssignAjax('sText',$oViewer->Fetch("components/blog/blog-list.tpl"));
|
||||
/**
|
||||
* Для подгрузки
|
||||
*/
|
||||
|
|
|
@ -160,6 +160,7 @@ return array(
|
|||
'topics_total' => 'Топиков',
|
||||
'date_created' => 'Дата создания',
|
||||
'rating_limit' => 'Ограничение на постинг',
|
||||
'rss' => 'RSS',
|
||||
|
||||
// Сообщения
|
||||
'alerts' => array(
|
||||
|
@ -173,7 +174,8 @@ return array(
|
|||
* Поиск
|
||||
*/
|
||||
'search' => array(
|
||||
'placeholder' => 'Поиск по названию',
|
||||
'placeholder' => 'Поиск по названию',
|
||||
'result_title' => 'Найден %%count%% блог;Найдено %%count%% блога;Найдено %%count%% блогов'
|
||||
),
|
||||
|
||||
/**
|
||||
|
|
|
@ -22,109 +22,5 @@
|
|||
{/block}
|
||||
|
||||
{block 'layout_content'}
|
||||
<form method="post" enctype="multipart/form-data" class="js-form-validate">
|
||||
{hook run='form_add_blog_begin'}
|
||||
|
||||
|
||||
{* Название блога *}
|
||||
{include 'components/field/field.text.tpl'
|
||||
sName = 'blog_title'
|
||||
aRules = [ 'required' => true, 'rangelength' => "[2,200]" ]
|
||||
sNote = $aLang.blog.add.fields.title.note
|
||||
sLabel = $aLang.blog.add.fields.title.label}
|
||||
|
||||
{* URL блога *}
|
||||
{include 'components/field/field.text.tpl'
|
||||
sName = 'blog_url'
|
||||
aRules = [ 'required' => true, 'type' => 'alphanum', 'rangelength' => '[2,50]' ]
|
||||
bIsDisabled = $_aRequest.blog_id && ! $oUserCurrent->isAdministrator()
|
||||
sNote = $aLang.blog.add.fields.url.note
|
||||
sLabel = $aLang.blog.add.fields.url.label}
|
||||
|
||||
|
||||
{* Категория блога *}
|
||||
{if Config::Get('module.blog.category_allow') and ($oUserCurrent->isAdministrator() or ! Config::Get('module.blog.category_only_admin'))}
|
||||
{$aBlogCategoriesCustom = [
|
||||
[ 'value' => 0, 'text' => '—' ]
|
||||
]}
|
||||
|
||||
{foreach $aBlogCategories as $oBlogCategory}
|
||||
{$aBlogCategoriesCustom[] = [
|
||||
'value' => $oBlogCategory->getId(),
|
||||
'text' => $oBlogCategory->getTitle()|escape
|
||||
]}
|
||||
{/foreach}
|
||||
|
||||
{include 'components/field/field.select.tpl'
|
||||
sName = 'blog_category'
|
||||
sLabel = $aLang.blog.add.fields.category.label
|
||||
sNote = $aLang.blog.add.fields.category.note
|
||||
sInputClasses = 'width-200'
|
||||
aItems = $aBlogCategoriesCustom
|
||||
sSelectedValue = $_aRequest.blog_category}
|
||||
{/if}
|
||||
|
||||
|
||||
{* Тип блога *}
|
||||
{include 'components/field/field.select.tpl'
|
||||
sName = 'blog_type'
|
||||
sLabel = $aLang.blog.add.fields.type.label
|
||||
sNote = $aLang.blog.add.fields.type.note_open
|
||||
sInputClasses = 'width-200 js-blog-add-type'
|
||||
sSelectedValue = $_aRequest.blog_type
|
||||
aItems = [
|
||||
[ 'value' => 'open', 'text' => $aLang.blog.add.fields.type.value_open ],
|
||||
[ 'value' => 'close', 'text' => $aLang.blog.add.fields.type.value_close ]
|
||||
]}
|
||||
|
||||
|
||||
{* Описание блога *}
|
||||
{include 'components/editor/editor.tpl'
|
||||
sSet = 'light'
|
||||
sMediaTargetType = 'blog'
|
||||
sName = 'blog_description'
|
||||
aRules = [ 'required' => true, 'rangelength' => '[10,3000]' ]
|
||||
sLabel = $aLang.blog.add.fields.description.label}
|
||||
|
||||
|
||||
{* Ограничение по рейтингу *}
|
||||
{include 'components/field/field.text.tpl'
|
||||
sName = 'blog_limit_rating_topic'
|
||||
aRules = [ 'required' => true, 'type' => 'number' ]
|
||||
sValue = '0'
|
||||
sInputClasses = 'width-100'
|
||||
sNote = $aLang.blog.add.fields.rating.note
|
||||
sLabel = $aLang.blog.add.fields.rating.label}
|
||||
|
||||
|
||||
{* Аватар *}
|
||||
{if $oBlogEdit and $oBlogEdit->getAvatar()}
|
||||
{foreach Config::Get('module.blog.avatar_size') as $iSize}
|
||||
{if $iSize}<img src="{$oBlogEdit->getAvatarPath({$iSize})}">{/if}
|
||||
{/foreach}
|
||||
|
||||
{include 'components/field/field.checkbox.tpl' sName='avatar_delete' bNoMargin=true sValue='on' sLabel=$aLang.common.remove}
|
||||
{/if}
|
||||
|
||||
{include 'components/field/field.file.tpl'
|
||||
sName = 'avatar'
|
||||
sLabel = $aLang.blog.add.fields.avatar.label}
|
||||
|
||||
|
||||
{hook run='form_add_blog_end'}
|
||||
|
||||
|
||||
{* Скрытые поля *}
|
||||
{include 'components/field/field.hidden.security_key.tpl'}
|
||||
|
||||
|
||||
{* Кнопки *}
|
||||
{if $sEvent == 'add'}
|
||||
{$sSubmitInputText = $aLang.common.create}
|
||||
{else}
|
||||
{$sSubmitInputText = $aLang.common.save}
|
||||
{/if}
|
||||
|
||||
{include 'components/button/button.tpl' sName='submit_blog_add' sText=$sSubmitInputText sMods='primary'}
|
||||
</form>
|
||||
{include 'components/blog/add.tpl'}
|
||||
{/block}
|
|
@ -20,50 +20,5 @@
|
|||
{/block}
|
||||
|
||||
{block 'layout_content'}
|
||||
{if $aBlogUsers}
|
||||
<form method="post" enctype="multipart/form-data">
|
||||
<table class="table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="cell-name"></th>
|
||||
<th class="ta-c">{$aLang.blog.admin.role_administrator}</th>
|
||||
<th class="ta-c">{$aLang.blog.admin.role_moderator}</th>
|
||||
<th class="ta-c">{$aLang.blog.admin.role_reader}</th>
|
||||
<th class="ta-c">{$aLang.blog.admin.role_banned}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
<tbody>
|
||||
{foreach $aBlogUsers as $oBlogUser}
|
||||
{$oUser = $oBlogUser->getUser()}
|
||||
|
||||
<tr>
|
||||
<td class="cell-name">
|
||||
{include 'components/user_item/user_item.tpl' oUser=$oUser}
|
||||
</td>
|
||||
|
||||
{if $oUser->getId() == $oUserCurrent->getId()}
|
||||
<td colspan="10" class="ta-c">—</td>
|
||||
{else}
|
||||
<td class="ta-c"><input type="radio" name="user_rank[{$oUser->getId()}]" value="administrator" {if $oBlogUser->getIsAdministrator()}checked{/if} /></td>
|
||||
<td class="ta-c"><input type="radio" name="user_rank[{$oUser->getId()}]" value="moderator" {if $oBlogUser->getIsModerator()}checked{/if} /></td>
|
||||
<td class="ta-c"><input type="radio" name="user_rank[{$oUser->getId()}]" value="reader" {if $oBlogUser->getUserRole() == $BLOG_USER_ROLE_USER}checked{/if} /></td>
|
||||
<td class="ta-c"><input type="radio" name="user_rank[{$oUser->getId()}]" value="ban" {if $oBlogUser->getUserRole() == $BLOG_USER_ROLE_BAN}checked{/if} /></td>
|
||||
{/if}
|
||||
</tr>
|
||||
{/foreach}
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
{* Скрытые поля *}
|
||||
{include 'components/field/field.hidden.security_key.tpl'}
|
||||
|
||||
{* Кнопки *}
|
||||
{include 'components/button/button.tpl' sName='submit_blog_admin' sText=$aLang.common.save sMods='primary'}
|
||||
</form>
|
||||
|
||||
{include 'components/pagination/pagination.tpl' aPaging=$aPaging}
|
||||
{else}
|
||||
{include 'components/alert/alert.tpl' mAlerts=$aLang.blog.admin.alerts.empty sMods='empty'}
|
||||
{/if}
|
||||
{include 'components/blog/admin.tpl'}
|
||||
{/block}
|
|
@ -19,71 +19,7 @@
|
|||
{extends 'layouts/layout.base.tpl'}
|
||||
|
||||
{block 'layout_content'}
|
||||
{* Подключаем модальное окно удаления блога если пользователь админ *}
|
||||
{if $oUserCurrent and $oUserCurrent->isAdministrator()}
|
||||
{include 'modals/modal.blog_delete.tpl'}
|
||||
{/if}
|
||||
|
||||
{* Является ли пользователь администратором или управляющим блога *}
|
||||
{$bUserIsAdministrator = $oUserCurrent && ($oUserCurrent->getId() == $oBlog->getOwnerId() || $oUserCurrent->isAdministrator() || $oBlog->getUserIsAdministrator())}
|
||||
|
||||
|
||||
<div class="blog">
|
||||
<header class="blog-header">
|
||||
{* Голосование *}
|
||||
{include 'components/vote/vote.tpl'
|
||||
sClasses = 'js-vote-blog'
|
||||
sMods = 'large'
|
||||
oObject = $oBlog
|
||||
bIsLocked = $bUserIsAdministrator
|
||||
bShowLabel = true}
|
||||
|
||||
{* Заголовок *}
|
||||
<h2 class="page-header blog-title">
|
||||
{if $oBlog->getType() == 'close'}<i title="{$aLang.blog.private}" class="icon icon-lock"></i>{/if}
|
||||
{$oBlog->getTitle()|escape}
|
||||
</h2>
|
||||
</header>
|
||||
|
||||
|
||||
{* Информация о блоге *}
|
||||
<div class="blog-content">
|
||||
{* Описание *}
|
||||
<div class="blog-description text">{$oBlog->getDescription()}</div>
|
||||
|
||||
{* Информация *}
|
||||
{$aBlogInfo = [
|
||||
[ 'label' => $aLang.blog.date_created, 'content' => "{date_format date=$oBlog->getDateAdd() hours_back='12' minutes_back='60' now='60' day='day H:i' format='j F Y'}" ],
|
||||
[ 'label' => $aLang.blog.topics_total, 'content' => $oBlog->getCountTopic() ],
|
||||
[ 'label' => $aLang.blog.rating_limit, 'content' => $oBlog->getLimitRatingTopic() ]
|
||||
]}
|
||||
|
||||
{include 'components/info_list/info_list.tpl' aInfoList=$aBlogInfo}
|
||||
</div>
|
||||
|
||||
{* Управление *}
|
||||
{if $oUserCurrent && $bUserIsAdministrator}
|
||||
{$aActionbarItems = [ [ 'icon' => 'icon-edit', 'url' => "{router page='blog'}edit/{$oBlog->getId()}/", 'text' => $aLang.common.edit ] ]}
|
||||
|
||||
{if $oUserCurrent->isAdministrator()}
|
||||
{$aActionbarItems[] = [
|
||||
'icon' => 'icon-trash',
|
||||
'attributes' => 'data-type="modal-toggle" data-modal-target="modal-blog-delete"',
|
||||
'text' => $aLang.common.remove
|
||||
]}
|
||||
{else}
|
||||
{$aActionbarItems[] = [
|
||||
'icon' => 'icon-trash',
|
||||
'url' => "{router page='blog'}delete/{$oBlog->getId()}/?security_ls_key={$LIVESTREET_SECURITY_KEY}",
|
||||
'classes' => 'js-blog-remove',
|
||||
'text' => $aLang.common.remove
|
||||
]}
|
||||
{/if}
|
||||
|
||||
{include 'components/actionbar/actionbar.tpl' aItems=$aActionbarItems}
|
||||
{/if}
|
||||
</div>
|
||||
|
||||
{include 'components/blog/blog.tpl' blog=$oBlog}
|
||||
|
||||
{* Сообщение для забаненного пользователя *}
|
||||
{* TODO: Вывод сообщения о бане *}
|
||||
|
|
|
@ -27,6 +27,6 @@
|
|||
]}
|
||||
|
||||
<div class="js-search-ajax-container" data-type="blogs">
|
||||
{include 'actions/ActionBlogs/blog_list.tpl' bUseMore=true}
|
||||
{include 'components/blog/blog-list.tpl' aBlogs=$aBlogs bUseMore=true}
|
||||
</div>
|
||||
{/block}
|
|
@ -16,8 +16,8 @@
|
|||
|
||||
{block 'block_footer'}
|
||||
{* Подписаться через RSS *}
|
||||
<a href="{router page='rss'}blog/{$oBlog->getUrl()}/" class="button">RSS</a>
|
||||
{include 'components/button/button.tpl' sUrl="{router page='rss'}blog/{$oBlog->getUrl()}/" sText=$aLang.blog.rss}
|
||||
|
||||
{* Вступить / Покинуть блог *}
|
||||
{include 'actions/ActionBlog/button_join.tpl'}
|
||||
{include 'components/blog/join.tpl'}
|
||||
{/block}
|
109
application/frontend/skin/developer/components/blog/add.tpl
Normal file
109
application/frontend/skin/developer/components/blog/add.tpl
Normal file
|
@ -0,0 +1,109 @@
|
|||
{**
|
||||
* Форма добавления/редактирования
|
||||
*}
|
||||
|
||||
<form method="post" enctype="multipart/form-data" class="js-form-validate">
|
||||
{hook run='form_add_blog_begin'}
|
||||
|
||||
|
||||
{* Название блога *}
|
||||
{include 'components/field/field.text.tpl'
|
||||
sName = 'blog_title'
|
||||
aRules = [ 'required' => true, 'rangelength' => "[2,200]" ]
|
||||
sNote = $aLang.blog.add.fields.title.note
|
||||
sLabel = $aLang.blog.add.fields.title.label}
|
||||
|
||||
{* URL блога *}
|
||||
{include 'components/field/field.text.tpl'
|
||||
sName = 'blog_url'
|
||||
aRules = [ 'required' => true, 'type' => 'alphanum', 'rangelength' => '[2,50]' ]
|
||||
bIsDisabled = $_aRequest.blog_id && ! $oUserCurrent->isAdministrator()
|
||||
sNote = $aLang.blog.add.fields.url.note
|
||||
sLabel = $aLang.blog.add.fields.url.label}
|
||||
|
||||
|
||||
{* Категория блога *}
|
||||
{if Config::Get('module.blog.category_allow') and ($oUserCurrent->isAdministrator() or ! Config::Get('module.blog.category_only_admin'))}
|
||||
{$aBlogCategoriesCustom = [
|
||||
[ 'value' => 0, 'text' => '—' ]
|
||||
]}
|
||||
|
||||
{foreach $aBlogCategories as $oBlogCategory}
|
||||
{$aBlogCategoriesCustom[] = [
|
||||
'value' => $oBlogCategory->getId(),
|
||||
'text' => $oBlogCategory->getTitle()|escape
|
||||
]}
|
||||
{/foreach}
|
||||
|
||||
{include 'components/field/field.select.tpl'
|
||||
sName = 'blog_category'
|
||||
sLabel = $aLang.blog.add.fields.category.label
|
||||
sNote = $aLang.blog.add.fields.category.note
|
||||
sInputClasses = 'width-200'
|
||||
aItems = $aBlogCategoriesCustom
|
||||
sSelectedValue = $_aRequest.blog_category}
|
||||
{/if}
|
||||
|
||||
|
||||
{* Тип блога *}
|
||||
{include 'components/field/field.select.tpl'
|
||||
sName = 'blog_type'
|
||||
sLabel = $aLang.blog.add.fields.type.label
|
||||
sNote = $aLang.blog.add.fields.type.note_open
|
||||
sInputClasses = 'width-200 js-blog-add-type'
|
||||
sSelectedValue = $_aRequest.blog_type
|
||||
aItems = [
|
||||
[ 'value' => 'open', 'text' => $aLang.blog.add.fields.type.value_open ],
|
||||
[ 'value' => 'close', 'text' => $aLang.blog.add.fields.type.value_close ]
|
||||
]}
|
||||
|
||||
|
||||
{* Описание блога *}
|
||||
{include 'components/editor/editor.tpl'
|
||||
sSet = 'light'
|
||||
sMediaTargetType = 'blog'
|
||||
sName = 'blog_description'
|
||||
aRules = [ 'required' => true, 'rangelength' => '[10,3000]' ]
|
||||
sLabel = $aLang.blog.add.fields.description.label}
|
||||
|
||||
|
||||
{* Ограничение по рейтингу *}
|
||||
{include 'components/field/field.text.tpl'
|
||||
sName = 'blog_limit_rating_topic'
|
||||
aRules = [ 'required' => true, 'type' => 'number' ]
|
||||
sValue = '0'
|
||||
sInputClasses = 'width-100'
|
||||
sNote = $aLang.blog.add.fields.rating.note
|
||||
sLabel = $aLang.blog.add.fields.rating.label}
|
||||
|
||||
|
||||
{* Аватар *}
|
||||
{if $oBlogEdit and $oBlogEdit->getAvatar()}
|
||||
{foreach Config::Get('module.blog.avatar_size') as $iSize}
|
||||
{if $iSize}<img src="{$oBlogEdit->getAvatarPath({$iSize})}">{/if}
|
||||
{/foreach}
|
||||
|
||||
{include 'components/field/field.checkbox.tpl' sName='avatar_delete' bNoMargin=true sValue='on' sLabel=$aLang.common.remove}
|
||||
{/if}
|
||||
|
||||
{include 'components/field/field.file.tpl'
|
||||
sName = 'avatar'
|
||||
sLabel = $aLang.blog.add.fields.avatar.label}
|
||||
|
||||
|
||||
{hook run='form_add_blog_end'}
|
||||
|
||||
|
||||
{* Скрытые поля *}
|
||||
{include 'components/field/field.hidden.security_key.tpl'}
|
||||
|
||||
|
||||
{* Кнопки *}
|
||||
{if $sEvent == 'add'}
|
||||
{$sSubmitInputText = $aLang.common.create}
|
||||
{else}
|
||||
{$sSubmitInputText = $aLang.common.save}
|
||||
{/if}
|
||||
|
||||
{include 'components/button/button.tpl' sName='submit_blog_add' sText=$sSubmitInputText sMods='primary'}
|
||||
</form>
|
|
@ -0,0 +1,50 @@
|
|||
{**
|
||||
* Управление пользователями блога
|
||||
*}
|
||||
|
||||
{if $aBlogUsers}
|
||||
<form method="post" enctype="multipart/form-data">
|
||||
<table class="table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="cell-name"></th>
|
||||
<th class="ta-c">{$aLang.blog.admin.role_administrator}</th>
|
||||
<th class="ta-c">{$aLang.blog.admin.role_moderator}</th>
|
||||
<th class="ta-c">{$aLang.blog.admin.role_reader}</th>
|
||||
<th class="ta-c">{$aLang.blog.admin.role_banned}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
<tbody>
|
||||
{foreach $aBlogUsers as $oBlogUser}
|
||||
{$oUser = $oBlogUser->getUser()}
|
||||
|
||||
<tr>
|
||||
<td class="cell-name">
|
||||
{include 'components/user_item/user_item.tpl' oUser=$oUser}
|
||||
</td>
|
||||
|
||||
{if $oUser->getId() == $oUserCurrent->getId()}
|
||||
<td colspan="10" class="ta-c">—</td>
|
||||
{else}
|
||||
<td class="ta-c"><input type="radio" name="user_rank[{$oUser->getId()}]" value="administrator" {if $oBlogUser->getIsAdministrator()}checked{/if} /></td>
|
||||
<td class="ta-c"><input type="radio" name="user_rank[{$oUser->getId()}]" value="moderator" {if $oBlogUser->getIsModerator()}checked{/if} /></td>
|
||||
<td class="ta-c"><input type="radio" name="user_rank[{$oUser->getId()}]" value="reader" {if $oBlogUser->getUserRole() == $BLOG_USER_ROLE_USER}checked{/if} /></td>
|
||||
<td class="ta-c"><input type="radio" name="user_rank[{$oUser->getId()}]" value="ban" {if $oBlogUser->getUserRole() == $BLOG_USER_ROLE_BAN}checked{/if} /></td>
|
||||
{/if}
|
||||
</tr>
|
||||
{/foreach}
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
{* Скрытые поля *}
|
||||
{include 'components/field/field.hidden.security_key.tpl'}
|
||||
|
||||
{* Кнопки *}
|
||||
{include 'components/button/button.tpl' sName='submit_blog_admin' sText=$aLang.common.save sMods='primary'}
|
||||
</form>
|
||||
|
||||
{include 'components/pagination/pagination.tpl' aPaging=$aPaging}
|
||||
{else}
|
||||
{include 'components/alert/alert.tpl' mAlerts=$aLang.blog.admin.alerts.empty sMods='empty'}
|
||||
{/if}
|
|
@ -9,7 +9,7 @@
|
|||
{* Список блогов *}
|
||||
{if $aBlogs}
|
||||
{if $iSearchCount}
|
||||
<h3 class="h3">Найдено {$iSearchCount} блогов</h3>
|
||||
<h3 class="h3">{lang name='blog.search.result_title' count=$iSearchCount plural=true}</h3>
|
||||
{/if}
|
||||
|
||||
{* Список блогов *}
|
||||
|
@ -34,18 +34,18 @@
|
|||
<p class="object-list-item-description">{$oBlog->getDescription()|strip_tags|truncate:120}</p>
|
||||
|
||||
{* Информация *}
|
||||
{$aBlogInfo = [
|
||||
{$info = [
|
||||
[ 'label' => "{$aLang.blog.users.readers_total}:", 'content' => $oBlog->getCountUser() ],
|
||||
[ 'label' => "{$aLang.vote.rating}:", 'content' => $oBlog->getRating() ],
|
||||
[ 'label' => "{$aLang.blog.topics_total}:", 'content' => $oBlog->getCountTopic() ]
|
||||
]}
|
||||
|
||||
{include 'components/info_list/info_list.tpl' aInfoList=$aBlogInfo sInfoListClasses='object-list-item-info'}
|
||||
{include 'components/info_list/info_list.tpl' aInfoList=$info sInfoListClasses='object-list-item-info'}
|
||||
|
||||
{* Действия *}
|
||||
<div class="object-list-item-actions">
|
||||
{* Вступить/покинуть блог *}
|
||||
{include 'actions/ActionBlog/button_join.tpl'}
|
||||
{include './join.tpl'}
|
||||
</div>
|
||||
</li>
|
||||
{/foreach}
|
||||
|
@ -53,7 +53,7 @@
|
|||
|
||||
|
||||
{if $bUseMore}
|
||||
{if !$bHideMore}
|
||||
{if ! $bHideMore}
|
||||
{include 'components/more/more.tpl'
|
||||
sClasses = 'js-more-search'
|
||||
sTarget = '.js-more-blogs-container'
|
88
application/frontend/skin/developer/components/blog/blog.tpl
Normal file
88
application/frontend/skin/developer/components/blog/blog.tpl
Normal file
|
@ -0,0 +1,88 @@
|
|||
{**
|
||||
* Блог
|
||||
*
|
||||
* @param object $blog Блог
|
||||
* @param string $mods Модификаторы
|
||||
* @param string $attributes Дополнительные атрибуты основного блока
|
||||
* @param string $classes Дополнительные классы
|
||||
*
|
||||
* TODO: Сделать универсальным
|
||||
*}
|
||||
|
||||
{* Название компонента *}
|
||||
{$component = 'blog'}
|
||||
|
||||
{* Переменные *}
|
||||
{$blog = $smarty.local.blog}
|
||||
|
||||
{* Подключаем модальное окно удаления блога если пользователь админ *}
|
||||
{if $oUserCurrent and $oUserCurrent->isAdministrator()}
|
||||
{include 'modals/modal.blog_delete.tpl'}
|
||||
{/if}
|
||||
|
||||
{* Является ли пользователь администратором или управляющим блога *}
|
||||
{$isBlogAdmin = $oUserCurrent && ($oUserCurrent->getId() == $blog->getOwnerId() || $oUserCurrent->isAdministrator() || $blog->getUserIsAdministrator())}
|
||||
|
||||
|
||||
{* Блог *}
|
||||
<div class="{$component} {mod name=$component mods=$mods default=$defaultMod} {$smarty.local.classes}" data-id="{$blog->getId()}">
|
||||
<header class="{$component}-header">
|
||||
{* Голосование *}
|
||||
{block 'blog_vote'}
|
||||
{include 'components/vote/vote.tpl'
|
||||
sClasses = 'js-vote-blog'
|
||||
sMods = 'large'
|
||||
oObject = $blog
|
||||
bIsLocked = $isBlogAdmin
|
||||
bShowLabel = true}
|
||||
{/block}
|
||||
|
||||
{* Заголовок *}
|
||||
<h2 class="page-header blog-title">
|
||||
{if $blog->getType() == 'close'}
|
||||
<i title="{$aLang.blog.private}" class="icon icon-lock"></i>
|
||||
{/if}
|
||||
|
||||
{$blog->getTitle()|escape}
|
||||
</h2>
|
||||
</header>
|
||||
|
||||
|
||||
{* Информация о блоге *}
|
||||
<div class="{$component}-content">
|
||||
{* Описание *}
|
||||
<div class="{$component}-description text">
|
||||
{$blog->getDescription()}
|
||||
</div>
|
||||
|
||||
{* Информация *}
|
||||
{include 'components/info_list/info_list.tpl' aInfoList=[
|
||||
[ 'label' => $aLang.blog.date_created, 'content' => "{date_format date=$blog->getDateAdd() hours_back='12' minutes_back='60' now='60' day='day H:i' format='j F Y'}" ],
|
||||
[ 'label' => $aLang.blog.topics_total, 'content' => $blog->getCountTopic() ],
|
||||
[ 'label' => $aLang.blog.rating_limit, 'content' => $blog->getLimitRatingTopic() ]
|
||||
]}
|
||||
</div>
|
||||
|
||||
|
||||
{* Управление *}
|
||||
{if $oUserCurrent && $isBlogAdmin}
|
||||
{$aActionbarItems = [ [ 'icon' => 'icon-edit', 'url' => "{router page='blog'}edit/{$blog->getId()}/", 'text' => $aLang.common.edit ] ]}
|
||||
|
||||
{if $oUserCurrent->isAdministrator()}
|
||||
{$aActionbarItems[] = [
|
||||
'icon' => 'icon-trash',
|
||||
'attributes' => 'data-type="modal-toggle" data-modal-target="modal-blog-delete"',
|
||||
'text' => $aLang.common.remove
|
||||
]}
|
||||
{else}
|
||||
{$aActionbarItems[] = [
|
||||
'icon' => 'icon-trash',
|
||||
'url' => "{router page='blog'}delete/{$blog->getId()}/?security_ls_key={$LIVESTREET_SECURITY_KEY}",
|
||||
'classes' => 'js-blog-remove',
|
||||
'text' => $aLang.common.remove
|
||||
]}
|
||||
{/if}
|
||||
|
||||
{include 'components/actionbar/actionbar.tpl' aItems=$aActionbarItems}
|
||||
{/if}
|
||||
</div>
|
Loading…
Reference in a new issue