1
0
Fork 0
mirror of https://github.com/Oreolek/ifhub.club.git synced 2024-07-01 05:55:02 +03:00
ifhub.club/application/frontend/skin/developer/blocks/block.categoryUpdate.tpl
2014-07-15 23:23:00 +07:00

34 lines
1.1 KiB
Smarty
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

{**
* Вывод категорий на странице создания нового объекта
*}
{$params = $smarty.local.params}
{$categoriesSelected = $smarty.local.categoriesSelected}
{$categories = $smarty.local.categories}
{* Получаем id выделеных категорий *}
{if $params.form_fill_current_from_request && $_aRequest[ $params.form_field ]}
{$selected = $_aRequest[ $params.form_field ]}
{elseif $categoriesSelected}
{$selected = []}
{foreach $categoriesSelected as $category}
{$selected[] = $category->getId()}
{/foreach}
{/if}
{* Формируем список категорий для select'а *}
{$items = []}
{if ! $params.validate_require}
{$items[] = [ 'value' => '', 'text' => '—' ]}
{/if}
{foreach $categories as $category}
{$entity = $category.entity}
{$items[] = [ 'value' => $entity->getId(), 'text' => $entity->getTitle(), 'level' => $category.level ]}
{/foreach}
{* Селект *}
{* TODO: i18n *}
{include 'components/field/field.select.tpl' sName="{$params.form_field}[]" aItems=$items sLabel='Категория' sSelectedValue=$selected}