protected function __construct() { $this->season = Season::getInstance(); $this->smarty = new Smarty(); $arguments = explode('?', $_SERVER['REQUEST_URI']); $arguments = strtolower($arguments[0]); $arguments = explode('/', $arguments); array_shift($arguments); $this->arguments = $arguments; }
/** * * @param mixed $input * @param NefubObject $oOutput */ protected static function handleMapping($input, NefubObject $oOutput) { $oOutput->nefub_id = $input->ID; $oOutput->name = $input->Name; $oOutput->club_nefub_id = $input->Club->ID; $oOutput->color_shirt = $input->Dress->Shirt; $oOutput->color_shorts = $input->Dress->Short; $oOutput->competition_nefub_id = $input->Competition->ID; $oOutput->season_nefub_id = Season::getInstance()->nefub_id; }
/** * @param mixed $input * @param NefubObject $oOutput */ protected static function handleMapping($input, NefubObject $oOutput) { $oOutput->nefub_id = $input->ID; $oOutput->competition_nefub_id = $input->Competition->ID; $oOutput->season_nefub_id = Season::getInstance()->nefub_id; $oOutput->name = $input->Name; $oOutput->information = $input->Information; $oPouleType = NefubTypeMapper::mapTypeFromAPI($input->Type, 'PouleType'); $oOutput->poule_type_id = $oPouleType->getId(); }
public static function getPlannedTeamGames(Team $oTeam, $bIncludeEvents = true) { $query = "SELECT Game.*\r\n\t\t\t\t\t\tFROM Game\t\t\t\t\t\t\r\n\t\t\t\t\t\tWHERE Game.date >= CURDATE()\r\n\t\t\t\t\t\tAND\r\n\t\t\t\t\t\t(\r\n\t\t\t\t\t\t\tGame.team1_nefub_id = '" . $oTeam->nefub_id . "'\r\n\t\t\t\t\t\t\tOR\r\n\t\t\t\t\t\t\tGame.team2_nefub_id = '" . $oTeam->nefub_id . "'\t\t\t\t\t\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\tOR\r\n\t\t\t\t\t\t\tGame.nefub_id IN\r\n\t\t\t\t\t\t\t(\r\n\t\t\t\t\t\t\t\tSELECT Referee.game_nefub_id\r\n\t\t\t\t\t\t\t\tFROM Referee\r\n\t\t\t\t\t\t\t\tWHERE\r\n\t\t\t\t\t\t\t\tReferee.team_nefub_id = '" . $oTeam->nefub_id . "'\r\n\t\t\t\t\t\t\t)\r\n\t\t\t\t\t\t)\r\n\t\t\t\t\t\tAND Game.date IS NOT NULL\t\t\t\t\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\tORDER BY Game.date ASC,\r\n\t\t\t\t\tGame.time ASC"; $aGames = Game::getAllFromQuery($query); if ($bIncludeEvents) { $oGender = $oTeam->getCompetition()->getGender(); $oGenre = $oTeam->getCompetition()->getGenre(); $aEvents = Event::getAll(array('gender_id' => $oGender->getId(), 'genre_id' => $oGenre->getId(), 'season_nefub_id' => Season::getInstance()->nefub_id), 'date'); } return $aGames; }
/** * * @return array */ public function getTeamPersons($includeTransferedFrom = true, $includeTransferedTo = true) { $where = ''; if (!$includeTransferedTo) { $where .= " AND TeamPerson.transfered != 1"; } if (!$includeTransferedFrom) { $where .= " AND TeamPerson.transfered != -1"; } $query = "SELECT TeamPerson.id\n\t\t\t\t\tFROM TeamPerson\n\t\t\t\t\tLEFT JOIN Team ON Team.nefub_id = TeamPerson.team_nefub_id\n\t\t\t\t\tWHERE\n\t\t\t\t\tTeamPerson.person_nefub_id = '" . $this->nefub_id . "'\n\t\t\t\t\tAND Team.season_nefub_id = '" . Season::getInstance()->nefub_id . "'\n\t\t\t\t\t{$where}\n\t\t\t\t\tGROUP BY TeamPerson.team_nefub_id\n\t\t\t\t\tORDER BY TeamPerson.team_nefub_id ASC"; return TeamPerson::getAllFromQuery($query); }
public static function getPlannedEvents($date = null, Genre $oGenre = null, Gender $oGender = null) { $query = "SELECT Event.id\n\t\t\t\t\tFROM Event\n\t\t\t\t\tWHERE Event.season_nefub_id = '" . Season::getInstance()->nefub_id . "'\n\t\t\t\t\t "; if ($oGender) { $query .= " AND Event.gender_id " . $oGender->getId(); } if ($oGenre) { $query .= " AND Event.genre_id " . $oGenre->getId(); } if ($date) { $query .= " AND Event.date = '" . str_replace("'", '', $date) . "'"; } else { $query .= ' AND DATE(Event.date) >= CURDATE()'; } $query .= ' GROUP BY gender_id'; $query .= ' ORDER BY Event.date ASC'; return self::getAllFromQuery($query); }
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 mixed $input * @param NefubObject */ protected static function handleMapping($input, NefubObject $oOutput) { $oOutput->nefub_id = $input->ID; $oOutput->season_nefub_id = Season::getInstance()->nefub_id; $oOutput->field = $input->Field; $oOutput->team1_nefub_id = $input->Home->ID; $oOutput->team2_nefub_id = $input->Away->ID; if (count($input->{'Match Officials'})) { } $referee = $input->{'Match Officials'}[0]; $oOutput->ref_team_nefub_id = $referee->Team->ID; foreach ($input->{'Match Officials'} as $referee) { RefereeMapper::mapRefereeFromAPI($referee, $input); } if ($input->Location) { $oLocation = LocationMapper::mapFromAPI($input->Location); $oOutput->location_nefub_id = $oLocation->nefub_id; } list($inputDay, $inputMonth, $inputYear) = explode('-', $input->Date); $oOutput->date = $inputYear . '-' . $inputMonth . '-' . $inputDay; $oOutput->time = $input->Time; $oOutput->finished = is_object($input->Result); if ($oOutput->finished) { $oOutput->team1_score = $input->Result->Home; $oOutput->team2_score = $input->Result->Away; $oOutput->team1_shots = $input->Shots->Home; $oOutput->team2_shots = $input->Shots->Away; // At least every goal should be an event if (is_array($input->Events) && count($input->Events) >= $oOutput->team1_score + $oOutput->team2_score) { foreach ($input->Events as $gameAction) { $oGameAction = GameActionMapper::mapGameActionFromAPI($gameAction, $input); } $oOutput->actions_retrieved = true; } } return $oOutput; }
/** * (non-PHPdoc) * @see Renderer::showOutput() */ public function showOutput() { $fullDir = $this->getFullRenderDirectory(); $fullPath = $this->getFullRenderPath(); // If render is set to be cleared, we need to parse the template to an html file if ($this->getClearRender()) { $this->assignSettings(); $this->assign('subject', $this->subject); $this->assign('oCurrentSeason', Season::getInstance()); $this->assign('nefubRoot', NEFUB_ROOT); $this->assign('host', HOST); $oLastRetrieved = RetrieveLog::getLast(); $this->assign('lastRetrieved', $oLastRetrieved->finish_time); $this->assign('downloadFileTypes', array('pdf' => 'PDF', 'csv' => 'Excel')); //, 'docx' => 'Word')); $output = $this->smarty->fetch('templates' . $this->template); // We need to create the directory recursively if it doesn't exist if (!file_exists($fullDir)) { mkdir($fullDir, 0777, true); } $r = fopen($fullPath, 'w+'); fwrite($r, $output); fclose($r); // need to be able to edit without being apache chmod($fullPath, 0777); } // Open the html file for output to screen require_once $fullPath; exit; }
protected static function convertEvent($nefubName, $date, Genre $oGenre, Gender $oGender) { $oEvent = Event::getByNefubName($nefubName, $date, $oGender); if (!$oEvent) { $oEvent = new Event(); $oEvent->nefub_name = $nefubName; $oEvent->season_nefub_id = Season::getInstance()->nefub_id; $oEvent->date = $date; $oEvent->genre_id = $oGenre->getId(); if ($oGender) { $oEvent->gender_id = $oGender->getId(); } } $oEvent->save(); return $oEvent; }
<?php require_once 'config.php'; setlocale(LC_ALL, 'nl_NL'); if (isset($_GET['tree']) && $_GET['tree'] == 1) { $oSeason = Season::getInstance(); var_dump_path($oSeason->getTree()); exit; } else { $oFrontRenderer = new FrontRenderer(); $arguments = explode('?', $_SERVER['REQUEST_URI']); $arguments = strtolower($arguments[0]); $arguments = explode('/', $arguments); array_shift($arguments); $c = count($arguments); $subject = $arguments[0]; if ($c >= 2) { $nefubId = $arguments[1]; } // Handle requests switch ($subject) { case 'ajax': if ($nefubId == 'search') { $search = urldecode($arguments[2]); $results = doSearch($search); echo json_encode($results); exit; } break; case 'retrieve.php': if (isset($_GET['retrieve'])) {
/** * */ public function buildSearchTable() { self::put('Zoekresultaten maken'); // Personen $aPersons = Person::getAll(); $personCount = 0; $deletePersonCount = 0; foreach ($aPersons as $oPerson) { $query = "SELECT DISTINCT(Team.competition_nefub_id), Competition.id\n\t\t\t\t\t\tFROM TeamPerson\n\t\t\t\t\t\tLEFT JOIN Team ON Team.nefub_id = TeamPerson.team_nefub_id\n\t\t\t\t\t\tLEFT JOIN Competition ON Team.competition_nefub_id = Competition.nefub_id\n\t\t\t\t\t\tWHERE TeamPerson.person_nefub_id = '" . $oPerson->nefub_id . "'\n\t\t\t\t\t\tAND Competition.season_nefub_id = '" . Season::getInstance()->nefub_id . "'\n\t\t\t\t\t\tORDER BY Team.competition_nefub_id ASC"; $aCompetitions = Competition::getAllFromQuery($query); $personCompetitions = array(); foreach ($aCompetitions as $oCompetition) { if (trim($oCompetition->name)) { $personCompetitions[] = $oCompetition->name; } } if (count($personCompetitions)) { $oSearchResult = SearchResult::selectByNefubId($oPerson->nefub_id, 'person'); if (!$oSearchResult) { $oSearchResult = new SearchResult(); $oSearchResult->nefub_id = $oPerson->nefub_id; $oSearchResult->type = 'person'; $oSearchResult->url = '/persoon/' . $oPerson->nefub_id; $personCount++; } $oSearchResult->name = $oPerson->name; $oSearchResult->subtitle = implode(', ', $personCompetitions); $oSearchResult->save(); } else { $deletePersonCount += Database::delete_rows('SearchResult', array('nefub_id' => $oPerson->nefub_id, 'type' => 'person')); } } self::put($deletePersonCount . ' perso(o)n(en) verwijderd van zoekresultatenlijst'); self::put($personCount . ' perso(o)n(en) toegevoegd aan zoekresultatenlijst'); // Teams $aTeams = Team::getAll(); $teamCount = 0; $deleteTeamCount = 0; foreach ($aTeams as $oTeam) { if ($oTeam->getCompetition() && $oTeam->season_nefub_id == Season::getInstance()->nefub_id) { $oSearchResult = SearchResult::selectByNefubId($oTeam->nefub_id, 'team'); if (!$oSearchResult) { $oSearchResult = new SearchResult(); $oSearchResult->nefub_id = $oTeam->nefub_id; $oSearchResult->name = $oTeam->name; $oSearchResult->type = 'team'; $oSearchResult->url = '/team/' . $oTeam->nefub_id; $teamCount++; } $oSearchResult->subtitle = $oTeam->getCompetition()->name; $oSearchResult->save(); } else { $deleteTeamCount += Database::delete_rows('SearchResult', array('nefub_id' => $oTeam->nefub_id, 'type' => 'team')); } } self::put($deleteTeamCount . ' team(s) verwijderd van zoekresultatenlijst'); self::put($teamCount . ' team(s) toegevoegd aan zoekresultatenlijst'); }
public function __construct() { $this->season = Season::getInstance(); }
/** * * Enter description here ... * @param string $template */ protected function showCompetitionDependentView($template = '/list.tpl') { $aCompetitions = Competition::getAll(array('season_nefub_id' => Season::getInstance()->nefub_id)); $this->assign('aCompetitions', $aCompetitions); $this->template = $template; $this->showOutput(); }