示例#1
0
 public function actionUpdate($id)
 {
     $model = $this->findModel($id);
     //userCv
     $user = User::findOne(['id' => $model->user_id]);
     $model->username = $user->username;
     $tarievenDag = UserTarievenDag::findOne(['user_id' => $model->user_id, 'naam' => 'Dagdienst']);
     $tarievenNacht = UserTarievenNacht::findOne(['user_id' => $model->user_id, 'naam' => 'Nachtdienst']);
     $tarievenWeekend = UserTarievenWeekend::findOne(['user_id' => $model->user_id, 'naam' => 'Weekenddienst']);
     $reisTarief = UserReistarief::findOne(['user_id' => $model->user_id]);
     $uploadMdl = new UploadForm();
     $uploadMdl->init($model->user_id);
     // convert  string to array
     $model->branch_discipline = explode(',', $model->branch_discipline);
     $model->branch_specialisatie = explode(',', $model->branch_specialisatie);
     if (!isset($tarievenDag)) {
         $tarievenDag = new UserTarieven();
     }
     if (!isset($tarievenNacht)) {
         $tarievenNacht = new UserTarieven();
     }
     if (!isset($tarievenWeekend)) {
         $tarievenWeekend = new UserTarieven();
     }
     if (!isset($reisTarief)) {
         $reisTarief = new UserReistarief();
     }
     //$userCvDocs = UserCvDocs::find()->where(['user_id' =>$model->user_id])->asArray()->all();
     if ($model->load(Yii::$app->request->post())) {
         //uplaod files to user dir
         $uploadMdl->docFiles = UploadedFile::getInstances($uploadMdl, 'docFiles');
         $uploadMdl->upload($model->user_id);
         // convert array's to string comma seperated
         $model->branch_discipline = implode(',', $model->branch_discipline);
         $model->branch_specialisatie = implode(',', $model->branch_specialisatie);
         $model->save(false);
         $tarievenDag->load(Yii::$app->request->post());
         $tarievenWeekend->user_id = $model->user_id;
         $tarievenDag->naam = 'Dagdienst';
         $tarievenDag->omschrijving = 'Dagdienst';
         $tarievenDag->save(false);
         $tarievenNacht->load(Yii::$app->request->post());
         $tarievenNacht->user_id = $model->user_id;
         $tarievenNacht->naam = 'Nachtdienst';
         $tarievenNacht->omschrijving = 'Nachtdienst';
         $tarievenNacht->save(false);
         $tarievenWeekend->load(Yii::$app->request->post());
         $tarievenWeekend->user_id = $model->user_id;
         $tarievenWeekend->naam = 'Weekenddienst';
         $tarievenWeekend->omschrijving = 'Weekenddienst';
         $tarievenWeekend->save(false);
         $reisTarief->load(Yii::$app->request->post());
         $reisTarief->user_id = $model->user_id;
         $tarievenDag->save(false);
         $uploadMdl = new UploadForm();
         $uploadMdl->init($model->user_id);
     }
     return $this->render('update', ['model' => $model, 'company' => Company::findOne(['user_id' => Yii::$app->user->id]), 'disciplines' => BranchDisciplines::allOmschrijvingen(), 'specialisaties' => BranchSpecialisaties::allOmschrijvingen(), 'user' => $user, 'tarievenDag' => $tarievenDag, 'tarievenNacht' => $tarievenNacht, 'tarievenWeekend' => $tarievenWeekend, 'reisTarief' => $reisTarief, 'uploadMdl' => $uploadMdl]);
 }
示例#2
0
 /**
  * Updates an existing Company model.
  * If update is successful, the browser will be redirected to the 'view' page.
  * @param integer $id
  * @return mixed
  */
 public function actionUpdate()
 {
     $userid = Yii::$app->user->identity;
     //        if(!$userid)  return;
     $user = User::findOne($userid->id);
     $company = Company::findOne(['user_id' => $userid->id]);
     $tarievenDag = UserTarievenDag::findOne(['user_id' => $user->id, 'naam' => 'Dagdienst']);
     $tarievenNacht = UserTarievenNacht::findOne(['user_id' => $user->id, 'naam' => 'Nachtdienst']);
     $tarievenWeekend = UserTarievenWeekend::findOne(['user_id' => $user->id, 'naam' => 'Weekenddienst']);
     $tariefReizen = UserReistarief::findOne(['user_id' => $user->id]);
     $profile = Profile::findOne(['user_id' => $user->id]);
     $abonnement = UserAbonnement::findOne(['user_id' => $userid->id]);
     $userLoaded = $user->load(Yii::$app->request->post());
     if ($userLoaded && $user->validate()) {
         if (Yii::$app->getModule("user")->emailChangeConfirmation && $user->checkAndPrepEmailChange()) {
             $userKey = Yii::$app->getModule("user")->model("UserKey");
             $userKey = $userKey::generate($user->id, $userKey::TYPE_EMAIL_CHANGE);
             if (!($numSent = $user->sendEmailConfirmation($userKey))) {
                 // handle email error
                 Yii::$app->session->setFlash("Email-error", "Failed to send email");
                 return $this->refresh();
             }
         }
     }
     if ($user->load(Yii::$app->request->post()) && $user->save() && $company->load(Yii::$app->request->post()) && $company->save() && $tarievenDag->load(Yii::$app->request->post()) && $tarievenDag->save() && $tarievenNacht->load(Yii::$app->request->post()) && $tarievenNacht->save() && $tarievenWeekend->load(Yii::$app->request->post()) && $tarievenWeekend->save() && $tariefReizen->load(Yii::$app->request->post()) && $tariefReizen->save() && $profile->load(Yii::$app->request->post()) && $profile->save() && $abonnement->load(Yii::$app->request->post()) && $abonnement->save()) {
         $this->updateZoHoContact($user);
         Yii::$app->session->setFlash("Account-success", Yii::t("user", "Account updated"));
         return $this->refresh();
         //return $this->redirect(['update',]);
     } else {
         return $this->render('update', ['company' => $company, 'user' => $user, 'tarievenDag' => $tarievenDag, 'tarievenNacht' => $tarievenNacht, 'tarievenWeekend' => $tarievenWeekend, 'tariefReizen' => $tariefReizen, 'profile' => $profile, 'abonnement' => $abonnement]);
     }
 }
示例#3
0
文件: UserCv.php 项目: jaccos/ap_dev
 public function getUserdagtarief()
 {
     $formatter = \Yii::$app->formatter;
     $UserTarievenDag = UserTarievenDag::findOne(['user_id' => $this->user_id, 'omschrijving' => 'Dagdienst']);
     if (isset($UserTarievenDag) && $UserTarievenDag->tarief > 0) {
         return $formatter->asCurrency($UserTarievenDag->tarief, 'EUR') . '/' . $UserTarievenDag->tarief_eenheid . ' vanaf ' . $UserTarievenDag->dag_vanaf . ' tot/met ' . $UserTarievenDag->dag_totenmet;
     } else {
         return 'n.v.t.';
     }
 }
示例#4
0
 public function updateTarieven($post, $user_id)
 {
     $tarievenDag = UserTarievenDag::findOne(['user_id' => $user_id, 'naam' => 'Dagdienst']);
     $tarievenNacht = UserTarievenNacht::findOne(['user_id' => $user_id, 'naam' => 'Nachtdienst']);
     $tarievenWeekend = UserTarievenWeekend::findOne(['user_id' => $user_id, 'naam' => 'Weekenddienst']);
     // $tariefReizen       = UserReistarief::findOne(['user_id'=>$user_id,]);
     $tarievenDag->load($post);
     $tarievenDag->save(false);
     $tarievenNacht->load($post);
     $tarievenNacht->save(false);
     $tarievenWeekend->load($post);
     $tarievenWeekend->save(false);
     //$tarievenReis->load($post);
     //$tarievenReis->save(false);
     return;
 }
示例#5
0
 public function actionUpdate($id)
 {
     $model = $this->findModel($id);
     //userCv
     $user = User::findOne(['id' => $model->user_id]);
     $model->username = $user->username;
     $tarievenDag = UserTarievenDag::findOne(['user_id' => $model->user_id, 'naam' => 'Dagdienst']);
     $tarievenNacht = UserTarievenNacht::findOne(['user_id' => $model->user_id, 'naam' => 'Nachtdienst']);
     $tarievenWeekend = UserTarievenWeekend::findOne(['user_id' => $model->user_id, 'naam' => 'Weekenddienst']);
     if (!isset($tarievenDag)) {
         $tarievenDag = new UserTarieven();
     }
     if (!isset($tarievenNacht)) {
         $tarievenNacht = new UserTarieven();
     }
     if (!isset($tarievenWeekend)) {
         $tarievenWeekend = new UserTarieven();
     }
     if ($model->load(Yii::$app->request->post())) {
         if (1 == 1) {
             //$documentfile = UploadedFile::getInstance($model, 'documentfile');
             // store the source file name
             //$model->document_naam = $documentfile->name;
             //if(!$model->document_encryp)
             //{
             //    $ext = end((explode(".", $documentfile->name)));
             //    $model->document_encryp = Yii::$app->security->generateRandomString().".$ext";
             //}
             //$path = Yii::$app->params['uploadPath'] . $model->document_encryp;
             //if( $model->save())
             //{
             //$documentfile->saveAs($path);
             //}
         }
         $model->save();
         $tarievenDag->load(Yii::$app->request->post());
         $tarievenWeekend->user_id = $model->user_id;
         $tarievenDag->naam = 'Dagdienst';
         $tarievenDag->omschrijving = 'Dagdienst';
         $tarievenDag->save(false);
         $tarievenNacht->load(Yii::$app->request->post());
         $tarievenNacht->user_id = $model->user_id;
         $tarievenNacht->naam = 'Nachtdienst';
         $tarievenNacht->omschrijving = 'Nachtdienst';
         $tarievenNacht->save(false);
         $tarievenWeekend->load(Yii::$app->request->post());
         $tarievenWeekend->user_id = $model->user_id;
         $tarievenWeekend->naam = 'Weekenddienst';
         $tarievenWeekend->omschrijving = 'Weekenddienst';
         $tarievenWeekend->save(false);
         return $this->redirect(['index']);
     } else {
         return $this->render('update', ['model' => $model, 'company' => Company::findOne(['user_id' => Yii::$app->user->id]), 'disciplines' => BranchDisciplines::allOmschrijvingen(), 'specialisaties' => BranchSpecialisaties::allOmschrijvingen(), 'user' => $user, 'tarievenDag' => $tarievenDag, 'tarievenNacht' => $tarievenNacht, 'tarievenWeekend' => $tarievenWeekend]);
     }
 }