예제 #1
0
 /**
  * Creates a new model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  */
 public function actionCreate()
 {
     $model = new Salary();
     // Uncomment the following line if AJAX validation is needed
     // $this->performAjaxValidation($model);
     if (isset($_POST['Salary'])) {
         $model->attributes = $_POST['Salary'];
         if ($model->save()) {
             $this->redirect(array('view', 'id' => $model->employer_id));
         }
     }
     $this->render('create', array('model' => $model));
 }
예제 #2
0
 function save()
 {
     $salary = new Salary();
     $salary->salary_periode = $this->input->post('salary_periode');
     $salary->salary_staffid = $this->input->post('salary_staffid');
     if ($salary->save()) {
         $this->session->set_flashdata('message', 'Salary successfully created!');
         redirect('salaries/');
     } else {
         // Failed
         $salary->error_message('custom', 'Salary Name required');
         $msg = $salary->error->custom;
         $this->session->set_flashdata('message', $msg);
         redirect('salaries/add');
     }
 }