<h3><?php echo Yii::t('phrase', 'Album Information'); ?> </h3> <fieldset class="clearfix"> <div class="clear"> <div class="left"> <div class="shadow"></div> <div class="clearfix"> <?php echo $form->labelEx($model, 'cat_id'); ?> <div class="desc"> <?php $category = AlbumCategory::getCategory(); if ($category != null) { echo $form->dropDownList($model, 'cat_id', $category, array('prompt' => Yii::t('phrase', 'Select Category'))); } else { echo $form->dropDownList($model, 'cat_id', array('prompt' => Yii::t('phrase', 'No Parent'))); } ?> <?php echo $form->error($model, 'cat_id'); ?> </div> </div> <div class="clearfix"> <?php echo $form->labelEx($model, 'title');
/** * Returns the data model based on the primary key given in the GET variable. * If the data model is not found, an HTTP exception will be raised. * @param integer the ID of the model to be loaded */ public function loadModel($id) { $model = AlbumCategory::model()->findByPk($id); if ($model === null) { throw new CHttpException(404, Yii::t('phrase', 'The requested page does not exist.')); } return $model; }
/** * Set default columns to display */ protected function afterConstruct() { $controller = strtolower(Yii::app()->controller->id); 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->title."<br/><span>".Utility::shortText(Utility::hardDecode($data->body),200)."</span>"', 'htmlOptions' => array('class' => 'bold'), 'type' => 'raw'); if (!isset($_GET['category'])) { $this->defaultColumns[] = array('name' => 'cat_id', 'value' => 'Phrase::trans($data->cat->name, 2)', 'filter' => AlbumCategory::getCategory(), 'type' => 'raw'); } $this->defaultColumns[] = array('name' => 'photo_search', 'value' => 'CHtml::link($data->views->photos." photo", Yii::app()->controller->createUrl("o/photo/manage",array("album"=>$data->album_id)))', 'htmlOptions' => array('class' => 'center'), 'type' => 'raw'); $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', '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'])) { if ($controller == 'o/admin' && OmmuSettings::getInfo('site_headline') == 1) { $this->defaultColumns[] = array('name' => 'headline', 'value' => 'Utility::getPublish(Yii::app()->controller->createUrl("headline",array("id"=>$data->album_id)), $data->headline, 1)', 'htmlOptions' => array('class' => 'center'), 'filter' => array(1 => Yii::t('phrase', 'Yes'), 0 => Yii::t('phrase', 'No')), 'type' => 'raw'); } $this->defaultColumns[] = array('name' => 'publish', 'value' => 'Utility::getPublish(Yii::app()->controller->createUrl("publish",array("id"=>$data->album_id)), $data->publish, 1)', 'htmlOptions' => array('class' => 'center'), 'filter' => array(1 => Yii::t('phrase', 'Yes'), 0 => Yii::t('phrase', 'No')), 'type' => 'raw'); } } parent::afterConstruct(); }