/** * @return Team */ public function getTeam() { if (!$this->team) { $this->team = Team::getByNefubId($this->team_nefub_id); } return $this->team; }
protected function runTeamSchedule($nefubId, $date) { if (is_numeric($nefubId) && $date) { if ($oTeam = Team::getByNefubId($nefubId)) { $formattedDate = strftime("%A %e %B %Y", strtotime($date)); $filename = 'agenda ' . $date . ' ' . $oTeam->name; $oSeason = Season::getInstance(); $query = "SELECT Game.id FROM Game WHERE Game.date = '" . $date . "' \n\t\t\t\t\t\t\tAND\n\t\t\t\t\t\t\t\t(\tGame.team1_nefub_id = '" . $oTeam->nefub_id . "' OR\n\t\t\t\t\t\t\t\t\tGame.team2_nefub_id = '" . $oTeam->nefub_id . "' OR\n\t\t\t\t\t\t\t\t\tGame.ref_team_nefub_id = '" . $oTeam->nefub_id . "')\n\t\t\t\t\t\t\tORDER BY Game.time, Game.field;\n\t\t\t\t\t\t"; $aGames = Game::getAllFromQuery($query); if (count($aGames)) { $title = 'Programma ' . $formattedDate . ' voor ' . utf8_decode($oTeam->name) . ' (' . $oTeam->getCompetition()->name . ')'; $footer = $title . '. Gedownload van http://' . $_SERVER['HTTP_HOST'] . '/team/' . $nefubId; $this->renderGames($filename, $title, $aGames, $footer, false); } } } $this->redirect(); }
/** * * @param int $nefubId */ public function showTeam($nefubId = null) { $this->subdirectory = '/team'; if ($nefubId) { $this->path = '/' . $nefubId; $this->template = '/team/team.tpl'; if ($this->getClearRender()) { $oTeam = Team::getByNefubId($nefubId); if ($oTeam) { $this->assign('oTeam', $oTeam); $finishedGames = $oTeam->getFinishedGames(); $aPlannedGames = $oTeam->getPlannedGames(); $finishedGamesCount = count($finishedGames); $plannedGamesCount = count($plannedGames); $players = $oTeam->getTeamPersons(); $playerCount = count($players); $this->assign('playerCount', $playerCount); $this->assign('aFinishedGames', $oTeam->getFinishedGames()); $this->assign('finishedGamesCount', $finishedGamesCount); $this->assign('aPlannedGames', $aPlannedGames); $this->assign('plannedGamesCount', $plannedGamesCount); } else { $this->redirect('/team'); } } } else { $this->path = '/index'; $this->template = '/team/view.tpl'; if ($this->getClearRender()) { $aSortedTeams = Team::getSortedByAlphabet(); $this->assign('aSortedTeams', $aSortedTeams); } } $this->showOutput(); }
public function updateTeams() { $aPoules = Poule::getAll(array('season_nefub_id' => Season::getInstance()->nefub_id), 'competition_nefub_id'); foreach ($aPoules as $oPoule) { $aPouleTeams = $oPoule->getPouleTeams(); foreach ($aPouleTeams as $oPouleTeam) { $team = $this->getAPITeamDetails($oPouleTeam->team_nefub_id); $oTeam = Team::getByNefubId($team->ID); if (!$oTeam) { $oTeam = new Team(); $oTeam->nefub_id = $team->ID; $oTeam->name = $team->Name; $oTeam->competition_nefub_id = $oPoule->competition_nefub_id; $oTeam->season_nefub_id = $oPoule->getCompetition()->season_nefub_id; $oTeam->club_nefub_id = $team->Club->ID; $oTeam->color_shirt = $team->Dress->Shirt; $oTeam->color_shorts = $team->Dress->Short; self::put('Team ' . $team->Name . ' toegevoegd'); $oTeam->save(); } if (isset($team->Players) && is_array($team->Players)) { foreach ($team->Players as $teamPlayer) { $this->convertTeamPerson($teamPlayer, $oTeam); } } else { self::put('Geen spelers gevonden voor ' . $team->Name); } $this->retrieveClub($team->Club); $this->retrieveTeamGames($team, 'schedule'); $query = "SELECT COUNT(Game.nefub_id) as countGames\n\t\t\t\t\t\t\tFROM Game\n\t\t\t\t\t\t\tWHERE\n\t\t\t\t\t\t\t\t(team1_nefub_id = '" . $team->ID . "'\n\t\t\t\t\t\t\t\tOR\n\t\t\t\t\t\t\t\tteam2_nefub_id = '" . $team->ID . "')\n\t\t\t\t\t\t\t\tAND\n\t\t\t\t\t\t\t\tGame.date <= CURDATE()"; $rows = Database::select_rows_by_query($query); $playedGames = $rows[0]['countGames']; $bRetrieveResults = false; if ($playedGames) { // Als er geen oude wedstrijden in de DB staan, vermoedelijk zijn ze dan niet eerder opgehaald. $query .= " AND Game.actions_retrieved = 0"; $rows = Database::select_rows_by_query($query); $gamesToRetrieve = $rows[0]['countGames']; $bRetrieveResults = $gamesToRetrieve != 0; } if ($bRetrieveResults) { $this->retrieveTeamGames($team, 'results'); } else { self::put('Resultaten voor ' . $oTeam->name . ' hoeven niet vernieuwd te worden'); } $oTeam->save(); $this->retrievedTeamNefubIds[$oPouleTeam->team_nefub_id] = true; } } }
protected function showTeams() { switch ($this->mode) { case 'bewerken': $oTeam = Team::getByNefubId($this->editId); $this->editObject($oTeam); break; default: $this->showCompetitionDependentView('/teams.tpl'); } }
/** * Enter description here ... * @return Team */ public function getTeam2() { return Team::getByNefubId($this->team2_nefub_id); }