本文整理汇总了PHP中Team::GetGround方法的典型用法代码示例。如果您正苦于以下问题:PHP Team::GetGround方法的具体用法?PHP Team::GetGround怎么用?PHP Team::GetGround使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Team
的用法示例。
在下文中一共展示了Team::GetGround方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
/**
* Create new TeamNameControl
* @param Team $team
* @param string $container_element
*/
public function __construct(Team $team, $container_element)
{
parent::XhtmlElement($container_element);
$name = $team->GetName();
$type = is_null($team->GetPlayerType()) ? '' : PlayerType::Text($team->GetPlayerType());
if ($type and strpos(strtolower(str_replace("'", '', $name)), strtolower(str_replace("'", '', $type))) !== false) {
$type = "";
}
$town = (is_null($team->GetGround()) or is_null($team->GetGround()->GetAddress())) ? "" : $team->GetGround()->GetAddress()->GetTown();
if ($town and strpos(strtolower($name), strtolower($town)) !== false) {
$town = "";
}
if ($type or $town) {
$html = '<span property="schema:name">' . htmlentities($name, ENT_QUOTES, "UTF-8", false) . '</span>';
if ($town) {
$html .= htmlentities(", {$town}", ENT_QUOTES, "UTF-8", false);
}
if ($type) {
$html .= htmlentities(" ({$type})", ENT_QUOTES, "UTF-8", false);
}
$this->AddControl($html);
} else {
$this->AddAttribute("property", "schema:name");
$this->AddControl(htmlentities($name, ENT_QUOTES, "UTF-8", false));
}
}
示例2: __construct
public function __construct(Team $team)
{
$this->team = $team;
$this->searchable = new SearchItem();
$this->searchable->SearchItemId("team" . $team->GetId());
$this->searchable->SearchItemType("team");
$this->searchable->Url($team->GetNavigateUrl());
$this->searchable->Title($team->GetNameAndType());
$this->searchable->Description($this->GetSearchDescription());
$this->searchable->WeightOfType(1000);
$keywords = array($team->GetName(), $team->GetGround()->GetAddress()->GetLocality(), $team->GetGround()->GetAddress()->GetTown());
$this->searchable->Keywords(implode(" ", $keywords));
$content = array($team->GetGround()->GetAddress()->GetAdministrativeArea(), $team->GetIntro(), $team->GetPlayingTimes(), $team->GetCost(), $team->GetContact());
$this->searchable->FullText(implode(" ", $content));
$this->searchable->RelatedLinksHtml('<ul>' . '<li><a href="' . $team->GetStatsNavigateUrl() . '">Statistics</a></li>' . '<li><a href="' . $team->GetPlayersNavigateUrl() . '">Players</a></li>' . '<li><a href="' . $team->GetCalendarNavigateUrl() . '">Match calendar</a></li>' . '</ul>');
}
示例3: CreateFixtureControls
//.........这里部分代码省略.........
$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);
}
$season_start_year = $this->context_season->GetStartYear();
$season_end_year = $this->context_season->GetEndYear();
if ($season_start_year) {
$o_date->SetYearStart($season_start_year);
}
if ($season_end_year) {
$o_date->SetYearEnd($season_end_year);
}
}
$o_date_part = new FormPart('When?', $o_date);
$o_date_part->SetIsFieldset(true);
$match_box->AddControl($o_date_part);
# Where?
$o_ground_list = new XhtmlSelect($this->GetNamingPrefix() . 'Ground');
$o_ground_list->AddControl(new XhtmlOption("Don't know", -1));
$o_ground_list->AddControl(new XhtmlOption('Not listed (type the address in the notes field)', -2));
# Promote the most likely grounds to the top of the list
$likely_ground_ids = array();
if ($match->GetGroundId()) {
$likely_ground_ids[] = $match->GetGroundId();
}
foreach ($this->probable_teams as $o_team) {
$likely_ground_ids[] = $o_team->GetGround()->GetId();
}
if (isset($this->context_season)) {
foreach ($this->context_season->GetTeams() as $o_team) {
$likely_ground_ids[] = $o_team->GetGround()->GetId();
}
}
if (isset($this->context_team) and is_object($this->context_team->GetGround())) {
$likely_ground_ids[] = $this->context_team->GetGround()->GetId();
}
$likely_grounds = array();
$a_other_grounds = array();
/* @var $o_ground Ground */
foreach ($this->grounds->GetItems() as $o_ground) {
if (array_search($o_ground->GetId(), $likely_ground_ids) > -1) {
$likely_grounds[] = $o_ground;
} else {
$a_other_grounds[] = $o_ground;
}
}
# Add home grounds
foreach ($likely_grounds as $o_ground) {
$option = new XhtmlOption($o_ground->GetNameAndTown(), $o_ground->GetId());
$option->SetGroupName('Likely grounds');
$o_ground_list->AddControl($option);
}
# Add away grounds
foreach ($a_other_grounds as $o_ground) {
$option = new XhtmlOption($o_ground->GetNameAndTown(), $o_ground->GetId());
$option->SetGroupName('Other grounds');
$o_ground_list->AddControl($option);
}
# Select ground
if ($match->GetGroundId()) {
$o_ground_list->SelectOption($match->GetGroundId());
} elseif (isset($this->context_team)) {
$o_ground_list->SelectOption($this->context_team->GetGround()->GetId());
}
$o_ground_part = new FormPart('Where?', $o_ground_list);
$match_box->AddControl($o_ground_part);
# Notes
$o_notes = new TextBox($this->GetNamingPrefix() . 'Notes', $match->GetNotes());
$o_notes->SetMode(TextBoxMode::MultiLine());
$o_notes_part = new FormPart('Notes<br />(remember to include contact details)', $o_notes);
$match_box->AddControl($o_notes_part);
# Remember short URL
$o_short_url = new TextBox($this->GetNamingPrefix() . 'ShortUrl', $match->GetShortUrl());
$o_short_url->SetMode(TextBoxMode::Hidden());
$match_box->AddControl($o_short_url);
# Note the context team to be added to the tournament by default
if (isset($this->context_team)) {
$context_team_box = new TextBox($this->GetNamingPrefix() . 'ContextTeam', $this->context_team->GetId());
$context_team_box->SetMode(TextBoxMode::Hidden());
$match_box->AddControl($context_team_box);
}
# Change Save button to "Next" button
if ($this->show_step_number) {
$this->SetButtonText('Next »');
}
}
开发者ID:stoolball-england,项目名称:stoolball-england-website,代码行数:101,代码来源:tournament-edit-control.class.php
示例4: AnalyseMatchData
/**
* Analyses supplied match data and makes relevant statistics available
*
* @param Match[] $data
* @param Team $context_team
*/
public function AnalyseMatchData($data, Team $context_team)
{
foreach ($data as $match) {
/* @var $match Match */
$season_dates = Season::SeasonDates($match->GetStartTime());
$season_key = date('Y', $season_dates[0]);
if ($season_key == date('Y', $season_dates[1])) {
# For summer stats, use the ground the match is played at rather than the team
# role to decide whether it's a home match.
# In this case we're interested in home advantage, which applies whether you're
# the team paying for the pitch or not.
$at_home = $context_team->GetGround()->GetId() == $match->GetGroundId();
$swap_home_away_role = ($context_team->GetId() == $match->GetHomeTeamId()) != $at_home;
} else {
# Winter seasons span two years, so add second year to key
$season_key .= "/" . date('y', $season_dates[1]);
# For winter it's simpler - just use the team role. Teams are rarely down to play
# at their home ground because they all
# play "away" at a leisure centre. Using the rules above ends up with teams
# getting the stats which belong to their opponents.
$at_home = $context_team->GetId() == $match->GetHomeTeamId();
$swap_home_away_role = false;
}
//$at_home = ($context_team->GetId() == $match->GetHomeTeamId());
//$swap_home_away_role = false;
if (!in_array($season_key, $this->seasons)) {
$this->seasons[] = $season_key;
}
if ($match->Result()->GetIsHomeWin() and !$swap_home_away_role or $match->Result()->GetIsAwayWin() and $swap_home_away_role) {
if ($at_home) {
if (!array_key_exists($season_key, $this->home_wins)) {
$this->home_wins[$season_key] = array();
}
$this->home_wins[$season_key][] = $match;
# Note the opponents played, and the results achieved against them
$opponent = $swap_home_away_role ? $match->GetHomeTeam() : $match->GetAwayTeam();
$this->EnsureTeamArray($season_key, $opponent);
$this->opponents[$season_key][$opponent->GetId()]['matches']++;
$this->opponents[$season_key][$opponent->GetId()]['wins']++;
} else {
if (!array_key_exists($season_key, $this->away_losses)) {
$this->away_losses[$season_key] = array();
}
$this->away_losses[$season_key][] = $match;
# Note the opponents played, and the results achieved against them
$opponent = $swap_home_away_role ? $match->GetAwayTeam() : $match->GetHomeTeam();
$this->EnsureTeamArray($season_key, $opponent);
$this->opponents[$season_key][$opponent->GetId()]['matches']++;
$this->opponents[$season_key][$opponent->GetId()]['losses']++;
}
} else {
if ($match->Result()->GetIsAwayWin() and !$swap_home_away_role or $match->Result()->GetIsHomeWin() and $swap_home_away_role) {
if ($at_home) {
if (!array_key_exists($season_key, $this->home_losses)) {
$this->home_losses[$season_key] = array();
}
$this->home_losses[$season_key][] = $match;
# Note the opponents played, and the results achieved against them
$opponent = $swap_home_away_role ? $match->GetHomeTeam() : $match->GetAwayTeam();
$this->EnsureTeamArray($season_key, $opponent);
$this->opponents[$season_key][$opponent->GetId()]['matches']++;
$this->opponents[$season_key][$opponent->GetId()]['losses']++;
} else {
if (!array_key_exists($season_key, $this->away_wins)) {
$this->away_wins[$season_key] = array();
}
$this->away_wins[$season_key][] = $match;
# Note the opponents played, and the results achieved against them
$opponent = $swap_home_away_role ? $match->GetAwayTeam() : $match->GetHomeTeam();
$this->EnsureTeamArray($season_key, $opponent);
$this->opponents[$season_key][$opponent->GetId()]['matches']++;
$this->opponents[$season_key][$opponent->GetId()]['wins']++;
}
} else {
if ($match->Result()->GetIsEqualResult()) {
if ($at_home) {
if (!array_key_exists($season_key, $this->home_equal_results)) {
$this->home_equal_results[$season_key] = array();
}
$this->home_equal_results[$season_key][] = $match;
# Note the opponents played, and the results achieved against them
$opponent = $swap_home_away_role ? $match->GetHomeTeam() : $match->GetAwayTeam();
$this->EnsureTeamArray($season_key, $opponent);
$this->opponents[$season_key][$opponent->GetId()]['matches']++;
$this->opponents[$season_key][$opponent->GetId()]['equal']++;
} else {
if (!array_key_exists($season_key, $this->away_equal_results)) {
$this->away_equal_results[$season_key] = array();
}
$this->away_equal_results[$season_key][] = $match;
# Note the opponents played, and the results achieved against them
$opponent = $swap_home_away_role ? $match->GetAwayTeam() : $match->GetHomeTeam();
$this->EnsureTeamArray($season_key, $opponent);
$this->opponents[$season_key][$opponent->GetId()]['matches']++;
//.........这里部分代码省略.........
开发者ID:stoolball-england,项目名称:stoolball-england-website,代码行数:101,代码来源:statistics-calculator.class.php
示例5: CreateControls
//.........这里部分代码省略.........
$o_match_box->AddControl($o_away_part);
if ($b_got_home) {
$o_home_list->SelectOption($o_match->GetHomeTeamId());
}
if (!$b_got_home and $b_is_new_match) {
// if no home team data, select the first team by default
// unless editing a match, in which case it may be correct to have no teams (eg cup final)
$o_home_list->SelectIndex($first_real_team_index);
}
if (!$b_got_away and $b_is_new_match) {
// if no away team data, select the second team as the away team so that it's not the same as the first
// unless editing a match, in which case it may be correct to have no teams (eg cup final).
$o_away_list->SelectIndex($first_real_team_index + 1);
// if there was a home team but not an away team, make sure we don't select the home team against itself
if ($b_got_home and $o_away_list->GetSelectedValue() == (string) $o_match->GetHomeTeamId()) {
$o_away_list->SelectIndex($first_real_team_index);
}
} else {
if ($b_got_away) {
$o_away_list->SelectOption($o_match->GetAwayTeamId());
}
if (!$b_is_new_match) {
# Note which away team was previously saved, even if it's "not known" - this is for JavaScript to know it shouldn't auto-change the away team
$away_saved = new TextBox($this->GetNamingPrefix() . 'SavedAway', $o_match->GetAwayTeamId());
$away_saved->SetMode(TextBoxMode::Hidden());
$o_match_box->AddControl($away_saved);
unset($away_saved);
}
}
}
# Where?
# If tournament match, assume same ground as tournament. Otherwise ask the user for ground.
if ($b_is_tournament_match) {
$ground = new TextBox($this->GetNamingPrefix() . 'Ground', $this->tournament->GetGroundId() ? $this->tournament->GetGroundId() : $o_match->GetGroundId());
$ground->SetMode(TextBoxMode::Hidden());
$o_match_box->AddControl($ground);
} else {
$o_ground_list = new XhtmlSelect($this->GetNamingPrefix() . 'Ground');
$o_ground_list->AddControl(new XhtmlOption("Don't know", -1));
$o_ground_list->AddControl(new XhtmlOption('Not listed (type the address in the notes field)', -2));
# Promote home grounds for this season to the top of the list
$a_home_ground_ids = array();
foreach ($this->a_teams as $teams) {
foreach ($teams as $o_team) {
$a_home_ground_ids[$o_team->GetId()] = $o_team->GetGround()->GetId();
}
}
$a_home_grounds = array();
$a_other_grounds = array();
/* @var $o_ground Ground */
foreach ($this->a_grounds as $o_ground) {
if (array_search($o_ground->GetId(), $a_home_ground_ids) > -1) {
$a_home_grounds[] = $o_ground;
} else {
$a_other_grounds[] = $o_ground;
}
}
# Add home grounds
foreach ($a_home_grounds as $o_ground) {
$option = new XhtmlOption($o_ground->GetNameAndTown(), $o_ground->GetId());
$option->SetGroupName('Home grounds');
$o_ground_list->AddControl($option);
}
# Add away grounds
foreach ($a_other_grounds as $o_ground) {
$option = new XhtmlOption($o_ground->GetNameAndTown(), $o_ground->GetId());
开发者ID:stoolball-england,项目名称:stoolball-england-website,代码行数:67,代码来源:match-fixture-edit-control.class.php
示例6: BuildItems
//.........这里部分代码省略.........
if (isset($o_row->website)) {
$o_competition->SetWebsiteUrl($o_row->website);
}
if (isset($o_row->short_url)) {
$o_competition->SetShortUrl($o_row->short_url);
}
if (isset($o_row->active)) {
$o_competition->SetIsActive($o_row->active);
}
if (isset($o_row->players_per_team)) {
$o_competition->SetMaximumPlayersPerTeam($o_row->players_per_team);
}
if (isset($o_row->overs)) {
$o_competition->SetOvers($o_row->overs);
}
$o_competition->SetPlayerType($o_row->player_type_id);
if (isset($o_row->update_search) and $o_row->update_search == 1) {
$o_competition->SetSearchUpdateRequired();
}
if (isset($o_row->category_id) && !is_null($o_row->category_id)) {
$cat = new Category();
$cat->SetId($o_row->category_id);
if (isset($o_row->category_name)) {
$cat->SetName($o_row->category_name);
}
if (isset($o_row->code)) {
$cat->SetUrl($o_row->code);
}
$o_competition->SetCategory($cat);
}
}
# Seasons are the first cause of multiple rows (first in sort order after competition)
if (isset($o_row->season_id)) {
if (!$o_season_builder->IsDone($o_row->season_id)) {
if ($o_season != null) {
$o_competition->AddSeason($o_season, true);
}
$o_season = new Season($this->o_settings);
$o_season->SetId($o_row->season_id);
$o_season->SetName($o_row->season_name);
$o_season->SetIsLatest($o_row->is_latest);
$o_season->SetStartYear($o_row->start_year);
$o_season->SetEndYear($o_row->end_year);
if (isset($o_row->season_intro)) {
$o_season->SetIntro($o_row->season_intro);
}
if (isset($o_row->results)) {
$o_season->SetResults($o_row->results);
}
if (isset($o_row->show_table)) {
$o_season->SetShowTable($o_row->show_table);
}
if (isset($o_row->show_runs_scored)) {
$o_season->SetShowTableRunsScored($o_row->show_runs_scored);
}
if (isset($o_row->show_runs_conceded)) {
$o_season->SetShowTableRunsConceded($o_row->show_runs_conceded);
}
if (isset($o_row->season_short_url)) {
$o_season->SetShortUrl($o_row->season_short_url);
}
}
# Team only present if there is a season
if (isset($o_row->team_id)) {
if (!$o_team_builder->IsDone($o_row->team_id)) {
if (isset($o_team)) {
unset($o_team);
}
$o_team = new Team($this->GetSettings());
$o_team->SetId($o_row->team_id);
$o_team->SetName($o_row->team_name);
$o_team->GetGround()->SetId($o_row->ground_id);
if (isset($o_row->team_short_url)) {
$o_team->SetShortUrl($o_row->team_short_url);
}
$o_season->AddTeam($o_team);
if (isset($o_row->withdrawn_league) and (bool) $o_row->withdrawn_league) {
$o_season->TeamsWithdrawnFromLeague()->Add($o_team);
}
}
# Points adjustments - should come with team and in order of team
if (isset($o_row->point_id) and !$o_points_builder->IsDone($o_row->point_id)) {
$o_point = new PointsAdjustment($o_row->point_id, $o_row->points, $o_team, $o_row->reason, $o_row->points_date);
$o_season->PointsAdjustments()->Add($o_point);
}
}
# Match types come with a season
if (isset($o_row->match_type) and !$o_matchtype_builder->IsDone($o_row->match_type)) {
$o_season->MatchTypes()->Add((int) $o_row->match_type);
}
}
}
# store final competition
if ($o_competition != null) {
if ($o_season != null) {
$o_competition->AddSeason($o_season, true);
}
$this->Add($o_competition);
}
}