/** * 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 = Functions_Lib::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 .= Functions_Lib::set_url('', '', $image, $attributes) . ' '; } if ($this->_current_user['setting_galaxy_write'] == '1') { $image = Functions_Lib::set_image(DPATH . 'img/m.gif', $this->_lang['write_message']); $url = 'game.php?page=messages&mode=write&id=' . $this->_row_data['user_id'] . '>'; $links .= Functions_Lib::set_url($url, '', $image) . ' '; } if ($this->_current_user['setting_galaxy_buddy'] == '1') { $image = Functions_Lib::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 .= Functions_Lib::set_url('', '', $image, $attributes) . ' '; } if ($this->_current_user['setting_galaxy_missile'] == '1' && $this->is_missile_active()) { $image = Functions_Lib::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 . '¤t=' . $this->_current_user['user_current_planet']; $links .= Functions_Lib::set_url($url, '', $image) . ' '; } } return $links; }
/** * method get_planets * param * return all the user planets */ private function get_planets() { $colony = 1; $planets_query = parent::$db->query("SELECT *\r\n\t\t\t\t\t\t\t\t\t\t\t\tFROM " . PLANETS . " AS p\r\n\t\t\t\t\t\t\t\t\t\t\t\tINNER JOIN " . BUILDINGS . " AS b ON b.building_planet_id = p.`planet_id`\r\n\t\t\t\t\t\t\t\t\t\t\t\tINNER JOIN " . DEFENSES . " AS d ON d.defense_planet_id = p.`planet_id`\r\n\t\t\t\t\t\t\t\t\t\t\t\tINNER JOIN " . SHIPS . " AS s ON s.ship_planet_id = p.`planet_id`\r\n\t\t\t\t\t\t\t\t\t\t\t\tWHERE `planet_user_id` = '" . (int) $this->_current_user['user_id'] . "'\r\n\t\t\t\t\t\t\t\t\t\t\t\t\tAND `planet_destroyed` = 0;"); $planet_block = '<tr>'; while ($user_planet = parent::$db->fetch_array($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 .= Functions_Lib::set_url($url, $user_planet['planet_name'], Functions_Lib::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->free_result($planets_query); return $planet_block; }
/** * 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">' . Functions_Lib::set_image($alliance_image, $alliance_image) . '</td></tr>'; } return ''; }