Exemple #1
0
} else {
    if (isset($_POST["purge"])) {
        $ic->check($_POST["id"], PURGE);
        $ic->delete($_POST, 1);
        Event::log($_POST["id"], "infocom", 4, "financial", sprintf(__('%s purges an item'), $_SESSION["glpiname"]));
        Html::back();
    } else {
        if (isset($_POST["update"])) {
            $ic->check($_POST["id"], UPDATE);
            $ic->update($_POST);
            Event::log($_POST["id"], "infocom", 4, "financial", sprintf(__('%s updates an item'), $_SESSION["glpiname"]));
            Html::back();
        } else {
            Session::checkRight("infocom", READ);
            Html::popHeader(Infocom::getTypeName(), $_SERVER['PHP_SELF']);
            if (isset($_GET["id"])) {
                $ic->getFromDB($_GET["id"]);
                $_GET["itemtype"] = $ic->fields["itemtype"];
                $_GET["items_id"] = $ic->fields["items_id"];
            }
            $item = false;
            if (isset($_GET["itemtype"]) && ($item = getItemForItemtype($_GET["itemtype"]))) {
                if (!isset($_GET["items_id"]) || !$item->getFromDB($_GET["items_id"])) {
                    $item = false;
                }
            }
            Infocom::showForItem($item, 0);
            Html::popFooter();
        }
    }
}