Esempio n. 1
0
 /**
  * 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]);
 }
Esempio n. 3
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getUserCvs()
 {
     return $this->hasMany(UserCv::className(), ['user_id' => 'id']);
 }
Esempio n. 4
0
 /**
  * Finds the UserCv model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $id
  * @return UserCv the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = UserCv::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }
Esempio n. 5
0
 /**
  * Vervewijder alle werknemers die gelieerd zijn aan een company
  * 
  **/
 public function deleteDependentUsers($user)
 {
     $depUsers = Yii::$app->getModule("user")->model("User");
     $depUsers = User::findAll(['company_id' => $user->company_id]);
     if ($depUsers) {
         foreach ($depUsers as $depUser) {
             //$reistarief = UserReistarief::findAll(['user_id'=>$depUser->id]);
             UserReistarief::deleteAll(['user_id' => $depUser->id]);
             //$tarief = UserTarieven::findAll(['user_id'=>$depUser->id]);
             UserTarieven::deleteAll(['user_id' => $depUser->id]);
             //$cv = UserCv::findAll(['user_id'=>$depUser->id]);
             UserCv::deleteAll(['user_id' => $depUser->id]);
             //$ce = CalendarEvents::find()->where(['user_id'=>$depUser->id])->all;
             CalendarEvents::deleteAll(['user_id' => $depUser->id]);
             //$cd = ContractDeals::find()->where(['user_id'=>$depUser->id])->all;
             ContractDeals::deleteAll(['user_id' => $depUser->id]);
             Profile::deleteAll(['user_id' => $depUser->id]);
         }
     }
 }