/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = RiskClinictype::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]); $query->andFilterWhere(['like', 'name', $this->name]); return $dataProvider; }
/** * Finds the RiskClinictype model based on its primary key value. * If the model is not found, a 404 HTTP exception will be thrown. * @param integer $id * @return RiskClinictype the loaded model * @throws NotFoundHttpException if the model cannot be found */ protected function findModel($id) { if (($model = RiskClinictype::findOne($id)) !== null) { return $model; } else { throw new NotFoundHttpException('The requested page does not exist.'); } }
public function getRiskClinictype() { return $this->hasOne(RiskClinictype::className(), ['id' => 'clinictype_id']); }
<?php echo $form->field($model, 'risk_department')->widget(Select2::classname(), ['data' => ArrayHelper::map(RiskAddDep::find()->all(), 'dep_id', 'dep_name'), 'options' => ['placeholder' => 'เลือกแแผนก ...'], 'pluginOptions' => ['allowClear' => true]]); ?> </div> <div class="col-xs-6 col-sm-6"> <?php echo $form->field($model, 'risk_miss')->inline()->radioList(\frontend\models\RiskHead::itemAlias('risk_miss')); ?> </div> <div class="col-xs-6 col-sm-6"> <?php echo $form->field($model, 'clinictype')->widget(Select2::classname(), ['data' => ArrayHelper::map(RiskClinictype::find()->all(), 'id', 'name'), 'options' => ['placeholder' => 'เลือกประเภทความเสี่ยง ...'], 'pluginOptions' => ['allowClear' => true]]); ?> </div> <?php echo $form->field($model, 'risk_event')->textarea(['rows' => 3]); ?> </div> <div class="col-xs-6 col-sm-6"> <?php echo $form->field($model, 'risk_outcome_pt')->textInput(['maxlength' => true]); ?> </div>