You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

62 lines
2.2 KiB
PHP

<?php
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
redirectIfNotLoggedIn();
$user = new User($_SESSION['uid']);
if (!$user->hasPermission("MACHINEMANAGER_VIEW")) {
header("Location: ./app.php?msg=no_permission");
die();
}
if (!empty($_GET["id"])) {
$machineid = $_GET["id"];
} else if (!empty($_GET["arg"])) {
$machineid = $_GET["arg"];
}
if (!Machine::exists($machineid)) {
header("Location: ./app.php?msg=no_such_machine");
exit();
}
$labeltype = "machineid";
if (!empty($VARS["labeltype"])) {
switch ($VARS["labeltype"]) {
case "doortag":
$labeltype = "doortag";
break;
case "machineidanonymous":
$labeltype = "machineidanonymous";
break;
case "machineid":
default:
$labeltype = "machineid";
}
}
$machine = new Machine($machineid);
$pdfurl = "./print/print.php?labeltype=$labeltype&id=$machineid";
?>
<div class="d-flex">
<ul class="nav nav-tabs">
<li class="nav-item">
<a class="nav-link<?php echo ($labeltype == "machineid" ? " active" : "") ?>" href="./app.php?page=printlabel&id=<?php echo $machine->getID(); ?>">Machine ID Label</a>
</li>
<li class="nav-item">
<a class="nav-link<?php echo ($labeltype == "doortag" ? " active" : "") ?>" href="./app.php?page=printlabel&id=<?php echo $machine->getID(); ?>&labeltype=doortag">Door Tag</a>
</li>
<li class="nav-item">
<a class="nav-link<?php echo ($labeltype == "machineidanonymous" ? " active" : "") ?>" href="./app.php?page=printlabel&id=<?php echo $machine->getID(); ?>&labeltype=machineidanonymous">Machine ID Label (No "Property Of")</a>
</li>
</ul>
<div class="ml-auto">
<a href="./app.php?page=viewmachine&id=<?php echo $machine->getID(); ?>" class="btn btn-info btn-sm"><i class="fas fa-eye"></i> <?php $Strings->get("Go to machine"); ?></a>
</div>
</div>
<div>
<iframe src="./print/pdfjs/web/viewer.html?<?php echo "labeltype=$labeltype&id=$machineid"; ?>" width="100%" height="500px"></iframe>
</div>