/** * 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) { try { $model = ProCallLog::model()->findByPk($id); if (is_null($model)) { throw new Exception('id not valid'); } $model->scenario = 'UpdateCallsLog'; $model->date = MyFormat::InvoiceDateDbDateToShowDate($model->date); $this->layout = 'ajax'; if (isset($_POST['ProCallLog'])) { $model->attributes = $_POST['ProCallLog']; if ($model->save()) { die('<script type="text/javascript">parent.$.fn.colorbox.close(); parent.$.fn.yiiGridView.update("pro-transactions-grid");</script>'); } } $this->render('update', array('model' => $model, 'actions' => $this->listActionsCanAccess)); } catch (Exception $e) { Yii::log("Exception " . print_r($e, true), 'error'); throw new CHttpException("Exception " . print_r($e, true)); } }