Add additional info to the server model

This commit is contained in:
Karsten Heiken
2011-09-09 21:10:01 +02:00
parent f69f56597a
commit f98d21a40d

View File

@@ -97,7 +97,12 @@ class Server extends CI_Model {
* @param string $serverId
*/
public function getById($serverId) {
return $this->db->get_where('servers', array('id' => $serverId))->row();
$this->load->helper('date');
$server = $this->db->get_where('servers', array('id' => $serverId))->row();
$server->uptimestring = secondsToString($server->uptime);
$server->lastheartbeat = sprintf(_('%s ago'),
secondsToString(time_diff($server->last_update, mysql_now())));
return $server;
}
}