本文整理汇总了PHP中Team::SetId方法的典型用法代码示例。如果您正苦于以下问题:PHP Team::SetId方法的具体用法?PHP Team::SetId怎么用?PHP Team::SetId使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Team
的用法示例。
在下文中一共展示了Team::SetId方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: OnSiteInit
function OnSiteInit()
{
parent::OnSiteInit();
# check parameter
if (isset($_GET['season']) and is_numeric($_GET['season'])) {
$this->i_season_id = (int) $_GET['season'];
} else {
if (isset($_POST['Season']) and is_numeric($_POST['Season'])) {
$this->i_season_id = (int) $_POST['Season'];
}
}
if (isset($_GET['type']) and is_numeric($_GET['type'])) {
$this->i_match_type = (int) $_GET['type'];
} else {
if (isset($_POST['MatchType']) and is_numeric($_POST['MatchType'])) {
$this->i_match_type = (int) $_POST['MatchType'];
} else {
$this->i_match_type = MatchType::FRIENDLY;
}
}
if (isset($_GET['team']) and is_numeric($_GET['team'])) {
$this->team = new Team($this->GetSettings());
$this->team->SetId($_GET['team']);
} else {
if (isset($_POST['team']) and is_numeric($_POST['team'])) {
$this->team = new Team($this->GetSettings());
$this->team->SetId($_POST['team']);
}
}
if (!isset($this->i_season_id) and !$this->team instanceof Team) {
$this->Abort();
}
}
示例2: OnPageInit
public function OnPageInit()
{
# Get team to display players for
if (!isset($_GET['team']) or !is_numeric($_GET['team'])) {
$this->Redirect();
}
$this->team = new Team($this->GetSettings());
$this->team->SetId($_GET['team']);
}
示例3: OnSiteInit
function OnSiteInit()
{
parent::OnSiteInit();
# check parameter
if (isset($_GET['season']) and is_numeric($_GET['season'])) {
$this->season = new Season($this->GetSettings());
$this->season->SetId((int) $_GET['season']);
}
if (isset($_GET['team']) and is_numeric($_GET['team'])) {
$this->team = new Team($this->GetSettings());
$this->team->SetId($_GET['team']);
}
}
示例4: BuildPostedItem
/**
* Re-build from data posted by this control a single data object which this control is editing
*
* @param int $i_counter
* @param int $i_id
*/
protected function BuildPostedItem($i_counter = null, $i_id = null)
{
$s_key = $this->GetNamingPrefix() . 'Team' . $i_counter;
$team = new Team($this->GetSettings());
if (isset($_POST[$s_key]) and is_numeric($_POST[$s_key])) {
$team->SetId($_POST[$s_key]);
}
$s_key = $this->GetNamingPrefix() . 'TeamValue' . $i_counter;
if (isset($_POST[$s_key])) {
$team->SetName($_POST[$s_key]);
}
# Infer player type from name
if (stristr($team->GetName(), "ladies")) {
$team->SetPlayerType(PlayerType::LADIES);
} else {
if (stristr($team->GetName(), "mixed")) {
$team->SetPlayerType(PlayerType::MIXED);
} else {
if (stristr($team->GetName(), "Junior mixed")) {
$team->SetPlayerType(PlayerType::JUNIOR_MIXED);
} else {
if (stristr($team->GetName(), "junior") or stristr($team->GetName(), "girls")) {
$team->SetPlayerType(PlayerType::GIRLS);
}
}
}
}
if ($team->GetId() or $team->GetName()) {
$this->DataObjects()->Add($team);
} else {
$this->IgnorePostedItem($i_counter);
}
}
开发者ID:stoolball-england,项目名称:stoolball-england-website,代码行数:39,代码来源:teams-in-tournament-editor.class.php
示例5: BuildPostedItem
/**
* Re-build from data posted by this control a single data object which this control is editing
*
* @param int $i_counter
* @param int $i_id
*/
protected function BuildPostedItem($i_counter = null, $i_id = null)
{
$match = new Match($this->GetSettings());
$match->SetMatchType(MatchType::TOURNAMENT_MATCH);
$key = $this->GetNamingPrefix() . 'MatchId' . $i_counter;
if (isset($_POST[$key]) and is_numeric($_POST[$key])) {
$match->SetId($_POST[$key]);
}
$key = $this->GetNamingPrefix() . 'MatchOrder' . $i_counter;
if (isset($_POST[$key]) and is_numeric($_POST[$key])) {
$match->SetOrderInTournament($_POST[$key]);
}
$key = $this->GetNamingPrefix() . 'MatchIdValue' . $i_counter;
if (isset($_POST[$key])) {
$match->SetTitle($_POST[$key]);
}
$key = $this->GetNamingPrefix() . 'HomeTeamId' . $i_counter;
if (isset($_POST[$key]) and $_POST[$key]) {
$team = new Team($this->GetSettings());
$team->SetId($_POST[$key]);
$match->SetHomeTeam($team);
}
$key = $this->GetNamingPrefix() . 'AwayTeamId' . $i_counter;
if (isset($_POST[$key]) and $_POST[$key]) {
$team = new Team($this->GetSettings());
$team->SetId($_POST[$key]);
$match->SetAwayTeam($team);
}
if ($match->GetId() or $match->GetHomeTeamId() and $match->GetAwayTeamId()) {
$this->DataObjects()->Add($match);
} else {
$this->IgnorePostedItem($i_counter);
}
}
开发者ID:stoolball-england,项目名称:stoolball-england-website,代码行数:40,代码来源:matches-in-tournament-editor.class.php
示例6: BuildPostedItem
/**
* Re-build from data posted by this control a single data object which this control is editing
*
* @param int $i_counter
* @param int $i_id
*/
protected function BuildPostedItem($i_counter = null, $i_id = null)
{
$s_key = $this->GetNamingPrefix() . 'Points' . $i_counter;
$s_award_key = $this->GetNamingPrefix() . 'Awarded' . $i_counter;
$i_points = (int) (isset($_POST[$s_key]) and is_numeric($_POST[$s_key])) ? $_POST[$s_key] : 0;
if (isset($_POST[$s_award_key]) and $_POST[$s_award_key] == '2') {
$i_points = $i_points - $i_points * 2;
}
$s_key = $this->GetNamingPrefix() . 'PointsTeam' . $i_counter;
$o_team = null;
$o_team = new Team($this->GetSettings());
if (isset($_POST[$s_key]) and is_numeric($_POST[$s_key])) {
$o_team->SetId($_POST[$s_key]);
}
$s_key = $this->GetNamingPrefix() . 'Reason' . $i_counter;
$s_reason = (isset($_POST[$s_key]) and strlen($_POST[$s_key]) <= 200) ? $_POST[$s_key] : '';
if ($i_points != 0 or $o_team->GetId() or $s_reason) {
$o_adjust = new PointsAdjustment($i_id, $i_points, $o_team, $s_reason);
$i_date = $this->BuildPostedItemModifiedDate($i_counter, $o_adjust);
$o_adjust->SetDate($i_date);
$this->DataObjects()->Add($o_adjust);
} else {
$this->IgnorePostedItem($i_counter);
}
}
开发者ID:stoolball-england,项目名称:stoolball-england-website,代码行数:31,代码来源:points-adjustments-editor.class.php
示例7: OnPostback
function OnPostback()
{
# get object
$this->team = $this->edit->GetDataObject();
# Check user has permission to edit this team. Authentication for team owners is based on the URI
# so make sure we get that from the database, not untrusted user input.
if ($this->team->GetId() and !AuthenticationManager::GetUser()->Permissions()->HasPermission(PermissionType::MANAGE_TEAMS)) {
$this->team_manager->ReadById(array($this->team->GetId()));
$check_team = $this->team_manager->GetFirst();
$this->team->SetShortUrl($check_team->GetShortUrl());
}
if ($this->team->GetId() and !AuthenticationManager::GetUser()->Permissions()->HasPermission(PermissionType::MANAGE_TEAMS, $this->team->GetLinkedDataUri()) or !$this->team->GetId() and !AuthenticationManager::GetUser()->Permissions()->HasPermission(PermissionType::MANAGE_TEAMS)) {
$this->GetAuthenticationManager()->GetPermission();
}
# save data if valid
if ($this->IsValid()) {
$i_id = $this->team_manager->SaveTeam($this->team);
$this->team->SetId($i_id);
$this->Redirect($this->team->GetNavigateUrl());
}
}
示例8: BuildPostedItem
/**
* Re-build from data posted by this control a single data object which this control is editing
*
* @param int $i_counter
* @param int $i_id
*/
protected function BuildPostedItem($i_counter = null, $i_id = null)
{
$s_key = $this->GetNamingPrefix() . 'Team' . $i_counter;
$o_team = null;
$o_team = new Team($this->GetSettings());
if (isset($_POST[$s_key]) and is_numeric($_POST[$s_key])) {
$o_team->SetId($_POST[$s_key]);
}
$s_key = $this->GetNamingPrefix() . 'TeamValue' . $i_counter;
if (isset($_POST[$s_key])) {
$o_team->SetName($_POST[$s_key]);
}
$s_key = $this->GetNamingPrefix() . 'WithdrawnLeague' . $i_counter;
$b_withdrawn_league = (isset($_POST[$s_key]) and $_POST[$s_key] == '1');
if ($o_team->GetId() or $b_withdrawn_league) {
$team_in_season = new TeamInSeason($o_team, null, $b_withdrawn_league);
$this->DataObjects()->Add($team_in_season);
} else {
$this->IgnorePostedItem($i_counter);
}
}
开发者ID:stoolball-england,项目名称:stoolball-england-website,代码行数:27,代码来源:teams-in-season-editor.class.php
示例9: BuildPostedDataObject
/**
* @return void
* @desc Re-build from data posted by this control the data object this control is editing
*/
function BuildPostedDataObject()
{
$team = new Team($this->GetSettings());
if (isset($_POST['item'])) {
$team->SetId($_POST['item']);
}
if (isset($_POST['name'])) {
$team->SetName($_POST['name']);
}
$team->SetWebsiteUrl($_POST['websiteUrl']);
$team->SetIsActive(isset($_POST['playing']));
$team->SetIntro(ucfirst(trim($_POST['intro'])));
$team->SetPlayingTimes($_POST['times']);
$team->SetCost($_POST['yearCost']);
$team->SetContact($_POST['contact']);
$team->SetPrivateContact($_POST['private']);
$ground = new Ground($this->GetSettings());
$ground->SetId($_POST['ground']);
$team->SetGround($ground);
if (isset($_POST['team_type'])) {
$team->SetTeamType($_POST['team_type']);
if ($team->GetTeamType() == Team::SCHOOL_YEARS) {
$team->SetSchoolYears(array(1 => isset($_POST['year1']), 2 => isset($_POST['year2']), 3 => isset($_POST['year3']), 4 => isset($_POST['year4']), 5 => isset($_POST['year5']), 6 => isset($_POST['year6']), 7 => isset($_POST['year7']), 8 => isset($_POST['year8']), 9 => isset($_POST['year9']), 10 => isset($_POST['year10']), 11 => isset($_POST['year11']), 12 => isset($_POST['year12'])));
}
}
if ($this->is_admin) {
$team->SetShortUrl($_POST[$this->GetNamingPrefix() . 'ShortUrl']);
$team->SetPlayerType($_POST['playerType']);
if (isset($_POST['club']) and is_numeric($_POST['club'])) {
$club = new Club($this->GetSettings());
$club->SetId($_POST['club']);
$team->SetClub($club);
}
}
$this->SetDataObject($team);
}
示例10: Delete
/**
* @access public
* @return void
* @param int[] $a_ids
* @desc Delete from the db the Teams matching the supplied ids
*/
public function Delete($a_ids)
{
# check parameter
$this->ValidateNumericArray($a_ids);
if (!count($a_ids)) {
throw new Exception('No teams to delete');
}
$s_ids = join(', ', $a_ids);
# Get more information on the teams
$teams = array();
$s_sql = "SELECT team_id, short_url, owner_role_id FROM nsa_team WHERE team_id IN ({$s_ids})";
$result = $this->GetDataConnection()->query($s_sql);
while ($row = $result->fetch()) {
$team = new Team($this->GetSettings());
$team->SetId($row->team_id);
$team->SetShortUrl($row->short_url);
$team->SetOwnerRoleId($row->owner_role_id);
$teams[] = $team;
}
$result->closeCursor();
# Check that current user is an admin or a team owner
require_once "authentication/authentication-manager.class.php";
$user = AuthenticationManager::GetUser();
foreach ($teams as $team) {
/* @var $team Team */
if (!$user->Permissions()->HasPermission(PermissionType::MANAGE_TEAMS, $team->GetLinkedDataUri())) {
throw new Exception("Unauthorised");
}
}
# delete owner role
$authentication_manager = new AuthenticationManager($this->GetSettings(), $this->GetDataConnection(), null);
foreach ($teams as $team) {
/* @var $team Team */
if ($team->GetOwnerRoleId()) {
$authentication_manager->DeleteRole($team->GetOwnerRoleId());
}
}
unset($authentication_manager);
# delete from short URL cache
require_once 'http/short-url-manager.class.php';
$o_url_manager = new ShortUrlManager($this->GetSettings(), $this->GetDataConnection());
foreach ($teams as $team) {
/* @var $team Team */
$o_url_manager->Delete($team->GetShortUrl());
}
unset($o_url_manager);
# Delete relationships to matches
$s_match_link = $this->GetSettings()->GetTable('MatchTeam');
$s_sql = 'DELETE FROM ' . $s_match_link . ' WHERE team_id IN (' . $s_ids . ') ';
$this->GetDataConnection()->query($s_sql);
# Delete relationships to competitions
$s_season_link = $this->GetSettings()->GetTable('TeamSeason');
$s_sql = 'DELETE FROM ' . $s_season_link . ' WHERE team_id IN (' . $s_ids . ') ';
$this->GetDataConnection()->query($s_sql);
# Delete players
require_once "player-manager.class.php";
$player_manager = new PlayerManager($this->GetSettings(), $this->GetDataConnection());
$player_manager->ReadPlayersInTeam($a_ids);
$players = $player_manager->GetItems();
if (count($players)) {
$player_ids = array();
foreach ($players as $player) {
$player_ids[] = $player->GetId();
}
$player_manager->Delete($player_ids);
}
unset($player_manager);
# delete team(s)
$s_sql = 'DELETE FROM nsa_team WHERE team_id IN (' . $s_ids . ') ';
$this->GetDataConnection()->query($s_sql);
return $this->GetDataConnection()->GetAffectedRows();
}
示例11: BuildPostedDataObject
/**
* @return void
* @desc Re-build from data posted by this control the data object this control is editing
*/
function BuildPostedDataObject()
{
$match = new Match($this->GetSettings());
$match->SetId($this->GetDataObjectId());
# Get match date
$s_key = $this->GetNamingPrefix() . 'Date';
if (isset($_POST[$s_key]) and strlen($_POST[$s_key]) and is_numeric($_POST[$s_key])) {
$match->SetStartTime($_POST[$s_key]);
}
# Get team names
$s_key = $this->GetNamingPrefix() . 'Home';
if (isset($_POST[$s_key])) {
$team_data = explode(MatchHighlightsEditControl::DATA_SEPARATOR, $_POST[$s_key], 2);
if (count($team_data) == 2) {
$o_home = new Team($this->GetSettings());
$o_home->SetId($team_data[0]);
$o_home->SetName($team_data[1]);
$match->SetHomeTeam($o_home);
}
}
$s_key = $this->GetNamingPrefix() . 'Away';
if (isset($_POST[$s_key])) {
$team_data = explode(MatchHighlightsEditControl::DATA_SEPARATOR, $_POST[$s_key], 2);
if (count($team_data) == 2) {
$o_away = new Team($this->GetSettings());
$o_away->SetId($team_data[0]);
$o_away->SetName($team_data[1]);
$match->SetAwayTeam($o_away);
}
}
# Get the result
$s_key = $this->GetNamingPrefix() . 'Result';
if (isset($_POST[$s_key])) {
$s_result = $_POST[$s_key];
if (strlen($s_result)) {
$match->Result()->SetResultType($s_result);
}
}
# Get players of the match. Fields to use depend on which radio button was selected.
$s_key = $this->GetNamingPrefix() . 'POM';
if (isset($_POST[$s_key])) {
$pom_type = (int) $_POST[$s_key];
if ($pom_type == MatchHighlightsEditControl::PLAYER_OF_THE_MATCH_OVERALL) {
$s_key = $this->GetNamingPrefix() . 'Player';
if (isset($_POST[$s_key]) and $_POST[$s_key]) {
$player = new Player($this->GetSettings());
$player->SetName($_POST[$s_key]);
$s_key = $this->GetNamingPrefix() . 'PlayerTeam';
if (isset($_POST[$s_key])) {
$player->Team()->SetId($_POST[$s_key]);
}
$match->Result()->SetPlayerOfTheMatch($player);
}
} else {
if ($pom_type == MatchHighlightsEditControl::PLAYER_OF_THE_MATCH_HOME_AND_AWAY) {
$s_key = $this->GetNamingPrefix() . 'PlayerHome';
if (isset($_POST[$s_key]) and $_POST[$s_key]) {
$player = new Player($this->GetSettings());
$player->SetName($_POST[$s_key]);
$player->Team()->SetId($match->GetHomeTeamId());
$match->Result()->SetPlayerOfTheMatchHome($player);
}
$s_key = $this->GetNamingPrefix() . 'PlayerAway';
if (isset($_POST[$s_key]) and $_POST[$s_key]) {
$player = new Player($this->GetSettings());
$player->SetName($_POST[$s_key]);
$player->Team()->SetId($match->GetAwayTeamId());
$match->Result()->SetPlayerOfTheMatchAway($player);
}
}
}
}
$s_key = $this->GetNamingPrefix() . 'Comments';
if (isset($_POST[$s_key])) {
$match->SetNewComment($_POST[$s_key]);
}
$this->SetDataObject($match);
}
开发者ID:stoolball-england,项目名称:stoolball-england-website,代码行数:82,代码来源:match-highlights-edit-control.class.php
示例12: BuildItems
/**
* Populates the collection of business objects from raw data
*
* @return bool
* @param MySqlRawData $result
*/
protected function BuildItems(MySqlRawData $result)
{
# use CollectionBuilder to handle duplicates
$club_builder = new CollectionBuilder();
$club = null;
while ($row = $result->fetch()) {
# check whether this is a new club
if (!$club_builder->IsDone($row->club_id)) {
# store any exisiting club
if ($club != null) {
$this->Add($club);
}
# create the new club
$club = new Club($this->GetSettings());
$club->SetId($row->club_id);
$club->SetName($row->club_name);
$club->SetTypeOfClub($row->club_type);
$club->SetHowManyPlayers($row->how_many_players);
$club->SetAgeRangeLower($row->age_range_lower);
$club->SetAgeRangeUpper($row->age_range_upper);
$club->SetPlaysOutdoors($row->plays_outdoors);
$club->SetPlaysIndoors($row->plays_indoors);
$club->SetShortUrl($row->short_url);
$club->SetTwitterAccount($row->twitter);
$club->SetFacebookUrl($row->facebook);
$club->SetInstagramAccount($row->instagram);
$club->SetClubmarkAccredited($row->clubmark);
}
# team the only cause of multiple rows (so far) so add to current club
if ($row->team_id) {
$team = new Team($this->GetSettings());
$team->SetId($row->team_id);
$team->SetName($row->team_name);
$team->SetShortUrl($row->team_short_url);
$club->Add($team);
}
}
# store final club
if ($club != null) {
$this->Add($club);
}
}
示例13: BuildPostedScorecard
/**
* Builds data posted on pages 2/3 back into a match object
* @return Match
*/
private function BuildPostedScorecard()
{
$match = new Match($this->GetSettings());
$match->SetId($this->GetDataObjectId());
# Must have data on which team is which, otherwise none of the rest makes sense
# Team ids are essential for saving data, while team names and match title are
# purely so they can be redisplayed if the page is invalid
$key = "teams";
if (!isset($_POST[$key]) or strpos($_POST[$key], ScorecardEditControl::DATA_SEPARATOR) === false) {
return $match;
}
$teams = explode(ScorecardEditControl::DATA_SEPARATOR, $_POST[$key], 6);
if (count($teams) != 6) {
return $match;
}
switch ($teams[0]) {
case "0":
$match->Result()->SetHomeBattedFirst(false);
$home_batting = $this->GetCurrentPage() == 3;
break;
case "1":
$match->Result()->SetHomeBattedFirst(true);
$home_batting = $this->GetCurrentPage() == 2;
break;
default:
$home_batting = $this->GetCurrentPage() == 2;
}
$home_team = new Team($this->GetSettings());
$home_team->SetId($teams[1]);
$home_team->SetName($teams[2]);
$match->SetHomeTeam($home_team);
$away_team = new Team($this->GetSettings());
$away_team->SetId($teams[3]);
$away_team->SetName($teams[4]);
$match->SetAwayTeam($away_team);
$match->SetTitle($teams[5]);
# Read posted batting data
$key = "batRows";
if (isset($_POST[$key])) {
# This controls not only which fields are read, but also which are redisplayed on an invalid postback or for the next innings.
$match->SetMaximumPlayersPerTeam(intval($_POST[$key]));
}
for ($i = 1; $i <= $match->GetMaximumPlayersPerTeam(); $i++) {
$key = "batName{$i}";
if (isset($_POST[$key])) {
# The row exists - has it been filled in?
if (trim($_POST[$key])) {
# Read the batter data in this row
$player = new Player($this->GetSettings());
$player->SetName($_POST[$key]);
$player->Team()->SetId($home_batting ? $home_team->GetId() : $away_team->GetId());
$key = "batHowOut{$i}";
$how_out = (isset($_POST[$key]) and is_numeric($_POST[$key])) ? (int) $_POST[$key] : null;
$key = "batOutBy{$i}";
$dismissed_by = null;
if (isset($_POST[$key]) and trim($_POST[$key])) {
$dismissed_by = new Player($this->GetSettings());
$dismissed_by->SetName($_POST[$key]);
$dismissed_by->Team()->SetId($home_batting ? $away_team->GetId() : $home_team->GetId());
}
$key = "batBowledBy{$i}";
$bowler = null;
if (isset($_POST[$key]) and trim($_POST[$key])) {
$bowler = new Player($this->GetSettings());
$bowler->SetName($_POST[$key]);
$bowler->Team()->SetId($home_batting ? $away_team->GetId() : $home_team->GetId());
}
# Correct caught and bowled if marked as caught
if ($how_out == Batting::CAUGHT and !is_null($dismissed_by) and !is_null($bowler) and trim($dismissed_by->GetName()) == trim($bowler->GetName())) {
$how_out = Batting::CAUGHT_AND_BOWLED;
$dismissed_by = null;
}
$key = "batRuns{$i}";
$runs = (isset($_POST[$key]) and is_numeric($_POST[$key])) ? (int) $_POST[$key] : null;
$key = "batBalls{$i}";
$balls = (isset($_POST[$key]) and is_numeric($_POST[$key])) ? (int) $_POST[$key] : null;
# Add that batting performance to the match result
$batting = new Batting($player, $how_out, $dismissed_by, $bowler, $runs, $balls);
if ($home_batting) {
$match->Result()->HomeBatting()->Add($batting);
} else {
$match->Result()->AwayBatting()->Add($batting);
}
}
}
}
$key = "batByes";
if (isset($_POST[$key]) and is_numeric($_POST[$key])) {
$player = new Player($this->GetSettings());
$player->SetPlayerRole(Player::BYES);
$player->Team()->SetId($home_batting ? $home_team->GetId() : $away_team->GetId());
$batting = new Batting($player, null, null, null, (int) $_POST[$key]);
if ($home_batting) {
$match->Result()->HomeBatting()->Add($batting);
} else {
$match->Result()->AwayBatting()->Add($batting);
//.........这里部分代码省略.........
开发者ID:stoolball-england,项目名称:stoolball-england-website,代码行数:101,代码来源:scorecard-edit-control.class.php
示例14: 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
示例15: BuildPostedDataObject
/**
* Builds a match object containing the result information posted by the control
*
*/
public function BuildPostedDataObject()
{
$o_match = new Match($this->GetSettings());
$o_match->SetId($this->GetDataObjectId());
# Get match date
$s_key = $this->GetNamingPrefix() . 'Date';
if (isset($_POST[$s_key]) and strlen($_POST[$s_key]) and is_numeric($_POST[$s_key])) {
$o_match->SetStartTime($_POST[$s_key]);
}
# Get team names
$s_key = $this->GetNamingPrefix() . 'Home';
if (isset($_POST[$s_key])) {
$team_data = explode(";", $_POST[$s_key], 2);
if (count($team_data) == 2) {
$o_home = new Team($this->GetSettings());
$o_home->SetId($team_data[0]);
$o_home->SetName($team_data[1]);
$o_match->SetHomeTeam($o_home);
}
}
$s_key = $this->GetNamingPrefix() . 'Away';
if (isset($_POST[$s_key])) {
$team_data = explode(";", $_POST[$s_key], 2);
if (count($team_data) == 2) {
$o_away = new Team($this->GetSettings());
$o_away->SetId($team_data[0]);
$o_away->SetName($team_data[1]);
$o_match->SetAwayTeam($o_away);
}
}
# Get who batted first
$s_key = $this->GetNamingPrefix() . 'BatFirst';
if (isset($_POST[$s_key])) {
$s_batted = $_POST[$s_key];
if ($s_batted == 'home') {
$o_match->Result()->SetHomeBattedFirst(true);
} else {
if ($s_batted == 'away') {
$o_match->Result()->SetHomeBattedFirst(false);
}
}
}
# Get the result
$s_key = $this->GetNamingPrefix() . 'Result';
if (isset($_POST[$s_key])) {
$s_result = $_POST[$s_key];
if (strlen($s_result)) {
$o_match->Result()->SetResultType($s_result);
}
}
# Get the home score
$s_key = $this->GetNamingPrefix() . 'HomeRuns';
if (isset($_POST[$s_key])) {
$s_home_runs = $_POST[$s_key];
if (strlen($s_home_runs)) {
$o_match->Result()->SetHomeRuns($s_home_runs);
}
}
$s_key = $this->GetNamingPrefix() . 'HomeWickets';
if (isset($_POST[$s_key])) {
$s_home_wickets = $_POST[$s_key];
if (strlen($s_home_wickets)) {
$o_match->Result()->SetHomeWickets($s_home_wickets);
}
}
# Get the away score
$s_key = $this->GetNamingPrefix() . 'AwayRuns';
if (isset($_POST[$s_key])) {
$s_away_runs = $_POST[$s_key];
if (strlen($s_away_runs)) {
$o_match->Result()->SetAwayRuns($s_away_runs);
}
}
$s_key = $this->GetNamingPrefix() . 'AwayWickets';
if (isset($_POST[$s_key])) {
$s_away_wickets = $_POST[$s_key];
if (strlen($s_away_wickets)) {
$o_match->Result()->SetAwayWickets($s_away_wickets);
}
}
$s_key = $this->GetNamingPrefix() . 'Comments';
if (isset($_POST[$s_key])) {
$o_match->SetNewComment($_POST[$s_key]);
}
$this->SetDataObject($o_match);
}
开发者ID:stoolball-england,项目名称:stoolball-england-website,代码行数:90,代码来源:match-result-edit-control.class.php