<?php
/* @var $this MenuItemController */
/* @var $model MenuItem */
$this->breadcrumbs = array(
    'Menus' => array('menu/admin'),
    'Manage',
);
Yii::app()->clientScript->registerScript('search', "
$('.search-button').click(function(){
	$('.search-form').toggle();
	return false;
});
$('.search-form form').submit(function(){
	$('#slider-grid').yiiGridView('update', {
		data: $(this).serialize()
	});
	return false;
});
");
?>
<div class="page-header">
    <h1>
        Manage Menu Items
        <small>
            <i class="icon-double-angle-right"></i>
            <?php echo $model->menu->title; ?>
        </small>
        <?php echo CHtml::link(Yii::t('admin', 'Create Menu Item'), array('create', 'menu_id' => $_GET['menu_id']), array('class' => 'btn btn-sm btn-primary pull-right')); ?>
    </h1>
</div>
<?php
$this->widget('ext.widgets.FGridView', array(
    'id' => 'menu-item-grid',
    'dataProvider' => $model->search(),
    'filter' => $model,
    'columns' => array(
        array(
            'name' => 'id',
            'htmlOptions' => array('style' => 'width:50px;'),
        ),
        array(
            'name' => 'title',
            'value' => 'CHtml::link($data->title,array("update","id" => $data->id, "menu_id" => $data->menu_id))',
            'type' => 'raw',
        ),
        'link',
//                'order',
        array(
            'name' => 'visible',
            'value' => '$data->visible==0? Yii::t("admin", "NO") : Yii::t("admin", "YES")',
            'filter' => array(0 => Yii::t('admin', 'NO'), 1 => Yii::t('admin', 'YES')),
        ),
       // array('name'=>'image', 'value'=>'CHtml::image(Yii::app()->request->baseUrl."/uploads/MenuItem/". $data->image,"",array("class"=>"img-responsive"))','type'=>'html'),
        
          'menu_id',
          'parent_id',
		  'sort',
         
        array(
            'class' => 'CButtonColumn',
            'template' => '{update} {delete}',
            'updateButtonUrl' => 'Yii::app()->controller->createUrl("update", array("id" => $data->id, "menu_id" => $data->menu_id))',
        ),

    ),
));
echo '<h3>' . Yii::t('admin', 'Preview:') . '</h3><hr/>';
$this->widget('CMenuWidget', array('options' => array('model_id' => $model->menu_id)));
echo "</hr>";
?>
<!-- Modal -->
<div id="full-width" class="modal container hide" tabindex="-1">
    <div class="modal-header">
        <a type="button" data-dismiss="modal" href="#" class="btn-link"><i class="icon icon-remove"></i></a>
    </div>
    <div class="modal-body">
        <div class="loading"></div>
    </div>
    <div class="modal-footer">
    </div>
</div><!-- Modal -->