Пример #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]);
 }
Пример #2
0
 public function actionResult($id)
 {
     $result = StudentResult::findOne($id);
     if (Yii::$app->user->identity->role == User::ROLE_STUDENT) {
         $allowed = Yii::$app->user->can('updateStudent', ['id_student' => $result->idStudentEducation->idStudent->id]);
     } else {
         $allowed = Yii::$app->user->can('viewProgramFiles', ['id_program' => $result->idDisciplineSemester->idDiscipline->id_program]);
     }
     return $this->renderFiles('common\\models\\StudentResult', $id, $allowed);
 }
Пример #3
0
 public static function examList($id_result)
 {
     $currentResult = StudentResult::findOne($id_result);
     $currentStudent = StudentEducation::findOne($currentResult->id_student_education);
     $results = StudentResult::find()->innerJoinWith(['idStudentEducation' => function ($query) use($currentStudent) {
         $query->joinWith(['idStudent' => function ($query2) {
             $query2->orderBy('name');
         }])->where(['year' => $currentStudent->year, 'group' => $currentStudent->group]);
     }])->where(['id_discipline_semester' => $currentResult->id_discipline_semester, 'id_discipline_name' => $currentResult->id_discipline_name, 'examiner' => $currentResult->examiner, 'passing_date' => StudentResult::convertDate($currentResult->passing_date)])->all();
     return $results;
 }
 protected function getIdFaculty($id, $parent = false)
 {
     if ($parent) {
         if ($id == null) {
             return null;
         }
         $model = StudentResult::findOne($id);
         return $model->idStudentEducation->idProgram->id_faculty;
     } else {
         $model = StudentResultFile::find()->where(['id_file' => $id])->one();
         return $this->getIdFaculty($model->id_student_result, true);
     }
 }
Пример #5
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 
Пример #6
0
 public function actionViewDiscipline($id)
 {
     // $id - StudentResult
     $model = StudentResult::findOne($id);
     return $this->render('viewDiscipline', ['model' => $model]);
 }