/** * 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(); // check access to application if (!in_array(AIS2ApplicationEnum::ADMINISTRACIA_STUDIA, $session->read('ais/aisApps'))) { $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); }
public function getZapisneListy(Trace $trace, $studiumIndex) { $this->studiumIndex = $studiumIndex; $data = $this->executor->readTable(array('studium' => $this->getStudiumIdFromIndex($studiumIndex)), 'zoznamZapisnychListov'); return new DataTableImpl(ZoznamZapisnychListovRegression::get(), $data); }