1<?php
2
3/**
4 * Observium Network Management and Monitoring System
5 * Copyright (C) 2006-2015, Adam Armstrong - http://www.observium.org
6 *
7 * @package    observium
8 * @subpackage webui
9 * @author     Adam Armstrong <adama@observium.org>
10 * @copyright  (C) 2006-2013 Adam Armstrong, (C) 2013-2019 Observium Limited
11 *
12 */
13
14register_html_title("Printing");
15
16$navbar = array();
17$navbar['brand'] = "Printer supplies";
18$navbar['class'] = "navbar-narrow";
19// Convert generic view to supply var
20if (!isset($vars['supply']) && isset($vars['view']))
21{
22  $vars['supply'] = $vars['view'];
23  unset($vars['view']);
24}
25
26foreach ($printing_tabs as $type)
27{
28  if (!$vars['supply']) { $vars['supply'] = $type; }
29
30  $navbar['options'][$type]['url']  = generate_url(array('page' => 'device', 'device' => $device['device_id'], 'tab' => 'printing', 'supply' => $type));
31  $navbar['options'][$type]['text'] = nicecase($type);
32  if ($vars['supply'] == $type) { $navbar['options'][$type]['class'] = "active"; }
33
34}
35
36if (dbExist('counters', '`device_id` = ? AND `counter_class` = ?', array($device['device_id'], 'printersupply')))
37{
38  $navbar['options']['counters']['url'] = generate_url(array('page' => 'device', 'device' => $device['device_id'], 'tab' => 'printing', 'supply' => 'counters'));
39  $navbar['options']['counters']['text'] = 'Printed counters';
40  if ($vars['supply'] == 'counters') { $navbar['options']['counters']['class'] = "active"; }
41}
42
43print_navbar($navbar);
44unset($navbar);
45
46switch ($vars['supply'])
47{
48  case 'counter':
49  case 'counters':
50    echo generate_box_open();
51    echo('<table class="table table-condensed table-striped  table-striped">');
52
53    $graph_title = "Counters";
54    $graph_type = "device_counter";
55
56    include("includes/print-device-graph.php");
57
58    echo('</table>');
59    echo generate_box_close();
60
61    print_counter_table(array('device_id' => $device['device_id'], 'class' => 'printersupply', 'page' => 'device'));
62    break;
63  case 'sensor':
64  case 'sensors':
65    echo generate_box_open();
66    echo('<table class="table table-condensed table-striped  table-striped">');
67
68    $graph_title = "Sensors";
69    $graph_type = "device_pagecount";
70
71    include("includes/print-device-graph.php");
72
73    echo('</table>');
74    echo generate_box_close();
75
76    print_sensor_table(array('device_id' => $device['device_id'], 'metric' => 'counter', 'sensor_descr' => 'print', 'page' => 'device'));
77    break;
78  default:
79    echo generate_box_open();
80    echo('<table class="table table-condensed table-striped  table-striped">');
81
82    $graph_title = nicecase($vars['supply']);
83    $graph_type = "device_printersupplies_" . $vars['supply'];
84
85    include("includes/print-device-graph.php");
86
87    echo('</table>');
88    echo generate_box_close();
89
90    print_printersupplies_table($vars);
91    break;
92}
93
94// EOF
95