コード例 #1
0
ファイル: ItemController.php プロジェクト: 44n/myEYii
 /**
  * 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));
 }
コード例 #2
0
ファイル: CategoryController.php プロジェクト: 44n/myEYii
 /**
  * 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));
 }
コード例 #3
0
ファイル: SectionModel.php プロジェクト: 44n/myEYii
 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();
 }