Exemplo n.º 1
0
 /**
  * Rooms in the lobby
  *
  * @uses Ajax
  */
 public function actionRooms()
 {
     $this->filterAjax();
     // clear out old users
     $system = new System();
     $this->renderJson($system->lobbyRooms($this->user->getId(), $this->user->isAdmin()));
 }
Exemplo n.º 2
0
 /**
  * Create a new room
  *
  * @uses Ajax
  */
 public function actionCreate()
 {
     // is this Ajax?
     if ($this->request->isAjax()) {
         $name = $this->request->getPost('name');
         $desc = $this->request->getPost('description');
         $room = new Room();
         // generate a room name for us
         if (empty($name)) {
             $name = $room->newName();
         }
         // save room
         $room->create($name, $desc);
         // 'refresh' rooms listing much like in a lobby
         $system = new System();
         $this->renderJson($system->lobbyRooms($this->user->getId(), $this->user->isAdmin()));
     } else {
         $this->renderTemplate('error404/javascript');
     }
 }