/** * @return Competition */ public function getCompetition() { if (!$this->competition) { $this->competition = Competition::getByNefubId($this->competition_nefub_id); } return $this->competition; }
/** * * @param int $nefubId */ public function showCompetition($nefubId) { $this->subdirectory = '/competitie'; $this->path = '/' . $nefubId; $this->template = '/competitie/competitie.tpl'; if ($this->getClearRender()) { $oCompetition = Competition::getByNefubId($nefubId); if ($oCompetition) { $this->assign('oCompetition', $oCompetition); $this->assign('aResultGames', $oCompetition->getFinishedGames()); $this->assign('updateTime', $oPoule->update_time); } else { $this->redirect(); } } $this->showOutput(); }
/** * @param stdClass $competition * * @return Competition */ protected function convertCompetition(stdClass $competition) { $oCompetition = Competition::getByNefubId($competition->ID); if (!$oCompetition) { $oCompetition = new Competition(); $oCompetition->name = $competition->Name; $oCompetition->nefub_id = $competition->ID; $oCompetition->season_nefub_id = Season::getInstance()->nefub_id; self::put('Competitie ' . $oCompetition->name . ' toegevoegd'); $this->addedNefubObject($oCompetition); } if (isset($competition->Poules) && is_array($competition->Poules)) { foreach ($competition->Poules as $poule) { $oPoule = Poule::getByNefubId($poule->ID); if (!$oPoule) { $oPoule = new Poule(); $oPoule->nefub_id = $poule->ID; $oPoule->name = $poule->Name; $oPoule->competition_nefub_id = $oCompetition->nefub_id; $oPoule->season_nefub_id = Season::getInstance()->nefub_id; self::put('Poule ' . $oPoule->name . ' toegevoegd'); } $oPoule->sorting = $poule->Order; $oPoule->save(); } } $oGender = $this->convertGender($competition->Gender); $oGenre = $this->convertGenre($competition->Genre); $oCompetitionType = $this->convertCompetitionType($competition->Type); $oCompetition->gender_id = $oGender->getId(); $oCompetition->genre_id = $oGenre->getId(); $oCompetition->competition_type_id = $oCompetitionType->getId(); $oCompetition->save(); return $oCompetition; }
protected function showGames() { switch ($this->mode) { case 'bewerken': $oGame = Game::getByNefubId($this->editId); $this->editObject($oGame); break; case 'competitie': $oCompetition = Competition::getByNefubId($this->editId); $this->assign('oCompetition', $oCompetition); $this->template = '/competitie.wedstrijden.tpl'; $this->showOutput(); break; default: $this->showCompetitionDependentView('/competities.wedstrijden.tpl'); } }