public function run()
 {
     global $request;
     $em = \Shared\DoctrineHelper::getEntityManager();
     $gmListMid = $request->request->get("GmListMid");
     $playerId = $request->request->get("playerId");
     $playerIp = $request->request->get("playerIp");
     $authority = $request->request->get("authority");
     $objPlayer = \Player\PlayerHelper::getPlayerRepository()->find($playerId);
     $objAccount = \Account\AccountHelper::getAccountRepository()->find($objPlayer->getIdAccount());
     if ($gmListMid > 0) {
         $objGmListMid = \Common\CommonHelper::getGmlistRepository()->find($gmListMid);
     } else {
         $objGmListMid = new \Common\Entity\Gmlist();
         $objGmListMid->setMserverip("ALL");
     }
     $objGmListMid->setMaccount($objAccount->getLogin());
     $objGmListMid->setMname($objPlayer->getName());
     $objGmListMid->setMauthority($authority);
     $objGmListMid->setMcontactip($playerIp);
     $em->persist($objGmListMid);
     $em->flush();
     $result = array('result' => true, 'reasons' => "");
     echo json_encode($result);
 }
 public function run()
 {
     global $request;
     $em = \Shared\DoctrineHelper::getEntityManager();
     $memberId = $request->request->get("memberId");
     if ($memberId > 0) {
         $objGmList = \Common\CommonHelper::getGmlistRepository()->find($memberId);
         if ($objGmList !== null) {
             $em->remove($objGmList);
             $em->flush();
             $result = array('result' => true, 'reasons' => "");
         } else {
             $result = array('result' => false, 'reasons' => "Le membre sélectionné n'existe pas.");
         }
     } else {
         $result = array('result' => false, 'reasons' => "Problème de transmission d'identifiant.");
     }
     echo json_encode($result);
 }
Ejemplo n.º 3
0
 public function run()
 {
     global $request;
     $mode = $request->query->get("mode");
     $objPlayer = null;
     $objAccount = null;
     if ($mode == "create") {
         $objGmList = new \Common\Entity\Gmlist();
     } else {
         if ($mode == "mod") {
             $id = $request->query->get("idMembre");
             $objGmList = \Common\CommonHelper::getGmlistRepository()->find($id);
             $objPlayer = \Player\PlayerHelper::getPlayerRepository()->findByName($objGmList->getMname());
             $objAccount = \Account\AccountHelper::getAccountRepository()->findAccountByLogin($objGmList->getMaccount());
         }
     }
     $this->arrayTemplate["arrAuthority"] = \AuthorityHelper::getAll();
     $this->arrayTemplate["objGmList"] = $objGmList;
     $this->arrayTemplate["objPlayer"] = $objPlayer;
     $this->arrayTemplate["objAccount"] = $objAccount;
     $view = $this->template->render($this->arrayTemplate);
     $this->response->setContent($view);
     $this->response->send();
 }