public function getHtml()
 {
     $predmetyZapisnehoListu = $this->skusky->getPredmetyZapisnehoListu();
     $predmetyZapisnehoListuTable = new Table(TableDefinitions::predmetyZapisnehoListu());
     $predmetyZapisnehoListuCollapsible = new Collapsible('Predmety zápisného listu', $predmetyZapisnehoListuTable);
     $kreditovCelkomLeto = 0;
     $kreditovCelkomZima = 0;
     $pocetPredmetovLeto = 0;
     $pocetPredmetovZima = 0;
     foreach (Sorter::sort($predmetyZapisnehoListu->getData(), array("semester" => -1, "nazov" => 1)) as $row) {
         if ($row['semester'] == 'L') {
             $pocetPredmetovLeto += 1;
             $kreditovCelkomLeto += $row['kredit'];
             $class = 'leto';
         } else {
             $pocetPredmetovZima += 1;
             $kreditovCelkomZima += $row['kredit'];
             $class = 'zima';
         }
         $predmetyZapisnehoListuTable->addRow($row, array('class' => $class));
     }
     $pocetPredmetovText = 'Celkom ';
     $pocetPredmetovText .= FajrUtils::formatPlural($pocetPredmetovLeto + $pocetPredmetovZima, '0 predmetov', '1 predmet', '%d predmety', '%d predmetov');
     if ($pocetPredmetovLeto > 0 && $pocetPredmetovZima > 0) {
         $pocetPredmetovText .= sprintf(' (%d v zime, %d v lete)', $pocetPredmetovZima, $pocetPredmetovLeto);
     }
     $kreditovCelkomText = '' . ($kreditovCelkomLeto + $kreditovCelkomZima);
     if ($kreditovCelkomLeto > 0 && $kreditovCelkomZima > 0) {
         $kreditovCelkomText .= sprintf(' (%d+%d)', $kreditovCelkomZima, $kreditovCelkomLeto);
     }
     $predmetyZapisnehoListuTable->addFooter(array('nazov' => $pocetPredmetovText, 'kredit' => $kreditovCelkomText), array());
     $predmetyZapisnehoListuTable->setUrlParams(array('studium' => Input::get('studium'), 'list' => Input::get('list')));
     return $predmetyZapisnehoListuTable->getHtml();
 }
Ejemplo n.º 2
0
 public static function prepare()
 {
     if (FajrConfig::get('URL.Path')) {
         $_get = array_merge(FajrRouter::pathToParams(FajrUtils::pathInfo()), $_GET);
     } else {
         $_get = $_GET;
     }
     $_post = $_POST;
     // podla pola definujeceho vstupne parametre overim ich platnost
     foreach (self::$allowedParamters as $input => $params) {
         foreach ($params as $name => $type) {
             if (isset(${$input}[$name])) {
                 $checker = self::$conditions[$type]['cond'];
                 if (!Validator::$checker(${$input}[$name], self::$conditions[$type]['options'])) {
                     throw new Exception(str_replace('%%NAME%%', $name, self::$conditions[$type]['message']));
                 }
                 self::$inputParameters[$name] = ${$input}[$name];
                 self::${$input}[$name] = ${$input}[$name];
             }
         }
     }
     // specialne vynimky
     if (isset($_get['logout'])) {
         self::$inputParameters['logout'] = true;
         //self::$_GET['logout'] = true; FIXME: Majak, co tu robilo toto?
         //Pravdepodobne to chceme umazat.
     }
     // budeme pouzivat uz len Input
     unset($_GET);
     unset($_POST);
 }
Ejemplo n.º 3
0
 /**
  * Get a directory configuration path.
  *
  * If a relative path is given in configuration, it is resolved
  * relative to the specified directory or project root directory
  * if no directory was specified
  *
  * @param string $key
  * @returns string absolute path for the directory specified in configuration
  *                 or null if this option was not specified and does not have
  *                 a default value
  * @see FajrConfig::$defaultOptions
  * @see FajrConfig::$directoriesRelativeTo
  * @see configuration.example.php
  */
 public static function getDirectory($key)
 {
     $dir = self::get($key);
     if ($dir === null) {
         return null;
     }
     if (FajrUtils::isAbsolutePath($dir)) {
         return $dir;
     }
     // default resolve relative
     $relativeTo = dirname(__FILE__);
     if (!empty(self::$directoriesRelativeTo[$key])) {
         $relativeTo = self::getDirectory(self::$directoriesRelativeTo[$key]);
     }
     return FajrUtils::joinPath($relativeTo, $dir);
 }
Ejemplo n.º 4
0
 public function getHtml()
 {
     $activeTab = $this->getActiveTab();
     $code = '<div class=\'tab_header\'>';
     foreach ($this->tabs as $key => $value) {
         $link = FajrUtils::linkUrl(array_merge($this->urlParams, array($this->name => $key)));
         if ($key == $activeTab['name']) {
             $class = 'tab_selected';
         } else {
             $class = 'tab';
         }
         $code .= '<span class=\'' . $class . '\'><a href="' . $link . '">' . $value['title'] . '</a></span>';
     }
     $code .= '</div>';
     try {
         $code .= $activeTab['content']->getHtml();
     } catch (Exception $e) {
         DisplayManager::addException($e);
     }
     return $code;
 }
    public function getHtml()
    {
        $predmetyZapisnehoListu = $this->skusky->getPredmetyZapisnehoListu();
        $hodnoteniaData = array();
        foreach ($this->hodnotenia->getHodnotenia()->getData() as $row) {
            $hodnoteniaData[$row['nazov']] = $row;
        }
        $this->hodnoteniaData = $hodnoteniaData;
        if (Input::get('action') !== null) {
            assert(Input::get("action") == "prihlasNaSkusku");
            if ($this->prihlasNaSkusku(Input::get("prihlasPredmetIndex"), Input::get("prihlasTerminIndex"))) {
                FajrUtils::redirect(array('tab' => 'TerminyHodnotenia'));
            } else {
                throw new Exception('Na skúšku sa nepodarilo prihlásiť.');
            }
        }
        $baseUrlParams = array("studium" => Input::get("studium"), "list" => Input::get("list"), "tab" => Input::get("tab"));
        $terminyTable = new Table(TableDefinitions::vyberTerminuHodnoteniaJoined(), array('termin' => 'index', 'predmet' => 'predmetIndex'), $baseUrlParams);
        $terminyCollapsible = new Collapsible('Termíny, na ktoré sa môžem prihlásiť', $terminyTable);
        $actionUrl = FajrUtils::linkUrl($baseUrlParams);
        foreach ($predmetyZapisnehoListu->getData() as $predmetRow) {
            $terminy = $this->skusky->getZoznamTerminovDialog($predmetRow['index'])->getZoznamTerminov();
            foreach ($terminy->getData() as $row) {
                $row['predmet'] = $predmetRow['nazov'];
                $row['predmetIndex'] = $predmetRow['index'];
                $hash = $this->hashNaPrihlasenie($predmetRow['nazov'], $row);
                $mozeSaPrihlasit = $this->mozeSaPrihlasit($row);
                if ($mozeSaPrihlasit == self::PRIHLASIT_MOZE || $mozeSaPrihlasit == self::PRIHLASIT_MOZE_ZNAMKA) {
                    $row['prihlas'] = "<form method='post' action='{$actionUrl}'><div>\n\t\t\t\t\t\t\t<input type='hidden' name='action' value='prihlasNaSkusku'/>\n\t\t\t\t\t\t\t<input type='hidden' name='prihlasPredmetIndex'\n\t\t\t\t\t\t\tvalue='" . $row['predmetIndex'] . "'/>\n\t\t\t\t\t\t\t<input type='hidden' name='prihlasTerminIndex'\n\t\t\t\t\t\t\tvalue='" . $row['index'] . "'/>\n\t\t\t\t\t\t\t<input type='hidden' name='hash' value='{$hash}'/>\n\t\t\t\t\t\t\t<button name='submit' type='submit' class='tableButton positive'>\n\t\t\t\t\t\t\t\t<img src='images/add.png' alt=''>Prihlás ma!\n\t\t\t\t\t\t\t</button></div></form>";
                    if ($mozeSaPrihlasit == self::PRIHLASIT_MOZE_ZNAMKA) {
                        $row['prihlas'] = 'Už máš zápísané"' . $hodnoteniaData[$row['predmet']]['znamka'] . '"' . $row['prihlas'];
                    }
                } else {
                    if ($mozeSaPrihlasit == self::PRIHLASIT_NEMOZE_CAS) {
                        $row['prihlas'] = 'Nedá sa (neskoro)';
                    } else {
                        if ($mozeSaPrihlasit == self::PRIHLASIT_NEMOZE_POCET) {
                            $row['prihlas'] = 'Termín je plný!';
                        } else {
                            if ($mozeSaPrihlasit == self::PRIHLASIT_NEMOZE_ZNAMKA) {
                                $row['prihlas'] = 'Už máš zápísané"' . $hodnoteniaData[$row['predmet']]['znamka'] . '"';
                            } else {
                                if ($mozeSaPrihlasit == self::PRIHLASIT_NEMOZE_INE) {
                                    $row['prihlas'] = 'Nedá sa, dôvod neznámy';
                                }
                            }
                        }
                    }
                }
                $terminyTable->addRow($row, null);
            }
        }
        if (Input::get('termin') != null && Input::get('predmet') != null) {
            $terminyTable->setOption('selected_key', array('index' => Input::get('termin'), 'predmetIndex' => Input::get('predmet')));
        }
        $html = $terminyCollapsible->getHtml();
        if (Input::get('termin') != null && Input::get('predmet') != null) {
            $prihlaseni = $this->skusky->getZoznamTerminovDialog(Input::get('predmet'))->getZoznamPrihlasenychDialog(Input::get('termin'))->getZoznamPrihlasenych();
            $zoznamPrihlasenychTable = new Table(TableDefinitions::zoznamPrihlasenych(), null, array('studium', 'list'));
            $zoznamPrihlasenychCollapsible = new Collapsible('Zoznam prihlásených
					na vybratý termín', $zoznamPrihlasenychTable);
            $zoznamPrihlasenychTable->addRows($prihlaseni->getData());
            $html .= $zoznamPrihlasenychCollapsible->getHtml();
        }
        return $html;
    }
Ejemplo n.º 6
0
 public function getHtml()
 {
     $table = $this->table;
     $columns = $table->getColumns();
     $class = '';
     if (isset($this->options['class'])) {
         $class = $this->options['class'];
     }
     if (!$this->isFooter) {
         if ($table->GetOption('selected_key') !== null) {
             $sKey = $table->getOption('selected_key');
             if (is_array($sKey)) {
                 $selected = true;
                 foreach ($sKey as $key => $value) {
                     if ($value != $this->data[$key]) {
                         $selected = false;
                     }
                 }
             } else {
                 $selected = $sKey == $this->data['index'];
             }
             if ($selected) {
                 $class = 'selected';
             }
         }
     }
     $row = "<tr class='{$class}'>\n";
     if ($table->newKey) {
         if (is_array($table->newKey)) {
             $params = $table->urlParams;
             foreach ($table->newKey as $key => $tableCol) {
                 $params[$key] = $this->data[$tableCol];
             }
             $link = FajrUtils::linkUrl($params);
         } else {
             $link = FajrUtils::linkUrl(array_merge($table->urlParams, array($table->newKey => $this->data['index'])));
         }
     }
     $colno = 0;
     foreach ($columns as $key => $column) {
         $real_key = substr($key, 0, 32);
         if (isset($this->data[$real_key])) {
             $cell_value = $this->data[$real_key];
         } else {
             $cell_value = '';
         }
         if ($cell_value == "") {
             $cell_value = "&nbsp;";
         }
         $cell = '    <td>';
         if ($table->newKey && $colno == 0) {
             $cell .= '<a href="' . $link . '">' . $cell_value . "</a>";
         } else {
             $cell .= $cell_value;
         }
         $cell .= "</td>\n";
         $row .= $cell;
         $colno++;
     }
     $row .= "</tr>\n";
     return $row;
 }
Ejemplo n.º 7
0
 public function testFormatPlural()
 {
     $this->assertEquals(FajrUtils::formatPlural(0, 'ok %d', 'failed one %d', 'failed 2-4 %d', 'failed other %d'), 'ok 0');
     $this->assertEquals(FajrUtils::formatPlural(1, 'failed zero %d', 'ok %d', 'failed 2-4 %d', 'failed other %d'), 'ok 1');
     $this->assertEquals(FajrUtils::formatPlural(2, 'failed zero %d', 'failed one %d', 'ok %d', 'failed other %d'), 'ok 2');
     $this->assertEquals(FajrUtils::formatPlural(3, 'failed zero %d', 'failed one %d', 'ok %d', 'failed other %d'), 'ok 3');
     $this->assertEquals(FajrUtils::formatPlural(4, 'failed zero %d', 'failed one %d', 'ok %d', 'failed other %d'), 'ok 4');
     $this->assertEquals(FajrUtils::formatPlural(5, 'failed zero %d', 'failed one %d', 'failed 2-4 %d', 'ok %d'), 'ok 5');
     $this->assertEquals(FajrUtils::formatPlural(10, 'failed zero %d', 'failed one %d', 'failed 2-4 %d', 'ok %d'), 'ok 10');
 }
Ejemplo n.º 8
0
 public function run()
 {
     $timer = new SystemTimer();
     $connection = null;
     $statsConnection = null;
     $rawStatsConnection = null;
     $trace = new NullTrace();
     if (FajrConfig::get('Debug.Trace') === true) {
         $trace = new HtmlTrace($timer, "--Trace--");
     }
     try {
         Input::prepare();
         $login = Input::get('login');
         Input::set('login', null);
         $krbpwd = Input::get('krbpwd');
         Input::set('krbpwd', null);
         $cosignCookie = Input::get('cosignCookie');
         Input::set('cosignCookie', null);
         // FIXME this should be refactored
         if ($login !== null && $krbpwd !== null || $cosignCookie !== null) {
             // we are going to log in, so we get a clean session
             // this needs to be done before a connection
             // is created, because we pass cookie file name
             // that contains session_id into AIS2CurlConnection
             // If we regenerated the session id afterwards,
             // we could not find the cookie file after a redirect
             FajrUtils::dropSession();
         }
         $connection = new connection\CurlConnection(FajrUtils::getCookieFile());
         $rawStatsConnection = new connection\StatsConnection($connection, new SystemTimer());
         $connection = $rawStatsConnection;
         $connection = new connection\GzipDecompressingConnection($connection, FajrConfig::getDirectory('Path.Temporary'));
         $connection = new connection\AIS2ErrorCheckingConnection($connection);
         $statsConnection = new connection\StatsConnection($connection, new SystemTimer());
         $connection = $statsConnection;
         $simpleConnection = new connection\HttpToSimpleConnectionAdapter($connection);
         AIS2Utils::connection($simpleConnection);
         // toto tu je docasne
         if (Input::get('logout') !== null) {
             FajrUtils::logout($connection);
             FajrUtils::redirect();
         }
         if ($login !== null && $krbpwd !== null) {
             $loggedIn = FajrUtils::login(new CosignLogin($login, $krbpwd), $connection);
             $login = null;
             $krbpwd = null;
         } else {
             if ($cosignCookie !== null) {
                 $loggedIn = FajrUtils::login(new AIS2CookieLogin($cosignCookie), $connection);
                 $cosignCookie = null;
             } else {
                 $loggedIn = FajrUtils::isLoggedIn();
             }
         }
         if ($loggedIn) {
             DisplayManager::addContent('<div class=\'logout\'><a class="button negative" href="' . FajrUtils::linkUrl(array('logout' => true)) . '">
     <img src="images/door_in.png" alt=""/>Odhlásiť</a></div>');
             $adminStudia = new VSES017\AdministraciaStudiaScreen($trace, $simpleConnection);
             if (Input::get('studium') === null) {
                 Input::set('studium', 0);
             }
             $zoznamStudii = $adminStudia->getZoznamStudii($trace->addChild("Get Zoznam Studii:"));
             $zoznamStudiiTable = new Table(TableDefinitions::zoznamStudii(), 'studium', array('tab' => Input::get('tab')));
             $zoznamStudiiTable->addRows($zoznamStudii->getData());
             $zoznamStudiiTable->setOption('selected_key', Input::get('studium'));
             $zoznamStudiiTable->setOption('collapsed', true);
             $zoznamStudiiCollapsible = new Collapsible(new HtmlHeader('Zoznam štúdií'), $zoznamStudiiTable, true);
             DisplayManager::addContent($zoznamStudiiCollapsible->getHtml());
             $zapisneListy = $adminStudia->getZapisneListy($trace->addChild('getZapisneListy'), Input::get('studium'));
             $zapisneListyTable = new Table(TableDefinitions::zoznamZapisnychListov(), 'list', array('studium' => Input::get('studium'), 'tab' => Input::get('tab')));
             if (Input::get('list') === null) {
                 $tmp = $zapisneListy->getData();
                 $lastList = end($tmp);
                 Input::set('list', $lastList['index']);
             }
             $zapisneListyTable->addRows($zapisneListy->getData());
             $zapisneListyTable->setOption('selected_key', Input::get('list'));
             $zapisneListyTable->setOption('collapsed', true);
             $zapisneListyCollapsible = new Collapsible(new HtmlHeader('Zoznam zápisných listov'), $zapisneListyTable, true);
             DisplayManager::addContent($zapisneListyCollapsible->getHtml());
             $terminyHodnotenia = new VSES017\TerminyHodnoteniaScreen($trace, $simpleConnection, $adminStudia->getIdZapisnyList($trace, Input::get('list')), $adminStudia->getIdStudium($trace, Input::get('list')));
             if (Input::get('tab') === null) {
                 Input::set('tab', 'TerminyHodnotenia');
             }
             $tabs = new TabManager('tab', array('studium' => Input::get('studium'), 'list' => Input::get('list')));
             // FIXME: chceme to nejak refaktorovat, aby sme nevytvarali zbytocne
             // objekty, ktore v konstruktore robia requesty
             $hodnoteniaScreen = new VSES017\HodnoteniaPriemeryScreen($trace, $simpleConnection, $adminStudia->getIdZapisnyList($trace, Input::get('list')));
             $tabs->addTab('TerminyHodnotenia', 'Moje skúšky', new MojeTerminyHodnoteniaCallback($trace, $terminyHodnotenia, $hodnoteniaScreen));
             $tabs->addTab('ZapisSkusok', 'Prihlásenie na skúšky', new ZoznamTerminovCallback($trace, $terminyHodnotenia, $hodnoteniaScreen));
             $tabs->addTab('ZapisnyList', 'Zápisný list', new ZapisanePredmetyCallback($trace, $terminyHodnotenia));
             $tabs->addTab('Hodnotenia', 'Hodnotenia/Priemery', new HodnoteniaCallback($trace, $hodnoteniaScreen));
             $tabs->setActive(Input::get('tab'));
             DisplayManager::addContent($tabs->getHtml());
             $version = '<div>Fajr verzia ' . hescape(Version::getVersionString()) . '</div>';
             DisplayManager::addContent($version);
             $statistics = "<div> Fajr made " . $statsConnection->getTotalCount() . " requests and downloaded " . $rawStatsConnection->getTotalSize() . " bytes (" . $statsConnection->getTotalSize() . " bytes uncompressed) of data from AIS2 in " . sprintf("%.3f", $statsConnection->getTotalTime()) . " seconds. It took " . sprintf("%.3f", $timer->getElapsedTime()) . " seconds to generate this page.</div>";
             DisplayManager::addContent($statistics);
         } else {
             DisplayManager::addContent('loginBox', true);
             DisplayManager::addContent('warnings', true);
             DisplayManager::addContent('terms', true);
             DisplayManager::addContent('credits', true);
             $version = "<div class='version prepend-1 span-21 last increase-line-height'>\n<strong>Verzia fajru:</strong> \n";
             $version .= hescape(Version::getVersionString());
             $version .= '</div>';
             DisplayManager::addContent($version);
             DisplayManager::addContent(Version::getChangelog(), false);
         }
     } catch (AIS2LoginException $e) {
         if ($connection) {
             FajrUtils::logout($connection);
         }
         DisplayManager::addException($e);
     } catch (Exception $e) {
         DisplayManager::addException($e);
     }
     DisplayManager::setBase(hescape(FajrUtils::basePath()));
     $trace->tlog("everything done, generating html");
     if (FajrConfig::get('Debug.Trace') === true) {
         $traceHtml = $trace->getHtml();
         DisplayManager::addContent('<div class="span-24">' . $traceHtml . '<div> Trace size:' . sprintf("%.2f", strlen($traceHtml) / 1024.0 / 1024.0) . ' MB</div></div>');
     }
     echo DisplayManager::display();
 }
 public function getHtml()
 {
     $trace = $this->trace->addChild("MojeTerminyHodnoteniaCallback");
     $trace->tlog("Executing callback");
     $terminyHodnotenia = $this->terminyHodnoteniaApp->getTerminyHodnotenia($trace->addChild("get terminy hodnotenia"));
     $hodnotenia = $this->hodnoteniaApp->getHodnotenia($trace->addChild("get hodnotenia"));
     if (Input::get('action') !== null) {
         $trace->tlog("odhlasujem zo skusky");
         assert(Input::get("action") == "odhlasZoSkusky");
         if ($this->odhlasZoSkusky(Input::get("odhlasIndex"))) {
             FajrUtils::redirect();
         } else {
             throw new Exception('Z termínu sa nepodarilo odhlásiť.');
         }
     }
     $baseUrlParams = array("studium" => Input::get("studium"), "list" => Input::get("list"), "tab" => Input::get("tab"));
     $terminyHodnoteniaTableActive = new Table(TableDefinitions::mojeTerminyHodnotenia(), 'termin', $baseUrlParams);
     $terminyHodnoteniaCollapsibleActive = new Collapsible(new HtmlHeader('Aktuálne termíny hodnotenia'), $terminyHodnoteniaTableActive);
     $terminyHodnoteniaTableOld = new Table(TableDefinitions::mojeTerminyHodnotenia(), 'termin', $baseUrlParams);
     $terminyHodnoteniaCollapsibleOld = new Collapsible(new HtmlHeader('Staré termíny hodnotenia'), $terminyHodnoteniaTableOld);
     if (Input::get('termin') != null) {
         $terminyHodnoteniaTableActive->setOption('selected_key', Input::get('termin'));
         $terminyHodnoteniaTableOld->setOption('selected_key', Input::get('termin'));
     }
     $actionUrl = FajrUtils::linkUrl($baseUrlParams);
     $hodnoteniePredmetu = array();
     foreach ($hodnotenia->getData() as $row) {
         $hodnoteniePredmetu[$row['nazov']] = $row['znamka'];
     }
     foreach ($terminyHodnotenia->getData() as $row) {
         $datum = AIS2Utils::parseAISDateTime($row['dat'] . " " . $row['cas']);
         if ($row['znamka'] == "") {
             // skusme najst znamku v hodnoteniach
             if (isset($hodnoteniePredmetu[$row['predmet']]) && $hodnoteniePredmetu[$row['predmet']] != "") {
                 $row['znamka'] = $hodnoteniePredmetu[$row['predmet']] . " (z&nbsp;predmetu)";
             }
         }
         if ($datum < time()) {
             $row['odhlas'] = "Skúška už bola.";
             if ($row['jePrihlaseny'] == 'A') {
                 $terminyHodnoteniaTableOld->addRow($row, null);
             }
         } else {
             if ($row['mozeOdhlasit'] == 1) {
                 $class = 'terminmozeodhlasit';
                 $hash = $this->hashNaOdhlasenie($row);
                 $row['odhlas'] = "<form method='post' action='{$actionUrl}'>\n            <div>\n            <input type='hidden' name='action' value='odhlasZoSkusky'/>\n            <input type='hidden' name='odhlasIndex'\n            value='" . $row['index'] . "'/>\n            <input type='hidden' name='hash' value='{$hash}'/>\n            <button name='submit' type='submit' class='tableButton negative'>\n              <img src='images/cross.png' alt=''>Odhlás\n            </button></div></form>";
             } else {
                 $row['odhlas'] = "nedá sa";
                 $class = 'terminnemozeodhlasit';
             }
             if ($row['prihlaseny'] != 'A') {
                 $row['odhlas'] = 'Si odhlásený. Ak chceš, opäť sa prihlás.';
                 $class = 'terminodhlaseny';
             }
             $terminyHodnoteniaTableActive->addRow($row, array('class' => $class));
         }
     }
     $html = $terminyHodnoteniaCollapsibleActive->getHtml();
     $html .= $terminyHodnoteniaCollapsibleOld->getHtml();
     if (Input::get('termin') != null) {
         $prihlaseni = $this->terminyHodnoteniaApp->getZoznamPrihlasenychDialog($trace, Input::get('termin'))->getZoznamPrihlasenych($trace);
         $zoznamPrihlasenychTable = new Table(TableDefinitions::zoznamPrihlasenych(), null, array('studium', 'list'));
         $zoznamPrihlasenychTable->addRows($prihlaseni->getData());
         $zoznamPrihlasenychCollapsible = new Collapsible(new HtmlHeader('Zoznam prihlásených
       na vybratý termín'), $zoznamPrihlasenychTable);
         $html .= $zoznamPrihlasenychCollapsible->getHtml();
     }
     return $html;
 }
Ejemplo n.º 10
0
 public function runPrihlasNaSkusku(Trace $trace, Context $context)
 {
     $request = $context->getRequest();
     $response = $context->getResponse();
     $predmetIndex = $request->getParameter("prihlasPredmetIndex");
     $terminIndex = $request->getParameter("prihlasTerminIndex");
     $predmety = $this->terminyHodnoteniaScreen->getPredmetyZapisnehoListu()->getData();
     $predmetKey = -1;
     foreach ($predmety as $key => $row) {
         if ($row['index'] == $predmetIndex) {
             $predmetKey = $key;
         }
     }
     $terminy = $this->terminyHodnoteniaScreen->getZoznamTerminovDialog($predmetIndex)->getZoznamTerminov()->getData();
     $terminKey = -1;
     foreach ($terminy as $key => $row) {
         if ($row['index'] == $terminIndex) {
             $terminKey = $key;
         }
     }
     if ($predmetKey == -1 || $terminKey == -1) {
         throw new Exception("Ooops, predmet/termín nenájdený. Pravdepodobne\n          zmena dát v AISe.");
     }
     $hash = $this->hashNaPrihlasenie($predmety[$predmetIndex]['nazov'], $terminy[$terminIndex]);
     if ($hash != $request->getParameter('hash')) {
         throw new Exception("Ooops, nesedia údaje o termíne. Pravdepodobne zmena\n          dát v AISe spôsobila posunutie tabuliek.");
     }
     if (!$this->terminyHodnoteniaScreen->getZoznamTerminovDialog($predmetIndex)->prihlasNaTermin($terminIndex)) {
         throw new Exception('Na skúšku sa nepodarilo prihlásiť.');
     }
     FajrUtils::redirect(array('action' => 'studium.MojeTerminyHodnotenia', 'studium' => $this->studium, 'list' => $this->zapisnyList));
 }
Ejemplo n.º 11
0
        DisplayManager::addContent($tabs->getHtml());
        $timeDiff = microtime(true) - $startTime;
        $version = '<div>Fajr verzia ' . hescape(Version::getVersionString()) . '</div>';
        DisplayManager::addContent($version);
        $statistics = "<div> Fajr made " . $statsConnection->getTotalCount() . " requests and downloaded " . $rawStatsConnection->getTotalSize() . " bytes (" . $statsConnection->getTotalSize() . " bytes uncompressed) of data from AIS2 in " . sprintf("%.3f", $statsConnection->getTotalTime()) . " seconds. It took " . sprintf("%.3f", $timeDiff) . " seconds to generate this page.</div>";
        DisplayManager::addContent($statistics);
    } else {
        DisplayManager::addContent('loginBox', true);
        DisplayManager::addContent('warnings', true);
        DisplayManager::addContent('terms', true);
        DisplayManager::addContent('credits', true);
        $version = "<div class='version prepend-1 span-21 last increase-line-height'>\n<strong>Verzia fajru:</strong> \n";
        $version .= hescape(Version::getVersionString());
        $version .= '</div>';
        DisplayManager::addContent($version);
        DisplayManager::addContent(Version::getChangelog(), false);
    }
} catch (AIS2LoginException $e) {
    if ($connection) {
        FajrUtils::logout($connection);
    }
    DisplayManager::addException($e);
} catch (Exception $e) {
    DisplayManager::addException($e);
}
if ($debugConnection) {
    DisplayManager::dumpRequests($debugConnection->getRequests());
}
DisplayManager::setBase(hescape(FajrUtils::basePath()));
echo DisplayManager::display();
session_write_close();