/**
  * Set default columns to display
  */
 protected function afterConstruct()
 {
     if (count($this->defaultColumns) == 0) {
         /*
         $this->defaultColumns[] = array(
         	'class' => 'CCheckBoxColumn',
         	'name' => 'id',
         	'selectableRows' => 2,
         	'checkBoxHtmlOptions' => array('name' => 'trash_id[]')
         );
         */
         $this->defaultColumns[] = array('header' => 'No', 'value' => '$this->grid->dataProvider->pagination->currentPage*$this->grid->dataProvider->pagination->pageSize + $row+1');
         $this->defaultColumns[] = array('name' => 'title', 'value' => '$data->url != "-" ? CHtml::link($data->title, $data->url, array(\'target\' => \'_blank\')) : $data->title', 'type' => 'raw');
         if (!isset($_GET['category'])) {
             $this->defaultColumns[] = array('name' => 'cat_id', 'value' => 'Phrase::trans($data->category_relation->name, 2)', 'filter' => BannerCategory::getCategory(), 'type' => 'raw');
         }
         /*
         $this->defaultColumns[] = array(
         	'name' => 'media',
         	'value' => '$data->media != "" ? CHtml::link($data->media, Yii::app()->request->baseUrl.\'/public/banner/\'.$data->media, array(\'target\' => \'_blank\')) : "-"',
         	'type' => 'raw',
         );
         */
         $this->defaultColumns[] = array('name' => 'click', 'value' => '$data->url != "-" ? $data->click : "-"', 'htmlOptions' => array('class' => 'center'));
         $this->defaultColumns[] = array('name' => 'published_date', 'value' => 'Utility::dateFormat($data->published_date)', 'htmlOptions' => array('class' => 'center'), 'filter' => Yii::app()->controller->widget('zii.widgets.jui.CJuiDatePicker', array('model' => $this, 'attribute' => 'published_date', 'language' => 'ja', 'i18nScriptFile' => 'jquery.ui.datepicker-en.js', 'htmlOptions' => array('id' => 'published_date_filter'), 'options' => array('showOn' => 'focus', 'dateFormat' => 'dd-mm-yy', 'showOtherMonths' => true, 'selectOtherMonths' => true, 'changeMonth' => true, 'changeYear' => true, 'showButtonPanel' => true)), true));
         $this->defaultColumns[] = array('name' => 'expired_date', 'value' => '!in_array($data->expired_date, array("0000-00-00","1970-01-01")) ? Utility::dateFormat($data->expired_date) : "Permanent"', 'htmlOptions' => array('class' => 'center'), 'filter' => Yii::app()->controller->widget('zii.widgets.jui.CJuiDatePicker', array('model' => $this, 'attribute' => 'expired_date', 'language' => 'ja', 'i18nScriptFile' => 'jquery.ui.datepicker-en.js', 'htmlOptions' => array('id' => 'expired_date_filter'), 'options' => array('showOn' => 'focus', 'dateFormat' => 'dd-mm-yy', 'showOtherMonths' => true, 'selectOtherMonths' => true, 'changeMonth' => true, 'changeYear' => true, 'showButtonPanel' => true)), true));
         /* $this->defaultColumns[] = array(
         				'name' => 'creation_search',
         				'value' => '$data->creation_relation->displayname',
         			);
         			$this->defaultColumns[] = array(
         				'name' => 'creation_date',
         				'value' => 'Utility::dateFormat($data->creation_date)',
         				'htmlOptions' => array(
         					'class' => 'center',
         				),
         				'filter' => Yii::app()->controller->widget('zii.widgets.jui.CJuiDatePicker', array(
         					'model'=>$this,
         					'attribute'=>'creation_date',
         					'language' => 'ja',
         					'i18nScriptFile' => 'jquery.ui.datepicker-en.js',
         					//'mode'=>'datetime',
         					'htmlOptions' => array(
         						'id' => 'creation_date_filter',
         					),
         					'options'=>array(
         						'showOn' => 'focus',
         						'dateFormat' => 'dd-mm-yy',
         						'showOtherMonths' => true,
         						'selectOtherMonths' => true,
         						'changeMonth' => true,
         						'changeYear' => true,
         						'showButtonPanel' => true,
         					),
         				), true),
         			); */
         if (!isset($_GET['type'])) {
             $this->defaultColumns[] = array('name' => 'publish', 'value' => 'Utility::getPublish(Yii::app()->controller->createUrl("publish",array("id"=>$data->banner_id)), $data->publish, 1)', 'htmlOptions' => array('class' => 'center'), 'filter' => array(1 => Yii::t('phrase', 'Yes'), 0 => Yii::t('phrase', 'No')), 'type' => 'raw');
         }
     }
     parent::afterConstruct();
 }
echo $form->errorSummary($model);
?>
</div>
<?php 
//begin.Messages
?>

<fieldset>

	<div class="clearfix">
		<?php 
echo $form->labelEx($model, 'cat_id');
?>
		<div class="desc">
			<?php 
$category = BannerCategory::getCategory(1);
if ($category != null) {
    echo $form->dropDownList($model, 'cat_id', $category);
} else {
    echo $form->dropDownList($model, 'cat_id', array('prompt' => 'No Parent'));
}
echo $form->error($model, 'cat_id');
?>
			<?php 
/*<div class="small-px silent"></div>*/
?>
		</div>
	</div>

	<div class="clearfix">
		<?php