Пример #1
0
 public function actionCreate()
 {
     $model = new PahSys();
     if (isset($_POST) && !empty($_POST)) {
         foreach ($_POST as $k => $v) {
             $_POST['PahSys'][$k] = $v;
         }
         $model->attributes = $_POST['PahSys'];
         if ($model->save()) {
             $status = true;
             $msg = "Data berhasil di simpan ";
         } else {
             $msg = CHtml::errorSummary($model);
             $status = false;
         }
         if (Yii::app()->request->isAjaxRequest) {
             echo CJSON::encode(array('success' => $status, 'msg' => $msg, 'id' => $model->name));
             Yii::app()->end();
         } else {
             $this->redirect(array('view', 'id' => $model->name));
         }
     }
     $this->render('create', array('model' => $model));
 }