本文整理汇总了PHP中Match::AddAwayTeam方法的典型用法代码示例。如果您正苦于以下问题:PHP Match::AddAwayTeam方法的具体用法?PHP Match::AddAwayTeam怎么用?PHP Match::AddAwayTeam使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Match
的用法示例。
在下文中一共展示了Match::AddAwayTeam方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: OnPostback
function OnPostback()
{
# get object
$this->tournament = $this->editor->GetDataObject();
if ($this->editor->GetDataObjectId()) {
# Because this is a new request we need to reverify security details 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();
if ($check_match instanceof Match) {
# This page is only for tournaments, so check that against the db
$this->b_is_tournament = $check_match->GetMatchType() == MatchType::TOURNAMENT;
/* The editor requires the teams in the tournament to populate the dropdown and to come up with a
* match title, and it doesn't have them when recreating the tournament from the postback data.
* Since we have $check_match available from the database anyway, get the teams from there. */
foreach ($check_match->GetAwayTeams() as $team) {
$this->tournament->AddAwayTeam($team);
}
}
} else {
# Error for there being no match id on postback,
$this->b_is_tournament = false;
}
# Check whether cancel was clicked
if ($this->editor->CancelClicked()) {
$this->match_manager->ExpandMatchUrl($this->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_is_tournament) {
# Save the matches in the tournament
$this->match_manager->SaveMatchesInTournament($this->tournament);
$this->match_manager->NotifyMatchModerator($this->tournament->GetId());
$this->match_manager->ExpandMatchUrl($this->tournament);
http_response_code(303);
$this->Redirect($this->tournament->GetNavigateUrl());
}
}
}
示例2: BuildItems
/**
* Populates the collection of business objects from raw data
*
* @return bool
* @param MySqlRawData $o_result
*/
protected function BuildItems(MySqlRawData $o_result)
{
$this->Clear();
$o_match_builder = new CollectionBuilder();
$o_team_builder = new CollectionBuilder();
while ($o_row = $o_result->fetch()) {
if (!$o_match_builder->IsDone($o_row->match_id)) {
if (isset($o_match)) {
$this->Add($o_match);
$o_team_builder->Reset();
}
# create new
$o_match = new Match($this->GetSettings());
$o_match->SetId($o_row->match_id);
if (isset($o_row->start_time)) {
$o_match->SetStartTime($o_row->start_time);
}
if (isset($o_row->home_runs)) {
$o_match->Result()->SetHomeRuns($o_row->home_runs);
}
if (isset($o_row->away_runs)) {
$o_match->Result()->SetAwayRuns($o_row->away_runs);
}
if (isset($o_row->match_result_id)) {
$o_match->Result()->SetResultType($o_row->match_result_id);
}
if (isset($o_row->home_team_id) and !is_null($o_row->home_team_id)) {
$o_home = new Team($this->o_settings);
$o_home->SetId($o_row->home_team_id);
if (isset($o_row->home_team_name)) {
$o_home->SetName($o_row->home_team_name);
}
if (isset($o_row->home_short_url)) {
$o_home->SetShortUrl($o_row->home_short_url);
}
$o_match->SetHomeTeam($o_home);
unset($o_home);
}
if (isset($o_row->ground_id)) {
$o_ground = new Ground($this->GetSettings());
$o_ground->SetId($o_row->ground_id);
$o_match->SetGround($o_ground);
unset($o_ground);
}
}
# Add away teams
if (isset($o_row->away_team_id) && !$o_team_builder->IsDone($o_row->away_team_id)) {
$o_away = new Team($this->o_settings);
$o_away->SetId($o_row->away_team_id);
if (isset($o_row->away_team_name)) {
$o_away->SetName($o_row->away_team_name);
}
if (isset($o_row->away_short_url)) {
$o_away->SetShortUrl($o_row->away_short_url);
}
$o_match->AddAwayTeam($o_away);
unset($o_away);
}
}
# Add final match
if (isset($o_match)) {
$this->Add($o_match);
}
return true;
}
示例3: BuildPostedDataObject
/**
* Builds a match object containing the result information posted by the control
*
*/
public function BuildPostedDataObject()
{
$match = new Match($this->GetSettings());
$match->SetMatchType(MatchType::TOURNAMENT);
# Get match id
$s_key = $this->GetNamingPrefix() . 'item';
if (isset($_POST[$s_key])) {
$s_id = $_POST[$s_key];
if (strlen($s_id)) {
$match->SetId($s_id);
}
}
# Get the title
$s_key = $this->GetNamingPrefix() . 'Title';
if (isset($_POST[$s_key])) {
$match->SetTitle(strip_tags($_POST[$s_key]));
}
# Get the qualification type
$s_key = $this->GetNamingPrefix() . 'Qualify';
if (isset($_POST[$s_key])) {
$match->SetQualificationType($_POST[$s_key]);
}
# Get the player type
$s_key = $this->GetNamingPrefix() . 'PlayerType';
if (isset($_POST[$s_key])) {
$match->SetPlayerType($_POST[$s_key]);
}
$s_key = $this->GetNamingPrefix() . "Players";
if (isset($_POST[$s_key]) and strlen($_POST[$s_key])) {
$match->SetMaximumPlayersPerTeam($_POST[$s_key]);
}
# Get the number of overs
$s_key = $this->GetNamingPrefix() . "Overs";
if (isset($_POST[$s_key]) and strlen($_POST[$s_key])) {
$match->SetOvers($_POST[$s_key]);
}
# Get the short URL
$s_key = $this->GetNamingPrefix() . 'ShortUrl';
if (isset($_POST[$s_key])) {
$match->SetShortUrl($_POST[$s_key]);
}
# Get the start date
$s_key = $this->GetNamingPrefix() . 'Start';
$match->SetStartTime(DateControl::GetPostedTimestampUtc($s_key));
$match->SetIsStartTimeKnown(DateControl::GetIsTimePosted($s_key));
# Get the initial team
$team = new Team($this->GetSettings());
$s_key = $this->GetNamingPrefix() . 'ContextTeam';
if (isset($_POST[$s_key]) and strlen($_POST[$s_key])) {
$team->SetId($_POST[$s_key]);
$match->AddAwayTeam($team);
}
# Get the ground
$s_key = $this->GetNamingPrefix() . 'Ground';
if (isset($_POST[$s_key]) and strlen($_POST[$s_key])) {
$o_ground = new Ground($this->GetSettings());
$o_ground->SetId($_POST[$s_key]);
$match->SetGround($o_ground);
}
# Get the notes
$s_key = $this->GetNamingPrefix() . 'Notes';
if (isset($_POST[$s_key])) {
$match->SetNotes($_POST[$s_key]);
}
$this->SetDataObject($match);
}
开发者ID:stoolball-england,项目名称:stoolball-england-website,代码行数:70,代码来源:tournament-edit-control.class.php
示例4: BuildPostedDataObject
/**
* Builds a match object containing the result information posted by the control
*
*/
public function BuildPostedDataObject()
{
$match = new Match($this->GetSettings());
$match->SetMatchType(MatchType::TOURNAMENT);
# Get match id
$s_key = $this->GetNamingPrefix() . 'item';
if (isset($_POST[$s_key])) {
$s_id = $_POST[$s_key];
if (strlen($s_id)) {
$match->SetId($s_id);
}
}
# Get the title
$s_key = $this->GetNamingPrefix() . 'Title';
if (isset($_POST[$s_key])) {
$match->SetTitle(strip_tags($_POST[$s_key]));
}
# Get the start date, because it's part of the title that has to be recreated for an internal postback
$s_key = $this->GetNamingPrefix() . 'Start';
if (isset($_POST[$s_key])) {
$match->SetStartTime($_POST[$s_key]);
}
$s_key = $this->GetNamingPrefix() . "MaxTeams";
if (isset($_POST[$s_key])) {
$match->SetMaximumTeamsInTournament($_POST[$s_key]);
}
# Teams - get from aggregated editor
$this->EnsureAggregatedEditors();
$a_teams = $this->teams_editor->DataObjects()->GetItems();
foreach ($a_teams as $team) {
$match->AddAwayTeam($team);
}
$this->SetDataObject($match);
}
开发者ID:stoolball-england,项目名称:stoolball-england-website,代码行数:38,代码来源:tournament-teams-control.class.php