コード例 #1
0
ファイル: overview.php プロジェクト: Gritch69/XG-Project
 /**
  * method get_planets
  * param $user_planet
  * param $is_current_planet
  * return building in progress or free text
  */
 private function get_current_work($user_planet, $is_current_planet = TRUE)
 {
     // THE PLANET IS "FREE" BY DEFAULT
     $building_block = $this->_lang['ov_free'];
     if (!$is_current_planet) {
         // UPDATE THE PLANET INFORMATION FIRST, MAY BE SOMETHING HAS JUST FINISHED
         Update_Lib::update_buildings_queue($user_planet, $this->_current_user);
     }
     if ($user_planet['planet_b_building'] != 0) {
         if ($user_planet['planet_b_building'] != 0) {
             $queue = explode(';', $user_planet['planet_b_building_id']);
             // GET ALL
             $current_building = explode(',', $queue[0]);
             // GET ONLY THE FIRST ELEMENT
             $building = $current_building[0];
             // THE BUILDING
             $level = $current_building[1];
             // THE LEVEL
             $time_to_end = $current_building[3] - time();
             // THE TIME
             // THE BUILDING BLOCK
             if ($is_current_planet) {
                 $building_block = Developments_Lib::current_building("overview", $building);
                 $building_block .= $this->_lang['tech'][$building] . ' (' . $level . ')';
                 $building_block .= "<br /><div id=\"blc\" class=\"z\">" . Format_Lib::pretty_time($time_to_end) . "</div>";
                 $building_block .= "\n<script language=\"JavaScript\">";
                 $building_block .= "\n\tpp = \"" . $time_to_end . "\";\n";
                 $building_block .= "\n\tpk = \"" . 1 . "\";\n";
                 $building_block .= "\n\tpm = \"cancel\";\n";
                 $building_block .= "\n\tpl = \"" . $this->_current_planet['planet_id'] . "\";\n";
                 $building_block .= "\n\tt();\n";
                 $building_block .= "\n</script>\n";
             } else {
                 $building_block = '' . $this->_lang['tech'][$building] . ' (' . $level . ')';
                 $building_block .= '<br><font color="#7f7f7f">(' . Format_Lib::pretty_time($time_to_end) . ')</font>';
             }
         }
     }
     // BACK TO THE PLANET!
     return $building_block;
 }
コード例 #2
0
ファイル: buildings.php プロジェクト: Gritch69/XG-Project
 /**
  * method build_page
  * param
  * return main method, loads everything
  */
 private function build_page()
 {
     $resource = $this->_objects->get_objects();
     $parse = $this->_lang;
     $parse['dpath'] = DPATH;
     $page = '';
     $max_fields = Developments_Lib::max_fields($this->_current_planet);
     // time to do something
     $this->do_command();
     Developments_Lib::set_first_element($this->_current_planet, $this->_current_user);
     $Sprice = array();
     $queue = $this->show_queue($Sprice);
     $this->start_building();
     $full_queue = $queue['lenght'] < MAX_BUILDING_QUEUE_SIZE ? FALSE : TRUE;
     foreach ($this->_lang['tech'] as $building => $building_name) {
         if (in_array($building, $this->_allowed[$this->_current_planet['planet_type']])) {
             $queue['to_destroy'] = isset($queue['to_destroy']) ? $queue['to_destroy'] : 0;
             if ($this->_current_planet['planet_field_current'] < $max_fields - $queue['to_destroy']) {
                 $have_fields = TRUE;
             } else {
                 $have_fields = FALSE;
             }
             if (Developments_Lib::is_development_allowed($this->_current_user, $this->_current_planet, $building)) {
                 $building_level = $this->_current_planet[$resource[$building]];
                 $building_time = Developments_Lib::development_time($this->_current_user, $this->_current_planet, $building, $building_level);
                 $parse['i'] = $building;
                 $parse['nivel'] = Developments_Lib::set_level_format($building_level);
                 $parse['n'] = $building_name;
                 $parse['descriptions'] = $this->_lang['res']['descriptions'][$building];
                 $parse['price'] = Developments_Lib::formated_development_price($this->_current_user, $this->_current_planet, $building, TRUE, $building_level);
                 $parse['time'] = Developments_Lib::formated_development_time($building_time);
                 $parse['click'] = $this->set_action_button($have_fields, $full_queue, $building, $queue);
                 $page .= parent::$page->parse_template(parent::$page->get_template('buildings/buildings_builds_row'), $parse);
             }
         }
     }
     if ($queue['lenght'] > 0) {
         $parse['BuildListScript'] = Developments_Lib::current_building($this->_current_page);
         $parse['BuildList'] = $queue['buildlist'];
     } else {
         $parse['BuildListScript'] = '';
         $parse['BuildList'] = '';
     }
     $parse['BuildingsList'] = $page;
     parent::$page->display(parent::$page->parse_template(parent::$page->get_template('buildings/buildings_builds'), $parse));
 }