/** * wordt gezet indien een contractaanbod wordt gedaan door de approxUser * @param string $code_title * @return string description **/ public function getEventDescription($code_title) { $approxuser = Gebruikers::findOne(['id' => Yii::$app->user->id]); $company = $approxuser->company; $titleDesc = CalendarCodeDescriptions::findOne(['code_title' => $code_title])->description; $BEDRIJFSNAAM = $company->name; $START = ''; return preg_replace('/\\{([A-Z]+)\\}/e', "\$\$1", $titleDesc); }
/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $user_id = Yii::$app->user->id; $query = Gebruikers::find(); $query->where("id<>{$user_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, 'role_id' => $this->role_id, 'status' => $this->status, 'login_time' => $this->login_time, 'create_time' => $this->create_time, 'update_time' => $this->update_time, 'ban_time' => $this->ban_time]); $query->andFilterWhere(['like', 'email', $this->email])->andFilterWhere(['like', 'new_email', $this->new_email])->andFilterWhere(['like', 'username', $this->username])->andFilterWhere(['like', 'password', $this->password])->andFilterWhere(['like', 'auth_key', $this->auth_key])->andFilterWhere(['like', 'api_key', $this->api_key])->andFilterWhere(['like', 'login_ip', $this->login_ip])->andFilterWhere(['like', 'create_ip', $this->create_ip])->andFilterWhere(['like', 'ban_reason', $this->ban_reason]); return $dataProvider; }
/** * wordt gezet indien een contractaanbod wordt gedaan door de approxUser * @param string $code_title * @return string description **/ public function getEventDescription($code_title) { $approxuser = Gebruikers::findOne(['id' => Yii::$app->user->id]); $company = $approxuser->company; $titleDesc = CalendarCodeDescriptions::findOne(['code_title' => $code_title])->description; $this->BEDRIJFSNAAM1 = $company->name; $this->START1 = ''; return preg_replace_callback('/\\{([A-Z]+)\\}/', function ($matches) { $a = ''; if ($matches[0] == '{BEDRIJFSNAAM}') { $a = $this->BEDRIJFSNAAM1; } elseif ($matches[0] == '{START}') { $a = $this->START1; } return $a; }, $titleDesc); }
/** * 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]); }
/** * Finds the Gebruikers model based on its primary key value. * If the model is not found, a 404 HTTP exception will be thrown. * @param integer $id * @return Gebruikers the loaded model * @throws NotFoundHttpException if the model cannot be found */ protected function findModel($id) { if (($model = Gebruikers::findOne($id)) !== null) { return $model; } else { throw new NotFoundHttpException('The requested page does not exist.'); } }