2014-06-11 11:58:32 +03:00
|
|
|
{**
|
|
|
|
* Дерево комментариев
|
|
|
|
*
|
|
|
|
* @component comment
|
|
|
|
* @styles css/comments.css
|
|
|
|
* @scripts js/comments.js
|
|
|
|
*
|
|
|
|
* @param array $aComments Комментарии
|
2014-10-18 09:07:45 +03:00
|
|
|
* @param string $classes Дополнительные классы
|
|
|
|
* @param string $attributes Атрибуты
|
|
|
|
* @param string $mods
|
2014-06-11 11:58:32 +03:00
|
|
|
* @param boolean $bShowVote (true) Показывать или нет голосование
|
|
|
|
* @param boolean $bShowReply (true) Показывать или нет кнопку Ответить
|
|
|
|
* @param integer $iAuthorId
|
|
|
|
* @param string $sDateReadLast
|
|
|
|
*}
|
|
|
|
|
|
|
|
{* Текущая вложенность *}
|
|
|
|
{$iCurrentLevel = -1}
|
|
|
|
|
|
|
|
{* Максимальная вложенность *}
|
|
|
|
{$iMaxLevel = $smarty.local.iMaxLevel|default:Config::Get('module.comment.max_tree')}
|
|
|
|
|
|
|
|
{* Добавляем возможность переопределить стандартный шаблон комментария *}
|
|
|
|
{$sTemplate = $smarty.local.template|default:'./comment.tpl'}
|
|
|
|
|
|
|
|
{* Построение дерева комментариев *}
|
|
|
|
{foreach $smarty.local.aComments as $oComment}
|
|
|
|
{* Ограничиваем вложенность комментария максимальным значением *}
|
|
|
|
{$iCommentLevel = ( $oComment->getLevel() > $iMaxLevel ) ? $iMaxLevel : $oComment->getLevel()}
|
|
|
|
|
|
|
|
{* Закрываем блоки-обертки *}
|
|
|
|
{if $iCurrentLevel > $iCommentLevel}
|
|
|
|
{section closewrappers1 loop=$iCurrentLevel - $iCommentLevel + 1}</div>{/section}
|
|
|
|
{elseif $iCurrentLevel == $iCommentLevel && ! $oComment@first}
|
|
|
|
</div>
|
|
|
|
{/if}
|
|
|
|
|
|
|
|
{* Устанавливаем текущий уровень вложенности *}
|
|
|
|
{$iCurrentLevel = $iCommentLevel}
|
|
|
|
|
|
|
|
{* Вспомогательный блок-обертка *}
|
|
|
|
<div class="comment-wrapper js-comment-wrapper" data-id="{$oComment->getId()}">
|
|
|
|
|
|
|
|
{* Комментарий *}
|
|
|
|
{include "$sTemplate"
|
|
|
|
oComment = $oComment
|
|
|
|
bShowVote = $smarty.local.bShowVote
|
|
|
|
bShowReply = ! $smarty.local.bForbidAdd
|
|
|
|
bShowFavourite = $smarty.local.bShowFavourite
|
|
|
|
sDateReadLast = $sDateReadLast
|
|
|
|
bIsHidden = $oComment->getDelete()
|
2014-06-13 09:34:12 +03:00
|
|
|
bShowScroll = $smarty.local.bShowScroll|default:true
|
2014-06-11 11:58:32 +03:00
|
|
|
bShowEdit = true}
|
|
|
|
|
|
|
|
{* Закрываем блоки-обертки после последнего комментария *}
|
|
|
|
{if $oComment@last}
|
|
|
|
{section closewrappers2 loop=$iCurrentLevel + 1}</div>{/section}
|
|
|
|
{/if}
|
|
|
|
{foreachelse}
|
2014-10-10 19:29:24 +03:00
|
|
|
{include 'components/alert/alert.tpl' mods='empty' classes='js-comments-empty' text=$aLang.common.empty}
|
2014-06-11 11:58:32 +03:00
|
|
|
{/foreach}
|