コード例 #1
0
 function OnLoadPageData()
 {
     # new data manager
     $team_manager = new TeamManager($this->GetSettings(), $this->GetDataConnection());
     $team_manager->FilterByActive(true);
     # Check for player type
     $this->player_type = null;
     if (isset($_GET['player'])) {
         if ($_GET['player'] == "past") {
             $this->player_type = 0;
             $team_manager->FilterByActive(false);
         } else {
             $this->player_type = PlayerType::Parse($_GET['player']);
             $a_player_types = is_null($this->player_type) ? null : array($this->player_type);
             if ($this->player_type == PlayerType::JUNIOR_MIXED) {
                 $a_player_types[] = PlayerType::GIRLS;
                 $a_player_types[] = PlayerType::BOYS;
             }
             $team_manager->FilterByPlayerType($a_player_types);
         }
     }
     if (isset($_GET['area']) and $_GET["area"]) {
         $this->administrative_area = preg_replace('/[^a-z]/', "", strtolower($_GET['area']));
         if ($this->administrative_area) {
             $team_manager->FilterByAdministrativeArea(array($this->administrative_area));
         }
     }
     # Get the counties for the filter
     $this->areas = $team_manager->ReadAdministrativeAreas();
     if ($this->administrative_area) {
         # read all teams matching the applied filter
         $team_manager->ReadTeamSummaries();
         $this->teams = $team_manager->GetItems();
     }
     unset($team_manager);
 }