showForm() 공개 메소드

Print the version form
public showForm ( $ID, $options = [] ) : true
$ID integer ID of the item
$options array - target for the Form - computers_id ID of the computer for add process
리턴 true if displayed false if item not found or not right to display
예제 #1
0
}
$disk = new ComputerDisk();
if (isset($_POST["add"])) {
    $disk->check(-1, 'w', $_POST);
    if ($newID = $disk->add($_POST)) {
        Event::log($_POST['computers_id'], "computers", 4, "inventory", sprintf(__('%s adds a volume'), $_SESSION["glpiname"]));
    }
    Html::back();
} else {
    if (isset($_POST["delete"])) {
        $disk->check($_POST["id"], 'd');
        if ($disk->delete($_POST)) {
            Event::log($disk->fields['computers_id'], "computers", 4, "inventory", sprintf(__('%s deletes a volume'), $_SESSION["glpiname"]));
        }
        $computer = new Computer();
        $computer->getFromDB($disk->fields['computers_id']);
        Html::redirect(Toolbox::getItemTypeFormURL('Computer') . '?id=' . $disk->fields['computers_id'] . ($computer->fields['is_template'] ? "&withtemplate=1" : ""));
    } else {
        if (isset($_POST["update"])) {
            $disk->check($_POST["id"], 'w');
            if ($disk->update($_POST)) {
                Event::log($disk->fields['computers_id'], "computers", 4, "inventory", sprintf(__('%s updates a volume'), $_SESSION["glpiname"]));
            }
            Html::back();
        } else {
            Html::header(Computer::getTypeName(2), $_SERVER['PHP_SELF'], "inventory", "computer");
            $disk->showForm($_GET["id"], array('computers_id' => $_GET["computers_id"]));
            Html::footer();
        }
    }
}