コード例 #1
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = ProgramHead::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, 'head_id' => $this->head_id]);
     $query->andFilterWhere(['like', 'name', $this->name]);
     return $dataProvider;
 }
コード例 #2
0
ファイル: _form.php プロジェクト: jaradsee/rmfaktha
 <div class="col-xs-6 col-sm-6"> 
     <?php 
echo $form->field($model, 'risk_level')->widget(Select2::classname(), ['data' => ArrayHelper::map(RiskLevel::find()->all(), 'level', 'name'), 'options' => ['placeholder' => 'เลือกระดับความรุนแรง ...'], 'pluginOptions' => ['allowClear' => true]]);
?>
  
  </div>
 <div class="col-xs-6 col-sm-6">  
    <?php 
echo $form->field($model, 'risk_head_department')->textInput(['maxlength' => true]);
?>
</div>
 
    
   <div class="col-sm-4 col-md-4">
       <?php 
echo $form->field($model, 'risk_program_head')->dropdownList(ArrayHelper::map(ProgramHead::find()->all(), 'id', 'name'), ['id' => 'ddl-risk_program_head', 'prompt' => 'เลือกโปรแกรมความเสี่ยง']);
?>
    </div>
     <div class="col-sm-4 col-md-4">
       <?php 
echo $form->field($model, 'risk_program_detail')->widget(DepDrop::classname(), ['options' => ['id' => 'ddl-risk_program_detail'], 'data' => [], 'pluginOptions' => ['depends' => ['ddl-risk_program_head'], 'placeholder' => 'เลือกอำเภอ...', 'url' => Url::to(['/riskhead/get-risk_program_detail'])]]);
?>
    </div>

  
    <?php 
echo $form->field($model, 'risk_program_text')->textInput(['maxlength' => true]);
?>

    <?php 
echo $form->field($model, 'login_name')->textInput(['maxlength' => true]);