Ejemplo n.º 1
0
function generate_device_link($device, $text = null, $vars = array(), $start = 0, $end = 0, $escape_text = 1, $overlib = 1)
{
    global $config;
    if (!$start) {
        $start = $config['time']['day'];
    }
    if (!$end) {
        $end = $config['time']['now'];
    }
    $class = devclass($device);
    if (!$text) {
        $text = $device['hostname'];
    }
    if (isset($config['os'][$device['os']]['over'])) {
        $graphs = $config['os'][$device['os']]['over'];
    } else {
        if (isset($device['os_group']) && isset($config['os'][$device['os_group']]['over'])) {
            $graphs = $config['os'][$device['os_group']]['over'];
        } else {
            $graphs = $config['os']['default']['over'];
        }
    }
    $url = generate_device_url($device, $vars);
    // beginning of overlib box contains large hostname followed by hardware & OS details
    $contents = '<div><span class="list-large">' . $device['hostname'] . '</span>';
    if ($device['hardware']) {
        $contents .= ' - ' . $device['hardware'];
    }
    if ($device['os']) {
        $contents .= ' - ' . mres($config['os'][$device['os']]['text']);
    }
    if ($device['version']) {
        $contents .= ' ' . mres($device['version']);
    }
    if ($device['features']) {
        $contents .= ' (' . mres($device['features']) . ')';
    }
    if (isset($device['location'])) {
        $contents .= ' - ' . htmlentities($device['location']);
    }
    $contents .= '</div>';
    foreach ($graphs as $entry) {
        $graph = $entry['graph'];
        $graphhead = $entry['text'];
        $contents .= '<div class="overlib-box">';
        $contents .= '<span class="overlib-title">' . $graphhead . '</span><br />';
        $contents .= generate_minigraph_image($device, $start, $end, $graph);
        $contents .= generate_minigraph_image($device, $config['time']['week'], $end, $graph);
        $contents .= '</div>';
    }
    if ($escape_text) {
        $text = htmlentities($text);
    }
    if ($overlib == 0) {
        $link = $contents;
    } else {
        $link = overlib_link($url, $text, escape_quotes($contents), $class);
    }
    if (device_permitted($device['device_id'])) {
        return $link;
    } else {
        return $device['hostname'];
    }
}
Ejemplo n.º 2
0
function generate_device_link($device, $text = NULL, $vars = array(), $escape = TRUE)
{
    if (is_array($device) && !$device['hostname']) {
        $device = device_by_id_cache($device['device_id']);
    }
    if (!device_permitted($device['device_id'])) {
        $text = $escape ? escape_html($device['hostname']) : $device['hostname'];
        return $text;
    }
    $class = devclass($device);
    if (!$text) {
        $text = $device['hostname'];
    }
    $url = generate_device_url($device, $vars);
    //$link = overlib_link($url, $text, $contents, $class, $escape);
    if ($escape) {
        $text = escape_html($text);
    }
    return '<a href="' . $url . '" class="entity-popup ' . $class . '" data-eid="' . $device['device_id'] . '" data-etype="device">' . $text . '</a>';
}
Ejemplo n.º 3
0
function generate_device_link($device, $text = NULL, $vars = array(), $start = 0, $end = 0)
{
    global $config;
    $class = devclass($device);
    if (!$text) {
        $text = $device['hostname'];
    }
    $contents = generate_device_link_contents($device, $vars, $start, $end);
    $text = htmlentities($text);
    $url = generate_device_url($device, $vars);
    $link = overlib_link($url, $text, $contents, $class);
    if (!device_permitted($device['device_id'])) {
        return $device['hostname'];
    }
    return $link;
}
Ejemplo n.º 4
0
function generatedevicelink($device, $text = 0, $start = 0, $end = 0)
{
    global $twoday;
    global $day;
    global $now;
    global $config;
    if (!$start) {
        $start = $day;
    }
    if (!$end) {
        $end = $now;
    }
    $class = devclass($device);
    if (!$text) {
        $text = $device['hostname'];
    }
    $graph_url = $config['base_url'] . "/graph.php?device=" . $device['device_id'] . "&amp;from={$start}&amp;to={$end}&amp;width=400&amp;height=120&amp;type=device_cpu";
    $graph_url_b = $config['base_url'] . "/graph.php?device=" . $device['device_id'] . "&amp;from={$start}&amp;to={$end}&amp;width=400&amp;height=120&amp;type=device_memory";
    $url = $config['base_url'] . "/device/" . $device['device_id'] . "/";
    $contents = "<div class=list-large>" . $device['hostname'] . " - CPU &amp; Memory Usage</div>";
    if (isset($device['location'])) {
        $contents .= "" . htmlentities($device['location'] . "<br />");
    }
    $contents .= "<img src=\\'{$graph_url}\\'><br /><img src=\\'{$graph_url_b}\\'";
    $text = htmlentities($text);
    $link = overlib_link($url, $text, $contents, $class);
    return $link;
}
function generate_device_link($device, $text = NULL, $vars = array(), $start = 0, $end = 0)
{
    $class = devclass($device);
    if (!$text) {
        $text = $device['hostname'];
    }
    #  $contents = generate_device_link_contents($device, $vars, $start, $end);
    $text = htmlentities($text);
    $url = generate_device_url($device, $vars);
    $link = overlib_link($url, $text, $contents, $class);
    if (!device_permitted($device['device_id'])) {
        return $device['hostname'];
    }
    return '<a href="' . $url . '" class="entity-popup ' . $class . '" data-eid="' . $device['device_id'] . '" data-etype="device">' . $text . '</a>';
}