예제 #1
0
 /**
  * Creates a new Work model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  * @return mixed
  */
 public function actionCreate()
 {
     $model = new Work();
     if ($model->load(Yii::$app->request->post()) && $model->save()) {
         return $this->redirect(['view', 'kpi' => $model->kpi, 'prov' => $model->prov]);
     } else {
         return $this->render('create', ['model' => $model]);
     }
 }
 public function insert($name, $order, $use_complete = false, $use_seeding = false, $use_pest_control = false)
 {
     $work = new Work();
     $work->name = $name;
     $work->use_complete = $use_complete;
     $work->use_seeding = $use_seeding;
     $work->use_pest_control = $use_pest_control;
     $work->display_order = $order;
     $work->save();
 }
예제 #3
0
 /**
  * Save data from user
  */
 public function save()
 {
     if ($this->validate()) {
         $work = new Work();
         $work->konkurs_id = 1;
         $work->participant_id = 2;
         $work->category_id = $this->category_id;
         $work->file_name = 'test';
         $work->file_type = 'pdf';
         $work->date = $this->date;
         $work->title = $this->title;
         $work->picture = 'test.jpg';
         return $work->save();
     }
     return false;
 }
예제 #4
0
 public function save()
 {
     if ($this->validate()) {
         $model = checkTimesheet();
         //nếu timesheet khác false
         if ($model != false) {
             if ($model == null) {
                 $model = new Timesheet(['user_id' => $this->user_id, 'date' => $this->date, 'status' => 0]);
                 $model->save();
             }
             $work = new Work(['timesheet_id' => $model->id, 'team_id' => $this->team_id, 'process_id' => $this->process_id, 'work_time' => $this->work_time, 'work_name' => $this->work_name]);
             if ($work->save()) {
                 return $model;
             }
         } else {
             return null;
         }
         return null;
     }
     return null;
 }