1
0
Fork 0
mirror of https://github.com/Oreolek/ifhub.club.git synced 2024-06-01 07:38:11 +03:00
ifhub.club/application/frontend/components/topic/topic-add.tpl

182 lines
6.4 KiB
Smarty
Raw Normal View History

2014-07-28 19:55:18 +03:00
{**
* Базовая форма создания топика
*
* @param object $topic
* @param object $type
* @param array $blogs
* @param array $blogId
2014-07-28 19:55:18 +03:00
*}
{$topic = $smarty.local.topic}
{$type = $smarty.local.type}
{block 'add_topic_options'}{/block}
2014-07-28 19:55:18 +03:00
{hook run="add_topic_begin"}
{block 'add_topic_header_after'}{/block}
2014-07-28 19:55:18 +03:00
<form action="" method="POST" enctype="multipart/form-data" id="topic-add-form" class="js-form-validate" data-content-action="{( $topic ) ? 'edit' : 'add'}">
{hook run="form_add_topic_begin"}
{block 'add_topic_form_begin'}{/block}
2014-07-28 19:55:18 +03:00
{* Выбор блога *}
{if ! $smarty.local.skipBlogs}
{$blogsSelect = []}
{foreach $smarty.local.blogs as $blogType => $blogs}
{$blogsSelectOptions = []}
{foreach $blogs as $blog}
{$blogsSelectOptions[] = [
'text' => $blog->getTitle()|escape,
'value' => $blog->getId()
]}
{/foreach}
{$blogsSelect[] = [
'text' => {lang "blog.types.{$blogType}"},
'value' => $blogsSelectOptions
]}
{/foreach}
{component 'field' template='select'
label = $aLang.topic.add.fields.blog.label
name = ''
placeholder = 'Выберите блоги для публикации'
inputClasses = 'js-topic-add-blogs'
isMultiple = true
selectedValue = ( ( $topic ) ? $topic->getBlogsId() : [] )
inputAttributes = [ 'data-chosen-order' => {json var=$topic->getBlogsId()} ]
items = $blogsSelect}
{/if}
2014-07-28 19:55:18 +03:00
{* Заголовок топика *}
{component 'field' template='text'
name = 'topic[topic_title]'
value = {(( $topic ) ? $topic->getTitle() : '')|escape}
entityField = 'topic_title'
entity = 'ModuleTopic_EntityTopic'
label = $aLang.topic.add.fields.title.label}
2014-07-28 19:55:18 +03:00
{block 'add_topic_form_text_before'}{/block}
2014-07-28 19:55:18 +03:00
{* Текст топика *}
{if $type->getParam('allow_text')}
{component 'editor'
name = 'topic[topic_text_source]'
value = (( $topic ) ? $topic->getTextSource() : '')|escape
label = $aLang.topic.add.fields.text.label
entityField = 'topic_text_source'
entity = 'ModuleTopic_EntityTopic'
inputClasses = 'js-editor-default'
mediaTargetType = 'topic'
mediaTargetId = ( $topic ) ? $topic->getId() : ''}
{/if}
2014-07-28 19:55:18 +03:00
{block 'add_topic_form_text_after'}{/block}
2014-07-28 19:55:18 +03:00
{* Теги *}
{if $type->getParam('allow_tags')}
{component 'field' template='text'
name = 'topic[topic_tags]'
value = {(( $topic ) ? $topic->getTags() : '')|escape}
rules = [ 'required' => true, 'rangetags' => '[1,15]' ]
label = {lang 'topic.add.fields.tags.label'}
note = {lang 'topic.add.fields.tags.note'}
inputClasses = 'width-full autocomplete-tags-sep'}
{/if}
2014-07-28 19:55:18 +03:00
{* Показывает дополнительные поля *}
{insert name='block' block='propertyUpdate' params=[
'target' => $topic,
'entity' => 'ModuleTopic_EntityTopic',
'target_type' => "topic_{$type->getCode()}"
]}
2014-07-28 19:55:18 +03:00
{* Выбор превью *}
{if $type->getParam('allow_preview')}
{component 'field' template='image-ajax'
label = 'Превью'
modalTitle = 'Выбор превью для топика'
targetType = 'topic'
targetId = ( $topic ) ? $topic->getId() : ''
classes = 'js-topic-add-field-image-preview'}
{/if}
{* Вставка опросов *}
{if $type->getParam('allow_poll')}
{component 'poll' template='manage'
targetType = 'topic'
targetId = ( $topic ) ? $topic->getId() : ''}
{/if}
2014-07-28 19:55:18 +03:00
{* Запретить комментарии *}
{component 'field' template='checkbox'
name = 'topic[topic_forbid_comment]'
checked = {( $topic && $topic->getForbidComment() ) ? true : false }
note = $aLang.topic.add.fields.forbid_comments.note
label = $aLang.topic.add.fields.forbid_comments.label}
2014-07-28 19:55:18 +03:00
{* Принудительный вывод топиков на главную (доступно только админам) *}
{if $oUserCurrent->isAdministrator()}
{component 'field' template='checkbox'
name = 'topic[topic_publish_index]'
checked = {($topic && $topic->getPublishIndex()) ? true : false }
note = $aLang.topic.add.fields.publish_index.note
label = $aLang.topic.add.fields.publish_index.label}
{component 'field' template='checkbox'
name = 'topic[topic_skip_index]'
checked = {($topic && $topic->getSkipIndex()) ? true : false }
note = $aLang.topic.add.fields.skip_index.note
label = $aLang.topic.add.fields.skip_index.label}
{/if}
2014-07-28 19:55:18 +03:00
{block 'add_topic_form_end'}{/block}
{hook run="form_add_topic_end"}
2014-07-28 19:55:18 +03:00
{* Скрытые поля *}
2015-01-12 17:50:04 +02:00
{component 'field' template='hidden' name='topic_type' value=$type->getCode()}
2014-07-28 19:55:18 +03:00
{if $topic}
{component 'field' template='hidden' name='topic[id]' value=$topic->getId()}
{/if}
2014-07-28 19:55:18 +03:00
{**
* Кнопки
*}
2014-07-28 19:55:18 +03:00
{* Опубликовать / Сохранить изменения *}
{component 'button'
id = {( $topic ) ? 'submit-edit-topic-publish' : 'submit-add-topic-publish' }
mods = 'primary'
classes = 'fl-r'
text = $aLang.topic.add.button[ ( $sEvent == 'add' or ( $topic && $topic->getPublish() == 0 ) ) ? 'publish' : 'update' ]}
2014-07-28 19:55:18 +03:00
{* Превью *}
{component 'button' type='button' classes='js-topic-preview-text-button' text=$aLang.common.preview_text}
2014-07-28 19:55:18 +03:00
{* Сохранить в черновиках / Перенести в черновики *}
{if ! $topic || ( $topic && $topic->getPublish() != 0 )}
{component 'button' type='button' classes='js-topic-draft-button' text=$aLang.topic.add.button[ ( $sEvent == 'add' ) ? 'save_as_draft' : 'mark_as_draft' ]}
{/if}
2014-07-28 19:55:18 +03:00
</form>
{* Блок с превью текста *}
{include './topic-preview.tpl'}
2014-07-28 19:55:18 +03:00
{block 'add_topic_end'}{/block}
2014-07-28 19:55:18 +03:00
{hook run="add_topic_end"}