Пример #1
0
    $_GET["withtemplate"] = "";
}
$netdevice = new NetworkEquipment();
if (isset($_POST["add"])) {
    $netdevice->check(-1, CREATE, $_POST);
    if ($newID = $netdevice->add($_POST)) {
        Event::log($newID, "networkequipment", 4, "inventory", sprintf(__('%1$s adds the item %2$s'), $_SESSION["glpiname"], $_POST["name"]));
        if ($_SESSION['glpibackcreated']) {
            Html::redirect($netdevice->getFormURL() . "?id=" . $newID);
        }
    }
    Html::back();
} else {
    if (isset($_POST["delete"])) {
        $netdevice->check($_POST["id"], DELETE);
        $netdevice->delete($_POST);
        Event::log($_POST["id"], "networkequipment", 4, "inventory", sprintf(__('%s deletes an item'), $_SESSION["glpiname"]));
        $netdevice->redirectToList();
    } else {
        if (isset($_POST["restore"])) {
            $netdevice->check($_POST["id"], DELETE);
            $netdevice->restore($_POST);
            Event::log($_POST["id"], "networkequipment", 4, "inventory", sprintf(__('%s restores an item'), $_SESSION["glpiname"]));
            $netdevice->redirectToList();
        } else {
            if (isset($_POST["purge"])) {
                $netdevice->check($_POST["id"], PURGE);
                $netdevice->delete($_POST, 1);
                Event::log($_POST["id"], "networkequipment", 4, "inventory", sprintf(__('%s purges an item'), $_SESSION["glpiname"]));
                $netdevice->redirectToList();
            } else {