本文整理汇总了PHP中Match::GetStartTimeFormatted方法的典型用法代码示例。如果您正苦于以下问题:PHP Match::GetStartTimeFormatted方法的具体用法?PHP Match::GetStartTimeFormatted怎么用?PHP Match::GetStartTimeFormatted使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Match
的用法示例。
在下文中一共展示了Match::GetStartTimeFormatted方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
public function __construct(Match $match)
{
$this->match = $match;
$this->searchable = new SearchItem("match", "match" . $match->GetId(), $match->GetNavigateUrl());
$this->searchable->Title($match->GetTitle() . ", " . $match->GetStartTimeFormatted(true, false));
$this->searchable->Description($this->GetSearchDescription());
$this->searchable->FullText($match->GetNotes());
$this->searchable->RelatedLinksHtml('<ul>' . '<li><a href="' . $match->GetNavigateUrl() . '/statistics">Statistics</a></li>' . '<li><a href="' . $match->GetCalendarNavigateUrl() . '">Add to calendar</a></li>' . '<li><a href="' . $match->GetEditNavigateUrl() . '">Update result</a></li>' . '</ul>');
# Assign more weight to newer matches
$weight = $match->GetStartTime() / 60 / 60 / 24 / 365;
$this->searchable->WeightWithinType($weight);
}
示例2: OnPrePageLoad
function OnPrePageLoad()
{
$this->SetOpenGraphType("sport");
$match_or_tournament = $this->match->GetMatchType() == MatchType::TOURNAMENT ? 'tournament' : 'match';
$match_title = $this->match->GetTitle();
if ($this->match->GetMatchType() == MatchType::TOURNAMENT_MATCH) {
$match_title .= " in the " . $this->match->GetTournament()->GetTitle();
}
$this->SetPageTitle($match_title . ' - ' . $this->match->GetStartTimeFormatted() . ' - stoolball ' . $match_or_tournament);
$this->SetContentConstraint(StoolballPage::ConstrainColumns());
require_once "search/match-search-adapter.class.php";
$adapter = new MatchSearchAdapter($this->match);
$this->SetPageDescription($adapter->GetSearchDescription());
$this->LoadClientScript("match.js", true);
}
示例3: SendMatchUpdatedEmail
/**
* Helper to build and send the email when a match has been added by a public user
*
* @param Match $o_match
* @param User $o_user
* @param bool $b_is_new_match
* @param bool $b_is_deleted_match
* @param string $s_email
* @param Season[] $seasons
*/
private function SendMatchUpdatedEmail(Match $o_match, User $o_user, $b_is_new_match, $b_is_deleted_match, $s_email, $seasons = null)
{
# text of email
$s_season_list = '';
if (is_array($seasons)) {
$i_total_seasons = count($seasons);
for ($i = 0; $i < $i_total_seasons; $i++) {
if ($i == 0) {
$s_season_list = "'" . $seasons[$i]->GetCompetitionName() . "'";
} else {
if ($i == $i_total_seasons - 1) {
$s_season_list .= " and '" . $seasons[$i]->GetCompetitionName() . "'";
} else {
$s_season_list .= ", '" . $seasons[$i]->GetCompetitionName() . "'";
}
}
}
}
$s_season = $s_season_list ? " in the {$s_season_list}" : '';
$s_why = $s_season_list ? $s_season_list : 'matches';
$new = $b_is_new_match ? 'new ' : '';
$verb = $b_is_new_match ? 'added' : 'updated';
if ($b_is_deleted_match) {
$verb = 'deleted';
}
$match_text = $o_match->GetMatchType() == MatchType::TOURNAMENT ? 'tournament' : 'match';
$s_title = html_entity_decode($o_match->GetTitle());
$s_date = ucfirst($o_match->GetStartTimeFormatted());
$s_ground = is_object($o_match->GetGround()) ? $o_match->GetGround()->GetNameAndTown() : '';
$s_notes = $o_match->GetNotes();
$s_domain = $this->settings->GetDomain();
$s_url = 'https://' . $s_domain . $o_match->GetNavigateUrl();
$s_contact_url = 'https://' . $s_domain . $this->settings->GetFolder('Contact');
$s_home_name = $o_match->GetMatchType() == MatchType::TOURNAMENT ? '' : html_entity_decode($o_match->GetHomeTeam()->GetName());
$s_away_name = $o_match->GetMatchType() == MatchType::TOURNAMENT ? '' : html_entity_decode($o_match->GetAwayTeam()->GetName());
$s_bat_first = is_null($o_match->Result()->GetHomeBattedFirst()) ? 'Not known which team batted first' : ($o_match->Result()->GetHomeBattedFirst() ? $s_home_name : $s_away_name) . ' batted first';
$s_home_runs = is_null($o_match->Result()->GetHomeRuns()) ? '(not known)' : $o_match->Result()->GetHomeRuns();
$s_home_wickets = is_null($o_match->Result()->GetHomeWickets()) ? '(not known)' : $o_match->Result()->GetHomeWickets();
if ($s_home_wickets == -1) {
$s_home_wickets = 'all out';
} else {
$s_home_wickets = 'for ' . $s_home_wickets . ' wickets';
}
$s_away_runs = is_null($o_match->Result()->GetAwayRuns()) ? '(not known)' : $o_match->Result()->GetAwayRuns();
$s_away_wickets = is_null($o_match->Result()->GetAwayWickets()) ? '(not known)' : $o_match->Result()->GetAwayWickets();
if ($s_away_wickets == -1) {
$s_away_wickets = 'all out';
} else {
$s_away_wickets = 'for ' . $s_away_wickets . ' wickets';
}
$s_user = $o_user->GetName();
$s_body = wordwrap("A {$new}{$match_text} has been {$verb} on the Stoolball England website at {$s_domain}{$s_season}.\n\n" . "The {$match_text} was {$verb} by {$s_user}.\n\n" . "The {$match_text} details are as follows:\n\n" . " {$s_title}\n" . " {$s_date}\n" . " {$s_ground}");
if ($s_notes) {
$s_notes = "\n\n" . wordwrap($s_notes, 70);
$s_notes = str_replace("\n", "\n ", $s_notes);
$s_body .= $s_notes;
}
if ($o_match->GetStartTime() <= gmdate('U') and !$b_is_new_match and $o_match->GetMatchType() != MatchType::TOURNAMENT) {
$s_body .= <<<EMAILBODY
\t{$s_bat_first}
EMAILBODY;
if ($o_match->Result()->GetHomeBattedFirst() === false) {
$s_body .= <<<EMAILBODY
\t{$s_away_name} score: {$s_away_runs} runs {$s_away_wickets}
\t{$s_home_name} score: {$s_home_runs} runs {$s_home_wickets}
EMAILBODY;
} else {
$s_body .= <<<EMAILBODY
\t{$s_home_name} score: {$s_home_runs} runs {$s_home_wickets}
\t{$s_away_name} score: {$s_away_runs} runs {$s_away_wickets}
EMAILBODY;
}
}
$s_body .= "\n\n";
if (!$b_is_deleted_match) {
$s_body .= wordwrap("You can view the {$match_text} at {$s_url}\n\n");
}
$s_body .= wordwrap("You have received this email because you are the administrative contact for {$s_why} on {$s_domain}.\n\n" . "We let you know when a {$match_text} is {$verb} by a member of the public, so that you can check there's nothing wrong.\n\n" . "If this email has been sent to the wrong address, or if the {$match_text} details are wrong, please let us know using the contact form at {$s_contact_url}.\n\n");
# send email, copy to me
require_once 'Zend/Mail.php';
$o_email = new Zend_Mail('UTF-8');
$o_email->addTo($s_email);
$o_email->setFrom('alerts@stoolball.org.uk', 'Stoolball England alerts');
$o_email->setSubject(ucfirst($match_text) . " {$verb}: {$s_title}, {$s_date}");
$o_email->setBodyText($s_body);
try {
//.........这里部分代码省略.........
示例4: CreateStartDate
private function CreateStartDate(Match $match)
{
$date = new XhtmlElement('abbr', htmlentities($match->GetStartTimeFormatted(), ENT_QUOTES, "UTF-8", false));
$date->SetTitle(Date::Microformat($match->GetStartTime()));
# hCalendar
$date->SetCssClass('dtstart');
# hCalendar
$date->AddAttribute("property", "schema:startDate");
$date->AddAttribute("datatype", "xsd:date");
$date->AddAttribute("content", Date::Microformat($match->GetStartTime()));
return $date;
}
示例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: ");
//.........这里部分代码省略.........