function OnPageLoad() { # Matches this page shouldn't edit are page not found if ($this->page_not_found) { require_once $_SERVER['DOCUMENT_ROOT'] . "/wp-content/themes/stoolball/section-404.php"; return; } echo "<h1>" . Html::Encode($this->GetPageTitle()) . "</h1>"; require_once 'xhtml/navigation/tabs.class.php'; $tabs = array('Summary' => $this->match->GetNavigateUrl()); if ($this->match->GetMatchType() == MatchType::TOURNAMENT_MATCH) { $tabs['Match statistics'] = ''; $tabs['Tournament statistics'] = $this->match->GetTournament()->GetNavigateUrl() . '/statistics'; } else { $tabs['Statistics'] = ''; } echo new Tabs($tabs); ?> <div class="box tab-box"> <div class="dataFilter"></div> <div class="box-content"> <?php if (!$this->has_statistics) { echo "<p>There aren't any statistics for " . htmlentities($this->match->GetTitle(), ENT_QUOTES, "UTF-8", false) . ' yet.</p> <p>To find out how to add them, see <a href="/play/manage/website/matches-and-results-why-you-should-add-yours/">Matches and results - why you should add yours</a>.</p>'; } else { ?> <div class="statsColumns"> <div class="statsColumn"> <div class="chart-js-template" id="worm-chart"></div> </div> <div class="statsColumn"> <div class="chart-js-template" id="run-rate-chart"></div> </div> </div> <div class="statsColumns manhattan"> <h2>Scores in each over</h2> <div class="statsColumn"> <div class="chart-js-template" id="manhattan-chart-first-innings"></div> </div> <div class="statsColumn"> <div class="chart-js-template" id="manhattan-chart-second-innings"></div> </div> </div> <?php } ?> </div> </div> <?php }
/** * @return void * @param Match $o_match * @desc Save the fixture details of the supplied Match to the database, and return the id */ public function SaveFixture(Match $o_match) { /* @var $o_away_team Team */ $s_match = $this->GetSettings()->GetTable('Match'); $s_season_match = $this->GetSettings()->GetTable('SeasonMatch'); $statistics = $this->GetSettings()->GetTable('PlayerMatch'); # check permissions - only save limited fields if not admin $b_user_is_match_admin = AuthenticationManager::GetUser()->Permissions()->HasPermission(PermissionType::MANAGE_MATCHES); $b_is_new_match = !$o_match->GetId(); # Ensure we know the match type because we'll make decisions based on it if (!$b_is_new_match and !$b_user_is_match_admin) { # Match type can't be changed on this request so MatchType property usually not populated. # Read from db, otherwise these variables can be wrong and the code can follow the wrong path. $s_sql = "SELECT match_type FROM {$s_match} WHERE match_id = " . Sql::ProtectNumeric($o_match->GetId()); $result = $this->GetDataConnection()->query($s_sql); if ($row = $result->fetch()) { $o_match->SetMatchType($row->match_type); } $result->closeCursor(); } $is_friendly = $o_match->GetMatchType() == MatchType::FRIENDLY; $is_tournament = $o_match->GetMatchType() == MatchType::TOURNAMENT; $is_tournament_match = ($o_match->GetMatchType() == MatchType::TOURNAMENT_MATCH and $o_match->GetTournament() instanceof Match); # Ensure all involved teams have their name, because that's essential to building a match title, # and short URL because that's used to build a non-tournament match URL $teams_without_data = array(); if ($o_match->GetHomeTeamId() and (!$o_match->GetHomeTeam()->GetName() or !$o_match->GetHomeTeam()->GetShortUrl())) { $teams_without_data[] = $o_match->GetHomeTeamId(); } foreach ($o_match->GetAwayTeams() as $team) { /* @var $team Team */ if ($team->GetId() and (!$team->GetName() or !$team->GetShortUrl())) { $teams_without_data[] = $team->GetId(); } } if (count($teams_without_data)) { $result = $this->GetDataConnection()->query("SELECT team_id, team_name, short_url FROM nsa_team WHERE team_id IN (" . implode(",", $teams_without_data) . ")"); while ($row = $result->fetch()) { if ($row->team_id == $o_match->GetHomeTeamId()) { $o_match->GetHomeTeam()->SetName($row->team_name); $o_match->GetHomeTeam()->SetShortUrl($row->short_url); } foreach ($o_match->GetAwayTeams() as $team) { /* @var $team Team */ if ($row->team_id == $team->GetId()) { $team->SetName($row->team_name); $team->SetShortUrl($row->short_url); } } } $result->closeCursor(); } # Make sure it's not a duplicate. If it is, just return the existing match's id. $duplicate_match = $this->GetDuplicateFixture($o_match, $b_user_is_match_admin); if ($duplicate_match instanceof Match) { return $duplicate_match->GetId(); } # build query # NOTE: dates are user-selected, therefore they don't need adjusting $o_tournament = $o_match->GetTournament(); $i_tournament = is_null($o_tournament) ? null : $o_tournament->GetId(); $i_ground = $o_match->GetGroundId() > 0 ? $o_match->GetGroundId() : null; # if no id, it's a new match; otherwise update the match # All changes to master data from here are logged, because this method can be called from the public interface if (!$b_is_new_match) { # Update the main match record $s_sql = 'UPDATE nsa_match SET '; $updated_type = ""; $updated_title = ""; if ($b_user_is_match_admin) { $updated_type = 'match_type = ' . Sql::ProtectNumeric($o_match->GetMatchType()) . ', '; $updated_title = "match_title = " . Sql::ProtectString($this->GetDataConnection(), $o_match->GetTitle()) . ", "; $s_sql .= $updated_type . $updated_title . 'custom_title' . Sql::ProtectBool($o_match->GetUseCustomTitle(), false, true) . ', '; } else { # Non-admin user not given chance to amend a custom title, so if there is a custom title # it must be left unchanged. But if title was generated, it can be regenerated based on # the user's changes. $o_result = $this->GetDataConnection()->query("SELECT custom_title FROM {$s_match} WHERE {$s_match}.match_id = " . Sql::ProtectNumeric($o_match->GetId())); $o_row = $o_result->fetch(); if (!is_null($o_row)) { $o_match->SetUseCustomTitle($o_row->custom_title); } if (!$o_match->GetUseCustomTitle()) { $updated_title = "match_title = " . Sql::ProtectString($this->GetDataConnection(), $o_match->GetTitle()) . ", "; $s_sql .= $updated_title; } } $player_type = Sql::ProtectNumeric($this->WorkOutPlayerType($o_match), true, false); $ground_id = Sql::ProtectNumeric($i_ground, true); $start_time = Sql::ProtectNumeric($o_match->GetStartTime()); $s_sql .= 'player_type_id = ' . $player_type . ', qualification = ' . Sql::ProtectNumeric($o_match->GetQualificationType(), false, false) . ', tournament_match_id = ' . Sql::ProtectNumeric($i_tournament, true) . ', ground_id = ' . $ground_id . ', ' . 'start_time = ' . $start_time . ', ' . 'start_time_known = ' . Sql::ProtectBool($o_match->GetIsStartTimeKnown()) . ', ' . "match_notes = " . Sql::ProtectString($this->GetDataConnection(), $o_match->GetNotes()) . ", \r\n update_search = 1, \r\n\t\t\tdate_changed = " . gmdate('U') . ", \r\n modified_by_id = " . Sql::ProtectNumeric(AuthenticationManager::GetUser()->GetId()) . ' ' . 'WHERE match_id = ' . Sql::ProtectNumeric($o_match->GetId()); $this->LoggedQuery($s_sql); # Update fields which are cached in the player statistics table $sql = "UPDATE {$statistics} SET\r\n\t\t\t{$updated_type}\r\n\t\t\tmatch_player_type = {$player_type},\r\n\t\t\tmatch_time = {$start_time},\r\n\t\t\t{$updated_title}\r\n\t\t\tground_id = {$ground_id}\r\n\t\t\tWHERE match_id = " . Sql::ProtectNumeric($o_match->GetId()); $this->GetDataConnection()->query($sql); } else { # If it's not a duplicate, insert the match $s_sql = 'INSERT INTO ' . $s_match . ' SET ' . "match_title = " . Sql::ProtectString($this->GetDataConnection(), $o_match->GetTitle()) . ", " . 'custom_title' . Sql::ProtectBool($o_match->GetUseCustomTitle(), false, true) . ', ' . 'match_type = ' . Sql::ProtectNumeric($o_match->GetMatchType()) . ', ' . 'player_type_id = ' . Sql::ProtectNumeric($this->WorkOutPlayerType($o_match), true, false) . ', qualification = ' . Sql::ProtectNumeric($o_match->GetQualificationType(), false, false) . ', tournament_match_id = ' . Sql::ProtectNumeric($i_tournament, true) . ', ground_id = ' . Sql::ProtectNumeric($i_ground, true) . ', ' . 'start_time = ' . Sql::ProtectNumeric($o_match->GetStartTime()) . ', ' . 'start_time_known = ' . Sql::ProtectBool($o_match->GetIsStartTimeKnown()) . ', ' . "match_notes = " . Sql::ProtectString($this->GetDataConnection(), $o_match->GetNotes()) . ", \r\n\t\t\tupdate_search = 1, \r\n added_by " . Sql::ProtectNumeric(AuthenticationManager::GetUser()->GetId(), false, true) . ', ' . 'date_added = ' . gmdate('U') . ', ' . 'date_changed = ' . gmdate('U') . ", \r\n modified_by_id = " . Sql::ProtectNumeric(AuthenticationManager::GetUser()->GetId()); $this->LoggedQuery($s_sql); # get autonumber $o_match->SetId($this->GetDataConnection()->insertID()); } # Save teams, unless this is a tournament, in which case it happens separately if (!$is_tournament) { $this->SaveTeams($o_match); } if ($is_tournament) { $this->CopyTournamentDetailsToTournamentMatches($o_match); } else { if ($is_tournament_match) { $this->CopyTournamentMatchDetailsFromTournament($o_match->GetTournament(), $o_match); } } # Only save players per side/overs for tournaments and friendlies. For other match types it's based on the # seasons and updated during SaveSeasons() if ($is_tournament or $is_friendly) { $players_per_team = $o_match->GetIsMaximumPlayersPerTeamKnown() ? Sql::ProtectNumeric($o_match->GetMaximumPlayersPerTeam()) : "NULL"; $overs = $o_match->GetIsOversKnown() ? Sql::ProtectNumeric($o_match->GetOvers()) : "NULL"; $s_sql = "UPDATE {$s_match} SET players_per_team = {$players_per_team}, overs = {$overs} " . " WHERE match_id = " . Sql::ProtectNumeric($o_match->GetId()) . " OR tournament_match_id = " . Sql::ProtectNumeric($o_match->GetId()); $this->LoggedQuery($s_sql); } $this->UpdateMatchUrl($o_match, $b_user_is_match_admin); # Match data has changed so notify moderator $this->QueueForNotification($o_match->GetId(), $b_is_new_match); }
function OnLoadPageData() { /* @var $match_manager MatchManager */ /* @var $editor MatchEditControl */ # get id of Match $i_id = $this->match_manager->GetItemId(); if ($i_id) { # Get details of match but, if invalid, don't replace submitted details with saved ones if ($this->IsValid()) { $this->match_manager->ReadByMatchId(array($i_id)); $this->match_manager->ExpandMatchScorecards(); $this->match = $this->match_manager->GetFirst(); if ($this->match instanceof Match) { $this->b_user_is_match_owner = AuthenticationManager::GetUser()->GetId() == $this->match->GetAddedBy()->GetId(); $this->b_is_tournament = $this->match->GetMatchType() == MatchType::TOURNAMENT; } } unset($this->match_manager); # get all competitions if user has permission to change the season if ($this->b_user_is_match_admin) { require_once 'stoolball/competition-manager.class.php'; $o_comp_manager = new CompetitionManager($this->GetSettings(), $this->GetDataConnection()); $o_comp_manager->ReadAllSummaries(); $this->editor->SetSeasons(CompetitionManager::GetSeasonsFromCompetitions($o_comp_manager->GetItems())); unset($o_comp_manager); } if ($this->b_user_is_match_admin or $this->b_user_is_match_owner) { # get all teams $season_ids = array(); if ($this->match instanceof Match) { foreach ($this->match->Seasons() as $season) { $season_ids[] = $season->GetId(); } } require_once 'stoolball/team-manager.class.php'; $o_team_manager = new TeamManager($this->GetSettings(), $this->GetDataConnection()); if ($this->match instanceof Match and $this->match->GetMatchType() == MatchType::TOURNAMENT_MATCH) { $o_team_manager->FilterByTournament(array($this->match->GetTournament()->GetId())); $o_team_manager->FilterByTeamType(array()); # override default to allow all team types $o_team_manager->ReadTeamSummaries(); } else { if ($this->b_user_is_match_admin or !count($season_ids) or $this->match->GetMatchType() == MatchType::FRIENDLY) { $o_team_manager->ReadById(); # we need full data on the teams to get the seasons they are playing in; } else { # If the user can't change the season, why let them select a team that's not in the season? $o_team_manager->ReadBySeasonId($season_ids); } } $this->editor->SetTeams(array($o_team_manager->GetItems())); unset($o_team_manager); # get all grounds require_once 'stoolball/ground-manager.class.php'; $o_ground_manager = new GroundManager($this->GetSettings(), $this->GetDataConnection()); $o_ground_manager->ReadAll(); $this->editor->SetGrounds($o_ground_manager->GetItems()); unset($o_ground_manager); } } # Tournament or match not found is page not found if (!$this->match instanceof Match or $this->b_is_tournament) { http_response_code(404); $this->page_not_found = true; } }
protected function CreateControls() { $o_match = $this->GetDataObject(); if (is_null($o_match)) { $o_match = new Match($this->GetSettings()); } /* @var $o_match Match */ /* @var $o_team Team */ $b_got_home = !is_null($o_match->GetHomeTeam()); $b_got_away = !is_null($o_match->GetAwayTeam()); $b_is_new_match = !(bool) $o_match->GetId(); $b_is_tournament_match = false; if ($this->i_match_type == MatchType::TOURNAMENT_MATCH) { $b_is_tournament_match = $this->tournament instanceof Match; } else { if ($o_match->GetMatchType() == MatchType::TOURNAMENT_MATCH and $o_match->GetTournament() instanceof Match) { $this->SetTournament($o_match->GetTournament()); $this->SetMatchType($o_match->GetMatchType()); $b_is_tournament_match = true; } } $o_match_outer_1 = new XhtmlElement('div'); $o_match_outer_1->SetCssClass('MatchFixtureEdit'); $o_match_outer_1->AddCssClass($this->GetCssClass()); $this->SetCssClass(''); $o_match_outer_1->SetXhtmlId($this->GetNamingPrefix()); $o_match_outer_2 = new XhtmlElement('div'); $o_match_box = new XhtmlElement('div'); $this->AddControl($o_match_outer_1); $o_match_outer_1->AddControl($o_match_outer_2); $o_match_outer_2->AddControl($o_match_box); if ($this->GetShowHeading()) { $s_heading = str_replace('{0}', MatchType::Text($this->i_match_type), $this->GetHeading()); # Add match type if required $o_title_inner_1 = new XhtmlElement('span', htmlentities($s_heading, ENT_QUOTES, "UTF-8", false)); $o_title_inner_2 = new XhtmlElement('span', $o_title_inner_1); $o_title_inner_3 = new XhtmlElement('span', $o_title_inner_2); $o_match_box->AddControl(new XhtmlElement('h2', $o_title_inner_3, "medium large")); } # Offer choice of season if appropriate $season_count = $this->seasons->GetCount(); if ($season_count == 1 and $this->i_match_type != MatchType::PRACTICE) { $o_season_id = new TextBox($this->GetNamingPrefix() . 'Season', $this->seasons->GetFirst()->GetId()); $o_season_id->SetMode(TextBoxMode::Hidden()); $o_match_box->AddControl($o_season_id); } elseif ($season_count > 1 and $this->i_match_type != MatchType::PRACTICE) { $o_season_id = new XhtmlSelect($this->GetNamingPrefix() . 'Season', '', $this->IsValidSubmit()); foreach ($this->Seasons()->GetItems() as $season) { $o_season_id->AddControl(new XhtmlOption($season->GetCompetitionName(), $season->GetId())); } $o_match_box->AddControl(new FormPart('Competition', $o_season_id)); } # Start date and time $match_time_known = (bool) $o_match->GetStartTime(); if (!$match_time_known) { # if no date set, use specified default if ($this->i_default_time) { $o_match->SetStartTime($this->i_default_time); if ($b_is_tournament_match) { $o_match->SetIsStartTimeKnown(false); } } else { # if no date set and no default, default to today at 6.30pm BST $i_now = gmdate('U'); $o_match->SetStartTime(gmmktime(17, 30, 00, (int) gmdate('n', $i_now), (int) gmdate('d', $i_now), (int) gmdate('Y', $i_now))); } } $o_date = new DateControl($this->GetNamingPrefix() . 'Start', $o_match->GetStartTime(), $o_match->GetIsStartTimeKnown(), $this->IsValidSubmit()); $o_date->SetShowTime(true); $o_date->SetRequireTime(false); $o_date->SetMinuteInterval(5); # if no date set and only one season to choose from, limit available dates to the length of that season if (!$match_time_known and $season_count == 1) { if ($this->Seasons()->GetFirst()->GetStartYear() == $this->Seasons()->GetFirst()->GetEndYear()) { $i_mid_season = gmmktime(0, 0, 0, 6, 30, $this->Seasons()->GetFirst()->GetStartYear()); } else { $i_mid_season = gmmktime(0, 0, 0, 12, 31, $this->Seasons()->GetFirst()->GetStartYear()); } $season_dates = Season::SeasonDates($i_mid_season); $season_start_month = gmdate('n', $season_dates[0]); $season_end_month = gmdate('n', $season_dates[1]); if ($season_start_month) { $o_date->SetMonthStart($season_start_month); } if ($season_end_month) { $o_date->SetMonthEnd($season_end_month + 1); } // TODO: need a better way to handle this, allowing overlap. Shirley has indoor matches until early April. $season_start_year = $this->Seasons()->GetFirst()->GetStartYear(); $season_end_year = $this->Seasons()->GetFirst()->GetEndYear(); if ($season_start_year) { $o_date->SetYearStart($season_start_year); } if ($season_end_year) { $o_date->SetYearEnd($season_end_year); } } if ($b_is_tournament_match) { $o_date->SetShowDate(false); $o_date->SetShowTime(false); $o_match_box->AddControl($o_date); } else { $o_date_part = new FormPart('When?', $o_date); $o_date_part->SetIsFieldset(true); $o_match_box->AddControl($o_date_part); } # Who's playing? if ($this->i_match_type == MatchType::PRACTICE and isset($this->context_team)) { $home_id = new TextBox($this->GetNamingPrefix() . 'Home', $this->context_team->GetId()); $home_id->SetMode(TextBoxMode::Hidden()); $away_id = new TextBox($this->GetNamingPrefix() . 'Away', $this->context_team->GetId()); $away_id->SetMode(TextBoxMode::Hidden()); $o_match_box->AddControl($home_id); $o_match_box->AddControl($away_id); } else { $o_home_list = new XhtmlSelect($this->GetNamingPrefix() . 'Home'); $o_away_list = new XhtmlSelect($this->GetNamingPrefix() . 'Away'); $first_real_team_index = 0; if ($this->b_user_is_admin) { # Option of not specifying teams is currently admin-only # Value of 0 is important because PHP sees it as boolean negative, but it can be used as the indexer of an array in JavaScript $o_home_list->AddControl(new XhtmlOption("Don't know yet", '0')); $o_away_list->AddControl(new XhtmlOption("Don't know yet", '0')); $first_real_team_index = 1; } foreach ($this->a_teams as $group_name => $teams) { foreach ($teams as $o_team) { $home_option = new XhtmlOption($o_team->GetName(), $o_team->GetId()); if (is_string($group_name) and $group_name) { $home_option->SetGroupName($group_name); } $o_home_list->AddControl($home_option); $away_option = new XhtmlOption($o_team->GetName(), $o_team->GetId()); if (is_string($group_name) and $group_name) { $away_option->SetGroupName($group_name); } $o_away_list->AddControl($away_option); } } $o_home_part = new FormPart('Home team', $o_home_list); $o_away_part = new FormPart('Away team', $o_away_list); $o_match_box->AddControl($o_home_part); $o_match_box->AddControl($o_away_part); if ($b_got_home) { $o_home_list->SelectOption($o_match->GetHomeTeamId()); } if (!$b_got_home and $b_is_new_match) { // if no home team data, select the first team by default // unless editing a match, in which case it may be correct to have no teams (eg cup final) $o_home_list->SelectIndex($first_real_team_index); } if (!$b_got_away and $b_is_new_match) { // if no away team data, select the second team as the away team so that it's not the same as the first // unless editing a match, in which case it may be correct to have no teams (eg cup final). $o_away_list->SelectIndex($first_real_team_index + 1); // if there was a home team but not an away team, make sure we don't select the home team against itself if ($b_got_home and $o_away_list->GetSelectedValue() == (string) $o_match->GetHomeTeamId()) { $o_away_list->SelectIndex($first_real_team_index); } } else { if ($b_got_away) { $o_away_list->SelectOption($o_match->GetAwayTeamId()); } if (!$b_is_new_match) { # Note which away team was previously saved, even if it's "not known" - this is for JavaScript to know it shouldn't auto-change the away team $away_saved = new TextBox($this->GetNamingPrefix() . 'SavedAway', $o_match->GetAwayTeamId()); $away_saved->SetMode(TextBoxMode::Hidden()); $o_match_box->AddControl($away_saved); unset($away_saved); } } } # Where? # If tournament match, assume same ground as tournament. Otherwise ask the user for ground. if ($b_is_tournament_match) { $ground = new TextBox($this->GetNamingPrefix() . 'Ground', $this->tournament->GetGroundId() ? $this->tournament->GetGroundId() : $o_match->GetGroundId()); $ground->SetMode(TextBoxMode::Hidden()); $o_match_box->AddControl($ground); } else { $o_ground_list = new XhtmlSelect($this->GetNamingPrefix() . 'Ground'); $o_ground_list->AddControl(new XhtmlOption("Don't know", -1)); $o_ground_list->AddControl(new XhtmlOption('Not listed (type the address in the notes field)', -2)); # Promote home grounds for this season to the top of the list $a_home_ground_ids = array(); foreach ($this->a_teams as $teams) { foreach ($teams as $o_team) { $a_home_ground_ids[$o_team->GetId()] = $o_team->GetGround()->GetId(); } } $a_home_grounds = array(); $a_other_grounds = array(); /* @var $o_ground Ground */ foreach ($this->a_grounds as $o_ground) { if (array_search($o_ground->GetId(), $a_home_ground_ids) > -1) { $a_home_grounds[] = $o_ground; } else { $a_other_grounds[] = $o_ground; } } # Add home grounds foreach ($a_home_grounds as $o_ground) { $option = new XhtmlOption($o_ground->GetNameAndTown(), $o_ground->GetId()); $option->SetGroupName('Home grounds'); $o_ground_list->AddControl($option); } # Add away grounds foreach ($a_other_grounds as $o_ground) { $option = new XhtmlOption($o_ground->GetNameAndTown(), $o_ground->GetId()); $option->SetGroupName('Away grounds'); $o_ground_list->AddControl($option); } # Select ground if ($o_match->GetGroundId()) { $o_ground_list->SelectOption($o_match->GetGroundId()); } elseif ($this->i_match_type == MatchType::PRACTICE and isset($this->context_team)) { $o_ground_list->SelectOption($this->context_team->GetGround()->GetId()); } $o_ground_part = new FormPart('Where?', $o_ground_list); $o_match_box->AddControl($o_ground_part); # Note which grounds belong to which teams, for use by match-fixture-edit-control.js to select a ground when the home team is changed # Format is 1,2;2,3;4,5 # where ; separates each team, and for each team the first number identifies the team and the second is the ground $s_team_ground = ''; foreach ($a_home_ground_ids as $i_team => $i_ground) { if ($s_team_ground) { $s_team_ground .= ';'; } $s_team_ground .= $i_team . ',' . $i_ground; } $o_hidden = new TextBox($this->GetNamingPrefix() . 'TeamGround', $s_team_ground); $o_hidden->SetMode(TextBoxMode::Hidden()); $o_match_box->AddControl($o_hidden); unset($o_hidden); # Note which ground was previously saved - this is for JavaScript to know it shouldn't auto-change the ground if (!$b_is_new_match) { $o_hidden = new TextBox($this->GetNamingPrefix() . 'SavedGround', $o_match->GetGroundId()); $o_hidden->SetMode(TextBoxMode::Hidden()); $o_match_box->AddControl($o_hidden); unset($o_hidden); } } # Notes $o_notes = new TextBox($this->GetNamingPrefix() . 'Notes', $o_match->GetNotes()); $o_notes->SetMode(TextBoxMode::MultiLine()); $o_notes_part = new FormPart('Notes', $o_notes); $o_match_box->AddControl($o_notes_part); # Remember match type, tournament and short URL $o_type = new TextBox($this->GetNamingPrefix() . 'MatchType', $this->GetMatchType()); $o_type->SetMode(TextBoxMode::Hidden()); $o_match_box->AddControl($o_type); if ($b_is_tournament_match) { $tourn_box = new TextBox($this->GetNamingPrefix() . 'Tournament', $this->tournament->GetId()); $tourn_box->SetMode(TextBoxMode::Hidden()); $o_match_box->AddControl($tourn_box); } $o_short_url = new TextBox($this->GetNamingPrefix() . 'ShortUrl', $o_match->GetShortUrl()); $o_short_url->SetMode(TextBoxMode::Hidden()); $o_match_box->AddControl($o_short_url); # Note the context team - to be picked up by JavaScript to enable auto-changing of away team if # context team is not selected as home team if (isset($this->context_team)) { $context_team_box = new TextBox($this->GetNamingPrefix() . 'ContextTeam', $this->context_team->GetId()); $context_team_box->SetMode(TextBoxMode::Hidden()); $o_match_box->AddControl($context_team_box); } }
function OnPageLoad() { if (!$this->match instanceof Match) { echo new XhtmlElement('h1', ucfirst($this->match_or_tournament) . ' already deleted'); echo new XhtmlElement('p', "The " . $this->match_or_tournament . " you're trying to delete does not exist or has already been deleted."); return; } echo new XhtmlElement('h1', 'Delete ' . $this->match_or_tournament . ': <cite>' . htmlentities($this->match->GetTitle(), ENT_QUOTES, "UTF-8", false) . '</cite>'); if ($this->b_deleted) { ?> <p>The <?php echo $this->match_or_tournament; ?> has been deleted.</p> <?php if ($this->match->GetTournament() instanceof Match) { echo '<p><a href="' . htmlentities($this->match->GetTournament()->GetNavigateUrl(), ENT_QUOTES, "UTF-8", false) . '">Go to ' . htmlentities($this->match->GetTournament()->GetTitle(), ENT_QUOTES, "UTF-8", false) . '</a></p>'; } else { if ($this->match->Seasons()->GetCount()) { foreach ($this->match->Seasons() as $season) { echo '<p><a href="' . htmlentities($season->GetNavigateUrl(), ENT_QUOTES, "UTF-8", false) . '">Go to ' . htmlentities($season->GetCompetitionName(), ENT_QUOTES, "UTF-8", false) . '</a></p>'; } } else { echo '<p><a href="/matches/">View all matches</a></p>'; } } } else { $has_permission = (AuthenticationManager::GetUser()->Permissions()->HasPermission(PermissionType::MANAGE_MATCHES) or AuthenticationManager::GetUser()->GetId() == $this->match->GetAddedBy()->GetId()); if ($has_permission) { $s_detail = 'This is a ' . MatchType::Text($this->match->GetMatchType()); $s_detail .= $this->match->GetIsStartTimeKnown() ? ' starting at ' : ' on '; $s_detail .= $this->match->GetStartTimeFormatted() . '. '; $s_context = ''; if ($this->match->GetTournament() instanceof Match) { $s_context = "It's in the " . $this->match->GetTournament()->GetTitle(); } if ($this->match->Seasons()->GetCount()) { $season = $this->match->Seasons()->GetFirst(); $b_the = !(stristr($season->GetCompetitionName(), 'the ') === 0); $s_context .= $s_context ? ', in ' : 'It\'s in '; $s_context .= $b_the ? 'the ' : ''; if ($this->match->Seasons()->GetCount() == 1) { $s_context .= $season->GetCompetitionName() . '.'; } else { $s_context .= 'following seasons: '; } } $s_detail .= $s_context; echo new XhtmlElement('p', htmlentities($s_detail, ENT_QUOTES, "UTF-8", false)); if ($this->match->Seasons()->GetCount() > 1) { $seasons = new XhtmlElement('ul'); foreach ($this->match->Seasons() as $season) { $seasons->AddControl(new XhtmlElement('li', htmlentities($season->GetCompetitionName(), ENT_QUOTES, "UTF-8", false))); } echo $seasons; } if ($this->match->GetMatchType() == MatchType::TOURNAMENT) { ?> <p>Deleting a tournament cannot be undone.</p> <?php } else { ?> <p>Deleting a match cannot be undone. The match will be removed from all league tables and statistics.</p> <?php } ?> <p>Are you sure you want to delete this <?php echo $this->match_or_tournament; ?> ?</p> <form action="<?php echo htmlentities($this->match->GetDeleteNavigateUrl(), ENT_QUOTES, "UTF-8", false); ?> " method="post" class="deleteButtons"> <div> <input type="submit" value="Delete <?php echo $this->match_or_tournament; ?> " name="delete" /> <input type="submit" value="Cancel" name="cancel" /> </div> </form> <?php $this->AddSeparator(); require_once 'stoolball/user-edit-panel.class.php'; $panel = new UserEditPanel($this->GetSettings(), 'this ' . $this->match_or_tournament); $panel->AddLink('view this ' . $this->match_or_tournament, $this->match->GetNavigateUrl()); $panel->AddLink('edit this ' . $this->match_or_tournament, $this->match->GetEditNavigateUrl()); echo $panel; } else { ?> <p>Sorry, you can't delete a <?php echo $this->match_or_tournament; ?> unless you added it.</p> <p><a href="<?php echo htmlentities($this->match->GetNavigateUrl(), ENT_QUOTES, "UTF-8", false); ?> ">Go back to <?php echo $this->match_or_tournament; ?> </a></p> <?php } } }
protected function OnPreRender() { /* @var $o_home Team */ /* @var $o_away Team */ /* @var $o_tourney Match */ # Date and tournament $o_date_para = new XhtmlElement('p'); $o_date = new XhtmlElement('abbr', htmlentities($this->o_match->GetStartTimeFormatted(), ENT_QUOTES, "UTF-8", false)); $o_date->SetTitle(Date::Microformat($this->o_match->GetStartTime())); # hCalendar $o_date->SetCssClass('dtstart'); # hCalendar $o_date->AddAttribute("property", "schema:startDate"); $o_date->AddAttribute("datatype", "xsd:date"); $o_date->AddAttribute("content", Date::Microformat($this->o_match->GetStartTime())); $o_date_para->AddControl('When: '); $o_date_para->AddControl($o_date); # hCalendar end date if ($this->o_match->GetIsStartTimeKnown()) { $i_end_time = $this->o_match->GetStartTime() + 60 * 90; $o_hcal_end = new XhtmlElement('abbr', ' until around ' . htmlentities(Date::Time($i_end_time), ENT_QUOTES, "UTF-8", false)); $o_hcal_end->SetTitle(Date::Microformat($i_end_time)); $o_hcal_end->SetCssClass('metadata dtend'); $o_date_para->AddControl($o_hcal_end); } # If we know the time and place, show when the sun sets # TODO: Assumes UK if ($this->o_match->GetGround() instanceof Ground and $this->o_match->GetGround()->GetAddress()->GetLatitude() and $this->o_match->GetGround()->GetAddress()->GetLongitude()) { $o_date_para->AddControl(' <span class="sunset">sunset ' . htmlentities(Date::Time(date_sunset($this->o_match->GetStartTime(), SUNFUNCS_RET_TIMESTAMP, $this->o_match->GetGround()->GetAddress()->GetLatitude(), $this->o_match->GetGround()->GetAddress()->GetLongitude())), ENT_QUOTES, "UTF-8", false) . '</span>'); } # Display match type/season/tournament if ($this->o_match->GetMatchType() == MatchType::TOURNAMENT_MATCH) { $o_date_para->SetCssClass('description'); # hCal $o_tourney = $this->o_match->GetTournament(); if (is_object($o_tourney)) { $tournament_link = new XhtmlAnchor(htmlentities($o_tourney->GetTitle(), ENT_QUOTES, "UTF-8", false), $o_tourney->GetNavigateUrl()); $tournament_link->AddAttribute("typeof", "schema:SportsEvent"); $tournament_link->AddAttribute("about", $o_tourney->GetLinkedDataUri()); $tournament_link->AddAttribute("rel", "schema:url"); $tournament_link->AddAttribute("property", "schema:name"); $tournament_container = new XhtmlElement("span", $tournament_link); $tournament_container->AddAttribute("rel", "schema:superEvent"); # Check for 'the' to get the grammar right $s_title = strtolower($o_tourney->GetTitle()); if (strlen($s_title) >= 4 and substr($s_title, 0, 4) == 'the ') { $o_date_para->AddControl(', in '); } else { $o_date_para->AddControl(', in the '); } $o_date_para->AddControl($tournament_container); $o_date_para->AddControl('.'); } else { $o_date_para->AddControl(', in a tournament.'); } } else { # hCalendar desc, built up at the same time as the date and league/tournament $hcal_desc = new XhtmlElement('div', null, 'description'); $this->AddControl($hcal_desc); $s_detail_xhtml = ucfirst(MatchType::Text($this->o_match->GetMatchType())); $season_list_xhtml = null; if ($this->o_match->Seasons()->GetCount() == 1) { $season = $this->o_match->Seasons()->GetFirst(); $season_name = new XhtmlAnchor(htmlentities($season->GetCompetitionName(), ENT_QUOTES, "UTF-8", false), $season->GetNavigateUrl()); $b_the = !(stristr($season->GetCompetitionName(), 'the ') === 0); $s_detail_xhtml .= ' in ' . ($b_the ? 'the ' : '') . $season_name->__toString() . '.'; } elseif ($this->o_match->Seasons()->GetCount() > 1) { $s_detail_xhtml .= ' in the following seasons: '; $season_list_xhtml = new XhtmlElement('ul'); $seasons = $this->o_match->Seasons()->GetItems(); $total_seasons = count($seasons); for ($i = 0; $i < $total_seasons; $i++) { $season = $seasons[$i]; /* @var $season Season */ $season_name = new XhtmlAnchor(htmlentities($season->GetCompetitionName(), ENT_QUOTES, "UTF-8", false), $season->GetNavigateUrl()); $li = new XhtmlElement('li', $season_name); if ($i < $total_seasons - 2) { $li->AddControl(new XhtmlElement('span', ', ', 'metadata')); } else { if ($i < $total_seasons - 1) { $li->AddControl(new XhtmlElement('span', ' and ', 'metadata')); } } $season_list_xhtml->AddControl($li); } } else { $s_detail_xhtml .= '.'; } $hcal_desc->AddControl(new XhtmlElement('p', $s_detail_xhtml)); if (!is_null($season_list_xhtml)) { $hcal_desc->AddControl($season_list_xhtml); } } # Who $o_home = $this->o_match->GetHomeTeam(); $o_away = $this->o_match->GetAwayTeam(); $has_home = $o_home instanceof Team; $has_away = $o_away instanceof Team; if ($has_home or $has_away) { $who = new XhtmlElement("p", "Who: "); if ($has_home) { $who->AddControl($this->CreateTeamLink($o_home)); } if ($has_home and $has_away) { $who->AddControl(" and "); } if ($has_away) { $who->AddControl($this->CreateTeamLink($o_away)); } $this->AddControl($who); } # When $this->AddControl($o_date_para); # Ground $o_ground = $this->o_match->GetGround(); if (is_object($o_ground)) { $o_ground_link = new XhtmlElement('a', htmlentities($o_ground->GetNameAndTown(), ENT_QUOTES, "UTF-8", false)); $o_ground_link->AddAttribute('href', $o_ground->GetNavigateUrl()); $o_ground_link->SetCssClass('location'); # hCalendar $o_ground_link->AddAttribute("typeof", "schema:Place"); $o_ground_link->AddAttribute("about", $o_ground->GetLinkedDataUri()); $o_ground_link->AddAttribute("rel", "schema:url"); $o_ground_link->AddAttribute("property", "schema:name"); $o_ground_control = new XhtmlElement('p', 'Where: '); $o_ground_control->AddAttribute("rel", "schema:location"); $o_ground_control->AddControl($o_ground_link); $this->AddControl($o_ground_control); } # Add result $o_result = $this->o_match->Result(); $b_result_known = !$o_result->GetResultType() == MatchResult::UNKNOWN; $toss_known = !is_null($this->o_match->Result()->GetTossWonBy()); $b_batting_order_known = !is_null($this->o_match->Result()->GetHomeBattedFirst()); $has_scorecard_data = ($o_result->HomeBatting()->GetCount() or $o_result->HomeBowling()->GetCount() or $o_result->AwayBatting()->GetCount() or $o_result->AwayBowling()->GetCount() or $o_result->GetHomeRuns() or $o_result->GetHomeWickets() or $o_result->GetAwayRuns() or $o_result->GetAwayWickets()); $has_player_of_match = $this->o_match->Result()->GetPlayerOfTheMatch() instanceof Player and $this->o_match->Result()->GetPlayerOfTheMatch()->GetName(); $has_player_of_match_home = $this->o_match->Result()->GetPlayerOfTheMatchHome() instanceof Player and $this->o_match->Result()->GetPlayerOfTheMatchHome()->GetName(); $has_player_of_match_away = $this->o_match->Result()->GetPlayerOfTheMatchAway() instanceof Player and $this->o_match->Result()->GetPlayerOfTheMatchAway()->GetName(); if ($b_result_known or $b_batting_order_known or $has_scorecard_data) { # Put result in header, so long as we have something to put after it. Otherwise put the result after it. $result_header = "Result"; if ($b_result_known and ($b_batting_order_known or $has_scorecard_data)) { $result_header .= ": " . $this->o_match->GetResultDescription(); } $result_header = new XhtmlElement('h2', htmlentities($result_header, ENT_QUOTES, "UTF-8", false)); if ($has_scorecard_data) { $result_header->AddCssClass("hasScorecard"); } $this->AddControl($result_header); } if ($toss_known) { $toss_team = $this->o_match->Result()->GetTossWonBy() === TeamRole::Home() ? $this->o_match->GetHomeTeam() : $this->o_match->GetAwayTeam(); if ($toss_team instanceof Team) { $toss_text = $toss_team->GetName() . " won the toss"; if ($b_batting_order_known) { $chose_to = ($this->o_match->Result()->GetTossWonBy() === TeamRole::Home()) == $this->o_match->Result()->GetHomeBattedFirst() ? "bat" : "bowl"; $toss_text .= " and chose to " . $chose_to; } $this->AddControl("<p>" . Html::Encode($toss_text) . '.</p>'); } } # If at least one player recorded, create a container for the schema.org metadata if ($has_scorecard_data or $has_player_of_match or $has_player_of_match_home or $has_player_of_match_away) { $this->AddControl('<div rel="schema:performers">'); } if ($has_scorecard_data) { $this->CreateScorecard($this->o_match); } else { # Got to be just result and batting order now. Only include result if batting order's not there, otherwise result will already be in header. if ($b_result_known and !$b_batting_order_known) { $this->AddControl(new XhtmlElement('p', htmlentities($this->o_match->GetResultDescription(), ENT_QUOTES, "UTF-8", false) . '.')); } if ($b_batting_order_known) { $this->AddControl(new XhtmlElement('p', htmlentities(($this->o_match->Result()->GetHomeBattedFirst() ? $o_home->GetName() : $o_away->GetName()) . ' batted first.'), ENT_QUOTES, "UTF-8", false)); } } # Player of the match if ($has_player_of_match) { $player = $this->o_match->Result()->GetPlayerOfTheMatch(); $team = $player->Team()->GetId() == $o_home->GetId() ? $o_home->GetName() : $o_away->GetName(); $player_of_match = new XhtmlElement('p', 'Player of the match: <a property="schema:name" rel="schema:url" href="' . htmlentities($player->GetPlayerUrl(), ENT_QUOTES, "UTF-8", false) . '">' . htmlentities($player->GetName(), ENT_QUOTES, "UTF-8", false) . "</a> ({$team})"); $player_of_match->AddAttribute("typeof", "schema:Person"); $player_of_match->AddAttribute("about", $player->GetLinkedDataUri()); $this->AddControl($player_of_match); } if ($has_player_of_match_home) { $player = $this->o_match->Result()->GetPlayerOfTheMatchHome(); $player_of_match = new XhtmlElement('p', $o_home->GetName() . ' player of the match: <a property="schema:name" rel="schema:url" href="' . htmlentities($player->GetPlayerUrl(), ENT_QUOTES, "UTF-8", false) . '">' . htmlentities($player->GetName(), ENT_QUOTES, "UTF-8", false) . "</a>"); $player_of_match->AddAttribute("typeof", "schema:Person"); $player_of_match->AddAttribute("about", $player->GetLinkedDataUri()); $this->AddControl($player_of_match); } if ($has_player_of_match_away) { $player = $this->o_match->Result()->GetPlayerOfTheMatchAway(); $player_of_match = new XhtmlElement('p', $o_away->GetName() . ' player of the match: <a property="schema:name" rel="schema:url" href="' . htmlentities($player->GetPlayerUrl(), ENT_QUOTES, "UTF-8", false) . '">' . htmlentities($player->GetName(), ENT_QUOTES, "UTF-8", false) . "</a>"); $player_of_match->AddAttribute("typeof", "schema:Person"); $player_of_match->AddAttribute("about", $player->GetLinkedDataUri()); $this->AddControl($player_of_match); } # End container for the schema.org metadata if ($has_scorecard_data or $has_player_of_match or $has_player_of_match_home or $has_player_of_match_away) { $this->AddControl('</div>'); } # Add notes if ($this->o_match->GetNotes()) { $this->AddControl(new XhtmlElement('h2', 'Notes')); $s_notes = htmlentities($this->o_match->GetNotes(), ENT_QUOTES, "UTF-8", false); $s_notes = XhtmlMarkup::ApplyCharacterEntities($s_notes); require_once 'email/email-address-protector.class.php'; $protector = new EmailAddressProtector($this->o_settings); $s_notes = $protector->ApplyEmailProtection($s_notes, AuthenticationManager::GetUser()->IsSignedIn()); $s_notes = XhtmlMarkup::ApplyHeadings($s_notes); $s_notes = XhtmlMarkup::ApplyParagraphs($s_notes); $s_notes = XhtmlMarkup::ApplyLists($s_notes); $s_notes = XhtmlMarkup::ApplySimpleTags($s_notes); $s_notes = XhtmlMarkup::ApplyLinks($s_notes); if (strpos($s_notes, '<p>') > -1) { $this->AddControl($s_notes); } else { $this->AddControl(new XhtmlElement('p', $s_notes)); } } # hCalendar metadata $o_hcal_para = new XhtmlElement('p'); $o_hcal_para->SetCssClass('metadata'); $this->AddControl($o_hcal_para); # hCalendar timestamp $o_hcal_para->AddControl('Status: At '); $o_hcal_stamp = new XhtmlElement('abbr', htmlentities(Date::Time(gmdate('U')), ENT_QUOTES, "UTF-8", false)); $o_hcal_stamp->SetTitle(Date::Microformat()); $o_hcal_stamp->SetCssClass('dtstamp'); $o_hcal_para->AddControl($o_hcal_stamp); # hCalendar GUID $o_hcal_para->AddControl(' match '); $o_hcal_guid = new XhtmlElement('span', htmlentities($this->o_match->GetLinkedDataUri(), ENT_QUOTES, "UTF-8", false)); $o_hcal_guid->SetCssClass('uid'); $o_hcal_para->AddControl($o_hcal_guid); # work out hCalendar status $s_status = 'CONFIRMED'; switch ($this->o_match->Result()->GetResultType()) { case MatchResult::CANCELLED: case MatchResult::POSTPONED: case MatchResult::AWAY_WIN_BY_FORFEIT: case MatchResult::HOME_WIN_BY_FORFEIT: $s_status = 'CANCELLED'; } # hCalendar URL and status $o_hcal_para->AddControl(' is '); $o_hcal_url = new XhtmlAnchor($s_status, 'http://' . $_SERVER['HTTP_HOST'] . $this->o_match->GetNavigateUrl()); $o_hcal_url->SetCssClass('url status'); $o_hcal_para->AddControl($o_hcal_url); }
function OnPageLoad() { $is_tournament = $this->match->GetMatchType() == MatchType::TOURNAMENT; $class = $is_tournament ? "match" : "match vevent"; ?> <div class="$class" typeof="schema:SportsEvent" about="<?php echo Html::Encode($this->match->GetLinkedDataUri()); ?> "> <?php require_once 'xhtml/navigation/tabs.class.php'; $tabs = array('Summary' => ''); if ($is_tournament) { $tabs['Tournament statistics'] = $this->match->GetNavigateUrl() . '/statistics'; # Make sure the reader knows this is a tournament, and the player type $says_tournament = strpos(strtolower($this->match->GetTitle()), 'tournament') !== false; $player_type = PlayerType::Text($this->match->GetPlayerType()); $says_player_type = strpos(strtolower($this->match->GetTitle()), strtolower(rtrim($player_type, '\''))) !== false; $page_title = $this->match->GetTitle() . ", " . Date::BritishDate($this->match->GetStartTime(), false); if (!$says_tournament and !$says_player_type) { $page_title .= ' (' . $player_type . ' stoolball tournament)'; } else { if (!$says_tournament) { $page_title .= ' stoolball tournament'; } else { if (!$says_player_type) { $page_title .= ' (' . $player_type . ')'; } } } $heading = new XhtmlElement('h1', $page_title); $heading->AddAttribute("property", "schema:name"); echo $heading; } else { if ($this->match->GetMatchType() == MatchType::TOURNAMENT_MATCH) { $tabs['Match statistics'] = $this->match->GetNavigateUrl() . '/statistics'; $tabs['Tournament statistics'] = $this->match->GetTournament()->GetNavigateUrl() . '/statistics'; $page_title = $this->match->GetTitle() . " in the " . $this->match->GetTournament()->GetTitle(); } else { $tabs['Statistics'] = $this->match->GetNavigateUrl() . '/statistics'; $page_title = $this->match->GetTitle(); } $o_title = new XhtmlElement('h1', Html::Encode($page_title)); $o_title->AddAttribute("property", "schema:name"); # hCalendar $o_title->SetCssClass('summary'); $o_title_meta = new XhtmlElement('span', ' (stoolball)'); $o_title_meta->SetCssClass('metadata'); $o_title->AddControl($o_title_meta); if ($this->match->GetMatchType() !== MatchType::TOURNAMENT_MATCH) { $o_title->AddControl(", " . Date::BritishDate($this->match->GetStartTime(), false)); } echo $o_title; } echo new Tabs($tabs); ?> <div class="box tab-box"> <div class="dataFilter"></div> <div class="box-content"> <?php if ($is_tournament) { require_once 'stoolball/tournaments/tournament-control.class.php'; echo new TournamentControl($this->GetSettings(), $this->match); } else { require_once 'stoolball/matches/match-control.class.php'; echo new MatchControl($this->GetSettings(), $this->match); } $this->DisplayComments(); $this->ShowSocial(); ?> </div> </div> </div> <?php $this->AddSeparator(); # add/edit/delete options $user_is_admin = AuthenticationManager::GetUser()->Permissions()->HasPermission(PermissionType::MANAGE_MATCHES); $user_is_owner = AuthenticationManager::GetUser()->GetId() == $this->match->GetAddedBy()->GetId(); $panel = new UserEditPanel($this->GetSettings(), 'this match'); $panel->AddCssClass("with-tabs"); if ($user_is_admin or $user_is_owner) { $link_text = $is_tournament ? 'tournament' : 'match'; $panel->AddLink('edit this ' . $link_text, $this->match->GetEditNavigateUrl()); } else { if ($this->match->GetMatchType() != MatchType::PRACTICE and !$is_tournament) { $panel->AddLink('update result', $this->match->GetEditNavigateUrl()); } } if ($is_tournament) { $panel->AddCssClass("with-tabs"); if ($user_is_admin or $user_is_owner) { $panel->AddLink('add or remove teams', $this->match->EditTournamentTeamsUrl()); } $panel->AddLink('add or remove matches', $this->match->GetEditTournamentMatchesUrl()); if (count($this->match->GetMatchesInTournament())) { $panel->AddLink('update results', $this->match->GetNavigateUrl() . "/matches/results"); } } if ($user_is_admin or $user_is_owner) { if ($is_tournament) { $panel->AddLink('edit where to list this tournament', $this->match->EditTournamentCompetitionsUrl()); } $link_text = $is_tournament ? 'tournament' : 'match'; $panel->AddLink('delete this ' . $link_text, $this->match->GetDeleteNavigateUrl()); } if ($this->match->GetMatchType() != MatchType::TOURNAMENT_MATCH and $this->match->GetStartTime() > time()) { $link_text = $is_tournament ? 'tournament' : 'match'; $panel->AddLink("add {$link_text} to your calendar", $this->match->GetCalendarNavigateUrl()); } echo $panel; if ($this->has_player_stats) { $tournament = $is_tournament ? $this->match : $this->match->GetTournament(); require_once 'stoolball/statistics-highlight-table.class.php'; echo new StatisticsHighlightTable($this->best_batting, $this->most_runs, $this->best_bowling, $this->most_wickets, $this->most_catches, "tournament"); echo '<p class="playerSummaryMore"><a href="' . $tournament->GetNavigateUrl() . '/statistics">Tournament statistics</a></p>'; } }