Newer
Older
<?php defined('SYSPATH') || die('No direct script access.');
class Controller_Teacher_Discipline_Journal extends Controller_Environment_Teacher
{
// id дисциплины
private $id;
/** @var Model_Discipline */
private $discipline;
public function before() {
parent::before();
$this->id = (int) $this->request->param('id');
$this->discipline = Model_Discipline::load($this->id);
if (!$this->discipline->exists()) {
throw new InvalidArgumentException(Error::DISCIPLINE_NOT_FOUND);
}
$this->setSemesterByDiscipline($this->discipline);
}
public function action_journal() {
$pageType = $this->request->param('type');
$this->discipline['LocalizedExamType'] = RusLang::tr($this->discipline->Type);
$lessons = Model_Journal::getLessonsForDiscipline($this->id);
$students = Model_Rating::GetStudentsForRating($this->id)->as_array('GroupID');
$lessonTypes = Model_Journal::getLessonTypes();
$this->twig->set([
'Discipline' => $this->discipline,
'Groups' => $this->discipline->getAllGroups()->groupByUniqueKey('ID'),
'Subgroups' => $this->discipline->getAllSubgroups()->groupByUniqueKey('ID'),
'Students' => $students,
'LessonTypes' => $lessonTypes->as_array(),
'Attendance' => Model_Journal::getAttendanceForDiscipline($this->discipline),
])->set_filename("teacher/discipline/journal");
}
}