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.

47 lines
1.5 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['arg']) && Job::exists($_GET['arg'])) {
$editing = true;
$job = new Job($_GET['arg']);
} else {
$job = Job::create();
}
if ($editing) {
$form = new FormBuilder("Edit Job " . $job->getName(), "fas fa-tasks", "action.php", "POST");
} else {
$form = new FormBuilder("Add Job", "fas fa-tasks", "action.php", "POST");
}
$form->setID("editjob");
$form->addHiddenInput("action", "editjob");
$form->addHiddenInput("source", "viewjob");
if ($editing) {
$form->addHiddenInput("jobid", $job->getID());
}
$form->addInput("jobname", $job->getName(), "text", true, null, null, "Job Title", "fas fa-tasks", 8, 0, 200);
$form->addInput("machineid", $job->getMachineID(), "text", false, null, null, "Machine ID", "fas fa-desktop", 4, 0, 200);
$form->addInput("jobinfo", $job->getInfo(), "textarea", false, "jobinfo", null, "Info", "fas fa-comment-dots", 6, 0, 10000);
$form->addInput("jobnotes", $job->getNotes(), "textarea", false, "jobnotes", null, "Notes", "far fa-comment-dots", 6, 0, 10000);
$form->addButton("Save", "fas fa-save", null, "submit", "savebtn");
$form->generate();