本文整理汇总了PHP中Match::GetAddedBy方法的典型用法代码示例。如果您正苦于以下问题:PHP Match::GetAddedBy方法的具体用法?PHP Match::GetAddedBy怎么用?PHP Match::GetAddedBy使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Match
的用法示例。
在下文中一共展示了Match::GetAddedBy方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: OnLoadPageData
function OnLoadPageData()
{
/* @var $match_manager MatchManager */
/* @var $editor TournamentEditControl */
# get id of Match
$i_id = $this->match_manager->GetItemId();
if (!$i_id) {
return;
}
# no need to read if redisplaying invalid form
if ($this->IsValid()) {
$this->match_manager->ReadByMatchId(array($i_id));
$this->tournament = $this->match_manager->GetFirst();
if ($this->tournament instanceof Match) {
$this->b_user_is_match_owner = AuthenticationManager::GetUser()->GetId() == $this->tournament->GetAddedBy()->GetId();
$this->b_is_tournament = $this->tournament->GetMatchType() == MatchType::TOURNAMENT;
} else {
return;
}
}
if ($this->b_user_is_match_admin or $this->b_user_is_match_owner) {
# Get all seasons
# Don't filter by match type at this point because we want to know what other types of match the seasons support.
# If it's tournaments only, they'll be treated differently.
require_once 'stoolball/season-manager.class.php';
$season_manager = new SeasonManager($this->GetSettings(), $this->GetDataConnection());
$season_dates = Season::SeasonDates($this->tournament->GetStartTime());
$season_manager->FilterByDateStart($season_dates[0]);
$season_manager->FilterByDateEnd($season_dates[1]);
$season_manager->ReadSeasonSummaries(array($this->tournament->GetPlayerType()));
$this->editor->Seasons()->SetItems($season_manager->GetItems());
unset($season_manager);
}
}
示例2: OnLoadPageData
function OnLoadPageData()
{
/* @var $match_manager MatchManager */
/* @var $editor TournamentEditControl */
# get id of Match
$i_id = $this->match_manager->GetItemId();
if (!$i_id) {
return;
}
# no need to read if redisplaying invalid form
if ($this->IsValid()) {
$this->match_manager->ReadByMatchId(array($i_id));
$this->tournament = $this->match_manager->GetFirst();
if ($this->tournament instanceof Match) {
$this->b_user_is_match_owner = AuthenticationManager::GetUser()->GetId() == $this->tournament->GetAddedBy()->GetId();
$this->b_is_tournament = $this->tournament->GetMatchType() == MatchType::TOURNAMENT;
} else {
return;
}
}
if ($this->b_user_is_match_admin or $this->b_user_is_match_owner) {
# get all grounds
require_once 'stoolball/ground-manager.class.php';
$o_ground_manager = new GroundManager($this->GetSettings(), $this->GetDataConnection());
$o_ground_manager->ReadAll();
$this->editor->Grounds()->SetItems($o_ground_manager->GetItems());
unset($o_ground_manager);
# get teams in seasons, in order to promote home grounds of teams
$season_ids = array();
foreach ($this->tournament->Seasons() as $season) {
$season_ids[] = $season->GetId();
}
require_once 'stoolball/team-manager.class.php';
$team_manager = new TeamManager($this->GetSettings(), $this->GetDataConnection());
if (count($season_ids)) {
$team_manager->ReadBySeasonId($season_ids);
$this->editor->ProbableTeams()->SetItems($team_manager->GetItems());
}
unset($team_manager);
}
}
示例3: OnLoadPageData
function OnLoadPageData()
{
/* @var $match_manager MatchManager */
/* @var $editor TournamentEditControl */
# get id of Match
$i_id = $this->match_manager->GetItemId();
if (!$i_id) {
return;
}
# no need to read if redisplaying invalid form
if ($this->IsValid()) {
$this->match_manager->ReadByMatchId(array($i_id));
$this->tournament = $this->match_manager->GetFirst();
if ($this->tournament instanceof Match) {
$this->b_user_is_match_owner = AuthenticationManager::GetUser()->GetId() == $this->tournament->GetAddedBy()->GetId();
$this->b_is_tournament = $this->tournament->GetMatchType() == MatchType::TOURNAMENT;
} else {
return;
}
}
}
示例4: OnLoadPageData
function OnLoadPageData()
{
/* @var $match_manager MatchManager */
# get id of Match
$i_id = $this->match_manager->GetItemId();
# Get details of match but, if invalid, don't replace submitted details with saved ones
if ($i_id and $this->IsValid()) {
$this->match_manager->ReadByMatchId(array($i_id));
$this->match_manager->ExpandMatchScorecards();
$this->match = $this->match_manager->GetFirst();
if ($this->match instanceof Match) {
$this->b_user_is_match_owner = AuthenticationManager::GetUser()->GetId() == $this->match->GetAddedBy()->GetId();
$this->b_is_tournament = $this->match->GetMatchType() == MatchType::TOURNAMENT;
}
}
unset($this->match_manager);
# Tournament or match in the future or not played is page not found
$editable_results = array(MatchResult::UNKNOWN, MatchResult::HOME_WIN, MatchResult::AWAY_WIN, MatchResult::TIE, MatchResult::ABANDONED);
if (!$this->match instanceof Match or $this->b_is_tournament or $this->match->GetStartTime() > gmdate('U') or !in_array($this->match->Result()->GetResultType(), $editable_results)) {
http_response_code(404);
$this->page_not_found = true;
}
}
示例5: OnLoadPageData
function OnLoadPageData()
{
/* @var $match_manager MatchManager */
/* @var $editor MatchEditControl */
# get id of Match
$i_id = $this->match_manager->GetItemId();
if ($i_id) {
# Get details of match but, if invalid, don't replace submitted details with saved ones
if ($this->IsValid()) {
$this->match_manager->ReadByMatchId(array($i_id));
$this->match_manager->ExpandMatchScorecards();
$this->match = $this->match_manager->GetFirst();
if ($this->match instanceof Match) {
$this->b_user_is_match_owner = AuthenticationManager::GetUser()->GetId() == $this->match->GetAddedBy()->GetId();
$this->b_is_tournament = $this->match->GetMatchType() == MatchType::TOURNAMENT;
}
}
unset($this->match_manager);
# get all competitions if user has permission to change the season
if ($this->b_user_is_match_admin) {
require_once 'stoolball/competition-manager.class.php';
$o_comp_manager = new CompetitionManager($this->GetSettings(), $this->GetDataConnection());
$o_comp_manager->ReadAllSummaries();
$this->editor->SetSeasons(CompetitionManager::GetSeasonsFromCompetitions($o_comp_manager->GetItems()));
unset($o_comp_manager);
}
if ($this->b_user_is_match_admin or $this->b_user_is_match_owner) {
# get all teams
$season_ids = array();
if ($this->match instanceof Match) {
foreach ($this->match->Seasons() as $season) {
$season_ids[] = $season->GetId();
}
}
require_once 'stoolball/team-manager.class.php';
$o_team_manager = new TeamManager($this->GetSettings(), $this->GetDataConnection());
if ($this->match instanceof Match and $this->match->GetMatchType() == MatchType::TOURNAMENT_MATCH) {
$o_team_manager->FilterByTournament(array($this->match->GetTournament()->GetId()));
$o_team_manager->FilterByTeamType(array());
# override default to allow all team types
$o_team_manager->ReadTeamSummaries();
} else {
if ($this->b_user_is_match_admin or !count($season_ids) or $this->match->GetMatchType() == MatchType::FRIENDLY) {
$o_team_manager->ReadById();
# we need full data on the teams to get the seasons they are playing in;
} else {
# If the user can't change the season, why let them select a team that's not in the season?
$o_team_manager->ReadBySeasonId($season_ids);
}
}
$this->editor->SetTeams(array($o_team_manager->GetItems()));
unset($o_team_manager);
# get all grounds
require_once 'stoolball/ground-manager.class.php';
$o_ground_manager = new GroundManager($this->GetSettings(), $this->GetDataConnection());
$o_ground_manager->ReadAll();
$this->editor->SetGrounds($o_ground_manager->GetItems());
unset($o_ground_manager);
}
}
# Tournament or match not found is page not found
if (!$this->match instanceof Match or $this->b_is_tournament) {
http_response_code(404);
$this->page_not_found = true;
}
}
示例6: 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;
//.........这里部分代码省略.........
示例7: 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) {
//.........这里部分代码省略.........