function generate_port_popup($port, $text = NULL, $type = NULL) { global $config; if (!isset($port['os'])) { $port = array_merge($port, device_by_id_cache($port['device_id'])); } humanize_port($port); if (!$text) { $text = rewrite_ifname($port['label']); } if ($type) { $port['graph_type'] = $type; } if (!isset($port['graph_type'])) { $port['graph_type'] = 'port_bits'; } $class = ifclass($port['ifOperStatus'], $port['ifAdminStatus']); if (!isset($port['os'])) { $port = array_merge($port, device_by_id_cache($port['device_id'])); } $content = generate_device_popup_header($port); $content .= generate_port_popup_header($port); $content .= '<div style="width: 700px">'; $graph_array['type'] = $port['graph_type']; $graph_array['legend'] = "yes"; $graph_array['height'] = "100"; $graph_array['width'] = "275"; $graph_array['to'] = $config['time']['now']; $graph_array['from'] = $config['time']['day']; $graph_array['id'] = $port['port_id']; $content .= generate_graph_tag($graph_array); $graph_array['from'] = $config['time']['week']; $content .= generate_graph_tag($graph_array); $graph_array['from'] = $config['time']['month']; $content .= generate_graph_tag($graph_array); $graph_array['from'] = $config['time']['year']; $content .= generate_graph_tag($graph_array); $content .= "</div>"; return $content; }
/** * Returns a string containing an HTML to be used as a port popups * * @param array $port array * @param string $text to be used as port label * @param string $type graph type to be used in graphs (bits, nupkts, etc) * * @return string HTML port popup contents */ function generate_port_popup($port, $text = NULL, $type = NULL) { $time = $GLOBALS['config']['time']; if (!isset($port['os'])) { $port = array_merge($port, device_by_id_cache($port['device_id'])); } humanize_port($port); if (!$text) { $text = rewrite_ifname($port['port_label']); } if ($type) { $port['graph_type'] = $type; } if (!isset($port['graph_type'])) { $port['graph_type'] = 'port_bits'; } if (!isset($port['os'])) { $port = array_merge($port, device_by_id_cache($port['device_id'])); } $content = generate_device_popup_header($port); $content .= generate_port_popup_header($port); $content .= '<div style="width: 700px">'; //$content .= generate_box_open(array('body-style' => 'width: 700px;')); $graph_array['type'] = $port['graph_type']; $graph_array['legend'] = "yes"; $graph_array['height'] = "100"; $graph_array['width'] = "275"; $graph_array['to'] = $time['now']; $graph_array['from'] = $time['day']; $graph_array['id'] = $port['port_id']; $content .= generate_graph_tag($graph_array); $graph_array['from'] = $time['week']; $content .= generate_graph_tag($graph_array); $graph_array['from'] = $time['month']; $content .= generate_graph_tag($graph_array); $graph_array['from'] = $time['year']; $content .= generate_graph_tag($graph_array); $content .= "</div>"; //$content .= generate_box_close(); return $content; }