/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = DocMigration::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, 'person_id' => $this->person_id, 'date' => $this->date, 'duration_months' => $this->duration_months, 'duration_days' => $this->duration_days, 'rec_status_id' => $this->rec_status_id, 'user_id' => $this->user_id, 'dc' => $this->dc]); $query->andFilterWhere(['like', 'series', $this->series])->andFilterWhere(['like', 'num', $this->num])->andFilterWhere(['like', 'who_give', $this->who_give])->andFilterWhere(['like', 'note', $this->note]); return $dataProvider; }
'searchField' => ['fullName'], ], ]);*/ ?> <?php echo $form->field($model, 'series')->textInput(['maxlength' => true]); ?> <?php echo $form->field($model, 'num')->textInput(['maxlength' => true]); ?> <?php echo $form->field($model, 'date')->widget(\dosamigos\datepicker\DatePicker::className(), ['language' => 'ru', 'options' => ['class' => 'form-control', 'autocomplete' => 'off'], 'clientOptions' => ['forceParse' => true, 'todayBtn' => true, 'clearBtn' => true, 'autoclose' => true, 'todayHighlight' => true, 'format' => 'dd.mm.yyyy']]); ?> <?php echo $form->field($model, 'duration_months')->textInput(); ?> <?php echo $form->field($model, 'duration_days')->textInput(); ?> <?php echo $form->field($model, 'who_give')->widget(\dosamigos\selectize\SelectizeDropDownList::className(), ['items' => \yii\helpers\ArrayHelper::map(\app\models\DocMigration::find()->select(['who_give'])->active()->distinct()->orderBy('who_give asc')->asArray()->all(), 'who_give', 'who_give'), 'options' => ['multiple' => false, 'class' => 'form-control', 'prompt' => ''], 'clientOptions' => ['selectOnTab' => true, 'openOnFocus' => false, 'persist' => false, 'maxItems' => 1, 'create' => true, 'valueField' => 'who_give', 'labelField' => 'who_give', 'searchField' => ['who_give']]]); ?> <?php echo $form->field($model, 'note')->textarea(['rows' => 6]);
/** * @return \yii\db\ActiveQuery */ public function getMigration() { return $this->hasMany(DocMigration::className(), ['person_id' => 'id']); }
/** * Finds the DocMigration model based on its primary key value. * If the model is not found, a 404 HTTP exception will be thrown. * @param integer $id * @return DocMigration the loaded model * @throws NotFoundHttpException if the model cannot be found */ protected function findModel($id) { if (($model = DocMigration::findOne($id)) !== null) { return $model; } else { throw new NotFoundHttpException('The requested page does not exist.'); } }