/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = Research::find(); $dataProvider = new ActiveDataProvider(['query' => $query]); if (!($this->load($params) && $this->validate())) { return $dataProvider; } $query->andFilterWhere(['id' => $this->id, 'user_id' => $this->user_id, 'type_id' => $this->type_id, 'category_id' => $this->category_id, 'fund_id' => $this->fund_id, 'created_at' => $this->created_at, 'updated_at' => $this->updated_at, 'submit_at' => $this->submit_at, 'reject_at' => $this->reject_at, 'approve_at' => $this->approve_at, 'success_at' => $this->success_at]); $query->andFilterWhere(['like', 'kecode', $this->kecode])->andFilterWhere(['like', 'date_receive', $this->date_receive])->andFilterWhere(['like', 'no_receive', $this->no_receive])->andFilterWhere(['like', 'name_th', $this->name_th])->andFilterWhere(['like', 'name_en', $this->name_en])->andFilterWhere(['like', 'fund_description', $this->fund_description])->andFilterWhere(['like', 'detail', $this->detail])->andFilterWhere(['like', 'submission_status', $this->submission_status]); return $dataProvider; }
/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = Research::find()->byResearcher(); $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, 'type_id' => $this->type_id, 'category_id' => $this->category_id, 'fund_id' => $this->fund_id, 'created_at' => $this->created_at, 'updated_at' => $this->updated_at]); $query->andFilterWhere(['like', 'kecode', $this->kecode])->andFilterWhere(['like', 'date_receive', $this->date_receive])->andFilterWhere(['like', 'no_receive', $this->no_receive])->andFilterWhere(['like', 'name_th', $this->name_th])->andFilterWhere(['like', 'name_en', $this->name_en])->andFilterWhere(['like', 'fund_description', $this->fund_description])->andFilterWhere(['like', 'detail', $this->detail]); return $dataProvider; }
public function getSubmissionStatusLabel() { return Research::getItemAilas($this->submission_status); }
/** * @return \yii\db\ActiveQuery */ public function getResearch() { return $this->hasOne(\common\models\Research::className(), ['id' => 'research_id']); }
/** * Finds the Research model based on its primary key value. * If the model is not found, a 404 HTTP exception will be thrown. * @param integer $id * @return Research the loaded model * @throws NotFoundHttpException if the model cannot be found */ protected function findModel($id) { if (($model = Research::findOne($id)) !== null) { return $model; } else { throw new NotFoundHttpException('The requested page does not exist.'); } }