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.

46 lines
1.6 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_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");
$form->addHiddenInput("source", "machines");
$form->addHiddenInput("machine", htmlspecialchars($_GET['id']));
$events = $database->select("event_types", ['eventid', 'eventname']);
$eventselect = ["" => ""];
foreach ($events as $e) {
$eventselect[$e['eventid']] = $e['eventname'];
}
$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");
$form->addInput("time", date("H:i"), "time", true, null, null, "Time", "fas fa-clock");
$form->addInput("privatenotes", "", "textarea", false, null, null, "Private Notes", "fas fa-comment-dots", 6);
$form->addInput("publicnotes", "", "textarea", false, null, null, "Public Notes", "far fa-comment-dots", 6);
$form->addButton("Save", "fas fa-save", null, "submit", "savebtn");
$form->generate();