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();