Пример #1
0
 /**
  * Creates a new model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  */
 public function actionCreate()
 {
     $model = new Trekstra();
     // Uncomment the following line if AJAX validation is needed
     // $this->performAjaxValidation($model);
     if (isset($_POST['Trekstra'])) {
         $model->attributes = $_POST['Trekstra'];
         $valid = $model->validate();
         try {
             if ($valid) {
                 $model->save();
                 Yii::app()->user->setFlash('success', 'Data <strong>berhasil</strong> ditambahkan. Terima kasih');
                 $this->redirect(array('nilai/raport', 'id' => $model->nis));
             }
         } catch (CDbException $e) {
             $model->addError(null, $e->getMessage());
         }
     }
     $this->render('create', array('model' => $model));
 }