本文整理汇总了PHP中Match::GetLinkedDataUri方法的典型用法代码示例。如果您正苦于以下问题:PHP Match::GetLinkedDataUri方法的具体用法?PHP Match::GetLinkedDataUri怎么用?PHP Match::GetLinkedDataUri使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Match
的用法示例。
在下文中一共展示了Match::GetLinkedDataUri方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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: ");
//.........这里部分代码省略.........
示例2: 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);
}
示例3: OnPageLoad
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) {
//.........这里部分代码省略.........