Exemple #1
0
        $newID = $item->add($_POST);
        if ($_SESSION['glpibackcreated']) {
            Html::redirect($itemtype::getFormURL() . "&id=" . $newID);
        } else {
            Html::back();
        }
    } elseif (isset($_POST["update"])) {
        $item->check($id, UPDATE);
        $item->update($_POST);
        Html::back();
    } elseif (isset($_POST["restore"])) {
        $item->check($id, DELETE);
        $item->restore($_POST);
        Html::back();
    } elseif (isset($_POST["purge"])) {
        $item->check($id, PURGE);
        $item->delete($_POST, 1);
        $item->redirectToList();
    } elseif (isset($_POST["delete"])) {
        $item->check($id, DELETE);
        $item->delete($_POST);
        $item->redirectToList();
    }
    $menu = PluginGenericobjectType::getFamilyNameByItemtype($_GET['itemtype']);
    Html::header($itemtype::getTypeName(), $_SERVER['PHP_SELF'], "assets", $menu !== false ? $menu : $itemtype, strtolower($itemtype));
    $item->display($_GET, array('withtemplate' => $_GET["withtemplate"]));
    Html::footer();
} else {
    Html::header(__('Access Denied!'));
    Html::DisplayErrorAndDie(__("You can't access to this page directly!"));
}