Example #1
0
 /**
  * method get_planets
  * param
  * return all the user planets
  */
 private function get_planets()
 {
     $colony = 1;
     $planets_query = parent::$db->query("SELECT *\n                                                                                            FROM " . PLANETS . " AS p\n                                                                                            INNER JOIN " . BUILDINGS . " AS b ON b.building_planet_id = p.`planet_id`\n                                                                                            INNER JOIN " . DEFENSES . " AS d ON d.defense_planet_id = p.`planet_id`\n                                                                                            INNER JOIN " . SHIPS . " AS s ON s.ship_planet_id = p.`planet_id`\n                                                                                            WHERE `planet_user_id` = '" . (int) $this->_current_user['user_id'] . "'\n                                                                                                    AND `planet_destroyed` = 0;");
     $planet_block = '<tr>';
     while ($user_planet = parent::$db->fetchArray($planets_query)) {
         if ($user_planet['planet_id'] != $this->_current_user['user_current_planet'] && $user_planet['planet_type'] != 3) {
             $url = 'game.php?page=overview&cp=' . $user_planet['planet_id'] . '&re=0';
             $image = DPATH . 'planets/small/s_' . $user_planet['planet_image'] . '.jpg';
             $attributes = 'height="50" width="50"';
             $planet_block .= '<th>' . $user_planet['planet_name'] . '<br>';
             $planet_block .= FunctionsLib::set_url($url, $user_planet['planet_name'], FunctionsLib::set_image($image, $user_planet['planet_name'], $attributes));
             $planet_block .= '<center>';
             $planet_block .= $this->get_current_work($user_planet, FALSE);
             $planet_block .= '</center></th>';
             if ($colony <= 1) {
                 $colony++;
             } else {
                 $planet_block .= '</tr><tr>';
                 $colony = 1;
             }
         }
     }
     $planet_block .= '</tr>';
     // CLEAN SOME MEMORY
     parent::$db->freeResult($planets_query);
     return $planet_block;
 }
Example #2
0
 /**
  * method image_block
  * param $alliance_image
  * return shows the image block, if any
  */
 private function image_block($alliance_image)
 {
     if ($alliance_image != '') {
         return '<tr><th colspan="2">' . FunctionsLib::set_image($alliance_image, $alliance_image) . '</td></tr>';
     }
     return '';
 }
Example #3
0
 /**
  * method actions_block
  * param
  * return all galaxy possible actions for the current planet
  */
 private function actions_block()
 {
     $links = '';
     if ($this->_row_data['user_id'] != $this->_current_user['user_id']) {
         if ($this->_current_user['setting_galaxy_espionage'] == '1') {
             $image = FunctionsLib::set_image(DPATH . 'img/e.gif', $this->_lang['gl_spy']);
             $attributes = "onclick=\"javascript:doit(6, " . $this->_galaxy . ", " . $this->_system . ", " . $this->_planet . ", 1, " . $this->_current_user['setting_probes_amount'] . ");\"";
             $links .= FunctionsLib::set_url('', '', $image, $attributes) . '&nbsp;';
         }
         if ($this->_current_user['setting_galaxy_write'] == '1') {
             $image = FunctionsLib::set_image(DPATH . 'img/m.gif', $this->_lang['write_message']);
             $url = 'game.php?page=messages&mode=write&id=' . $this->_row_data['user_id'] . '>';
             $links .= FunctionsLib::set_url($url, '', $image) . '&nbsp;';
         }
         if ($this->_current_user['setting_galaxy_buddy'] == '1') {
             $image = FunctionsLib::set_image(DPATH . 'img/b.gif', $this->_lang['gl_buddy_request']);
             $attributes = "onClick=\"f('game.php?page=buddy&mode=2&u=" . $this->_row_data['user_id'] . "', '" . $this->_lang['gl_buddy_request'] . "')\"";
             $links .= FunctionsLib::set_url('', '', $image, $attributes) . '&nbsp;';
         }
         if ($this->_current_user['setting_galaxy_missile'] == '1' && $this->is_missile_active()) {
             $image = FunctionsLib::set_image(DPATH . 'img/r.gif', $this->_lang['gl_missile_attack']);
             $url = 'game.php?page=galaxy&mode=2&galaxy=' . $this->_galaxy . '&system=' . $this->_system . '&planet=' . $this->_planet . '&current=' . $this->_current_user['user_current_planet'];
             $links .= FunctionsLib::set_url($url, '', $image) . '&nbsp;';
         }
     }
     return $links;
 }