-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.php
77 lines (57 loc) · 3.08 KB
/
index.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
<?php
require("vendor/autoload.php");
snmp_read_mib($_SERVER['MIBDIRS'].'SNMPv2-SMI.txt');
$generalPrintersConfigs = json_decode(file_get_contents("./configs/general_printers.json"), true);
$specificPrintersConfigs = json_decode(file_get_contents("./configs/specific_printers.json"), true);
echo "<div class='row'>";
foreach($specificPrintersConfigs as $specificPrintersConfigKey => $specificPrintersConfig) {
echo "<div class='column'>";
$printer = new Printer(
array_merge($generalPrintersConfigs, $specificPrintersConfig)
);
try {
echo "<h3>Printer-IP: ".$printer->getIPAddress()."</h3>";
echo "<h3>Factory-ID: ".$printer->getFactoryId()."</h3>";
echo "<h3>Vendor name: ".$printer->getVendorName()."</h3>";
echo "<h3>Serial number: ".$printer->getSerialNumber()."</h3>";
echo "<h3>Black-white prints: ".$printer->getNumberOfPrintedBlacks()."</h3>";
echo "<h3>Color prints: ".$printer->getNumberOfPrintedColors()."</h3>";
echo "<h3>Total prints: ".$printer->getNumberOfPrintedPapers()."</h3>";
echo "<h2>Toner levels:</h2>";
echo "<strong style='background: cyan; color: black;'>Cyan [C]:</strong> ".$printer->getCyanTonerLevel()."%</br>";
echo "<strong style='background: magenta; color: black;'>Magenta [M]:</strong> ".$printer->getMagentaTonerLevel()."%</br>";
echo "<strong style='background: yellow; color: black;'>Yellow [Y]:</strong> ".$printer->getYellowTonerLevel()."%</br>";
if($printer->isOneBlackTonerPrinter()){
echo "<strong style='background: black; color: white;'>Black [K]:</strong> : ".$printer->getBlackTonerLevel()."%</br>";
} else if($printer->isTwoBlackTonerPrinter()) {
echo "<strong style='background: black; color: white;'>Black [K1]:</strong> : ".$printer->getBlackTonerFirstLevel()."%</br>";
echo "<strong style='background: black; color: white;'>Black [K2]:</strong> ".$printer->getBlackTonerSecondLevel()."%</br>";
}
echo "<h2>Drum levels:</h2>";
echo "<strong style='background: cyan; color: black;'>Cyan [C]:</strong> ".$printer->getCyanDrumLevel()."%</br>";
echo "<strong style='background: magenta; color: black;'>Magenta [M]:</strong> ".$printer->getMagentaDrumLevel()."%</br>";
echo "<strong style='background: yellow; color: black;'>Yellow [Y]:</strong> ".$printer->getYellowDrumLevel()."%</br>";
echo "<strong style='background: black; color: white;'>Black [K]:</strong> : ".$printer->getBlackDrumLevel()."%</br>";
echo "<h2>Supply levels:</h2>";
echo "<strong style='background: grey; color: black;'>Waste:</strong> ".$printer->getWasteContainerLevel()."</br>";
echo "<strong style='background: grey; color: black;'>Fuser:</strong> ".$printer->getFuserAssemblyLevel()."%</br>";
} catch(Exception $e) {
echo $e->getMessage();
}
echo "</div>";
}
echo "</div>";
echo '
<style>
.column {
float: left;
width: 50%;
}
/* Clear floats after the columns */
.row:after {
content: "";
display: table;
clear: both;
}
</style>
';