/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = DocExam::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, '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; }
/** * @return \yii\db\ActiveQuery */ public function getExam() { return $this->hasMany(DocExam::className(), ['person_id' => 'id']); }
/** * Finds the DocExam model based on its primary key value. * If the model is not found, a 404 HTTP exception will be thrown. * @param integer $id * @return DocExam the loaded model * @throws NotFoundHttpException if the model cannot be found */ protected function findModel($id) { if (($model = DocExam::findOne($id)) !== null) { return $model; } else { throw new NotFoundHttpException('The requested page does not exist.'); } }
'openOnFocus' => false, 'persist' => false, 'maxItems' => 1, 'create' => false, // 'plugins' => ['remove_button'], 'valueField' => 'id', 'labelField' => 'fullName', '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, 'who_give')->widget(\dosamigos\selectize\SelectizeDropDownList::className(), ['items' => \yii\helpers\ArrayHelper::map(\app\models\DocExam::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]);