static function uninstall()
 {
     global $DB;
     $displayPreference = new DisplayPreference();
     $displayPreference->deleteByCriteria(array('itemtype' => __CLASS__));
     $table = getTableForItemType(__CLASS__);
     $DB->query("DROP TABLE IF EXISTS `{$table}`");
 }
예제 #2
0
 static function uninstall()
 {
     global $DB;
     $displayPreference = new DisplayPreference();
     $displayPreference->deleteByCriteria(array('itemtype' => __CLASS__));
     // Remove dropdowns localization
     $dropdownTranslation = new DropdownTranslation();
     $dropdownTranslation->deleteByCriteria(array("itemtype = 'PluginSimcardSimcardSize'"), 1);
     $table = getTableForItemType(__CLASS__);
     $DB->query("DROP TABLE IF EXISTS `{$table}`");
 }
*/
/** @file
* @brief
*/
if (!defined('GLPI_ROOT')) {
    include '../inc/includes.php';
}
Html::popHeader(__('Setup'), $_SERVER['PHP_SELF']);
Session::haveRightsOr('serach_config', array(DisplayPreference::PERSONAL, DisplayPreference::GENERAL));
$setupdisplay = new DisplayPreference();
if (isset($_POST["activate"])) {
    $setupdisplay->activatePerso($_POST);
} else {
    if (isset($_POST["disable"])) {
        if ($_POST['users_id'] == Session::getLoginUserID()) {
            $setupdisplay->deleteByCriteria(array('users_id' => $_POST['users_id'], 'itemtype' => $_POST['itemtype']));
        }
    } else {
        if (isset($_POST["add"])) {
            $setupdisplay->add($_POST);
        } else {
            if (isset($_POST["purge"]) || isset($_POST["purge_x"])) {
                $setupdisplay->delete($_POST, 1);
            } else {
                if (isset($_POST["up"]) || isset($_POST["up_x"])) {
                    $setupdisplay->orderItem($_POST, 'up');
                } else {
                    if (isset($_POST["down"]) || isset($_POST["down_x"])) {
                        $setupdisplay->orderItem($_POST, 'down');
                    }
                }
예제 #4
0
 /**
  * Delete object type table + entries in glpi_display
  * @name object type's name
  * @return nothing
  */
 public static function deleteTable($itemtype)
 {
     global $DB;
     $preferences = new DisplayPreference();
     $preferences->deleteByCriteria(array("itemtype" => $itemtype));
     $DB->query("DROP TABLE IF EXISTS `" . getTableForItemType($itemtype) . "`");
 }
예제 #5
0
 /**
  * 
  *
  * 
  **/
 static function uninstall()
 {
     global $DB;
     $displayPreference = new DisplayPreference();
     $displayPreference->deleteByCriteria(array("`num` >= " . self::RESERVED_TYPE_RANGE_MIN . " AND `num` <= " . self::RESERVED_TYPE_RANGE_MAX));
     $table = getTableForItemType(__CLASS__);
     $query = "DROP TABLE IF EXISTS `" . $table . "`";
     $DB->query($query) or die($DB->error());
 }
 static function deleteDisplayPreferences($table, $field)
 {
     $pref = new DisplayPreference();
     $itemtype = getItemTypeForTable($table);
     $searchopt = Search::getCleanedOptions($itemtype);
     foreach ($searchopt as $num => $option) {
         if (isset($option['field']) && $option['field'] == $field || isset($option['field']) && $option['linkfield'] == $field) {
             $criteria = array('itemtype' => $itemtype, 'num' => $num);
             $pref->deleteByCriteria($criteria);
             break;
         }
     }
 }
    if (isset($_POST["add"])) {
        $setupdisplay->add($_POST);
    } else {
        if (isset($_POST["delete"]) || isset($_POST["delete_x"])) {
            $setupdisplay->delete($_POST);
        } else {
            if (isset($_POST["up"]) || isset($_POST["up_x"])) {
                $setupdisplay->orderItem($_POST, 'up');
            } else {
                if (isset($_POST["down"]) || isset($_POST["down_x"])) {
                    $setupdisplay->orderItem($_POST, 'down');
                } else {
                    if (isset($_POST['delete_for_user'])) {
                        foreach ($_POST['itemtype'] as $itemtype => $val) {
                            $crit = array('users_id' => $_POST['users_id'], 'itemtype' => $itemtype);
                            $setupdisplay->deleteByCriteria($crit);
                        }
                        glpi_header($_SERVER['HTTP_REFERER']);
                    }
                }
            }
        }
    }
}
if (strpos($_SERVER['PHP_SELF'], "popup") && $_REQUEST["itemtype"]) {
    $tabs[1] = array('title' => $LANG['central'][13], 'url' => $CFG_GLPI['root_doc'] . "/ajax/displaypreference.tabs.php", 'params' => "target=" . $_SERVER['PHP_SELF'] . "&id=-1&glpi_tab=1&itemtype=" . "display&displaytype=" . $_REQUEST["itemtype"]);
    $tabs[2] = array('title' => $LANG['central'][12], 'url' => $CFG_GLPI['root_doc'] . "/ajax/displaypreference.tabs.php", 'params' => "target=" . $_SERVER['PHP_SELF'] . "&id=-1&glpi_tab=2&itemtype=" . "display&displaytype=" . $_REQUEST["itemtype"]);
    echo "<div id='tabspanel' class='center-h'></div>";
    createAjaxTabs('tabspanel', 'tabcontent', $tabs, 'DisplayPreference');
    echo "<div id='tabcontent'>&nbsp;</div>";
    echo "<script type='text/javascript'>loadDefaultTab();</script>";