当前位置: 首页>>代码示例>>PHP>>正文


PHP get_percentage_colours函数代码示例

本文整理汇总了PHP中get_percentage_colours函数的典型用法代码示例。如果您正苦于以下问题:PHP get_percentage_colours函数的具体用法?PHP get_percentage_colours怎么用?PHP get_percentage_colours使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了get_percentage_colours函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: showPercent

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;
}
开发者ID:REAP720801,项目名称:librenms,代码行数:8,代码来源:transfer.inc.php

示例2: showPercent

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;
}
开发者ID:samyscoub,项目名称:librenms,代码行数:8,代码来源:transfer.inc.php

示例3: toner2colour

function toner2colour($descr, $percent)
{
    $colour = get_percentage_colours(100 - $percent);
    if (substr($descr, -1) == 'C' || stripos($descr, 'cyan') !== false) {
        $colour['left'] = '55D6D3';
        $colour['right'] = '33B4B1';
    }
    if (substr($descr, -1) == 'M' || stripos($descr, 'magenta') !== false) {
        $colour['left'] = 'F24AC8';
        $colour['right'] = 'D028A6';
    }
    if (substr($descr, -1) == 'Y' || stripos($descr, 'yellow') !== false || stripos($descr, 'giallo') !== false || stripos($descr, 'gul') !== false) {
        $colour['left'] = 'FFF200';
        $colour['right'] = 'DDD000';
    }
    if (substr($descr, -1) == 'K' || stripos($descr, 'black') !== false || stripos($descr, 'nero') !== false) {
        $colour['left'] = '000000';
        $colour['right'] = '222222';
    }
    return $colour;
}
开发者ID:RobsanInc,项目名称:librenms,代码行数:21,代码来源:functions.inc.php

示例4: toner2colour

<?php

/**
 * Observium
 *
 *   This file is part of Observium.
 *
 * @package    observium
 * @subpackage graphs
 * @copyright  (C) 2006-2014 Adam Armstrong
 *
 */
$scale_min = "0";
$scale_max = "100";
include_once $config['html_dir'] . "/includes/graphs/common.inc.php";
$rrd_options .= " COMMENT:'                                 Cur    Max\\n'";
$colour = toner2colour($toner['toner_descr']);
if ($colour['left'] == NULL) {
    $colour['left'] = "CC0000";
}
$descr = rrdtool_escape($toner['toner_descr'], 26);
$background = get_percentage_colours(100 - $toner['toner_current']);
$rrd_options .= " DEF:toner" . $toner['toner_id'] . "=" . $rrd_filename . ":toner:AVERAGE ";
$rrd_options .= " LINE1:toner" . $toner['toner_id'] . "#" . $colour['left'] . ":'" . $descr . "' ";
$rrd_options .= " AREA:toner" . $toner['toner_id'] . "#" . $background['right'] . ":";
$rrd_options .= " GPRINT:toner" . $toner['toner_id'] . ":LAST:'%5.0lf%%'";
$rrd_options .= " GPRINT:toner" . $toner['toner_id'] . ":MAX:%5.0lf%%\\\\l";
// EOF
开发者ID:skive,项目名称:observium,代码行数:28,代码来源:usage.inc.php

示例5: formatStorage

?>
</div>
         <div class="col-md-4"><i style="font-size: 7px; line-height: 7px; background-color: #ddd;    border: 1px #fff solid;">&nbsp;&nbsp;&nbsp;</i>
          <strong>合计:</strong>   <?php 
echo formatStorage($device_state['ucd_mem']['mem_total'] * 1024);
?>
</div>
      </div>
    </td>
  </tr>

<?php 
$swap_used = $device_state['ucd_mem']['swap_total'] - $device_state['ucd_mem']['swap_avail'];
$swap_perc = round($swap_used / $device_state['ucd_mem']['swap_total'] * 100);
$swap_free_perc = 100 - $swap_perc;
$background = get_percentage_colours('40');
$percentage_bar = array();
$percentage_bar['border'] = "#356AA0";
$percentage_bar['bg'] = "#f0f0f0";
$percentage_bar['width'] = "100%";
$percentage_bar['text'] = $swap_free_perc . "%";
$percentage_bar['text_c'] = "#356AA0";
$percentage_bar['bars'][0] = array('percent' => $swap_perc, 'colour' => '#356AA0', 'text' => $swap_perc . '%');
echo '  <tr>';
echo '    <td class="entity">Swap</td>';
echo '    <td>';
echo percentage_bar($percentage_bar);
echo '    </td>';
echo '  </tr>';
?>
开发者ID:rhizalpatrax64bit,项目名称:StacksNetwork,代码行数:30,代码来源:ucd_mem.inc.php

示例6: foreach

         break;
     default:
         echo $entry['']['cc6kxbarModuleModeSwitchingMode'];
 }
 echo "</td>\n      </tr>";
 foreach ($entity_state['group']['c6kxbar'][$index] as $subindex => $fabric) {
     if (is_numeric($subindex)) {
         if ($fabric['cc6kxbarModuleChannelFabStatus'] == "ok") {
             $fabric['mode_class'] = "green";
         } else {
             $fabric['mode_class'] = "red";
         }
         $percent_in = $fabric['cc6kxbarStatisticsInUtil'];
         $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;
开发者ID:rhizalpatrax64bit,项目名称:StacksNetwork,代码行数:31,代码来源:c6kxbar.inc.php

示例7: list_bills

function list_bills()
{
    global $config;
    $app = \Slim\Slim::getInstance();
    $router = $app->router()->getCurrentRoute()->getParams();
    $status = 'ok';
    $err_msg = '';
    $message = '';
    $code = 200;
    $bills = array();
    $bill_id = mres($router['bill_id']);
    $bill_ref = mres($_GET['ref']);
    $bill_custid = mres($_GET['custid']);
    if (!empty($bill_custid)) {
        $sql = '`bill_custid` = ?';
        $param = array($bill_custid);
    } elseif (!empty($bill_ref)) {
        $sql = '`bill_ref` = ?';
        $param = array($bill_ref);
    } elseif (is_numeric($bill_id)) {
        $sql = '`bill_id` = ?';
        $param = array($bill_id);
    } else {
        $sql = '';
        $param = array();
    }
    if (count($param) >= 1) {
        $sql = "WHERE {$sql}";
    }
    foreach (dbFetchRows("SELECT `bills`.*,COUNT(port_id) AS `ports_total` FROM `bills` LEFT JOIN `bill_ports` ON `bill_ports`.`bill_id`=`bills`.`bill_id` {$sql} GROUP BY `bill_name`,`bill_ref` ORDER BY `bill_name`", $param) as $bill) {
        $day_data = getDates($bill['bill_day']);
        $ports_total = $bill['ports_total'];
        $datefrom = $day_data['0'];
        $dateto = $day_data['1'];
        $rate_data = $bill;
        $rate_95th = $rate_data['rate_95th'];
        $dir_95th = $rate_data['dir_95th'];
        $total_data = $rate_data['total_data'];
        $rate_average = $rate_data['rate_average'];
        if ($bill['bill_type'] == "cdr") {
            $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 ? "-" : format_si($overuse);
        } 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 ? "-" : format_bytes_billing($overus);
        }
        $bill['allowed'] = $allowed;
        $bill['used'] = $used;
        $bill['percent'] = $percent;
        $bill['overuse'] = $overuse;
        $bills[] = $bill;
    }
    $count = count($bills);
    $output = array("status" => $status, "err-msg" => $err_msg, "count" => $count, "bills" => $bills);
    $app->response->headers->set('Content-Type', 'application/json');
    echo _json_encode($output);
}
开发者ID:syzdek,项目名称:librenms,代码行数:67,代码来源:api_functions.inc.php

示例8: toner_to_colour

function toner_to_colour($descr, $percent)
{
    if (substr($descr, -1) == 'C' || toner_map($descr, "cyan")) {
        $colour['left'] = "B6F6F6";
        $colour['right'] = "33B4B1";
    }
    if (substr($descr, -1) == 'M' || toner_map($descr, "magenta")) {
        $colour['left'] = "FBA8E6";
        $colour['right'] = "D028A6";
    }
    if (substr($descr, -1) == 'Y' || toner_map($descr, "yellow")) {
        $colour['left'] = "FFF764";
        $colour['right'] = "DDD000";
    }
    if (substr($descr, -1) == 'K' || toner_map($descr, "black")) {
        $colour['left'] = "888787";
        $colour['right'] = "555555";
    }
    if (!isset($colour['left'])) {
        $colour = get_percentage_colours(100 - $percent);
        $colour['found'] = FALSE;
    } else {
        $colour['found'] = TRUE;
    }
    return $colour;
}
开发者ID:Natolumin,项目名称:observium,代码行数:26,代码来源:functions.inc.php

示例9: round

<?php

/**
 * Observium Network Management and Monitoring System
 * Copyright (C) 2006-2015, Adam Armstrong - http://www.observium.org
 *
 * @package    observium
 * @subpackage applications
 * @author     Adam Armstrong <adama@observium.org>
 * @copyright  (C) 2006-2013 Adam Armstrong, (C) 2013-2016 Observium Limited
 *
 */
$cpu_counter = $app_data['cpu']['proc'];
$time_counter = $app_data['cpu']['time'];
$cpu_load_percent = round($cpu_counter / $time_counter * 100, 2);
$background = get_percentage_colours($cpu_load_percent);
$graph_array = array();
$graph_array['height'] = "100";
$graph_array['width'] = "512";
$graph_array['to'] = $config['time']['now'];
$graph_array['id'] = $app['app_id'];
$graph_array['type'] = 'application_mssql_cpu_usage';
$graph_array['from'] = $config['time']['day'];
$graph_array['legend'] = "no";
$graph = generate_graph_tag($graph_array);
$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, $app['app_instance'] . " - CPU Usage");
$percentage_bar = array();
开发者ID:Natolumin,项目名称:observium,代码行数:31,代码来源:processor.inc.php

示例10: toner_to_colour

/**
 * Observium
 *
 *   This file is part of Observium.
 *
 * @package    observium
 * @subpackage graphs
 * @copyright  (C) 2006-2013 Adam Armstrong, (C) 2013-2016 Observium Limited
 *
 */
$scale_min = "0";
$scale_max = "100";
include_once $config['html_dir'] . "/includes/graphs/common.inc.php";
$rrd_options .= " COMMENT:'                                 Cur     Max\\n'";
if ($supply['supply_colour'] != '') {
    $colour = toner_to_colour($supply['supply_colour'], $perc);
} else {
    $colour = toner_to_colour($supply['supply_descr'], $perc);
}
if ($colour['left'] == NULL) {
    $colour['left'] = "CC0000";
}
$descr = rrdtool_escape($supply['supply_descr'], 26);
$background = get_percentage_colours(100 - $supply['supply_value']);
$rrd_options .= " DEF:level" . $supply['supply_id'] . "=" . $rrd_filename . ":level:AVERAGE ";
$rrd_options .= " LINE1:level" . $supply['supply_id'] . "#" . $colour['left'] . ":'" . $descr . "' ";
$rrd_options .= " AREA:level" . $supply['supply_id'] . "#" . $background['right'] . ":";
$rrd_options .= " GPRINT:level" . $supply['supply_id'] . ":LAST:'%5.0lf%%'";
$rrd_options .= " GPRINT:level" . $supply['supply_id'] . ":MAX:%5.0lf%%\\l";
// EOF
开发者ID:Natolumin,项目名称:observium,代码行数:30,代码来源:usage.inc.php

示例11: unset

  $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'] . " - " . htmlentities($storage['storage_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);
  $total = formatStorage($storage['storage_size']);
  $used = formatStorage($storage['storage_used']);
  $free = formatStorage($storage['storage_free']);
  $background = get_percentage_colours($storage['storage_perc']);
  echo '<tr class="' . $storage['html_row_class'] . '">
      <td class="entity">' . generate_device_link($storage) . '</td>
      <td>' . overlib_link($link, htmlentities($storage['storage_descr']), $overlib_content) . '</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") {
      echo "<tr><td colspan=7>";
开发者ID:skive,项目名称:observium,代码行数:31,代码来源:storage.inc.php

示例12: generate_processor_row

function generate_processor_row($processor, $vars)
{
    global $config;
    $table_cols = 4;
    if ($vars['page'] != "device" && $vars['popup'] != TRUE) {
        $table_cols++;
    }
    // Add a column for device.
    // FIXME should that really be done here? :-)
    // FIXME - not it shouldn't. we need some per-os rewriting on discovery-time.
    $text_descr = $processor['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);
    $graph_array = array();
    $graph_array['to'] = $config['time']['now'];
    $graph_array['id'] = $processor['processor_id'];
    $graph_array['type'] = 'processor_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" => $processor['device_id'], "tab" => "health", "metric" => 'processor'));
    $overlib_content = generate_overlib_content($graph_array, $processor['hostname'] . " - " . $text_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);
    $perc = round($processor['processor_usage']);
    $background = get_percentage_colours($perc);
    $processor['html_row_class'] = $background['class'];
    $row .= '<tr class="' . $processor['html_row_class'] . '">
          <td class="state-marker"></td>';
    if ($vars['page'] != "device" && $vars['popup'] != TRUE) {
        $row .= '<td class="entity">' . generate_device_link($processor) . '</td>';
    }
    $row .= '  <td class="entity">' . generate_entity_link('processor', $processor) . '</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") {
        $vars['graph'] = "usage";
    }
    if ($vars['graph']) {
        $row .= '<tr class="' . $processor['html_row_class'] . '">';
        $row .= '<td class="state-marker"></td>';
        $row .= '<td colspan=' . $table_cols . '>';
        unset($graph_array['height'], $graph_array['width'], $graph_array['legend']);
        $graph_array['to'] = $config['time']['now'];
        $graph_array['id'] = $processor['processor_id'];
        $graph_array['type'] = 'processor_' . $vars['graph'];
        print_graph_row($graph_array, TRUE);
        $row .= '</td></tr>';
    }
    # endif graphs
    return $row;
}
开发者ID:Natolumin,项目名称:observium,代码行数:64,代码来源:processor.inc.php

示例13: dbFetchRows

 *
 */
$graph_type = "printersupply_usage";
$supplies = dbFetchRows("SELECT * FROM `printersupplies` WHERE `device_id` = ? ORDER BY `supply_type`", array($device['device_id']));
if (count($supplies)) {
    $box_args = array('title' => 'Printer Supplies', 'url' => generate_url(array('page' => 'device', 'device' => $device['device_id'], 'tab' => 'printing')), 'icon' => 'oicon-contrast');
    echo generate_box_open($box_args);
    echo '<table class="table table-condensed table-striped">';
    foreach ($supplies as $supply) {
        $percent = round($supply['supply_value'], 0);
        if ($supply['supply_colour'] != '') {
            $background = toner_to_colour($supply['supply_colour'], $percent);
        } else {
            $background = toner_to_colour($supply['supply_descr'], $percent);
        }
        $background_percent = get_percentage_colours($percent - 100);
        $graph_array = array();
        $graph_array['height'] = "100";
        $graph_array['width'] = "210";
        $graph_array['to'] = $config['time']['now'];
        $graph_array['id'] = $supply['supply_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'] . " - " . $supply['supply_descr']);
        $graph_array['width'] = 80;
        $graph_array['height'] = 20;
开发者ID:Natolumin,项目名称:observium,代码行数:31,代码来源:printersupplies.inc.php

示例14: unset

        #    $graph_array['to']     = $config['time']['now'];
        #    $graph_array['id']     = $proc['processor_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);
        #    echo('<tr>
        #           <td><span class="entity">'.overlib_link($link, $text_descr, $overlib_content).'</span></td>
        #           <td width=90>'.overlib_link($link, $minigraph, $overlib_content).'</td>
        #           <td width=200>'.overlib_link($link, print_percentage_bar (200, 20, $percent, NULL, "ffffff", $background['left'], $percent . "%", "ffffff", $background['right']), $overlib_content).'
        #           </a></td>
        #         </tr>');
    }
    $average_percent = round($total_percent / $numprocs);
    $background = get_percentage_colours($average_percent);
    echo '<table class="table table-condensed-more table-striped table-bordered">';
    echo '<tr>
           <td><span class="entity">' . overlib_link($link, $text_descr, $overlib_content) . '</span><span class="label pull-right" style="margin-top: 2px; font-size: 11px;"><i class="icon-remove"></i> ' . $numprocs . '</span></td>
           <td style="width: 200px">' . overlib_link($link, print_percentage_bar(200, 20, $average_percent, NULL, "ffffff", $background['left'], $average_percent . "%", "ffffff", $background['right']), $overlib_content) . '</td>
         </tr>';
    echo "</table>";
    echo "</div></div>";
}
// EOF
开发者ID:skive,项目名称:observium,代码行数:31,代码来源:processors-unix.inc.php

示例15: toner2colour

function toner2colour($descr, $percent)
{
    $colour = get_percentage_colours(100 - $percent);
    if (substr($descr, -1) == 'C' || toner_map($descr, "cyan")) {
        $colour['left'] = "55D6D3";
        $colour['right'] = "33B4B1";
    }
    if (substr($descr, -1) == 'M' || toner_map($descr, "magenta")) {
        $colour['left'] = "F24AC8";
        $colour['right'] = "D028A6";
    }
    if (substr($descr, -1) == 'Y' || toner_map($descr, "yellow")) {
        $colour['left'] = "FFF200";
        $colour['right'] = "DDD000";
    }
    if (substr($descr, -1) == 'K' || toner_map($descr, "black")) {
        $colour['left'] = "111111";
        $colour['right'] = "555555";
    }
    return $colour;
}
开发者ID:rhizalpatrax64bit,项目名称:StacksNetwork,代码行数:21,代码来源:functions.inc.php


注:本文中的get_percentage_colours函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。