예제 #1
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Groups::find()->joinWith(['speciality', 'speciality.faculty']);
     //$query->addSelect( [new \yii\db\Expression("CONCAT(faculty.faculty_name,' / ',speciality.speciality_name) as spec_full_name")] );
     $dataProvider = new ActiveDataProvider(['query' => $query]);
     $query->joinWith('okr');
     $query->joinWith('speciality');
     $this->load($params);
     $dataProvider->setSort(['attributes' => ['id_okr' => ['asc' => ['okr.okr_name' => SORT_ASC], 'desc' => ['okr.okr_name' => SORT_DESC], 'label' => 'Факультет/спеціальність'], 'main_group_name' => ['asc' => ['main_group_name' => SORT_ASC], 'desc' => ['main_group_name' => SORT_DESC], 'label' => 'Факультет/спеціальність'], 'inflow_year' => ['asc' => ['inflow_year' => SORT_ASC], 'desc' => ['inflow_year' => SORT_DESC], 'label' => 'Факультет/спеціальність'], 'number_of_students' => ['asc' => ['number_of_students' => SORT_ASC], 'desc' => ['number_of_students' => SORT_DESC], 'label' => 'Факультет/спеціальність'], 'id_speciality' => ['asc' => ['speciality.speciality_name' => SORT_ASC], 'desc' => ['speciality.speciality_name' => SORT_DESC], 'label' => 'Факультет/спеціальність']]]);
     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(['group_id' => $this->group_id, 'inflow_year' => $this->inflow_year, 'number_of_students' => $this->numb, 'parent_group' => $this->parent_group]);
     if (strlen($this->sub_group) > 0) {
         $query->andWhere("group_id in (select sg.parent_group from groups sg where " . "is_subgroup = 1 and sg.main_group_name like '%" . str_replace(["'", '"'], ["`", '`'], $this->sub_group) . "%') ");
     }
     $query->andWhere("is_subgroup is null or is_subgroup = 0");
     $query->andFilterWhere(['like', 'main_group_name', $this->main_group_name]);
     $query->andFilterWhere(['like', 'okr_name', $this->okr_name]);
     $query->andFilterWhere(['like', 'speciality_name', $this->id_speciality]);
     $query->andFilterWhere(['like', 'CONCAT(faculty.faculty_name," / ",speciality.speciality_name)', $this->spec_full_name]);
     return $dataProvider;
 }
예제 #2
0
use kartik\select2\Select2;
use app\module\handbook\models\DisciplineList;
use app\module\handbook\models\Discipline;
use app\module\handbook\models\LessonsType;
use kartik\switchinput\SwitchInput;
use app\module\handbook\models\Teachers;
use app\module\handbook\models\ClassRooms;
use app\module\handbook\models\Housing;
use app\module\handbook\models\Groups;
use app\module\handbook\models\DisciplineGroups;
use app\module\timetable\models\Lessons;
/* @var $this yii\web\View */
/* @var $model app\module\timetable\models\Lessons */
/* @var $form yii\widgets\ActiveForm */
$id_group = $_GET['id_group'];
$group_info = Groups::find()->where(['group_id' => $id_group])->all();
?>

<div class="copy-form">
    <div class="col-md-12">
        <?php 
$form = ActiveForm::begin();
?>
        
        <?php 
echo $form->field($model, 'parent')->hiddenInput(['value' => $group_info[0]['parent_group']])->label(false);
?>
        
        <div class="col-md-4">
            <div class="row well margin_for_editor_copy"> 
                <h4>Понеділок</h4>  
예제 #3
0
use app\module\handbook\models\Housing;
use app\module\handbook\models\Groups;
use app\module\handbook\models\DisciplineGroups;
/* @var $this yii\web\View */
/* @var $model app\module\timetable\models\Lessons */
/* @var $form yii\widgets\ActiveForm */
$lesson_number = $_GET['lesson_number'];
$day = $_GET['day'];
$id_faculty = $_GET['id_faculty'];
$id_speciality = $_GET['id_speciality'];
$course = $_GET['course'];
$semester = $_GET['semester'];
$is_numerator = $_GET['is_numerator'];
$id_group = $_GET['id_group'];
$id_okr = $_GET['id_okr'];
$students_in_group = Groups::find()->where(['group_id' => $id_group])->all();
$sig = $students_in_group[0]['number_of_students'] + 5;
$classes = ClassRooms::find()->Where('seats>' . $sig)->orderBy('classrooms_number ASC')->all();
foreach ($classes as $cl) {
    $housing = Housing::findOne(['housing_id' => $cl['id_housing']]);
    $classroomsArray[$cl['classrooms_id']] = $cl['classrooms_number'] . ' - ' . $housing['name'];
}
$d = Discipline::findAll(['id_group' => $id_group]);
if (empty($d)) {
    $d = Discipline::findAll(['id_group' => $students_in_group[0]['parent_group']]);
}
if (empty($d)) {
    echo '<div class="alert alert-danger" role="alert">Для даної групи немає дисциплін!</div>';
    exit;
}
foreach ($d as $dd) {
예제 #4
0
    echo $count;
    ?>
" class="panel-collapse collapse" role="tabpanel" aria-labelledby="collapseListGroupHeading<?php 
    echo $count;
    ?>
">
        <ul class="list-group">    
    <?php 
    foreach ($groups_list as $grl) {
        $sem = date("n");
        if ($sem > 8) {
            $semester_for_editor = 1;
        } else {
            $semester_for_editor = 2;
        }
        $gr = Groups::find()->where(['group_id' => $grl])->all();
        $course_get = date("Y") - $gr[0]['inflow_year'];
        $speciality_id = $gr[0]['id_speciality'];
        $group_name = $gr[0]['main_group_name'];
        $faculty_id = $af['faculty_id'];
        echo '<li class="list-group-item">
                <a href="index.php?r=timetable/lessons/editor&semester_for_editor=1&course_get=' . $course_get . '&faculty_id=' . $faculty_id . '&speciality_id=' . $speciality_id . '&group_id=' . $grl . '" target="_blank">' . $group_name . ' 1-й семестр
                </a>
                ' . "\t ||\t " . '    
                <a href="index.php?r=timetable/lessons/editor&semester_for_editor=2&course_get=' . $course_get . '&faculty_id=' . $faculty_id . '&speciality_id=' . $speciality_id . '&group_id=' . $grl . '" target="_blank">' . $group_name . ' 2-й семестр
                </a>
               </li>';
    }
    $count++;
    ?>
    </ul>        
 /**
  * Deletes an existing Lessons model.
  * If deletion is successful, the browser will be redirected to the 'index' page.
  * @param integer $id
  * @return mixed
  */
 public function actionDelete($id)
 {
     $model = $this->findModel($id);
     $this->findModel($id)->delete();
     $group = Groups::find()->where(['group_id' => $model->id_group])->all();
     if ($group[0]['parent_group'] != 0) {
         $url = Url::to('index.php?r=timetable/lessons/editor&id' . $model->lesson_id . '&semester_for_editor=' . $model->semester . '&course_get=' . $model->course . '&faculty_id=' . $model->id_faculty . '&speciality_id=' . $model->id_speciality . '&group_id=' . $group[0]['parent_group'] . '#day_lesson' . $model->day . '_' . $model->lesson_number);
     } else {
         $url = Url::to('index.php?r=timetable/lessons/editor&id' . $model->lesson_id . '&semester_for_editor=' . $model->semester . '&course_get=' . $model->course . '&faculty_id=' . $model->id_faculty . '&speciality_id=' . $model->id_speciality . '&group_id=' . $model->id_group . '#day_lesson' . $model->day . '_' . $model->lesson_number);
     }
     return $this->redirect($url);
 }
예제 #6
0
    echo $form->field($model, 'id_edebo')->textInput();
    ?>
    
    <?php 
    $okr = Okr::findOne($_GET['okr_id']);
    ?>
    <?php 
    echo $form->field($model, 'id_okr')->hiddenInput(['value' => $_GET['okr_id']])->label(false);
    ?>
    
    <?php 
    echo $form->field($model, 'tmp_okr')->textInput(['value' => $okr["okr_name"], 'disabled' => true])->label('ОКР');
    ?>
    
    <?php 
    echo $form->field($model, 'parent_group')->dropDownList(ArrayHelper::map(Groups::find()->where(['is_subgroup' => 0])->all(), 'group_id', 'main_group_name'), ['disabled' => true]);
    ?>
    
    <div class="form-group">
        <?php 
    echo Html::submitButton($model->isNewRecord ? 'Створити' : 'Оновити', ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']);
    ?>
    </div>
    
    <?php 
    ActiveForm::end();
    ?>
    
    <?php 
}
?>
예제 #7
0
    <?php 
echo $form->field($model, 'id_discipline')->widget(Select2::classname(), ['data' => ArrayHelper::map(DisciplineList::find()->orderBy('discipline_name ASC')->all(), 'discipline_id', 'discipline_name'), 'language' => 'uk', 'pluginOptions' => ['allowClear' => true]])->label('Дисципліна');
?>

    <?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_lessons_type')->widget(Select2::classname(), ['data' => ArrayHelper::map(LessonsType::find()->all(), 'id', 'lesson_type_name'), 'language' => 'uk', 'pluginOptions' => ['allowClear' => true]])->label('Тип заняття');
?>

    <?php 
echo Html::label("Групи");
echo Select2::widget(['model' => $model, 'attribute' => 'id_group', 'language' => 'ru', 'data' => ArrayHelper::map(Groups::find()->all(), 'group_id', 'main_group_name')]);
?>
  
        
    <?php 
echo $form->field($model, 'course')->textInput();
?>
    
    <?php 
echo $form->field($model, 'discipline_semester')->textInput();
?>

    <?php 
if (isset($_GET['id'])) {
    ?>