/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = ClnCauseInj::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(['CAUSE_GEN_NO' => $this->CAUSE_GEN_NO, 'CREATE_DATE' => $this->CREATE_DATE, 'UPDATE_DATE' => $this->UPDATE_DATE, 'VERSION' => $this->VERSION]); $query->andFilterWhere(['like', 'CAUSE_CODE', $this->CAUSE_CODE])->andFilterWhere(['like', 'CAUSE_NAME', $this->CAUSE_NAME])->andFilterWhere(['like', 'CAUSE_TYPE', $this->CAUSE_TYPE])->andFilterWhere(['like', 'CREATE_BY', $this->CREATE_BY])->andFilterWhere(['like', 'UPDATE_BY', $this->UPDATE_BY]); return $dataProvider; }
/** * Updates an existing ClnTranInj model. * If update is successful, the browser will be redirected to the 'view' page. * @param integer $id * @return mixed */ public function actionUpdate($id) { $model = $this->findModel($id); $modelClnDiagnose = ClnDiagnose::findOne(['TRAN_INJ_GEN_NO' => $id]); $sportItems = ArrayHelper::map(ClnSport::find()->all(), 'SPORT_GEN_NO', 'SPORT_NAME'); $causeItems = ArrayHelper::map(ClnCauseInj::find()->all(), 'CAUSE_GEN_NO', 'CAUSE_NAME'); $bondItems = ArrayHelper::map(ClnBoundaryInj::find()->all(), 'BOND_GEN_NO', 'BOND_NAME'); $searchClnMedicineTestSearchModel = new \app\models\ClnMedicineTestSearch(); $queryParams = array(); $queryParams = Yii::$app->request->queryParams; $queryParams['ClnMedicineTestSearch']['TRAN_INJ_GEN_NO'] = $id; $dataClnMedicineTestProvider = $searchClnMedicineTestSearchModel->search($queryParams); //Yii::$app->request->queryParams); if ($model->load(Yii::$app->request->post()) && $model->save()) { return $this->redirect(['view', 'id' => $model->TRAN_INJ_GEN_NO]); } else { return $this->render('update', ['model' => $model, 'modelClnDiagnose' => $modelClnDiagnose, 'sportItems' => $sportItems, 'causeItems' => $causeItems, 'bondItems' => $bondItems, 'searchClnMedicineTestSearchModel' => $searchClnMedicineTestSearchModel, 'dataClnMedicineTestProvider' => $dataClnMedicineTestProvider]); } }
<?php echo $form->field($model, 'DIAGNOSE_TYPE')->radioList(['1' => 'กีฬา', '2' => 'ทั่วไป'], ['separator' => '<span style="padding: 0 40px"> </span>', 'tabindex' => 3]); ?> </div> </div> <div class="row"> <div class="col-md-6"> <div class="form-group"> <?php echo $form->field($model, 'SPORT_GEN_NO')->widget(Select2::classname(), ['data' => ArrayHelper::map(ClnSport::find()->all(), 'SPORT_GEN_NO', 'SPORT_NAME'), 'options' => ['placeholder' => 'Select a state ...'], 'pluginOptions' => ['allowClear' => true]]); ?> <?php echo $form->field($model, 'CAUSE_GEN_NO')->widget(Select2::classname(), ['data' => ArrayHelper::map(ClnCauseInj::find()->all(), 'CAUSE_GEN_NO', 'CAUSE_NAME'), 'options' => ['placeholder' => 'Select a state ...'], 'pluginOptions' => ['allowClear' => true]]); ?> <?php echo $form->field($model, 'BOND_GEN_NO')->widget(Select2::classname(), ['data' => ArrayHelper::map(ClnBoundaryInj::find()->all(), 'BOND_GEN_NO', 'BOND_NAME'), 'options' => ['placeholder' => 'Select a state ...'], 'pluginOptions' => ['allowClear' => true]]); ?> </div> </div> <div class="col-md-6"> <div class="form-group"> <?php echo $form->field($model, 'CAUSE_OTHER')->textInput(['maxlength' => true]); ?>