Exemplo n.º 1
0
 public function actionCreate()
 {
     $model = new AttendancePresencesRequestOff();
     // Uncomment the following line if AJAX validation is needed
     // $this->performAjaxValidation($model);
     if (isset($_POST['AttendancePresencesRequestOff'])) {
         $model->attributes = $_POST['AttendancePresencesRequestOff'];
         $model->status = 'draft';
         $model->created_by = getUser()->role;
         $model->created_at = date('Y-m-d H:i:s');
         if ($_POST['action'] == 'Save') {
             $model->status = 'saved';
         }
         if ($model->save()) {
             $this->redirect(array('view', 'id' => $model->id));
         } else {
             print_r($model->errors);
         }
     }
     $this->render('create', array('model' => $model));
 }