showForm() public method

Print the computer form
public showForm ( $ID, $options = [] ) : Nothing
$ID integer ID of the item
$options array - target for the Form - withtemplate template or basic computer
return Nothing (display)
Exemplo n.º 1
0
            $computer->check($_POST['id'], 'd');
            if ($computer->restore($_POST)) {
                Event::log($_POST["id"], "computers", 4, "inventory", sprintf(__('%s restores an item'), $_SESSION["glpiname"]));
            }
            $computer->redirectToList();
        } else {
            if (isset($_POST["purge"])) {
                $computer->check($_POST['id'], 'd');
                if ($computer->delete($_POST, 1)) {
                    Event::log($_POST["id"], "computers", 4, "inventory", sprintf(__('%s purges an item'), $_SESSION["glpiname"]));
                }
                $computer->redirectToList();
                //update a computer
            } else {
                if (isset($_POST["update"])) {
                    $computer->check($_POST['id'], 'w');
                    $computer->update($_POST);
                    Event::log($_POST["id"], "computers", 4, "inventory", sprintf(__('%s updates an item'), $_SESSION["glpiname"]));
                    Html::back();
                    // Disconnect a computer from a printer/monitor/phone/peripheral
                } else {
                    //print computer information
                    Html::header(Computer::GetTypeName(2), $_SERVER['PHP_SELF'], "inventory", "computer");
                    //show computer form to add
                    $computer->showForm($_GET["id"], array('withtemplate' => $_GET["withtemplate"]));
                    Html::footer();
                }
            }
        }
    }
}