Esempio n. 1
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Lessons::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(['lesson_id' => $this->lesson_id, 'id_group' => $this->id_group, 'id_faculty' => $this->id_faculty, 'id_speciality' => $this->id_speciality, 'course' => $this->course, 'semester' => $this->semester, 'id_okr' => $this->id_okr, 'is_numerator' => $this->is_numerator, 'id_discipline' => $this->id_discipline, 'id_teacher' => $this->id_teacher, 'id_classroom' => $this->id_classroom, 'day' => $this->day, 'is_holiday' => $this->is_holiday, 'all_group' => $this->all_group, 'all_speciality' => $this->all_speciality, 'lesson_number' => $this->lesson_number, 'comment' => $this->comment]);
     return $dataProvider;
 }
Esempio n. 2
0
        <?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">
        <div class="panel-heading" role="tab" id="collapseListGroupHeading<?php 
    echo $count;
    ?>
">
 /**
  * Finds the Lessons model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $id
  * @return Lessons the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = Lessons::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }
Esempio n. 4
0
function day_print($day, $lesson_number, $id_group, $is_numerator, $id_okr, $parent)
{
    unset($one_lesson);
    $one_lesson = Lessons::findOne(['semester' => $_GET['semester_for_editor'], 'course' => $_GET['course_get'], 'id_speciality' => $_GET['speciality_id'], 'id_faculty' => $_GET['faculty_id'], 'day' => $day, 'lesson_number' => $lesson_number, 'is_numerator' => $is_numerator, 'id_group' => $id_group]);
    $lesson_id = $one_lesson['lesson_id'];
    if (empty($one_lesson)) {
        //По заданным параметрам ничего нет
        if ($is_numerator == 1) {
            echo '<div class="info_in_editor bottom_ccc_border">';
            echo '<div id="lesson_id' . $lesson_id . '"></div>';
            echo '<div id="day_lesson';
            echo $day . '_' . $lesson_number;
            echo '"></div>';
            ?>
            <p class="editor_info">Чисельник</p>
            <?php 
            echo Html::button('', ['value' => Url::to('index.php?r=timetable/lessons/create&id_okr=' . $id_okr . '&id_group=' . $id_group . '&id_faculty=' . $_GET['faculty_id'] . '&id_speciality=' . $_GET['speciality_id'] . '&course=' . $_GET['course_get'] . '&semester=' . $_GET['semester_for_editor'] . '&is_numerator=1&day=' . $day . '&lesson_number=' . $lesson_number), 'class' => 'editor_edit_button fa fa-pencil-square-o', 'id' => 'modalButton', 'title' => 'Редагувати']);
            ?>
            <?php 
            //echo '<p class="none_information_in_editor">Інформація відсутня</p>';
            echo '<p class="none_information_in_editor"></p>';
            echo '</div>';
        } else {
            echo '<div class="info_in_editor">';
            echo '<div id="lesson_id' . $lesson_id . '"></div>';
            echo '<div id="day_lesson';
            echo $day . '_' . $lesson_number;
            echo '"></div>';
            ?>
            <p class="editor_info">Знаменник</p>
            <?php 
            echo Html::button('', ['value' => Url::to('index.php?r=timetable/lessons/create&id_okr=' . $id_okr . '&id_group=' . $id_group . '&id_faculty=' . $_GET['faculty_id'] . '&id_speciality=' . $_GET['speciality_id'] . '&course=' . $_GET['course_get'] . '&semester=' . $_GET['semester_for_editor'] . '&is_numerator=0&day=' . $day . '&lesson_number=' . $lesson_number), 'class' => 'editor_edit_button fa fa-pencil-square-o', 'id' => 'modalButton', 'title' => 'Редагувати']);
            ?>
            <?php 
            //echo '<p class="none_information_in_editor">Інформація відсутня</p>';
            echo '<p class="none_information_in_editor"></p>';
            echo '</div>';
        }
    } else {
        //По заданным параметрам найдены данные
        if ($one_lesson['is_holiday'] == 1) {
            //Если ДСР
            if ($is_numerator == 1) {
                echo '<div class="info_in_editor">';
                echo '<div id="lesson_id' . $lesson_id . '"></div>';
                echo '<div id="day_lesson';
                echo $day . '_' . $lesson_number;
                echo '"></div>';
                ?>
                <?php 
                echo Html::button('', ['value' => Url::to('index.php?r=timetable/lessons/update&id=' . $lesson_id . '&id_okr=' . $id_okr . '&id_group=' . $id_group . '&id_faculty=' . $_GET['faculty_id'] . '&id_speciality=' . $_GET['speciality_id'] . '&course=' . $_GET['course_get'] . '&semester=' . $_GET['semester_for_editor'] . '&is_numerator=1&day=' . $day . '&lesson_number=' . $lesson_number), 'class' => 'editor_edit_button fa fa-pencil-square-o', 'id' => 'modalButton', 'title' => 'Редагувати']);
                ?>
                <a href="<?php 
                echo Url::toRoute(['delete', 'parent' => $parent, 'id' => $lesson_id]);
                ?>
" data-pjax="0" data-method="post" data-confirm="Ви впевнені, що хочете видалити цей запис?" class="editor_delete_button"><i class="fa fa-trash"></i></a>
                <?php 
                echo '<p class="dsr_in_editor">ДСР</p>';
                echo '</div>';
            } else {
                echo '<div class="info_in_editor">';
                echo '<div id="lesson_id' . $lesson_id . '"></div>';
                echo '<div id="day_lesson';
                echo $day . '_' . $lesson_number;
                echo '"></div>';
                ?>
                <?php 
                echo Html::button('', ['value' => Url::to('index.php?r=timetable/lessons/update&id=' . $lesson_id . '&id_okr=' . $id_okr . '&id_group=' . $id_group . '&id_faculty=' . $_GET['faculty_id'] . '&id_speciality=' . $_GET['speciality_id'] . '&course=' . $_GET['course_get'] . '&semester=' . $_GET['semester_for_editor'] . '&is_numerator=1&day=' . $day . '&lesson_number=' . $lesson_number), 'class' => 'editor_edit_button fa fa-pencil-square-o', 'id' => 'modalButton', 'title' => 'Редагувати']);
                ?>
                <a href="<?php 
                echo Url::toRoute(['delete', 'parent' => $parent, 'id' => $lesson_id]);
                ?>
" data-pjax="0" data-method="post" data-confirm="Ви впевнені, що хочете видалити цей запис?" class="editor_delete_button"><i class="fa fa-trash"></i></a>
                <?php 
                echo '</div>';
            }
        } else {
            //Обычный день
            if ($is_numerator == 1) {
                echo '<div class="info_in_editor bottom_ccc_border">';
                echo '<div id="lesson_id' . $lesson_id . '"></div>';
                echo '<div id="day_lesson';
                echo $day . '_' . $lesson_number;
                echo '"></div>';
                ?>
                <p class="editor_info">Чисельник</p>
                <?php 
                echo Html::button('', ['value' => Url::to('index.php?r=timetable/lessons/update&id=' . $lesson_id . '&id_okr=' . $id_okr . '&id_group=' . $id_group . '&id_faculty=' . $_GET['faculty_id'] . '&id_speciality=' . $_GET['speciality_id'] . '&course=' . $_GET['course_get'] . '&semester=' . $_GET['semester_for_editor'] . '&is_numerator=1&day=' . $day . '&lesson_number=' . $lesson_number), 'class' => 'editor_edit_button fa fa-pencil-square-o', 'id' => 'modalButton', 'title' => 'Редагувати']);
                ?>
                
                <?php 
                echo Html::button('', ['value' => Url::to('index.php?r=timetable/lessons/copy&id=' . $lesson_id . '&id_okr=' . $id_okr . '&id_group=' . $id_group . '&id_faculty=' . $_GET['faculty_id'] . '&id_speciality=' . $_GET['speciality_id'] . '&course=' . $_GET['course_get'] . '&semester=' . $_GET['semester_for_editor'] . '&is_numerator=1&day=' . $day . '&lesson_number=' . $lesson_number), 'class' => 'editor_copy_button fa fa-files-o', 'id' => 'modalButtonCopy', 'title' => 'Копіювати']);
                ?>
                
                
                <a href="<?php 
                echo Url::toRoute(['delete', 'parent' => $parent, 'id' => $lesson_id]);
                ?>
" data-pjax="0" data-method="post" data-confirm="Ви впевнені, що хочете видалити цей запис?" class="editor_delete_button"><i class="fa fa-trash"></i></a>
                <?php 
            } else {
                echo '<div class="info_in_editor">';
                echo '<div id="lesson_id' . $lesson_id . '"></div>';
                echo '<div id="day_lesson';
                echo $day . '_' . $lesson_number;
                echo '"></div>';
                ?>
                <p class="editor_info">Знаменник</p>
                <?php 
                echo Html::button('', ['value' => Url::to('index.php?r=timetable/lessons/update&id=' . $lesson_id . '&id_okr=' . $id_okr . '&id_group=' . $id_group . '&id_faculty=' . $_GET['faculty_id'] . '&id_speciality=' . $_GET['speciality_id'] . '&course=' . $_GET['course_get'] . '&semester=' . $_GET['semester_for_editor'] . '&is_numerator=0&day=' . $day . '&lesson_number=' . $lesson_number), 'class' => 'editor_edit_button fa fa-pencil-square-o', 'id' => 'modalButton', 'title' => 'Редагувати']);
                ?>
                <?php 
                echo Html::button('', ['value' => Url::to('index.php?r=timetable/lessons/copy&id=' . $lesson_id . '&id_okr=' . $id_okr . '&id_group=' . $id_group . '&id_faculty=' . $_GET['faculty_id'] . '&id_speciality=' . $_GET['speciality_id'] . '&course=' . $_GET['course_get'] . '&semester=' . $_GET['semester_for_editor'] . '&is_numerator=1&day=' . $day . '&lesson_number=' . $lesson_number), 'class' => 'editor_copy_button fa fa-files-o', 'id' => 'modalButtonCopy', 'title' => 'Копіювати']);
                ?>
                <a href="<?php 
                echo Url::toRoute(['delete', 'parent' => $parent, 'id' => $lesson_id]);
                ?>
" data-pjax="0" data-method="post" data-confirm="Ви впевнені, що хочете видалити цей запис?" class="editor_delete_button"><i class="fa fa-trash"></i></a>
                <?php 
            }
            ?>
            
                <p class="editor_p">
                    <h4>
                        <?php 
            echo getDisciplineName($one_lesson['id_discipline']);
            ?>
                    </h4>
                </p>
                
                <p class="editor_p">
                    <h5 class="teacher_name">
                        <?php 
            echo getTeacherName($one_lesson['id_teacher']);
            ?>
                    </h5>
                </p>
                
                <p class="editor_p">
                    <h5 class="editor_h5">
                        <?php 
            echo getDisciplineType($one_lesson['id_discipline']);
            ?>
                    </h5>
                </p>
                
                <p class="editor_p">
                    <?php 
            echo getHousingName($one_lesson['id_classroom']);
            ?>
    
                </p>
                
                <p class="editor_p">
                    <?php 
            echo getClassromNumber($one_lesson['id_classroom']);
            ?>
                </p>
                <p class="editor_p">
                    <?php 
            echo $one_lesson['comment'];
            ?>
                </p>
                <?php 
            echo '</div>';
        }
    }
    echo '</div>';
}