function OnPostback()
 {
     # Get the item info and store it
     $id = $this->manager->GetItemId($this->data_object);
     $this->data_object = $this->manager->ReadRoleById($id);
     # Check whether cancel was clicked
     if (isset($_POST['cancel'])) {
         $this->Redirect("roles.php");
     }
     # Check whether delete was clicked
     if (isset($_POST['delete'])) {
         # Delete it
         $this->manager->DeleteRole($id);
         # Note success
         $this->deleted = true;
     }
 }
 /**
  * @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();
 }