/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = EmpCategory::find()->where(['is_status' => 0]); $dataProvider = new ActiveDataProvider(['query' => $query, 'sort' => ['defaultOrder' => ['emp_category_id' => SORT_DESC]]]); $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(['emp_category_id' => $this->emp_category_id, 'created_at' => $this->created_at, 'created_by' => $this->created_by, 'updated_at' => $this->updated_at, 'updated_by' => $this->updated_by, 'is_status' => $this->is_status]); $query->andFilterWhere(['like', 'emp_category_name', $this->emp_category_name])->andFilterWhere(['like', 'emp_category_alias', $this->emp_category_alias]); unset($_SESSION['exportData']); $_SESSION['exportData'] = $dataProvider; return $dataProvider; }
/** * @return \yii\db\ActiveQuery */ public function getEmpMasterCategory() { return $this->hasOne(EmpCategory::className(), ['emp_category_id' => 'emp_master_category_id']); }
?> </div> <div class="col-xs-12 col-sm-4 col-lg-4 form-group"> <?php echo Html::label('Designation', '', ['class' => 'control-label']); ?> <?php echo Html::dropDownList('designation', null, ArrayHelper::map(\app\modules\employee\models\EmpDesignation::find()->where(['is_status' => 0])->all(), 'emp_designation_id', 'emp_designation_name'), ['prompt' => 'Select Designation', 'class' => 'form-control']); ?> </div> <div class="col-xs-12 col-sm-4 col-lg-4 form-group"> <?php echo Html::label('Category', ''); ?> <?php echo Html::dropDownList('category', null, ArrayHelper::map(\app\modules\employee\models\EmpCategory::find()->where(['is_status' => 0])->all(), 'emp_category_id', 'emp_category_name'), ['prompt' => 'Select Category', 'class' => 'form-control']); ?> </div> </div> <div class="row"> <div class="col-xs-12 col-sm-4 col-lg-4 form-group"> <?php echo Html::label('Gender', ''); ?> <?php echo Html::dropDownList('gender', null, EmpInfo::getGenderOptions(), ['prompt' => 'Select Gender', 'class' => 'form-control']); ?> </div> <div class="col-xs-12 col-sm-4 col-lg-4 form-group"> <?php echo Html::label('City', '');
/** * Finds the EmpCategory model based on its primary key value. * If the model is not found, a 404 HTTP exception will be thrown. * @param integer $id * @return EmpCategory the loaded model * @throws NotFoundHttpException if the model cannot be found */ protected function findModel($id) { if (($model = EmpCategory::findOne($id)) !== null) { return $model; } else { throw new NotFoundHttpException('The requested page does not exist.'); } }