Beispiel #1
0
 function load()
 {
     parent::load();
     $allianceId = intval($this->data['alliance_id']);
     if ($allianceId == 0 || !$this->hasAllianceSetRoles() || !isset($_GET['uid'])) {
         exit(0);
         return null;
     }
     $uid = intval($_GET['uid']);
     $m = new AllianceModel();
     $this->allianceData = $m->getAllianceData($allianceId);
     if (!$this->isMemberOfAlliance($uid)) {
         exit(0);
         return null;
     }
     if ($this->isPost()) {
         $roleName = isset($_POST['a_titel']) ? $_POST['a_titel'] : '';
         if (trim($roleName) == '') {
             $roleName = '.';
         }
         $roleNumber = 0;
         if (isset($_POST['e1'])) {
             $roleNumber |= ALLIANCE_ROLE_SETROLES;
         }
         if (isset($_POST['e2'])) {
             $roleNumber |= ALLIANCE_ROLE_REMOVEPLAYER;
         }
         if (isset($_POST['e3'])) {
             $roleNumber |= ALLIANCE_ROLE_EDITNAMES;
         }
         if (isset($_POST['e4'])) {
             $roleNumber |= ALLIANCE_ROLE_EDITCONTRACTS;
         }
         if (isset($_POST['e5'])) {
             $roleNumber |= ALLIANCE_ROLE_SENDMESSAGE;
         }
         if (isset($_POST['e6'])) {
             $roleNumber |= ALLIANCE_ROLE_INVITEPLAYERS;
         }
         $m->setPlayerAllianceRole($uid, $roleName, $roleNumber);
     }
     $row = $m->getPlayerAllianceRole($uid);
     if ($row == NULL) {
         exit(0);
         return null;
     }
     $this->playerName = $row['name'];
     $alliance_roles = trim($row['alliance_roles']);
     if ($alliance_roles == '') {
         $this->playerRoles = array('name' => '', 'roles' => 0);
     } else {
         list($rolesNumber, $roleName) = explode(' ', $alliance_roles, 2);
         $this->playerRoles = array('name' => $roleName == '.' ? '' : $roleName, 'roles' => $rolesNumber);
     }
     $m->dispose();
 }
Beispiel #2
0
 function getAllianceDataFor($playerId)
 {
     $m = new AllianceModel();
     return $m->getAllianceDataFor($playerId);
 }