mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
Apply fixes from StyleCI (#12120)
This commit is contained in:
@@ -7,11 +7,11 @@ unset($vars['page']);
|
||||
// Setup here
|
||||
|
||||
if (session('widescreen')) {
|
||||
$graph_width=1700;
|
||||
$thumb_width=180;
|
||||
$graph_width = 1700;
|
||||
$thumb_width = 180;
|
||||
} else {
|
||||
$graph_width=1075;
|
||||
$thumb_width=113;
|
||||
$graph_width = 1075;
|
||||
$thumb_width = 113;
|
||||
}
|
||||
|
||||
$vars['from'] = parse_at_time($vars['from']) ?: Config::get('time.day');
|
||||
@@ -25,15 +25,15 @@ $id = $vars['id'];
|
||||
|
||||
if (is_numeric($vars['device'])) {
|
||||
$device = device_by_id_cache($vars['device']);
|
||||
} elseif (!empty($vars['device'])) {
|
||||
} elseif (! empty($vars['device'])) {
|
||||
$device = device_by_name($vars['device']);
|
||||
}
|
||||
|
||||
if (is_file("includes/html/graphs/".$type."/auth.inc.php")) {
|
||||
require "includes/html/graphs/".$type."/auth.inc.php";
|
||||
if (is_file("includes/html/graphs/" . $type . "/auth.inc.php")) {
|
||||
require "includes/html/graphs/" . $type . "/auth.inc.php";
|
||||
}
|
||||
|
||||
if (!$auth) {
|
||||
if (! $auth) {
|
||||
require 'includes/html/error-no-perm.inc.php';
|
||||
} else {
|
||||
if (Config::has("graph_types.$type.$subtype.descr")) {
|
||||
@@ -67,9 +67,9 @@ if (!$auth) {
|
||||
echo "<select name='type' id='type' onchange=\"window.open(this.options[this.selectedIndex].value,'_top')\" >";
|
||||
|
||||
foreach (get_graph_subtypes($type, $device) as $avail_type) {
|
||||
echo "<option value='" . generate_url($vars, array('type' => $type . "_" . $avail_type, 'page' => "graphs")) . "'";
|
||||
echo "<option value='" . generate_url($vars, ['type' => $type . "_" . $avail_type, 'page' => "graphs"]) . "'";
|
||||
if ($avail_type == $subtype) {
|
||||
echo(" selected");
|
||||
echo " selected";
|
||||
}
|
||||
$display_type = nicecase($avail_type);
|
||||
echo ">$display_type</option>";
|
||||
@@ -79,7 +79,6 @@ if (!$auth) {
|
||||
|
||||
print_optionbar_end();
|
||||
|
||||
|
||||
$thumb_array = Config::get('graphs.row.normal');
|
||||
|
||||
echo '<table width=100% class="thumbnail_graph_table"><tr>';
|
||||
@@ -93,91 +92,91 @@ if (!$auth) {
|
||||
$link_array['page'] = "graphs";
|
||||
$link = generate_url($link_array);
|
||||
|
||||
echo('<td align=center>');
|
||||
echo('<b>'.$text.'</b><br>');
|
||||
echo('<a href="'.$link.'">');
|
||||
echo '<td align=center>';
|
||||
echo '<b>' . $text . '</b><br>';
|
||||
echo '<a href="' . $link . '">';
|
||||
echo generate_lazy_graph_tag($graph_array);
|
||||
echo('</a>');
|
||||
echo('</td>');
|
||||
echo '</a>';
|
||||
echo '</td>';
|
||||
}
|
||||
|
||||
echo('</tr></table>');
|
||||
echo '</tr></table>';
|
||||
|
||||
$graph_array = $vars;
|
||||
$graph_array['height'] = Config::get('webui.min_graph_height');
|
||||
$graph_array['width'] = $graph_width;
|
||||
$graph_array['width'] = $graph_width;
|
||||
|
||||
if ($screen_width = Session::get('screen_width')) {
|
||||
if ($screen_width > 800) {
|
||||
$graph_array['width'] = ($screen_width - ($screen_width /10));
|
||||
$graph_array['width'] = ($screen_width - ($screen_width / 10));
|
||||
} else {
|
||||
$graph_array['width'] = ($screen_width - ($screen_width /4));
|
||||
$graph_array['width'] = ($screen_width - ($screen_width / 4));
|
||||
}
|
||||
}
|
||||
|
||||
if ($screen_height = Session::get('screen_height')) {
|
||||
if ($screen_height > 960) {
|
||||
$graph_array['height'] = ($screen_height - ($screen_height /2));
|
||||
$graph_array['height'] = ($screen_height - ($screen_height / 2));
|
||||
} else {
|
||||
$graph_array['height'] = max($graph_array['height'], ($screen_height - ($screen_height /1.5)));
|
||||
$graph_array['height'] = max($graph_array['height'], ($screen_height - ($screen_height / 1.5)));
|
||||
}
|
||||
}
|
||||
|
||||
echo("<hr />");
|
||||
echo "<hr />";
|
||||
|
||||
include_once 'includes/html/print-date-selector.inc.php';
|
||||
|
||||
echo ('<div style="padding-top: 5px";></div>');
|
||||
echo('<center>');
|
||||
echo '<div style="padding-top: 5px";></div>';
|
||||
echo '<center>';
|
||||
if ($vars['legend'] == "no") {
|
||||
echo(generate_link("Show Legend", $vars, array('page' => "graphs", 'legend' => null)));
|
||||
echo generate_link("Show Legend", $vars, ['page' => "graphs", 'legend' => null]);
|
||||
} else {
|
||||
echo(generate_link("Hide Legend", $vars, array('page' => "graphs", 'legend' => "no")));
|
||||
echo generate_link("Hide Legend", $vars, ['page' => "graphs", 'legend' => "no"]);
|
||||
}
|
||||
|
||||
// FIXME : do this properly
|
||||
# if ($type == "port" && $subtype == "bits")
|
||||
# {
|
||||
echo(' | ');
|
||||
// if ($type == "port" && $subtype == "bits")
|
||||
// {
|
||||
echo ' | ';
|
||||
if ($vars['previous'] == "yes") {
|
||||
echo(generate_link("Hide Previous", $vars, array('page' => "graphs", 'previous' => null)));
|
||||
echo generate_link("Hide Previous", $vars, ['page' => "graphs", 'previous' => null]);
|
||||
} else {
|
||||
echo(generate_link("Show Previous", $vars, array('page' => "graphs", 'previous' => "yes")));
|
||||
echo generate_link("Show Previous", $vars, ['page' => "graphs", 'previous' => "yes"]);
|
||||
}
|
||||
# }
|
||||
// }
|
||||
|
||||
echo(' | ');
|
||||
echo ' | ';
|
||||
if ($vars['showcommand'] == "yes") {
|
||||
echo(generate_link("Hide RRD Command", $vars, array('page' => "graphs", 'showcommand' => null)));
|
||||
echo generate_link("Hide RRD Command", $vars, ['page' => "graphs", 'showcommand' => null]);
|
||||
} else {
|
||||
echo(generate_link("Show RRD Command", $vars, array('page' => "graphs", 'showcommand' => "yes")));
|
||||
echo generate_link("Show RRD Command", $vars, ['page' => "graphs", 'showcommand' => "yes"]);
|
||||
}
|
||||
|
||||
if ($vars['type'] == 'port_bits') {
|
||||
echo ' | To show trend, set to future date';
|
||||
}
|
||||
|
||||
echo('</center>');
|
||||
echo '</center>';
|
||||
|
||||
echo generate_graph_js_state($graph_array);
|
||||
|
||||
echo('<div style="width: '.$graph_array['width'].'; margin: auto;"><center>');
|
||||
echo '<div style="width: ' . $graph_array['width'] . '; margin: auto;"><center>';
|
||||
if (Config::get('webui.dynamic_graphs', false) === true) {
|
||||
echo generate_dynamic_graph_js($graph_array);
|
||||
echo generate_dynamic_graph_tag($graph_array);
|
||||
} else {
|
||||
echo generate_lazy_graph_tag($graph_array);
|
||||
}
|
||||
echo("</center></div>");
|
||||
echo "</center></div>";
|
||||
|
||||
if (Config::has('graph_descr.' . $vars['type'])) {
|
||||
print_optionbar_start();
|
||||
echo('<div style="float: left; width: 30px;">
|
||||
echo '<div style="float: left; width: 30px;">
|
||||
<div style="margin: auto auto;">
|
||||
<i class="fa fa-info-circle fa-lg icon-theme" aria-hidden="true"></i>
|
||||
</div>
|
||||
</div>');
|
||||
echo(Config::get('graph_descr.' . $vars['type']));
|
||||
</div>';
|
||||
echo Config::get('graph_descr.' . $vars['type']);
|
||||
print_optionbar_end();
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user