/** * Akcia pre hodnotenia a priemery * * @param Trace $trace trace object * @param Request $request */ public function runHodnotenia(Trace $trace, Request $request) { $format = $request->getParameter('format', 'html'); $priemeryCalculator = new PriemeryCalculator(); $hodnotenia = $this->hodnoteniaScreen->getHodnotenia($trace->addChild('get hodnotenia')); $this->warnings->warnWrongTableStructure($trace, 'hodnotenia', regression\HodnoteniaRegression::get(), $hodnotenia->getTableDefinition()); $hodnoteniaData = Sorter::sort($hodnotenia->getData(), array("semester" => -1, "nazov" => 1)); foreach ($hodnoteniaData as &$hodnoteniaRow) { $semester = $hodnoteniaRow[HodnoteniaFields::SEMESTER] == 'L' ? PriemeryCalculator::SEMESTER_LETNY : PriemeryCalculator::SEMESTER_ZIMNY; try { $hodnoteniaRow['timestamp'] = AIS2Utils::parseAISDate($hodnoteniaRow['datum']); } catch (\Exception $e) { $hodnoteniaRow['timestamp'] = null; } $hodnoteniaRow['akRok'] = $this->zapisnyListObj['popisAkadRok']; $priemeryCalculator->add($semester, $hodnoteniaRow[HodnoteniaFields::ZNAMKA], $hodnoteniaRow[HodnoteniaFields::KREDIT]); } $priemery = $this->hodnoteniaScreen->getPriemery($trace->addChild('get priemery')); $this->warnings->warnWrongTableStructure($trace, 'priemery', regression\PriemeryRegression::get(), $priemery->getTableDefinition()); $this->templateParams['currentTab'] = 'Hodnotenia'; $this->templateParams['hodnotenia'] = $hodnoteniaData; $this->templateParams['priemery'] = $priemery->getData(); $this->templateParams['priemeryCalculator'] = $priemeryCalculator; return $this->renderResponse('studium/hodnotenia', $this->templateParams, $format == 'xml' ? 'xml' : 'html'); }
public function getPriemery(Trace $trace) { $data = $this->executor->readTable(array('list' => $this->idZapisnyList), 'priemery'); $table = new DataTableImpl(PriemeryRegression::get(), $data); return $table; }