/** * Displays a single User model. * @param integer $id * @return mixed */ public function actionView($id) { $data['userList'] = User::getAllUsers($id); $data['userEducation'] = User::getUserEducation($id); $data['userWorking'] = User::getUserWorking($id); $data['institution'] = Institution::find()->where(array('inst_status' => 1))->all(); $data['level'] = EducationLevel::find()->indexBy('el_id')->all(); return $this->render('view', $data); /*return $this->render('view', [ 'model' => $this->findModel($id), ]);*/ }
/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = Institution::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(['inst_id' => $this->inst_id]); $query->andFilterWhere(['like', 'inst_code', $this->inst_code])->andFilterWhere(['like', 'inst_name', $this->inst_name]); return $dataProvider; }
public static function actionGetfaculty() { $request = Yii::$app->request; $uni_ID = $request->post('uni_id'); $data = Institution::find()->where(array('uni_id' => $uni_ID))->asArray()->all(); Yii::$app->response->format = 'json'; //header json echo json_encode($data); }
public function actionIndex() { $data['faculty'] = Institution::find()->select(['inst_id', 'inst_name', 'inst_code', 'institution.uni_id'])->joinWith(['university'])->where(['uni_status' => 1])->asArray()->all(); // $data['faculty'] = Institution::find()->indexBy('inst_id')->where(array('id'=> $id))->asArray()->all(); return $this->render('index', $data); }