/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = Status::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(['id' => $this->id, 'weight' => $this->weight, 'closed' => $this->closed]); $query->andFilterWhere(['like', 'title', $this->title]); return $dataProvider; }
<? $form = ActiveForm::begin([ 'action' => ['index'], 'method' => 'get', ]) ?> <div class="row"> <div class="col-sm-4"> <?php echo $form->field($model, 'title'); ?> </div> <div class="col-sm-4"> <? $statusList = ArrayHelper::map( Status::find()->orderBy('weight')->asArray()->all(), 'id', 'title' ); echo $form->field($model, 'status_id')->dropDownList([''=>''] + $statusList+[ Status::OPENED => \Yii::t('type', '<< Opened >>'), Status::CLOSED => \Yii::t('type', '<< Closed >>'), ]); ?> </div> <div class="col-sm-4"> <? $priorityList = ArrayHelper::map( Priority::find()->orderBy('weight')->asArray()->all(), 'id',