private function addDefaultTestData(PriemeryCalculator $calculator)
 {
     $data = array(array(PriemeryCalculator::SEMESTER_LETNY, 'A', 1), array(PriemeryCalculator::SEMESTER_LETNY, 'B', 2), array(PriemeryCalculator::SEMESTER_LETNY, '', 2), array(PriemeryCalculator::SEMESTER_ZIMNY, 'C', 8), array(PriemeryCalculator::SEMESTER_ZIMNY, '', 2));
     foreach ($data as $row) {
         $calculator->add($row[0], $row[1], $row[2]);
     }
 }
 /**
  * Akcia ktora zobrazi predmety zapisane danym clovekom
  *
  * @param Trace $trace trace object
  * @param Context $context
  */
 public function runZapisanePredmety(Trace $trace, Context $context)
 {
     $request = $context->getRequest();
     $response = $context->getResponse();
     $predmetyZapisnehoListu = $this->terminyHodnoteniaScreen->getPredmetyZapisnehoListu($trace);
     $priemeryCalculator = new PriemeryCalculator();
     $predmetyZapisnehoListuData = Sorter::sort($predmetyZapisnehoListu->getData(), array("kodSemester" => -1, "nazov" => 1));
     foreach ($predmetyZapisnehoListuData as $predmetyRow) {
         $semester = $predmetyRow[PredmetyFields::SEMESTER] == 'L' ? PriemeryCalculator::SEMESTER_LETNY : PriemeryCalculator::SEMESTER_ZIMNY;
         $priemeryCalculator->add($semester, '', $predmetyRow[PredmetyFields::KREDIT]);
     }
     $response->set('predmetyZapisnehoListu', $predmetyZapisnehoListuData);
     $response->set('predmetyStatistika', $priemeryCalculator);
     $response->setTemplate('studium/zapisanePredmety');
 }
 /**
  * Akcia ktora zobrazi predmety zapisane danym clovekom
  *
  * @param Trace $trace trace object
  * @param Request $request
  */
 public function runZapisanePredmety(Trace $trace, Request $request)
 {
     $this->templateParams['currentTab'] = 'ZapisnyList';
     if ($this->terminyHodnoteniaScreen == null) {
         return $this->renderResponse('studium/terminyHodnoteniaNedostupne', $this->templateParams);
     }
     $predmetyZapisnehoListu = $this->terminyHodnoteniaScreen->getPredmetyZapisnehoListu($trace);
     $this->warnings->warnWrongTableStructure($trace, 'terminy hodnotenia-predmety', regression\ZapisanePredmetyRegression::get(), $predmetyZapisnehoListu->getTableDefinition());
     $priemeryCalculator = new PriemeryCalculator();
     $predmetyZapisnehoListuData = Sorter::sort($predmetyZapisnehoListu->getData(), array("semester" => -1, "nazov" => 1));
     foreach ($predmetyZapisnehoListuData as $predmetyRow) {
         $semester = $predmetyRow[PredmetyFields::SEMESTER] == 'L' ? PriemeryCalculator::SEMESTER_LETNY : PriemeryCalculator::SEMESTER_ZIMNY;
         $priemeryCalculator->add($semester, '', $predmetyRow[PredmetyFields::KREDIT]);
     }
     $this->templateParams['predmetyZapisnehoListu'] = $predmetyZapisnehoListuData;
     $this->templateParams['predmetyStatistika'] = $priemeryCalculator;
     return $this->renderResponse('studium/zapisanePredmety', $this->templateParams);
 }