コード例 #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
 /**
  * Finds the Groups model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $id
  * @return Groups the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = Groups::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }
コード例 #3
0
ファイル: _copy.php プロジェクト: petlyakss/test_timetable
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>  
コード例 #4
0
ファイル: Lessons.php プロジェクト: petlyakss/test_timetable
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getGroup()
 {
     return $this->hasOne(Groups::className(), ['group_id' => 'id_group']);
 }
コード例 #5
0
ファイル: _form.php プロジェクト: petlyakss/test_timetable
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) {
コード例 #6
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>        
コード例 #7
0
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 
echo $form->field($model, 'id_group')->dropDownList(ArrayHelper::map(Groups::findAll(['is_subgroup' => 0]), 'group_id', 'main_group_name'), ['prompt' => 'Оберіть групу'])->label("Група");
?>
  
    <div class="form-group">
        <?php 
echo Html::submitButton($model->isNewRecord ? 'Обрати' : 'Оновити', ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']);
?>
    </div>

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

</div>
コード例 #8
0
 /**
  * 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);
 }
コード例 #9
0
ファイル: _form.php プロジェクト: petlyakss/test_timetable
    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 
}
?>
コード例 #10
0
ファイル: _form.php プロジェクト: petlyakss/test_timetable
    <?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'])) {
    ?>
    
コード例 #11
0
ファイル: view.php プロジェクト: petlyakss/test_timetable
use app\module\handbook\models\Groups;
/* @var $this yii\web\View */
/* @var $model app\module\handbook\models\Discipline */
$d_name = DisciplineList::findOne([$model->id_discipline]);
$this->title = $d_name['discipline_name'];
$this->params['breadcrumbs'][] = ['label' => 'Дисципліни', 'url' => ['index']];
$this->params['breadcrumbs'][] = $this->title;
function auditory($val)
{
    $classes = ClassRooms::findOne(['classrooms_id' => $val]);
    $housing = Housing::findOne(['housing_id' => $classes['id_housing']]);
    return $classes['classrooms_number'] . ' - ' . $housing['name'];
}
$optionsId = DisciplineGroups::findAll(['id_discipline' => $model->discipline_distribution_id]);
for ($i = 0; $i < count($optionsId); $i++) {
    $optionName[] = Groups::findAll(['group_id' => $optionsId[$i]['id_group']]);
    $optionsArray[] = $optionName[$i][0]['main_group_name'] . " ";
}
$optionsString = implode(' | ', $optionsArray);
?>
<div class="discipline-view">

    <h1><?php 
echo Html::encode($this->title);
?>
</h1>

    <p>
        <?php 
echo Html::a('Оновити', ['update', 'id' => $model->discipline_distribution_id], ['class' => 'btn btn-primary']);
?>
コード例 #12
0
ファイル: Okr.php プロジェクト: petlyakss/test_timetable
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getGroups()
 {
     return $this->hasMany(Groups::className(), ['id_okr' => 'okr_id']);
 }
コード例 #13
0
ファイル: editor.php プロジェクト: petlyakss/test_timetable
use yii\bootstrap\Modal;
use yii\helpers\Url;
/* @var $this yii\web\View */
/* @var $model app\module\timetable\models\Lessons */
$semester_for_editor = $_GET['semester_for_editor'];
$course_get = $_GET['course_get'];
$faculty = $_GET['faculty_id'];
$speciality = $_GET['speciality_id'];
$group_id = $_GET['group_id'];
$inflow_year = date('Y') - $course_get;
$spec_name = Speciality::findOne(["speciality_id" => $speciality]);
$faculty_name = Faculty::findOne(["faculty_id" => $faculty]);
$week = ["", "Понеділок", "Вівторок", "Середа", "Четвер", "П'ятниця", "Субота"];
$groups_list = Groups::findAll(["id_speciality" => $speciality, "inflow_year" => $inflow_year, "group_id" => $group_id]);
$less_time = LessonTime::find()->all();
$gl = Groups::findAll(["parent_group" => $group_id]);
if (count($gl) > 0) {
    //Определяем есть ли у группы подгруппы
    $group_has_subgroup = true;
    $groups_list = $gl;
    $parent = $gl[0]['parent_group'];
} else {
    $group_has_subgroup = false;
    $parent = 0;
}
$this->title = 'Редагувати розклад:';
$this->params['breadcrumbs'][] = ['label' => 'Редактор розкладу', 'url' => ['index']];
$this->params['breadcrumbs'][] = $semester_for_editor . ' семестр';
$this->params['breadcrumbs'][] = $course_get . ' курс';
$this->params['breadcrumbs'][] = $faculty_name['faculty_name'];
$this->params['breadcrumbs'][] = $spec_name['speciality_name'];