/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = Department::find(); $dataProvider = new ActiveDataProvider(['query' => $query]); $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(['id' => $this->id, 'user_id' => $this->user_id, 'department_id' => $this->department_id, 'created_at' => $this->created_at, 'created_by' => $this->created_by, 'updated_at' => $this->updated_at, 'updated_by' => $this->updated_by, 'weight' => $this->weight]); $query->andFilterWhere(['like', 'title', $this->title])->andFilterWhere(['like', 'description', $this->description])->andFilterWhere(['like', 'phone', $this->phone])->andFilterWhere(['like', 'fax', $this->fax])->andFilterWhere(['like', 'email', $this->email]); return $dataProvider; }
<?php echo $form->field($model, 'first_name'); ?> <?php echo $form->field($model, 'patronymic'); ?> <?php $listdata = ArrayHelper::map(Post::find()->all(), 'id', 'title'); ?> <?php echo $form->field($model, 'post_id')->dropDownList($listdata, ['class' => 'form-control select']); ?> <?php $listdata = ArrayHelper::map(Department::find()->all(), 'id', 'title'); ?> <?php echo $form->field($model, 'department_id')->dropDownList($listdata, ['class' => 'form-control select']); ?> <?php echo $form->field($model, 'email_work'); ?> <?php echo $form->field($model, 'password')->passwordInput(); ?> <div class="form-group"> <?php echo Html::submitButton(Yii::t('app', 'Signup'), ['class' => 'btn btn-primary', 'name' => 'signup-button']); ?>