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.
39 lines
946 B
PHP
39 lines
946 B
PHP
<?php
|
|
|
|
/*
|
|
* Copyright 2020 Netsyms Technologies.
|
|
* 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/.
|
|
*/
|
|
|
|
require_once __DIR__ . "/../required.php";
|
|
|
|
redirectIfNotLoggedIn();
|
|
$user = new User($_SESSION['uid']);
|
|
if (!$user->hasPermission("MACHINEMANAGER_VIEW")) {
|
|
die("No permission.");
|
|
}
|
|
|
|
if (!empty($_GET["id"])) {
|
|
$machineid = $_GET["id"];
|
|
} else if (!empty($_GET["arg"])) {
|
|
$machineid = $_GET["arg"];
|
|
}
|
|
if (!Machine::exists($machineid)) {
|
|
exit("No such machine.");
|
|
}
|
|
|
|
$templates = DeviceLabelPrinter::getLabelTemplates();
|
|
|
|
$labeltype = array_keys($templates)[0];
|
|
|
|
if (array_key_exists($VARS["labeltype"], $templates)) {
|
|
$labeltype = $VARS["labeltype"];
|
|
}
|
|
|
|
$machine = new Machine($machineid);
|
|
|
|
$printer = new DeviceLabelPrinter($labeltype, $machine);
|
|
|
|
$printer->servePDF(); |