public function getPriemery(Trace $trace) { $this->openIfNotAlready($trace); $data = $this->executor->readTable(array('list' => $this->idZapisnyList), 'priemery'); $table = new DataTableImpl(PriemeryRegression::get(), $data); return $table; }
/** * Akcia pre hodnotenia a priemery * * @param Trace $trace trace object * @param Context $context */ public function runHodnotenia(Trace $trace, Context $context) { $priemeryCalculator = new PriemeryCalculator(); $request = $context->getRequest(); $response = $context->getResponse(); $hodnotenia = $this->hodnoteniaScreen->getHodnotenia($trace->addChild('get hodnotenia')); FajrUtils::warnWrongTableStructure($response, '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; $priemeryCalculator->add($semester, $hodnoteniaRow[HodnoteniaFields::ZNAMKA], $hodnoteniaRow[HodnoteniaFields::KREDIT]); } $priemery = $this->hodnoteniaScreen->getPriemery($trace->addChild('get priemery')); FajrUtils::warnWrongTableStructure($response, 'priemery', regression\PriemeryRegression::get(), $priemery->getTableDefinition()); $response->set('hodnotenia', $hodnoteniaData); $response->set('priemery', $priemery->getData()); $response->set('priemeryCalculator', $priemeryCalculator); $response->setTemplate('studium/hodnotenia'); }