本文整理汇总了PHP中Match::GetIsStartTimeKnown方法的典型用法代码示例。如果您正苦于以下问题:PHP Match::GetIsStartTimeKnown方法的具体用法?PHP Match::GetIsStartTimeKnown怎么用?PHP Match::GetIsStartTimeKnown使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Match
的用法示例。
在下文中一共展示了Match::GetIsStartTimeKnown方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: CreateFixtureControls
//.........这里部分代码省略.........
$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) {
$o_date->SetYearStart($season_start_year);
}
if ($season_end_year) {
$o_date->SetYearEnd($season_end_year);
}
}
$o_date_part = new FormPart('When?', $o_date);
$o_date_part->SetIsFieldset(true);
$match_box->AddControl($o_date_part);
# Where?
开发者ID:stoolball-england,项目名称:stoolball-england-website,代码行数:67,代码来源:tournament-edit-control.class.php
示例2: GetDuplicateFixture
/**
* Checks whether the given match fixture data is already in the database; returns the duplicate match or null
*
* @param Match $match_to_compare
* @param bool $b_user_is_match_admin
* @return Match
*/
private function GetDuplicateFixture(Match $match_to_compare, $b_user_is_match_admin)
{
# Make sure it's not a duplicate. If it is, return the duplicate match.
$is_duplicate = false;
$is_new_match = !(bool) $match_to_compare->GetId();
$id_of_duplicate = null;
$s_match = $this->GetSettings()->GetTable('Match');
$s_mt = $this->GetSettings()->GetTable('MatchTeam');
$i_tournament = is_null($match_to_compare->GetTournament()) ? null : $match_to_compare->GetTournament()->GetId();
$i_ground = $match_to_compare->GetGroundId() > 0 ? $match_to_compare->GetGroundId() : null;
$s_sql = "SELECT {$s_match}.match_id FROM {$s_match} INNER JOIN {$s_mt} ON {$s_match}.match_id = {$s_mt}.match_id AND {$s_mt}.team_role = " . TeamRole::Home();
$s_where = $this->SqlAddCondition('', 'tournament_match_id' . Sql::ProtectNumeric($i_tournament, true, true));
$s_where = $this->SqlAddCondition($s_where, 'ground_id' . Sql::ProtectNumeric($i_ground, true, true));
$s_where = $this->SqlAddCondition($s_where, 'start_time = ' . Sql::ProtectNumeric($match_to_compare->GetStartTime()));
$s_where = $this->SqlAddCondition($s_where, 'start_time_known = ' . Sql::ProtectBool($match_to_compare->GetIsStartTimeKnown()));
$s_where = $this->SqlAddCondition($s_where, 'match_notes = ' . Sql::ProtectString($this->GetDataConnection(), $match_to_compare->GetNotes()));
$s_where = $this->SqlAddCondition($s_where, "{$s_mt}.team_id" . Sql::ProtectNumeric($match_to_compare->GetHomeTeamId(), true, true));
# If it's a new match we want to check that it's not a duplicate match type of one already added.
# If it's an updated match only an admin can change that. If not an admin, data's not even available so don't compare.
if ($is_new_match or $b_user_is_match_admin) {
$s_where = $this->SqlAddCondition($s_where, 'match_type = ' . Sql::ProtectNumeric($match_to_compare->GetMatchType()));
}
# If it's a tournament the player type should be specified by the user so check whether it's changed.
# For any other match it's inferred automatically from other metadata about the match as it's saved,
# and we're already checking whether that other data has changed so don't check for player type.
if ($match_to_compare->GetMatchType() == MatchType::TOURNAMENT) {
$s_where = $this->SqlAddCondition($s_where, 'player_type_id' . Sql::ProtectNumeric($match_to_compare->GetPlayerType(), true, true));
}
# If there's an id we're comparing whether the existing match has changed.
# If no id we're looking whether the match has already been added, probably by someone else.
if (!$is_new_match) {
$s_where = $this->SqlAddCondition($s_where, "{$s_match}.match_id" . Sql::ProtectNumeric($match_to_compare->GetId(), false, true));
# Only compare title properties for an update to a match, not for a match being added. If a new match is being added
# the same match may exist with a different title because a result has been filled in - we still want to treat that as
# a duplicate and not add the new match. But if the match is being updated it can only come from the match editing screen,
# where the existing title is visible. The title may have changed due to an updated result, but OK to treat this as a changed
# fixture in that event - an email about the match update is going to be sent and the match marked as updated anyway, so no problem.
$s_where = $this->SqlAddCondition($s_where, 'match_title = ' . Sql::ProtectString($this->GetDataConnection(), $match_to_compare->GetTitle(), false));
$s_where = $this->SqlAddCondition($s_where, 'custom_title' . Sql::ProtectBool($match_to_compare->GetUseCustomTitle(), false, true));
# A new match would have either no or a newly-generated short URL, which inevitably would be different from the existing match
# had it already been entered. But if we're updating the match the short URL may have been changed deliberately and we want to
# recognise that change, not throw it away as a duplicate.
$s_where = $this->SqlAddCondition($s_where, 'short_url = ' . Sql::ProtectString($this->GetDataConnection(), $match_to_compare->GetShortUrl(), false));
}
$s_sql = $this->SqlAddWhereClause($s_sql, $s_where);
$result = $this->GetDataConnection()->query($s_sql);
if ($o_row = $result->fetch()) {
$id_of_duplicate = $o_row->match_id;
# if it's a new match, this gives info on the match as it already exists
$is_duplicate = true;
}
$result->closeCursor();
# If basic match details appear to be a duplicate, does it have the same away team(s) too?
if ($is_duplicate) {
$s_sql = "SELECT team_id FROM {$s_mt} WHERE match_id = " . Sql::ProtectNumeric($id_of_duplicate) . " AND team_role = " . TeamRole::Away();
$result = $this->GetDataConnection()->query($s_sql);
$existing_away_team_ids = array();
while ($row = $result->fetch()) {
$existing_away_team_ids[] = (int) $row->team_id;
}
$result->closeCursor();
if (count($existing_away_team_ids) != count($match_to_compare->GetAwayTeams())) {
# Different number of teams...
$is_duplicate = false;
}
# Same number of away teams... now are those away teams the same ones as in the match we're comparing?
if ($is_duplicate) {
foreach ($match_to_compare->GetAwayTeams() as $team) {
/* @var $team Team */
if (!in_array($team->GetId(), $existing_away_team_ids, true)) {
$is_duplicate = false;
break;
}
}
}
}
# If basic match details and away teams appear to be a duplicate, does it have the same season(s) too?
if ($is_duplicate) {
# 1. If the user isn't admin and is updating match, don't check. They're not allowed to change season data so it's not even available.
# 2. If the user isn't admin and it's a new match, is the existing match in the given season - don't care if it's in others too
# 3. If the user is an admin, we want to look for an exact match
if ($b_user_is_match_admin or $is_new_match) {
$s_sql = "SELECT season_id FROM " . $this->GetSettings()->GetTable('SeasonMatch') . " WHERE match_id = " . Sql::ProtectNumeric($id_of_duplicate);
$result = $this->GetDataConnection()->query($s_sql);
$existing_season_ids = array();
while ($row = $result->fetch()) {
$existing_season_ids[] = (int) $row->season_id;
}
$result->closeCursor();
if (count($existing_season_ids) == $match_to_compare->Seasons()->GetCount() or !$b_user_is_match_admin and $is_new_match) {
# Same number of seasons...
} else {
# Different number of seasons...
//.........这里部分代码省略.........
示例3: 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
示例4: AddMetadata
private function AddMetadata(Match $match, XhtmlElement $li)
{
$li->AddCssClass('vevent');
# hCalendar
$li->AddAttribute("typeof", "schema:SportsEvent");
$li->AddAttribute("about", $match->GetLinkedDataUri());
$meta = new XhtmlElement('span');
$meta->SetCssClass('metadata');
# hCalendar end date
if ($match->GetStartTime() and $match->GetIsStartTimeKnown()) {
$end_date = $this->CreateEndDate($match);
$meta->AddControl($end_date);
}
# hCalendar location
if (!is_null($match->GetGround())) {
$ground = new XhtmlElement('span', htmlentities($match->GetGround()->GetNameAndTown(), ENT_QUOTES, "UTF-8", false));
$ground->SetCssClass('location');
$meta->AddControl(' at ');
$meta->AddControl($ground);
}
# hCalendar description
$hcal_desc = new XhtmlElement('span');
$hcal_desc->SetCssClass('description');
$i_seasons = $match->Seasons()->GetCount();
if ($i_seasons) {
$meta->AddControl(' in ');
$seasons = $match->Seasons()->GetItems();
for ($i = 0; $i < $i_seasons; $i++) {
$b_last = ($i > 0 and $i == $i_seasons - 1);
if ($i > 0 and !$b_last) {
$hcal_desc->AddControl(', ');
} elseif ($b_last) {
$hcal_desc->AddControl(' and ');
}
$hcal_desc->AddControl(htmlentities($seasons[$i]->GetCompetitionName(), ENT_QUOTES, "UTF-8", false));
}
}
if (!$match->GetIsStartTimeKnown()) {
$hcal_desc->AddControl('. Start time not known');
}
if ($hcal_desc->CountControls()) {
$meta->AddControl($hcal_desc);
}
# hCalendar timestamp
$meta->AddControl('. At ');
$hcal_stamp = new XhtmlElement('abbr', htmlentities(Date::Time(gmdate('U')), ENT_QUOTES, "UTF-8", false));
$hcal_stamp->SetTitle(Date::Microformat());
$hcal_stamp->SetCssClass('dtstamp');
$meta->AddControl($hcal_stamp);
# hCalendar GUID
$meta->AddControl(' match ');
$hcal_guid = new XhtmlElement('span', htmlentities($match->GetLinkedDataUri(), ENT_QUOTES, "UTF-8", false));
$hcal_guid->SetCssClass('uid');
$meta->AddControl($hcal_guid);
# hCalendar status
$s_status = 'CONFIRMED';
switch ($match->Result()->GetResultType()) {
case MatchResult::CANCELLED:
case MatchResult::POSTPONED:
case MatchResult::AWAY_WIN_BY_FORFEIT:
case MatchResult::HOME_WIN_BY_FORFEIT:
$s_status = 'CANCELLED';
}
$meta->AddControl(' is ');
$status = new XhtmlElement('span', $s_status);
$status->SetCssClass('status');
$meta->AddControl($status);
$meta->AddControl('.');
$li->AddControl($meta);
}
示例5: OnPageLoad
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;
//.........这里部分代码省略.........
示例6: OnPreRender
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: ");
//.........这里部分代码省略.........