コード例 #1
0
--------------------------------------------------------------------------
*/
/** @file
* @brief
*/
include '../inc/includes.php';
Session::checkCentralAccess();
if (!isset($_GET["id"])) {
    $_GET["id"] = "";
}
if (!isset($_GET["computers_id"])) {
    $_GET["computers_id"] = "";
}
$disk = new ComputerVirtualMachine();
if (isset($_POST["add"])) {
    $disk->check(-1, CREATE, $_POST);
    if ($newID = $disk->add($_POST)) {
        Event::log($_POST['computers_id'], "computers", 4, "inventory", sprintf(__('%s adds a virtual machine'), $_SESSION["glpiname"]));
        if ($_SESSION['glpibackcreated']) {
            Html::redirect(Toolbox::getItemTypeFormURL('ComputerVirtualMachine') . "?id=" . $newID);
        }
    }
    Html::back();
} else {
    if (isset($_POST["purge"])) {
        $disk->check($_POST["id"], PURGE);
        if ($disk->delete($_POST, 1)) {
            Event::log($disk->fields['computers_id'], "computers", 4, "inventory", sprintf(__('%s purges a virtual machine'), $_SESSION["glpiname"]));
        }
        $computer = new Computer();
        $computer->getFromDB($disk->fields['computers_id']);
コード例 #2
0
*/
// ----------------------------------------------------------------------
// Original Author of file:
// Purpose of file:
// ----------------------------------------------------------------------
define('GLPI_ROOT', '..');
include GLPI_ROOT . "/inc/includes.php";
if (!isset($_GET["id"])) {
    $_GET["id"] = "";
}
if (!isset($_GET["computers_id"])) {
    $_GET["computers_id"] = "";
}
$disk = new ComputerVirtualMachine();
if (isset($_POST["add"])) {
    $disk->check(-1, 'w', $_POST);
    if ($newID = $disk->add($_POST)) {
        Event::log($_POST['computers_id'], "computers", 4, "inventory", $_SESSION["glpiname"] . " " . $LANG['log'][21]);
    }
    glpi_header($_SERVER['HTTP_REFERER']);
} else {
    if (isset($_POST["delete"])) {
        $disk->check($_POST["id"], 'w');
        if ($disk->delete($_POST)) {
            Event::log($disk->fields['computers_id'], "computers", 4, "inventory", $_SESSION["glpiname"] . " " . $LANG['log'][21]);
        }
        $computer = new Computer();
        $computer->getFromDB($disk->fields['computers_id']);
        glpi_header(getItemTypeFormURL('Computer') . '?id=' . $disk->fields['computers_id'] . ($computer->fields['is_template'] ? "&withtemplate=1" : ""));
    } else {
        if (isset($_POST["update"])) {