function plugin_fields_checkFiles() { $plugin = new Plugin(); if (isset($_SESSION['glpiactiveentities']) && $plugin->isInstalled('fields') && $plugin->isActivated('fields')) { Plugin::registerClass('PluginFieldsContainer'); Plugin::registerClass('PluginFieldsDropdown'); Plugin::registerClass('PluginFieldsField'); if (TableExists("glpi_plugin_fields_containers")) { $container_obj = new PluginFieldsContainer(); $containers = $container_obj->find(); foreach ($containers as $container) { $classname = "PluginFields" . ucfirst($container['itemtype'] . preg_replace('/s$/', '', $container['name'])); if (!class_exists($classname)) { PluginFieldsContainer::generateTemplate($container); } } } if (TableExists("glpi_plugin_fields_fields")) { $fields_obj = new PluginFieldsField(); $fields = $fields_obj->find("`type` = 'dropdown'"); foreach ($fields as $field) { PluginFieldsDropdown::create($field); } } } }
/** * Initialize the plugin's hooks */ function plugin_init_customfields() { global $PLUGIN_HOOKS, $DB, $ACTIVE_CUSTOMFIELDS_TYPES, $ALL_CUSTOMFIELDS_TYPES; $PLUGIN_HOOKS['csrf_compliant']['customfields'] = true; $PLUGIN_HOOKS['change_profile']['customfields'] = array('PluginCustomfieldsProfile', 'changeprofile'); // Register classes Plugin::registerClass('PluginCustomfieldsDropdowns'); Plugin::registerClass('PluginCustomfieldsFields'); if (isset($_SESSION['glpiID'])) { $plugin = new Plugin(); if ($plugin->isInstalled("customfields") && $plugin->isActivated("customfields")) { // enable a tab for reading / setting access rights for the plugin Plugin::registerClass('PluginCustomfieldsProfile', array('addtabon' => 'Profile')); // Display a menu entry in the main menu if the user has // configuration rights if (Session::haveRight('config', UPDATE)) { // $PLUGIN_HOOKS['menu_entry']['customfields'] = true; $PLUGIN_HOOKS["menu_toadd"]['customfields'] = array('plugins' => 'PluginCustomfieldsConfig'); } // initiate empty dropdowns $PLUGIN_HOOKS['item_empty']['customfields'] = array('PluginCustomfieldsDropdownsItem' => 'PluginCustomfieldsDropdownsItem::item_empty'); } // Indicate where the configuration page can be found if (Session::haveRight('config', UPDATE)) { $PLUGIN_HOOKS['config_page']['customfields'] = 'front/config.form.php'; } // Hook for initialization after initialization of all other plugins $PLUGIN_HOOKS['post_init']['customfields'] = 'plugin_customfields_postinit'; } }
function plugin_init_escalade() { global $PLUGIN_HOOKS; $PLUGIN_HOOKS['csrf_compliant']['escalade'] = true; $plugin = new Plugin(); if (isset($_SESSION['glpiID']) && $plugin->isInstalled('escalade') && $plugin->isActivated('escalade')) { //load config in session if (TableExists("glpi_plugin_escalade_configs")) { PluginEscaladeConfig::loadInSession(); // == Load js scripts == if (isset($_SESSION['plugins']['escalade']['config'])) { $escalade_config = $_SESSION['plugins']['escalade']['config']; $PLUGIN_HOOKS['add_javascript']['escalade'][] = 'scripts/function.js'; // on central page if (strpos($_SERVER['REQUEST_URI'], "central.php") !== false) { //history and climb feature if ($escalade_config['show_history']) { $PLUGIN_HOOKS['add_javascript']['escalade'][] = 'scripts/central.js.php'; } } // on ticket page (in edition) if (strpos($_SERVER['REQUEST_URI'], "ticket.form.php") !== false && isset($_GET['id'])) { //history and climb feature if ($escalade_config['show_history']) { $PLUGIN_HOOKS['add_javascript']['escalade'][] = 'scripts/escalade.js.php'; } //remove btn feature if (!$escalade_config['remove_delete_group_btn'] || !$escalade_config['remove_delete_user_btn']) { $PLUGIN_HOOKS['add_javascript']['escalade'][] = 'scripts/remove_btn.js.php'; } //clone ticket feature if ($escalade_config['cloneandlink_ticket']) { $PLUGIN_HOOKS['add_javascript']['escalade'][] = 'scripts/cloneandlink_ticket.js.php'; } //filter group feature if ($escalade_config['use_filter_assign_group']) { $PLUGIN_HOOKS['add_javascript']['escalade'][] = 'scripts/filtergroup.js.php'; } } Plugin::registerClass('PluginEscaladeGroup_Group', array('addtabon' => 'Group')); Plugin::registerClass('PluginEscaladeUser', array('addtabon' => array('User'))); } } $PLUGIN_HOOKS['add_css']['escalade'][] = 'escalade.css'; // == Ticket modifications $PLUGIN_HOOKS['item_update']['escalade'] = array('Ticket' => 'plugin_escalade_item_update'); $PLUGIN_HOOKS['item_add']['escalade'] = array('Group_Ticket' => 'plugin_escalade_item_add_group_ticket', 'Ticket_User' => 'plugin_escalade_item_add_user', 'Ticket' => 'plugin_escalade_item_add_ticket'); $PLUGIN_HOOKS['pre_item_add']['escalade'] = array('Group_Ticket' => 'plugin_escalade_pre_item_add_group_ticket', 'Ticket' => 'plugin_escalade_pre_item_add_ticket'); $PLUGIN_HOOKS['post_prepareadd']['escalade'] = array('Ticket' => 'plugin_escalade_post_prepareadd_ticket'); $PLUGIN_HOOKS['item_purge']['escalade'] = array('User' => 'plugin_escalade_item_purge'); $PLUGIN_HOOKS['item_add']['escalade']['User'] = '******'; // == Interface links == if (Session::haveRight('config', UPDATE)) { $PLUGIN_HOOKS['config_page']['escalade'] = 'front/config.form.php'; } $PLUGIN_HOOKS['use_massive_action']['escalade'] = 1; } }
/** * Initialize all classes and generic variables of the plugin */ function plugin_init_formcreator() { global $PLUGIN_HOOKS; // Set the plugin CSRF compliance (required since GLPI 0.84) $PLUGIN_HOOKS['csrf_compliant']['formcreator'] = true; $plugin = new Plugin(); if (isset($_SESSION['glpiID']) && $plugin->isInstalled('formcreator') && $plugin->isActivated('formcreator')) { // Massive Action definition $PLUGIN_HOOKS['use_massive_action']['formcreator'] = 1; // If user have acces to one form or more, add link $form_table = getTableForItemType('PluginFormcreatorForm'); $table_fp = getTableForItemType('PluginFormcreatorFormprofiles'); $where = getEntitiesRestrictRequest("", $form_table, "", "", true, false); $query = "SELECT COUNT({$form_table}.id)\n FROM {$form_table}\n WHERE {$form_table}.`is_active` = 1\n AND {$form_table}.`is_deleted` = 0\n AND {$form_table}.`helpdesk_home` = 1\n AND ({$form_table}.`language` = '{$_SESSION['glpilanguage']}' OR {$form_table}.`language` = '')\n AND {$where}\n AND ({$form_table}.`access_rights` != " . PluginFormcreatorForm::ACCESS_RESTRICTED . " OR {$form_table}.`id` IN (\n SELECT plugin_formcreator_forms_id\n FROM {$table_fp}\n WHERE plugin_formcreator_profiles_id = " . (int) $_SESSION['glpiactiveprofile']['id'] . "))"; $result = $GLOBALS['DB']->query($query); list($nb) = $GLOBALS['DB']->fetch_array($result); if ($nb > 0) { $PLUGIN_HOOKS['menu_toadd']['formcreator']['helpdesk'] = 'PluginFormcreatorFormlist'; } if (strpos($_SERVER['REQUEST_URI'], "plugins/formcreator") !== false || strpos($_SERVER['REQUEST_URI'], "central.php") !== false || isset($_SESSION['glpiactiveprofile']) && $_SESSION['glpiactiveprofile']['interface'] == 'helpdesk') { // Add specific CSS $PLUGIN_HOOKS['add_css']['formcreator'][] = "css/styles.css"; $PLUGIN_HOOKS['add_css']['formcreator'][] = 'lib/pqselect/pqselect.min.css'; $PLUGIN_HOOKS['add_javascript']['formcreator'][] = 'lib/pqselect/pqselect.min.js'; // Add specific JavaScript $PLUGIN_HOOKS['add_javascript']['formcreator'][] = 'scripts/forms-validation.js.php'; $PLUGIN_HOOKS['add_javascript']['formcreator'][] = 'scripts/scripts.js.php'; } // Add a link in the main menu plugins for technician and admin panel $PLUGIN_HOOKS['menu_entry']['formcreator'] = 'front/formlist.php'; // Config page $plugin = new Plugin(); $links = array(); if (Session::haveRight('entity', UPDATE)) { $PLUGIN_HOOKS['config_page']['formcreator'] = 'front/form.php'; $PLUGIN_HOOKS['menu_toadd']['formcreator']['admin'] = 'PluginFormcreatorForm'; $links['config'] = '/plugins/formcreator/front/form.php'; $links['add'] = '/plugins/formcreator/front/form.form.php'; } $img = '<img src="' . $GLOBALS['CFG_GLPI']['root_doc'] . '/plugins/formcreator/pics/check.png" title="' . __('Forms waiting for validation', 'formcreator') . '" alt="Waiting forms list" />'; $links[$img] = '/plugins/formcreator/front/formanswer.php'; // Set options for pages (title, links, buttons...) $links['search'] = '/plugins/formcreator/front/formlist.php'; $PLUGIN_HOOKS['submenu_entry']['formcreator']['options'] = array('config' => array('title' => __('Setup'), 'page' => '/plugins/formcreator/front/form.php', 'links' => $links), 'options' => array('title' => _n('Form', 'Forms', 2, 'formcreator'), 'links' => $links)); // Load field class and all its method to manage fields Plugin::registerClass('PluginFormcreatorFields'); // Notification Plugin::registerClass('PluginFormcreatorFormanswer', array('notificationtemplates_types' => true)); if ($_SESSION['glpi_use_mode'] == Session::DEBUG_MODE && isset($_SESSION['glpimenu'])) { unset($_SESSION['glpimenu']); } } }
function plugin_init_purgelogs() { global $PLUGIN_HOOKS, $CFG_GLPI; $PLUGIN_HOOKS['csrf_compliant']['purgelogs'] = true; $plugin = new Plugin(); if ($plugin->isInstalled('purgelogs') && $plugin->isActivated('purgelogs')) { //if glpi is loaded if (Session::getLoginUserID() && Session::haveRight("config", UPDATE)) { $PLUGIN_HOOKS['config_page']['purgelogs'] = 'front/config.form.php'; } } }
function plugin_init_simcard() { global $PLUGIN_HOOKS, $CFG_GLPI, $LANG; $PLUGIN_HOOKS['csrf_compliant']['simcard'] = true; $plugin = new Plugin(); if ($plugin->isInstalled('simcard') && $plugin->isActivated('simcard')) { //load changeprofile function $PLUGIN_HOOKS['change_profile']['simcard'] = array('PluginSimcardProfile', 'changeProfile'); $PLUGIN_HOOKS['assign_to_ticket']['simcard'] = true; $PLUGIN_HOOKS['pre_item_purge']['simcard'] = array('Profile' => array('PluginSimcardsProfile', 'purgeProfiles')); $PLUGIN_HOOKS['plugin_datainjection_populate']['simcard'] = 'plugin_datainjection_populate_simcard'; $PLUGIN_HOOKS['item_purge']['simcard'] = array(); foreach (PluginSimcardSimcard_Item::getClasses() as $type) { $PLUGIN_HOOKS['item_purge']['simcard'][$type] = 'plugin_item_purge_simcard'; } Plugin::registerClass('PluginSimcardSimcard_Item', array('addtabon' => PluginSimcardSimcard_Item::getClasses())); Plugin::registerClass('PluginSimcardProfile', array('addtabon' => 'Profile')); // Params : plugin name - string type - number - class - table - form page Plugin::registerClass('PluginSimcardSimcard', array('linkgroup_types' => true, 'linkuser_types' => true, 'document_types' => true, 'contract_types' => true, 'ticket_types' => true, 'helpdesk_visible_types' => true, 'infocom_types' => true, 'unicity_types' => true, 'reservation_types' => true)); array_push($CFG_GLPI['state_types'], 'PluginSimcardSimcard'); //if glpi is loaded if (Session::getLoginUserID()) { // Display a menu entry ? //if (Session::haveRight("simcard", "r")) { if (PluginSimcardSimcard::canCreate() || PluginSimcardSimcard::canUpdate() || PluginSimcardSimcard::canDelete() || PluginSimcardSimcard::canView()) { //menu entry //$PLUGIN_HOOKS['menu_entry']['simcard'] = 'front/simcard.php'; $PLUGIN_HOOKS['menu_toadd']['simcard'] = array('assets' => 'PluginSimcardSimcard'); //search link //$PLUGIN_HOOKS['submenu_entry']['simcard']['options']['simcard']['links']['search'] // = '/plugins/simcard/front/simcard.php'; //add simcard to items details $PLUGIN_HOOKS['headings']['simcard'] = 'plugin_get_headings_simcard'; $PLUGIN_HOOKS['headings_action']['simcard'] = 'plugin_headings_actions_simcard'; $PLUGIN_HOOKS['headings_actionpdf']['simcard'] = 'plugin_headings_actionpdf_simcard'; } //if (Session::haveRight("simcard", "w")) { if (PluginSimcardSimcard::canCreate()) { //add link // $PLUGIN_HOOKS['submenu_entry']['simcard']['options']['simcard']['links']['add'] // = '/front/setup.templates.php?itemtype=PluginSimcardSimcard&add=1'; // $PLUGIN_HOOKS['submenu_entry']['simcard']['options']['simcard']['links']['template'] // = '/front/setup.templates.php?itemtype=PluginSimcardSimcard&add=0'; //use massiveaction in the plugin $PLUGIN_HOOKS['use_massive_action']['simcard'] = 1; } // Import from Data_Injection plugin $PLUGIN_HOOKS['migratetypes']['simcard'] = 'plugin_datainjection_migratetypes_simcard'; $PLUGIN_HOOKS['menu']['simcard'] = true; $PLUGIN_HOOKS['post_init']['simcard'] = 'plugin_simcard_postinit'; } } }
function plugin_init_escalade() { global $PLUGIN_HOOKS; $PLUGIN_HOOKS['csrf_compliant']['escalade'] = true; $plugin = new Plugin(); if (isset($_SESSION['glpiID']) && $plugin->isInstalled('escalade') && $plugin->isActivated('escalade')) { //load config in session if (TableExists("glpi_plugin_escalade_configs")) { PluginEscaladeConfig::loadInSession(); // == Load js scripts == if (isset($_SESSION['plugins']['escalade']['config'])) { if (strpos($_SERVER['REQUEST_URI'], "ticket.form.php") !== false || strpos($_SERVER['REQUEST_URI'], "central.php") !== false) { //history and climb feature if ($_SESSION['plugins']['escalade']['config']['show_history'] == true && $_SESSION['plugins']['escalade']['config']['remove_group'] == true) { $PLUGIN_HOOKS['add_javascript']['escalade'][] = 'scripts/escalade.js.php'; } } if (strpos($_SERVER['REQUEST_URI'], "ticket.form.php") !== false) { //remove btn feature $PLUGIN_HOOKS['add_javascript']['escalade'][] = 'scripts/remove_btn.js.php'; //clone ticket feature if ($_SESSION['plugins']['escalade']['config']['cloneandlink_ticket'] == true) { $PLUGIN_HOOKS['add_javascript']['escalade'][] = 'scripts/cloneandlink_ticket.js.php'; } //assign me feature if ($_SESSION['plugins']['escalade']['config']['assign_me_ticket'] == true) { $PLUGIN_HOOKS['add_javascript']['escalade'][] = 'scripts/assign_me.js.php'; } //filter group feature if ($_SESSION['plugins']['escalade']['config']['use_filter_assign_group'] == true) { $PLUGIN_HOOKS['add_javascript']['escalade'][] = 'scripts/filtergroup.js.php'; } } Plugin::registerClass('PluginEscaladeGroup_Group', array('addtabon' => 'Group')); } } $PLUGIN_HOOKS['add_css']['escalade'][] = 'style.css'; // == Ticket modifications $PLUGIN_HOOKS['item_update']['escalade'] = array('Ticket' => 'plugin_escalade_item_update'); $PLUGIN_HOOKS['item_add']['escalade'] = array('Group_Ticket' => 'plugin_escalade_item_add_group_ticket', 'Ticket_User' => 'plugin_escalade_item_add_user', 'Ticket' => 'plugin_escalade_item_add_ticket'); $PLUGIN_HOOKS['pre_item_add']['escalade'] = array('Group_Ticket' => 'plugin_escalade_pre_item_add_group_ticket', 'Ticket' => 'plugin_escalade_pre_item_add_ticket'); $PLUGIN_HOOKS['post_prepareadd']['escalade'] = array('Ticket' => 'plugin_escalade_post_prepareadd_ticket'); // == Interface links == if (Session::haveRight('config', 'w')) { $config_page = 'front/config.form.php'; $PLUGIN_HOOKS['config_page']['escalade'] = $config_page; $PLUGIN_HOOKS['submenu_entry']['escalade']['config'] = $config_page; $PLUGIN_HOOKS['submenu_entry']['escalade']['options']['config']['links']['config'] = '/plugins/escalade/' . $config_page; } } }
function plugin_init_news() { global $PLUGIN_HOOKS; $PLUGIN_HOOKS['csrf_compliant']['news'] = true; $PLUGIN_HOOKS['add_javascript']['news'] = 'scripts/alert.php'; $PLUGIN_HOOKS['add_css']['news'] = 'css/styles.css'; $PLUGIN_HOOKS['change_profile']['news'] = array('PluginNewsProfile', 'changeProfile'); Plugin::registerClass('PluginNewsProfile', array('addtabon' => 'Profile')); $plugin = new Plugin(); if (isset($_SESSION['glpiID']) && $plugin->isInstalled('news') && $plugin->isActivated('news')) { if (Session::haveRight('plugin_news', READ)) { $PLUGIN_HOOKS['menu_toadd']['news'] = array('tools' => 'PluginNewsAlert'); } } }
function plugin_init_moreldap() { global $PLUGIN_HOOKS, $CFG_GLPI, $LANG; $PLUGIN_HOOKS['csrf_compliant']['moreldap'] = true; $plugin = new Plugin(); if ($plugin->isInstalled("moreldap") && $plugin->isActivated("moreldap")) { //Add a tab on AuthLDAP items Plugin::registerClass('PluginMoreldapAuthLDAP', array('addtabon' => 'AuthLDAP')); // request more attributes from LDAP // $PLUGIN_HOOKS['retrieve_more_field_from_ldap']['moreldap'] = "plugin_retrieve_more_field_from_ldap_moreldap"; // Retrieve others datas from LDAP $PLUGIN_HOOKS['item_add']['moreldap'] = array('User' => 'plugin_moreldap_item_add_or_update_user'); $PLUGIN_HOOKS['item_update']['moreldap'] = array('User' => 'plugin_moreldap_item_add_or_update_user'); } }
function plugin_init_geninventorynumber() { global $PLUGIN_HOOKS, $CFG_GLPI, $GENINVENTORYNUMBER_TYPES; $PLUGIN_HOOKS['csrf_compliant']['geninventorynumber'] = true; $PLUGIN_HOOKS['post_init']['geninventorynumber'] = 'plugin_geninventorynumber_postinit'; $GENINVENTORYNUMBER_TYPES = array('Computer', 'Monitor', 'Printer', 'NetworkEquipment', 'Peripheral', 'Phone', 'SoftwareLicense'); $plugin = new Plugin(); if ($plugin->isInstalled('geninventorynumber') && $plugin->isActivated('geninventorynumber') && Session::haveRight("config", CREATE)) { $PLUGIN_HOOKS['use_massive_action']['geninventorynumber'] = 1; Plugin::registerClass('PluginGeninventorynumberProfile', array('addtabon' => array('Profile'))); Plugin::registerClass('PluginGeninventorynumberConfig'); Plugin::registerClass('PluginGeninventorynumberConfigField'); if (Session::haveRight('config', UPDATE)) { $PLUGIN_HOOKS["menu_toadd"]['geninventorynumber'] = array('tools' => 'PluginGeninventorynumberConfig'); } } }
/** * Initialize the plugin's hooks */ function plugin_init_customfields() { global $PLUGIN_HOOKS, $DB, $ACTIVE_CUSTOMFIELDS_TYPES, $ALL_CUSTOMFIELDS_TYPES; $PLUGIN_HOOKS['csrf_compliant']['customfields'] = true; $PLUGIN_HOOKS['change_profile']['customfields'] = array('PluginCustomfieldsProfile', 'changeprofile'); // Register classes Plugin::registerClass('PluginCustomfieldsDropdowns'); Plugin::registerClass('PluginCustomfieldsFields'); if (isset($_SESSION['glpiID'])) { $plugin = new Plugin(); if ($plugin->isInstalled("customfields") && $plugin->isActivated("customfields")) { // enable a tab for reading / setting access rights for the plugin Plugin::registerClass('PluginCustomfieldsProfile', array('addtabon' => 'Profile')); include_once 'inc/virtual_classes.php'; $query = "SELECT `itemtype`, `enabled`\r\n FROM `glpi_plugin_customfields_itemtypes`\r\n WHERE `itemtype` <> 'Version'"; $result = $DB->query($query); while ($data = $DB->fetch_assoc($result)) { $ALL_CUSTOMFIELDS_TYPES[] = $data['itemtype']; if ($data['enabled']) { $ACTIVE_CUSTOMFIELDS_TYPES[] = $data['itemtype']; Plugin::registerClass('PluginCustomfields' . $data['itemtype'], array('addtabon' => array($data['itemtype']))); } } // Display a menu entry in the main menu if the user has // configuration rights if (Session::haveRight('config', 'w')) { $PLUGIN_HOOKS['menu_entry']['customfields'] = true; } // Hooks for add item, update item (for active types) foreach ($ACTIVE_CUSTOMFIELDS_TYPES as $type) { $PLUGIN_HOOKS['item_add']['customfields'][$type] = 'plugin_item_add_customfields'; $PLUGIN_HOOKS['pre_item_update']['customfields'][$type] = 'plugin_pre_item_update_customfields'; } // Hooks for purge item foreach ($ALL_CUSTOMFIELDS_TYPES as $type) { $PLUGIN_HOOKS['item_purge']['customfields'][$type] = 'plugin_item_purge_customfields'; } // initiate empty dropdowns $PLUGIN_HOOKS['item_empty']['customfields'] = array('PluginCustomfieldsDropdownsItem' => 'PluginCustomfieldsDropdownsItem::item_empty'); } // Indicate where the configuration page can be found if (Session::haveRight('config', 'w')) { $PLUGIN_HOOKS['config_page']['customfields'] = 'front/config.form.php'; } } }
/** * Initialize all classes and generic variables of the plugin */ function plugin_init_formcreator() { global $PLUGIN_HOOKS; // Set the plugin CSRF compliance (required since GLPI 0.84) $PLUGIN_HOOKS['csrf_compliant']['formcreator'] = true; $plugin = new Plugin(); if (isset($_SESSION['glpiID']) && $plugin->isInstalled('formcreator') && $plugin->isActivated('formcreator')) { // Massive Action definition $PLUGIN_HOOKS['use_massive_action']['formcreator'] = 1; $PLUGIN_HOOKS['menu_toadd']['formcreator'] = array('admin' => 'PluginFormcreatorForm', 'helpdesk' => 'PluginFormcreatorFormlist'); if (strpos($_SERVER['REQUEST_URI'], "plugins/formcreator") !== false || strpos($_SERVER['REQUEST_URI'], "central.php") !== false || isset($_SESSION['glpiactiveprofile']) && $_SESSION['glpiactiveprofile']['interface'] == 'helpdesk') { // Add specific CSS $PLUGIN_HOOKS['add_css']['formcreator'][] = "css/styles.css"; $PLUGIN_HOOKS['add_css']['formcreator'][] = 'lib/pqselect/pqselect.min.css'; $PLUGIN_HOOKS['add_javascript']['formcreator'][] = 'lib/pqselect/pqselect.min.js'; // Add specific JavaScript $PLUGIN_HOOKS['add_javascript']['formcreator'][] = 'scripts/forms-validation.js.php'; //$PLUGIN_HOOKS['add_javascript']['formcreator'][] = 'scripts/scripts.js.php'; } // [CRI] : Add plugin_formcreator_postinit $PLUGIN_HOOKS['post_init']['formcreator'] = 'plugin_formcreator_postinit'; // Add a link in the main menu plugins for technician and admin panel $PLUGIN_HOOKS['menu_entry']['formcreator'] = 'front/formlist.php'; // Config page $plugin = new Plugin(); $links = array(); if (Session::haveRight('entity', UPDATE) && $plugin->isActivated("formcreator")) { $PLUGIN_HOOKS['config_page']['formcreator'] = 'front/form.php'; $links['config'] = '/plugins/formcreator/front/form.php'; $links['add'] = '/plugins/formcreator/front/form.form.php'; } $img = '<img src="' . $GLOBALS['CFG_GLPI']['root_doc'] . '/plugins/formcreator/pics/check.png" title="' . __('Forms waiting for validation', 'formcreator') . '" alt="Waiting forms list" />'; $links[$img] = '/plugins/formcreator/front/formanswer.php'; // Set options for pages (title, links, buttons...) $links['search'] = '/plugins/formcreator/front/formlist.php'; $PLUGIN_HOOKS['submenu_entry']['formcreator']['options'] = array('config' => array('title' => __('Setup'), 'page' => '/plugins/formcreator/front/form.php', 'links' => $links), 'options' => array('title' => _n('Form', 'Forms', 2, 'formcreator'), 'links' => $links)); // Load field class and all its method to manage fields Plugin::registerClass('PluginFormcreatorFields'); // Notification Plugin::registerClass('PluginFormcreatorFormanswer', array('notificationtemplates_types' => true)); if ($_SESSION['glpi_use_mode'] == Session::DEBUG_MODE && isset($_SESSION['glpimenu'])) { unset($_SESSION['glpimenu']); } } }
function plugin_init_moreldap() { global $PLUGIN_HOOKS, $CFG_GLPI, $LANG; $PLUGIN_HOOKS['csrf_compliant']['moreldap'] = true; $plugin = new Plugin(); if ($plugin->isInstalled("moreldap") && $plugin->isActivated("moreldap")) { //Add a tab on AuthLDAP items Plugin::registerClass('PluginMoreldapAuthLDAP', array('addtabon' => 'AuthLDAP')); // request more attributes from LDAP $PLUGIN_HOOKS['retrieve_more_field_from_ldap']['moreldap'] = "plugin_retrieve_more_field_from_ldap_moreldap"; // Retrieve others datas from LDAP $PLUGIN_HOOKS['retrieve_more_data_from_ldap']['moreldap'] = "plugin_retrieve_more_data_from_ldap_moreldap"; // Indicate where the configuration page can be found if (Session::haveRight('config', 'w')) { $PLUGIN_HOOKS['config_page']['moreldap'] = 'front/authldap.php'; } } }
function plugin_init_tag() { global $PLUGIN_HOOKS; $PLUGIN_HOOKS['csrf_compliant']['tag'] = true; Plugin::registerClass('PluginTagTagItem', array('addtabon' => array('PluginTagTag'))); $plugin = new Plugin(); if ($plugin->isInstalled("tag") && $plugin->isActivated("tag")) { // add link on plugin name in Configuration > Plugin $PLUGIN_HOOKS['config_page']['tag'] = "front/tag.php"; $PLUGIN_HOOKS['add_javascript']['tag'][] = 'js/scripts.js'; } // only on itemtype form if (preg_match_all("/.*\\/(.*)\\.form\\.php/", $_SERVER['REQUEST_URI'], $matches) !== false) { if (strpos($_SERVER['REQUEST_URI'], "/front/dropdown.php") === false && strpos($_SERVER['REQUEST_URI'], ".form.php?") !== false && strpos($_SERVER['REQUEST_URI'], "id=-1") === false && strpos($_SERVER['REQUEST_URI'], "withtemplate=") === false && strpos($_SERVER['REQUEST_URI'], "?new=1") === false && strpos($_SERVER['REQUEST_URI'], "popup=1&rand=") === false && strpos($_SERVER['REQUEST_URI'], "/front/queuedmail") === false && strpos($_SERVER['REQUEST_URI'], "plugins/tag/front/tag.form.php") === false && strpos($_SERVER['REQUEST_URI'], "plugins/tag/front/tagtype") === false && strpos($_SERVER['REQUEST_URI'], "plugins/datainjection/front/model.form.php") === false && strpos($_SERVER['REQUEST_URI'], "plugins/webservices/front/client.form.php?new=1") === false && strpos($_SERVER['REQUEST_URI'], "plugins/printercounters/") === false && isset($_SESSION["glpiroot"]) && strpos($_SERVER['REQUEST_URI'], $_SESSION["glpiroot"] . "/front/reservation.form.php") === false && strpos($_SERVER['REQUEST_URI'], $_SESSION["glpiroot"] . "/front/config.form.php") === false) { //for ?forcetab=PluginBehaviorsConfig%241 if (Session::haveRight("itilcategory", READ)) { $PLUGIN_HOOKS['add_javascript']['tag'][] = 'js/show_tags.js'; } } if (isset($matches[1][0])) { $itemtype = $matches[1][0]; if (preg_match_all("/plugins\\/(.*)\\//U", $_SERVER['REQUEST_URI'], $matches_plugin) !== false) { if (isset($matches_plugin[1][0])) { $itemtype = "Plugin" . ucfirst($matches_plugin[1][0]) . ucfirst($itemtype); } } // stop on blaclisted itemtype if (in_array($itemtype, array_map('strtolower', getBlacklistItemtype()))) { return ''; } if (class_exists($itemtype)) { //normalize classname case $obj = new $itemtype(); $itemtype = get_class($obj); // Tag have no tag associated if ($itemtype != 'PluginTagTag') { $PLUGIN_HOOKS['pre_item_update']['tag'][$itemtype] = 'plugin_pre_item_update_tag'; $PLUGIN_HOOKS['pre_item_purge']['tag'][$itemtype] = 'plugin_pre_item_purge_tag'; } } } } }
function plugin_init_genericobject() { global $PLUGIN_HOOKS, $CFG_GLPI, $GO_BLACKLIST_FIELDS, $GO_FIELDS, $GENERICOBJECT_PDF_TYPES, $GO_LINKED_TYPES, $GO_READONLY_FIELDS; $GO_READONLY_FIELDS = array("is_helpdesk_visible", "comment"); $GO_BLACKLIST_FIELDS = array("itemtype", "table", "is_deleted", "id", "entities_id", "is_recursive", "is_template", "notepad", "template_name", "date_mod", "name", "is_helpdesk_visible", "comment"); $GO_LINKED_TYPES = array('Computer', 'Phone', 'Peripheral', 'Software', 'Monitor', 'Printer', 'NetworkEquipment'); $PLUGIN_HOOKS['csrf_compliant']['genericobject'] = true; $GENERICOBJECT_PDF_TYPES = array(); $plugin = new Plugin(); if ($plugin->isInstalled("genericobject") && $plugin->isActivated("genericobject")) { plugin_genericobject_includeCommonFields(); $PLUGIN_HOOKS['use_massive_action']['genericobject'] = 1; /* load changeprofile function */ $PLUGIN_HOOKS['change_profile']['genericobject'] = array('PluginGenericobjectProfile', 'changeProfile'); // Display a menu entry ? $PLUGIN_HOOKS['menu_entry']['genericobject'] = true; //Do not display icon if not using the genericobject plugin if (isset($_GET['id']) && $_GET['id'] != '' && strpos($_SERVER['REQUEST_URI'], Toolbox::getItemTypeFormURL("PluginGenericobjectType")) !== false) { $url = '/plugins/genericobject/index.php'; $type = new PluginGenericobjectType(); $type->getFromDB($_GET['id']); if ($type->fields['is_active']) { $url .= '?itemtypes_id=' . $_GET['id']; $image = "<img src='" . $CFG_GLPI["root_doc"] . "/pics/stats_item.png' title=\"" . __("Go to objects list", "genericobject") . "\" alt=\"" . __("Go to objects list", "genericobject") . "\">"; $PLUGIN_HOOKS['submenu_entry']['genericobject']['options']['type']['links'][$image] = $url; } } $PLUGIN_HOOKS['submenu_entry']['genericobject']['options']['type']['links']['add'] = Toolbox::getItemTypeFormURL('PluginGenericobjectType', false); $PLUGIN_HOOKS['submenu_entry']['genericobject']['options']['type']['links']['search'] = Toolbox::getItemTypeSearchURL('PluginGenericobjectType', false); // Config page if (Session::haveRight('config', 'w')) { $PLUGIN_HOOKS['submenu_entry']['genericobject']['config'] = 'front/type.php'; $PLUGIN_HOOKS['config_page']['genericobject'] = 'front/type.php'; $PLUGIN_HOOKS['submenu_entry']['genericobject']['add']['type'] = 'front/type.form.php'; $PLUGIN_HOOKS['submenu_entry']['genericobject']['search']['type'] = 'front/type.php'; } $PLUGIN_HOOKS['assign_to_ticket']['genericobject'] = true; $PLUGIN_HOOKS['use_massive_action']['genericobject'] = 1; $PLUGIN_HOOKS['post_init']['genericobject'] = 'plugin_post_init_genericobject'; $PLUGIN_HOOKS['plugin_datainjection_populate']['genericobject'] = "plugin_datainjection_populate_genericobject"; } }
function plugin_init_manufacturersimports() { global $PLUGIN_HOOKS, $CFG_GLPI; $PLUGIN_HOOKS['csrf_compliant']['manufacturersimports'] = true; $plugin = new Plugin(); if ($plugin->isInstalled('manufacturersimports') && Session::getLoginUserID()) { Plugin::registerClass('PluginManufacturersimportsProfile', array('addtabon' => 'Profile')); //Display menu entry only if user has right to see it ! if (Session::haveRight('plugin_manufacturersimports', READ)) { $PLUGIN_HOOKS["menu_toadd"]['manufacturersimports'] = array('tools' => 'PluginManufacturersimportsMenu'); } if (Session::haveRight('config', UPDATE)) { $PLUGIN_HOOKS['config_page']['manufacturersimports'] = 'front/config.php'; $PLUGIN_HOOKS['use_massive_action']['manufacturersimports'] = 1; } // End init, when all types are registered $PLUGIN_HOOKS['post_init']['manufacturersimports'] = 'plugin_manufacturersimports_postinit'; } // Add specific files to add to the header : javascript or css $PLUGIN_HOOKS['add_css']['manufacturersimports'] = array("manufacturersimports.css"); }
function plugin_init_mobile() { global $PLUGIN_HOOKS, $LANG; Plugin::registerClass('PluginMobileCommon'); $PLUGIN_HOOKS['csrf_compliant']['mobile'] = true; $PLUGIN_HOOKS['helpdesk_menu_entry']['mobile'] = false; $PLUGIN_HOOKS['config_page']['mobile'] = 'index.php'; $PLUGIN_HOOKS['menu_entry']['mobile'] = 'index.php'; $PLUGIN_HOOKS['headings']['mobile'] = 'plugin_get_headings_mobile'; $PLUGIN_HOOKS['headings_action']['mobile'] = 'plugin_headings_actions_mobile'; $PLUGIN_HOOKS['change_profile']['mobile'] = array('PluginMobileProfile', 'changeProfile'); $PLUGIN_HOOKS['redirect_page']['mobile'] = 'index.php'; $plug = new Plugin(); if ($plug->isInstalled('mobile') && $plug->isActivated('mobile')) { require_once GLPI_ROOT . "/plugins/mobile/inc/common.function.php"; checkParams(); if (isNavigatorMobile()) { redirectMobile(); } } }
function plugin_init_racks() { global $PLUGIN_HOOKS, $CFG_GLPI; $PLUGIN_HOOKS['csrf_compliant']['racks'] = true; //load changeprofile function $PLUGIN_HOOKS['change_profile']['racks'] = array('PluginRacksProfile', 'initProfile'); $plugin = new Plugin(); if ($plugin->isInstalled('racks') && $plugin->isActivated('racks')) { //Ability to add a rack to a project $CFG_GLPI["project_asset_types"][] = 'PluginRacksRack'; $PLUGIN_HOOKS['assign_to_ticket']['racks'] = true; Plugin::registerClass('PluginRacksRack', array('document_types' => true, 'location_types' => true, 'unicity_types' => true, 'linkgroup_tech_types' => true, 'linkuser_tech_types' => true, 'infocom_types' => true, 'ticket_types' => true)); Plugin::registerClass('PluginRacksProfile', array('addtabon' => 'Profile')); $types = array('PluginAppliancesAppliance', 'PluginManufacturersimportsConfig', 'PluginTreeviewConfig', 'PluginPositionsPosition'); foreach ($types as $itemtype) { if (class_exists($itemtype)) { $itemtype::registerType('PluginRacksRack'); } } //If treeview plugin is installed, add rack as a type of item //that can be shown in the tree if (class_exists('PluginTreeviewConfig')) { $PLUGIN_HOOKS['treeview']['PluginRacksRack'] = '../racks/pics/racks.png'; } if (Session::getLoginUserID()) { include_once GLPI_ROOT . "/plugins/racks/inc/rack.class.php"; if (PluginRacksRack::canView()) { //Display menu entry only if user has right to see it ! $PLUGIN_HOOKS["menu_toadd"]['racks'] = array('assets' => 'PluginRacksMenu'); $PLUGIN_HOOKS['use_massive_action']['racks'] = 1; } if (PluginRacksRack::canCreate() || Config::canUpdate()) { $PLUGIN_HOOKS['config_page']['racks'] = 'front/config.form.php'; } $PLUGIN_HOOKS['add_css']['racks'] = "racks.css"; $PLUGIN_HOOKS['post_init']['racks'] = 'plugin_racks_postinit'; $PLUGIN_HOOKS['reports']['racks'] = array('front/report.php' => __("Report - Bays management", "racks")); } } }
function plugin_init_itilcategorygroups() { global $PLUGIN_HOOKS; $PLUGIN_HOOKS['csrf_compliant']['itilcategorygroups'] = true; $plugin = new Plugin(); if ($plugin->isInstalled('itilcategorygroups') && $plugin->isActivated('itilcategorygroups')) { if (Session::haveRight('config', UPDATE)) { $PLUGIN_HOOKS['config_page']['itilcategorygroups'] = 'front/category.php'; } Plugin::registerClass('PluginItilcategorygroupsCategory', array('forwardentityfrom' => 'ITILCategory')); Plugin::registerClass('PluginItilcategorygroupsGroup_Level', array('addtabon' => 'Group')); if (Session::haveRight('config', READ)) { // add to 'Admin' menu : $PLUGIN_HOOKS["menu_toadd"]['itilcategorygroups'] = array('admin' => 'PluginItilcategorygroupsMenu'); // other hook : $PLUGIN_HOOKS['pre_item_update']['itilcategorygroups'] = array('Group' => 'plugin_pre_item_update_itilcategorygroups'); } if (Session::haveRight('config', UPDATE)) { $PLUGIN_HOOKS['submenu_entry']['itilcategorygroups']['options']['PluginItilcategorygroupsCategory']['links']['add'] = '/plugins/itilcategorygroups/front/category.form.php'; } $PLUGIN_HOOKS['add_javascript']['itilcategorygroups'] = array('scripts/function.js', 'scripts/filtergroups.js.php', 'scripts/multiple_group.js'); } }
function plugin_init_talk() { global $PLUGIN_HOOKS, $CFG_GLPI, $LANG; $PLUGIN_HOOKS['csrf_compliant']['talk'] = true; $plugin = new Plugin(); if ($plugin->isInstalled('talk') && $plugin->isActivated('talk')) { //load preferences on profile changing $PLUGIN_HOOKS['change_profile']['talk'] = array('PluginTalkProfile', 'changeProfile'); //if glpi is loaded if (Session::getLoginUserID()) { Plugin::registerClass('PluginTalkProfile', array('addtabon' => 'Profile')); Plugin::registerClass('PluginTalkUserpref', array('addtabon' => array('User', 'Preference'))); $PLUGIN_HOOKS['use_massive_action']['talk'] = 1; if (Session::haveRight('plugin_talk_is_active', PluginTalkTicket::ACTIVE)) { if (strpos($_SERVER['REQUEST_URI'], "/ticket.form.php") !== false && isset($_GET['id'])) { if (PluginTalkUserpref::isFunctionEnabled("talk_tab")) { // Plugin::registerClass('PluginTalkTicket', // array('addtabon' => array('Ticket'))); $PLUGIN_HOOKS['add_css']['talk'][] = 'css/talk.css'; if (!PluginTalkUserpref::isFunctionEnabled("old_tabs")) { $PLUGIN_HOOKS['add_css']['talk'][] = 'css/hide_ticket_tabs.css'; } $_SESSION['plugin_talk_lasttickets_id'] = $_REQUEST['id']; $PLUGIN_HOOKS['add_javascript']['talk'][] = 'scripts/insert_talktab.js.php'; $PLUGIN_HOOKS['add_javascript']['talk'][] = 'scripts/filter_timeline.js'; $PLUGIN_HOOKS['add_javascript']['talk'][] = 'scripts/read_more.js'; $PLUGIN_HOOKS['add_javascript']['talk'][] = 'scripts/split_button.js'; } /* disabled for 0.85 */ // if (PluginTalkUserpref::isFunctionEnabled("split_view")) { // $PLUGIN_HOOKS['add_css']['talk'][] = 'css/split_ticket_view.css'; // } } } } } }
function plugin_init_themes() { global $PLUGIN_HOOKS; $PLUGIN_HOOKS['csrf_compliant']['themes'] = true; $PLUGIN_HOOKS['change_profile']['themes'] = array('PluginThemesProfile', 'changeProfile'); $plugin = new Plugin(); if ($plugin->isInstalled("themes") && $plugin->isActivated("themes")) { Plugin::registerClass('PluginThemesProfile', array('addtabon' => 'Profile')); Plugin::registerClass('PluginThemesTheme', array('addtabon' => 'Preference')); // Default new css and js file. if (plugin_themes_haveRight('themes', 'w')) { $PLUGIN_HOOKS['menu_entry']["themes"] = "front/themes.php"; $PLUGIN_HOOKS['submenu_entry']['themes']['search'] = 'front/themes.php'; $PLUGIN_HOOKS['submenu_entry']['themes']['add'] = 'front/themes.form.php'; } /*** Search for a default theme to display***/ $activeTheme = new PluginThemesTheme(); $activeTheme->getFromDB(PluginThemesTheme::getUserTheme()); if ($activeTheme->fields['name'] != "GLPI") { $PLUGIN_HOOKS['add_css']['themes'] = 'front/getfile.php?theme_id=' . $activeTheme->fields['id'] . '&type=css&file=' . $activeTheme->fields['name'] . '.css'; $PLUGIN_HOOKS['add_javascript']['themes'] = 'front/getfile.php?theme_id=' . $activeTheme->fields['id'] . '&type=js&file=' . $activeTheme->fields['name'] . '.js'; } } }
/** * * Determine if the plugin should be installed or upgraded * * Returns 0 if the plugin is not yet installed * Returns 1 if the plugin is already installed * * @since 1.3 */ function plugin_simcard_postinit() { global $UNINSTALL_TYPES, $ORDER_TYPES, $ALL_CUSTOMFIELDS_TYPES, $DB; $plugin = new Plugin(); if ($plugin->isInstalled('uninstall') && $plugin->isActivated('uninstall')) { array_push($UNINSTALL_TYPES, 'PluginSimcardSimcard'); } if ($plugin->isInstalled('order') && $plugin->isActivated('order')) { array_push($ORDER_TYPES, 'PluginSimcardSimcard'); } if ($plugin->isInstalled('customfields') && $plugin->isActivated('customfields')) { PluginCustomfieldsItemtype::registerItemtype('PluginSimcardSimcard'); } }
$DBCONNECTION_REQUIRED = 1; // MASS IMPORT for OCSNG include '../../../inc/includes.php'; $_SESSION["glpicronuserrunning"] = $_SESSION["glpiname"] = 'ocsinventoryng'; // Check PHP Version - sometime (debian) cli version != module version if (phpversion() < "5") { die("PHP version:" . phpversion() . " - " . "You must install at least PHP5.\n\n"); } // Chech Memory_limit - sometine cli limit (php-cli.ini) != module limit (php.ini) $mem = Toolbox::getMemoryLimit(); if ($mem > 0 && $mem < 64 * 1024 * 1024) { die("PHP memory_limit = " . $mem . " - " . "A minimum of 64Mio is commonly required for GLPI.'\n\n"); } //Check if plugin is installed $plugin = new Plugin(); if (!$plugin->isInstalled("ocsinventoryng")) { echo "Disabled plugin\n"; exit(1); } if (!$plugin->isActivated("ocsinventoryng")) { echo "Disabled plugin\n"; exit(1); } $thread_nbr = ''; $threadid = ''; $ocsservers_id = -1; $fields = array(); //Get script configuration $config = new PluginOcsinventoryngConfig(); $notimport = new PluginOcsinventoryngNotimportedcomputer(); $config->getFromDB(1);
function canUsePluginGeninventoryNumber() { $plugin = new Plugin(); if (!$plugin->isInstalled("geninventorynumber") || !$plugin->isActivated("geninventorynumber")) { return false; } return $this->fields['use_plugin_geninventorynumber']; }
<?php include '../../../inc/includes.php'; Plugin::load('tag', true); $plugin = new Plugin(); if ($plugin->isInstalled("tag") && $plugin->isActivated("tag")) { $dropdown = new PluginTagTag(); include GLPI_ROOT . "/front/dropdown.common.php"; }
<?php include '../../../inc/includes.php'; $plugin = new Plugin(); if (!$plugin->isInstalled('formcreator') || !$plugin->isActivated('formcreator')) { Html::displayNotFoundError(); } Session::checkLoginUser(); if ($_SESSION['glpiactiveprofile']['interface'] == 'helpdesk') { Html::helpHeader(__('Form list', 'formcreator'), $_SERVER['PHP_SELF']); } else { Html::header(__('Form list', 'formcreator'), $_SERVER['PHP_SELF'], 'plugins', 'formcreator', 'options'); } $form = new PluginFormcreatorForm(); $form->showList(); Html::footer();
function plugin_init_genericobject() { global $PLUGIN_HOOKS, $CFG_GLPI, $GO_BLACKLIST_FIELDS, $GO_FIELDS, $GENERICOBJECT_PDF_TYPES, $GO_LINKED_TYPES, $GO_READONLY_FIELDS, $LOADED_PLUGINS; include_once GLPI_ROOT . '/plugins/genericobject/inc/profile.class.php'; PluginGenericobjectProfile::reloadProfileRights(); $GO_READONLY_FIELDS = array("is_helpdesk_visible", "comment"); $GO_BLACKLIST_FIELDS = array("itemtype", "table", "is_deleted", "id", "entities_id", "is_recursive", "is_template", "notepad", "template_name", "date_mod", "name", "is_helpdesk_visible", "comment"); $GO_LINKED_TYPES = array('Computer', 'Phone', 'Peripheral', 'Software', 'Monitor', 'Printer', 'NetworkEquipment'); $PLUGIN_HOOKS['csrf_compliant']['genericobject'] = true; $GENERICOBJECT_PDF_TYPES = array(); $plugin = new Plugin(); if ($plugin->isInstalled("genericobject") && $plugin->isActivated("genericobject")) { plugin_genericobject_includeCommonFields(); $PLUGIN_HOOKS['use_massive_action']['genericobject'] = 1; // add css styles $PLUGIN_HOOKS['add_css']['genericobject'] = array("css/styles.css"); // Display a menu entry ? $PLUGIN_HOOKS['menu_toadd']['genericobject'] = array('config' => 'PluginGenericobjectType', 'assets' => 'PluginGenericobjectObject'); // Ensure GLPI does correctly load menu entries for each activated objects // TODO: it could be better to check existence of those entries before unsetting the glpimenu // session in order to trigger rebuild. unset($_SESSION['glpimenu']); // Config page /*if (Session::haveRight('config', READ)) { $PLUGIN_HOOKS['config_page']['genericobject'] = 'front/type.php'; $PLUGIN_HOOKS['submenu_entry']['genericobject']['options']['type']['links']['add'] = Toolbox::getItemTypeFormURL('PluginGenericobjectType', false); $PLUGIN_HOOKS['submenu_entry']['genericobject']['options']['type']['links']['search'] = Toolbox::getItemTypeSearchURL('PluginGenericobjectType', false); }*/ $PLUGIN_HOOKS['assign_to_ticket']['genericobject'] = true; $PLUGIN_HOOKS['use_massive_action']['genericobject'] = 1; $PLUGIN_HOOKS['post_init']['genericobject'] = 'plugin_post_init_genericobject'; $PLUGIN_HOOKS['plugin_datainjection_populate']['genericobject'] = "plugin_datainjection_populate_genericobject"; } }
<?php include "../../../inc/includes.php"; if (!isset($_GET["id"])) { $_GET["id"] = 0; } $plugin = new Plugin(); if (!$plugin->isInstalled('escalade') || !$plugin->isActivated('escalade')) { echo "Plugin not installed or activated"; return; } $config = new PluginEscaladeConfig(); if (isset($_POST["add"])) { Session::checkRight("config", CREATE); $newID = $config->add($_POST); Html::back(); } elseif (isset($_POST["update"])) { Session::checkRight("config", UPDATE); $config->update($_POST); Html::back(); } elseif (isset($_POST["delete"])) { Session::checkRight("config", DELETE); $config->delete($_POST, 1); Html::redirect("./config.form.php"); } else { Html::header(__("Escalation", "escalade"), '', "plugins", "escalade", "config"); $config->showForm(1); Html::footer(); }
/** * Reruns the aspect installation to upgrade the plugin if needed * * @param Plugin $plugin The plugin to upgrade * * @return void */ public function autoupgradePlugin(Plugin $plugin) { if (empty($plugin) || !$plugin->isInstalled() || !$plugin->isEnabled()) { return; } $xml = $this->loadXML($plugin->Path); if (empty($xml)) { return; } if ($plugin->Version != ($newversion = strval($xml->info->version))) { $plugin->NewVersion = $newversion; return; } if (!$this->TransactionManager->isTransactionInProgress()) { $this->TransactionManager->begin(); } $xmlFile = $plugin->Path . '/plugin.xml'; $ts = $this->DateFactory->newLocalDate(filemtime($xmlFile)); $md5 = md5_file($xmlFile); $changed = $this->processAspects($plugin, $log); if ($plugin->Md5 !== $md5) { $plugin->Md5 = $md5; $this->processCMSNavItems($plugin, $log, $xml); $this->processElements($plugin, $log, $xml); $changed = true; } // rerun element schemas if ($changed) { $plugin->AutoUpgraded = true; if (!$this->TransactionManager->isTransactionInProgress()) { $this->TransactionManager->begin(); } // foreach($this->ElementService->findAll()->getResults() as $element) // $this->NodeService->createDBSchema($element); $plugin = $this->PluginService->edit($plugin); } }
function showForm($ID, $options = array()) { global $CFG_GLPI; if (!$this->canView()) { return false; } $yesnoall = array(0 => __("No"), 1 => __('First'), 2 => __('Last')); $this->check($ID, 'r'); $this->showFormHeader($options); echo "<tr class='tab_bg_1'>"; echo "<td>"; echo __("Remove old assign group on new group assign", "escalade"); echo "</td>"; echo "<td>"; Dropdown::showYesNo("remove_group", $this->fields["remove_group"], -1, array('on_change' => 'hide_show_history(this.value)')); echo "<script type='text/javascript'>\n function hide_show_history(val) {\n if (val == 0) {\n document.getElementById('show_history_td1').style.display = 'none';\n document.getElementById('show_history_td2').style.display = 'none';\n document.getElementById('show_solve_return_group_td1').style.display = 'none';\n document.getElementById('show_solve_return_group_td2').style.display = 'none';\n } else {\n document.getElementById('show_history_td1').style.display = '';\n document.getElementById('show_history_td2').style.display = '';\n document.getElementById('show_solve_return_group_td1').style.display = '';\n document.getElementById('show_solve_return_group_td2').style.display = '';\n }\n }\n </script>"; echo "</td>"; $style = ""; if ($this->fields["remove_group"] == false) { $style = "style='display: none !important;'"; } echo "<td id='show_history_td1' {$style}>"; echo __("show group assign history visually", "escalade"); echo "</td>"; echo "<td id='show_history_td2' {$style}>"; Dropdown::showYesNo("show_history", $this->fields["show_history"]); echo "</td>"; echo "</tr>"; echo "<tr class='tab_bg_1'>"; echo "<td>"; echo __("Escalation history in tasks", "escalade"); echo "</td>"; echo "<td>"; Dropdown::showYesNo("task_history", $this->fields["task_history"]); echo "</td>"; echo "<td>"; echo __("Remove technician(s) on escalation", "escalade"); echo "</td>"; echo "<td>"; Dropdown::showYesNo("remove_tech", $this->fields["remove_tech"]); echo "</td>"; echo "</tr>"; echo "<tr class='tab_bg_1'>"; echo "<td>"; echo __("Ticket status after an escalation", "escalade"); echo "</td>"; echo "<td>"; self::dropdownGenericStatus("Ticket", "ticket_last_status", $this->fields["ticket_last_status"]); echo "</td>"; echo "<td id='show_solve_return_group_td1' {$style}>"; echo __("Assign ticket to intial group on solve ticket", "escalade"); echo "</td>"; echo "<td id='show_solve_return_group_td2' {$style}>"; Dropdown::showYesNo("solve_return_group", $this->fields["solve_return_group"]); echo "</td>"; echo "</tr>"; echo "<tr class='tab_bg_1'>"; echo "<td>"; echo __("Assign the technical manager on ticket category change", "escalade"); echo "</td>"; echo "<td>"; Dropdown::showYesNo("reassign_tech_from_cat", $this->fields["reassign_tech_from_cat"]); echo "</td>"; echo "<td>"; echo __("Assign the technical groupe on ticket category change", "escalade"); echo "</td>"; echo "<td>"; Dropdown::showYesNo("reassign_group_from_cat", $this->fields["reassign_group_from_cat"]); echo "</td>"; echo "</tr>"; echo "<tr class='tab_bg_1'>"; echo "<td>"; echo __("Clone tickets", "escalade"); echo "</td>"; echo "<td>"; Dropdown::showYesNo("cloneandlink_ticket", $this->fields["cloneandlink_ticket"]); echo "</td>"; echo "<td>"; echo __("Close cloned tickets at the same time", "escalade"); echo "</td>"; echo "<td>"; Dropdown::showYesNo("close_linkedtickets", $this->fields["close_linkedtickets"]); echo "</td>"; echo "</tr>"; echo "<tr class='tab_bg_1'>"; echo "<td>"; echo __("Use the technician's group", "escalade"); echo "</td>"; echo "<td>"; echo "<table>"; echo "<tr><td>"; Dropdown::showFromArray('use_assign_user_group', $yesnoall, array('value' => $this->fields['use_assign_user_group'])); echo "</td>"; echo "<td><label for=''>" . __("a time of creation", "escalade") . " </label>"; Dropdown::showYesNo("use_assign_user_group_creation", $this->fields["use_assign_user_group_creation"]); echo "</td>"; echo "<td><label for=''>" . __("a time of modification", "escalade") . " </label>"; Dropdown::showYesNo("use_assign_user_group_modification", $this->fields["use_assign_user_group_modification"]); echo "</td>"; echo "</tr></table>"; $plugin = new Plugin(); if ($plugin->isInstalled('behaviors') && $plugin->isActivated('behaviors')) { echo "<i>" . str_replace('##link##', $CFG_GLPI["root_doc"] . "/front/config.form.php?forcetab=PluginBehaviorsConfig%241", __("Nota: This feature (creation part) is duplicate with the <a href='##link##'>Behavior</a>plugin. This last has priority.", "escalade")) . "</i>"; } echo "</td>"; echo "</tr>"; echo "<tr class='tab_bg_1'>"; echo "<td>"; echo __("Display delete button of assigned groups", "escalade"); echo "</td>"; echo "<td>"; Dropdown::showYesNo("remove_delete_group_btn", $this->fields["remove_delete_group_btn"]); echo "</td>"; echo "<td>"; echo __("Display delete button of assigned users", "escalade"); echo "</td>"; echo "<td>"; Dropdown::showYesNo("remove_delete_user_btn", $this->fields["remove_delete_user_btn"]); echo "</td>"; echo "</tr>"; echo "<tr class='tab_bg_1'>"; echo "<td>"; echo __("Rapid ticket assignment button", "escalade"); echo "</td>"; echo "<td>"; Dropdown::showYesNo("assign_me_ticket", $this->fields["assign_me_ticket"]); echo "</td>"; echo "<td>"; echo __("Enable filtering on the groups assignment", "escalade"); echo "</td>"; echo "<td>"; Dropdown::showYesNo("use_filter_assign_group", $this->fields["use_filter_assign_group"]); echo "</td>"; echo "</tr>"; $options['candel'] = false; $this->showFormButtons($options); }