| 1 | <?php |
|---|
| 2 | /********************************************************************\ |
|---|
| 3 | * This program is free software; you can redistribute it and/or * |
|---|
| 4 | * modify it under the terms of the GNU General Public License as * |
|---|
| 5 | * published by the Free Software Foundation; either version 2 of * |
|---|
| 6 | * the License, or (at your option) any later version. * |
|---|
| 7 | * * |
|---|
| 8 | * This program is distributed in the hope that it will be useful, * |
|---|
| 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * |
|---|
| 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * |
|---|
| 11 | * GNU General Public License for more details. * |
|---|
| 12 | * * |
|---|
| 13 | * You should have received a copy of the GNU General Public License* |
|---|
| 14 | * along with this program; if not, contact: * |
|---|
| 15 | * * |
|---|
| 16 | * Free Software Foundation Voice: +1-617-542-5942 * |
|---|
| 17 | * 59 Temple Place - Suite 330 Fax: +1-617-542-2652 * |
|---|
| 18 | * Boston, MA 02111-1307, USA gnu@gnu.org * |
|---|
| 19 | * * |
|---|
| 20 | \********************************************************************/ |
|---|
| 21 | /**@file node_list.php |
|---|
| 22 | * Network status page |
|---|
| 23 | * @author Copyright (C) 2004 Benoit Gr�goire |
|---|
| 24 | */ |
|---|
| 25 | |
|---|
| 26 | define('BASEPATH','./'); |
|---|
| 27 | require_once BASEPATH.'include/common.php'; |
|---|
| 28 | require_once BASEPATH.'classes/Style.php'; |
|---|
| 29 | require_once (BASEPATH.'include/user_management_menu.php'); |
|---|
| 30 | require_once BASEPATH.'classes/Statistics.php'; |
|---|
| 31 | |
|---|
| 32 | //$style = new Style(); |
|---|
| 33 | $stats=new Statistics(); |
|---|
| 34 | |
|---|
| 35 | //echo $style->GetHeader(HOTSPOT_NETWORK_NAME.' hotspot status'); |
|---|
| 36 | // echo "<div id='head'><h1>". HOTSPOT_NETWORK_NAME ." node list</h1></div>\n"; |
|---|
| 37 | |
|---|
| 38 | //echo "<div id='content'>\n"; |
|---|
| 39 | |
|---|
| 40 | $db->ExecSql("SELECT *, (NOW()-last_heartbeat_timestamp) AS since_last_heartbeat, |
|---|
| 41 | CASE WHEN ((NOW()-last_heartbeat_timestamp) < interval '5 minutes') THEN true ELSE false END AS is_up FROM nodes WHERE node_deployment_status = 'DEPLOYED' OR node_deployment_status = 'NON_WIFIDOG_NODE' ORDER BY creation_date",$node_results, false); |
|---|
| 42 | echo "<table class='spreadsheet'>\n"; |
|---|
| 43 | echo "<thead><tr class='spreadsheet'><th class='spreadsheet' colspan=6>"._('Status of the ').count($node_results) .' '._("open").' '.HOTSPOT_NETWORK_NAME.' '._("HotSpots")."</th></tr>\n"; |
|---|
| 44 | echo "<tr class='spreadsheet'><th class='spreadsheet'>"._('HotSpot / Status')."</th>\n"; |
|---|
| 45 | echo "<th class='spreadsheet'>"._('Description')."</th>\n"; |
|---|
| 46 | echo "<th class='spreadsheet'>"._('Location')."</th>\n"; |
|---|
| 47 | echo "</tr></thead>\n"; |
|---|
| 48 | foreach($node_results as $node_row) |
|---|
| 49 | { |
|---|
| 50 | echo "<tr class='spreadsheet'>\n"; |
|---|
| 51 | echo "<td class='spreadsheet'>\n"; |
|---|
| 52 | if($node_row['node_deployment_status']=='NON_WIFIDOG_NODE') |
|---|
| 53 | { |
|---|
| 54 | echo "? "; |
|---|
| 55 | } |
|---|
| 56 | else |
|---|
| 57 | { |
|---|
| 58 | if($node_row['is_up']=='t') |
|---|
| 59 | { |
|---|
| 60 | echo "<img src='".BASE_URL_PATH . "images/hotspot_status_up.png'> "; |
|---|
| 61 | } |
|---|
| 62 | else |
|---|
| 63 | { |
|---|
| 64 | echo "<img src='".BASE_URL_PATH . "images/hotspot_status_down.png'> "; |
|---|
| 65 | } |
|---|
| 66 | } |
|---|
| 67 | |
|---|
| 68 | if(empty($node_row['home_page_url'])) |
|---|
| 69 | { |
|---|
| 70 | echo "$node_row[name]\n"; |
|---|
| 71 | } |
|---|
| 72 | else |
|---|
| 73 | { |
|---|
| 74 | echo "<a href='$node_row[home_page_url]' target='_new'>$node_row[name]</a>\n"; |
|---|
| 75 | } |
|---|
| 76 | if($node_row['is_up']!='t') |
|---|
| 77 | { |
|---|
| 78 | $duration = $db->GetDurationArrayFromIntervalStr($node_row['since_last_heartbeat']); |
|---|
| 79 | echo '<br />' . $duration['days'].'days '.$duration['hours'].'h '.$duration['minutes'].'min<br />'; |
|---|
| 80 | } |
|---|
| 81 | |
|---|
| 82 | echo "</td>\n"; |
|---|
| 83 | echo "<td class='spreadsheet'>\n"; |
|---|
| 84 | if(!empty($node_row['description'])) |
|---|
| 85 | { |
|---|
| 86 | echo "$node_row[description]\n"; |
|---|
| 87 | } |
|---|
| 88 | echo '<br />'; |
|---|
| 89 | echo _("Opened on "); |
|---|
| 90 | echo "$node_row[creation_date]\n"; |
|---|
| 91 | $num_online_users = $stats->getNumOnlineUsers($node_row['node_id']); |
|---|
| 92 | if($num_online_users!=0) |
|---|
| 93 | { |
|---|
| 94 | echo ", $num_online_users "; |
|---|
| 95 | echo _("user(s) online"); |
|---|
| 96 | } |
|---|
| 97 | |
|---|
| 98 | |
|---|
| 99 | echo "</td>\n"; |
|---|
| 100 | echo "<td class='spreadsheet'>\n"; |
|---|
| 101 | if(!empty($node_row['street_address'])) |
|---|
| 102 | { |
|---|
| 103 | echo "<br />$node_row[street_address]\n"; |
|---|
| 104 | } |
|---|
| 105 | if(!empty($node_row['map_url'])) |
|---|
| 106 | { |
|---|
| 107 | echo " - <a href='$node_row[map_url]' target='_new'>Map</a>\n"; |
|---|
| 108 | } |
|---|
| 109 | if(!empty($node_row['mass_transit_info'])) |
|---|
| 110 | { |
|---|
| 111 | echo "<br />$node_row[mass_transit_info]\n"; |
|---|
| 112 | } |
|---|
| 113 | if(!empty($node_row['public_phone_number'])) |
|---|
| 114 | { |
|---|
| 115 | echo "<br />$node_row[public_phone_number]\n"; |
|---|
| 116 | } |
|---|
| 117 | if(!empty($node_row['public_email'])) |
|---|
| 118 | { |
|---|
| 119 | echo "<br />$node_row[public_email]\n"; |
|---|
| 120 | } |
|---|
| 121 | |
|---|
| 122 | |
|---|
| 123 | echo "</td>\n"; |
|---|
| 124 | } |
|---|
| 125 | echo "</table>\n"; |
|---|
| 126 | |
|---|
| 127 | // echo "</div>\n"; |
|---|
| 128 | |
|---|
| 129 | //echo $style->GetFooter(); |
|---|
| 130 | ?> |
|---|