function showPercent($per) { $background = get_percentage_colours($per); $right_background = $background['right']; $left_background = $background['left']; $res = print_percentage_bar(350, 20, $per, NULL, "ffffff", $left_background, $per . "%", "ffffff", $right_background); return $res; }
function showPercent($per) { $background = get_percentage_colours($per); $right_background = $background['right']; $left_background = $background['left']; $res = print_percentage_bar(350, 20, $per, null, 'ffffff', $left_background, $per . '%', 'ffffff', $right_background); return $res; }
$graph_array['legend'] = 'no'; $link_array = $graph_array; $link_array['page'] = 'graphs'; unset($link_array['height'], $link_array['width'], $link_array['legend']); $link = generate_url($link_array); $text_descr = $entity['entPhysicalName'] . ' - Fabric ' . $subindex; $overlib_content = generate_overlib_content($graph_array, $device['hostname'] . ' - ' . $text_descr); $graph_array['width'] = 80; $graph_array['height'] = 20; $graph_array['bg'] = 'ffffff00'; // the 00 at the end makes the area transparent. $minigraph = generate_lazy_graph_tag($graph_array); echo '<tr> <td></td> <td><strong>Fabric ' . $subindex . "</strong></td>\n <td><span style='font-weight: bold;' class=" . $fabric['mode_class'] . '>' . $fabric['cc6kxbarModuleChannelFabStatus'] . '</span></td> <td>' . formatRates($fabric['cc6kxbarModuleChannelSpeed'] * 1000000) . '</td> <td>' . overlib_link($link, $minigraph, $overlib_content) . '</td> <td>' . print_percentage_bar(125, 20, $percent_in, 'Ingress', 'ffffff', $background['left'], $percent_in . '%', 'ffffff', $background['right']) . '</td> <td>' . print_percentage_bar(125, 20, $percent_out, 'Egress', 'ffffff', $background['left'], $percent_out . '%', 'ffffff', $background['right']) . '</td> </tr>'; } //end if } //end foreach } //end foreach echo ' </table>'; echo ' </div>'; echo ' </div>'; echo ' </div>'; echo '</div>';
function generate_printersupplies_row($supply, $vars) { $graph_type = "printersupply_usage"; $table_cols = 5; $total = $supply['supply_capacity']; $perc = $supply['supply_value']; $graph_array['type'] = $graph_type; $graph_array['id'] = $supply['supply_id']; $graph_array['from'] = $GLOBALS['config']['time']['day']; $graph_array['to'] = $GLOBALS['config']['time']['now']; $graph_array['height'] = "20"; $graph_array['width'] = "80"; if ($supply['supply_colour'] != '') { $background = toner_to_colour($supply['supply_colour'], $perc); } else { $background = toner_to_colour($supply['supply_descr'], $perc); } /// FIXME - popup for printersupply entity. $output .= '<tr class="' . $supply['html_row_class'] . '">'; $output .= '<td class="state-marker"></td>'; if ($vars['popup'] == TRUE) { $output .= '<td style="width: 40px; text-align: center;"><i class="' . $GLOBALS['config']['entities']['printersupply']['icon'] . '"></i></td>'; } else { $output .= '<td style="width: 1px;"></td>'; } if ($vars['page'] != "device" && $vars['popup'] != TRUE) { $output .= '<td class="entity">' . generate_device_link($supply) . '</td>'; $table_cols++; } $output .= '<td class="entity">' . generate_entity_link('printersupply', $supply) . '</td>'; if (!isset($vars['supply'])) { $output .= '<td>' . nicecase($supply['supply_type']) . '</td>'; } $output .= '<td style="width: 70px;">' . generate_graph_popup($graph_array) . '</td>'; $output .= '<td style="width: 200px;"><a href="' . $link . '">' . print_percentage_bar(400, 20, $perc, $perc . '%', 'ffffff', $background['right'], NULL, "ffffff", $background['left']) . '</a></td>'; $output .= '<td style="width: 50px; text-align: right;"><span class="label">' . $perc . '%</span></td>'; $output .= '</tr>'; if ($vars['view'] == "graphs") { $output .= '<tr class="' . $supply['html_row_class'] . '">'; $output .= '<td class="state-marker"></td>'; $output .= '<td colspan=' . $table_cols . '>'; unset($graph_array['height'], $graph_array['width'], $graph_array['legend']); $graph_array['to'] = $config['time']['now']; $graph_array['id'] = $supply['supply_id']; $graph_array['type'] = $graph_type; $output .= generate_graph_row($graph_array, TRUE); $output .= "</td></tr>"; } # endif graphs return $output; }
$graph_array['legend'] = "no"; $link_array = $graph_array; $link_array['page'] = "graphs"; unset($link_array['height'], $link_array['width'], $link_array['legend']); $link = generate_url($link_array); $overlib_content = generate_overlib_content($graph_array, $device['hostname'] . " - " . $text_descr); $graph_array['width'] = 80; $graph_array['height'] = 20; $graph_array['bg'] = 'ffffff00'; # the 00 at the end makes the area transparent. // $graph_array['style'][] = 'margin-top: -6px'; $minigraph = generate_graph_tag($graph_array); echo '<tr class="device-overview"> <td style="max-width: 100px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;"><strong>' . overlib_link($link, $text_descr, $overlib_content) . '</strong></td> <td style="width: 90px">' . overlib_link($link, $minigraph, $overlib_content) . '</td> <td style="width: 200px">' . overlib_link($link, print_percentage_bar(200, 20, $percent, $used . "/" . $total . " (" . $percent . "%)", "ffffff", $background['left'], $free . " (" . (100 - $percent) . "%)", "ffffff", $background['right']), $overlib_content) . '</td> </tr>'; /** <tr class="small"> <td colspan=3> <span class="pull-right"> <?php echo("<strong>Used</strong> <strong style='color:#".$background['left'].";'>$used ($percent%)</strong> / <strong>Free</strong> <strong style='color:#".$background['right'].";'>$free (".(100 - $percent) . "%)</strong> / <strong>Total</strong> <strong>$total</strong>"); ?> </span> </td> </tr> */ } echo "</table>"; echo "</div></div>"; } // EOF
//$total = formatStorage($toner['toner_size']); //$free = formatStorage($toner['toner_free']); //$used = formatStorage($toner['toner_used']); $background = toner2colour($toner['toner_descr'], $percent); $graph_array = array(); $graph_array['height'] = "100"; $graph_array['width'] = "210"; $graph_array['to'] = $config['time']['now']; $graph_array['id'] = $toner['toner_id']; $graph_array['type'] = $graph_type; $graph_array['from'] = $config['time']['day']; $graph_array['legend'] = "no"; $link_array = $graph_array; $link_array['page'] = "graphs"; unset($link_array['height'], $link_array['width'], $link_array['legend']); $link = generate_url($link_array); $overlib_content = generate_overlib_content($graph_array, $device['hostname'] . " - " . $toner['toner_descr']); $graph_array['width'] = 80; $graph_array['height'] = 20; $graph_array['bg'] = 'ffffff00'; # the 00 at the end makes the area transparent. $graph_array['style'][] = 'margin-top: -6px'; $minigraph = generate_graph_tag($graph_array); $percent_text = $percent < 0 ? "Unknown" : $percent . "%"; echo "<tr class=device-overview>\n <td class=strong>" . overlib_link($link, $toner['toner_descr'], $overlib_content) . "</td>\n <td style='width: 90px;'>" . overlib_link($link, $minigraph, $overlib_content) . "</td>\n <td style='width: 200px;'>" . overlib_link($link, print_percentage_bar(200, 20, $percent, NULL, "ffffff", $background['left'], $percent_text, "ffffff", $background['right']), $overlib_content) . "</td>\n </tr>"; } echo "</table>"; echo "</div></div>"; } unset($toner_rows); // EOF
case $percent >= 90: $perc['BG'] = "danger"; break; case $percent >= 75: $perc['BG'] = "warning"; break; case $percent >= 50: $perc['BG'] = "success"; break; default: $perc['BG'] = "info"; } $perc['width'] = $percent <= "100" ? $percent : "100"; $url = generate_url($vars, array('detail' => $history['bill_hist_id'])); $background = get_percentage_colours($percent); echo "\n <tr>\n <td><i class=\"icon-calendar\"></i> <strong>" . strftime("%F", strtotime($datefrom)) . " to " . strftime("%F", strtotime($dateto)) . "</strong></td>\n <td><span class=\"label label-" . $label . "\">{$type}</span></td>\n <td><span class=\"badge badge-success\">{$allowed}</span></td>\n <td><span class=\"badge\">{$in}</span></td>\n <td><span class=\"badge\">{$out}</span></td>\n <td>{$total_data}</td>\n <td>{$rate_95th}</td>\n <td style=\"text-align: center;\">{$overuse}</td>\n <td width=\"225\">\n " . print_percentage_bar(400, 20, $percent, $percent . '%', "ffffff", $background['left'], 100 - $percent . "%", "ffffff", $background['right']) . "\n </td>\n <td>\n <div class=\"btn-toolbar\" style=\"margin: 0px auto 0px auto;\">\n <div class=\"btn-group\">\n <a class=\"btn btn-mini\" href=\"" . $url . "\"><img src=\"images/16/chart_curve.png\" alt=\"Show details\" title=\"Show details\" rel=\"tooltip\"/></a>"; // Don't show things people can't use! //<a class=\"btn btn-mini\" disabled=\"disabled\" href=\"javascript:;\"><img src=\"images/16/page_white_acrobat.png\" alt=\"PDF Report\" title=\"PDF Report\" rel=\"tooltip\"/></a> //<a href=\"pdf.php?type=billing&report=history&bill_id=".$bill_id."&history_id=".$history['bill_hist_id']."\"><img src=\"images/16/page_white_acrobat.png\" border=\"0\" align=\"absmiddle\" alt=\"PDF Report\" title=\"PDF Report\"/></a> echo "\n </div>\n </div>\n </td>\n </tr>"; if ($vars['detail'] == $history['bill_hist_id'] || $vars['detail'] == "all") { $img['bitrate'] = showDetails($bill_id, "bitrate", strtotime($datefrom), strtotime($dateto), $type); $img['bw_day'] = showDetails($bill_id, "day", strtotime($datefrom), strtotime($dateto)); $img['bw_hour'] = showDetails($bill_id, "hour", strtotime($datefrom), strtotime($dateto)); echo "\n <tr>\n <td colspan=\"10\" style=\"text-align: center; background-color: #ffffff;\">\n <!-- <b>Accuate Graph</b><br /> //-->\n " . $img['bitrate'] . "<br />\n <!-- <b>Bandwidth Graph per day</b><br /> //-->\n " . $img['bw_day'] . "<br />\n <!-- <b>Bandwidth Graph per hour</b><br /> //-->\n " . $img['bw_hour'] . "\n </td>\n </tr>"; } } // PERMITTED } echo " </tobdy>"; echo " </table>";
$rate_95th = round($rate_95th, 2); $percent = round($rate_95th / $cdr * 100, 2); $type = '&95th=yes'; ?> <td> <?php echo format_si($rate_95th); ?> of <?php echo format_si($cdr) . 'bps (' . $percent . '%)'; ?> (95th%ile) </td> <td style="width: 210px;"> <?php echo print_percentage_bar(200, 20, $percent, null, 'ffffff', $background['left'], $percent . '%', 'ffffff', $background['right']); ?> </td> <?php } } //end if ?> </tr> </table> </div> </div> </div> <?php
continue; } } $total = $toner['toner_capacity']; $perc = $toner['toner_current']; $graph_array['type'] = $graph_type; $graph_array['id'] = $toner['toner_id']; $graph_array['from'] = $config['time']['day']; $graph_array['to'] = $config['time']['now']; $graph_array['height'] = "20"; $graph_array['width'] = "80"; $graph_array_zoom = $graph_array; $graph_array_zoom['height'] = "150"; $graph_array_zoom['width'] = "400"; $link = "graphs/id=" . $graph_array['id'] . "/type=" . $graph_array['type'] . "/from=" . $graph_array['from'] . "/to=" . $graph_array['to'] . "/"; $mini_graph = overlib_link($link, generate_graph_tag($graph_array), generate_graph_tag($graph_array_zoom), NULL); $background = get_percentage_colours(100 - $perc); echo "<tr class='health'><td>" . generate_device_link($toner) . "</td><td class=strong>" . $toner['toner_descr'] . "</td>\n <td>{$mini_graph}</td>\n <td>\n <a href='#' {$store_popup}>" . print_percentage_bar(400, 20, $perc, "{$perc}%", "ffffff", $background['left'], $free, "ffffff", $background['right']) . "</a>\n </td><td>{$perc}" . "%</td></tr>"; if ($vars['view'] == "graphs") { echo "<tr></tr><tr class='health'><td colspan=5>"; unset($graph_array['height'], $graph_array['width'], $graph_array['legend']); $graph_array['to'] = $config['time']['now']; $graph_array['id'] = $toner['toner_id']; $graph_array['type'] = $graph_type; include "includes/print-graphrow.inc.php"; echo "</td></tr>"; } # endif graphs } } echo "</table></div>";
$link = generate_url(array("page" => "device", "device" => $proc['device_id'], "tab" => "health", "metric" => 'processor')); $overlib_content = generate_overlib_content($graph_array, $proc['hostname'] . " - " . htmlentities($text_descr), NULL); $graph_array['width'] = 80; $graph_array['height'] = 20; $graph_array['bg'] = 'ffffff00'; # the 00 at the end makes the area transparent. $graph_array['from'] = $config['time']['day']; $mini_graph = generate_graph_tag($graph_array); $perc = round($proc['processor_usage']); $background = get_percentage_colours($perc); echo '<tr class="' . $proc['html_row_class'] . '"> <td class="entity">' . generate_device_link($proc) . '</td> <td>' . overlib_link($link, htmlentities($text_descr), $overlib_content) . '</td> <td>' . overlib_link($link_graph, $mini_graph, $overlib_content) . '</td> <td><a href="' . $link_graph . '"> ' . print_percentage_bar(400, 20, $perc, $perc . "%", "ffffff", $background['left'], 100 - $perc . "%", "ffffff", $background['right']) . ' </a> </td> </tr> '; if ($vars['view'] == "graphs") { echo "<tr><td colspan=4>"; unset($graph_array['height'], $graph_array['width'], $graph_array['legend']); $graph_array['to'] = $config['time']['now']; $graph_array['id'] = $proc['processor_id']; $graph_array['type'] = $graph_type; print_graph_row($graph_array); echo "</td></tr>"; } # endif graphs }
$graph_array['width'] = 80; $graph_array['height'] = 20; $graph_array['bg'] = 'ffffff00'; # the 00 at the end makes the area transparent. $graph_array['from'] = $config['time']['day']; $mini_graph = generate_graph_tag($graph_array); $total = formatStorage($mempool['mempool_total']); $used = formatStorage($mempool['mempool_used']); $free = formatStorage($mempool['mempool_free']); $background = get_percentage_colours($mempool['mempool_perc']); echo '<tr> <td class="entity">' . generate_device_link($mempool) . '</td> <td>' . overlib_link($link, $mempool['mempool_descr'], $overlib_content) . '</td> <td>' . overlib_link($link_graph, $mini_graph, $overlib_content) . '</td> <td><a href="' . $proc_url . '" ' . $proc_popup . '> ' . print_percentage_bar(400, 20, $mempool['mempool_perc'], $used . ' / ' . $total, "ffffff", $background['left'], $free, "ffffff", $background['right']) . ' </a> </td> <td>' . $mempool['mempool_perc'] . '%</td> </tr> '; if ($vars['view'] == "graphs") { echo "<tr><td colspan=5>"; unset($graph_array['height'], $graph_array['width'], $graph_array['legend']); $graph_array['to'] = $config['time']['now']; $graph_array['id'] = $mempool['mempool_id']; $graph_array['type'] = $graph_type; print_graph_row($graph_array); echo "</td></tr>"; } # endif graphs
$total = formatStorage($mempool['mempool_total']); $used = formatStorage($mempool['mempool_used']); $free = formatStorage($mempool['mempool_free']); } else { // If total == 100, than memory not have correct size and uses percents only $total = $mempool['mempool_total'] . '%'; $used = $mempool['mempool_used'] . '%'; $free = $mempool['mempool_free'] . '%'; } $background = get_percentage_colours($mempool['mempool_perc']); echo '<tr class="' . $mempool['html_row_class'] . '"> <td class="entity">' . generate_device_link($mempool) . '</td> <td>' . overlib_link($link, htmlentities($mempool['mempool_descr']), $overlib_content) . '</td> <td>' . overlib_link($link_graph, $mini_graph, $overlib_content) . '</td> <td><a href="' . $link_graph . '"> ' . print_percentage_bar(400, 20, $mempool['mempool_perc'], $used . '/' . $total . ' (' . $mempool['mempool_perc'] . '%)', "ffffff", $background['left'], $free . ' (' . (100 - $mempool['mempool_perc']) . '%)', "ffffff", $background['right']) . ' </a> </td> <td>' . $mempool['mempool_perc'] . '%</td> </tr> '; if ($vars['view'] == "graphs") { echo "<tr><td colspan=5>"; unset($graph_array['height'], $graph_array['width'], $graph_array['legend']); $graph_array['to'] = $config['time']['now']; $graph_array['id'] = $mempool['mempool_id']; $graph_array['type'] = $graph_type; print_graph_row($graph_array); echo "</td></tr>"; } # endif graphs
function generate_storage_row($storage, $vars) { global $config; $table_cols = 8; if ($vars['page'] != "device" && $vars['popup'] != TRUE) { $table_cols++; } // Add a column for device. $graph_array = array(); $graph_array['to'] = $config['time']['now']; $graph_array['id'] = $storage['storage_id']; $graph_array['type'] = 'storage_usage'; $graph_array['legend'] = "no"; $link_array = $graph_array; $link_array['page'] = "graphs"; unset($link_array['height'], $link_array['width'], $link_array['legend']); $link_graph = generate_url($link_array); $link = generate_url(array("page" => "device", "device" => $storage['device_id'], "tab" => "health", "metric" => 'storage')); $overlib_content = generate_overlib_content($graph_array, $storage['hostname'] . ' - ' . $storage['storage_descr']); $graph_array['width'] = 80; $graph_array['height'] = 20; $graph_array['bg'] = 'ffffff00'; $graph_array['from'] = $config['time']['day']; $mini_graph = generate_graph_tag($graph_array); $total = formatStorage($storage['storage_size']); $used = formatStorage($storage['storage_used']); $free = formatStorage($storage['storage_free']); $background = get_percentage_colours($storage['storage_perc']); if ($storage['storage_ignore']) { $storage['row_class'] = 'suppressed'; } else { $storage['row_class'] = $background['class']; } $row .= '<tr class="ports ' . $storage['row_class'] . '"> <td class="state-marker"></td>'; if ($vars['page'] != "device" && $vars['popup'] != TRUE) { $row .= '<td class="entity">' . generate_device_link($storage) . '</td>'; } $row .= ' <td class="entity">' . generate_entity_link('storage', $storage) . '</td> <td>' . $total . '</td> <td>' . $used . '</td> <td>' . $free . '</td> <td>' . overlib_link($link_graph, $mini_graph, $overlib_content) . '</td> <td><a href="' . $link_graph . '"> ' . print_percentage_bar(400, 20, $storage['storage_perc'], $storage['storage_perc'] . '%', "ffffff", $background['left'], 100 - $storage['storage_perc'] . "%", "ffffff", $background['right']) . ' </a> </td> </tr> '; if ($vars['view'] == "graphs") { $vars['graph'] = "usage"; } if ($vars['graph']) { echo '<tr class="' . $storage['row_class'] . '">'; echo '<td class="state-marker"></td>'; echo '<td colspan="' . $table_cols . '">'; unset($graph_array['height'], $graph_array['width'], $graph_array['legend']); $graph_array['to'] = $config['time']['now']; $graph_array['id'] = $storage['storage_id']; $graph_array['type'] = 'storage_' . $vars['graph']; print_graph_row($graph_array, TRUE); $row .= '</td></tr>'; } # endif graphs return $row; }
$graph_array['to'] = $config['time']['now']; $graph_array['id'] = $drive['storage_id']; $graph_array['type'] = $graph_type; $graph_array['from'] = $config['time']['day']; $graph_array['legend'] = 'no'; $link_array = $graph_array; $link_array['page'] = 'graphs'; unset($link_array['height'], $link_array['width'], $link_array['legend']); $link = generate_url($link_array); $overlib_content = generate_overlib_content($graph_array, $device['hostname'] . ' - ' . $drive['storage_descr']); $graph_array['width'] = 80; $graph_array['height'] = 20; $graph_array['bg'] = 'ffffff00'; // the 00 at the end makes the area transparent. $minigraph = generate_lazy_graph_tag($graph_array); echo '<tr> <td class="col-md-4">' . overlib_link($link, $drive['storage_descr'], $overlib_content) . '</td> <td class="col-md-4">' . overlib_link($link, $minigraph, $overlib_content) . '</td> <td class="col-md-4">' . overlib_link($link, print_percentage_bar(200, 20, $percent, null, 'ffffff', $background['left'], $percent . '%', 'ffffff', $background['right']), $overlib_content) . ' </a></td> </tr>'; } //end foreach echo '</table> </div> </div> </div> </div>'; } //end if unset($drive_rows);
} else { if ($type == 'Quota') { $allowed = format_number($history['bill_allowed'], $config['billing']['base']); $used = format_number($history['total_data'], $config['billing']['base']); $in = format_number($history['traf_in'], $config['billing']['base']); $out = format_number($history['traf_out'], $config['billing']['base']); $overuse = $history['bill_overuse'] <= 0 ? '-' : '<span style="color: #' . $background['left'] . '; font-weight: bold;">' . format_number($history['bill_overuse'], $config['billing']['base']) . 'B</span>'; } } $total_data = $type == 'Quota' ? '<b>' . $total_data . '</b>' : $total_data; $rate_95th = $type == 'CDR' ? '<b>' . $rate_95th . '</b>' : $rate_95th; $url = generate_url($vars, array('detail' => $history['bill_hist_id'])); echo ' <tr> <td></td> <td><span style="font-weight: bold;" class="interface">' . strftime('%Y-%m-%d', strtotime($datefrom)) . ' to ' . strftime('%Y-%m-%d', strtotime($dateto)) . "</span></td>\n <td>{$type}</td>\n <td>{$allowed}</td>\n <td>{$in}</td>\n <td>{$out}</td>\n <td>{$total_data}</td>\n <td>{$rate_95th}</td>\n <td style=\"text-align: center;\">{$overuse}</td>\n <td width=\"250\">" . print_percentage_bar(250, 20, $percent, null, 'ffffff', $background['left'], $percent . '%', 'ffffff', $background['right']) . '</td> <td> <a href="' . $url . '"><img src="images/16/chart_curve.png" border="0" align="absmiddle" alt="Show details" title="Show details"/></a> </td> </tr>'; if ($vars['detail'] == $history['bill_hist_id'] || $vars['detail'] == 'all') { $img['bitrate'] = showDetails($bill_id, 'bitrate', $history['bill_hist_id'], $type); $img['bw_day'] = showDetails($bill_id, 'day', $history['bill_hist_id']); $img['bw_hour'] = showDetails($bill_id, 'hour', $history['bill_hist_id']); echo ' <tr style="background: #fff; border-top: 1px solid ' . $row_colour . '; border-bottom: 1px solid #ccc;"> <td colspan="11"> <!-- <b>Accuate Graph</b><br /> //--> ' . $img['bitrate'] . '<br /> <!-- <b>Bandwidth Graph per day</b><br /> //--> ' . $img['bw_day'] . '<br />
$graph_array = array(); $graph_array['height'] = "100"; $graph_array['width'] = "210"; $graph_array['to'] = $config['time']['now']; $graph_array['device'] = $device['device_id']; $graph_array['mod'] = $index; $graph_array['chan'] = $subindex; $graph_array['type'] = "c6kxbar_util"; $graph_array['from'] = $config['time']['day']; $graph_array['legend'] = "no"; $link_array = $graph_array; $link_array['page'] = "graphs"; unset($link_array['height'], $link_array['width'], $link_array['legend']); $link = generate_url($link_array); $text_descr = $entity['entPhysicalName'] . " - Fabric " . $subindex; $overlib_content = generate_overlib_content($graph_array, $device['hostname'] . " - " . $text_descr); $graph_array['width'] = 80; $graph_array['height'] = 20; $graph_array['bg'] = 'ffffff00'; $graph_array['style'][] = 'margin-top: -6px'; $minigraph = generate_graph_tag($graph_array); echo '<tr class="' . $background['class'] . '"> <td class="state-marker"></td> <td width=150><strong>Fabric ' . $subindex . '</strong></td> <td><span style="font-weight: bold;" class="label label-' . $fabric['mode_class'] . '">' . $fabric['cc6kxbarModuleChannelFabStatus'] . "</span></td>\n <td>" . formatRates($fabric['cc6kxbarModuleChannelSpeed'] * 1000000) . "</td>\n <td>" . overlib_link($link, $minigraph, $overlib_content) . "</td>\n <td width=125>" . print_percentage_bar(125, 20, $percent_in, "Ingress", "ffffff", $background['left'], $percent_in . "%", "ffffff", $background['right']) . "</td>\n <td width=125>" . print_percentage_bar(125, 20, $percent_out, "Egress", "ffffff", $background['left'], $percent_out . "%", "ffffff", $background['right']) . "</td>\n </tr>"; } } } echo "</table>"; echo generate_box_close(); // EOF
$type = "CDR"; $allowed = format_si($bill['bill_cdr']) . "bps"; $used = format_si($rate_data['rate_95th']) . "bps"; $percent = round($rate_data['rate_95th'] / $bill['bill_cdr'] * 100, 2); $background = get_percentage_colours($percent); $overuse = $rate_data['rate_95th'] - $bill['bill_cdr']; $overuse = $overuse <= 0 ? "-" : "<span style=\"color: #" . $background['left'] . "; font-weight: bold;\">" . format_si($overuse) . "bps</span>"; } elseif ($bill['bill_type'] == "quota") { $type = "Quota"; $allowed = format_bytes_billing($bill['bill_quota']); $used = format_bytes_billing($rate_data['total_data']); $percent = round($rate_data['total_data'] / $bill['bill_quota'] * 100, 2); $background = get_percentage_colours($percent); $overuse = $rate_data['total_data'] - $bill['bill_quota']; $overuse = $overuse <= 0 ? "-" : "<span style=\"color: #" . $background['left'] . "; font-weight: bold;\">" . format_bytes_billing($overuse) . "</span>"; } $right_background = $background['right']; $left_background = $background['left']; if (!is_integer($i / 2)) { $row_colour = $list_colour_a; } else { $row_colour = $list_colour_b; } echo "\n <tr bgcolor='{$row_colour}'>\n <td><a href='" . generate_url(array('page' => "bill", 'bill_id' => $bill['bill_id'])) . "'><span style='font-weight: bold;' class=interface>" . $bill['bill_name'] . "</span></a><br />" . strftime("%F", strtotime($datefrom)) . " to " . strftime("%F", strtotime($dateto)) . "</td>\n <td>{$notes}</td>\n <td>{$type}</td>\n <td>{$allowed}</td>\n <td>{$used}</td>\n <td style=\"text-align: center;\">{$overuse}</td>\n <td>" . print_percentage_bar(250, 20, $percent, NULL, "ffffff", $background['left'], $percent . "%", "ffffff", $background['right']) . "</td>\n <td><a href='" . generate_url(array('page' => "bill", 'bill_id' => $bill['bill_id'], 'view' => "edit")) . "'><img src='images/16/wrench.png' align=absmiddle alt='Edit'> Edit</a></td>\n </tr>\n "; $i++; } // PERMITTED } echo "</table>"; } //echo("</td></tr></table>");
$background_in = get_percentage_colours($percent_in); $percent_out = $fabric['cc6kxbarStatisticsOutUtil']; $background_out = get_percentage_colours($percent_out); $graph_array = array(); $graph_array['height'] = "100"; $graph_array['width'] = "210"; $graph_array['to'] = $config['time']['now']; $graph_array['device'] = $device['device_id']; $graph_array['mod'] = $index; $graph_array['chan'] = $subindex; $graph_array['type'] = "c6kxbar_util"; $graph_array['from'] = $config['time']['day']; $graph_array['legend'] = "no"; $link_array = $graph_array; $link_array['page'] = "graphs"; unset($link_array['height'], $link_array['width'], $link_array['legend']); $link = generate_url($link_array); $text_descr = $entity['entPhysicalName'] . " - Fabric " . $subindex; $overlib_content = generate_overlib_content($graph_array, $device['hostname'] . " - " . $text_descr); $graph_array['width'] = 80; $graph_array['height'] = 20; $graph_array['bg'] = 'ffffff00'; # the 00 at the end makes the area transparent. $graph_array['style'][] = 'margin-top: -6px'; $minigraph = generate_graph_tag($graph_array); echo "<tr class=device-overview>\n <td width=10></td>\n <td width=150><strong>Fabric " . $subindex . "</strong></td>\n <td><span style='font-weight: bold;' class=" . $fabric['mode_class'] . ">" . $fabric['cc6kxbarModuleChannelFabStatus'] . "</span></td>\n <td>" . formatRates($fabric['cc6kxbarModuleChannelSpeed'] * 1000000) . "</td>\n <td>" . overlib_link($link, $minigraph, $overlib_content) . "</td>\n <td width=125>" . print_percentage_bar(125, 20, $percent_in, "Ingress", "ffffff", $background['left'], $percent_in . "%", "ffffff", $background['right']) . "</td>\n <td width=125>" . print_percentage_bar(125, 20, $percent_out, "Egress", "ffffff", $background['left'], $percent_out . "%", "ffffff", $background['right']) . "</td>\n </tr>"; } } } echo "</table>"; echo "</div></div>";
$total = formatStorage($mempool['mempool_total']); $free = formatStorage($mempool['mempool_free']); $used = formatStorage($mempool['mempool_used']); $graph_array['type'] = $graph_type; $graph_array['id'] = $mempool['mempool_id']; $graph_array['from'] = $config['time']['day']; $graph_array['to'] = $config['time']['now']; $graph_array['height'] = "20"; $graph_array['width'] = "80"; $graph_array_zoom = $graph_array; $graph_array_zoom['height'] = "150"; $graph_array_zoom['width'] = "400"; $link = "graphs/id=" . $graph_array['id'] . "/type=" . $graph_array['type'] . "/from=" . $graph_array['from'] . "/to=" . $graph_array['to'] . "/"; $mini_graph = overlib_link($link, generate_graph_tag($graph_array), generate_graph_tag($graph_array_zoom), NULL); $background = get_percentage_colours($perc); $bar_link = overlib_link($link, print_percentage_bar(400, 20, $perc, "{$used} / {$total}", "ffffff", $background['left'], $free, "ffffff", $background['right']), generate_graph_tag($graph_array_zoom), NULL); $response[] = array('hostname' => generate_device_link($mempool), 'mempool_descr' => $mempool['mempool_descr'], 'graph' => $mini_graph, 'mempool_used' => $bar_link, 'mempool_perc' => $perc . "%"); if ($_POST['view'] == "graphs") { $graph_array['height'] = "100"; $graph_array['width'] = "216"; $graph_array['to'] = $config['time']['now']; $graph_array['id'] = $mempool['mempool_id']; $graph_array['type'] = $graph_type; $return_data = true; include "includes/print-graphrow.inc.php"; unset($return_data); $response[] = array('hostname' => $graph_data[0], 'mempool_descr' => $graph_data[1], 'graph' => $graph_data[2], 'mempool_used' => $graph_data[3], 'mempool_perc' => ''); } # endif graphs } $output = array('current' => $current, 'rowCount' => $rowCount, 'rows' => $response, 'total' => $count);
echo "<br />Transferred " . format_bytes_billing($total_data) . " of " . format_bytes_billing($bill_data['bill_quota']) . " (" . $percent . "%)"; echo "<br />Average rate " . formatRates($rate_average); $background = get_percentage_colours($percent); echo "<p>" . print_percentage_bar(350, 20, $perc, NULL, "ffffff", $background['left'], $percent . "%", "ffffff", $background['right']) . "</p>"; $type = "&ave=yes"; } elseif ($bill_data['bill_type'] == "cdr") { // The customer is billed based on a CDR with 95th%ile overage echo "<h4>CDR / 95th Bill</h4>"; $unit = "kbps"; $cdr = $bill_data['bill_cdr']; $rate_95th = round($rate_95th, 2); $percent = round($rate_95th / $cdr * 100, 2); $type = "&95th=yes"; echo "<strong>" . $fromtext . " to " . $totext . "</strong>\n <br />Measured " . format_si($rate_95th) . "bps of " . format_si($cdr) . "bps (" . $percent . "%) @ 95th %ile"; $background = get_percentage_colours($percent); echo "<p>" . print_percentage_bar(350, 20, $percent, NULL, "ffffff", $background['left'], $percent . "%", "ffffff", $background['right']) . "</p>"; # echo("<p>Billing Period : " . $fromtext . " to " . $totext . "<br /> # " . $paidrate_text . " <br /> # " . $total_data . "MB transfered in the current billing cycle. <br /> # " . $rate_average . "Kbps Average during the current billing cycle. </p> # <font face=\"Trebuchet MS, Verdana, Arial, Sans-Serif\" color=" . $bill_color . "><B>" . $rate_95th . "Kbps @ 95th Percentile.</b> (" . $dir_95th . ") (" . $bill_text . ")</font> # </td><td><img src=\"images/billing-key.png\"></td></tr></table> # <br />"); } $lastmonth = dbFetchCell("SELECT UNIX_TIMESTAMP(DATE_SUB(NOW(), INTERVAL 1 MONTH))"); $yesterday = dbFetchCell("SELECT UNIX_TIMESTAMP(DATE_SUB(NOW(), INTERVAL 1 DAY))"); $rightnow = date(U); if ($vars['view'] == "accurate") { $bi = "<img src='billing-graph.php?bill_id=" . $bill_id . "&bill_code=" . $_GET['bill_code']; $bi .= "&from=" . $unixfrom . "&to=" . $unixto; // $bi .= "&x=800&y=250";
$total = formatStorage($toner['toner_size']); $free = formatStorage($toner['toner_free']); $used = formatStorage($toner['toner_used']); $background = toner2colour($toner['toner_descr'], $percent); $graph_array = array(); $graph_array['height'] = "100"; $graph_array['width'] = "210"; $graph_array['to'] = $config['time']['now']; $graph_array['id'] = $toner['toner_id']; $graph_array['type'] = $graph_type; $graph_array['from'] = $config['time']['day']; $graph_array['legend'] = "no"; $link_array = $graph_array; $link_array['page'] = "graphs"; unset($link_array['height'], $link_array['width'], $link_array['legend']); $link = generate_url($link_array); $overlib_content = generate_overlib_content($graph_array, $device['hostname'] . " - " . $toner['toner_descr']); $graph_array['width'] = 80; $graph_array['height'] = 20; $graph_array['bg'] = 'ffffff00'; # the 00 at the end makes the area transparent. $minigraph = generate_graph_tag($graph_array); echo "<tr>\n <td>" . overlib_link($link, $toner['toner_descr'], $overlib_content) . "</td>\n <td>" . overlib_link($link, $minigraph, $overlib_content) . "</td>\n <td>" . overlib_link($link, print_percentage_bar(200, 20, $percent, NULL, "ffffff", $background['left'], $percent . "%", "ffffff", $background['right']), $overlib_content) . "\n </a></td>\n </tr>"; } echo "</table>"; echo "</div>"; echo "</div>"; echo "</div>"; echo "</div>"; } unset($toner_rows);
$graph_array = array(); $graph_array['height'] = "100"; $graph_array['width'] = "210"; $graph_array['to'] = $config['time']['now']; $graph_array['device'] = $device['device_id']; $graph_array['id'] = $proc['id']; $graph_array['type'] = $graph_type; $graph_array['from'] = $config['time']['day']; $graph_array['legend'] = "no"; $link_array = $graph_array; $link_array['page'] = "graphs"; unset($link_array['height'], $link_array['width'], $link_array['legend']); $link = generate_url($link_array); $overlib_content = generate_overlib_content($graph_array, $device['hostname'] . " - " . $text_descr); $graph_array['width'] = 80; $graph_array['height'] = 20; $graph_array['bg'] = 'ffffff00'; # the 00 at the end makes the area transparent. // $graph_array['style'][] = 'margin-top: -6px'; $minigraph = generate_graph_tag($graph_array); $count_button = $proc['count'] > 1 ? '<span class="label pull-right" style="margin-top: 2px; font-size: 11px;"><i class="icon-remove"></i> ' . $proc['count'] . '</span>' : ''; echo '<tr> <td><span class="entity">' . overlib_link($link, $text_descr, $overlib_content) . '</span>' . $count_button . '</td> <td style="width: 90px">' . overlib_link($link, $minigraph, $overlib_content) . '</td> <td style="width: 200px">' . overlib_link($link, print_percentage_bar(200, 20, $percent, NULL, "ffffff", $background['left'], $percent . "%", "ffffff", $background['right']), $overlib_content) . '</td> </tr>'; } echo "</table>"; echo "</div></div>"; } // EOF
$graph_array['type'] = 'device_processor'; $graph = generate_lazy_graph_tag($graph_array); //Generate link to graphs $link_array = $graph_array; $link_array['page'] = 'graphs'; unset($link_array['height'], $link_array['width']); $link = generate_url($link_array); //Generate tooltip $graph_array['width'] = '210'; $overlib_content = generate_overlib_content($graph_array, $device['hostname'] . ' - CPU usage'); echo '<tr> <td colspan="4">'; echo overlib_link($link, $graph, $overlib_content, null); echo ' </td> </tr>'; //Add a row with CPU desc, count and percent graph $totalPercent = $totalPercent / count($processors); $background = get_percentage_colours($totalPercent); echo '<tr> <td>' . overlib_link($link, $text_descr, $overlib_content) . '</td> <td>' . overlib_link($link, 'x' . count($processors), $overlib_content) . '</td> <td>' . overlib_link($link, print_percentage_bar(200, 20, $totalPercent, null, 'ffffff', $background['left'], $percent . '%', 'ffffff', $background['right']), $overlib_content) . '</td> </tr>'; } echo '</table> </div> </div> </div> </div>'; } //end if
$type = $bill['bill_type']; $percent = $bill['bill_percent']; $dir_95th = $bill['dir_95th']; $rate_95th = format_si($bill['rate_95th']) . 'bps'; $total_data = format_bytes_billing($bill['traf_total']); $background = get_percentage_colours($percent); if ($type == 'CDR') { $allowed = format_si($bill['bill_allowed']) . 'bps'; $used = format_si($bill['rate_95th']) . 'bps'; $in = format_si($bill['rate_95th_in']) . 'bps'; $out = format_si($bill['rate_95th_out']) . 'bps'; $overuse = $bill['bill_overuse'] <= 0 ? '-' : '<span style="color: #' . $background['left'] . '; font-weight: bold;">' . format_si($bill['bill_overuse']) . 'bps</span>'; } else { if ($type == 'Quota') { $allowed = format_bytes_billing($bill['bill_allowed']); $used = format_bytes_billing($bill['total_data']); $in = format_bytes_billing($bill['traf_in']); $out = format_bytes_billing($bill['traf_out']); $overuse = $bill['bill_overuse'] <= 0 ? '-' : '<span style="color: #' . $background['left'] . '; font-weight: bold;">' . format_bytes_billing($bill['bill_overuse']) . '</span>'; } } $total_data = $type == 'Quota' ? '<b>' . $total_data . '</b>' : $total_data; $rate_95th = $type == 'CDR' ? '<b>' . $rate_95th . '</b>' : $rate_95th; echo "\n <tr>\n <td><a href=\"" . generate_url(array('page' => 'bill', 'bill_id' => $bill['bill_id'], 'view' => 'history', detail => $bill['bill_hist_id'])) . '"><span style="font-weight: bold;" class="interface">' . $bill['bill_name'] . '</a></span><br />from ' . strftime('%x', strtotime($datefrom)) . ' to ' . strftime('%x', strtotime($dateto)) . "</td>\n <td>{$type}</td>\n <td>{$allowed}</td>\n <td>{$in}</td>\n <td>{$out}</td>\n <td>{$total_data}</td>\n <td>{$rate_95th}</td>\n <td style=\"text-align: center;\">{$overuse}</td>\n <td>" . print_percentage_bar(250, 20, $percent, null, 'ffffff', $background['left'], $percent . '%', 'ffffff', $background['right']) . '</td> </tr>'; } //end if } //end foreach echo '</tbody> </table>';
$perc = round($drive['storage_perc'], 0); $total = formatStorage($drive['storage_size']); $free = formatStorage($drive['storage_free']); $used = formatStorage($drive['storage_used']); $graph_array['type'] = $graph_type; $graph_array['id'] = $drive['storage_id']; $graph_array['from'] = $config['time']['day']; $graph_array['to'] = $config['time']['now']; $graph_array['height'] = "20"; $graph_array['width'] = "80"; $graph_array_zoom = $graph_array; $graph_array_zoom['height'] = "150"; $graph_array_zoom['width'] = "400"; $link = "graphs/id=" . $graph_array['id'] . "/type=" . $graph_array['type'] . "/from=" . $graph_array['from'] . "/to=" . $graph_array['to'] . "/"; $mini_graph = overlib_link($link, generate_graph_tag($graph_array), generate_graph_tag($graph_array_zoom), NULL); $background = get_percentage_colours($perc); echo "<tr class='health'><td>" . generate_device_link($drive) . "</td><td class=tablehead>" . $drive['storage_descr'] . "</td>\n <td>{$mini_graph}</td>\n <td>\n <a href='#' {$store_popup}>" . print_percentage_bar(400, 20, $perc, "{$used} / {$total}", "ffffff", $background['left'], $free, "ffffff", $background['right']) . "</a>\n </td><td>{$perc}" . "%</td></tr>"; if ($vars['view'] == "graphs") { echo "<tr></tr><tr class='health'><td colspan=5>"; $graph_array['height'] = "100"; $graph_array['width'] = "216"; $graph_array['to'] = $config['time']['now']; $graph_array['id'] = $drive['storage_id']; $graph_array['type'] = $graph_type; include "includes/print-graphrow.inc.php"; echo "</td></tr>"; } # endif graphs } } echo "</table></div>";
<?php $graph_type = "processor_usage"; echo "<div style='margin-top: 5px; padding: 0px;'>"; echo '<table class="table table-striped-two table-condensed">'; $i = '1'; $sql = "SELECT *, `processors`.`processor_id` as `processor_id`"; $sql .= " FROM `processors`"; $sql .= " LEFT JOIN `processors-state` ON `processors`.processor_id = `processors-state`.processor_id"; $sql .= " WHERE `device_id` = ?"; foreach (dbFetchRows($sql, array($device['device_id'])) as $proc) { $proc_url = "device/device=" . $device['device_id'] . "/tab=health/metric=processor/"; $mini_url = "graph.php?id=" . $proc['processor_id'] . "&type=" . $graph_type . "&from=" . $config['time']['day'] . "&to=" . $config['time']['now'] . "&width=80&height=20&bg=f4f4f4"; $text_descr = $proc['processor_descr']; $text_descr = rewrite_entity_descr($text_descr); $proc_popup = "onmouseover=\"return overlib('<div class=entity-title>" . $device['hostname'] . " - " . $text_descr; $proc_popup .= "</div><img src=\\'graph.php?id=" . $proc['processor_id'] . "&type=" . $graph_type . "&from=" . $config['time']['month'] . "&to=" . $config['time']['now'] . "&width=400&height=125\\'>"; $proc_popup .= "', RIGHT" . $config['overlib_defaults'] . ");\" onmouseout=\"return nd();\""; $percent = round($proc['processor_usage']); $background = get_percentage_colours($percent); echo "<tr>\n <td class=strong><a href='" . $proc_url . "' {$proc_popup}>" . $text_descr . "</a></td>\n <td width=90><a href='" . $proc_url . "' {$proc_popup}><img src='{$mini_url}'></a></td>\n <td width=200><a href='" . $proc_url . "' {$proc_popup}>\n " . print_percentage_bar(400, 20, $percent, $percent . "%", "ffffff", $background['left'], 100 - $percent . "%", "ffffff", $background['right']) . "\n </a></td>\n </tr>"; echo "<tr><td colspan=5>"; $graph_array['id'] = $proc['processor_id']; $graph_array['type'] = $graph_type; include "includes/print-graphrow.inc.php"; } echo "</table>"; echo "</div>";
$left_background = 'c4323f'; $right_background = 'C96A73'; } elseif ($perc > '75') { $left_background = 'bf5d5b'; $right_background = 'd39392'; } elseif ($perc > '50') { $left_background = 'bf875b'; $right_background = 'd3ae92'; } elseif ($perc > '25') { $left_background = '5b93bf'; $right_background = '92b7d3'; } else { $left_background = '9abf5b'; $right_background = 'bbd392'; } echo "<tr bgcolor={$row_colour}><td class=tablehead><a href='" . $mempool_url . "' {$mempool_popup}>" . $text_descr . "</a></td>\n <td width=90><a href='" . $mempool_url . "' {$mempool_popup}><img src='{$mini_url}'></a></td>\n <td width=200><a href='" . $mempool_url . "' {$mempool_popup}>\n " . print_percentage_bar(400, 20, $perc, "{$used} / {$total}", "ffffff", $left_background, $free, "ffffff", $right_background) . "\n </a></td>\n <td width=50>" . $perc . "%</td>\n </tr>"; echo "<tr bgcolor='{$row_colour}'><td colspan=5>"; $daily_graph = "graph.php?id=" . $mempool['mempool_id'] . "&type=mempool&from={$day}&to={$now}&width=211&height=100"; $daily_url = "graph.php?id=" . $mempool['mempool_id'] . "&type=mempool&from={$day}&to={$now}&width=400&height=150"; $weekly_graph = "graph.php?id=" . $mempool['mempool_id'] . "&type=mempool&from={$week}&to={$now}&width=211&height=100"; $weekly_url = "graph.php?id=" . $mempool['mempool_id'] . "&type=mempool&from={$week}&to={$now}&width=400&height=150"; $monthly_graph = "graph.php?id=" . $mempool['mempool_id'] . "&type=mempool&from={$month}&to={$now}&width=211&height=100"; $monthly_url = "graph.php?id=" . $mempool['mempool_id'] . "&type=mempool&from={$month}&to={$now}&width=400&height=150"; $yearly_graph = "graph.php?id=" . $mempool['mempool_id'] . "&type=mempool&from={$year}&to={$now}&width=211&height=100"; $yearly_url = "graph.php?id=" . $mempool['mempool_id'] . "&type=mempool&from={$year}&to={$now}&width=400&height=150"; echo "<a onmouseover=\"return overlib('<img src=\\'{$daily_url}\\'>', LEFT);\" onmouseout=\"return nd();\">\n <img src='{$daily_graph}' border=0></a> "; echo "<a onmouseover=\"return overlib('<img src=\\'{$weekly_url}\\'>', LEFT);\" onmouseout=\"return nd();\">\n <img src='{$weekly_graph}' border=0></a> "; echo "<a onmouseover=\"return overlib('<img src=\\'{$monthly_url}\\'>', LEFT);\" onmouseout=\"return nd();\">\n <img src='{$monthly_graph}' border=0></a> "; echo "<a onmouseover=\"return overlib('<img src=\\'{$yearly_url}\\'>', LEFT);\" onmouseout=\"return nd();\">\n <img src='{$yearly_graph}' border=0></a>"; echo "</td></tr>"; $i++;
$left_background = 'c4323f'; $right_background = 'C96A73'; } elseif ($perc > '75') { $left_background = 'bf5d5b'; $right_background = 'd39392'; } elseif ($perc > '50') { $left_background = 'bf875b'; $right_background = 'd3ae92'; } elseif ($perc > '25') { $left_background = '5b93bf'; $right_background = '92b7d3'; } else { $left_background = '9abf5b'; $right_background = 'bbd392'; } echo "<tr bgcolor='{$row_colour}'><th><a href='{$fs_url}' {$fs_popup}>" . $drive['storage_descr'] . "</a></td><td>\n <a href='{$fs_url}' {$fs_popup}>" . print_percentage_bar(400, 20, $perc, "{$used} / {$total}", "ffffff", $left_background, $perc . "%", "ffffff", $right_background) . "</a>\n </td><td>" . $free . "</td><td></td></tr>"; $graph_type = "storage"; // start temperature graphs $daily_temp = "graph.php?id=" . $drive['storage_id'] . "&type={$graph_type}&from={$day}&to={$now}&width=212&height=100"; $daily_url = "graph.php?id=" . $drive['storage_id'] . "&type={$graph_type}&from={$day}&to={$now}&width=400&height=150"; $weekly_temp = "graph.php?id=" . $drive['storage_id'] . "&type={$graph_type}&from={$week}&to={$now}&width=212&height=100"; $weekly_url = "graph.php?id=" . $drive['storage_id'] . "&type={$graph_type}&from={$week}&to={$now}&width=400&height=150"; $monthly_temp = "graph.php?id=" . $drive['storage_id'] . "&type={$graph_type}&from={$month}&to={$now}&width=212&height=100"; $monthly_url = "graph.php?id=" . $drive['storage_id'] . "&type={$graph_type}&from={$month}&to={$now}&width=400&height=150"; $yearly_temp = "graph.php?id=" . $drive['storage_id'] . "&type={$graph_type}&from={$year}&to={$now}&width=212&height=100"; $yearly_url = "graph.php?id=" . $drive['storage_id'] . "&type={$graph_type}&from={$year}&to={$now}&width=400&height=150"; echo "<tr bgcolor='{$row_colour}'><td colspan=6>"; echo "<a onmouseover=\"return overlib('<div class=list-large>" . $device['hostname'] . " - " . $drive['storage_descr'] . "</div><img src=\\'{$daily_url}\\'>', LEFT, FGCOLOR, '#e5e5e5');\" onmouseout=\"return nd();\">\n <img src='{$daily_temp}' border=0></a> "; echo "<a onmouseover=\"return overlib('<div class=list-large>" . $device['hostname'] . " - " . $drive['storage_descr'] . "</div><img src=\\'{$weekly_url}\\'>', LEFT, FGCOLOR, '#e5e5e5');\" onmouseout=\"return nd();\">\n <img src='{$weekly_temp}' border=0></a> "; echo "<a onmouseover=\"return overlib('<div class=list-large>" . $device['hostname'] . " - " . $drive['storage_descr'] . "</div><img src=\\'{$monthly_url}\\'>', LEFT, FGCOLOR, '#e5e5e5');\" onmouseout=\"return nd();\">\n <img src='{$monthly_temp}' border=0></a> "; echo "<a onmouseover=\"return overlib('<div class=list-large>" . $device['hostname'] . " - " . $drive['storage_descr'] . "</div><img src=\\'{$yearly_url}\\'>', LEFT, FGCOLOR, '#e5e5e5');\" onmouseout=\"return nd();\">\n <img src='{$yearly_temp}' border=0></a>";
if (device_permitted($proc['device_id'])) { $device = $proc; // FIXME should that really be done here? :-) $text_descr = $proc['processor_descr']; $text_descr = str_replace("Routing Processor", "RP", $text_descr); $text_descr = str_replace("Switching Processor", "SP", $text_descr); $text_descr = str_replace("Sub-Module", "Module ", $text_descr); $text_descr = str_replace("DFC Card", "DFC", $text_descr); $proc_url = "device/" . $device['device_id'] . "/health/processor/"; $mini_url = "graph.php?id=" . $proc['processor_id'] . "&type=" . $graph_type . "&from=" . $config['time']['day'] . "&to=" . $config['time']['now'] . "&width=80&height=20&bg=f4f4f400"; $proc_popup = "onmouseover=\"return overlib('<div class=list-large>" . $device['hostname'] . " - " . $text_descr; $proc_popup .= "</div><img src=\\'graph.php?id=" . $proc['processor_id'] . "&type=" . $graph_type . "&from=" . $config['month'] . "&to=" . $config['time']['now'] . "&width=400&height=125\\'>"; $proc_popup .= "', RIGHT" . $config['overlib_defaults'] . ");\" onmouseout=\"return nd();\""; $perc = round($proc['processor_usage']); $background = get_percentage_colours($perc); echo " <tr class=\"health\">\n <td>" . generate_device_link($proc) . "</td>\n <td class=\"tablehead\"><a href='" . $proc_url . "' {$proc_popup}>" . $text_descr . "</a></td>\n <td width=\"90\"><a href=\"" . $proc_url . "\" {$proc_popup}><img src=\"{$mini_url}\" /></a></td>\n <td width=\"200\"><a href=\"" . $proc_url . "\" {$proc_popup}>\n " . print_percentage_bar(400, 20, $perc, $perc . "%", "ffffff", $background['left'], 100 - $perc . "%", "ffffff", $background['right']); echo '</a></td> </tr>'; if ($vars['view'] == "graphs") { echo ' <tr></tr><tr class="health"><td colspan="5">'; $daily_graph = "graph.php?id=" . $proc['processor_id'] . "&type=" . $graph_type . "&from=" . $config['time']['day'] . "&to=" . $config['time']['now'] . "&width=211&height=100"; $daily_url = "graph.php?id=" . $proc['processor_id'] . "&type=" . $graph_type . "&from=" . $config['time']['day'] . "&to=" . $config['time']['now'] . "&width=400&height=150"; $weekly_graph = "graph.php?id=" . $proc['processor_id'] . "&type=" . $graph_type . "&from=" . $config['time']['week'] . "&to=" . $config['time']['now'] . "&width=211&height=100"; $weekly_url = "graph.php?id=" . $proc['processor_id'] . "&type=" . $graph_type . "&from=" . $config['time']['week'] . "&to=" . $config['time']['now'] . "&width=400&height=150"; $monthly_graph = "graph.php?id=" . $proc['processor_id'] . "&type=" . $graph_type . "&from=" . $config['time']['month'] . "&to=" . $config['time']['now'] . "&width=211&height=100"; $monthly_url = "graph.php?id=" . $proc['processor_id'] . "&type=" . $graph_type . "&from=" . $config['time']['month'] . "&to=" . $config['time']['now'] . "&width=400&height=150"; $yearly_graph = "graph.php?id=" . $proc['processor_id'] . "&type=" . $graph_type . "&from=" . $config['time']['year'] . "&to=" . $config['time']['now'] . "&width=211&height=100"; $yearly_url = "graph.php?id=" . $proc['processor_id'] . "&type=" . $graph_type . "&from=" . $config['time']['year'] . "&to=" . $config['time']['now'] . "&width=400&height=150"; echo " <a onmouseover=\"return overlib('<img src=\\'{$daily_url}\\'>', LEFT);\" onmouseout=\"return nd();\">\n <img src=\"{$daily_graph}\" border=\"0\"></a> "; echo " <a onmouseover=\"return overlib('<img src=\\'{$weekly_url}\\'>', LEFT);\" onmouseout=\"return nd();\">\n <img src=\"{$weekly_graph}\" border=\"0\"></a> "; echo " <a onmouseover=\"return overlib('<img src=\\'{$monthly_url}\\'>', LEFT);\" onmouseout=\"return nd();\">\n <img src=\"{$monthly_graph}\" border=\"0\"></a> ";
case $percent >= 75: $perc['BG'] = "warning"; break; case $percent >= 50: $perc['BG'] = "success"; break; default: $perc['BG'] = "info"; } $perc['width'] = $percent <= "100" ? $percent : "100"; $label['type'] = $type == "限额" ? "info" : "inverse"; $label['overuse'] = $overuse == "-" ? "success" : "important"; $notes = !empty($notes) ? "<br /><span class=\"label\"><i class=\"icon-comment icon-white\"></i> " . $notes . " </span>" : ""; $ref['cust'] = !empty($custid) ? "<a href=\"javascript:;\" data-rel=\"tooltip\" data-tooltip=\"" . $custid . "\"><i class=\"icon-user\"></i></a>" : ""; $ref['bill'] = !empty($refid) ? "<a href=\"javascript:;\" data-rel=\"tooltip\" data-tooltip=\"" . $refid . "\"><i class=\"icon-info-sign\"></i></a>" : ""; $ref['html'] = (!empty($ref['cust']) || !empty($ref['bill'])) && $isAdmin == true ? "<span style=\"float: right;\">" . $ref['cust'] . "" . $ref['bill'] . "</span>" : ""; $links['quick'] = generate_url(array('page' => 'bill', 'bill_id' => $billid, 'view' => 'quick')); $links['accurate'] = generate_url(array('page' => 'bill', 'bill_id' => $billid, 'view' => 'accurate')); $links['transfer'] = generate_url(array('page' => 'bill', 'bill_id' => $billid, 'view' => 'transfer')); $links['history'] = generate_url(array('page' => 'bill', 'bill_id' => $billid, 'view' => 'history')); $links['edit'] = $isAdmin ? generate_url(array('page' => 'bill', 'bill_id' => $billid, 'view' => 'edit')) : "javascript:;"; $links['reset'] = $isAdmin ? generate_url(array('page' => 'bill', 'bill_id' => $billid, 'view' => 'reset')) : "javascript:;"; $links['delete'] = $isAdmin ? generate_url(array('page' => 'bill', 'bill_id' => $billid, 'view' => 'delete')) : "javascript:;"; echo "\n <tr>\n <td>\n <i class=\"icon-hdd\"></i> <a href=\"" . $links['quick'] . "\"><strong class=\"interface\">" . $bill['bill_name'] . "</strong></a>" . $ref['html'] . "<br />\n <i class=\"icon-calendar\"></i> " . date("jS F Y", strtotime($datefrom)) . " to " . date("jS F Y", strtotime($dateto)) . "\n " . $notes . "\n </td>\n <td style=\"text-align: center;\"><span class=\"label label-" . $label['type'] . "\">" . $type . "</span></td>\n <td style=\"text-align: center;\">" . $allowed . "</td>\n <td style=\"text-align: center;\">" . $used . "</td>\n <td style=\"text-align: center;\">" . $overuse . "</td>\n <td>"; echo print_percentage_bar(400, 20, $percent, $percent . '%', "ffffff", $background['left'], $percent < 100 ? 100 - $percent . "%" : "0%", "ffffff", $background['right']); echo "\n </td>\n <td>\n <div class=\"btn-toolbar\" style=\"margin-top: 0px;\">\n <!--\n <div class=\"btn-group pull-right\">\n <a class=\"btn btn-mini btn-primary\" href=\"" . $links['quick'] . "\" data-rel=\"tooltip\" data-tooltip=\"显示快速的图像\"><i class=\"icon-list-alt icon-white\"></i> 快速</a>\n <a class=\"btn btn-mini btn-primary\" href=\"" . $links['accurate'] . "\" data-rel=\"tooltip\" data-tooltip=\"显示精确的图像\"><i class=\"icon-signal icon-white\"></i> 精确</a>\n <a class=\"btn btn-mini btn-primary\" href=\"" . $links['transfer'] . "\" data-rel=\"tooltip\" data-tooltip=\"显示传输的图像\"><i class=\"icon-tasks icon-white\"></i> 传输</a>\n <a class=\"btn btn-mini btn-primary\" href=\"" . $links['history'] . "\" data-rel=\"tooltip\" data-tooltip=\"显示历史使用\"><i class=\"icon-calendar icon-white\"></i> 历史</a>\n </div>\n -->\n <div class=\"btn-group pull-right\" style=\"margin-top: 0px;\">\n <a class=\"btn btn-mini btn-success\" href=\"" . $links['edit'] . "\" data-rel=\"tooltip\" data-tooltip=\"编辑账单\"" . $disabled . "><i class=\"icon-edit icon-white\"></i> 编辑</a>\n <a class=\"btn btn-mini btn-warning\" href=\"" . $links['reset'] . "\" data-rel=\"tooltip\" data-tooltip=\"重置账单\"" . $disabled . "><i class=\"icon-refresh icon-white\"></i> 重置</a>\n <a class=\"btn btn-mini btn-danger\" href=\"" . $links['delete'] . "\" data-rel=\"tooltip\" data-tooltip=\"删除账单\"" . $disabled . "><i class=\"icon-trash icon-white\"></i> 删除</a>\n </div>\n </div>\n </td>\n </tr>\n"; } // PERMITTED } echo " </tbody>\n"; echo "</table>\n";