2012-04-09 23:00:31 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
$graph_type = "toner_usage";
|
|
|
|
|
|
|
|
$toners = dbFetchRows("SELECT * FROM `toner` WHERE device_id = ?", array($device['device_id']));
|
|
|
|
|
|
|
|
if (count($toners))
|
|
|
|
{
|
2014-02-26 22:33:45 +00:00
|
|
|
echo('<div class="row">
|
|
|
|
<div class="col-md-12">
|
|
|
|
<div class="panel panel-default panel-condensed">
|
|
|
|
<div class="panel-heading">');
|
|
|
|
echo('<a href="device/device='.$device['device_id'].'/tab=toner/">');
|
|
|
|
echo("<img src='images/icons/toner.png'> Toner</a>");
|
|
|
|
echo('</div>
|
|
|
|
<table class="table table-hover table-condensed table-striped">');
|
2012-04-09 23:00:31 +00:00
|
|
|
|
|
|
|
foreach ($toners as $toner)
|
|
|
|
{
|
|
|
|
$percent = round($toner['toner_current'], 0);
|
|
|
|
$total = formatStorage($toner['toner_size']);
|
|
|
|
$free = formatStorage($toner['toner_free']);
|
|
|
|
$used = formatStorage($toner['toner_used']);
|
|
|
|
|
2012-04-14 23:28:23 +00:00
|
|
|
$background = toner2colour($toner['toner_descr'], $percent);
|
2012-04-17 15:27:17 +00:00
|
|
|
|
2012-04-09 23:00:31 +00:00
|
|
|
$graph_array = array();
|
|
|
|
$graph_array['height'] = "100";
|
|
|
|
$graph_array['width'] = "210";
|
2012-05-06 18:38:11 +00:00
|
|
|
$graph_array['to'] = $config['time']['now'];
|
2012-04-09 23:00:31 +00:00
|
|
|
$graph_array['id'] = $toner['toner_id'];
|
|
|
|
$graph_array['type'] = $graph_type;
|
2012-05-06 18:38:11 +00:00
|
|
|
$graph_array['from'] = $config['time']['day'];
|
2012-04-09 23:00:31 +00:00
|
|
|
$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']);
|
|
|
|
|
2012-04-10 17:21:49 +00:00
|
|
|
$graph_array['width'] = 80; $graph_array['height'] = 20; $graph_array['bg'] = 'ffffff00'; # the 00 at the end makes the area transparent.
|
2012-04-17 15:27:17 +00:00
|
|
|
|
2012-04-09 23:00:31 +00:00
|
|
|
$minigraph = generate_graph_tag($graph_array);
|
|
|
|
|
2014-02-26 22:33:45 +00:00
|
|
|
echo("<tr>
|
|
|
|
<td>".overlib_link($link, $toner['toner_descr'], $overlib_content)."</td>
|
|
|
|
<td>".overlib_link($link, $minigraph, $overlib_content)."</td>
|
|
|
|
<td>".overlib_link($link, print_percentage_bar (200, 20, $percent, NULL, "ffffff", $background['left'], $percent . "%", "ffffff", $background['right']), $overlib_content)."
|
2012-04-09 23:00:31 +00:00
|
|
|
</a></td>
|
|
|
|
</tr>");
|
|
|
|
}
|
|
|
|
|
|
|
|
echo("</table>");
|
|
|
|
echo("</div>");
|
2014-02-26 22:33:45 +00:00
|
|
|
echo("</div>");
|
|
|
|
echo("</div>");
|
|
|
|
echo("</div>");
|
2012-04-09 23:00:31 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
unset ($toner_rows);
|
|
|
|
|
|
|
|
?>
|