Esempio n. 1
0
 /**
  * method flying_fleets_table
  * param
  * return the fleets table
  */
 private function flying_fleets_table()
 {
     $table = '';
     $i = 0;
     while ($fleet = parent::$db->fetchArray($this->_flying_fleets)) {
         $block['num'] = ++$i;
         $block['mission'] = $this->resources_pop_up($this->_lang['ff_type_mission'][$fleet['fleet_mission']] . ' ' . (FleetsLib::is_fleet_returning($fleet) ? $this->_lang['ff_r'] : $this->_lang['ff_a']), $fleet);
         $block['amount'] = $this->ships_pop_up($this->_lang['ff_ships'], $fleet);
         $block['beginning'] = FormatLib::pretty_coords($fleet['fleet_start_galaxy'], $fleet['fleet_start_system'], $fleet['fleet_start_planet']);
         $block['departure'] = date(FunctionsLib::read_config('date_format_extended'), $fleet['fleet_creation']);
         $block['objective'] = FormatLib::pretty_coords($fleet['fleet_end_galaxy'], $fleet['fleet_end_system'], $fleet['fleet_end_planet']);
         $block['arrival'] = date(FunctionsLib::read_config('date_format_extended'), $fleet['fleet_start_time']);
         $block['return'] = date(FunctionsLib::read_config('date_format_extended'), $fleet['fleet_end_time']);
         $table .= parent::$page->parse_template(parent::$page->get_template('adm/fleet_rows_view'), $block);
     }
     return $table;
 }
Esempio n. 2
0
 /**
  * method build_page
  * param
  * return main method, loads everything
  */
 private function build_page()
 {
     #####################################################################################################
     // SOME DEFAULT VALUES
     #####################################################################################################
     //	ELEMENTS
     $resource = parent::$objects->getObjects();
     // QUERYS
     $count = parent::$db->queryFetch("SELECT\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t(SELECT COUNT(fleet_owner) AS `actcnt`\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tFROM " . FLEETS . "\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tWHERE `fleet_owner` = '" . $this->_current_user['user_id'] . "') AS max_fleet,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t(SELECT COUNT(fleet_owner) AS `expedi`\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tFROM " . FLEETS . "\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tWHERE `fleet_owner` = '" . $this->_current_user['user_id'] . "'\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tAND `fleet_mission` = '15') AS max_expeditions");
     // LANGUAGE
     $this->_lang['js_path'] = XGP_ROOT . JS_PATH;
     $parse = $this->_lang;
     $MaxFlyingFleets = $count['max_fleet'];
     $MaxExpedition = $this->_current_user[$resource[124]];
     if ($MaxExpedition >= 1) {
         $ExpeditionEnCours = $count['max_expeditions'];
         $EnvoiMaxExpedition = FleetsLib::get_max_expeditions($MaxExpedition);
     } else {
         $ExpeditionEnCours = 0;
         $EnvoiMaxExpedition = 0;
     }
     $MaxFlottes = FleetsLib::get_max_fleets($this->_current_user[$resource[108]], $this->_current_user['premium_officier_admiral']);
     $missiontype = FleetsLib::get_missions();
     $ShipData = '';
     $parse['flyingfleets'] = $MaxFlyingFleets;
     $parse['maxfleets'] = $MaxFlottes;
     $parse['currentexpeditions'] = $ExpeditionEnCours;
     $parse['maxexpeditions'] = $EnvoiMaxExpedition;
     $i = 0;
     $flying_fleets = '';
     if ($count['max_fleet'] != 0 or $MaxExpedition != 0) {
         $fq = parent::$db->query("SELECT *\n\t\t\t\t\t\t\t\t\t\tFROM " . FLEETS . "\n\t\t\t\t\t\t\t\t\t\tWHERE fleet_owner = '" . $this->_current_user['user_id'] . "'");
         while ($f = parent::$db->fetchArray($fq)) {
             $i++;
             $parse['num'] = $i;
             $parse['fleet_mission'] = $missiontype[$f['fleet_mission']];
             if (FleetsLib::is_fleet_returning($f)) {
                 $parse['tooltip'] = $this->_lang['fl_returning'];
                 $parse['title'] = $this->_lang['fl_r'];
             } else {
                 $parse['tooltip'] = $this->_lang['fl_onway'];
                 $parse['title'] = $this->_lang['fl_a'];
             }
             $fleet = explode(";", $f['fleet_array']);
             $e = 0;
             $parse['fleet'] = '';
             foreach ($fleet as $a => $b) {
                 if ($b != '') {
                     $e++;
                     $a = explode(",", $b);
                     $parse['fleet'] .= $this->_lang['tech'][$a[0]] . ":" . $a[1] . "\n";
                     if ($e > 1) {
                         $parse['fleet'] .= "\t";
                     }
                 }
             }
             $parse['fleet_amount'] = FormatLib::pretty_number($f['fleet_amount']);
             $parse['fleet_start'] = FormatLib::pretty_coords($f['fleet_start_galaxy'], $f['fleet_start_system'], $f['fleet_start_planet']);
             $parse['fleet_start_time'] = date(FunctionsLib::read_config('date_format_extended'), $f['fleet_creation']);
             $parse['fleet_end'] = FormatLib::pretty_coords($f['fleet_end_galaxy'], $f['fleet_end_system'], $f['fleet_end_planet']);
             $parse['fleet_end_time'] = date(FunctionsLib::read_config('date_format_extended'), $f['fleet_start_time']);
             $parse['fleet_arrival'] = date(FunctionsLib::read_config('date_format_extended'), $f['fleet_end_time']);
             //now we can view the call back button for ships in maintaing position (2)
             if ($f['fleet_mess'] == 0 or $f['fleet_mess'] == 2) {
                 $parse['inputs'] = '<form action="game.php?page=movement&action=return" method="post">';
                 $parse['inputs'] .= '<input name="fleetid" value="' . $f['fleet_id'] . '" type="hidden">';
                 $parse['inputs'] .= '<input value="' . $this->_lang['fl_send_back'] . '" type="submit" name="send">';
                 $parse['inputs'] .= '</form>';
                 if ($f['fleet_mission'] == 1) {
                     $parse['inputs'] .= '<a href="#" onClick="f(\'game.php?page=federationlayer&union=' . $f['fleet_group'] . '&fleet=' . $f['fleet_id'] . '\', \'\')">';
                     $parse['inputs'] .= '<input value="' . $this->_lang['fl_acs'] . '" type="button">';
                     $parse['inputs'] .= '</a>';
                 }
             } else {
                 $parse['inputs'] = '&nbsp;-&nbsp;';
             }
             $flying_fleets .= parent::$page->parse_template(parent::$page->get_template('movement/fleet_row_fleets'), $parse);
         }
     }
     if ($i == 0) {
         $parse['num'] = '-';
         $parse['fleet_mission'] = '-';
         $parse['title'] = '';
         $parse['fleet_amount'] = '-';
         $parse['fleet_start'] = '-';
         $parse['fleet_start_time'] = '-';
         $parse['fleet_end'] = '-';
         $parse['fleet_end_time'] = '-';
         $parse['fleet_arrival'] = '-';
         $parse['inputs'] = '-';
         $flying_fleets .= parent::$page->parse_template(parent::$page->get_template('movement/fleet_row_fleets'), $parse);
     }
     $parse['fleetpagerow'] = $flying_fleets;
     $parse['envoimaxexpedition'] = $EnvoiMaxExpedition;
     $parse['expeditionencours'] = $ExpeditionEnCours;
     parent::$page->display(parent::$page->parse_template(parent::$page->get_template('movement/fleet_table'), $parse));
 }
Esempio n. 3
0
 /**
  * method build_page
  * param
  * return main method, loads everything
  */
 private function build_page()
 {
     $parse = $this->_lang;
     $tech_row_template = parent::$page->get_template('buildings/buildings_research_row');
     $tech_script_template = parent::$page->get_template('buildings/buildings_research_script');
     $technology_list = '';
     // time to do something
     $this->do_command();
     // build the page
     foreach ($this->_lang['tech'] as $tech => $tech_name) {
         if ($tech > 105 && $tech <= 199) {
             if (DevelopmentsLib::is_development_allowed($this->_current_user, $this->_current_planet, $tech)) {
                 $RowParse['dpath'] = DPATH;
                 $RowParse['tech_id'] = $tech;
                 $building_level = $this->_current_user[$this->_resource[$tech]];
                 $RowParse['tech_level'] = DevelopmentsLib::set_level_format($building_level, $tech, $this->_current_user);
                 $RowParse['tech_name'] = $tech_name;
                 $RowParse['tech_descr'] = $this->_lang['res']['descriptions'][$tech];
                 $RowParse['tech_price'] = DevelopmentsLib::formated_development_price($this->_current_user, $this->_current_planet, $tech);
                 $SearchTime = DevelopmentsLib::development_time($this->_current_user, $this->_current_planet, $tech, FALSE, $this->_lab_level);
                 $RowParse['search_time'] = DevelopmentsLib::formated_development_time($SearchTime);
                 if (!$this->_is_working['is_working']) {
                     if (DevelopmentsLib::is_development_payable($this->_current_user, $this->_current_planet, $tech) && !parent::$users->is_on_vacations($this->_current_user)) {
                         if (!$this->is_laboratory_in_queue()) {
                             $action_link = FormatLib::color_red($this->_lang['bd_research']);
                         } else {
                             $action_link = FunctionsLib::set_url('game.php?page=research&cmd=search&tech=' . $tech, '', FormatLib::color_green($this->_lang['bd_research']));
                         }
                     } else {
                         $action_link = FormatLib::color_red($this->_lang['bd_research']);
                     }
                 } else {
                     if ($this->_is_working['working_on']['planet_b_tech_id'] == $tech) {
                         $bloc = $this->_lang;
                         if ($this->_is_working['working_on']['id'] != $this->_current_planet['planet_id']) {
                             $bloc['tech_time'] = $this->_is_working['working_on']['planet_b_tech'] - time();
                             $bloc['tech_name'] = $this->_lang['bd_from'] . $this->_is_working['working_on']['planet_name'] . '<br /> ' . FormatLib::pretty_coords($this->_is_working['working_on']['planet_galaxy'], $this->_is_working['working_on']['planet_system'], $this->_is_working['working_on']['planet_planet']);
                             $bloc['tech_home'] = $this->_is_working['working_on']['id'];
                             $bloc['tech_id'] = $this->_is_working['working_on']['planet_b_tech_id'];
                         } else {
                             $bloc['tech_time'] = $this->_current_planet['planet_b_tech'] - time();
                             $bloc['tech_name'] = '';
                             $bloc['tech_home'] = $this->_current_planet['planet_id'];
                             $bloc['tech_id'] = $this->_current_planet['planet_b_tech_id'];
                         }
                         $action_link = parent::$page->parse_template($tech_script_template, $bloc);
                     } else {
                         $action_link = "<center>-</center>";
                     }
                 }
                 $RowParse['tech_link'] = $action_link;
                 $technology_list .= parent::$page->parse_template($tech_row_template, $RowParse);
             }
         }
     }
     $parse['noresearch'] = !$this->is_laboratory_in_queue() ? $this->_lang['bd_building_lab'] : '';
     $parse['technolist'] = $technology_list;
     parent::$page->display(parent::$page->parse_template(parent::$page->get_template('buildings/buildings_research'), $parse));
 }
Esempio n. 4
0
 /**
  * buildReportLink
  *
  * @param string $color Color
  * @param string $rid   Report ID
  * @param int    $g     Galaxy
  * @param int    $s     System
  * @param int    $p     Planet
  *
  * @return string
  */
 private function buildReportLink($color, $rid, $g, $s, $p)
 {
     $style = 'style="color:' . $color . ';"';
     $js = "OnClick=\\'f(\"game.php?page=combatreport&report=" . $rid . "\", \"\");\\'";
     $content = $this->_lang['sys_mess_attack_report'] . ' ' . FormatLib::pretty_coords($g, $s, $p);
     return FunctionsLib::set_url('', '', $content, $style . ' ' . $js);
 }