Пример #1
0
            $computer->check($_POST['id'], DELETE);
            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'], PURGE);
                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'], UPDATE);
                    $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(Session::getPluralNumber()), $_SERVER['PHP_SELF'], "assets", "computer");
                    //show computer form to add
                    $computer->display(array('id' => $_GET["id"], 'withtemplate' => $_GET["withtemplate"]));
                    Html::footer();
                }
            }
        }
    }
}