コード例 #1
0
 /**
  * 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);
     if (Yii::app()->user->checkAccess($this->id . '.' . $this->action->id, array('owner' => $model->create_user))) {
         // Uncomment the following line if AJAX validation is needed
         // $this->performAjaxValidation($model);
         $allotment = $model->applicant->getAllotments();
         $paymentTypeOptions = PaymentType::getPaymentTypes($allotment->data[0]->category_id);
         if (isset($_POST['PaymentDetail'])) {
             $model->attributes = $_POST['PaymentDetail'];
             if ($model->save()) {
                 $this->redirect(Yii::app()->user->returnUrl);
             }
         }
         $this->render('update', array('model' => $model, 'paymentTypeOptions' => $paymentTypeOptions));
     } else {
         $this->accessDenied();
     }
 }