<?php
/* @var $this PageController */
/* @var $model Page */
$this->breadcrumbs = array(
    'Pages' => array('admin'),
    'Manage',
);
$this->menu = array(
    array('label' => 'Create Page', 'url' => array('create')),
);
Yii::app()->clientScript->registerScript('search', "
$('.search-button').click(function(){
	$('.search-form').toggle();
	return false;
});
$('.search-form form').submit(function(){
	$('#page-grid').yiiGridView('update', {
		data: $(this).serialize()
	});
	return false;
});
");
?>
<div class="page-header"><h1>Manage Pages</h1></div>
<?php
$this->widget('ext.widgets.FGridView', array(
    'id' => 'page-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))',
            'type' => 'raw',
        ),
        'slug',
//		'content',
//  	'language',
        array(
            'name' => 'layout',
            'value' => '$data->camelToText($data->layout)',
            'filter' => $model->getLayoutFiles(),
        ),
        array(
            'header' => Yii::t('admin', 'Page Link'),
            'value' => 'CHtml::link("Page Link >",array("/page/view","slug"=>$data->slug,"lang"=> Yii::app()->options->get("I18N_MULTILINGUAL", 0) ? $data->language : NULL ),array("target"=>"_new","class"=>"btn btn-xs"));',
            'type' => 'raw',
        ),
        array(
            'class' => 'CButtonColumn',
            'template' => '{update} {delete}{delete_pdf}',

            'buttons'=>array(
			
				'delete_pdf'=>array(
					'label'=>'',
					'click'=>'function(){return confirm("are you sure to delete pdf ?");}',
					'url'=>'Yii::app()->createUrl("admin/page/delete_pdf", array("id"=>$data->id))',
					'visible'=>'$data->attachment_url != NULL ',
                    'options'=>array( 'class'=>'icon-trash','title'=>'Delete pdf' ),
				),
        ),)
    ),
));
