Пример #1
0
 /**
  *
  */
 public function run()
 {
     $user = Model_Users::current_user();
     if ($user) {
         $pi = Ultimatum_Model_Ultplayers::getInstance();
         $params = array('user' => $user->identity(), 'active' => 1, 'status' => 'active');
         $active_games = $pi->find($params, 'id DESC');
         foreach ($active_games as $ag) {
             $ag->active = FALSE;
             $ag->save();
         }
     } else {
         $this->view()->nouser = true;
     }
     return $this->forward('index');
 }
 /**
  * @return Ultimatum_Model_Ultplayers;
  */
 function get_player($pReload = FALSE)
 {
     if ($pReload || is_null($this->_player)) {
         // process
         $this->_player = Ultimatum_Model_Ultplayers::getInstance()->get($this->player);
     }
     return $this->_player;
 }
Пример #3
0
 public function gamesstoreAction()
 {
     $pt = Ultimatum_Model_Ultplayers::getInstance();
     $pl = $pt->find(array('user' => Model_Users::current_user()->identity()));
     $data = array();
     foreach ($pl as $p) {
         $game = $p->get_game();
         if ($game->status == 'started') {
             $row = $game->toArray();
             $players = $game->players(TRUE);
             $turn = $game->turn(TRUE);
             $row['players'] = count($players);
             $row['turn'] = $turn;
             $data[] = $row;
         }
     }
     ksort($data);
     $this->_store('id', $data, 'name');
 }
Пример #4
0
 /**
  *
  * @return int[]
  */
 public function player_ids()
 {
     $table = $player_ids = Ultimatum_Model_Ultplayers::getInstance()->table();
     $sql = sprintf('SELECT id FROM %s where game = ?', $table->tableName());
     $player_ids = $table->getAdapter()->fetchCol($sql, $this->identity());
     return $player_ids;
 }
Пример #5
0
 /**
  * Note - this is the SCANNING player, not the owner of the group.
  * @return Ultimatum_Model_Ultplayer;
  */
 public function get_player()
 {
     return Ultimatum_Model_Ultplayers::getInstance()->get($this->player);
 }