'device', 'device' => $device['device_id'], 'tab' => 'graphs']; $graphs_sections = []; foreach ($device['graphs'] as $entry) { if (isset($entry['enabled']) && !$entry['enabled']) { continue; } // Skip disabled graphs $section = $config['graph_types']['device'][$entry['graph']]['section']; if (in_array($section, $config['graph_sections'])) { // Collect only enabled and exists graphs //$graphs_sections[$section][$entry['graph']] = $entry['enabled']; if (isset($config['graph_types']['device'][$entry['graph']]['order']) && is_numeric($config['graph_types']['device'][$entry['graph']]['order'])) { $order = $config['graph_types']['device'][$entry['graph']]['order']; } else { $order = 999; // Set high order for unordered graphs } while (isset($graphs_sections[$section][$order])) { $order++; } $graphs_sections[$section][$order] = $entry['graph']; } } if (OBSERVIUM_EDITION !== 'community') { // Custom OIDs $sql = "SELECT * FROM `oids_entries`"; $sql .= " LEFT JOIN `oids` USING(`oid_id`)"; $sql .= " WHERE `device_id` = ?"; $custom_graphs = dbFetchRows($sql, [$device['device_id']]); if (count($custom_graphs)) { $graphs_sections['custom'] = TRUE; } } $navbar['brand'] = "Graphs"; $navbar['class'] = "navbar-narrow"; // Set sections order $graphs_sections_sorted = []; foreach ($config['graph_sections'] as $section) { if (isset($graphs_sections[$section])) { $graphs_sections_sorted[$section] = $graphs_sections[$section]; unset($graphs_sections[$section]); } } $graphs_sections = array_merge($graphs_sections_sorted, $graphs_sections); //print_vars($graphs_sections); unset($graphs_sections_sorted); foreach ($graphs_sections as $section => $graph) { $type = strtolower($section); if (empty($config['graph_sections'][$section])) { $text = nicecase($type); } else { $text = $config['graph_sections'][$section]; } if (!$vars['group']) { $vars['group'] = $type; } if ($vars['group'] == $type) { $navbar['options'][$section]['class'] = "active"; } $navbar['options'][$section]['url'] = generate_url(['page' => 'device', 'device' => $device['device_id'], 'tab' => 'graphs', 'group' => $type]); $navbar['options'][$section]['text'] = $text; //print_vars($graph); } print_navbar($navbar); echo generate_box_open(); echo('
');
echo('' . $graph_title . ''); print_graph_row($graph_array); echo(' |
');
echo('' . $graph_title . ''); print_graph_row($graph_array); echo(' |