/** * Manages all models. */ public function actionAdmin() { $model = new ItemModel('search'); $model->unsetAttributes(); // clear any default values if (isset($_GET['ItemModel'])) { $model->attributes = $_GET['ItemModel']; } $this->render('admin', array('model' => $model)); }
/** * Updates a particular model. * If update is successful, the browser will be redirected to the 'view' page. * @param integer $id the ID of the model to be updated */ public function actionUpdate($id) { $model = $this->loadModel($id); // Uncomment the following line if AJAX validation is needed // $this->performAjaxValidation($model); if (isset($_POST['CategoryModel'])) { $model->attributes = $_POST['CategoryModel']; if ($model->save()) { $this->redirect(array('view', 'id' => $model->id)); } } $modelItem = new ItemModel('search'); $modelItem->unsetAttributes(); // clear any default values $modelItem->category_id = $model->id; if (isset($_GET['ItemModel'])) { $modelItem->attributes = $_GET['ItemModel']; } $this->render('update', array('model' => $model, 'modelItem' => $modelItem)); }
public function searchItems() { // Warning: Please modify the following code to remove attributes that // should not be searched. $model = new ItemModel(); $model->unsetAttributes(); $model->section_id = $this->id; return $model->search(); }