1
0
Fork 0
mirror of https://github.com/Oreolek/ifhub.club.git synced 2024-07-05 07:54:24 +03:00
ifhub.club/application/frontend/components/poll/poll.vote.tpl
2015-10-27 16:02:57 +07:00

38 lines
1.6 KiB
Smarty

{**
* Форма голосования
*
* @param ModulePoll_EntityPoll $poll Опрос
*}
{* Тип голосования *}
{* Если можно выбрать больше одного варианта, то показываем чекбоксы, иначе радио-кнопки *}
{$type = ( $poll->getCountAnswerMax() > 1 ) ? 'checkbox' : 'radio'}
{* Форма *}
<form method="post" class="js-poll-vote-form">
{* Список ответов *}
<ul class="ls-poll-answer-list">
{foreach $poll->getAnswers() as $answer}
<li class="ls-poll-answer-list-item js-poll-answer-list-item" data-answer-id="{$answer->getId()}">
{component 'field' template=$type
name = 'answers[]'
value = $answer->getId()
label = $answer->getTitle()
classes = 'js-poll-answer-$type'}
</li>
{/foreach}
</ul>
{component 'field' template='hidden' name='id' value=$poll->getId()}
{if $oUserCurrent or $poll->getIsGuestAllow()}
{* Проголосовать *}
{component 'button' text=$aLang.poll.vote type='button' mods='primary' classes='js-poll-vote'}
{* Воздержаться *}
{component 'button' text=$aLang.poll.abstain type='button' classes='js-poll-abstain'}
{else}
{* Предупрежение: голосовать могут только авторизованные пользователи *}
{component 'alert' mods='info' text=$aLang.poll.only_auth}
{/if}
</form>