/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = Experience::find(); $dataProvider = new ActiveDataProvider(['query' => $query]); $this->load($params); if (!$this->validate()) { // uncomment the following line if you do not want to return any records when validation fails // $query->where('0=1'); return $dataProvider; } $query->andFilterWhere(['id' => $this->id, 'user_id' => $this->user_id, 'startdate' => $this->startdate, 'enddate' => $this->enddate, 'salary' => $this->salary]); $query->andFilterWhere(['like', 'company', $this->company])->andFilterWhere(['like', 'position', $this->position])->andFilterWhere(['like', 'location', $this->location])->andFilterWhere(['like', 'desc', $this->desc]); return $dataProvider; }
/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = Experience::find(); $dataProvider = new ActiveDataProvider(['query' => $query]); $this->load($params); if (!$this->validate()) { // uncomment the following line if you do not want to return any records when validation fails // $query->where('0=1'); return $dataProvider; } $query->andFilterWhere(['id' => $this->id, 'type_id' => $this->type_id, 'person_id' => $this->person_id, 'education_type_id' => $this->education_type_id, 'profession_id' => $this->profession_id, 'city_id' => $this->city_id, 'date_start' => $this->date_start, 'date_end' => $this->date_end, 'duration' => $this->duration, 'rec_status_id' => $this->rec_status_id, 'user_id' => $this->user_id, 'dc' => $this->dc]); $query->andFilterWhere(['like', 'firm', $this->firm])->andFilterWhere(['like', 'note', $this->note]); return $dataProvider; }
/** * @return \yii\db\ActiveQuery */ public function getExperiences() { return $this->hasMany(Experience::className(), ['user_id' => 'id']); }
//echo $form->field($model, 'education_type_id')->textInput() ?> <?php /*echo $form->field($model, 'education_type_id')->radioList($model::$list_education_type, [ 'class' => 'btn-group', 'data-toggle' => 'buttons', 'unselect' => null, // remove hidden field 'item' => function ($index, $label, $name, $checked, $value) { return '<label class="btn btn-default' . ($checked ? ' active' : '') . '">' . Html::radio($name, $checked, ['value' => $value, 'class' => 'project-status-btn']) . $label . '</label>'; }, ]);*/ ?> <?php echo $form->field($model, 'firm')->widget(\dosamigos\selectize\SelectizeDropDownList::className(), ['items' => \yii\helpers\ArrayHelper::map(\app\models\Experience::find()->select(['firm'])->active()->distinct()->orderBy('firm asc')->asArray()->all(), 'firm', 'firm'), 'options' => ['multiple' => false, 'class' => 'form-control', 'prompt' => ''], 'clientOptions' => ['selectOnTab' => true, 'openOnFocus' => false, 'persist' => false, 'maxItems' => 1, 'create' => true, 'valueField' => 'firm', 'labelField' => 'firm', 'searchField' => ['firm']]]); ?> <?php //echo $form->field($model, 'profession_id')->textInput() ?> <?php //echo $form->field($model, 'profession_id',['inputOptions' => ['class' => 'form-control']])->dropDownList(ArrayHelper::map(\app\models\Profession::find()->active()->all(), 'id', 'name'), ['prompt' => '']) ?> <?php echo $form->field($model, 'profession_id')->widget(\dosamigos\selectize\SelectizeDropDownList::className(), ['items' => ArrayHelper::map(\app\models\Profession::find()->active()->all(), 'id', 'name'), 'options' => ['multiple' => false, 'class' => 'form-control', 'prompt' => ''], 'clientOptions' => ['openOnFocus' => false, 'persist' => false, 'maxItems' => 1, 'create' => false, 'valueField' => 'id', 'labelField' => 'name', 'searchField' => ['name']]]); ?> <?php //echo= $form->field($model, 'city_id')->textInput()
/** * Update a model. * * @param array $inputs * @param $id * @return void */ public function update($inputs, $id) { $this->model = Experience::find($id); return $this->save($inputs); }
/** * Finds the Experience model based on its primary key value. * If the model is not found, a 404 HTTP exception will be thrown. * @param integer $id * @return Experience the loaded model * @throws NotFoundHttpException if the model cannot be found */ protected function findModel($id) { if (($model = Experience::findOne($id)) !== null) { return $model; } else { throw new NotFoundHttpException('The requested page does not exist.'); } }
/** * @return \yii\db\ActiveQuery */ public function getExperiences() { return $this->hasMany(Experience::className(), ['person_id' => 'id'])->orderBy('date_start'); }
/** * Display a listing of the resource. * * @return Response */ public function index() { return response()->json(Experience::get()); }
public function experiences() { $experiences = Experience::select("experience.*", "company.name as company_name")->join("company", "experience.company_id", "=", "company.id")->where("user_id", $this->id)->get(); return $experiences; }
public function statVille($filiere = null) { $experience = new Experience(); $query = $experience->select('experiences.ville', DB::raw('count(experiences.ville) as nombre'))->orderby('nombre', 'desc')->limit(5)->join('cvs', 'cvs.id', '=', 'experiences.cv_id')->join('etudiants', 'etudiants.id', '=', 'cvs.etudiant_id'); if ($filiere) { $query->where('etudiants.filiere_id', $filiere); } $query->groupBy('experiences.ville')->get(); $data = $query->get(); return $data; }