/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = Specclasses::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(['spec_class_id' => $this->spec_class_id]); $query->andFilterWhere(['like', 'spec_class_name', $this->spec_class_name]); return $dataProvider; }
<?php echo $form->field($model, 'id_housing')->dropDownList(ArrayHelper::map(Housing::find()->all(), 'housing_id', 'name')); ?> <?php echo $form->field($model, 'seats')->textInput(); ?> <?php echo $form->field($model, 'comp_number')->textInput(); ?> <?php echo Html::label("Тип аудиторії"); echo Select2::widget(['model' => $model, 'attribute' => 'options', 'language' => 'ru', 'data' => ArrayHelper::map(Specclasses::find()->all(), 'spec_class_id', 'spec_class_name'), 'options' => ['multiple' => true]]); ?> <br/> <?php echo Html::label('Інші дисципліни'); echo $form->field($model, 'is_public')->widget(SwitchInput::classname(), ['type' => SwitchInput::CHECKBOX])->label(false); ?> <div class="form-group"> <?php echo Html::submitButton($model->isNewRecord ? 'Створити' : 'Оновити', ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']); ?> </div> <?php ActiveForm::end(); ?>