| 
									
										
										
										
											2020-06-03 01:06:19 -06:00
										 |  |  | <?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(); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-07-02 18:02:44 -06:00
										 |  |  | $labeltype = array_keys($SETTINGS["labels"]["templates"])[0]; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | if (!empty($VARS["labeltype"]) && array_key_exists($VARS["labeltype"], $SETTINGS["labels"]["templates"])) { | 
					
						
							|  |  |  |     $labeltype = $VARS["labeltype"]; | 
					
						
							| 
									
										
										
										
											2020-06-03 01:06:19 -06:00
										 |  |  | } | 
					
						
							| 
									
										
										
										
											2020-07-02 18:02:44 -06:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-06-03 01:06:19 -06:00
										 |  |  | $machine = new Machine($machineid); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | $pdfurl = "./print/print.php?labeltype=$labeltype&id=$machineid"; | 
					
						
							|  |  |  | ?>
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | <div class="d-flex"> | 
					
						
							| 
									
										
										
										
											2020-06-10 11:43:13 -06:00
										 |  |  |     <ul class="nav nav-tabs"> | 
					
						
							| 
									
										
										
										
											2020-07-02 18:02:44 -06:00
										 |  |  |         <?php | 
					
						
							|  |  |  |         foreach ($SETTINGS["labels"]["templates"] as $id => $display) { | 
					
						
							|  |  |  |             ?>
 | 
					
						
							|  |  |  |             <li class="nav-item"> | 
					
						
							|  |  |  |                 <a class="nav-link<?php echo ($labeltype == $id ? " active" : "") ?>" href="./app.php?page=printlabel&id=<?php echo $machine->getID(); ?>&labeltype=<?php echo $id; ?>"><?php echo $display; ?></a>
 | 
					
						
							|  |  |  |             </li> | 
					
						
							|  |  |  |             <?php | 
					
						
							|  |  |  |         } | 
					
						
							|  |  |  |         ?>
 | 
					
						
							| 
									
										
										
										
											2020-06-10 11:43:13 -06:00
										 |  |  |     </ul> | 
					
						
							| 
									
										
										
										
											2020-06-03 01:06:19 -06:00
										 |  |  |     <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> | 
					
						
							| 
									
										
										
										
											2020-06-09 20:20:55 -06:00
										 |  |  |     <iframe src="./print/pdfjs/web/viewer.html?<?php echo "labeltype=$labeltype&id=$machineid"; ?>" width="100%" height="500px"></iframe> | 
					
						
							| 
									
										
										
										
											2020-06-10 11:21:41 -06:00
										 |  |  | </div> |