public function __construct($pGroup, $pGame = NULL) { $pGroup = Zupal_Domain_Abstract::_as($pGroup, 'Ultimatum_Model_Ultgroups'); if ($pGame) { $pGame = Zupal_Domain_Abstract::_as($pGame, 'Ultimatum_Model_Ultgames'); } else { $pGame = Ultimatum_Model_Ultgames::get_active(); } parent::_load(); $this->game_id->set_value($pGame->identity()); $this->group_id->set_value($pGroup->identity()); $this->set_label('Change size of ' . $pGroup); }
public function group_sizes($pGroup, $pGame = NULL) { $pGroup = Zupal_Domain_Abstract::_as($pGroup, 'Ultimatum_Model_Ultgroups'); if (!$pGroup) { throw new Exception(__METHOD__ . ': no group found'); } if (is_null($pGame)) { $pGame = Ultimatum_Model_Ultgames::get_active(); } else { $pGame = Zupal_Domain_Abstract::_as($pGame, 'Ultimatum_Model_Ultgames'); } if (!$pGame) { throw new Exception(__METHOD__ . ': no game found'); } $params = array('game' => $pGame->identity(), 'group_id' => $pGroup->identity()); return $this->find($params, array('turn', 'changed_on')); }
/** * * @return <type> */ public function scan_group($pGroup) { $pGroup = Ultimatum_Model_Ultgroups::as_group($pGroup, TRUE); $params = array('target_group_id' => $pGroup, 'player' => $this->identity(), 'active' => 1); $old_scan = Ultimatum_Model_Ultgamegroupscans::getInstance()->findOne($params); if ($old_scan) { return $old_scan; } else { $scan = Ultimatum_Model_Ultgamegroupscans::getInstance()->get(NULL, $params); $scan->on_turn = Ultimatum_Model_Ultgames::get_active()->turn(); $scan->save(); return $scan; } }
/** * * @param Ultimatum_Model_GroupProfileIF $pParam * @return <type> */ public function powerMatrix(Ultimatum_Model_GroupProfileIF $profile) { ob_start(); ?> <table class="ult_power_matrix"> <tr> <th>Off</th> <th>Def</th> <th>Grow</th> <th>Net</th> </tr> <?php if (Ultimatum_Model_Ultgames::get_active()) { ?> <tr> <td><small><?php echo $profile->offense_size(TRUE); ?> × <?php echo $profile->offense_efficiency(TRUE); ?> </small></td> <td><small><?php echo $profile->defense_size(TRUE); ?> × <?php echo $profile->defense_efficiency(TRUE); ?> </small></td> <td><small><?php echo $profile->growth_size(TRUE); ?> × <?php echo $profile->growth_efficiency(TRUE); ?> </small></td> <td><small><?php echo $profile->network_size(TRUE); ?> × <?php echo $profile->network_efficiency(TRUE); ?> </small></td> </tr> <tr> <td><?php echo $profile->offense_effect(TRUE); ?> </td> <td><?php echo $profile->defense_effect(TRUE); ?> </td> <td><?php echo $profile->growth_effect(TRUE); ?> </td> <td><?php echo $profile->network_effect(TRUE); ?> </td> </tr> <?php } else { ?> <tr> <td><?php echo $profile->offense_efficiency(TRUE); ?> </td> <td><?php echo $profile->defense_efficiency(TRUE); ?> </td> <td><?php echo $profile->growth_efficiency(TRUE); ?> </td> <td><?php echo $profile->network_efficiency(TRUE); ?> </td> </tr> <?php } ?> </table> <?php return ob_get_clean(); }
/** * * @param int $pGame_id * @return <type> */ public function sizes($pGame_id = NULL) { if (!$pGame) { $pGame = Ultimatum_Model_Ultgames::get_active(); } if ($pGame) { $sizes = $this->sizes_in_game($pGame); } else { $sizes = array(); } return $sizes; }