<?php /* Smarty version Smarty-3.0.4, created on 2020-06-02 20:15:14
         compiled from "C:/Domains/troskovnik.hr/wwwroot/manager/templates/default/resource/sections/tvs.tpl" */ ?>
<?php /*%%SmartyHeaderCode:30215ed69732a95e64-59634596%%*/if(!defined('SMARTY_DIR')) exit('no direct access allowed');
$_smarty_tpl->decodeProperties(array (
  'file_dependency' => 
  array (
    'c22ea5834393808e98097d67edf723699c774f99' => 
    array (
      0 => 'C:/Domains/troskovnik.hr/wwwroot/manager/templates/default/resource/sections/tvs.tpl',
      1 => 1311242358,
      2 => 'file',
    ),
  ),
  'nocache_hash' => '30215ed69732a95e64-59634596',
  'function' => 
  array (
  ),
  'has_nocache_code' => false,
)); /*/%%SmartyHeaderCode%%*/?>
<?php if (!is_callable('smarty_function_cycle')) include 'C:\Domains\troskovnik.hr\wwwroot/core/model/smarty/plugins\function.cycle.php';
if (!is_callable('smarty_modifier_escape')) include 'C:\Domains\troskovnik.hr\wwwroot/core/model/smarty/plugins\modifier.escape.php';
?><?php echo $_smarty_tpl->getVariable('OnResourceTVFormPrerender')->value;?>


<input type="hidden" name="tvs" value="1" />
<div id="modx-tv-tabs">
<?php  $_smarty_tpl->tpl_vars['category'] = new Smarty_Variable;
 $_from = $_smarty_tpl->getVariable('categories')->value; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array');}
if ($_smarty_tpl->_count($_from) > 0){
    foreach ($_from as $_smarty_tpl->tpl_vars['category']->key => $_smarty_tpl->tpl_vars['category']->value){
?>
<?php if (count($_smarty_tpl->getVariable('category')->value->tvs)>0){?>

    <div id="modx-tv-tab<?php echo $_smarty_tpl->getVariable('category')->value->id;?>
" class="x-tab<?php if ($_smarty_tpl->getVariable('category')->value->hidden){?>-hidden<?php }?>" title="<?php echo $_smarty_tpl->getVariable('category')->value->category;?>
">
    <?php  $_smarty_tpl->tpl_vars['tv'] = new Smarty_Variable;
 $_from = $_smarty_tpl->getVariable('category')->value->tvs; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array');}
if ($_smarty_tpl->_count($_from) > 0){
    foreach ($_from as $_smarty_tpl->tpl_vars['tv']->key => $_smarty_tpl->tpl_vars['tv']->value){
?>
<?php if ($_smarty_tpl->getVariable('tv')->value->type!="hidden"){?>
    <div class="x-form-item x-tab-item <?php echo smarty_function_cycle(array('values'=>",alt"),$_smarty_tpl);?>
 modx-tv" id="tv<?php echo $_smarty_tpl->getVariable('tv')->value->id;?>
-tr">
        <label for="tv<?php echo $_smarty_tpl->getVariable('tv')->value->id;?>
" class="modx-tv-label">

            <?php if ($_smarty_tpl->getVariable('showCheckbox')->value){?><input type="checkbox" name="tv<?php echo $_smarty_tpl->getVariable('tv')->value->id;?>
-checkbox" class="modx-tv-checkbox" value="1" /><?php }?>
            <span class="modx-tv-caption" id="tv<?php echo $_smarty_tpl->getVariable('tv')->value->id;?>
-caption"><?php echo $_smarty_tpl->getVariable('tv')->value->caption;?>
</span>
            <a class="modx-tv-reset" id="modx-tv-reset-<?php echo $_smarty_tpl->getVariable('tv')->value->id;?>
" title="<?php echo (isset($_smarty_tpl->getVariable('_lang')->value['set_to_default']) ? $_smarty_tpl->getVariable('_lang')->value['set_to_default'] : null);?>
"></a>

            <?php if ($_smarty_tpl->getVariable('tv')->value->description){?><span class="modx-tv-description"><?php echo $_smarty_tpl->getVariable('tv')->value->description;?>
</span><?php }?>
            <?php if ($_smarty_tpl->getVariable('tv')->value->inherited){?><br /><span class="modx-tv-inherited"><?php echo (isset($_smarty_tpl->getVariable('_lang')->value['tv_value_inherited']) ? $_smarty_tpl->getVariable('_lang')->value['tv_value_inherited'] : null);?>
</span><?php }?>
        </label>
        <div class="x-form-element modx-tv-form-element" style="padding-left: 200px;">
            <input type="hidden" id="tvdef<?php echo $_smarty_tpl->getVariable('tv')->value->id;?>
" value="<?php echo smarty_modifier_escape($_smarty_tpl->getVariable('tv')->value->default_text);?>
" />
            <?php echo $_smarty_tpl->getVariable('tv')->value->get('formElement');?>

        </div>

        <br class="clear" />
    </div>
    <script type="text/javascript">Ext.onReady(function() { new Ext.ToolTip({target: 'tv<?php echo $_smarty_tpl->getVariable('tv')->value->id;?>
-caption',html: '[[*<?php echo $_smarty_tpl->getVariable('tv')->value->name;?>
]]'});});</script>
<?php }else{ ?>
    <input type="hidden" id="tvdef<?php echo $_smarty_tpl->getVariable('tv')->value->id;?>
" value="<?php echo smarty_modifier_escape($_smarty_tpl->getVariable('tv')->value->default_text);?>
" />
    <?php echo $_smarty_tpl->getVariable('tv')->value->get('formElement');?>

<?php }?>
    <?php }} ?>

    </div>
<?php }?>
<?php }} ?>
</div>

<script type="text/javascript">
// <![CDATA[
Ext.onReady(function() {    
    MODx.resetTV = function(id) {
        var i = Ext.get('tv'+id);
        var d = Ext.get('tvdef'+id);
        
        if (i) {
            i.dom.value = d.dom.value;
            i.dom.checked = d.dom.value ? true : false;
        }
        var c = Ext.getCmp('tv'+id);
        if (c) {
            if (c.xtype == 'checkboxgroup' || c.xtype == 'radiogroup') {
                var cbs = d.dom.value.split(',');
                for (var i=0;i<c.items.length;i++) {
                    if (c.items.items[i]) {
                        c.items.items[i].setValue(cbs.indexOf(c.items.items[i].id) != -1);
                    }
                } 
            } else {
                c.setValue(d.dom.value);
            }
        }
        var p = Ext.getCmp('modx-panel-resource');
        if (p) {
            p.markDirty();
            p.fireEvent('tv-reset',{id:id});
        }
    };

    Ext.select('.modx-tv-reset').on('click',function(e,t,o) {
        var id = t.id.split('-');
        id = id[3];
        MODx.resetTV(id);
    });
    MODx.refreshTVs = function() {
        if (MODx.unloadTVRTE) { MODx.unloadTVRTE(); }
        Ext.getCmp('modx-panel-resource-tv').refreshTVs();
    };
    <?php if ($_smarty_tpl->getVariable('tvcount')->value>0){?>
    MODx.load({
        xtype: 'modx-tabs'
        ,applyTo: 'modx-tv-tabs'
        ,activeTab: 0
        ,autoTabs: true
        ,border: false
        ,plain: true
        ,width: Ext.getCmp('modx-panel-resource').getWidth() - 30
        ,hideMode: 'offsets'
        ,autoScroll: true
        ,defaults: {
            bodyStyle: 'padding: 5px;'
            ,autoScroll: true
            ,autoHeight: true
        }
        ,deferredRender: false
    });
    <?php }?>

    MODx.tvCounts = <?php echo $_smarty_tpl->getVariable('tvCounts')->value;?>
;
    MODx.tvMap = <?php echo $_smarty_tpl->getVariable('tvMap')->value;?>
;
    
});    
// ]]>
</script>


<?php echo $_smarty_tpl->getVariable('OnResourceTVFormRender')->value;?>


<br class="clear" />