public function xml($type, $id) { $this->layout = 'xml'; // If the xml we are going to load is research info if ($type == 'research') { // check that it is numeric if (!is_numeric($id)) { // if not, try to convert it to one $id = explode(',', $id); $id = $id[1]; } // if that doesn't work, then throw out a error if (!is_numeric($id)) { show_error('Please do not attempt to use non numeric values as ID'); } // Now get the item information ; ) $query = $this->db->query("SELECT * FROM `research` WHERE `id` = '{$id}'"); if ($query->num_rows() > 0) { $research = $query->result_array(); $sql = $this->db->query("SELECT * FROM `research_completed` WHERE `rid` = '{$id}' AND `uid` = '{$this->userID}'"); $res = $sql->result_array(); if ($sql->num_rows() > 0) { $research[0]['completed'] = '1'; } else { $research[0]['completed'] = '0'; } $res = $this->db->query("SELECT end_time, uid FROM `research_completed` WHERE `end_time` > '" . time() . "' AND `uid` = '{$this->userID}' LIMIT 1;"); if ($res->num_rows() > 0) { $result = $res->result_array(); $this->data['researching'] = "true"; $this->data['researchingEndTime'] = secondtoword($result[0]['end_time'] - time()); } $this->data['research'] = $research; $this->load->view('constructions/research_information', $this->data); } else { show_error("ID {$id} does not exist in the database"); } } }
<?php if (isset($messages)) { ?> <div class="ui-state-highlight ui-corner-all" style="margin-top: 20px; padding: 0 .7em; width: 80%; margin-left: auto; margin-right: auto; display: block;"> <p><span class="ui-icon ui-icon-info" style="float: left; margin-right: .3em;"></span> <strong>Building:</strong> <?php foreach ($messages as $m) { echo $m . "<br />"; } ?> <br /><br />Build time: <?php echo secondtoword($buildtime); ?> </p> </div> <?php }