Пример #1
0
}
if (empty($_GET["networknames_id"])) {
    $_GET["networknames_id"] = "";
}
if (isset($_POST["add"])) {
    $alias->check(-1, 'w', $_POST);
    if ($newID = $alias->add($_POST)) {
        Ajax::refreshPopupTab();
        Event::log($newID, $alias->getType(), 4, "setup", sprintf(__('%1$s adds the item %2$s'), $_SESSION["glpiname"], $_POST["name"]));
    }
    Html::back();
} else {
    if (isset($_POST["delete"])) {
        $alias->check($_POST['id'], 'd');
        $item = $alias->getItem();
        $alias->delete($_POST);
        Event::log($_POST["id"], $alias->getType(), 4, "setup", sprintf(__('%s purges an item'), $_SESSION["glpiname"]));
        if ($item) {
            Html::redirect($item->getLinkURL());
        } else {
            Html::redirect($CFG_GLPI['root_doc'] . "/front/central.php");
        }
    } else {
        if (isset($_POST["update"])) {
            $alias->check($_POST["id"], 'w');
            $alias->update($_POST);
            Ajax::refreshPopupMainWindow();
            Event::log($_POST["id"], $alias->getType(), 4, "setup", sprintf(__('%s updates an item'), $_SESSION["glpiname"]));
            Html::back();
        }
    }
Пример #2
0
    $_GET["networknames_id"] = "";
}
if (isset($_POST["add"])) {
    $alias->check(-1, CREATE, $_POST);
    if ($newID = $alias->add($_POST)) {
        Event::log($newID, $alias->getType(), 4, "setup", sprintf(__('%1$s adds the item %2$s'), $_SESSION["glpiname"], $_POST["name"]));
        if ($_SESSION['glpibackcreated']) {
            Html::redirect($alias->getFormURL() . "?id=" . $newID);
        }
    }
    Html::back();
} else {
    if (isset($_POST["purge"])) {
        $alias->check($_POST['id'], PURGE);
        $item = $alias->getItem();
        $alias->delete($_POST, 1);
        Event::log($_POST["id"], "networkname", 5, "inventory", sprintf(__('%s purges an item'), $_SESSION["glpiname"]));
        if ($item) {
            Html::redirect($item->getLinkURL());
        } else {
            Html::redirect($CFG_GLPI["root_doc"] . "/front/central.php");
        }
    } else {
        if (isset($_POST["update"])) {
            $alias->check($_POST["id"], UPDATE);
            $alias->update($_POST);
            Event::log($_POST["id"], $alias->getType(), 4, "setup", sprintf(__('%s updates an item'), $_SESSION["glpiname"]));
            Html::back();
        }
    }
}