/** * Creates a SeasonEditControl * * @param SiteSettings $o_settings */ public function __construct(SiteSettings $o_settings) { # set up element $this->SetDataObjectClass('Season'); parent::__construct($o_settings); # set up aggregated editors $this->match_types_editor = new RelatedIdEditor($o_settings, $this, 'MatchType', 'Match types', array('Type of match'), 'IdValue', false, 'GetId', 'SetId', 'GetValue'); $this->match_types_editor->SetMinimumItems(1); $this->match_types_editor->SetPossibleDataObjects(array(new IdValue(MatchType::CUP, ucfirst(MatchType::Text(MatchType::CUP))), new IdValue(MatchType::FRIENDLY, ucfirst(MatchType::Text(MatchType::FRIENDLY))), new IdValue(MatchType::LEAGUE, ucfirst(MatchType::Text(MatchType::LEAGUE))), new IdValue(MatchType::PRACTICE, ucfirst(MatchType::Text(MatchType::PRACTICE))), new IdValue(MatchType::TOURNAMENT, ucfirst(MatchType::Text(MatchType::TOURNAMENT))))); #$this->match_types_editor->SetValuesToExclude(array(MatchType::TournamentMatch())); # Tournament match is implied by Tournament $this->adjustments_editor = new PointsAdjustmentsEditor($o_settings, $this, 'Points', 'Points adjustments', array('Points', 'Awarded or deducted', 'Team', 'Reason')); $this->teams_editor = new TeamsInSeasonEditor($o_settings, $this, 'Team', 'Teams', array('Team', 'Withdrawn')); # initialise arrays $this->result_types = array(new MatchResult(MatchResult::HOME_WIN), new MatchResult(MatchResult::AWAY_WIN), new MatchResult(MatchResult::HOME_WIN_BY_FORFEIT), new MatchResult(MatchResult::AWAY_WIN_BY_FORFEIT), new MatchResult(MatchResult::TIE), new MatchResult(MatchResult::POSTPONED), new MatchResult(MatchResult::CANCELLED), new MatchResult(MatchResult::ABANDONED)); }
/** * Sets the security roles to which the user could belong * @param $roles Role[] */ public function SetRoles($roles) { $this->roles_editor->SetPossibleDataObjects($roles); }