Example #1
0
 /**
  * At this point the game has been created and registered - but the player has not chosen a group.
  * Note -- if they walk away they will be a player without a group -- not a good thing!
  */
 public function run()
 {
     $c = $this->get_controller();
     if (!$c->_prep()) {
         $params = array('error' => 'Cannot start game');
         return $this->forward('index', NULL, NULL, $params);
     }
     //@TODO: make sure the groups are not already owned! hell is other players
     $t = Ultimatum_Model_Ultgroups::getInstance()->table();
     $sql = sprintf('SELECT %s FROM %s', $t->idField(), $t->tableName());
     $ids = $t->getAdapter()->fetchCol($sql);
     $group_ids = Zupal_Util_Array::random_set($ids, 4);
     $game_id = $this->view()->game->identity();
     foreach ($group_ids as $id) {
         $groups[] = $group = Ultimatum_Model_Ultgroups::getInstance()->get($id);
         $gamegroup = new Ultimatum_Model_Ultgamegroups();
         $gamegroup->game = $game_id;
         $gamegroup->group_id = $id;
         $gamegroup->save();
         // note -- will be saved with no owner.
         $gamegroup->start_size();
         $scans[] = $this->view()->player->scan_group($group);
     }
     $this->view()->groups = $groups;
     $this->view()->scans = $scans;
 }
 /**
  *
  */
 public function pagesstoreAction()
 {
     $pt = Pages_Model_Zupalpages::getInstance();
     $pages = $pt->findAll('id');
     $data = array();
     foreach ($pages as $page) {
         $row = $page->toArray();
         if ($atom = $page->get_atom($page->atomic_id)) {
             if ($publish_status = $page->get_publish_status()) {
                 $psa = Zupal_Util_Array::mod_keys($publish_status->toArray(), 'ps_');
             } else {
                 $psa = array();
             }
             $row = array_merge($row, Zupal_Util_Array::mod_keys($atom->toArray(), 'a_'), $psa);
         }
         $data[] = $row;
     }
     $this->_store('id', $data, 'a_title');
 }
Example #3
0
 protected function _getAllParams()
 {
     return Zupal_Util_Array::stripslashes($this->getRequest()->getParams());
 }
Example #4
0
 public function _random_name()
 {
     $letter_count = rand(1, 2) + rand(1, 2) + rand(1, 2);
     $letters = Zupal_Util_Array::random(self::$_alphabet, $letter_count);
     return join('. ', $letters) . '.';
 }