Changeset 405

Show
Ignore:
Timestamp:
01/27/05 11:00:52 (8 years ago)
Author:
aprilp
Message:

*** empty log message ***

Location:
trunk/wifidog-auth/wifidog
Files:
4 modified

Legend:

Unmodified
Added
Removed
  • trunk/wifidog-auth/wifidog/admin/hotspot.php

    r402 r405  
    3737     
    3838    if ("$node_id" != "new") { // Node creation 
    39         $node = Node::GetObject($node_id); 
     39        $node = Node::getNode($node_id); 
    4040    } 
    4141 
     
    4343    $smarty->assign("user_id", $user_id); 
    4444    $smarty->assign("node_id", $node_id); 
    45     $smarty->assign('node_deployment_status', Node::GetAllDeploymentStatus()); 
     45    $smarty->assign('node_deployment_status', Node::getAllDeploymentStatus()); 
    4646 
    4747    $smarty->display("admin/templates/hotspot_edit.html"); 
     
    5959    $smarty->assign("title", _("Add a new hotspot with")); 
    6060    $smarty->assign("node_id", $node_id); 
    61     $smarty->assign('node_deployment_status', Node::GetAllDeploymentStatus()); 
     61    $smarty->assign('node_deployment_status', Node::getAllDeploymentStatus()); 
    6262    $smarty->display("admin/templates/hotspot_edit.html"); 
    6363 
     
    128128 
    129129    //if (is_array($node_results)) { // If no row return, $node_results will be NULL 
    130     $nodes = Node::GetAllNodes(); 
     130    $nodes = Node::getAllNodes(); 
    131131    if (is_array($nodes)) { 
    132132        $smarty->assign('nodes', $nodes); 
  • trunk/wifidog-auth/wifidog/classes/Node.php

    r402 r405  
    3434   * @return a Node object, or null if there was an error 
    3535   */ 
    36   static function getObject($id) { 
     36  static function getNode($id) { 
    3737      $object = null; 
    3838      $object = new self($id); 
     
    4444   * @return the newly created Node object, or null if there was an error 
    4545   */ 
    46   static function createObject($id) { 
     46  static function createNode($id) { 
    4747      global $db; 
    4848 
     
    6262    $db->ExecSqlUniqueRes($sql, $row, false); 
    6363    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")); 
    6565    } 
    6666    $this->mRow = $row;   
     
    9696 
    9797    $db->ExecSql("SELECT * FROM nodes", $nodes, false); 
     98 
    9899    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")); 
    100121    } 
    101122    return $nodes; 
     
    107128    $db->ExecSql("SELECT * FROM node_deployment_status", $statuses, false); 
    108129    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")); 
    110131    } 
    111132    $statuses_array = array(); 
  • trunk/wifidog-auth/wifidog/node_list.php

    r402 r405  
    2727require_once BASEPATH.'include/common.php'; 
    2828require_once BASEPATH.'include/common_interface.php'; 
     29require_once BASEPATH.'classes/Node.php'; 
    2930 
    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); 
     31foreach(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); 
    3635} 
    3736 
  • trunk/wifidog-auth/wifidog/templates/node_list.html

    r334 r405  
    1717<tr class="{cycle values="odd,even"}"> 
    1818    <td class="status"> 
    19     {if $nodes[node].is_up == "t"} 
     19    {if $nodes[node].online == 't'} 
    2020    <img src='{$smarty.const.BASE_URL_PATH}images/hotspot_status_up.png'> 
    2121    {else}