Пример #1
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Section::find();
     $dataProvider = new ActiveDataProvider(['query' => $query]);
     $this->load($params);
     if (!$this->validate()) {
         // uncomment the following line if you do not want to any records when validation fails
         // $query->where('0=1');
         return $dataProvider;
     }
     $query->andFilterWhere(['id' => $this->id, 'level_id' => $this->level_id]);
     $query->andFilterWhere(['like', 'section_name', $this->section_name]);
     return $dataProvider;
 }
Пример #2
0
?>
                <?php 
echo $form->field($model, 'email');
?>
                <!-- <?php 
echo $form->field($model, 'level_id')->dropDownList(ArrayHelper::map(Level::find()->all(), 'id', 'level_name'), ['prompt' => "Select Grade Level", 'onChange' => '
                            $.post( "index.php?r=site/lists&id=' . '"+$(this).val(), function(data) {
                                $( "select#signupform-section_id" ).html(data);
                            });']);
?>
 -->
                <?php 
echo $form->field($model, 'level_id')->dropDownList(ArrayHelper::map(Level::find()->all(), 'id', 'level_name'), ['prompt' => "Select Grade Level"]);
?>
                <?php 
echo $form->field($model, 'section_id')->dropDownList(ArrayHelper::map(Section::find()->all(), 'id', 'section_name', 'level_desc'), ['prompt' => "Select Section Name"]);
?>
                <?php 
echo $form->field($model, 'password')->passwordInput();
?>
                <div class="form-group">
                    <?php 
echo Html::submitButton('Signup', ['class' => 'btn btn-primary', 'name' => 'signup-button']);
?>
                </div>
            <?php 
ActiveForm::end();
?>
        </div>
    </div>
</div>
Пример #3
0
            <div class="box box-success">
                <div class="box-header">
                    <!--<h3 class="box-title">ฟอร์มบันทึกข้อมูล</h3>-->
                </div>
                <!-- /.box-header -->
                <div class="box-body">

                    <?php 
$form = ActiveForm::begin(['options' => ['enctype' => 'multipart/form-data']]);
?>

                    <div class="well well-small">
                        <div class="row">
                            <div class="col-md-4">
                                <?php 
echo $form->field($model, 'section')->widget(Select2::classname(), ['data' => ArrayHelper::map(Section::find()->all(), 'id', 'name'), 'options' => ['placeholder' => 'หน่วยงาน/ฝ่าย/แผนก...'], 'pluginOptions' => ['allowClear' => true]]);
?>
                            </div>
                            <div class="col-md-4">
                                <?php 
echo $form->field($model, 'date', ['inputOptions' => ['placeholder' => 'ระบุวันที่', 'class' => 'form-control datepicker', 'autocomplete' => 'off']])->widget(DatePicker::className(), ['dateFormat' => 'php:Y-m-d', 'language' => 'th'])->textInput();
?>
                            </div>
                            <div class="col-md-4">
                                <?php 
echo $form->field($model, 'error_type')->widget(Select2::classname(), ['data' => ArrayHelper::map(Comequipmenttype::find()->all(), 'id', 'name'), 'options' => ['placeholder' => 'เลือกอุปกรณ์...'], 'pluginOptions' => ['allowClear' => true]]);
?>
                            </div>
                            <div class="col-md-6">
                                <?php 
echo $form->field($model, 'request', ['inputOptions' => ['placeholder' => 'ระบุชื่อผู้แจ้งซ่อม', 'class' => 'form-control']])->textInput(['maxlength' => 100]);
Пример #4
0
 /**
  * Finds the Section model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $id
  * @return Section the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = Section::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }
Пример #5
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getSections()
 {
     return $this->hasMany(Section::className(), ['level_id' => 'id']);
 }