/** * * @param boolean $pReload * @return Synerg_Model_Gameresourceclasses */ public static function getInstance($pReload = FALSE) { if ($pReload || is_null(self::$_Instance)) { // process self::$_Instance = new self(); } return self::$_Instance; }
public function render() { $control = array_pop($this->get_form()->controls()); $rc = $this->get_form()->resource_class; $class = Synerg_Model_Gameresourceclasses::get_by_name(Synerg_Model_Gameresourceclasses::CLASS_RESOURCES); $rc->set_value($class->identity()); ob_start(); echo $rc; echo $this->get_form()->id; echo $this->get_form()->game_type; ?> <table class="zupal_form_table"> <tr> <th style="width: 100px">Resource:</th> <td><?php echo $this->get_form()->title; ?> </td> </tr> <tr> <th style="width: 100px"><?php echo $this->get_form()->lead->get_label(); ?> </th> <td><?php echo $this->get_form()->lead; ?> </td> </tr> <tr> <th style="width: 100px"> </th> <td><?php echo $this->get_form()->active; ?> </td> </tr> <tr> <!-- th><?php echo $this->get_form()->content->get_label(); ?> </th --> <td colspan="2"><?php echo $this->get_form()->content; ?> </td> </tr> <tr> <th colspan="2"> <?php echo $control; ?> </th> </tr> </table></td></tr> </table> <?php return ob_get_clean(); }
/** * return a JSON Dojo data block */ public function store() { $gt = Synerg_Model_Gametypes::getInstance()->synergy_gametype(); $out = array(); $classes = Synerg_Model_Gameresourceclasses::getInstance()->find(array('active' => 1, 'game_type' => $gt->identity())); foreach ($classes as $class) { $cn = $class->title; foreach ($class->resource_types() as $resource) { $data = $resource->toArray(TRUE); $data['resource_class_name'] = $cn; $out[] = $data; } } $this->get_controller()->_store('id', $out); }
public function render() { $control = array_pop($this->get_form()->controls()); $rc = $this->get_form()->resource_class; $class = Synerg_Model_Gameresourceclasses::get_by_name(Synerg_Model_Gameresourceclasses::CLASS_GROUPS); $rc->set_value($class->identity()); ob_start(); echo $rc; echo $this->get_form()->id; echo $this->get_form()->game_type; ?> <table class="zupal_form_table"> <tr> <th style="width: 100px">Group:</th> <td><?php echo $this->get_form()->title; ?> </td> </tr> <tr> <th style="width: 100px"><?php echo $this->get_form()->lead->get_label(); ?> </th> <td><?php echo $this->get_form()->lead; ?> </td> </tr> <tr> <th style="width: 100px"> </th> <td><?php echo $this->get_form()->active; ?> </td> </tr> <tr> <!-- th><?php echo $this->get_form()->content->get_label(); ?> </th --> <td colspan="2"><?php echo $this->get_form()->content; ?> </td> </tr> <tr> <td> </td> </tr> <tr><td colspan="4" style="border: 1px solid white; padding: 1em"> <table style="width: auto;"> <tr><th colspan="2"> <h2>Properties</h2> </th> </tr> <tr> <th style="text-align: center; font-style:italic">Resource</th> <th style="text-align: center; font-style:italic">Effect (%)</th> </tr> <?php for ($i = 1; $i <= 5; ++$i) { ?> <tr> <?php $nfield = $this->get_form()->get_field("string_{$i}"); $nfield->set_width(250); ?> <td><?php echo $nfield; ?> </td> <?php $vfield = $this->get_form()->get_field("value_{$i}"); $vfield->set_align('right'); $vfield->set_width(100); ?> <td><?php echo $vfield; ?> %</td> </tr> <?php } ?> <tr> <th colspan="2"> <?php echo $control; ?> </th> </tr> </table></td></tr> </table> <?php return ob_get_clean(); }