/** * 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 = ReportCategory::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() { if (count($this->defaultColumns) == 0) { $this->defaultColumns[] = array('header' => 'No', 'value' => '$this->grid->dataProvider->pagination->currentPage*$this->grid->dataProvider->pagination->pageSize + $row+1'); if (!isset($_GET['category'])) { $this->defaultColumns[] = array('name' => 'cat_id', 'value' => 'Phrase::trans($data->cat->name, 2)', 'filter' => ReportCategory::getCategory(), 'type' => 'raw'); } $this->defaultColumns[] = array('name' => 'user_search', 'value' => '$data->user->displayname'); $this->defaultColumns[] = 'url'; $this->defaultColumns[] = 'body'; $this->defaultColumns[] = array('name' => 'report_date', 'value' => 'Utility::dateFormat($data->report_date)', 'htmlOptions' => array('class' => 'center'), 'filter' => Yii::app()->controller->widget('zii.widgets.jui.CJuiDatePicker', array('model' => $this, 'attribute' => 'report_date', 'language' => 'ja', 'i18nScriptFile' => 'jquery.ui.datepicker-en.js', 'htmlOptions' => array('id' => 'report_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' => 'status', 'value' => 'Utility::getPublish(Yii::app()->controller->createUrl("resolve",array("id"=>$data->report_id)), $data->status, 5)', 'htmlOptions' => array('class' => 'center'), 'type' => 'raw'); } parent::afterConstruct(); }
<fieldset> <div id="ajax-message"> <?php echo $form->errorSummary($model); ?> </div> <div class="clearfix"> <?php echo $form->labelEx($model, 'cat_id'); ?> <div class="desc"> <?php if (ReportCategory::getCategory(1) != null) { echo $form->dropDownList($model, 'cat_id', ReportCategory::getCategory(1)); } 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, 'url'); ?> <div class="desc">
<fieldset> <div id="ajax-message"> <?php echo $form->errorSummary($model); ?> </div> <div class="clearfix"> <?php echo $form->labelEx($model, 'dependency'); ?> <div class="desc"> <?php if (ReportCategory::getCategory() != null) { echo $form->dropDownList($model, 'dependency', ReportCategory::getCategory(), array('prompt' => Yii::t('phrase', 'No Parent'))); } else { echo $form->dropDownList($model, 'dependency', array('prompt' => Yii::t('phrase', 'No Parent'))); } ?> <?php echo $form->error($model, 'dependency'); ?> </div> </div> <div class="clearfix"> <?php echo $form->labelEx($model, 'title'); ?> <div class="desc">