Exemplo n.º 1
0
 /**
  * Creates a new model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  */
 public function actionCreate()
 {
     $model = new Origin();
     // Uncomment the following line if AJAX validation is needed
     // $this->performAjaxValidation($model);
     if (isset($_POST['Origin'])) {
         $model->attributes = $_POST['Origin'];
         if ($model->save() && $model->validate()) {
             date_default_timezone_set("Asia/Manila");
             $activity = new Activity();
             $activity->act_desc = 'Added Another Origin';
             $activity->act_datetime = date('Y-m-d G:i:s');
             $activity->act_by = User::model()->findByPK(Yii::app()->user->name)->emp_id;
             $activity->save();
             $this->redirect(array('view', 'id' => $model->orig_id));
         }
     }
     $this->render('create', array('model' => $model));
 }