1
0
Fork 0
mirror of https://github.com/Oreolek/ifhub.club.git synced 2024-06-17 07:10:48 +03:00

Remove $smarty.local

This commit is contained in:
Denis Shakhov 2016-04-07 16:40:28 +07:00
parent 1eb8f4812d
commit 507ffdb8c6
39 changed files with 192 additions and 187 deletions

View file

@ -2,11 +2,13 @@
* Список пользователей блога
*}
{component_define_params params=[ 'titleLang' ]}
{capture 'block_title'}
{$usersCount = count($blogUsers)}
{if $usersCount}
{$usersCount} {lang "{$smarty.local.titleLang|default:'blog.readers_declension'}" count=$usersCount plural=true}
{$usersCount} {lang "{$titleLang|default:'blog.readers_declension'}" count=$usersCount plural=true}
{else}
{$aLang.blog.users.empty}
{/if}

View file

@ -12,22 +12,18 @@
{* Название компонента *}
{$component = 'ls-comment-form'}
{* Переменные *}
{$targetId = $smarty.local.targetId}
{$targetType = $smarty.local.targetType}
{component_define_params params=[ 'editorSet', 'targetId', 'targetType', 'mods', 'classes', 'attributes' ]}
{* Форма *}
<form method = "post"
class = "{$component} {cmods name=$component mods=$smarty.local.mods} {$smarty.local.classes}"
class = "{$component} {cmods name=$component mods=$mods} {$classes}"
enctype = "multipart/form-data"
data-target-id = "{$targetId}"
data-target-type = "{$targetType}"
{cattr list=$smarty.local.attributes}>
{cattr list=$attributes}>
{block 'comment-form'}
{* @hook Начало формы комментирования *}
{hook run='comment_form_begin' params=$smarty.local.params}
{hook run='comment_form_begin' params=$params}
{block 'comment-form-fields'}
{* Скрытые поля *}
@ -36,7 +32,7 @@
{* Текст комментария *}
{component 'editor'
set = $smarty.local.editorSet|default:'light'
set = $editorSet|default:'light'
name = 'comment_text'
inputClasses = 'js-comment-form-text'
help = false
@ -44,7 +40,7 @@
{/block}
{* @hook Хук расположенный после полей формы и перед кнопками управления формой *}
{hook run='comment_form_fields_after' params=$smarty.local.params}
{hook run='comment_form_fields_after' params=$params}
{**
* Кнопки
@ -61,6 +57,6 @@
{component 'button' text=$aLang.common.preview_text type='button' classes='js-comment-form-preview'}
{* @hook Конец формы комментирования *}
{hook run='comment_form_end' params=$smarty.local.params}
{hook run='comment_form_end' params=$params}
{/block}
</form>

View file

@ -5,11 +5,12 @@
*}
{$component = 'ls-comment-list'}
{component_define_params params=[ 'comments', 'mods', 'classes', 'attributes' ]}
{if $smarty.local.comments}
<div class="{$component} {cmods name=$component mods=$smarty.local.mods} {$smarty.local.classes}" {cattr list=$smarty.local.attributes}>
{if $comments}
<div class="{$component} {cmods name=$component mods=$mods} {$classes}" {cattr list=$attributes}>
{component 'comment' template='tree'
comments = $smarty.local.comments
comments = $comments
forbidAdd = true
maxLevel = 0
commentParams = [

View file

@ -13,14 +13,13 @@
* @param boolean $forbidAdd
*}
{component_define_params params=[ 'authorId', 'authorText', 'commentParams', 'comments', 'dateReadLast', 'forbidAdd', 'maxLevel', 'showReply' ]}
{* Текущая вложенность *}
{$currentLevel = -1}
{* Максимальная вложенность *}
{$maxLevel = $smarty.local.maxLevel}
{* Построение дерева комментариев *}
{foreach $smarty.local.comments as $comment}
{foreach $comments as $comment}
{* Ограничиваем вложенность комментария максимальным значением *}
{$commentLevel = ( $comment->getLevel() > $maxLevel ) ? $maxLevel : $comment->getLevel()}
@ -41,11 +40,11 @@
{block 'comment_tree_comment'}
{component 'comment'
comment = $comment
dateReadLast = $smarty.local.dateReadLast
authorId = $smarty.local.authorId
authorText = $smarty.local.authorText
showReply = ! $smarty.local.forbidAdd || $smarty.local.showReply
params = $smarty.local.commentParams}
dateReadLast = $dateReadLast
authorId = $authorId
authorText = $authorText
showReply = ! $forbidAdd || $showReply
params = $commentParams}
{/block}
{* Закрываем блоки-обертки после последнего комментария *}

View file

@ -17,11 +17,10 @@
{* Название компонента *}
{$component = 'ls-comment'}
{component_define_params params=[ 'dateReadLast', 'showPath', 'showReply', 'authorId', 'comment', 'useFavourite', 'useScroll', 'useVote', 'useEdit', 'mods', 'classes', 'attributes' ]}
{* Переменные *}
{$comment = $smarty.local.comment}
{$mods = $smarty.local.mods}
{$useEdit = $smarty.local.useEdit|default:true}
{$useEdit = $useEdit|default:true}
{$isDeleted = $comment->getDelete()}
{$user = $comment->getUser()}
@ -37,12 +36,12 @@
*}
{* Комментарий с отрицательным рейтингом *}
{if $smarty.local.useVote && $comment->isBad()}
{if $useVote && $comment->isBad()}
{$mods = "$mods bad"}
{/if}
{* Автор комментария является автором объекта к которому оставлен комментарий *}
{if $smarty.local.authorId == $user->getId()}
{if $authorId == $user->getId()}
{$mods = "$mods author"}
{/if}
@ -55,7 +54,7 @@
{$mods = "$mods self"}
{* Непрочитанный комментарий *}
{elseif $smarty.local.dateReadLast && strtotime($smarty.local.dateReadLast) <= strtotime($comment->getDate())}
{elseif $dateReadLast && strtotime($dateReadLast) <= strtotime($comment->getDate())}
{$mods = "$mods new"}
{/if}
@ -64,16 +63,16 @@
* Комментарий
* Атрибут id используется для ссылки на комментарий через хэш в урл (например #comment123)
*}
<section class = "{$component} {cmods name=$component mods=$mods} {$smarty.local.classes} open js-comment"
<section class = "{$component} {cmods name=$component mods=$mods} {$classes} open js-comment"
id = "comment{$commentId}"
data-id = "{$commentId}"
data-parent-id = "{$comment->getPid()}"
{cattr list=$smarty.local.attributes}>
{cattr list=$attributes}>
{* @hook Начало комментария *}
{hook run='comment_comment_begin' params=$smarty.local.params}
{hook run='comment_comment_begin' params=$params}
{* Путь до комментария *}
{if $smarty.local.showPath}
{if $showPath}
<div class="{$component}-path">
{$target = $comment->getTarget()}
@ -90,14 +89,14 @@
</a>
{* Избранное *}
{if $oUserCurrent && $smarty.local.useFavourite}
{if $oUserCurrent && $useFavourite}
{component 'favourite' classes="{$component}-favourite js-comment-favourite" target=$comment}
{/if}
{* Информация *}
<ul class="{$component}-info ls-clearfix">
{* @hook Начало блока с информацией *}
{hook run='comment_info_begin' params=$smarty.local.params}
{hook run='comment_info_begin' params=$params}
{* Автор комментария *}
<li class="{$component}-username">
@ -117,7 +116,7 @@
</li>
{* Прокрутка к родительскому комментарию *}
{if $smarty.local.useScroll|default:true}
{if $useScroll|default:true}
{if $comment->getPid()}
<li class = "{$component}-scroll-to {$component}-scroll-to-parent js-comment-scroll-to-parent"
title = "{$aLang.comments.comment.scroll_to_parent}">↑</li>
@ -129,7 +128,7 @@
{/if}
{* Голосование *}
{if $smarty.local.useVote}
{if $useVote}
<li>
{* Блокируем голосование для гостей или если залогиненый пользователь является автором комментария*}
{component 'vote'
@ -140,20 +139,20 @@
{/if}
{* @hook Конец блока с информацией *}
{hook run='comment_info_end' params=$smarty.local.params}
{hook run='comment_info_end' params=$params}
</ul>
{* Текст комментария *}
<div class="{$component}-content">
{* @hook Начало блока с содержимым комментария *}
{hook run='comment_content_begin' params=$smarty.local.params}
{hook run='comment_content_begin' params=$params}
<div class="{$component}-text ls-text">
{$comment->getText()}
</div>
{* @hook Конец блока с содержимым комментария *}
{hook run='comment_content_end' params=$smarty.local.params}
{hook run='comment_content_end' params=$params}
</div>
{* Информация о редактировании *}
@ -174,10 +173,10 @@
{* Действия *}
<ul class="{$component}-actions ls-clearfix">
{* @hook Начало списка экшенов комментария *}
{hook run='comment_actions_begin' params=$smarty.local.params}
{hook run='comment_actions_begin' params=$params}
{* Ответить *}
{if $oUserCurrent && ! $isDeleted && $smarty.local.showReply|default:true}
{if $oUserCurrent && ! $isDeleted && $showReply|default:true}
<li>
<a href="#" class="ls-link-dotted js-comment-reply" data-id="{$commentId}">{$aLang.comments.comment.reply}</a>
</li>
@ -189,7 +188,7 @@
</li>
{* Редактировать *}
{if $smarty.local.useEdit && $oUserCurrent && $comment->IsAllowEdit()}
{if $useEdit && $oUserCurrent && $comment->IsAllowEdit()}
<li>
<a href="#" class="ls-link-dotted js-comment-update" data-id="{$commentId}">
{$aLang.common.edit}
@ -213,12 +212,12 @@
{/if}
{* @hook Конец списка экшенов комментария *}
{hook run='comment_actions_end' params=$smarty.local.params}
{hook run='comment_actions_end' params=$params}
</ul>
{else}
{$aLang.comments.comment.deleted}
{/if}
{* @hook Конец комментария *}
{hook run='comment_comment_end' params=$smarty.local.params}
{hook run='comment_comment_end' params=$params}
</section>

View file

@ -28,18 +28,13 @@
*}
{$component = 'ls-comments'}
{component_define_params params=[ 'addCommentText', 'authorid', 'authorText', 'commentParams', 'comments', 'count', 'dateReadLast', 'forbidAdd',
'forbidText', 'isSubscribed', 'lastCommentId', 'maxLevel', 'pagination', 'targetId', 'targetType', 'title', 'titleNoComments',
'useSubscribe', 'mods', 'classes', 'attributes' ]}
{block 'comment-list-options'}
{$mods = $smarty.local.mods}
{$targetId = $smarty.local.targetId}
{$targetType = $smarty.local.targetType}
{$count = $smarty.local.count}
{$forbidAdd = $smarty.local.forbidAdd}
{$isSubscribed = $smarty.local.isSubscribed}
{$pagination = $smarty.local.pagination}
{* Максимальная вложенность *}
{$maxLevel = $smarty.local.maxLevel|default:Config::Get('module.comment.max_tree')}
{$maxLevel = $maxLevel|default:Config::Get('module.comment.max_tree')}
{if $forbidAdd}
{$mods = "$mods forbid"}
@ -50,14 +45,14 @@
{add_block group='toolbar' name='component@comment.toolbar'}
{/if}
<div class="{$component} js-comments {cmods name=$component mods=$mods} {$smarty.local.classes}"
<div class="{$component} js-comments {cmods name=$component mods=$mods} {$classes}"
data-target-type="{$targetType}"
data-target-id="{$targetId}"
data-comment-last-id="{$smarty.local.lastCommentId}"
{cattr list=$smarty.local.attributes}>
data-comment-last-id="{$lastCommentId}"
{cattr list=$attributes}>
{* @hook Начало блока с комментариями *}
{hook run='comments_begin' params=$smarty.local.params}
{hook run='comments_begin' params=$params}
{**
* Заголовок
@ -65,14 +60,14 @@
<header class="{$component}-header">
<h3 class="comments-title js-comments-title">
{if $count}
{lang "{$smarty.local.title|default:'comments.comments_declension'}" count=$count plural=true}
{lang "{$title|default:'comments.comments_declension'}" count=$count plural=true}
{else}
{lang "{$smarty.local.titleNoComments|default:'comments.no_comments'}"}
{lang "{$titleNoComments|default:'comments.no_comments'}"}
{/if}
</h3>
{* @hook Конец шапки *}
{hook run='comments_header_end' params=$smarty.local.params}
{hook run='comments_header_end' params=$params}
</header>
@ -92,7 +87,7 @@
{/if}
{* Подписка на комментарии *}
{if $smarty.local.useSubscribe && $oUserCurrent}
{if $useSubscribe && $oUserCurrent}
{$items[] = [ 'buttons' => [[
'classes' => "{$component}-subscribe js-comments-subscribe {if $isSubscribed}active{/if}",
'text' => ( $isSubscribed ) ? $aLang.comments.unsubscribe : $aLang.comments.subscribe
@ -104,24 +99,24 @@
{/if}
{* @hook Хук перед списком комментариев *}
{hook run='comments_list_before' params=$smarty.local.params}
{hook run='comments_list_before' params=$params}
{**
* Комментарии
*}
<div class="ls-comment-list js-comment-list" {if ! $smarty.local.comments}style="display: none"{/if}>
<div class="ls-comment-list js-comment-list" {if ! $comments}style="display: none"{/if}>
{component 'comment' template='tree'
comments = $smarty.local.comments
comments = $comments
forbidAdd = $forbidAdd
maxLevel = $maxLevel
authorid = $smarty.local.authorid
authorText = $smarty.local.authorText
dateReadLast = $smarty.local.dateReadLast
commentParams = $smarty.local.commentParams}
authorid = $authorid
authorText = $authorText
dateReadLast = $dateReadLast
commentParams = $commentParams}
</div>
{* @hook Хук после списка комментариев *}
{hook run='comments_list_after' params=$smarty.local.params}
{hook run='comments_list_after' params=$params}
{**
@ -136,14 +131,14 @@
{* Проверяем запрещено комментирование или нет *}
{if $forbidAdd}
{component 'alert' mods='info' text=$smarty.local.forbidText}
{component 'alert' mods='info' text=$forbidText}
{* Если разрешено то показываем форму добавления комментария *}
{else}
{if $oUserCurrent}
{* Кнопка открывающая форму *}
<h4 class="ls-comment-reply-root js-comment-reply js-comment-reply-root" data-id="0">
<a href="#" class="ls-link-dotted">{$smarty.local.addCommentText|default:$aLang.comments.form.title}</a>
<a href="#" class="ls-link-dotted">{$addCommentText|default:$aLang.comments.form.title}</a>
</h4>
{else}
{component 'alert' mods='info' text=$aLang.comments.alerts.unregistered}
@ -156,5 +151,5 @@
{/if}
{* @hook Конец блока с комментариями *}
{hook run='comments_end' params=$smarty.local.params}
{hook run='comments_end' params=$params}
</div>

View file

@ -3,8 +3,10 @@
* Кнопка обновления комментариев
*}
{component_define_params params=[ 'mods', 'classes', 'attributes' ]}
{component 'toolbar' template='item'
classes = "{$smarty.local.classes} js-comments-toolbar"
classes = "{$classes} js-comments-toolbar"
mods = 'comments'
buttons = [
[

View file

@ -1,5 +1,5 @@
{block 'media_pane_options'}
{$id = $smarty.local.id}
{component_define_params params=[ 'id' ]}
{/block}
<div class="ls-media-pane-content js-media-pane-content">

View file

@ -4,6 +4,8 @@
* @param boolean $useSizes
*}
{component_define_params params=[ 'useSizes' ]}
{capture 'block_content'}
<form method="post" action="" enctype="multipart/form-data">
{* Выравнивание *}
@ -18,7 +20,7 @@
]}
{* Размер *}
{if $smarty.local.useSizes|default:true}
{if $useSizes|default:true}
{component 'field' template='select'
name = 'size'
label = {lang name='media.insert.settings.fields.size.label'}

View file

@ -1,10 +1,12 @@
{extends 'Component@uploader.uploader'}
{block 'uploader_options' append}
{component_define_params params=[ 'targetType', 'targetId', 'targetTmp' ]}
{$attributes = array_merge( $attributes|default:[], [
'data-param-target_type' => {json var=$smarty.local.targetType},
'data-param-target_id' => {json var=$smarty.local.targetId},
'data-param-target_tmp' => {json var=$smarty.local.targetTmp}
'data-param-target_type' => {json var=$targetType},
'data-param-target_id' => {json var=$targetId},
'data-param-target_tmp' => {json var=$targetTmp}
])}
{/block}

View file

@ -5,7 +5,9 @@
* @param string $targetType
*}
<div class="fieldset ls-poll-manage js-poll-manage" data-type="{$smarty.local.targetType}" data-target-id="{$smarty.local.targetId}">
{component_define_params params=[ 'targetId', 'targetType' ]}
<div class="fieldset ls-poll-manage js-poll-manage" data-type="{$targetType}" data-target-id="{$targetId}">
<header class="fieldset-header">
<h3 class="fieldset-title">{$aLang.poll.polls}</h3>
</header>
@ -16,8 +18,8 @@
{* Список добавленных опросов *}
{insert name="block" block="pollFormItems" params=[
'target_type' => $smarty.local.targetType,
'target_id' => $smarty.local.targetId
'target_type' => $targetType,
'target_id' => $targetId
]}
</div>
</div>

View file

@ -2,6 +2,8 @@
* Вывод дополнительных полей для ввода данных на странице создания нового объекта
*}
{foreach $smarty.local.properties as $property}
{component_define_params params=[ 'properties' ]}
{foreach $properties as $property}
{component 'property' template='input.item' property=$property}
{/foreach}

View file

@ -1,4 +1,4 @@
{$property = $smarty.local.property}
{component_define_params params=[ 'property' ]}
{if $property}
{* Проверяем наличие кастомного шаблона item.[type].[target_type].tpl *}

View file

@ -1,6 +1,8 @@
{if $smarty.local.properties}
{component_define_params params=[ 'properties' ]}
{if $properties}
<div class="ls-property-list">
{foreach $smarty.local.properties as $property}
{foreach $properties as $property}
{component 'property' template='output.item' property=$property}
{/foreach}
</div>

View file

@ -4,8 +4,9 @@
* @param array $users
*}
{component_define_params params=[ 'users' ]}
{component 'user-list-add'
users = $smarty.local.users
title = $aLang.talk.blacklist.title
note = $aLang.talk.blacklist.note
classes = 'js-user-list-add-blacklist'}

View file

@ -5,6 +5,8 @@
{extends 'component@user-list-add.item'}
{block 'user_list_add_item_options' append}
{component_define_params params=[ 'editable' ]}
{if $userContainer && $userContainer->getUserActive() != $TALK_USER_ACTIVE}
{$classes = "$classes inactive"}
{$attributes = [ 'title' => {lang 'talk.users.inactive'} ]}
@ -12,7 +14,7 @@
{/block}
{block 'user_list_add_item_actions'}
{if $smarty.local.editable|default:true && $user->getId() != $oUserCurrent->getId()}
{if $editable|default:true && $user->getId() != $oUserCurrent->getId()}
<li class="js-message-users-user-inactivate ls-talk-participants-item-inactivate" title="{$aLang.common.remove}" data-user-id="{$userId}">
{component 'icon' icon='minus'}
</li>

View file

@ -5,11 +5,13 @@
{extends 'Component@user-list-add.user-list-add'}
{block 'user_list_add_list'}
{component_define_params params=[ 'users' ]}
{component 'talk' template='participants-list'
hideableEmptyAlert = true
users = $smarty.local.users
users = $users
showActions = true
show = !! $smarty.local.users
show = !! $users
classes = "js-$component-users"
itemClasses = "js-$component-user"}
{/block}

View file

@ -6,15 +6,17 @@
* @param boolean $paging
*}
{component_define_params params=[ 'talks', 'selectable' ]}
<div class="js-talk-list">
{if $smarty.local.talks}
{if $talks}
<form action="{router page='talk'}" method="post" id="talk-form">
{* Скрытые поля *}
{component 'field' template='hidden.security-key'}
{component 'field' template='hidden' name='form_action' id='talk-form-action'}
{* Экшнбар *}
{if $smarty.local.selectable}
{if $selectable}
{component 'actionbar' template='item.select'
classes = 'js-talk-actionbar-select'
target = '.js-talk-list-item'
@ -40,7 +42,7 @@
{* Список сообщений *}
<table class="ls-table talk-list">
<tbody>
{foreach $smarty.local.talks as $talk}
{foreach $talks as $talk}
{* Создатель диалога *}
{$author = $talk->getTalkUser()}
@ -52,7 +54,7 @@
<tr class="talk-list-item {if $author->getCommentCountNew() or ! $author->getDateLast()}talk-unread{/if} js-talk-list-item" data-id="{$talk->getId()}">
{* Выделение *}
{if $smarty.local.selectable}
{if $selectable}
<td class="cell-checkbox">
<input type="checkbox" name="talk_select[{$talk->getId()}]" data-id="{$talk->getId()}" />
</td>

View file

@ -6,7 +6,7 @@
* @param array $lastCommentId
*}
{$talk = $smarty.local.talk}
{component_define_params params=[ 'talk', 'comments', 'lastCommentId' ]}
{* Первое сообщение *}
{component 'talk' template='message-root' talk=$talk}
@ -29,13 +29,13 @@
{if $activeParticipantsCount || $comments}
{* Вывод комментариев к сообщению *}
{component 'comment' template='comments'
comments = $smarty.local.comments
comments = $comments
classes = 'js-comments-talk'
attributes = [ 'id' => 'comments' ]
targetId = $talk->getId()
targetType = 'talk'
count = $talk->getCountComment()
dateReadLast = $talk->getTalkUser()->getDateLast()
lastCommentId = $smarty.local.lastCommentId
lastCommentId = $lastCommentId
forbidText = $aLang.talk.notices.deleted}
{/if}

View file

@ -2,6 +2,8 @@
* Теги
*}
{component_define_params params=[ 'tags', 'tagsUser' ]}
{component 'block'
title = {lang 'tags.block_tags.title'}
classes = 'js-block-default'
@ -10,11 +12,11 @@
'tabs' => [
[
'text' => {lang 'tags.block_tags.nav.all'},
'content' => {component 'tags' template='cloud' tags=$smarty.local.tags}
'content' => {component 'tags' template='cloud' tags=$tags}
],
[
'text' => {lang 'tags.block_tags.nav.favourite'},
'content' => {component 'tags' template='cloud' tags=$smarty.local.tagsUser},
'content' => {component 'tags' template='cloud' tags=$tagsUser},
'is_enabled' => !! $oUserCurrent
]
]

View file

@ -7,12 +7,12 @@
* @param array $blogId
*}
{$topic = $smarty.local.topic}
{$type = $smarty.local.type}
{component_define_params params=[ 'topic', 'type', 'skipBlogs', 'blogs' ]}
{block 'add_topic_options'}{/block}
{hook run="add_topic_begin"}
{block 'add_topic_header_after'}{/block}
@ -22,12 +22,12 @@
{* Выбор блога *}
{if ! $smarty.local.skipBlogs}
{if ! $skipBlogs}
{$blogsSelect = []}
{$blogsSelectId = []}
{$blogsSelectedId=[]}
{foreach $smarty.local.blogs as $blogType => $blogs}
{foreach $blogs as $blogType => $blogs}
{$blogsSelectOptions = []}
{foreach $blogs as $blog}

View file

@ -5,8 +5,7 @@
* @param array $paging
*}
{$topics = $smarty.local.topics}
{$paging = $smarty.local.paging}
{component_define_params params=[ 'topics', 'paging' ]}
{if $topics}
{add_block group='toolbar' name='component@toolbar-scrollnav.toolbar.scrollnav' show=count( $topics )}

View file

@ -8,10 +8,10 @@
*}
{$component = 'ls-topic'}
{component_define_params params=[ 'topic', 'isPreview', 'isList', 'mods', 'classes', 'attributes' ]}
{component_define_params params=[ 'type', 'topic', 'isPreview', 'isList', 'mods', 'classes', 'attributes' ]}
{$user = $topic->getUser()}
{$type = ($topic->getType()) ? $topic->getType() : $smarty.local.type}
{$type = ($topic->getType()) ? $topic->getType() : $type}
{if ! $isList}
{$mods = "{$mods} single"}

View file

@ -1,16 +1,18 @@
{extends 'component@user.user-list-small-item'}
{block 'user_list_small_item_options' append}
{component_define_params params=[ 'showActions', 'showRemove' ]}
{block 'user_list_add_item_options'}{/block}
{/block}
{block 'user_list_small_item_content' append}
{block 'user_list_add_item_content'}
{* Действия *}
{if $smarty.local.showActions}
{if $showActions}
<ul class="{$component}-actions js-user-list-small-actions">
{block 'user_list_add_item_actions'}
{if $smarty.local.showRemove|default:true}
{if $showRemove|default:true}
<li class="js-user-list-add-user-remove" title="{$aLang.common.remove}" data-user-id="{$userId}">
{component 'icon' icon='remove'}
</li>

View file

@ -4,7 +4,7 @@
* @param object $user
*}
{$user = $smarty.local.user}
{component_define_params params=[ 'user' ]}
{component 'nav'
hook = 'user_actions'

View file

@ -6,6 +6,8 @@
* @param array $emptyText
*}
{component_define_params params=[ 'size' ]}
{$items = []}
{foreach $users as $user}
@ -15,6 +17,6 @@
{$items[] = {component 'user' template='avatar' size=$smarty.local.size|default:'small' user=$user}}
{/foreach}
{component 'avatar' template='list' items=$items params=$smarty.local.params}
{component 'avatar' template='list' items=$items params=$params}
{component 'pagination' total=+$pagination.iCountPage current=+$pagination.iCurrentPage url="{$pagination.sBaseUrl}/page__page__/"}

View file

@ -7,6 +7,8 @@
* @param array $mods
*}
{component_define_params params=[ 'user', 'size' ]}
{$sizes = [
'large' => 200,
'default' => 100,
@ -16,11 +18,9 @@
'text' => 18
]}
{$user = $smarty.local.user}
{component 'avatar'
image = $user->getProfileAvatarPath( $sizes[ $smarty.local.size|default:'default' ] )
image = $user->getProfileAvatarPath( $sizes[ $size|default:'default' ] )
url = $user->getUserWebPath()
classes = 'user-item'
name = $user->getDisplayName()
params = $smarty.local.params}
params = $params}

View file

@ -3,14 +3,10 @@
*}
{$component = 'user-friend'}
{component_define_params params=[ 'friendship', 'tag', 'userTarget', 'mods', 'classes', 'attributes' ]}
{block 'user_friend_options'}
{$friendship = $smarty.local.friendship}
{$tag = $smarty.local.tag|default:'li'}
{$mods = $smarty.local.mods}
{$attributes = $smarty.local.attributes}
{$classes = $smarty.local.classes}
{$userTarget = $smarty.local.userTarget}
{$tag = $tag|default:'li'}
{if $friendship}
{$status = $friendship->getFriendStatus()}
@ -47,7 +43,7 @@
{/block}
<{$tag} class="{$component} {cmods name=$component mods=$mods} {$smarty.local.classes}" {cattr list=$smarty.local.attributes} data-status="{$status}" data-target="{$userTarget->getId()}">
<{$tag} class="{$component} {cmods name=$component mods=$mods} {$classes}" {cattr list=$attributes} data-status="{$status}" data-target="{$userTarget->getId()}">
{block 'user_friend'}
{if in_array( $status, [ 'sent', 'rejected' ] )}
<span class="{$component}-text js-user-friend-text">{lang name="user.friends.status.{$status}"}</span>

View file

@ -3,9 +3,7 @@
*}
{$component = 'user-profile'}
{$user = $smarty.local.user}
{$mods = $smarty.local.mods}
{component_define_params params=[ 'user', 'mods', 'classes', 'attributes' ]}
{if $user->getProfileName()}
{$mods = "{$mods} has-name"}
@ -15,7 +13,7 @@
{$mods = "{$mods} is-online"}
{/if}
<div class="{$component} {cmods name=$component mods=$mods} {$smarty.local.classes} ls-clearfix" {cattr list=$smarty.local.attributes}>
<div class="{$component} {cmods name=$component mods=$mods} {$classes} ls-clearfix" {cattr list=$attributes}>
{* @hook Начало шапки с информацией о пользователе *}
{hook run='user_header_begin' user=$user}

View file

@ -3,27 +3,28 @@
*}
{$component = 'user-info-group'}
{component_define_params params=[ 'html', 'items', 'name', 'title', 'mods', 'classes', 'attributes' ]}
{hook run="{$component}-{$smarty.local.name}-before"}
{hook run="{$component}-{$name}-before"}
{* Получаем пункты установленные плагинами *}
{hook run="{$component}-{$smarty.local.name}-items" assign='itemsHook' items=$smarty.local.items array=true}
{$items = $itemsHook|default:$smarty.local.items}
{hook run="{$component}-{$name}-items" assign='itemsHook' items=$items array=true}
{$items = $itemsHook|default:$items}
{if $smarty.local.html || $smarty.local.items}
<div class="{$component} {cmods name=$component mods=$smarty.local.mods} {$smarty.local.classes}" {cattr list=$smarty.local.attributes}>
{if $html || $items}
<div class="{$component} {cmods name=$component mods=$mods} {$classes}" {cattr list=$attributes}>
<h3 class="user-info-group-title">
{$smarty.local.title}
{$title}
</h3>
<div class="user-info-group-content">
{if $smarty.local.html}
{$smarty.local.html}
{if $html}
{$html}
{else}
{component 'info-list' list=$smarty.local.items classes='user-info-group-items'}
{component 'info-list' list=$items classes='user-info-group-items'}
{/if}
</div>
</div>
{/if}
{hook run="{$component}-{$smarty.local.name}-after"}
{hook run="{$component}-{$name}-after"}

View file

@ -11,7 +11,8 @@
* @param array usersFriend
*}
{$user = $smarty.local.user}
{component_define_params params=[ 'blogsAdminister', 'blogsCreated', 'blogsJoined', 'blogsModerate', 'friends', 'invitedByUser', 'user', 'usersInvited', 'mods', 'classes', 'attributes' ]}
{$session = $user->getSession()}
{$geoTarget = $user->getGeoTarget()}
@ -116,7 +117,7 @@
{$items = []}
{* Кто пригласил пользователя *}
{if $smarty.local.invitedByUser}
{if $invitedByUser}
{$items[] = [
'label' => {lang name='user.profile.activity.invited_by'},
'content' => "<a href=\"{$invitedByUser->getUserWebPath()}\">{$invitedByUser->getDisplayName()}</a>"
@ -124,10 +125,10 @@
{/if}
{* Приглашенные пользователем *}
{if $smarty.local.usersInvited}
{if $usersInvited}
{$users = ''}
{foreach $smarty.local.usersInvited as $userInvited}
{foreach $usersInvited as $userInvited}
{$users = $users|cat:"<a href=\"{$userInvited->getUserWebPath()}\">{$userInvited->getDisplayName()}</a>&nbsp;"}
{/foreach}
@ -138,10 +139,10 @@
{/if}
{* Блоги созданные пользователем *}
{if $smarty.local.blogsCreated}
{if $blogsCreated}
{$blogs = ''}
{foreach $smarty.local.blogsCreated as $blog}
{foreach $blogsCreated as $blog}
{$blogs = $blogs|cat:"<a href=\"{$blog->getUrlFull()}\">{$blog->getTitle()|escape}</a>{if ! $blog@last}, {/if}"}
{/foreach}
@ -152,10 +153,10 @@
{/if}
{* Блоги администрируемые пользователем *}
{if $smarty.local.blogsAdminister}
{if $blogsAdminister}
{$blogs = ''}
{foreach $smarty.local.blogsAdminister as $blogUser}
{foreach $blogsAdminister as $blogUser}
{$blog = $blogUser->getBlog()}
{$blogs = $blogs|cat:"<a href=\"{$blog->getUrlFull()}\">{$blog->getTitle()|escape}</a>{if ! $blogUser@last}, {/if}"}
{/foreach}
@ -167,10 +168,10 @@
{/if}
{* Блоги модерируемые пользователем *}
{if $smarty.local.blogsModerate}
{if $blogsModerate}
{$blogs = ''}
{foreach $smarty.local.blogsModerate as $blogUser}
{foreach $blogsModerate as $blogUser}
{$blog = $blogUser->getBlog()}
{$blogs = $blogs|cat:"<a href=\"{$blog->getUrlFull()}\">{$blog->getTitle()|escape}</a>{if ! $blogUser@last}, {/if}"}
{/foreach}
@ -182,10 +183,10 @@
{/if}
{* Блоги в которые вступил пользователь *}
{if $smarty.local.blogsJoined}
{if $blogsJoined}
{$blogs = ''}
{foreach $smarty.local.blogsJoined as $blogUser}
{foreach $blogsJoined as $blogUser}
{$blog = $blogUser->getBlog()}
{$blogs = $blogs|cat:"<a href=\"{$blog->getUrlFull()}\">{$blog->getTitle()|escape}</a>{if ! $blogUser@last}, {/if}"}
{/foreach}
@ -215,9 +216,9 @@
{**
* Друзья
*}
{if $smarty.local.friends}
{if $friends}
{capture 'user_info_friends'}
{component 'user' template='avatar-list' users=$smarty.local.friends}
{component 'user' template='avatar-list' users=$friends}
{/capture}
{component 'user' template='info-group'

View file

@ -4,6 +4,8 @@
* @param array $users
*}
{foreach $smarty.local.users as $user}
{component_define_params params=[ 'users' ]}
{foreach $users as $user}
{component 'user' template='list-item' user=$user}
{/foreach}

View file

@ -8,25 +8,20 @@
* @param string $textEmpty
*}
{if $smarty.local.users}
{$pagination = $smarty.local.pagination}
{component_define_params params=[ 'users', 'pagination', 'users', 'useMore', 'hideMore', 'textEmpty' ]}
{if $users}
{* Список пользователей *}
{component 'item' template='group'
classes = 'js-more-users-container'
items = {component 'user' template='list-loop' users=$smarty.local.users}}
{component 'item.group' classes='js-more-users-container' items={component 'user' template='list-loop' users=$users}}
{* Кнопка подгрузки *}
{if $smarty.local.useMore}
{if ! $smarty.local.hideMore}
{component 'more'
classes = 'js-more-search'
target = '.js-more-users-container'
ajaxParams = [ 'next_page' => 2 ]}
{if $useMore}
{if ! $hideMore}
{component 'more' classes='js-more-search' target='.js-more-users-container' ajaxParams=[ 'next_page' => 2 ]}
{/if}
{else}
{component 'pagination' total=+$pagination.iCountPage current=+$pagination.iCurrentPage url="{$pagination.sBaseUrl}/page__page__/"}
{/if}
{else}
{component 'blankslate' text=$smarty.local.textEmpty|default:{lang name='user.notices.empty'}}
{component 'blankslate' text=$textEmpty|default:{lang name='user.notices.empty'}}
{/if}

View file

@ -3,12 +3,13 @@
*
* @param array $users
* @param boolean $selectable
* @param string $target
*}
{component_define_params params=[ 'users', 'selectable' ]}
{capture 'modal_content'}
{* Экшнбар *}
{if $smarty.local.users && $smarty.local.selectable}
{if $users && $selectable}
{component 'actionbar' template='item.select'
classes = 'js-user-list-modal-actionbar'
target = '.js-user-list-select .js-user-list-small-item'
@ -19,8 +20,8 @@
{* Список *}
{component 'user' template='list-small'
users = $smarty.local.users
selectable = $smarty.local.selectable
users = $users
selectable = $selectable
showEmpty = true
classes = 'js-user-list-select'}
{/capture}
@ -31,7 +32,7 @@
classes = 'js-modal-default'
mods = 'users-select'
id = 'modal-users-select'
primaryButton = ( $smarty.local.users && $smarty.local.selectable ) ? [
primaryButton = ( $users && $selectable ) ? [
'text' => {lang 'common.add'},
'classes' => 'js-user-list-select-add',
'form' => 'form-complaint-user'

View file

@ -2,7 +2,7 @@
* Настройки аккаунта (емэйл, пароль)
*}
{$user = $smarty.local.user}
{component_define_params params=[ 'user' ]}
{hook run='settings_account_begin'}

View file

@ -2,12 +2,11 @@
* Настройки профиля
*}
{$user = $smarty.local.user}
{component_define_params params=[ 'user' ]}
{* @hook Начало формы с настройками профиля *}
{hook run='user_settings_profile_begin'}
{* Шаблон пользовательского поля (userfield) *}
{function name=userfield}
<div class="ls-mb-15 js-user-field-item" {if ! $field}id="user-field-template" style="display:none;"{/if}>

View file

@ -24,4 +24,4 @@
isMultiple = true
placeholder = " "
note = $smarty.capture.user_field_choose
params = $smarty.local.params}
params = $params}

View file

@ -12,17 +12,15 @@
*}
{$component = 'user-list-small-item'}
{component_define_params params=[ 'selectable', 'user', 'mods', 'classes', 'attributes' ]}
{block 'user_list_small_item_options'}
{$classes = $smarty.local.classes}
{$attributes = $smarty.local.attributes}
{$user = $smarty.local.user}
{$userId = $user->getId()}
{/block}
<li class="{$component} js-user-list-small-item {$classes}" data-user-id="{$userId}" {cattr list=$attributes}>
{* Чекбокс *}
{if $smarty.local.selectable}
{if $selectable}
<input type="checkbox" class="js-user-list-small-checkbox" data-user-id="{$userId}" data-user-login="{$user->getLogin()}" />
{/if}

View file

@ -8,19 +8,17 @@
* @param boolean $selectable
* @param array $exclude
* @param string $itemTemplate
* @param string $classes
*}
{$users = $smarty.local.users}
{$classes = $smarty.local.classes}
{component_define_params params=[ 'exclude', 'hideableEmptyAlert', 'selectable', 'show', 'title', 'users', 'mods', 'classes', 'attributes' ]}
{* Заголовок *}
{if $smarty.local.title}
<h3 class="user-list-small-title">{$smarty.local.title}</h3>
{if $title}
<h3 class="user-list-small-title">{$title}</h3>
{/if}
{* Уведомление о пустом списке *}
{if ! $users || $smarty.local.hideableEmptyAlert}
{if ! $users || $hideableEmptyAlert}
{component 'blankslate'
text = $aLang.common.empty
classes = 'js-user-list-small-empty'
@ -28,8 +26,8 @@
{/if}
{* Список пользователей *}
{if $users || ! $smarty.local.show|default:true}
<ul class="user-list-small js-user-list-small {$classes}" {if ! $smarty.local.show|default:true}style="display: none"{/if}>
{if $users || ! $show|default:true}
<ul class="user-list-small js-user-list-small {$classes}" {if ! $show|default:true}style="display: none"{/if}>
{foreach $users as $user}
{$userContainer = $user}
@ -37,10 +35,10 @@
{$user = $user->getUser()}
{/if}
{if ! $smarty.local.exclude || ! in_array( $user->getId(), $smarty.local.exclude )}
{if ! $exclude || ! in_array( $user->getId(), $exclude )}
{block 'user_list_small_item'}
{*include $itemTemplate|default:'./user-list-small-item.tpl' showRemove=! $excludeRemove || ! in_array( $user->getId(), $aUserListSmallExcludeRemove )*}
{component 'user' template='list-small-item' user=$user selectable=$smarty.local.selectable}
{component 'user' template='list-small-item' user=$user selectable=$selectable}
{/block}
{/if}
{/foreach}