| 
									
										
										
										
											2019-09-29 22:38:10 -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_EDIT")) { | 
					
						
							|  |  |  |     header("Location: ./app.php?msg=no_permission"); | 
					
						
							|  |  |  |     die(); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | $editing = false; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | if (empty($_GET['id']) || !Machine::exists($_GET['id'])) { | 
					
						
							|  |  |  |     header("Location: ./app.php?msg=invalid_parameters"); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | $machine = new Machine($_GET['id']); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | $form = new FormBuilder("Add Event", "fas fa-history", "action.php", "POST"); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | $form->setID("editmachine"); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | $form->addHiddenInput("action", "addevent"); | 
					
						
							| 
									
										
										
										
											2020-06-11 15:02:45 -06:00
										 |  |  | $form->addHiddenInput("source", "viewmachine"); | 
					
						
							| 
									
										
										
										
											2019-09-29 22:38:10 -06:00
										 |  |  | $form->addHiddenInput("machine", htmlspecialchars($_GET['id'])); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-09-03 15:42:20 -06:00
										 |  |  | $eventselect = ["" => ""] + Event::getTypesFormattedForForm(); | 
					
						
							| 
									
										
										
										
											2019-09-29 22:38:10 -06:00
										 |  |  | 
 | 
					
						
							|  |  |  | $form->addInput("event", "", "select", true, null, $eventselect, "Event", "fas fa-list"); | 
					
						
							|  |  |  | $form->addInput("date", date("Y-m-d"), "date", true, null, null, "Date", "fas fa-calendar"); | 
					
						
							| 
									
										
										
										
											2019-12-07 20:06:10 -07:00
										 |  |  | $form->addInput("time", date("H:i"), "time", true, null, null, "Time", "fas fa-clock"); | 
					
						
							| 
									
										
										
										
											2020-06-27 16:12:21 -06:00
										 |  |  | $form->addInput("privatenotes", "", "textarea", false, null, null, "Private Notes", "fas fa-comment-dots", 6, 0, 10000); | 
					
						
							|  |  |  | $form->addInput("publicnotes", "", "textarea", false, null, null, "Public Notes", "far fa-comment-dots", 6, 0, 10000); | 
					
						
							| 
									
										
										
										
											2019-09-29 22:38:10 -06:00
										 |  |  | 
 | 
					
						
							|  |  |  | $form->addButton("Save", "fas fa-save", null, "submit", "savebtn"); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | $form->generate(); |