public function OnLoadPageData()
 {
     # get player
     if (!is_object($this->player)) {
         $id = $this->player_manager->GetItemId($this->player);
         if ($id) {
             $this->player_manager->ReadPlayerById($id);
             $this->player = $this->player_manager->GetFirst();
         }
     }
     # tidy up
     unset($this->player_manager);
 }
 public function OnPageInit()
 {
     # Create the editor and manager
     $this->player_manager = new PlayerManager($this->GetSettings(), $this->GetDataConnection());
     $this->editor = new PlayerEditor($this->GetSettings());
     $this->editor->SetAllowCancel(true);
     $this->RegisterControlForValidation($this->editor);
     # Get player to edit
     $this->player = new Player($this->GetSettings());
     $this->player->SetId($this->player_manager->GetItemId());
     # If the team parameter is passed, that's a request to create a new player in a team
     if (isset($_GET['team']) and is_numeric($_GET['team'])) {
         $this->player->Team()->SetId($_GET['team']);
     }
 }