public function OnLoadPageData() { require_once 'stoolball/competition-manager.class.php'; $manager = new CompetitionManager($this->GetSettings(), $this->GetDataConnection()); if ($this->season_id) { $manager->ReadById(null, array($this->season_id)); } else { $manager->ReadById(array($this->competition_id)); } $this->competition = $manager->GetFirst(); $this->season = $this->competition->GetWorkingSeason(); unset($manager); # If the competition was requested, redirect to the current season if ($this->competition_id) { http_response_code(303); header("Location: " . $this->season->GetMapUrl()); return; } $this->has_map = count($this->season->GetTeams()); # Get other seasons require_once 'stoolball/season-manager.class.php'; $a_comp_ids = array($this->competition->GetId()); $o_season_manager = new SeasonManager($this->GetSettings(), $this->GetDataConnection()); $o_season_manager->ReadByCompetitionId($a_comp_ids); $a_other_seasons = $o_season_manager->GetItems(); $this->competition->SetSeasons(array()); foreach ($a_other_seasons as $season) { if ($season->GetId() == $this->season->GetId()) { $this->competition->AddSeason($this->season, true); } else { $this->competition->AddSeason($season, false); } } }
function OnLoadPageData() { /* @var $competition Competition */ # check parameter if (isset($_GET['competition']) and is_numeric($_GET['competition'])) { $comp_manager = new CompetitionManager($this->GetSettings(), $this->GetDataConnection()); $comp_manager->ReadById(array($_GET['competition']), null); $this->competition = $comp_manager->GetFirst(); $this->season = $this->competition->GetWorkingSeason(); unset($comp_manager); } else { $this->Redirect("/competitions/"); } # must have found a competition if (!$this->competition instanceof Competition) { $this->Redirect("/competitions/"); } # Get seasons in the competition $a_comp_ids = array($this->competition->GetId()); $o_season_manager = new SeasonManager($this->GetSettings(), $this->GetDataConnection()); $o_season_manager->ReadByCompetitionId($a_comp_ids); $a_seasons = $o_season_manager->GetItems(); $this->competition->SetSeasons($a_seasons); unset($o_season_manager); # Get stats highlights $this->statistics["querystring"] = "?competition=" . $this->competition->GetId(); require_once 'stoolball/statistics/statistics-manager.class.php'; $statistics_manager = new StatisticsManager($this->GetSettings(), $this->GetDataConnection()); $statistics_manager->FilterByCompetition(array($this->competition->GetId())); require_once "_summary-data-query.php"; unset($statistics_manager); }
function OnLoadPageData() { /* @var $o_competition Competition */ # check parameter if (!isset($_GET['season']) or !is_numeric($_GET['season'])) { http_response_code(400); exit; } if (isset($_GET['season']) and is_numeric($_GET['season'])) { $comp_manager = new CompetitionManager($this->GetSettings(), $this->GetDataConnection()); $comp_manager->ReadById(null, array($_GET['season'])); $this->competition = $comp_manager->GetFirst(); unset($comp_manager); } # must have found a competition if (!$this->competition instanceof Competition) { http_response_code(404); exit; } $this->season = $this->competition->GetWorkingSeason(); if (is_object($this->season)) { # get matches $o_match_manager = new MatchManager($this->GetSettings(), $this->GetDataConnection()); $o_match_manager->ReadBySeasonId(array($this->season->GetId())); $a_matches = $o_match_manager->GetItems(); $this->season->SetMatches($a_matches); # Get other seasons $a_comp_ids = array($this->competition->GetId()); $o_season_manager = new SeasonManager($this->GetSettings(), $this->GetDataConnection()); $o_season_manager->ReadByCompetitionId($a_comp_ids); $a_other_seasons = $o_season_manager->GetItems(); $this->competition->SetSeasons(array()); foreach ($a_other_seasons as $season) { if ($season->GetId() == $this->season->GetId()) { $this->competition->AddSeason($this->season, true); } else { $this->competition->AddSeason($season, false); } } unset($o_season_manager); } else { # Must have a season http_response_code(404); exit; } }
function OnLoadPageData() { /* @var $match_manager MatchManager */ /* @var $editor TournamentEditControl */ # get id of Match $i_id = $this->match_manager->GetItemId(); if (!$i_id) { return; } # no need to read if redisplaying invalid form if ($this->IsValid()) { $this->match_manager->ReadByMatchId(array($i_id)); $this->tournament = $this->match_manager->GetFirst(); if ($this->tournament instanceof Match) { $this->b_user_is_match_owner = AuthenticationManager::GetUser()->GetId() == $this->tournament->GetAddedBy()->GetId(); $this->b_is_tournament = $this->tournament->GetMatchType() == MatchType::TOURNAMENT; } else { return; } } if ($this->b_user_is_match_admin or $this->b_user_is_match_owner) { # Get all seasons # Don't filter by match type at this point because we want to know what other types of match the seasons support. # If it's tournaments only, they'll be treated differently. require_once 'stoolball/season-manager.class.php'; $season_manager = new SeasonManager($this->GetSettings(), $this->GetDataConnection()); $season_dates = Season::SeasonDates($this->tournament->GetStartTime()); $season_manager->FilterByDateStart($season_dates[0]); $season_manager->FilterByDateEnd($season_dates[1]); $season_manager->ReadSeasonSummaries(array($this->tournament->GetPlayerType())); $this->editor->Seasons()->SetItems($season_manager->GetItems()); unset($season_manager); } }
function OnLoadPageData() { /* @var $o_competition Competition */ # check parameter if (!isset($_GET['item']) or !is_numeric($_GET['item'])) { http_response_code(400); exit; } # new data managers $o_comp_manager = new CompetitionManager($this->GetSettings(), $this->GetDataConnection()); # get competition $latest = (isset($_GET['latest']) and $_GET['latest'] == '1'); if ($latest) { $o_comp_manager->ReadById(array($_GET['item']), null); } else { $o_comp_manager->ReadById(null, array($_GET['item'])); } $this->competition = $o_comp_manager->GetFirst(); $this->season = $this->competition->GetWorkingSeason(); # must have found a competition if (!$this->competition instanceof Competition or !$this->season instanceof Season) { http_response_code(404); exit; } # If the competition was requested, redirect to the current season if ($latest) { http_response_code(303); header("Location: " . $this->season->GetNavigateUrl()); return; } # Update search engine. Only do this for the latest season as then we have the right teams already. if ($this->competition->GetSearchUpdateRequired() and $latest) { $this->SearchIndexer()->DeleteFromIndexById("competition" . $this->competition->GetId()); require_once "search/competition-search-adapter.class.php"; $adapter = new CompetitionSearchAdapter($this->competition); $this->SearchIndexer()->Index($adapter->GetSearchableItem()); $this->SearchIndexer()->CommitChanges(); $o_comp_manager->SearchUpdated($this->competition->GetId()); } unset($o_comp_manager); # get matches $o_match_manager = new MatchManager($this->GetSettings(), $this->GetDataConnection()); $o_match_manager->ReadBySeasonId(array($this->season->GetId())); $a_matches = $o_match_manager->GetItems(); $this->season->SetMatches($a_matches); # While we're here, check if there are any outstanding notifications to be sent $o_match_manager->NotifyMatchModerator(); unset($o_match_manager); # Get stats highlights require_once 'stoolball/statistics/statistics-manager.class.php'; $statistics_manager = new StatisticsManager($this->GetSettings(), $this->GetDataConnection()); $statistics_manager->FilterBySeason(array($this->season->GetId())); $statistics_manager->FilterMaxResults(1); $this->best_batting = $statistics_manager->ReadBestBattingPerformance(); $this->best_bowling = $statistics_manager->ReadBestBowlingPerformance(); $this->most_runs = $statistics_manager->ReadBestPlayerAggregate("runs_scored"); $this->most_wickets = $statistics_manager->ReadBestPlayerAggregate("wickets"); $this->most_catches = $statistics_manager->ReadBestPlayerAggregate("catches"); # See what stats we've got available $best_batting_count = count($this->best_batting); $best_bowling_count = count($this->best_bowling); $best_batters = count($this->most_runs); $best_bowlers = count($this->most_wickets); $best_catchers = count($this->most_catches); $this->has_player_stats = ($best_batting_count or $best_batters or $best_bowling_count or $best_bowlers or $best_catchers); if (!$this->has_player_stats) { $player_of_match = $statistics_manager->ReadBestPlayerAggregate("player_of_match"); $this->has_player_stats = (bool) count($player_of_match); } unset($statistics_manager); # Get other seasons $a_comp_ids = array($this->competition->GetId()); $o_season_manager = new SeasonManager($this->GetSettings(), $this->GetDataConnection()); $o_season_manager->ReadByCompetitionId($a_comp_ids); $a_other_seasons = $o_season_manager->GetItems(); $this->competition->SetSeasons(array()); foreach ($a_other_seasons as $season) { if ($season->GetId() == $this->season->GetId()) { $this->competition->AddSeason($this->season, true); } else { $this->competition->AddSeason($season, false); } } unset($o_season_manager); }
function OnLoadPageData() { /* @var Team $team */ # check parameter if (!isset($_GET['item']) or !is_numeric($_GET['item'])) { $this->Redirect(); } # new data manager $team_manager = new TeamManager($this->GetSettings(), $this->GetDataConnection()); $match_manager = new MatchManager($this->GetSettings(), $this->GetDataConnection()); # get teams $team_manager->FilterByTeamType(array()); $team_manager->ReadById(array($_GET['item'])); $this->team = $team_manager->GetFirst(); # must have found a team if (!$this->team instanceof Team) { $this->Redirect('/teams/'); } # Update search engine if ($this->team->GetSearchUpdateRequired()) { require_once "search/team-search-adapter.class.php"; $this->SearchIndexer()->DeleteFromIndexById("team" . $this->team->GetId()); $adapter = new TeamSearchAdapter($this->team); $this->SearchIndexer()->Index($adapter->GetSearchableItem()); $this->SearchIndexer()->CommitChanges(); $team_manager->SearchUpdated($this->team->GetId()); } unset($team_manager); $this->is_one_time_team = $this->team->GetTeamType() == Team::ONCE; # get matches and match stats if (!$this->is_one_time_team) { $a_season_dates = Season::SeasonDates(); $this->season_key = date('Y', $a_season_dates[0]); if ($this->season_key != date('Y', $a_season_dates[1])) { $this->season_key .= "/" . date('y', $a_season_dates[1]); } $match_manager->FilterByDateStart($a_season_dates[0]); } $match_manager->FilterByTeam(array($this->team->GetId())); $match_manager->ReadMatchSummaries(); $this->a_matches = $match_manager->GetItems(); unset($match_manager); $club = $this->team->GetClub(); $this->has_facebook_group_url = ($club->GetFacebookUrl() and strpos($club->GetFacebookUrl(), '/groups/') !== false); $this->has_facebook_page_url = ($club->GetFacebookUrl() and !$this->has_facebook_group_url); if (!$this->has_facebook_page_url) { require_once 'stoolball/statistics/statistics-manager.class.php'; $statistics_manager = new StatisticsManager($this->GetSettings(), $this->GetDataConnection()); $statistics_manager->FilterByTeam(array($this->team->GetId())); $statistics_manager->FilterMaxResults(1); $this->best_batting = $statistics_manager->ReadBestBattingPerformance(); $this->best_bowling = $statistics_manager->ReadBestBowlingPerformance(); $this->most_runs = $statistics_manager->ReadBestPlayerAggregate("runs_scored"); $this->most_wickets = $statistics_manager->ReadBestPlayerAggregate("wickets"); $this->most_catches = $statistics_manager->ReadBestPlayerAggregate("catches"); # See what stats we've got available $best_batting_count = count($this->best_batting); $best_bowling_count = count($this->best_bowling); $best_batters = count($this->most_runs); $best_bowlers = count($this->most_wickets); $best_catchers = count($this->most_catches); $this->has_player_stats = ($best_batting_count or $best_batters or $best_bowling_count or $best_bowlers or $best_catchers); if (!$this->has_player_stats) { $player_of_match = $statistics_manager->ReadBestPlayerAggregate("player_of_match"); $this->has_player_stats = (bool) count($player_of_match); } unset($statistics_manager); } # Get whether to show add league/cup links $season_manager = new SeasonManager($this->GetSettings(), $this->GetDataConnection()); $season_manager->ReadCurrentSeasonsByTeamId(array($this->team->GetId()), array(MatchType::CUP, MatchType::LEAGUE)); $this->seasons = $season_manager->GetItems(); unset($season_manager); }
function OnLoadPageData() { /* @var $o_last_match Match */ /* @var $season Season */ /* @var $team Team */ # new data manager $o_match_manager = new MatchManager($this->GetSettings(), $this->GetDataConnection()); # Collect season to add this match to, starting with the URL # get season and teams (was at this stage because editor needed teams to build its # posted data object, but that's no longer the case so probably could be later if needed) if (isset($this->i_season_id)) { $season_manager = new SeasonManager($this->GetSettings(), $this->GetDataConnection()); $season_manager->ReadById(array($this->i_season_id)); $this->season = $season_manager->GetFirst(); unset($season_manager); $this->edit->Seasons()->Add($this->season); # If there are at least 2 teams in the season, show only those teams, otherwise show all teams of the relevant player type if (count($this->season->GetTeams()) > 1) { $this->edit->SetTeams(array($this->season->GetTeams())); } else { require_once 'stoolball/team-manager.class.php'; $team_manager = new TeamManager($this->GetSettings(), $this->GetDataConnection()); $team_manager->FilterByPlayerType(array($this->season->GetCompetition()->GetPlayerType())); $team_manager->ReadTeamSummaries(); $this->edit->SetTeams(array($team_manager->GetItems())); unset($team_manager); } } # Not elseif, because when you've added a match there's a season, but we still need this to run to populate # the choices for the next match to be added if ($this->team instanceof Team) { # Otherwise it should be a team. # Get more information about the team itself require_once 'stoolball/team-manager.class.php'; $team_manager = new TeamManager($this->GetSettings(), $this->GetDataConnection()); $team_manager->ReadById(array($this->team->GetId())); $this->team = $team_manager->GetFirst(); if (!is_null($this->team)) { $this->edit->SetContextTeam($this->team); $season_ids = array(); $team_groups = array(); $a_exclude_team_ids = array(); $team_manager->FilterByActive(true); # Add the home team first $team_groups[] = array($this->team); $a_exclude_team_ids[] = $this->team->GetId(); # Get the seasons this team is in... $season_manager = new SeasonManager($this->GetSettings(), $this->GetDataConnection()); if ($this->i_match_type == MatchType::FRIENDLY) { # For a friendly, any group of teams they play with is fine $season_manager->ReadCurrentSeasonsByTeamId(array($this->team->GetId())); } else { # For anything else, get the seasons *for this type of match* $season_manager->ReadCurrentSeasonsByTeamId(array($this->team->GetId()), array($this->i_match_type)); } $seasons = $season_manager->GetItems(); unset($season_manager); $this->edit->Seasons()->Clear(); # on postback, the season just added is already there, so clear to prevent a duplicate foreach ($seasons as $season) { $this->edit->Seasons()->Add($season); $season_ids[] = $season->GetId(); } #... and their opponent teams in those seasons if (count($season_ids)) { $team_manager->FilterExceptTeams($a_exclude_team_ids); $team_manager->ReadBySeasonId($season_ids); $season_teams = $team_manager->GetItems(); if (count($season_teams)) { $team_groups['This season\'s teams'] = $season_teams; } foreach ($season_teams as $team) { $a_exclude_team_ids[] = $team->GetId(); } } # ...and if this is a friendly it could be any other team if ($this->i_match_type == MatchType::FRIENDLY) { # get any other teams they played in the last 2 years, and combine with existing results $team_manager->FilterExceptTeams($a_exclude_team_ids); $team_manager->ReadRecentOpponents(array($this->team->GetId()), 24); $recent_opponents = $team_manager->GetItems(); if (count($recent_opponents)) { $team_groups['Recent opponents'] = $recent_opponents; } foreach ($recent_opponents as $team) { $a_exclude_team_ids[] = $team->GetId(); } # get any other teams they might play, and combine with existing results $team_manager->FilterExceptTeams($a_exclude_team_ids); $team_manager->ReadAll(); $team_groups['Other teams'] = $team_manager->GetItems(); } # What if there are still no opponents to choose from? In that case select all teams. if (count($team_groups) == 1) { $team_manager->FilterExceptTeams($a_exclude_team_ids); $team_manager->ReadAll(); $team_groups[] = $team_manager->GetItems(); } # Offer those teams to select from if ($total_groups = count($team_groups)) { # If only two groups (home team + 1 group), don't group teams. Remove the only key from the array. if ($total_groups == 2) { $keys = array_keys($team_groups); $team_groups = array($team_groups[$keys[0]], $team_groups[$keys[1]]); } $this->edit->SetTeams($team_groups); } } unset($team_manager); } # Save match if ($this->IsPostback() and $this->IsValid()) { # Get posted match $this->match = $this->edit->GetDataObject(); if (!$this->IsRefresh()) { # Save match $o_match_manager->SaveFixture($this->match); $o_match_manager->SaveSeasons($this->match, true); $o_match_manager->NotifyMatchModerator($this->match->GetId()); # Update 'next 5 matches' $o_match_manager->ReadNext(); $this->a_next_matches = $o_match_manager->GetItems(); } # Reset control for new match $this->edit->SetDataObject(new Match($this->GetSettings())); } $o_match_manager->FilterByMatchType(array($this->i_match_type)); if (isset($this->i_season_id)) { # If we're adding a match to a season, get last game in season for its date $o_match_manager->ReadLastInSeason($this->season->GetId()); } else { if ($this->team instanceof Team) { # Get the last game already scheduled for the team to use its date $o_match_manager->ReadLastForTeam($this->team->GetId()); } } $o_last_match = $o_match_manager->GetFirst(); if (is_object($o_last_match)) { $current_season = Season::SeasonDates(); if (gmdate('Y', $o_last_match->GetStartTime()) < gmdate('Y', $current_season[0])) { # If the last match this team played was last season, use the time but not the date $this->edit->SetDefaultTime(gmmktime(gmdate('H', $o_last_match->GetStartTime()), gmdate('i', $o_last_match->GetStartTime()), 0, gmdate('m'), gmdate('d'), gmdate('Y'))); } else { # If the last match was this season and has a time, use it if ($o_last_match->GetIsStartTimeKnown()) { $this->edit->SetDefaultTime($o_last_match->GetStartTime()); } else { # If the last match has no time, use 6.30pm BST $this->edit->SetDefaultTime(gmmktime(17, 30, 0, gmdate('m', $o_last_match->GetStartTime()), gmdate('d', $o_last_match->GetStartTime()), gmdate('Y', $o_last_match->GetStartTime()))); } } } unset($o_match_manager); # Get grounds $o_ground_manager = new GroundManager($this->GetSettings(), $this->GetDataConnection()); $o_ground_manager->ReadAll(); $a_grounds = $o_ground_manager->GetItems(); $this->edit->SetGrounds($a_grounds); unset($o_ground_manager); }
/** * @return int * @param Competition $o_competition * @desc Save the supplied Competition to the database, and return the id */ function SaveCompetition($o_competition) { # Set up short URL manager require_once 'http/short-url-manager.class.php'; $o_url_manager = new ShortUrlManager($this->GetSettings(), $this->GetDataConnection()); $new_short_url = $o_url_manager->EnsureShortUrl($o_competition); # build query $category_id = is_null($o_competition->GetCategory()) ? null : $o_competition->GetCategory()->GetId(); $allowed_html = array('p', 'br', 'strong', 'em', 'a[href]', 'ul', 'ol', 'li'); # if no id, it's a new Competition; otherwise update the Competition $is_new = !$o_competition->GetId(); if ($is_new) { $s_sql = 'INSERT INTO ' . $this->GetSettings()->GetTable('Competition') . ' SET ' . "competition_name = " . Sql::ProtectString($this->GetDataConnection(), $o_competition->GetName()) . ", " . "category_id = " . Sql::ProtectNumeric($category_id, true, false) . ', ' . "intro = " . $this->SqlHtmlString($o_competition->GetIntro(), $allowed_html) . ", " . "contact = " . $this->SqlHtmlString($o_competition->GetContact(), $allowed_html) . ", " . "notification_email = " . Sql::ProtectString($this->GetDataConnection(), $o_competition->GetNotificationEmail()) . ", " . "website = " . Sql::ProtectString($this->GetDataConnection(), $o_competition->GetWebsiteUrl()) . ", " . 'active = ' . Sql::ProtectBool($o_competition->GetIsActive()) . ', ' . 'player_type_id = ' . Sql::ProtectNumeric($o_competition->GetPlayerType()) . ", " . 'players_per_team = ' . Sql::ProtectNumeric($o_competition->GetMaximumPlayersPerTeam()) . ", " . 'overs = ' . Sql::ProtectNumeric($o_competition->GetOvers()) . ", " . "short_url = " . Sql::ProtectString($this->GetDataConnection(), $o_competition->GetShortUrl()) . ", " . "update_search = 1, " . 'date_added = ' . gmdate('U') . ', ' . 'date_changed = ' . gmdate('U'); # run query $o_result = $this->GetDataConnection()->query($s_sql); # get autonumber $o_competition->SetId($this->GetDataConnection()->insertID()); # create a default season require_once 'stoolball/season-manager.class.php'; $o_season = new Season($this->GetSettings()); $o_season->SetCompetition($o_competition); $o_season->SetStartYear(gmdate('Y', gmdate('U'))); $o_season->SetEndYear(gmdate('Y', gmdate('U'))); $o_season->SetIsLatest(true); $o_season_mgr = new SeasonManager($this->GetSettings(), $this->GetDataConnection()); $o_season_mgr->SaveSeason($o_season); unset($o_season_mgr); } else { $s_sql = 'UPDATE ' . $this->GetSettings()->GetTable('Competition') . ' SET ' . "competition_name = " . Sql::ProtectString($this->GetDataConnection(), $o_competition->GetName()) . ", " . "category_id = " . Sql::ProtectNumeric($category_id, true, false) . ', ' . "intro = " . $this->SqlHtmlString($o_competition->GetIntro(), $allowed_html) . ", " . "contact = " . $this->SqlHtmlString($o_competition->GetContact(), $allowed_html) . ", " . "notification_email = " . Sql::ProtectString($this->GetDataConnection(), $o_competition->GetNotificationEmail()) . ", " . "website = " . Sql::ProtectString($this->GetDataConnection(), $o_competition->GetWebsiteUrl()) . ", " . 'active = ' . Sql::ProtectBool($o_competition->GetIsActive()) . ', ' . 'player_type_id = ' . Sql::ProtectNumeric($o_competition->GetPlayerType()) . ", " . 'players_per_team = ' . Sql::ProtectNumeric($o_competition->GetMaximumPlayersPerTeam()) . ", " . 'overs = ' . Sql::ProtectNumeric($o_competition->GetOvers()) . ", " . "short_url = " . Sql::ProtectString($this->GetDataConnection(), $o_competition->GetShortUrl()) . ", " . "update_search = 1, " . 'date_changed = ' . gmdate('U') . ' ' . 'WHERE competition_id = ' . Sql::ProtectNumeric($o_competition->GetId()); # run query $this->GetDataConnection()->query($s_sql); } # Request search update for related objects which mention the competition $seasons = array(); $sql = "SELECT season_id FROM nsa_season WHERE competition_id = " . SQL::ProtectNumeric($o_competition->GetId(), false); $result = $this->GetDataConnection()->query($sql); while ($row = $result->fetch()) { $seasons[] = $row->season_id; } $result->closeCursor(); $seasons = implode(", ", $seasons); $sql = "UPDATE nsa_team SET update_search = 1 WHERE team_id IN \n ( \n SELECT team_id FROM nsa_team_season WHERE season_id IN ({$seasons})\n )"; $this->GetDataConnection()->query($sql); $sql = "UPDATE nsa_match SET update_search = 1 WHERE match_id IN \n ( \n SELECT match_id FROM nsa_season_match WHERE season_id IN ({$seasons})\n )"; $this->GetDataConnection()->query($sql); # Regenerate short URLs if (is_object($new_short_url)) { $new_short_url->SetParameterValuesFromObject($o_competition); $o_url_manager->Save($new_short_url); # season URLs are generated from the competition, so regenerate those too if (!$is_new) { $o_season_mgr = new SeasonManager($this->GetSettings(), $this->GetDataConnection()); $o_season_mgr->ReadByCompetitionId(array($o_competition->GetId())); $seasons = $o_season_mgr->GetItems(); unset($o_season_mgr); foreach ($seasons as $season) { /* @var $season Season */ $new_short_url = $o_url_manager->EnsureShortUrl($season, true); if (is_object($new_short_url)) { $s_sql = "UPDATE " . $this->GetSettings()->GetTable('Season') . " SET short_url = " . Sql::ProtectString($this->GetDataConnection(), $new_short_url->GetShortUrl()) . " WHERE season_id = " . Sql::ProtectNumeric($season->GetId()); $this->GetDataConnection()->query($s_sql); $new_short_url->SetParameterValuesFromObject($season); $o_url_manager->Save($new_short_url); } } } } unset($o_url_manager); return $o_competition->GetId(); }