Esempio n. 1
0
$model = new PluginUninstallModel();
$model->getConfig($_REQUEST["model_id"]);
//Case of a uninstallation initiated from the object form
if (isset($_REQUEST["uninstall"])) {
    //Uninstall only if a model is selected
    if ($model->fields['types_id'] == PluginUninstallModel::TYPE_MODEL_UNINSTALL) {
        //Massive uninstallation
        PluginUninstallUninstall::uninstall($_REQUEST["device_type"], $_REQUEST["model_id"], array($_REQUEST["device_type"] => array($_REQUEST["id"] => $_REQUEST["id"])), $location);
        Html::back();
    } else {
        PluginUninstallReplace::showForm($_REQUEST["device_type"], $_REQUEST["model_id"], array($_REQUEST["device_type"] => array($_REQUEST["id"] => $_REQUEST["id"])), $location);
        Html::footer();
    }
} else {
    if ($model->fields['types_id'] == PluginUninstallModel::TYPE_MODEL_UNINSTALL) {
        //Massive uninstallation
        if (isset($_SESSION['glpi_uninstalllist'])) {
            PluginUninstallUninstall::uninstall($_REQUEST["device_type"], $_REQUEST["model_id"], $_SESSION['glpi_uninstalllist'], $location);
        }
        unset($_SESSION['glpi_uninstalllist']);
        Session::addMessageAfterRedirect(__('Uninstallation successful', 'uninstall'));
        Html::footer();
        $device_type = $_REQUEST["device_type"];
        Html::redirect($device_type::getSearchURL());
    } else {
        if (isset($_SESSION['glpi_uninstalllist'])) {
            PluginUninstallReplace::showForm($_REQUEST["device_type"], $_REQUEST["model_id"], $_SESSION['glpi_uninstalllist'], $location);
        }
        Html::footer();
    }
}
Esempio n. 2
0
 /**
  *
  * Get rights matrix for plugin
  *
  * @return array:array:string rights matrix
  */
 function getGeneralRights()
 {
     $rights = array(array('itemtype' => 'PluginUninstallProfile', 'label' => PluginUninstallUninstall::getTypeName(), 'field' => "uninstall:profile", 'rights' => array(READ => __('Read'), UPDATE => __('Write'), self::RIGHT_REPLACE => PluginUninstallReplace::getTypeName())));
     return $rights;
 }