1
0
Fork 0
mirror of https://github.com/Oreolek/ifhub.club.git synced 2024-07-05 16:04:24 +03:00
ifhub.club/application/frontend/skin/developer/blocks/block.categoryUpdate.tpl

27 lines
1 KiB
Smarty
Raw Normal View History

{*
Вывод категорий на странице создания нового объекта
*}
{$aCategoriesCurrentId=[]}
{if $aCategoryParams.form_fill_current_from_request && $_aRequest[$aCategoryParams.form_field]}
{$aCategoriesCurrentId=$_aRequest[$aCategoryParams.form_field]}
{else}
{if $aCategoriesCurrent}
{foreach $aCategoriesCurrent as $oCategoryCurrent}
{$aCategoriesCurrentId[]=$oCategoryCurrent->getId()}
{/foreach}
{/if}
{/if}
Категория:
<select name="{$aCategoryParams.form_field}[]" {if $aCategoryParams.multiple}multiple="multiple" style="height: 200px;"{/if}>
{if !$aCategoryParams.validate_require}
<option value="">&mdash;</option>
{/if}
{foreach $aCategories as $aCategory}
{$oCategory=$aCategory.entity}
<option value="{$oCategory->getId()}" {if in_array($oCategory->getId(),$aCategoriesCurrentId)}selected="selected"{/if} style="margin-left: {$oCategory->getLevel()*10}px;">{''|str_pad:(2*$aCategory.level):'-'|cat:$oCategory->getTitle()}</option>
{/foreach}
</select>