Changeset 405
- Timestamp:
- 01/27/05 11:00:52 (8 years ago)
- Location:
- trunk/wifidog-auth/wifidog
- Files:
-
- 4 modified
-
admin/hotspot.php (modified) (4 diffs)
-
classes/Node.php (modified) (5 diffs)
-
node_list.php (modified) (1 diff)
-
templates/node_list.html (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/wifidog-auth/wifidog/admin/hotspot.php
r402 r405 37 37 38 38 if ("$node_id" != "new") { // Node creation 39 $node = Node:: GetObject($node_id);39 $node = Node::getNode($node_id); 40 40 } 41 41 … … 43 43 $smarty->assign("user_id", $user_id); 44 44 $smarty->assign("node_id", $node_id); 45 $smarty->assign('node_deployment_status', Node:: GetAllDeploymentStatus());45 $smarty->assign('node_deployment_status', Node::getAllDeploymentStatus()); 46 46 47 47 $smarty->display("admin/templates/hotspot_edit.html"); … … 59 59 $smarty->assign("title", _("Add a new hotspot with")); 60 60 $smarty->assign("node_id", $node_id); 61 $smarty->assign('node_deployment_status', Node:: GetAllDeploymentStatus());61 $smarty->assign('node_deployment_status', Node::getAllDeploymentStatus()); 62 62 $smarty->display("admin/templates/hotspot_edit.html"); 63 63 … … 128 128 129 129 //if (is_array($node_results)) { // If no row return, $node_results will be NULL 130 $nodes = Node:: GetAllNodes();130 $nodes = Node::getAllNodes(); 131 131 if (is_array($nodes)) { 132 132 $smarty->assign('nodes', $nodes); -
trunk/wifidog-auth/wifidog/classes/Node.php
r402 r405 34 34 * @return a Node object, or null if there was an error 35 35 */ 36 static function get Object($id) {36 static function getNode($id) { 37 37 $object = null; 38 38 $object = new self($id); … … 44 44 * @return the newly created Node object, or null if there was an error 45 45 */ 46 static function create Object($id) {46 static function createNode($id) { 47 47 global $db; 48 48 … … 62 62 $db->ExecSqlUniqueRes($sql, $row, false); 63 63 if ($row == null) { 64 throw new Exception(_("The id $node_id_str could not be found in the database") , "EXCEPTION_CREATE_OBJECT_FAILED");64 throw new Exception(_("The id $node_id_str could not be found in the database")); 65 65 } 66 66 $this->mRow = $row; … … 96 96 97 97 $db->ExecSql("SELECT * FROM nodes", $nodes, false); 98 98 99 if ($nodes == null) { 99 throw new Exception(_("No nodes could not be found in the database"), "EXCEPTION_NO_NODES"); 100 throw new Exception(_("No nodes could not be found in the database")); 101 } 102 return $nodes; 103 } 104 105 static function getAllNodesOrdered($order_by) { 106 global $db; 107 108 $db->ExecSql("SELECT * FROM nodes ORDER BY $order_by", $nodes, false); 109 110 if ($nodes == null) { 111 throw new Exception(_("No nodes could not be found in the database")); 112 } 113 return $nodes; 114 } 115 116 static function getAllNodesWithStatus() { 117 global $db; 118 $db->ExecSql("SELECT node_id, name, last_heartbeat_user_agent, (NOW()-last_heartbeat_timestamp) AS since_last_heartbeat, last_heartbeat_ip, CASE WHEN ((NOW()-last_heartbeat_timestamp) < interval '5 minutes') THEN true ELSE false END AS online, creation_date FROM nodes ORDER BY node_id", $nodes, false); 119 if ($nodes == null) { 120 throw new Exception(_("No nodes could not be found in the database")); 100 121 } 101 122 return $nodes; … … 107 128 $db->ExecSql("SELECT * FROM node_deployment_status", $statuses, false); 108 129 if ($statuses == null) { 109 throw new Exception(_("No deployment statues could be found in the database") , "EXCEPTION_NO_STATUSES");130 throw new Exception(_("No deployment statues could be found in the database")); 110 131 } 111 132 $statuses_array = array(); -
trunk/wifidog-auth/wifidog/node_list.php
r402 r405 27 27 require_once BASEPATH.'include/common.php'; 28 28 require_once BASEPATH.'include/common_interface.php'; 29 require_once BASEPATH.'classes/Node.php'; 29 30 30 $db->ExecSql("SELECT node_id, name, last_heartbeat_user_agent, (NOW()-last_heartbeat_timestamp) AS since_last_heartbeat, last_heartbeat_ip, CASE WHEN ((NOW()-last_heartbeat_timestamp) < interval '5 minutes') THEN true ELSE false END AS is_up, creation_date FROM nodes ORDER BY node_id", $node_results, false); 31 32 foreach($node_results as $node_row) { 33 $node_row['duration'] = $db->GetDurationArrayFromIntervalStr($node_row['since_last_heartbeat']); 34 $node_row['num_online_users'] = $stats->getNumOnlineUsers($node_row['node_id']); 35 $smarty->append("nodes", $node_row); 31 foreach(Node::getAllNodesWithStatus("node_id") as $node) { 32 $node['duration'] = $db->GetDurationArrayFromIntervalStr($node['since_last_heartbeat']); 33 $node['num_online_users'] = $stats->getNumOnlineUsers($node['node_id']); 34 $smarty->append("nodes", $node); 36 35 } 37 36 -
trunk/wifidog-auth/wifidog/templates/node_list.html
r334 r405 17 17 <tr class="{cycle values="odd,even"}"> 18 18 <td class="status"> 19 {if $nodes[node]. is_up == "t"}19 {if $nodes[node].online == 't'} 20 20 <img src='{$smarty.const.BASE_URL_PATH}images/hotspot_status_up.png'> 21 21 {else}
