/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $company = Company::findOne(['user_id' => Yii::$app->user->id]); $query = UserCv::find()->innerJoin('user', 'user_cv.user_id = user.id')->where('user.company_id=:companyid', [':companyid' => $company->id]); $dataProvider = new ActiveDataProvider(['query' => $query]); $this->load($params); if (!$this->validate()) { // uncomment the following line if you do not want to any records when validation fails // $query->where('0=1'); return $dataProvider; } $query->andFilterWhere(['id' => $this->id, 'user_id' => $this->user_id]); $query->andFilterWhere(['like', 'huidige_beroep', $this->huidige_beroep])->andFilterWhere(['like', 'huidge_werkgever', $this->huidge_werkgever])->andFilterWhere(['like', 'voornaam', $this->voornaam])->andFilterWhere(['like', 'tussenvoegsel', $this->tussenvoegsel])->andFilterWhere(['like', 'achternaam', $this->achternaam])->andFilterWhere(['like', 'email', $this->email])->andFilterWhere(['like', 'telefoon', $this->telefoon])->andFilterWhere(['like', 'mobiel', $this->mobiel])->andFilterWhere(['like', 'postcode', $this->postcode])->andFilterWhere(['like', 'huisnummer', $this->huisnummer])->andFilterWhere(['like', 'toevoeging', $this->toevoeging])->andFilterWhere(['like', 'straat', $this->straat])->andFilterWhere(['like', 'rijbewijs', $this->rijbewijs])->andFilterWhere(['like', 'geboortejaar', $this->geboortejaar])->andFilterWhere(['like', 'geboortemaand', $this->geboortemaand])->andFilterWhere(['like', 'geboortedag', $this->geboortedag])->andFilterWhere(['like', 'geboorteplaats', $this->geboorteplaats])->andFilterWhere(['like', 'nationaliteit', $this->nationaliteit])->andFilterWhere(['like', 'branch', $this->branch])->andFilterWhere(['like', 'branch_discipline', $this->branch_discipline])->andFilterWhere(['like', 'branch_specialisatie', $this->branch_specialisatie]); return $dataProvider; }
/** * start de dialog om een contract aan te bieden **/ public function actionDialogContr() { $id = ArrayHelper::getValue($_POST, 'id'); $calenderevent = CalendarEvents::findOne(['id' => $id]); $start = substr($calenderevent->start, 0, 10); //Zie of er op die dag all contracten die zijn geaccepteerd. // $query = new Query(); $query->from('calendar_events'); $query->where(['start' => substr($calenderevent->start, 0, 10), 'user_id' => $calenderevent->user_id]); $query->andWhere(['like', 'code_title', 'Accep']); if ($query->count() > 0) { return $this->renderAjax('_dialogContrbezet', ['calenderevent' => $calenderevent]); } $usercv = UserCv::findOne(['user_id' => $calenderevent->user_id]); $user = User::findOne(['id' => $calenderevent->user_id]); $contractdeal = new ContractDeals(); $company = Company::findOne(['id' => $user->company_id]); $usercontactperson = Gebruikers::findOne(['id' => $calenderevent->user_id]); return $this->renderAjax('_dialogContr', ['calenderevent' => $calenderevent, 'company' => $company, 'usercv' => $usercv, 'contractdeal' => $contractdeal, 'user' => $user]); }
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]); }
/** * Finds the Company model based on its primary key value. * If the model is not found, a 404 HTTP exception will be thrown. * @param integer $id * @return Company the loaded model * @throws NotFoundHttpException if the model cannot be found */ protected function findModel($id) { if (($model = Company::findOne($id)) !== null) { return $model; } else { throw new NotFoundHttpException('The requested page does not exist.'); } }
public function getIseigenmedewerker() { $eigenmedewerker = ''; $ingeloggdecntctprsn = Yii::$app->user->id; $getoondeCntctprsn = Company::findOne($this->company_id)->user_id; if ($ingeloggdecntctprsn == $getoondeCntctprsn) { $eigenmedewerker = 'Mijn medewerker'; } return $eigenmedewerker; }
public function actionDelDoc($id) { $model = $this->findModel($id); $user = User::findOne(['id' => $model->user_id]); $model->username = $user->username; $model->deletePdfFile(); return $this->render('update', ['model' => $model, 'company' => Company::findOne(['user_id' => Yii::$app->user->id]), 'disciplines' => BranchDisciplines::allOmschrijvingen(), 'specialisaties' => BranchSpecialisaties::allOmschrijvingen(), 'user' => $user]); }