/** * Manages all models. */ public function actionAdmin() { if ($this->menu_use[3]) { $model = new NewsGroup('search'); $news_type_list = array(); $criteria = new CDbCriteria(); $criteria->condition = 'status=:status AND news_type_id<>2 AND news_type_id<>3'; $criteria->params = array(':status' => 1); $criteria->order = 'sort_order'; $news_type = NewsType::model()->findAll($criteria); foreach ($news_type as $type) { $news_type_list[$type->news_type_id] = $type->name_th; } $model->unsetAttributes(); // clear any default values if (isset($_GET['NewsGroup'])) { $model->attributes = $_GET['NewsGroup']; } $this->render('admin', array('model' => $model, 'news_type_list' => $news_type_list)); } else { $this->redirect(array('site/index')); } }
/** * Manages all models. */ public function actionAdmin() { if ($this->menu_use[3]) { $model = new NewsGroup('search2'); $model->unsetAttributes(); // clear any default values if (isset($_GET['NewsGroup'])) { $model->attributes = $_GET['NewsGroup']; } $this->render('admin', array('model' => $model)); } else { $this->redirect(array('site/index')); } }