/**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Faculty::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(['faculty_id' => $this->faculty_id, 'id_edbo' => $this->id_edbo, 'id_deanery' => $this->id_deanery]);
     $query->andFilterWhere(['like', 'faculty_name', $this->faculty_name]);
     return $dataProvider;
 }
<div class="lessons-create">
    <div class="col-md-7">
        <h2>Створити новий розклад</h2>

        <?php 
echo $this->render('_beginForm', ['model' => $model]);
?>
    </div>
    
    <div class="col-md-5">
        
    <h2>Вже існуючі розклади</h2>    
        
        <div class="panel-group" role="tablist">
<?php 
$all_faculty = Faculty::find()->orderBy('faculty_name ASC')->all();
$count = 0;
foreach ($all_faculty as $af) {
    unset($groups_array);
    $all_gr = Lessons::find()->where(['id_faculty' => $af['faculty_id']])->select('id_group')->distinct()->all();
    foreach ($all_gr as $ag) {
        $gr = Groups::find()->where(['group_id' => $ag['id_group']])->all();
        if ($gr[0]['parent_group'] == 0) {
            $groups_array[] = $gr[0]['group_id'];
        } else {
            $groups_array[] = $gr[0]['parent_group'];
        }
    }
    $groups_list = array_unique($groups_array);
    ?>
    <div class="panel panel-default">
示例#3
0
<div class="lessons-form">

    <?php 
$form = ActiveForm::begin();
?>

    <?php 
echo $form->field($model, 'semester_for_editor')->dropDownList($semestr)->label("Семестр");
?>
    
    <?php 
echo $form->field($model, 'course_get')->dropDownList($course)->label("Курс");
?>
    
    <?php 
echo $form->field($model, 'id_faculty')->dropDownList(ArrayHelper::map(Faculty::find()->all(), 'faculty_id', 'faculty_name'), ['prompt' => 'Оберіть факультет', 'onchange' => '
                $.post("index.php?r=timetable/lessons/speciality_list&id=' . '"+$(this).val(), function( data ) {
                  $( "select#lessons-id_speciality" ).html( data );
                });
            '])->label("Факультет");
?>
    
    <?php 
echo $form->field($model, 'id_speciality')->dropDownList(ArrayHelper::map(Speciality::find()->all(), 'speciality_id', 'speciality_name'), ['prompt' => 'Оберіть спеціальність', 'onchange' => '
                $.post("index.php?r=timetable/lessons/groups_list&id=' . '"+$(this).val()+"&course=' . '"+$("#lessons-course_get").val(), function( data ) {
                  $( "select#lessons-id_group" ).html( data );
                });
            '])->label("Спеціальність");
?>
    
    <?php 
示例#4
0
$form = ActiveForm::begin();
?>

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

    <?php 
echo $form->field($model, 'id_edebo')->textInput();
?>

    <?php 
echo $form->field($model, 'id_cathedra')->widget(Select2::classname(), ['data' => $all_cathedra, 'language' => 'uk', 'pluginOptions' => ['allowClear' => true]])->label('Кафедра');
?>
   
   <?php 
echo $form->field($model, 'id_faculty')->dropDownList(ArrayHelper::map(Faculty::find()->orderBy('faculty_name ASC')->all(), 'faculty_id', 'faculty_name'));
?>

    <div class="form-group">
        <?php 
echo Html::submitButton($model->isNewRecord ? 'Додати' : 'Оновити', ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']);
?>
    </div>

    <?php 
ActiveForm::end();
?>

</div>