/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = Oblasti::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, 'use_for_report' => $this->use_for_report, 'id_inspekcii' => $this->id_inspekcii]); $query->andFilterWhere(['like', 'nazva', $this->nazva])->andFilterWhere(['like', 'kerivnyk', $this->kerivnyk])->andFilterWhere(['like', 'email', $this->email])->andFilterWhere(['like', 'address', $this->address]); return $dataProvider; }
use yii\widgets\ActiveForm; use yii\helpers\ArrayHelper; use app\models\Oblasti; /* @var $this yii\web\View */ /* @var $model app\models\Leshoz */ /* @var $form yii\widgets\ActiveForm */ ?> <div class="leshoz-form"> <?php $form = ActiveForm::begin(); ?> <?php echo $form->field($model, 'id_obl')->dropDownList(ArrayHelper::map(Oblasti::find()->all(), 'id', 'nazva'))->label(Yii::t('region', 'Nazva')); ?> <?php echo $form->field($model, 'nazva')->textInput(['maxlength' => true]); ?> <?php echo $form->field($model, 'N_dogovora')->textInput(['maxlength' => true]); ?> <?php echo $form->field($model, 'Data_dogovora')->textInput(); ?> <?php