本文整理汇总了PHP中Match::GetMatchesInTournament方法的典型用法代码示例。如果您正苦于以下问题:PHP Match::GetMatchesInTournament方法的具体用法?PHP Match::GetMatchesInTournament怎么用?PHP Match::GetMatchesInTournament使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Match
的用法示例。
在下文中一共展示了Match::GetMatchesInTournament方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: OnPostback
function OnPostback()
{
# Get the match info and store it
$i_id = $this->manager->GetItemId($this->match);
$this->manager->ReadByMatchId(array($i_id));
$this->match = $this->manager->GetFirst();
if (!$this->match instanceof Match) {
# This can be the case if the back button is used to go back to the "match has been deleted" page.
$this->b_deleted = true;
return;
}
# Check whether cancel was clicked
if (isset($_POST['cancel'])) {
$this->Redirect($this->match->GetNavigateUrl());
}
# Check whether delete was clicked
if (isset($_POST['delete'])) {
# Check again that the requester has permission to delete this match
$has_permission = (AuthenticationManager::GetUser()->Permissions()->HasPermission(PermissionType::MANAGE_MATCHES) or AuthenticationManager::GetUser()->GetId() == $this->match->GetAddedBy()->GetId());
if ($has_permission) {
# Delete the match
$this->manager->DeleteMatch(array($i_id));
# Remove match, and all dependent tournament matches, from search results
foreach ($this->match->GetMatchesInTournament() as $tournament_match) {
$this->SearchIndexer()->DeleteFromIndexById("match" . $tournament_match->GetId());
}
$this->SearchIndexer()->DeleteFromIndexById("match" . $this->match->GetId());
$this->SearchIndexer()->CommitChanges();
require_once 'stoolball/data-change-notifier.class.php';
$notifier = new DataChangeNotifier($this->GetSettings());
$notifier->MatchUpdated($this->match, AuthenticationManager::GetUser(), false, true);
# Update 'next 5 matches'
$this->manager->ReadNext();
$this->a_next_matches = $this->manager->GetItems();
# Note success
$this->b_deleted = true;
}
}
}
示例2: 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
示例3: SaveMatchesInTournament
/**
* Saves the supplied match array as the matches in a tournament
* @param Match $tournament_id
*/
public function SaveMatchesInTournament(Match $tournament)
{
$match_ids_to_keep = array();
foreach ($tournament->GetMatchesInTournament() as $match) {
/* @var $match Match */
if (!$match instanceof Match or $match->GetMatchType() !== MatchType::TOURNAMENT_MATCH) {
continue;
}
if ($match->GetId()) {
$match_ids_to_keep[] = $match->GetId();
}
}
# Delete unwanted matches
$match_ids_to_delete = array();
$sql = "SELECT match_id FROM nsa_match \r\n WHERE tournament_match_id = " . Sql::ProtectNumeric($tournament->GetId(), false, false) . "\r\n AND match_id NOT IN (" . join(',', $match_ids_to_keep) . ") ";
$result = $this->GetDataConnection()->query($sql);
while ($row = $result->fetch()) {
$match_ids_to_delete[] = $row->match_id;
}
if (count($match_ids_to_delete)) {
$this->DeleteMatch($match_ids_to_delete);
}
# Add and update matches
foreach ($tournament->GetMatchesInTournament() as $match) {
/* @var $match Match */
if (!$match instanceof Match or $match->GetMatchType() !== MatchType::TOURNAMENT_MATCH) {
continue;
}
if (!$match->GetId()) {
$this->SaveFixture($match);
}
$this->SaveMatchOrderInTournament($match->GetId(), $match->GetOrderInTournament());
$this->CopyTournamentMatchDetailsFromTournament($tournament, $match);
}
}
示例4: 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) {
//.........这里部分代码省略.........