本文整理汇总了PHP中Match::GetStartTime方法的典型用法代码示例。如果您正苦于以下问题:PHP Match::GetStartTime方法的具体用法?PHP Match::GetStartTime怎么用?PHP Match::GetStartTime使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Match
的用法示例。
在下文中一共展示了Match::GetStartTime方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: OnPrePageLoad
function OnPrePageLoad()
{
if ($this->page_not_found) {
$this->SetPageTitle('Page not found');
return;
}
$title = "Statistics for the " . $this->tournament->GetTitle() . ", " . Date::BritishDate($this->tournament->GetStartTime());
$this->SetPageTitle($title);
$this->SetContentConstraint(StoolballPage::ConstrainBox());
$this->SetContentCssClass('stats');
}
示例2: OnPrePageLoad
public function OnPrePageLoad()
{
/* @var $match Match */
#$this->SetContentConstraint(StoolballPage::ConstrainText());
$this->SetContentCssClass('scorecardPage');
$this->SetContentCssClass('scorecardPage');
if ($this->page_not_found) {
$this->SetPageTitle('Page not found');
return;
# Don't load any JS
}
# Set page title
$edit_or_update = ($this->b_user_is_match_admin or $this->b_user_is_match_owner) ? "Edit" : "Update";
$step = ", step " . $this->editor->GetCurrentPage() . " of 4";
$this->SetPageTitle("{$edit_or_update} " . $this->match->GetTitle() . ', ' . Date::BritishDate($this->match->GetStartTime()) . $step);
# Load JavaScript
$autocomplete_team_ids = array();
if ($this->match->GetHomeTeamId()) {
$autocomplete_team_ids[] = $this->match->GetHomeTeamId();
}
if ($this->match->GetAwayTeamId()) {
$autocomplete_team_ids[] = $this->match->GetAwayTeamId();
}
if (count($autocomplete_team_ids)) {
$this->LoadClientScript("/scripts/lib/jquery-ui-1.8.11.custom.min.js");
$this->LoadClientScript("/play/playersuggest.js.php?v=2&team=" . implode(",", $autocomplete_team_ids));
// . "&time=" . time());
?>
<link rel="stylesheet" type="text/css" href="/css/custom-theme/jquery-ui-1.8.11.custom.css" media="all" />
<?php
}
$this->LoadClientScript('scorecard.js', true);
}
示例3: OnPageLoad
public 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;
}
$edit_or_update = ($this->b_user_is_match_admin or $this->b_user_is_match_owner) ? "Edit" : "Update";
if ($this->match->GetStartTime() > gmdate('U') and !$this->b_user_is_match_admin and !$this->b_user_is_match_owner) {
$step = "";
# definitely only this step because match in future and can't change date
} else {
$step = " – step 1 of 4";
}
echo new XhtmlElement('h1', "{$edit_or_update} " . htmlentities($this->match->GetTitle(), ENT_QUOTES, "UTF-8", false) . $step);
# If result only there's room for a little help
if (!$this->b_user_is_match_admin and !$this->b_user_is_match_owner) {
/* Create instruction panel */
$o_panel = new XhtmlElement('div');
$o_panel->SetCssClass('panel instructionPanel');
$o_title_inner1 = new XhtmlElement('div', 'Add your matches quickly:');
$o_title = new XhtmlElement('h2', $o_title_inner1);
$o_panel->AddControl($o_title);
$o_tab_tip = new XhtmlElement('ul');
$o_tab_tip->AddControl(new XhtmlElement('li', 'You can add runs, wickets and the winning team on the next few pages'));
$o_tab_tip->AddControl(new XhtmlElement('li', 'Don\'t worry if you don\'t know – fill in what you can and leave the rest blank.'));
$o_panel->AddControl($o_tab_tip);
echo $o_panel;
}
# OK to edit the match
$this->editor->SetDataObject($this->match);
echo $this->editor;
}
示例4: OnPrePageLoad
function OnPrePageLoad()
{
if ($this->page_not_found) {
$this->SetPageTitle('Page not found');
return;
}
$title = "Statistics for " . $this->match->GetTitle() . ", " . Date::BritishDate($this->match->GetStartTime(), false);
$this->SetPageTitle($title);
$this->SetContentConstraint(StoolballPage::ConstrainBox());
if ($this->has_statistics) {
$this->LoadClientScript("/scripts/lib/chart.min.js");
$this->LoadClientScript("/scripts/chart.js?v=2");
$this->LoadClientScript("/play/statistics/match.js");
?>
<!--[if lte IE 8]><script src="/scripts/lib/excanvas.compiled.js"></script><![endif]-->
<?php
}
}
示例5: __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);
}
示例6: OnPrePageLoad
function OnPrePageLoad()
{
/* @var $match Match */
# set page title
if ($this->tournament instanceof Match) {
$action = "Edit ";
$this->SetPageTitle($action . $this->tournament->GetTitle() . ', ' . Date::BritishDate($this->tournament->GetStartTime()));
} else {
$this->SetPageTitle('Page not found');
}
$this->SetContentCssClass('matchEdit');
$this->SetContentConstraint(StoolballPage::ConstrainText());
}
示例7: OnPrePageLoad
function OnPrePageLoad()
{
/* @var $match Match */
# set page title
if ($this->tournament instanceof Match) {
$this->SetPageTitle('Edit ' . $this->tournament->GetTitle() . ', ' . Date::BritishDate($this->tournament->GetStartTime()));
} else {
$this->SetPageTitle('Page not found');
}
$this->SetContentCssClass('matchEdit');
$this->SetContentConstraint(StoolballPage::ConstrainText());
$this->LoadClientScript('/scripts/tournament-edit-control-3.js');
}
示例8: OnPrePageLoad
function OnPrePageLoad()
{
/* @var $match Match */
# set page title
if ($this->tournament instanceof Match) {
$action = $this->adding ? "Add " : "Edit ";
$this->SetPageTitle($action . $this->tournament->GetTitle() . ', ' . Date::BritishDate($this->tournament->GetStartTime()));
} else {
$this->SetPageTitle('Page not found');
}
$this->SetContentCssClass('matchEdit');
$this->SetContentConstraint(StoolballPage::ConstrainText());
$except = array();
if ($this->tournament instanceof Match) {
foreach ($this->tournament->GetAwayTeams() as $team) {
$except[] = $team->GetId();
}
}
$this->LoadClientScript("/scripts/lib/jquery-ui-1.8.11.custom.min.js");
$this->LoadClientScript("/play/teams/suggest-teams.js.php?except=" . trim(implode(",", $except), ","));
?>
<link rel="stylesheet" type="text/css" href="/css/custom-theme/jquery-ui-1.8.11.custom.css" media="all" />
<?php
}
示例9: CreateSeasonControls
/**
* Creates the controls when the editor is in its season view
*
*/
private function CreateSeasonControls(Match $match, XhtmlElement $match_box)
{
/* @var $season Season */
$css_class = 'TournamentEdit checkBoxList';
if ($this->GetCssClass()) {
$css_class .= ' ' . $this->GetCssClass();
}
$match_outer_1 = new XhtmlElement('div');
$match_outer_1->SetCssClass($css_class);
$this->SetCssClass('');
$match_outer_1->SetXhtmlId($this->GetNamingPrefix());
$match_outer_2 = new XhtmlElement('div');
$this->AddControl($match_outer_1);
$match_outer_1->AddControl($match_outer_2);
$match_outer_2->AddControl($match_box);
$heading = 'Select seasons';
if ($this->show_step_number) {
$heading .= ' – step 3 of 3';
}
$o_title_inner_1 = new XhtmlElement('span', $heading);
$o_title_inner_2 = new XhtmlElement('span', $o_title_inner_1);
$o_title_inner_3 = new XhtmlElement('span', $o_title_inner_2);
$match_box->AddControl(new XhtmlElement('h2', $o_title_inner_3, "large"));
# Preserve match title, because we need it to send the email when the seasons are saved
$title = new TextBox($this->GetNamingPrefix() . 'Title', $match->GetTitle(), $this->IsValidSubmit());
$title->SetMode(TextBoxMode::Hidden());
$match_box->AddControl($title);
# If the list of seasons includes ones in which the only match type is tournament, then
# they're annual tournaments like Expo and Seaford. Although those tournaments can be listed
# in other seasons (they're of interest to the league teams), we don't want other tournaments
# listed on pages which are supposed to be just about those annual tournaments. So exclude them
# from the collection of possible seasons. Next bit of code will add them back in for any
# tournaments which actually are meant to be in those seasons.
$seasons = $this->seasons->GetItems();
$len = count($seasons);
for ($i = 0; $i < $len; $i++) {
# Make sure only seasons which contain tournaments are listed. Necessary to include all match types
# in the Seasons() collection from the database so that we can test what other match types seasons support.
if (!$seasons[$i]->MatchTypes()->Contains(MatchType::TOURNAMENT)) {
unset($seasons[$i]);
continue;
}
if ($seasons[$i]->MatchTypes()->GetCount() == 1 and $seasons[$i]->MatchTypes()->GetFirst() == MatchType::TOURNAMENT) {
unset($seasons[$i]);
}
}
$this->seasons->SetItems($seasons);
# If the list of possible seasons doesn't include the one(s) the match is already in,
# or the ones the context team plays in, add those to the list of possibles
$a_season_ids = array();
foreach ($this->seasons as $season) {
$a_season_ids[] = $season->GetId();
}
foreach ($match->Seasons() as $season) {
if (!in_array($season->GetId(), $a_season_ids, true)) {
$this->seasons->Insert($season);
$a_season_ids[] = $season->GetId();
}
}
if (isset($this->context_team)) {
$match_year = Date::Year($match->GetStartTime());
foreach ($this->context_team->Seasons() as $team_in_season) {
/* @var $team_in_season TeamInSeason */
if (!in_array($team_in_season->GetSeasonId(), $a_season_ids, true) and ($team_in_season->GetSeason()->GetStartYear() == $match_year or $team_in_season->GetSeason()->GetEndYear() == $match_year)) {
$this->seasons->Insert($team_in_season->GetSeason());
$a_season_ids[] = $team_in_season->GetSeasonId();
}
}
}
require_once 'xhtml/forms/checkbox.class.php';
$seasons_list = '';
if ($this->seasons->GetCount()) {
# Sort the seasons by name, because they've been messed up by the code above
$this->seasons->SortByProperty('GetCompetitionName');
$match_box->AddControl(new XhtmlElement('p', 'Tick all the places we should list your tournament:'));
$match_box->AddControl('<div class="radioButtonList">');
foreach ($this->seasons as $season) {
# Select season if it's one of the seasons the match is already in
$b_season_selected = false;
foreach ($match->Seasons() as $match_season) {
$b_season_selected = ($b_season_selected or $match_season->GetId() == $season->GetId());
}
/* @var $season Season */
$box = new CheckBox($this->GetNamingPrefix() . 'Season' . $season->GetId(), $season->GetCompetitionName(), $season->GetId(), $b_season_selected, $this->IsValidSubmit());
$seasons_list .= $season->GetId() . ';';
$match_box->AddControl($box);
}
$match_box->AddControl('</div>');
# Remember all the season ids to make it much easier to find the data on postback
$seasons = new TextBox($this->GetNamingPrefix() . 'Seasons', $seasons_list, $this->IsValidSubmit());
$seasons->SetMode(TextBoxMode::Hidden());
$match_box->AddControl($seasons);
} else {
$match_month = 'in ' . Date::MonthAndYear($match->GetStartTime());
$type = strtolower(PlayerType::Text($match->GetPlayerType()));
$match_box->AddControl(new XhtmlElement('p', "Unfortunately we don't have details of any {$type} competitions {$match_month} to list your tournament in."));
//.........这里部分代码省略.........
开发者ID:stoolball-england,项目名称:stoolball-england-website,代码行数:101,代码来源:tournament-seasons-control.class.php
示例10: CreateMatchControls
/**
* Creates the controls to edit the matches
*
*/
private function CreateMatchControls(Match $tournament, XhtmlElement $box)
{
$css_class = 'TournamentEdit';
$box->SetCssClass($css_class);
$this->SetCssClass('');
$box->SetXhtmlId($this->GetNamingPrefix());
$this->AddControl($box);
# Preserve tournament title and date, because we need them for the page title when "add" is clicked
$title = new TextBox($this->GetNamingPrefix() . 'Title', $tournament->GetTitle(), $this->IsValidSubmit());
$title->SetMode(TextBoxMode::Hidden());
$box->AddControl($title);
$date = new TextBox($this->GetNamingPrefix() . 'Start', $tournament->GetStartTime(), $this->IsValidSubmit());
$date->SetMode(TextBoxMode::Hidden());
$box->AddControl($date);
# Matches editor
$this->EnsureAggregatedEditors();
$this->matches_editor->DataObjects()->SetItems($tournament->GetMatchesInTournament());
$this->matches_editor->SetTeams($tournament->GetAwayTeams());
$box->AddControl($this->matches_editor);
}
开发者ID:stoolball-england,项目名称:stoolball-england-website,代码行数:24,代码来源:tournament-matches-control.class.php
示例11: CreateHighlightsControls
/**
* Sets up controls for page 4 of the wizard
* @param Match $match
* @return void
*/
private function CreateHighlightsControls(Match $match)
{
$b_got_teams = !(is_null($match->GetHomeTeam()) || is_null($match->GetAwayTeam()));
// Move CSS class to div element
$match_outer_1 = new XhtmlElement('div');
$match_outer_1->SetCssClass('matchResultEdit panel');
$match_outer_2 = new XhtmlElement('div');
$match_box = new XhtmlElement('div');
$this->AddControl($match_outer_1);
$match_outer_1->AddControl($match_outer_2);
$match_outer_2->AddControl($match_box);
$o_title_inner_1 = new XhtmlElement('span', "Match highlights");
$o_title_inner_2 = new XhtmlElement('span', $o_title_inner_1);
$o_title_inner_3 = new XhtmlElement('span', $o_title_inner_2);
$o_heading = new XhtmlElement('h2', $o_title_inner_3);
$match_box->AddControl($o_heading);
# Who's playing?
$o_home_name = new TextBox($this->GetNamingPrefix() . 'Home');
$o_away_name = new TextBox($this->GetNamingPrefix() . 'Away');
$o_home_name->SetMode(TextBoxMode::Hidden());
$o_away_name->SetMode(TextBoxMode::Hidden());
if (!is_null($match->GetHomeTeam())) {
$o_home_name->SetText($match->GetHomeTeam()->GetId() . MatchHighlightsEditControl::DATA_SEPARATOR . $match->GetHomeTeam()->GetName());
}
if (!is_null($match->GetAwayTeam())) {
$o_away_name->SetText($match->GetAwayTeam()->GetId() . MatchHighlightsEditControl::DATA_SEPARATOR . $match->GetAwayTeam()->GetName());
}
$this->AddControl($o_home_name);
$this->AddControl($o_away_name);
# When? (for validator message only)
$when = new TextBox($this->GetNamingPrefix() . 'Date', $match->GetStartTime());
$when->SetMode(TextBoxMode::Hidden());
$this->AddControl($when);
# Who won?
$o_winner = new XhtmlSelect($this->GetNamingPrefix() . 'Result');
$o_winner->AddControl(new XhtmlOption("Don't know", ''));
$result_types = array(MatchResult::HOME_WIN, MatchResult::AWAY_WIN, MatchResult::TIE, MatchResult::ABANDONED);
foreach ($result_types as $result_type) {
if ($b_got_teams) {
$o_winner->AddControl(new XhtmlOption($this->NameTeams(MatchResult::Text($result_type), $match->GetHomeTeam(), $match->GetAwayTeam()), $result_type));
} else {
$o_winner->AddControl(new XhtmlOption(MatchResult::Text($result_type), $result_type));
}
}
if ($this->IsValidSubmit()) {
if ($match->Result()->GetResultType() == MatchResult::UNKNOWN and !is_null($match->Result()->GetHomeRuns()) and !is_null($match->Result()->GetAwayRuns())) {
# If match result is not known but we can guess from the entered scores, select it
if ($match->Result()->GetHomeRuns() > $match->Result()->GetAwayRuns()) {
$o_winner->SelectOption(MatchResult::HOME_WIN);
} else {
if ($match->Result()->GetHomeRuns() < $match->Result()->GetAwayRuns()) {
$o_winner->SelectOption(MatchResult::AWAY_WIN);
} else {
if ($match->Result()->GetHomeRuns() == $match->Result()->GetAwayRuns()) {
$o_winner->SelectOption(MatchResult::TIE);
}
}
}
} else {
$o_winner->SelectOption($match->Result()->GetResultType());
}
}
$o_win_part = new FormPart('Who won?', $o_winner);
$match_box->AddControl($o_win_part);
# Get current player of match
$player = $match->Result()->GetPlayerOfTheMatch();
$home_player = $match->Result()->GetPlayerOfTheMatchHome();
$away_player = $match->Result()->GetPlayerOfTheMatchAway();
$current_pom = MatchHighlightsEditControl::PLAYER_OF_THE_MATCH_NONE;
if ($player instanceof Player) {
$current_pom = MatchHighlightsEditControl::PLAYER_OF_THE_MATCH_OVERALL;
} else {
if ($home_player instanceof Player or $away_player instanceof Player) {
$current_pom = MatchHighlightsEditControl::PLAYER_OF_THE_MATCH_HOME_AND_AWAY;
}
}
# Choose from different types of player of the match
require_once 'xhtml/forms/radio-button.class.php';
$pom_container = new XhtmlElement('fieldset', new XhtmlElement('legend', 'Player of the match', 'formLabel'));
$pom_container->SetCssClass('formPart');
$pom_options = new XhtmlElement('div', null, 'formControl radioButtonList');
$pom_options->SetXhtmlId($this->GetNamingPrefix() . "PlayerOptions");
$pom_container->AddControl($pom_options);
$match_box->AddControl($pom_container);
$pom_options->AddControl(new RadioButton($this->GetNamingPrefix() . 'POM' . MatchHighlightsEditControl::PLAYER_OF_THE_MATCH_NONE, $this->GetNamingPrefix() . 'POM', "none chosen", MatchHighlightsEditControl::PLAYER_OF_THE_MATCH_NONE, $current_pom == MatchHighlightsEditControl::PLAYER_OF_THE_MATCH_NONE, $this->IsValidSubmit()));
$pom_options->AddControl(new RadioButton($this->GetNamingPrefix() . 'POM' . MatchHighlightsEditControl::PLAYER_OF_THE_MATCH_OVERALL, $this->GetNamingPrefix() . 'POM', "yes, one chosen", MatchHighlightsEditControl::PLAYER_OF_THE_MATCH_OVERALL, $current_pom == MatchHighlightsEditControl::PLAYER_OF_THE_MATCH_OVERALL, $this->IsValidSubmit()));
$pom_options->AddControl(new RadioButton($this->GetNamingPrefix() . 'POM' . MatchHighlightsEditControl::PLAYER_OF_THE_MATCH_HOME_AND_AWAY, $this->GetNamingPrefix() . 'POM', "yes, one from each team", MatchHighlightsEditControl::PLAYER_OF_THE_MATCH_HOME_AND_AWAY, $current_pom == MatchHighlightsEditControl::PLAYER_OF_THE_MATCH_HOME_AND_AWAY, $this->IsValidSubmit()));
# Controls for entering a single player of the match
$player_name = new TextBox($this->GetNamingPrefix() . 'Player', $player instanceof Player ? $player->GetName() : '', $this->IsValidSubmit());
$player_name->SetMaxLength(100);
$player_name->AddCssClass("player");
$player_name->AddCssClass("team" . $match->GetHomeTeamId());
$player_name->AddCssClass("team" . $match->GetAwayTeamId());
$player_name->AddAttribute("autocomplete", "off");
$player_box = new XhtmlElement("div", $player_name);
//.........这里部分代码省略.........
开发者ID:stoolball-england,项目名称:stoolball-england-website,代码行数:101,代码来源:match-highlights-edit-control.class.php
示例12: CreateFixtureControls
//.........这里部分代码省略.........
$per_side_box->SetBlankFirst(true);
for ($i = 6; $i <= 16; $i++) {
$per_side_box->AddControl(new XhtmlOption($i));
}
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);
}
开发者ID:stoolball-england,项目名称:stoolball-england-website,代码行数:67,代码来源:tournament-edit-control.class.php
示例13: CopyTournamentDetailsToTournamentMatches
private function CopyTournamentDetailsToTournamentMatches(Match $tournament)
{
# If it's a tournament, copy the date of the tournament to the tournament matches to ensure they're always on the same day
$typical_match_duration_in_seconds = 45 * 60;
$sql = "UPDATE nsa_match SET start_time = " . Sql::ProtectNumeric($tournament->GetStartTime()) . " + ({$typical_match_duration_in_seconds}*IFNULL(order_in_tournament-1,0)), \r\n start_time_known = 0\r\n WHERE tournament_match_id = " . Sql::ProtectNumeric($tournament->GetId());
$this->LoggedQuery($sql);
}
示例14: 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: ");
//.........这里部分代码省略.........
示例15: CreateTeamScoreControls
/**
* Adds controls to edit a team score
*
* @param XhtmlElement $o_container
* @param string $s_id_prefix
* @param Match $o_match
* @param Team $o_team
* @param int $i_runs
* @param int $i_wickets
*/
private function CreateTeamScoreControls($o_container, $s_team_role, Match $o_match, Team $o_team = null, $i_runs, $i_wickets)
{
$o_box = new XhtmlElement('div');
$o_runs = new TextBox($this->GetNamingPrefix() . $s_team_role . 'Runs', $i_runs);
$o_runs->SetCssClass("numeric");
if ($i_runs == null) {
$o_runs->PopulateData();
}
$s_runs_label = (is_null($o_team) ? $s_team_role : $o_team->GetName()) . ' score';
$o_part = new FormPart($s_runs_label, $o_box);
$o_box->AddControl($o_runs);
$o_part->GetLabel()->AddAttribute('for', $o_runs->GetXhtmlId());
$o_wickets = new XhtmlSelect($this->GetNamingPrefix() . $s_team_role . 'Wickets', ' for ');
$o_wickets->SetBlankFirst(true);
$max_wickets = $o_match->GetMaximumPlayersPerTeam() - 2;
$season_dates = Season::SeasonDates($o_match->GetStartTime());
# working with GMT
if (Date::Year($season_dates[0]) != Date::Year($season_dates[1])) {
# outdoor needs maximum-2, but indoor needs maximum-1 cos last batter can play on.
# if there's any chance it's indoor use maximum-1
$max_wickets = $o_match->GetMaximumPlayersPerTeam() - 1;
}
for ($i = 0; $i <= $max_wickets; $i++) {
$o_wickets->AddControl(new XhtmlOption($i));
}
$o_wickets->AddControl(new XhtmlOption('all out', -1));
$o_wickets->SelectOption($i_wickets);
$o_box->AddControl($o_wickets);
$o_container->AddControl($o_part);
}
开发者ID:stoolball-england,项目名称:stoolball-england-website,代码行数:40,代码来源:match-result-edit-control.class.php