/** * @return Game */ public function getGame() { if (!$this->game) { $this->game = Game::getByNefubId($this->game_nefub_id); } return $this->game; }
public function addGameRow(Game $oGame, $includeField = true) { $oGame = Game::getByNefubId($oGame->nefub_id); $field = $oGame->field ? $oGame->field : 1; $gameType = $oGame->getCompetition()->getGender()->name . ' ' . $oGame->getCompetition()->getGenre()->name; $team1 = utf8_decode($oGame->getTeam1()->name); $team2 = utf8_decode($oGame->getTeam2()->name); if ($oGame->getFirstReferee()) { $oGame = new Game($oGame->getId()); $oReferee = $oGame->getFirstReferee(); $referee = utf8_decode($oReferee->getName()); if (!$oReferee->getPerson()) { $referee .= ' (' . $oReferee->getTeam()->getCompetition()->getGender()->name; $referee .= ' ' . $oReferee->getTeam()->getCompetition()->getGenre()->name . ')'; } } else { $referee = 'Onbekend'; } $text = $oGame->getFormattedTime(); $text .= "\t"; $text .= $team1; $text .= "\t"; $text .= $team2; $text .= "\n"; $text .= $gameType; if ($includeField) { $text .= $field; } $this->section->addText($text, array('name' => 'Arial', 'size' => 10, 'bold' => false)); }
/** * * @param int $nefubId */ public function showGame($nefubId) { $this->subdirectory = '/wedstrijd'; $this->path = '/' . $nefubId; $this->template = '/game/game.tpl'; if ($this->getClearRender()) { $oGame = Game::getByNefubId($nefubId); if ($oGame) { $this->assign('oSeason', $oSeason); $this->assign('bShowShots', $oGame->poule_type_id != GAME_TYPE_KLEINVELD); $this->assign('oGame', $oGame); $gameActions = $oGame->getActions(); $this->assign('gameActions', $gameActions); if (count($gameActions) == 0) { $this->assign('noGameActions', true); } } else { $this->redirect(); } } $this->showOutput(); }
/** * * @param stdClass $game * @param int $teamNefubId * @param Game $oGame * @return Game */ protected function convertGame(stdClass $game) { $oGame = Game::getByNefubId($game->ID); if (!$oGame) { $oGame = new Game(); $oGame->nefub_id = $game->ID; $this->addedNefubObject($oGame); } if ($oGame->actions_retrieved == 1) { return $oGame; } if (count($game->{'Match Officials'})) { $referees = $game->{'Match Officials'}; // Backwards compatability if ($referees[0]->Team) { $oGame->ref_team_nefub_id = $referees[0]->Team->ID; } foreach ($referees as $referee) { $this->convertReferee($oGame, $referee); } } $oGame->team1_nefub_id = $game->Home->ID; $oGame->team2_nefub_id = $game->Away->ID; $oLocation = LocationMapper::mapFromAPI($game->Location); $oGame->location_nefub_id = $oLocation->nefub_id; $oGame->field = $game->Field; list($gameDay, $gameMonth, $gameYear) = explode('-', $game->Date); $oGame->date = $gameYear . '-' . $gameMonth . '-' . $gameDay; $oGame->time = $game->Time; $oGame->finished = isset($game->Result) && is_object($game->Result); $oCompetition = CompetitionMapper::mapFromAPI($game->Competition); $oGame->competition_nefub_id = $oCompetition->nefub_id; $oGame->season_nefub_id = $oCompetition->season_nefub_id; if ($oGame->finished) { $oGame->team1_score = $game->Result->Home; $oGame->team2_score = $game->Result->Away; $oGame->team1_shots = $game->Shots->Home; $oGame->team2_shots = $game->Shots->Away; if (!$oGame->actions_retrieved) { $this->convertGamePersons($game->Formation->Home, $game->Home->ID, $oGame); $this->convertGamePersons($game->Formation->Away, $game->Away->ID, $oGame); Database::delete_rows('GameAction', array('game_nefub_id' => $oGame->nefub_id)); $this->convertGameActions($game->Events, $oGame); Game::updateActionsRetrieved($oGame); } } $oGame->save(); $this->retrievedScheduledGameNefubIds[$oGame->nefub_id] = $oGame; return $oGame; }
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'); } }