/** * Invoke an action given its name * * This function requests information necessary to operate on * VSES017 AIS application * * @param Trace $trace trace object * @param string $action action name * @param Context $context fajr context */ public function invokeAction(Trace $trace, $action, Context $context) { $request = $context->getRequest(); $response = $context->getResponse(); Preconditions::checkIsString($action); $this->screenFactory = new VSES017\VSES017_factory($context->getAisConnection()); $this->adminStudia = $this->screenFactory->newAdministraciaStudiaScreen($trace); $this->studium = $request->getParameter('studium', '0'); $this->zoznamStudii = $this->adminStudia->getZoznamStudii($trace->addChild("Get Zoznam Studii:")); $this->zapisneListy = $this->adminStudia->getZapisneListy($trace->addChild('getZapisneListy'), $this->studium); $this->zapisnyList = $request->getParameter('list'); if (empty($this->zapisnyList)) { $tmp = $this->zapisneListy->getData(); $lastList = end($tmp); $this->zapisnyList = $lastList['index']; } $this->terminyHodnoteniaScreen = $this->screenFactory->newTerminyHodnoteniaScreen($trace, $this->adminStudia->getZapisnyListIdFromZapisnyListIndex($trace, $this->zapisnyList), $this->adminStudia->getStudiumIdFromZapisnyListIndex($trace, $this->zapisnyList)); // FIXME: chceme to nejak refaktorovat, aby sme nevytvarali zbytocne // objekty, ktore v konstruktore robia requesty $this->hodnoteniaScreen = $this->screenFactory->newHodnoteniaPriemeryScreen($trace, $this->adminStudia->getZapisnyListIdFromZapisnyListIndex($trace, $this->zapisnyList)); $response->set('zoznamStudii', $this->zoznamStudii); $response->set('studium', $this->studium); $response->set('zapisneListy', $this->zapisneListy); $response->set('zapisnyList', $this->zapisnyList); parent::invokeAction($trace, $action, $context); }
public function invokeAction(Trace $trace, $action, Request $request) { Preconditions::checkIsString($action); if (!$this->loginManager->isLoggedIn()) { throw new AuthenticationRequiredException(); } return parent::invokeAction($trace, $action, $request); }
public function __construct(FajrConfig $config, LoginManager $loginManager, ServerManager $serverManager, sfSessionStorage $session, DisplayManager $displayManager, Router $router) { parent::__construct($displayManager, $router); $this->config = $config; $this->loginManager = $loginManager; $this->serverManager = $serverManager; $this->session = $session; }
/** * Invoke an action given its name * * This function requests information necessary to operate on * VSST060 AIS application * * @param Trace $trace trace object * @param string $action action name * @param Request $request incoming request */ public function invokeAction(Trace $trace, $action, Request $request) { Preconditions::checkIsString($action); Preconditions::checkNotNull($request); $screenFactory = $this->factory; $register = $screenFactory->newRegisterPredmetovScreen($trace); $this->registerPredmetovScreen = $register; $result = parent::invokeAction($trace, $action, $request); if ($this->registerPredmetovScreen) { $this->registerPredmetovScreen->closeWindow(); } return $result; }
/** * Invoke an action given its name * * This function requests information necessary to operate on * VSST060 AIS application * * @param Trace $trace trace object * @param string $action action name * @param Context $context fajr context */ public function invokeAction(Trace $trace, $action, Context $context) { Preconditions::checkIsString($action); $request = $context->getRequest(); $response = $context->getResponse(); $session = $context->getSessionStorage(); Preconditions::checkNotNull($request); Preconditions::checkNotNull($response); Preconditions::checkNotNull($session); // check access to application $apps = $session->read('ais/aisApps'); if (!is_array($apps)) { throw new Exception("Interná chyba - zoznam AIS aplikácii je nekorektný."); } if (!in_array(AIS2ApplicationEnum::REGISTER_PREDMETOV, $apps)) { $response->setTemplate('predmety/notAvailable'); return; } $screenFactory = $this->factory; $register = $screenFactory->newRegisterPredmetovScreen($trace); $this->registerPredmetovScreen = $register; parent::invokeAction($trace, $action, $context); }
public function __construct(DisplayManager $displayManager, Router $router) { parent::__construct($displayManager, $router); }
/** * Invoke an action given its name * * This function requests information necessary to operate on * VSES017 AIS application * * @param Trace $trace trace object * @param string $action action name * @param Context $context fajr context */ public function invokeAction(Trace $trace, $action, Context $context) { Preconditions::checkIsString($action); $request = $context->getRequest(); $response = $context->getResponse(); $session = $context->getSessionStorage(); Preconditions::checkNotNull($request); Preconditions::checkNotNull($response); Preconditions::checkNotNull($session); // check access to application $apps = $session->read('ais/aisApps'); if (!is_array($apps)) { throw new Exception("Interná chyba - zoznam AIS aplikácii je nekorektný."); } if (!in_array(AIS2ApplicationEnum::ADMINISTRACIA_STUDIA, $apps)) { $response->setTemplate('studium/notAvailable'); return; } $screenFactory = $this->factory; $adminStudia = $screenFactory->newAdministraciaStudiaScreen($trace); $this->studium = $request->getParameter('studium', '0'); $this->zoznamStudii = $adminStudia->getZoznamStudii($trace->addChild("Get Zoznam Studii:")); $this->zapisneListy = $adminStudia->getZapisneListy($trace->addChild('getZapisneListy'), $this->studium); FajrUtils::warnWrongTableStructure($response, 'zoznam studii', regression\ZoznamStudiiRegression::get(), $this->zoznamStudii->getTableDefinition()); FajrUtils::warnWrongTableStructure($response, 'zoznam zapisnych listov', regression\ZoznamZapisnychListovRegression::get(), $this->zapisneListy->getTableDefinition()); $this->zapisnyList = $request->getParameter('list'); if ($this->zapisnyList === '') { $tmp = $this->zapisneListy->getData(); $lastList = end($tmp); $this->zapisnyList = $lastList['index']; } $this->terminyHodnoteniaScreen = $screenFactory->newTerminyHodnoteniaScreen($trace, $adminStudia->getZapisnyListIdFromZapisnyListIndex($trace, $this->zapisnyList), $adminStudia->getStudiumIdFromZapisnyListIndex($trace, $this->zapisnyList)); // FIXME: chceme to nejak refaktorovat, aby sme nevytvarali zbytocne // objekty, ktore v konstruktore robia requesty $this->hodnoteniaScreen = $screenFactory->newHodnoteniaPriemeryScreen($trace, $adminStudia->getZapisnyListIdFromZapisnyListIndex($trace, $this->zapisnyList)); $response->set('zoznamStudii', $this->zoznamStudii); $response->set('studium', $this->studium); $response->set('zapisneListy', $this->zapisneListy); $response->set('zapisnyList', $this->zapisnyList); parent::invokeAction($trace, $action, $context); }
/** * Invoke an action given its name * * This function requests information necessary to operate on * VSES017 AIS application * * @param Trace $trace trace object * @param string $action action name * @param Request $request incoming request */ public function invokeAction(Trace $trace, $action, Request $request) { Preconditions::checkIsString($action); if (!$this->loginManager->isLoggedIn()) { throw new AuthenticationRequiredException(); } Preconditions::checkNotNull($request); // check access to application $apps = $this->session->read('ais/aisApps'); if (!is_array($apps)) { throw new Exception("Interná chyba - zoznam AIS aplikácii je nekorektný."); } if (!in_array(AIS2ApplicationEnum::ADMINISTRACIA_STUDIA, $apps)) { return $this->renderResponse('studium/notAvailable'); } $screenFactory = $this->factory; $adminStudia = $screenFactory->newAdministraciaStudiaScreen($trace); $this->administraciaStudiaScreen = $adminStudia; $this->studium = $request->getParameter('studium', '0'); $this->zoznamStudii = $adminStudia->getZoznamStudii($trace->addChild("Get Zoznam Studii:")); $this->zapisneListy = $adminStudia->getZapisneListy($trace->addChild('getZapisneListy'), $this->studium); $this->warnings->warnWrongTableStructure($trace, 'zoznam studii', regression\ZoznamStudiiRegression::get(), $this->zoznamStudii->getTableDefinition()); $this->warnings->warnWrongTableStructure($trace, 'zoznam zapisnych listov', regression\ZoznamZapisnychListovRegression::get(), $this->zapisneListy->getTableDefinition()); $zapisneListyData = $this->zapisneListy->getData(); if (count($zapisneListyData) == 0) { $this->zapisnyList = null; $this->terminyHodnoteniaScreen = null; $this->hodnoteniaScreen = null; $this->templateParams['zapisnyListObj'] = null; } else { $this->zapisnyList = $request->getParameter('list'); if ($this->zapisnyList === '') { // Ak nemame nastaveny zapisny list, zobreme aktualny // ak nenajdeme aktualny, zoberme posledny v zozname $aktualnyAkadRok = FajrUtils::getAcademicYear(); $this->zapisnyList = null; foreach ($zapisneListyData as $zapList) { if ($zapList['popisAkadRok'] == $aktualnyAkadRok) { $this->zapisnyList = $zapList['index']; } } // nenasli sme if ($this->zapisnyList === null) { $lastList = end($zapisneListyData); $this->zapisnyList = $lastList['index']; } } $this->zapisnyList = intval($this->zapisnyList); $this->zapisnyListObj = $zapisneListyData[$this->zapisnyList]; $this->templateParams['zapisnyListObj'] = $this->zapisnyListObj; try { $this->terminyHodnoteniaScreen = $screenFactory->newTerminyHodnoteniaScreen($trace, $adminStudia->getParamNameFromZapisnyListIndex($trace, $this->zapisnyList, VSES017\AdministraciaStudiaScreen::ACTION_TERMINY_HODNOTENIA)); } catch (ParseException $e) { $this->terminyHodnoteniaScreen = null; } // FIXME: chceme to nejak refaktorovat, aby sme nevytvarali zbytocne // objekty, ktore v konstruktore robia requesty $this->hodnoteniaScreen = $screenFactory->newHodnoteniaPriemeryScreen($trace, $adminStudia->getParamNameFromZapisnyListIndex($trace, $this->zapisnyList, VSES017\AdministraciaStudiaScreen::ACTION_HODNOTENIA_PRIEMERY)); } $this->templateParams['currentTab'] = ''; $this->templateParams['zoznamStudii'] = $this->zoznamStudii; $this->templateParams['studium'] = $this->studium; // TODO(anty): refactor $zoznamStudiiData = $this->zoznamStudii->getData(); $this->templateParams['studiumObj'] = $zoznamStudiiData[$this->studium]; $this->templateParams['zapisneListy'] = $this->zapisneListy; $this->templateParams['zapisnyList'] = $this->zapisnyList; // TODO(anty): refactor if (array_key_exists($action, $this->actionInfo)) { $info = $this->actionInfo[$action]; if ($info['requiresZapisnyList'] && $this->zapisnyList === null) { $this->templateParams['activeTab'] = $info['tabName']; return $this->renderResponse('studium/chybaZapisnyList', $this->templateParams); } } $result = parent::invokeAction($trace, $action, $request); if ($this->terminyHodnoteniaScreen) { $this->terminyHodnoteniaScreen->closeWindow(); } if ($this->hodnoteniaScreen) { $this->hodnoteniaScreen->closeWindow(); } if ($this->administraciaStudiaScreen) { $this->administraciaStudiaScreen->closeWindow(); } return $result; }