Exemplo n.º 1
0
    switch ($_POST["field"]) {
        case "types_id":
            if ($_POST["itemtype"] == 'PluginOrderOther') {
                $file = 'other';
            } else {
                $file = $_POST["itemtype"];
            }
            if (file_exists(GLPI_ROOT . "/inc/" . strtolower($_POST["itemtype"]) . "type.class.php") || file_exists(GLPI_ROOT . "/plugins/order/inc/" . strtolower($file) . "type.class.php")) {
                Dropdown::show($_POST["itemtype"] . "Type", array('name' => "types_id"));
            }
            break;
        case "models_id":
            if (file_exists(GLPI_ROOT . "/inc/" . strtolower($_POST["itemtype"]) . "model.class.php")) {
                Dropdown::show($_POST["itemtype"] . "Model", array('name' => "models_id"));
            } else {
                return "";
            }
            break;
        case "templates_id":
            $item = new $_POST['itemtype']();
            if ($item->maybeTemplate()) {
                $table = getTableForItemType($_POST["itemtype"]);
                $PluginOrderReference->dropdownTemplate("templates_id", $_POST["entity_restrict"], $table);
            } else {
                return "";
            }
            break;
    }
} else {
    return '';
}