本文整理汇总了PHP中Match::SetStartTime方法的典型用法代码示例。如果您正苦于以下问题:PHP Match::SetStartTime方法的具体用法?PHP Match::SetStartTime怎么用?PHP Match::SetStartTime使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Match
的用法示例。
在下文中一共展示了Match::SetStartTime方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: BuildPostedDataObject
/**
* Builds a match object containing the result information posted by the control
*
*/
public function BuildPostedDataObject()
{
$tournament = new Match($this->GetSettings());
$tournament->SetMatchType(MatchType::TOURNAMENT);
# Get match id
$s_key = $this->GetNamingPrefix() . 'item';
if (isset($_POST[$s_key])) {
$s_id = $_POST[$s_key];
if (strlen($s_id)) {
$tournament->SetId($s_id);
}
}
# Get the title
$s_key = $this->GetNamingPrefix() . 'Title';
if (isset($_POST[$s_key])) {
$tournament->SetTitle(strip_tags($_POST[$s_key]));
}
# Get the start date, because it's part of the title that has to be recreated for an internal postback
$s_key = $this->GetNamingPrefix() . 'Start';
if (isset($_POST[$s_key])) {
$tournament->SetStartTime($_POST[$s_key]);
}
# Matches - get from aggregated editor
$this->EnsureAggregatedEditors();
$matches = $this->matches_editor->DataObjects()->GetItems();
foreach ($matches as $match) {
$tournament->AddMatchInTournament($match);
}
$this->SetDataObject($tournament);
}
开发者ID:stoolball-england,项目名称:stoolball-england-website,代码行数:34,代码来源:tournament-matches-control.class.php
示例2: BuildPostedDataObject
/**
* @return void
* @desc Re-build from data posted by this control the data object this control is editing
*/
function BuildPostedDataObject()
{
$match = new Match($this->GetSettings());
$match->SetId($this->GetDataObjectId());
# Get match date
$s_key = $this->GetNamingPrefix() . 'Date';
if (isset($_POST[$s_key]) and strlen($_POST[$s_key]) and is_numeric($_POST[$s_key])) {
$match->SetStartTime($_POST[$s_key]);
}
# Get team names
$s_key = $this->GetNamingPrefix() . 'Home';
if (isset($_POST[$s_key])) {
$team_data = explode(MatchHighlightsEditControl::DATA_SEPARATOR, $_POST[$s_key], 2);
if (count($team_data) == 2) {
$o_home = new Team($this->GetSettings());
$o_home->SetId($team_data[0]);
$o_home->SetName($team_data[1]);
$match->SetHomeTeam($o_home);
}
}
$s_key = $this->GetNamingPrefix() . 'Away';
if (isset($_POST[$s_key])) {
$team_data = explode(MatchHighlightsEditControl::DATA_SEPARATOR, $_POST[$s_key], 2);
if (count($team_data) == 2) {
$o_away = new Team($this->GetSettings());
$o_away->SetId($team_data[0]);
$o_away->SetName($team_data[1]);
$match->SetAwayTeam($o_away);
}
}
# Get the result
$s_key = $this->GetNamingPrefix() . 'Result';
if (isset($_POST[$s_key])) {
$s_result = $_POST[$s_key];
if (strlen($s_result)) {
$match->Result()->SetResultType($s_result);
}
}
# Get players of the match. Fields to use depend on which radio button was selected.
$s_key = $this->GetNamingPrefix() . 'POM';
if (isset($_POST[$s_key])) {
$pom_type = (int) $_POST[$s_key];
if ($pom_type == MatchHighlightsEditControl::PLAYER_OF_THE_MATCH_OVERALL) {
$s_key = $this->GetNamingPrefix() . 'Player';
if (isset($_POST[$s_key]) and $_POST[$s_key]) {
$player = new Player($this->GetSettings());
$player->SetName($_POST[$s_key]);
$s_key = $this->GetNamingPrefix() . 'PlayerTeam';
if (isset($_POST[$s_key])) {
$player->Team()->SetId($_POST[$s_key]);
}
$match->Result()->SetPlayerOfTheMatch($player);
}
} else {
if ($pom_type == MatchHighlightsEditControl::PLAYER_OF_THE_MATCH_HOME_AND_AWAY) {
$s_key = $this->GetNamingPrefix() . 'PlayerHome';
if (isset($_POST[$s_key]) and $_POST[$s_key]) {
$player = new Player($this->GetSettings());
$player->SetName($_POST[$s_key]);
$player->Team()->SetId($match->GetHomeTeamId());
$match->Result()->SetPlayerOfTheMatchHome($player);
}
$s_key = $this->GetNamingPrefix() . 'PlayerAway';
if (isset($_POST[$s_key]) and $_POST[$s_key]) {
$player = new Player($this->GetSettings());
$player->SetName($_POST[$s_key]);
$player->Team()->SetId($match->GetAwayTeamId());
$match->Result()->SetPlayerOfTheMatchAway($player);
}
}
}
}
$s_key = $this->GetNamingPrefix() . 'Comments';
if (isset($_POST[$s_key])) {
$match->SetNewComment($_POST[$s_key]);
}
$this->SetDataObject($match);
}
开发者ID:stoolball-england,项目名称:stoolball-england-website,代码行数:82,代码来源:match-highlights-edit-control.class.php
示例3: UpdateMatchUrl
private function UpdateMatchUrl(Match $match, $user_is_match_admin)
{
# Ensure we have the correct details to generate a short URL.
# Particularly important for tournament matches where this may have been updated from the tournament.
$sql = "SELECT start_time FROM nsa_match WHERE match_id = " . Sql::ProtectNumeric($match->GetId(), false);
$result = $this->GetDataConnection()->query($sql);
$row = $result->fetch();
if ($row) {
$match->SetStartTime($row->start_time);
}
# URL generation scenarios
# 1. New match added by public - generate short URL
# 2. Match updated by public - regenerate allowing current url to be kept
# 3. Match added or updated by admin - if blank or generation requested, regenerate allowing current url to be kept, otherwise keep
$new_short_url = null;
if (!$user_is_match_admin or $user_is_match_admin and (!$match->GetShortUrl() or !$match->GetUseCustomShortUrl())) {
# Set up short URL manager
require_once 'http/short-url-manager.class.php';
$url_manager = new ShortUrlManager($this->GetSettings(), $this->GetDataConnection());
$new_short_url = $url_manager->EnsureShortUrl($match, true);
}
# Save the URL for the match, and copy to match statistics
$sql = "UPDATE nsa_match SET\r\n short_url = " . Sql::ProtectString($this->GetDataConnection(), $match->GetShortUrl()) . "\r\n WHERE match_id = " . Sql::ProtectNumeric($match->GetId());
$this->LoggedQuery($sql);
$sql = "UPDATE nsa_player_match SET\r\n match_url = " . Sql::ProtectString($this->GetDataConnection(), $match->GetShortUrl()) . "\r\n WHERE match_id = " . Sql::ProtectNumeric($match->GetId());
$this->GetDataConnection()->query($sql);
# Regenerate short URLs, but check whether manager exists because might've been denied permission above
# and in that same case we do NOT want to regenerate short URLs
if (isset($url_manager)) {
if (is_object($new_short_url)) {
$new_short_url->SetParameterValuesFromObject($match);
$url_manager->Save($new_short_url);
}
unset($url_manager);
}
}
示例4: CreateFixtureControls
//.........这里部分代码省略.........
}
if ($match->GetIsMaximumPlayersPerTeamKnown()) {
$per_side_box->SelectOption($match->GetMaximumPlayersPerTeam());
} else {
if (!$match->GetId()) {
# Use eight as sensible default for new tournaments
$per_side_box->SelectOption(8);
}
}
$players_per_team = new XhtmlElement("label", $per_side_box);
$players_per_team->AddAttribute("for", $this->GetNamingPrefix() . "Players");
$players_per_team->AddControl(" players per team");
$players_part = new FormPart("How many players?", $players_per_team);
$players_part->AddCssClass("playersPerTeam");
$match_box->AddControl($players_part);
# Overs
$overs_box = new XhtmlSelect($this->GetNamingPrefix() . "Overs", null, $this->IsValid());
$overs_box->SetBlankFirst(true);
for ($i = 2; $i <= 8; $i++) {
$overs_box->AddControl(new XhtmlOption($i));
}
if ($match->GetIsOversKnown()) {
$overs_box->SelectOption($match->GetOvers());
}
$overs_label = new XhtmlElement("label", "Overs per innings");
$overs_label->AddAttribute("for", $overs_box->GetXhtmlId());
$overs_part = new FormPart($overs_label, new XhtmlElement("div", $overs_box));
$overs_part->AddCssClass("overs");
$match_box->AddControl($overs_part);
# Start date and time
if (!$match->GetStartTime()) {
# if no date set, use specified default
if ($this->i_default_time) {
$match->SetStartTime($this->i_default_time);
} else {
# if no date set and no default, default to today at 10.30am BST
# NOTE that if this is a new tournament in an old season, this date won't be selected because the available
# dates will be limited below and won't include today. It'll be the same day in the relevant year though.
$i_now = gmdate('U');
$match->SetStartTime(gmmktime(9, 30, 00, (int) gmdate('n', $i_now), (int) gmdate('d', $i_now), (int) gmdate('Y', $i_now)));
$match->SetIsStartTimeKnown(true);
}
}
$o_date = new DateControl($this->GetNamingPrefix() . 'Start', $match->GetStartTime(), $match->GetIsStartTimeKnown(), $this->IsValidSubmit());
$o_date->SetShowTime(true);
$o_date->SetRequireTime(false);
$o_date->SetMinuteInterval(5);
# if only one season to choose from, limit available dates to the length of that season
if ($this->context_season instanceof Season) {
if ($this->context_season->GetStartYear() == $this->context_season->GetEndYear()) {
$i_mid_season = gmmktime(0, 0, 0, 6, 30, $this->context_season->GetStartYear());
} else {
$i_mid_season = gmmktime(0, 0, 0, 12, 31, $this->context_season->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);
}
$season_start_year = $this->context_season->GetStartYear();
$season_end_year = $this->context_season->GetEndYear();
if ($season_start_year) {
开发者ID:stoolball-england,项目名称:stoolball-england-website,代码行数:67,代码来源:tournament-edit-control.class.php
示例5: BuildPostedDataObject
/**
* Builds a match object containing the result information posted by the control
*
*/
public function BuildPostedDataObject()
{
$o_match = new Match($this->GetSettings());
$o_match->SetId($this->GetDataObjectId());
# Get match date
$s_key = $this->GetNamingPrefix() . 'Date';
if (isset($_POST[$s_key]) and strlen($_POST[$s_key]) and is_numeric($_POST[$s_key])) {
$o_match->SetStartTime($_POST[$s_key]);
}
# Get team names
$s_key = $this->GetNamingPrefix() . 'Home';
if (isset($_POST[$s_key])) {
$team_data = explode(";", $_POST[$s_key], 2);
if (count($team_data) == 2) {
$o_home = new Team($this->GetSettings());
$o_home->SetId($team_data[0]);
$o_home->SetName($team_data[1]);
$o_match->SetHomeTeam($o_home);
}
}
$s_key = $this->GetNamingPrefix() . 'Away';
if (isset($_POST[$s_key])) {
$team_data = explode(";", $_POST[$s_key], 2);
if (count($team_data) == 2) {
$o_away = new Team($this->GetSettings());
$o_away->SetId($team_data[0]);
$o_away->SetName($team_data[1]);
$o_match->SetAwayTeam($o_away);
}
}
# Get who batted first
$s_key = $this->GetNamingPrefix() . 'BatFirst';
if (isset($_POST[$s_key])) {
$s_batted = $_POST[$s_key];
if ($s_batted == 'home') {
$o_match->Result()->SetHomeBattedFirst(true);
} else {
if ($s_batted == 'away') {
$o_match->Result()->SetHomeBattedFirst(false);
}
}
}
# Get the result
$s_key = $this->GetNamingPrefix() . 'Result';
if (isset($_POST[$s_key])) {
$s_result = $_POST[$s_key];
if (strlen($s_result)) {
$o_match->Result()->SetResultType($s_result);
}
}
# Get the home score
$s_key = $this->GetNamingPrefix() . 'HomeRuns';
if (isset($_POST[$s_key])) {
$s_home_runs = $_POST[$s_key];
if (strlen($s_home_runs)) {
$o_match->Result()->SetHomeRuns($s_home_runs);
}
}
$s_key = $this->GetNamingPrefix() . 'HomeWickets';
if (isset($_POST[$s_key])) {
$s_home_wickets = $_POST[$s_key];
if (strlen($s_home_wickets)) {
$o_match->Result()->SetHomeWickets($s_home_wickets);
}
}
# Get the away score
$s_key = $this->GetNamingPrefix() . 'AwayRuns';
if (isset($_POST[$s_key])) {
$s_away_runs = $_POST[$s_key];
if (strlen($s_away_runs)) {
$o_match->Result()->SetAwayRuns($s_away_runs);
}
}
$s_key = $this->GetNamingPrefix() . 'AwayWickets';
if (isset($_POST[$s_key])) {
$s_away_wickets = $_POST[$s_key];
if (strlen($s_away_wickets)) {
$o_match->Result()->SetAwayWickets($s_away_wickets);
}
}
$s_key = $this->GetNamingPrefix() . 'Comments';
if (isset($_POST[$s_key])) {
$o_match->SetNewComment($_POST[$s_key]);
}
$this->SetDataObject($o_match);
}
开发者ID:stoolball-england,项目名称:stoolball-england-website,代码行数:90,代码来源:match-result-edit-control.class.php
示例6: CreateControls
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);
//.........这里部分代码省略.........
开发者ID:stoolball-england,项目名称:stoolball-england-website,代码行数:101,代码来源:match-fixture-edit-control.class.php
示例7: OnLoadPageData
public function OnLoadPageData()
{
# Now get statistics for the player
$filter_by_player = array($this->player->GetId());
$statistics_manager = new StatisticsManager($this->GetSettings(), $this->GetDataConnection());
$statistics_manager->FilterByPlayer($filter_by_player);
# Apply filters common to all statistics
StatisticsFilter::SupportMatchTypeFilter($statistics_manager);
StatisticsFilter::SupportOppositionFilter($statistics_manager);
StatisticsFilter::SupportCompetitionFilter($statistics_manager);
StatisticsFilter::ApplySeasonFilter($this->GetSettings(), $this->GetDataConnection(), $statistics_manager);
StatisticsFilter::SupportGroundFilter($statistics_manager);
StatisticsFilter::SupportDateFilter($statistics_manager);
StatisticsFilter::SupportBattingPositionFilter($statistics_manager);
StatisticsFilter::SupportInningsFilter($statistics_manager);
StatisticsFilter::SupportMatchResultFilter($statistics_manager);
# Now get the statistics for the player
$this->player = new Player($this->GetSettings());
$data = $statistics_manager->ReadBestBowlingPerformance(true);
foreach ($data as $performance) {
# Not useful for either average or economy
if (is_null($performance["runs_conceded"])) {
continue;
}
$bowling = new Bowling($this->player);
$bowling->SetWickets($performance["wickets"]);
$bowling->SetRunsConceded($performance["runs_conceded"]);
$bowling->SetOvers($performance["overs"]);
$match = new Match($this->GetSettings());
$match->SetStartTime($performance["match_time"]);
$bowling->SetMatch($match);
$this->player->Bowling()->Add($bowling);
}
$statistics_manager->FilterByPlayer(null);
$statistics_manager->FilterByBowler($filter_by_player);
$statistics_manager->FilterByHowOut(array(Batting::BODY_BEFORE_WICKET, Batting::BOWLED, Batting::CAUGHT, Batting::CAUGHT_AND_BOWLED, Batting::HIT_BALL_TWICE));
$this->player->SetHowWicketsTaken($statistics_manager->ReadHowWicketsFall());
unset($statistics_manager);
# How dismissed
?>
{
<?php
if ($this->player->Bowling()->GetCount()) {
?>
"economy": {
"labels": [<?php
echo $this->BuildBowlingTimeline($this->player->Bowling()->GetItems());
?>
],
"datasets": [
{
"label": "Economy in each match",
"data": [<?php
echo $this->BuildMatchEconomyData($this->player->Bowling()->GetItems());
?>
]
},
{
"label": "Economy overall",
"data": [<?php
echo $this->BuildEconomyData($this->player->Bowling()->GetItems());
?>
]
}
]
},
"bowlingAverage": {
"labels": [<?php
echo $this->BuildBowlingTimeline($this->player->Bowling()->GetItems());
?>
],
"datasets": [
{
"label": "Average in each match",
"data": [<?php
echo $this->BuildMatchBowlingAverageData($this->player->Bowling()->GetItems());
?>
]
},
{
"label": "Average overall",
"data": [<?php
echo $this->BuildBowlingAverageData($this->player->Bowling()->GetItems());
?>
]
}
]
},
<?php
}
?>
"wickets": [
<?php
$how_out = $this->player->GetHowWicketsTaken();
$len = count($how_out);
$count = 0;
foreach ($how_out as $key => $value) {
$label = ucfirst(html_entity_decode(Batting::Text($key)));
echo '{ "label":"' . $label . '","value":' . $value . "}";
$count++;
//.........这里部分代码省略.........
示例8: BuildItems
/**
* Populates the collection of business objects from raw data
*
* @return bool
* @param MySqlRawData $o_result
*/
protected function BuildItems(MySqlRawData $o_result)
{
$this->Clear();
$o_match_builder = new CollectionBuilder();
$o_team_builder = new CollectionBuilder();
while ($o_row = $o_result->fetch()) {
if (!$o_match_builder->IsDone($o_row->match_id)) {
if (isset($o_match)) {
$this->Add($o_match);
$o_team_builder->Reset();
}
# create new
$o_match = new Match($this->GetSettings());
$o_match->SetId($o_row->match_id);
if (isset($o_row->start_time)) {
$o_match->SetStartTime($o_row->start_time);
}
if (isset($o_row->home_runs)) {
$o_match->Result()->SetHomeRuns($o_row->home_runs);
}
if (isset($o_row->away_runs)) {
$o_match->Result()->SetAwayRuns($o_row->away_runs);
}
if (isset($o_row->match_result_id)) {
$o_match->Result()->SetResultType($o_row->match_result_id);
}
if (isset($o_row->home_team_id) and !is_null($o_row->home_team_id)) {
$o_home = new Team($this->o_settings);
$o_home->SetId($o_row->home_team_id);
if (isset($o_row->home_team_name)) {
$o_home->SetName($o_row->home_team_name);
}
if (isset($o_row->home_short_url)) {
$o_home->SetShortUrl($o_row->home_short_url);
}
$o_match->SetHomeTeam($o_home);
unset($o_home);
}
if (isset($o_row->ground_id)) {
$o_ground = new Ground($this->GetSettings());
$o_ground->SetId($o_row->ground_id);
$o_match->SetGround($o_ground);
unset($o_ground);
}
}
# Add away teams
if (isset($o_row->away_team_id) && !$o_team_builder->IsDone($o_row->away_team_id)) {
$o_away = new Team($this->o_settings);
$o_away->SetId($o_row->away_team_id);
if (isset($o_row->away_team_name)) {
$o_away->SetName($o_row->away_team_name);
}
if (isset($o_row->away_short_url)) {
$o_away->SetShortUrl($o_row->away_short_url);
}
$o_match->AddAwayTeam($o_away);
unset($o_away);
}
}
# Add final match
if (isset($o_match)) {
$this->Add($o_match);
}
return true;
}
示例9: OnLoadPageData
public function OnLoadPageData()
{
# Now get statistics for the player
$filter_by_player = array($this->player->GetId());
$statistics_manager = new StatisticsManager($this->GetSettings(), $this->GetDataConnection());
$statistics_manager->FilterByPlayer($filter_by_player);
# Apply filters common to all statistics
StatisticsFilter::SupportMatchTypeFilter($statistics_manager);
StatisticsFilter::SupportOppositionFilter($statistics_manager);
StatisticsFilter::SupportCompetitionFilter($statistics_manager);
StatisticsFilter::ApplySeasonFilter($this->GetSettings(), $this->GetDataConnection(), $statistics_manager);
StatisticsFilter::SupportGroundFilter($statistics_manager);
StatisticsFilter::SupportDateFilter($statistics_manager);
StatisticsFilter::SupportBattingPositionFilter($statistics_manager);
StatisticsFilter::SupportInningsFilter($statistics_manager);
StatisticsFilter::SupportMatchResultFilter($statistics_manager);
# Now get the statistics for the player
$this->player = new Player($this->GetSettings());
$data = $statistics_manager->ReadBestBattingPerformance(false, true);
foreach ($data as $performance) {
$batting = new Batting($this->player, $performance["how_out"], null, null, $performance["runs_scored"]);
$match = new Match($this->GetSettings());
$match->SetStartTime($performance["match_time"]);
$batting->SetMatch($match);
$this->player->Batting()->Add($batting);
}
unset($statistics_manager);
# How dismissed
?>
{
<?php
$score_spread = $this->player->ScoreSpread();
if (is_array($score_spread)) {
?>
"scoreSpread": {
"labels": [
<?php
$len = count($score_spread);
$count = 0;
foreach ($score_spread as $key => $value) {
echo '"' . $key . '"';
$count++;
if ($count < $len) {
echo ',';
}
}
?>
],
"datasets": [
{
"label": "Not out",
"data": [
<?php
$len = count($score_spread);
$count = 0;
foreach ($score_spread as $key => $value) {
echo $value["not-out"];
$count++;
if ($count < $len) {
echo ',';
}
}
?>
]
},
{
"label": "Out",
"data": [
<?php
$len = count($score_spread);
$count = 0;
foreach ($score_spread as $key => $value) {
echo $value["out"];
$count++;
if ($count < $len) {
echo ',';
}
}
?>
]
}
]
},
<?php
}
if ($this->player->Batting()->GetCount()) {
?>
"battingForm": {
"labels": [<?php
echo $this->BuildBattingTimeline($this->player->Batting()->GetItems());
?>
],
"datasets": [
{
"label": "Scores",
"data": [<?php
echo $this->BuildScoresData($this->player->Batting()->GetItems());
?>
]
//.........这里部分代码省略.........