コード例 #1
0
ファイル: SectionController.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['SectionModel'])) {
         $model->attributes = $_POST['SectionModel'];
         if ($model->save()) {
             $this->redirect(array('view', 'id' => $model->id));
         }
     }
     $modelCategory = new CategoryModel('search');
     $modelCategory->unsetAttributes();
     // clear any default values
     $modelCategory->section_id = $model->id;
     if (isset($_GET['CategoryModel'])) {
         $modelCategory->attributes = $_GET['CategoryModel'];
     }
     $this->render('update', array('model' => $model, 'modelCategory' => $modelCategory));
 }
コード例 #2
0
ファイル: CategoryController.php プロジェクト: 44n/myEYii
 /**
  * Manages all models.
  */
 public function actionAdmin()
 {
     $model = new CategoryModel('search');
     $model->unsetAttributes();
     // clear any default values
     if (isset($_GET['CategoryModel'])) {
         $model->attributes = $_GET['CategoryModel'];
     }
     $this->render('admin', array('model' => $model));
 }