public function testParseAISDateTime() { $this->assertEquals(AIS2Utils::parseAISDateTime("11.01.2010 08:30"), mktime(8, 30, 00, 1, 11, 2010)); $this->assertEquals(AIS2Utils::parseAISDateTime("31.02.2011 09:35"), mktime(9, 35, 00, 2, 31, 2011)); // parsovanie bez uvodnych nul zatial nepodporujeme (a ani nemusime) // AIS2Utils::parseAISDateTime("31.2.2011 9:35"); $this->setExpectedException("Exception"); AIS2Utils::parseAISDateTime("8:30 11.1.2010"); }
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 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; }