Exemplo n.º 1
0
--------------------------------------------------------------------------
*/
/** @file
* @brief
*/
include '../inc/includes.php';
Session::checkRight("networking", READ);
if (!isset($_GET["id"])) {
    $_GET["id"] = "";
}
if (!isset($_GET["withtemplate"])) {
    $_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"])) {
    exit;
}
if (!isset($_REQUEST['glpi_tab'])) {
    exit;
}
if (!isset($_POST["sort"])) {
    $_POST["sort"] = "";
}
if (!isset($_POST["order"])) {
    $_POST["order"] = "";
}
if (!isset($_POST["withtemplate"])) {
    $_POST["withtemplate"] = "";
}
$netdevice = new NetworkEquipment();
$netdevice->check($_POST["id"], 'r');
if (!empty($_POST["withtemplate"])) {
    if ($_POST["id"] > 0) {
        switch ($_REQUEST['glpi_tab']) {
            case 4:
                Infocom::showForItem($netdevice, $_POST["withtemplate"]);
                Contract::showAssociated($netdevice, $_POST["withtemplate"]);
                break;
            case 5:
                Document::showAssociated($netdevice, $_POST["withtemplate"]);
                break;
            default:
                if (!Plugin::displayAction($netdevice, $_REQUEST['glpi_tab'], $_POST["withtemplate"])) {
                    NetworkPort::showForItem('NetworkEquipment', $_POST["id"], $_POST["withtemplate"]);
                }
        }
Exemplo n.º 3
0
--------------------------------------------------------------------------
*/
/** @file
* @brief
*/
include '../inc/includes.php';
Session::checkRight("networking", "r");
if (!isset($_GET["id"])) {
    $_GET["id"] = "";
}
if (!isset($_GET["withtemplate"])) {
    $_GET["withtemplate"] = "";
}
$netdevice = new NetworkEquipment();
if (isset($_POST["add"])) {
    $netdevice->check(-1, 'w', $_POST);
    $newID = $netdevice->add($_POST);
    Event::log($newID, "networkequipment", 4, "inventory", sprintf(__('%1$s adds the item %2$s'), $_SESSION["glpiname"], $_POST["name"]));
    Html::back();
} else {
    if (isset($_POST["delete"])) {
        $netdevice->check($_POST["id"], 'd');
        $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"], 'd');
            $netdevice->restore($_POST);
            Event::log($_POST["id"], "networkequipment", 4, "inventory", sprintf(__('%s restores an item'), $_SESSION["glpiname"]));
            $netdevice->redirectToList();