/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = Jobgrademodul::find()->JoinWith('groupfunction', true, 'left JOIN')->JoinWith('groupseqmen', true, 'left JOIN')->andWhere(['u0003m.JOBGRADE_STS' => !3]); //->Where('u0003m.JOBGRADE_STS<>3'); $dataProvider = new ActiveDataProvider(['query' => $query]); /* SORTING Group Function Author -ptr.nov-*/ $dataProvider->sort->attributes['groupfunction.GF_NM'] = ['asc' => ['u0003a.GF_NM' => SORT_ASC], 'desc' => ['u0003a.GF_NM' => SORT_DESC]]; /* SORTING Group Seqment Author -ptr.nov-*/ $dataProvider->sort->attributes['groupseqmen.SEQ_NM'] = ['asc' => ['u0003b.SEQ_NM' => SORT_ASC], 'desc' => ['u0003b.SEQ_NM' => SORT_DESC]]; $this->load($params); if (!$this->validate()) { return $dataProvider; } $query->andFilterWhere(['like', 'JOBGRADE_ID', $this->JOBGRADE_ID])->andFilterWhere(['like', 'JOBGRADE_NM', $this->JOBGRADE_NM])->andFilterWhere(['like', 'u0003a.GF_NM', $this->getAttribute('groupfunction.GF_NM')])->andFilterWhere(['like', 'u0003b.SEQ_NM', $this->getAttribute('groupseqmen.SEQ_NM')]); return $dataProvider; }
public function actionGrading() { $out = []; if (isset($_POST['depdrop_parents'])) { $parents = $_POST['depdrop_parents']; if ($parents != null) { $GRP_FNC = $parents[0]; $GRP_SEQ = $parents[1]; $grd_param1 = null; if (!empty($_POST['depdrop_params'])) { $params = $_POST['depdrop_params']; $grd_param1 = $params[0]; // get the value of grading_id = js/html value } } $model = Jobgrademodul::find()->asArray()->where(['GF_ID' => $GRP_FNC, 'SEQ_ID' => $GRP_SEQ])->all(); foreach ($model as $key => $value) { $out[] = ['id' => $value['JOBGRADE_ID'], 'name' => $value['JOBGRADE_NM']]; } echo json_encode(['output' => $out, 'selected' => $grd_param1]); //echo json_encode(['output'=>$out, 'selected'=>'']); return; } } echo Json::encode(['output' => '', 'selected' => '']); }
protected function findModel($id) { if (($model = Jobgrademodul::findOne($id)) !== null) { return $model; } else { throw new NotFoundHttpException('The requested page does not exist.'); } }