Example #1
0
 public function CheckFaculty($rule, $action)
 {
     /* @var $model StudentEducation */
     switch ($action->id) {
         case 'index':
             $model = StudentEducation::find()->where(['id_student' => Yii::$app->request->get('id'), 'year' => YearHelper::getYear()])->one();
             $id_faculty = $model ? $model->idProgram->id_faculty : null;
             break;
         case 'update':
             $model = StudentEducation::findOne(Yii::$app->request->get('id_student'));
             $id_faculty = $model->idProgram->id_faculty;
             break;
         case 'delete':
             $id = Yii::$app->request->get('id');
             if ($id) {
                 /* @var $result StudentResult */
                 $result = StudentResult::findOne($id);
                 $model = StudentEducation::findOne($result->id_student_education);
                 $id_faculty = $model->idProgram->id_faculty;
             } else {
                 $id_faculty = null;
             }
             break;
         default:
             $id_faculty = null;
     }
     return Yii::$app->user->can('updateFaculty', ['id_faculty' => $id_faculty]);
 }
Example #2
0
 protected function getIdFaculty($id, $parent = false)
 {
     if ($parent) {
         $model = StudentEducation::find()->where(['id_student' => $id, 'year' => YearHelper::getYear()])->one();
         return $model->idProgram->id_faculty;
     } else {
         $model = StudentEducation::findOne($id);
         return $model->idProgram->id_faculty;
     }
 }
Example #3
0
 public static function newExamList($id_student, $id_semester)
 {
     $currentStudent = StudentEducation::findOne($id_student);
     $studentResults = StudentResult::find()->innerJoinWith(['idStudentEducation' => function ($query) use($currentStudent) {
         $query->where(['year' => $currentStudent->year, 'group' => $currentStudent->group]);
     }])->where(['id_discipline_semester' => $id_semester])->select('id_student');
     $students = StudentEducation::find()->joinWith(['idStudent' => function ($query) {
         $query->orderBy('name');
     }])->where(['year' => $currentStudent->year, 'id_program' => $currentStudent->id_program, 'course' => $currentStudent->course, 'group' => $currentStudent->group])->andWhere(['not in', 'id_student', $studentResults])->all();
     $results = [];
     foreach ($students as $student) {
         $result = new StudentResult();
         $result->id_student_education = $student->id;
         $result->id_discipline_semester = $id_semester;
         $results[] = $result;
     }
     return $results;
 }
Example #4
0
<?php

use common\models\Program;
use common\models\StudentEducation;
use common\models\StudentResult;
/* @var $this yii\web\View */
/* @var $provider yii\data\ActiveDataProvider */
/* @var $program Program */
/* @var $idParent integer */
/* @var $student StudentEducation */
/* @var $result StudentResult */
$result = StudentResult::findOne($idParent);
$student = StudentEducation::findOne($result->id_student_education);
$program = Program::findOne($student->id_program);
$this->title = 'Файлы';
$this->params['breadcrumbs'][] = ['label' => 'Образовательные программы', 'url' => ['/program', 'idParent' => $program->id_faculty]];
$this->params['breadcrumbs'][] = ['label' => 'Студенты', 'url' => ['/student', 'idParent' => $student->id_program, 'page' => Yii::$app->session->get('studentPage')]];
$this->params['breadcrumbs'][] = ['label' => 'Результаты', 'url' => ['/student/result/index', 'id' => $student->id_student]];
$this->params['breadcrumbs'][] = $this->title;
?>
<h2>Файлы</h2>
<h3>
    Студент: <?php 
echo $student->studentName;
?>
    Дисциплина: <?php 
echo $result->idDisciplineSemester->idDiscipline->fullName;
?>
</h3>

<?php 
Example #5
0
 protected function getIdFaculty($id, $parent = false)
 {
     if ($parent) {
         $model = Program::findOne($id);
         return $model->id_faculty;
     } else {
         $model = StudentEducation::findOne($id);
         return $model->idProgram->id_faculty;
     }
 }
Example #6
0
<?php

use yii\grid\GridView;
use yii\helpers\Html;
use yii\widgets\Pjax;
use common\models\Program;
use common\models\StudentEducation;
use common\helpers\YearHelper;
/* @var $this yii\web\View */
/* @var $provider yii\data\ActiveDataProvider */
/* @var $program Program */
/* @var $idParent integer */
/* @var $student StudentEducation */
require Yii::$app->basePath . '/views/grid/index.php';
$student = StudentEducation::findOne(['id_student' => $idParent, 'year' => YearHelper::getYear()]);
$program = Program::findOne($student->id_program);
$this->title = 'История';
$this->params['breadcrumbs'][] = ['label' => 'Образовательные программы', 'url' => ['/program', 'idParent' => $program->id_faculty]];
$this->params['breadcrumbs'][] = ['label' => 'Студенты', 'url' => ['/student', 'idParent' => $student->id_program, 'page' => Yii::$app->session->get('studentPage')]];
$this->params['breadcrumbs'][] = $this->title;
?>
<h2>История</h2>
<h3>
    Студент: <?php 
echo "{$student->studentName}";
?>
</h3>

<p>
    <?php 
echo Html::a('Новый учебный год', ['create', 'idParent' => $idParent], ['class' => 'btn btn-success actionCreate']);