Files
librenms-librenms/includes/html/pages/wireless.inc.php
T

85 lines
2.6 KiB
PHP
Raw Normal View History

2017-05-01 23:49:11 -05:00
<?php
/**
* wireless.inc.php
*
* Wireless Sensors table view
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* @package LibreNMS
* @link http://librenms.org
* @copyright 2017 Tony Murray
* @author Tony Murray <murraytony@gmail.com>
*/
2017-12-24 22:19:22 +02:00
$pagetitle[] = "Wireless";
2017-05-01 23:49:11 -05:00
use LibreNMS\Device\WirelessSensor;
$sensors = dbFetchColumn('SELECT `sensor_class` FROM `wireless_sensors` GROUP BY `sensor_class`');
$valid_wireless_types = array_intersect_key(WirelessSensor::getTypes(), array_flip($sensors));
2019-04-11 23:26:42 -05:00
$class = basename($vars['metric'] ?? key($valid_wireless_types));
$vars['view'] = basename($vars['view'] ?? 'nographs');
2017-05-01 23:49:11 -05:00
2017-12-24 22:19:22 +02:00
$link_array = array('page' => 'wireless');
2017-05-01 23:49:11 -05:00
2017-12-24 22:19:22 +02:00
$linkoptions = '<span style="font-weight: bold;">Wireless</span> &#187; ';
2017-05-01 23:49:11 -05:00
$sep = '';
foreach ($valid_wireless_types as $type => $details) {
2017-12-24 22:19:22 +02:00
$linkoptions .= $sep;
2017-05-01 23:49:11 -05:00
if ($class == $type) {
2017-12-24 22:19:22 +02:00
$linkoptions .= '<span class="pagemenu-selected">';
2017-05-01 23:49:11 -05:00
}
$linkoptions .= generate_link(__("wireless.$type.short"), $link_array, array('metric'=> $type, 'view' => $vars['view']));
2017-05-01 23:49:11 -05:00
if ($class == $type) {
2017-12-24 22:19:22 +02:00
$linkoptions .= '</span>';
2017-05-01 23:49:11 -05:00
}
$sep = ' | ';
}
unset($sep);
2017-12-24 22:19:22 +02:00
$displayoptions = '';
2017-05-01 23:49:11 -05:00
if ($vars['view'] == "graphs") {
2017-12-24 22:19:22 +02:00
$displayoptions .= '<span class="pagemenu-selected">';
2017-05-01 23:49:11 -05:00
}
2017-12-24 22:19:22 +02:00
$displayoptions .= generate_link("Graphs", $link_array, array("metric"=> $class, "view" => "graphs"));
2017-05-01 23:49:11 -05:00
if ($vars['view'] == "graphs") {
2017-12-24 22:19:22 +02:00
$displayoptions .= '</span>';
2017-05-01 23:49:11 -05:00
}
2017-12-24 22:19:22 +02:00
$displayoptions .= ' | ';
2017-05-01 23:49:11 -05:00
if ($vars['view'] != "graphs") {
2017-12-24 22:19:22 +02:00
$displayoptions .= '<span class="pagemenu-selected">';
2017-05-01 23:49:11 -05:00
}
2017-12-24 22:19:22 +02:00
$displayoptions .= generate_link("No Graphs", $link_array, array("metric"=> $class, "view" => "nographs"));
2017-05-01 23:49:11 -05:00
if ($vars['view'] != "graphs") {
2017-12-24 22:19:22 +02:00
$displayoptions .= '</span>';
2017-05-01 23:49:11 -05:00
}
if (isset($valid_wireless_types[$class])) {
$graph_type = 'wireless_' . $class;
$unit = __("wireless.$class.unit");
2017-12-24 22:19:22 +02:00
$pagetitle[] = "Wireless :: ".$class;
2019-06-23 00:29:12 -05:00
include \LibreNMS\Config::get('install_dir') . '/includes/html/pages/wireless/sensors.inc.php';
2017-05-01 23:49:11 -05:00
} else {
echo("No sensors of type " . $class . " found.");
}