예제 #1
0
 function showFormUserPreferences()
 {
     global $DB;
     $entity = $_SESSION['glpiactive_entity'];
     $userID = Session::getLoginUserID();
     $templates = PluginUninstallUninstall::getAllTemplatesByEntity($_SESSION["glpiactive_entity"], true);
     $data = plugin_version_uninstall();
     echo "<form action='" . $this->getFormURL() . "' method='post'>";
     echo "<div class='center'>";
     echo "<table class='tab_cadre_fixe'>";
     echo "<tr><th colspan='2'>" . $data['name'] . "</th></tr>";
     if (!empty($templates)) {
         echo "<tr class='tab_bg_1 center'>";
         echo "<th>" . PluginUninstallModel::getTypeName() . "</th>";
         echo "<th>" . __("Item's location after uninstall", "uninstall") . "</th>";
         echo "</tr>";
         foreach ($templates as $ID => $name) {
             $pref_ID = self::checkIfPreferenceExistsByEntity($userID, $ID, $entity);
             if (!$pref_ID) {
                 $pref_ID = self::addDefaultPreference($userID, $ID, $entity);
             }
             $this->getFromDB($pref_ID);
             echo "<tr class='tab_bg_1'><td>" . $name . "</td>";
             echo "<td>";
             $value = isset($this->fields["locations_id"]) ? $this->fields["locations_id"] : 0;
             Location::dropdown(array('name' => "id[{$pref_ID}][locations_id]", 'value' => $value == '' ? 0 : $value, 'comments' => 1, 'entity' => $entity, 'toadd' => array(-1 => __('Keep previous location', 'uninstall'), 0 => __('Empty location', 'uninstall'))));
             echo "<input type='hidden' name='id[" . $pref_ID . "][id]' value='" . $pref_ID . "'>";
             echo "</td></tr>";
         }
         echo "<tr class='tab_bg_1'><td colspan='2' class='center'>";
         echo "<input type='submit' name='update_user_preferences_uninstall' value='" . _sx('button', 'Post') . "' class='submit'>";
         echo "</td></tr>";
     }
     echo "</table>";
     echo "</div>";
     Html::closeForm();
 }
예제 #2
0
 /**
  * @param $ID
  * @param $item
  * @param $user_id
  **/
 static function showFormUninstallation($ID, $item, $user_id)
 {
     global $CFG_GLPI;
     $type = $item->getType();
     // TODO review this to pass arg in form, not in URL.
     echo "<form action='" . $CFG_GLPI["root_doc"] . "/plugins/uninstall/front/action.php?device_type={$type}'\n             method='post'>";
     echo "<table class='tab_cadre_fixe' cellpadding='5'>";
     echo "<tr><th colspan='3'>" . self::getTypeName() . "</th></tr>";
     echo "<tr class='tab_bg_1'><td>" . PluginUninstallModel::getTypeName() . "</td><td>";
     $item = new $type();
     $item->getFromDB($ID);
     $rand = self::dropdownUninstallModels("model_id", $_SESSION["glpiID"], $item->fields["entities_id"]);
     echo "</td></tr>";
     $params = array('templates_id' => '__VALUE__', 'entity' => $item->fields["entities_id"], 'users_id' => $_SESSION["glpiID"]);
     Ajax::updateItemOnSelectEvent("dropdown_model_id{$rand}", "show_objects", $CFG_GLPI["root_doc"] . "/plugins/uninstall/ajax/locations.php", $params);
     echo "<tr class='tab_bg_1'><td>" . __("Item's location after uninstall", "uninstall") . "</td>";
     echo "<td><span id='show_objects'>\n" . Dropdown::EMPTY_VALUE . "</span></td>\n";
     echo "</tr>";
     echo "<tr class='tab_bg_1 center'><td colspan='3'>";
     echo "<input type='submit' name='uninstall' value=\"" . _sx('button', 'Post') . "\"\n             class='submit'>";
     echo "<input type='hidden' name='id' value='" . $ID . "'>";
     echo "</td></tr>";
     echo "</table>";
     Html::closeForm();
 }
예제 #3
0
 Uninstall plugin is free software; you can redistribute it and/or modify
 it under the terms of the GNU General Public License as published by
 the Free Software Foundation; either version 2 of the License, or
 (at your option) any later version.

 Uninstall plugin is distributed in the hope that it will be useful,
 but WITHOUT ANY WARRANTY; without even the implied warranty of
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 GNU General Public License for more details.

 You should have received a copy of the GNU General Public License
 along with uninstall. If not, see <http://www.gnu.org/licenses/>.
 --------------------------------------------------------------------------
 @package   uninstall
 @author    the uninstall plugin team
 @copyright Copyright (c) 2010-2013 Uninstall plugin team
 @license   GPLv2+
            http://www.gnu.org/licenses/gpl.txt
 @link      https://forge.indepnet.net/projects/uninstall
 @link      http://www.glpi-project.org/
 @since     2009
 ---------------------------------------------------------------------- */
include '../../../inc/includes.php';
Html::header(PluginUninstallModel::getTypeName(Session::getPluralNumber()), '', "admin", "PluginUninstallModel", "model");
if (Session::haveRight(PluginUninstallProfile::$rightname, READ)) {
    Search::show("PluginUninstallModel");
} else {
    Html::displayRightError();
}
Html::footer();
예제 #4
0
    $id = -1;
}
$model = new PluginUninstallModel();
if (isset($_POST["add"])) {
    $model->check(-1, UPDATE, $_POST);
    $model->add($_POST);
    Html::back();
} else {
    if (isset($_POST["update"])) {
        $model->check($_POST['id'], UPDATE);
        $model->update($_POST);
        Html::back();
    } else {
        if (isset($_POST["delete"])) {
            $model->check($_POST['id'], DELETE);
            $model->delete($_POST);
            $model->redirectToList();
        } else {
            Html::header(PluginUninstallModel::getTypeName(), $_SERVER['PHP_SELF'], "admin", "PluginUninstallModel", "model");
            if ($model->getFromDB($id)) {
                if ($model->fields['types_id'] == PluginUninstallModel::TYPE_MODEL_REPLACEMENT) {
                    if (!Session::haveRight(PluginUninstallProfile::$rightname, PluginUninstallProfile::RIGHT_REPLACE)) {
                        Html::displayRightError();
                    }
                }
            }
            $model->display(array('id' => $id, 'withtemplate' => $_GET["withtemplate"]));
            Html::footer();
        }
    }
}