本文整理汇总了PHP中Player::GetTotalMatches方法的典型用法代码示例。如果您正苦于以下问题:PHP Player::GetTotalMatches方法的具体用法?PHP Player::GetTotalMatches怎么用?PHP Player::GetTotalMatches使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Player
的用法示例。
在下文中一共展示了Player::GetTotalMatches方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: OnPreRender
public function OnPreRender()
{
$by = $this->player->GetPlayerRole() == \Player::PLAYER ? ", " : " conceded by ";
$this->AddControl('<h1><span property="schema:name">' . \Html::Encode($this->player->GetName()) . '</span>' . \Html::Encode($by . ' ' . $this->player->Team()->GetName() . $this->filter_description) . "</h1>");
# When has this player played?
$match_or_matches = $this->player->GetTotalMatches() == 1 ? " match" : " matches";
$years = $this->player->GetPlayingYears();
$filtered = "";
if ($this->filter_description) {
# If first played date is missing, the player came from PlayerManager because there were no statistics found
if (!$this->filter_matched_nothing) {
$filtered = " matching this filter";
} else {
$filtered = ", but none match this filter";
$years = '';
}
}
$team_name = '<span rel="schema:memberOf"><span about="' . \Html::Encode($this->player->Team()->GetLinkedDataUri()) . '" typeof="schema:SportsTeam"><a property="schema:name" rel="schema:url" href="' . \Html::Encode($this->player->Team()->GetNavigateUrl()) . "\">" . \Html::Encode($this->player->Team()->GetName()) . "</a></span></span>";
if ($this->player->GetPlayerRole() == \Player::PLAYER) {
if ($this->player->GetTotalMatches() == 0) {
$played_total = " hasn't played any " . $match_or_matches;
} else {
$played_total = ' played <a href="/play/statistics/player-performances' . $this->filter_querystring . '">' . $this->player->GetTotalMatches() . $match_or_matches . '</a>';
}
$this->AddControl("<p>" . \Html::Encode($this->player->GetName()) . $played_total . " for {$team_name}{$filtered}{$years}.</p>");
# Player of match
if ($this->player->GetTotalPlayerOfTheMatchNominations() > 0) {
$match_or_matches = $this->player->GetTotalPlayerOfTheMatchNominations() == 1 ? " match." : " matches.";
$this->AddControl('<p>Nominated <a href="/play/statistics/player-of-match' . $this->filter_querystring . '">player of the match</a> in ' . $this->player->GetTotalPlayerOfTheMatchNominations() . $match_or_matches . "</p>");
}
} else {
$this->AddControl("<p>{$team_name} recorded " . \Html::Encode($this->player->TotalRuns() . " " . strtolower($this->player->GetName()) . " in " . $this->player->GetTotalMatches() . $match_or_matches . "{$filtered}{$years}.") . "</p>");
}
}
开发者ID:stoolball-england,项目名称:stoolball-england-website,代码行数:34,代码来源:player-summary-control.class.php
示例2: __construct
public function __construct(Player $player)
{
$this->searchable = new SearchItem("player", "player" . $player->GetId(), $player->GetPlayerUrl());
$this->searchable->Description($player->GetPlayerDescription());
$this->searchable->WeightOfType(20);
if ($player->GetPlayerRole() == Player::PLAYER) {
$this->searchable->Title($player->GetName() . ", " . $player->Team()->GetName());
$this->searchable->WeightWithinType($player->GetTotalMatches());
} else {
$this->searchable->Title($player->GetName() . " conceded by " . $player->Team()->GetName());
}
$this->searchable->Keywords($this->searchable->Title());
}
示例3: OnPageLoad
function OnPageLoad()
{
if (!$this->player instanceof Player) {
echo new XhtmlElement('h1', 'Player already deleted');
echo new XhtmlElement('p', "The player you're trying to delete does not exist or has already been deleted.");
return;
}
echo new XhtmlElement('h1', 'Delete player: <cite>' . Html::Encode($this->player->GetName()) . '</cite>');
if ($this->player->GetPlayerRole() != Player::PLAYER) {
?>
Sorry, an extras player can't be deleted.<?php
return;
}
if ($this->b_deleted) {
echo "<p>" . Html::Encode($this->player->GetName()) . "'s information has been deleted.</p>\n\t\t\t<p><a href=\"" . Html::Encode($this->player->Team()->GetPlayersNavigateUrl()) . "\">List players for " . Html::Encode($this->player->Team()->GetName()) . "</a></p>";
} else {
$has_permission = AuthenticationManager::GetUser()->Permissions()->HasPermission(PermissionType::MANAGE_PLAYERS);
if ($has_permission) {
$s_detail = $this->player->GetName() . " has ";
switch ($this->player->GetTotalMatches()) {
case 0:
$s_detail .= "not played any matches";
break;
case 1:
$s_detail .= "played one match";
break;
default:
$s_detail .= "played " . $this->player->GetTotalMatches() . " matches";
break;
}
$s_detail .= " for " . $this->player->Team()->GetName() . '. ';
echo new XhtmlElement('p', Html::Encode($s_detail));
?>
<p>Deleting a player cannot be undone. Their scores and performances
will be removed from all match scorecards and statistics.</p>
<p>Are you sure you want to delete this player?</p>
<form action="<?php
echo Html::Encode($this->player->GetDeleteUrl());
?>
" method="post"
class="deleteButtons">
<div><input type="submit" value="Delete player" 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->player->GetName());
$panel->AddLink("view this player", $this->player->GetPlayerUrl());
$panel->AddLink("rename this player", $this->player->GetEditUrl());
echo $panel;
} else {
?>
<p>Sorry, you can't delete a player unless you're responsible for
updating their team.</p>
<p><a href="<?php
echo Html::Encode($this->player->GetPlayerUrl());
?>
">Go back to <?php
echo Html::Encode($this->player->GetName());
?>
's
profile</a></p>
<?php
}
}
}
示例4: OnLoadPageData
public function OnLoadPageData()
{
# Always get the player's unfiltered profile, because it's needed for the page description
require_once "stoolball/player-manager.class.php";
$player_manager = new PlayerManager($this->GetSettings(), $this->GetDataConnection());
$player_manager->ReadPlayerById($this->player->GetId());
$this->player_unfiltered = $player_manager->GetFirst();
if (!$this->player_unfiltered instanceof Player) {
http_response_code(404);
$this->not_found = true;
return;
}
# Update search engine
if ($this->player_unfiltered->GetSearchUpdateRequired()) {
require_once "search/player-search-adapter.class.php";
$this->SearchIndexer()->DeleteFromIndexById("player" . $this->player->GetId());
$adapter = new PlayerSearchAdapter($this->player_unfiltered);
$this->SearchIndexer()->Index($adapter->GetSearchableItem());
$this->SearchIndexer()->CommitChanges();
$player_manager->SearchUpdated($this->player->GetId());
}
unset($player_manager);
# Check first for a player created using 'add player', who hasn't played yet
if ($this->player_unfiltered->GetTotalMatches() == 0) {
$this->player = $this->player_unfiltered;
} else {
# Now get statistics for the player
$statistics_manager = new StatisticsManager($this->GetSettings(), $this->GetDataConnection());
$statistics_manager->FilterByPlayer(array($this->player->GetId()));
# Apply filters common to all statistics
$this->filter_control = new StatisticsFilterControl();
$filter_batting_position = StatisticsFilter::SupportBattingPositionFilter($statistics_manager);
$this->filter_control->SupportBattingPositionFilter($filter_batting_position);
$this->filter .= $filter_batting_position[2];
$filter_match_type = StatisticsFilter::SupportMatchTypeFilter($statistics_manager);
$this->filter_control->SupportMatchTypeFilter($filter_match_type);
$this->filter .= $filter_match_type[2];
$filter_opposition = StatisticsFilter::SupportOppositionFilter($statistics_manager);
$this->filter_control->SupportOppositionFilter($filter_opposition);
$this->filter .= $filter_opposition[2];
$filter_competition = StatisticsFilter::SupportCompetitionFilter($statistics_manager);
$this->filter_control->SupportCompetitionFilter($filter_competition);
$this->filter .= $filter_competition[2];
$this->filter .= StatisticsFilter::ApplySeasonFilter($this->GetSettings(), $this->GetDataConnection(), $statistics_manager);
$filter_ground = StatisticsFilter::SupportGroundFilter($statistics_manager);
$this->filter_control->SupportGroundFilter($filter_ground);
$this->filter .= $filter_ground[2];
$filter_date = StatisticsFilter::SupportDateFilter($statistics_manager);
if (!is_null($filter_date[0])) {
$this->filter_control->SupportAfterDateFilter($filter_date[0]);
}
if (!is_null($filter_date[1])) {
$this->filter_control->SupportBeforeDateFilter($filter_date[1]);
}
$this->filter .= $filter_date[2];
$filter_innings = StatisticsFilter::SupportInningsFilter($statistics_manager);
$this->filter_control->SupportInningsFilter($filter_innings[1]);
$this->filter .= $filter_innings[2];
$filter_won_match = StatisticsFilter::SupportMatchResultFilter($statistics_manager);
$this->filter_control->SupportMatchResultFilter($filter_won_match[1]);
$this->filter .= $filter_won_match[2];
# Now get the statistics for the player
$data = $statistics_manager->ReadPlayerSummary();
if (count($data)) {
$this->player = $data[0];
} else {
if ($this->filter) {
# If no matches matched the filter, ensure we have the player's name and team
$this->player = $this->player_unfiltered;
$this->filter_matched_nothing = true;
} else {
$this->regenerating = true;
}
}
$data = $statistics_manager->ReadBestBattingPerformance(false);
foreach ($data as $performance) {
$batting = new Batting($this->player, $performance["how_out"], null, null, $performance["runs_scored"], $performance["balls_faced"]);
$this->player->Batting()->Add($batting);
}
if ($this->player->GetPlayerRole() == Player::PLAYER) {
$data = $statistics_manager->ReadBestPlayerAggregate("player_of_match");
$this->player->SetTotalPlayerOfTheMatchNominations(count($data) ? $data[0]["statistic"] : 0);
}
unset($statistics_manager);
}
}