Newer
Older
/**
* @property $disciplines_collection Model_Disciplines
*/
class Controller_Office_Disciplines extends Controller_Environment_Office {
public function before() {
parent::before();
$this->user->checkAccess(User::RIGHTS_DEAN | User::RIGHTS_ADMIN);
$this->disciplines_collection = new Model_Disciplines();
$this->show_data(null);
}
public function action_filter() {
$this->show_data($this->request->param('parameter'));
private function show_data($state, $semesterID = null){
$semesterID = $semesterID ?: User::instance()->SemesterID;
Владислав Яковлев
committed
$facultyID = $this->user->Faculty->ID;
$parameters = ['semesterID' => $semesterID, 'facultyID' => $facultyID];
$disciplines = $this->disciplines_collection->setParamValues($parameters)
->getByState($state);
$teachers = [];
foreach ($disciplines as $discipline) {
$teachers[$discipline['ID']] = Model_Teacher::with($discipline['AuthorID']);
Владислав Яковлев
committed
Anton Bagliy
committed
$inMainList = $state === null;
$this->twig->set_filename(self::OFFICE . 'disciplines/index')
Anton Bagliy
committed
'Teachers' => $teachers,
'InMainList' => $inMainList