本文整理汇总了PHP中Match::GetDeleteNavigateUrl方法的典型用法代码示例。如果您正苦于以下问题:PHP Match::GetDeleteNavigateUrl方法的具体用法?PHP Match::GetDeleteNavigateUrl怎么用?PHP Match::GetDeleteNavigateUrl使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Match
的用法示例。
在下文中一共展示了Match::GetDeleteNavigateUrl方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: OnPostback
function OnPostback()
{
if ($this->editor->GetDataObjectId()) {
# Because this is a new request we need to reverify that this is the match owner before letting anything happen.
# Can't trust that info from a postback so MUST go to the database to check it.
$this->match_manager->ReadByMatchId(array($this->editor->GetDataObjectId()));
$check_match = $this->match_manager->GetFirst();
$this->b_user_is_match_owner = ($check_match instanceof Match and AuthenticationManager::GetUser()->GetId() == $check_match->GetAddedBy()->GetId());
# This page is only for tournaments, so check that against the db too
$this->b_is_tournament = $check_match->GetMatchType() == MatchType::TOURNAMENT;
} else {
# Not an entirely correct error for there being no match id on postback,
# but no match = not the owner, and most importantly it will prevent the
# match being saved or the edit form being shown.
$this->b_user_is_match_owner = false;
}
# get object
$this->tournament = $this->editor->GetDataObject();
# Check whether cancel was clicked
if ($this->editor->CancelClicked()) {
$this->match_manager->ExpandMatchUrl($this->tournament);
if ($this->adding) {
http_response_code(303);
$this->Redirect($this->tournament->GetDeleteNavigateUrl());
} else {
# Show the tournament
$this->Redirect($this->tournament->GetNavigateUrl());
}
}
# save data if valid
if ($this->IsValid()) {
# Confirm match is being saved as a tournament
$this->b_is_tournament = $this->b_is_tournament and $this->tournament->GetMatchType() == MatchType::TOURNAMENT;
# Check that the requester has permission to update this match
if (($this->b_user_is_match_admin or $this->b_user_is_match_owner) and $this->b_is_tournament) {
# Save the teams in the tournament
$this->match_manager->SaveTeams($this->tournament);
$this->match_manager->NotifyMatchModerator($this->tournament->GetId());
$this->match_manager->ExpandMatchUrl($this->tournament);
http_response_code(303);
if ($this->adding) {
$this->Redirect($this->tournament->AddTournamentCompetitionsUrl());
} else {
$this->Redirect($this->tournament->GetNavigateUrl());
}
}
}
}
示例2: OnPageLoad
function OnPageLoad()
{
echo '<h1>' . htmlentities($this->GetPageTitle(), ENT_QUOTES, "UTF-8", false) . '</h1>';
if (is_object($this->match)) {
echo "<p>Thank you. You have added the following match:</p>";
echo new MatchListControl(array($this->match));
echo "<p>Don't worry if you made a mistake, just <a href=\"" . htmlentities($this->match->GetEditNavigateUrl(), ENT_QUOTES, "UTF-8", false) . '">edit this match</a>
or <a href="' . htmlentities($this->match->GetDeleteNavigateUrl(), ENT_QUOTES, "UTF-8", false) . '">delete this match</a>.</p>';
$this->edit->SetHeading('Add another {0}');
# Configure edit control
$this->edit->SetCssClass('panel addAnotherPanel');
} else {
/* Create instruction panel */
$o_panel = new XhtmlElement('div');
$o_panel->SetCssClass('panel instructionPanel large');
$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', 'Use the <span class="tab">tab</span> key on your keyboard to move through the form'));
$o_tab_tip->AddControl(new XhtmlElement('li', 'Type the first letter or number to select from a dropdown list'));
if ($this->i_match_type != MatchType::TOURNAMENT_MATCH) {
$o_tab_tip->AddControl(new XhtmlElement('li', 'If you\'re not sure when the match starts, leave the time blank'));
}
$o_panel->AddControl($o_tab_tip);
echo $o_panel;
# Configure edit control
$this->edit->SetCssClass('panel');
}
# display the match to edit
echo $this->edit;
parent::OnPageLoad();
}
示例3: 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;
//.........这里部分代码省略.........
示例4: OnPageLoad
//.........这里部分代码省略.........
$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) {
$panel->AddLink('edit where to list this tournament', $this->match->EditTournamentCompetitionsUrl());
}
$link_text = $is_tournament ? 'tournament' : 'match';
$panel->AddLink('delete this ' . $link_text, $this->match->GetDeleteNavigateUrl());
}
if ($this->match->GetMatchType() != MatchType::TOURNAMENT_MATCH and $this->match->GetStartTime() > time()) {
$link_text = $is_tournament ? 'tournament' : 'match';
$panel->AddLink("add {$link_text} to your calendar", $this->match->GetCalendarNavigateUrl());
}
echo $panel;
if ($this->has_player_stats) {
$tournament = $is_tournament ? $this->match : $this->match->GetTournament();
require_once 'stoolball/statistics-highlight-table.class.php';
echo new StatisticsHighlightTable($this->best_batting, $this->most_runs, $this->best_bowling, $this->most_wickets, $this->most_catches, "tournament");
echo '<p class="playerSummaryMore"><a href="' . $tournament->GetNavigateUrl() . '/statistics">Tournament statistics</a></p>';
}
}