function plugin_treeview_install() { global $DB; // version 1.0 if (TableExists("glpi_plugin_treeview_display") && !TableExists("glpi_plugin_treeview_preference")) { plugin_treeview_upgrade10to11(); } // version 1.1 if (TableExists("glpi_plugin_treeview_profiles") && FieldExists("glpi_plugin_treeview_profiles", "interface")) { plugin_treeview_upgrade11to12(); } // version 1.2 if (!TableExists("glpi_plugin_treeview_displayprefs") && TableExists("glpi_plugin_treeview_profiles")) { plugin_treeview_upgrade12to13(); } // version 1.3 if (TableExists("glpi_plugin_treeview_preferences")) { plugin_treeview_upgrade13to14(); } // not installed if (!TableExists("glpi_plugin_treeview_configs")) { $query = "CREATE TABLE IF NOT EXISTS `glpi_plugin_treeview_configs` (\n `id` int(11) NOT NULL auto_increment,\n `target` varchar(255) NOT NULL default 'right',\n `folderLinks` tinyint(1) NOT NULL default '0',\n `useSelection` tinyint(1) NOT NULL default '0',\n `useLines` tinyint(1) NOT NULL default '0',\n `useIcons` tinyint(1) NOT NULL default '0',\n `closeSameLevel` tinyint(1) NOT NULL default '0',\n `itemName` int(11) NOT NULL default '0',\n `locationName` int(11) NOT NULL default '0',\n PRIMARY KEY (`id`)\n ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci "; $DB->query($query) or die($DB->error()); $query = "INSERT INTO `glpi_plugin_treeview_configs`\n (`id`, `target`, `folderLinks`, `useSelection`, `useLines`, `useIcons`,\n `closeSameLevel`, `itemName`, `locationName`)\n VALUES ('1','right','1','1','1','1','0', '3', '2');"; $DB->query($query) or die($DB->error()); $query = "CREATE TABLE IF NOT EXISTS `glpi_plugin_treeview_profiles` (\n `id` int(11) NOT NULL auto_increment,\n `name` varchar(255) collate utf8_unicode_ci default NULL,\n `treeview` char(1) collate utf8_unicode_ci default NULL,\n PRIMARY KEY (`id`),\n KEY `name` (`name`)\n ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci "; $DB->query($query) or die($DB->error()); $query = "CREATE TABLE IF NOT EXISTS `glpi_plugin_treeview_preferences` (\n `id` int(11) NOT NULL auto_increment,\n `users_id` int(11) NOT NULL default '0' COMMENT 'RELATION to glpi_users (id)',\n `show_on_load` int(11) NOT NULL default '0',\n PRIMARY KEY (`id`)\n ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci "; $DB->query($query) or die($DB->error()); } // No autoload when plugin is not activated require 'inc/profile.class.php'; PluginTreeviewProfile::createFirstAccess($_SESSION['glpiactiveprofile']['id']); return true; }
function getTabNameForItem(CommonGLPI $item, $withtemplate = 0) { if ($item->getType() == 'Profile' && $item->getField('interface') != 'helpdesk') { return PluginTreeviewProfile::getTypeName(2); } return ''; }
function plugin_treeview_install() { global $DB; // not installed if (!TableExists("glpi_plugin_treeview_configs")) { $query = "CREATE TABLE IF NOT EXISTS `glpi_plugin_treeview_configs` (\n `id` int(11) NOT NULL auto_increment,\n `target` varchar(255) NOT NULL default 'right',\n `folderLinks` tinyint(1) NOT NULL default '0',\n `useSelection` tinyint(1) NOT NULL default '0',\n `useLines` tinyint(1) NOT NULL default '0',\n `useIcons` tinyint(1) NOT NULL default '0',\n `closeSameLevel` tinyint(1) NOT NULL default '0',\n `itemName` int(11) NOT NULL default '0',\n `locationName` int(11) NOT NULL default '0',\n PRIMARY KEY (`id`)\n ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci "; $DB->query($query) or die($DB->error()); $query = "INSERT INTO `glpi_plugin_treeview_configs`\n (`id`, `target`, `folderLinks`, `useSelection`, `useLines`, `useIcons`,\n `closeSameLevel`, `itemName`, `locationName`)\n VALUES ('1','right','1','1','1','1','0', '3', '2');"; $DB->query($query) or die($DB->error()); $query = "CREATE TABLE IF NOT EXISTS `glpi_plugin_treeview_preferences` (\n `id` int(11) NOT NULL auto_increment,\n `users_id` int(11) NOT NULL default '0' COMMENT 'RELATION to glpi_users (id)',\n `show_on_load` int(11) NOT NULL default '0',\n PRIMARY KEY (`id`)\n ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci "; $DB->query($query) or die($DB->error()); } include_once GLPI_ROOT . "/plugins/treeview/inc/profile.class.php"; PluginTreeviewProfile::initProfile(); PluginTreeviewProfile::createfirstAccess($_SESSION['glpiactiveprofile']['id']); return true; }
treeview - TreeView browser plugin for GLPI Copyright (C) 2003-2012 by the treeview Development Team. https://forge.indepnet.net/projects/treeview ------------------------------------------------------------------------- LICENSE This file is part of treeview. treeview 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. treeview 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 treeview. If not, see <http://www.gnu.org/licenses/>. -------------------------------------------------------------------------- */ include '../../../inc/includes.php'; Session::checkRight("profile", "r"); $prof = new PluginTreeviewProfile(); if (isset($_POST['update_user_profile'])) { $prof->update($_POST); Html::back(); }