当前位置: 首页>>代码示例>>PHP>>正文


PHP Plugin::isInstalled方法代码示例

本文整理汇总了PHP中Plugin::isInstalled方法的典型用法代码示例。如果您正苦于以下问题:PHP Plugin::isInstalled方法的具体用法?PHP Plugin::isInstalled怎么用?PHP Plugin::isInstalled使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Plugin的用法示例。


在下文中一共展示了Plugin::isInstalled方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: plugin_fields_checkFiles

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);
            }
        }
    }
}
开发者ID:publik1974,项目名称:fields,代码行数:26,代码来源:setup.php

示例2: plugin_init_customfields

/**
 * 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';
    }
}
开发者ID:blerohellec,项目名称:customfields,代码行数:33,代码来源:setup.php

示例3: plugin_init_escalade

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'] = 'plugin_escalade_item_add_user';
        // == Interface links ==
        if (Session::haveRight('config', UPDATE)) {
            $PLUGIN_HOOKS['config_page']['escalade'] = 'front/config.form.php';
        }
        $PLUGIN_HOOKS['use_massive_action']['escalade'] = 1;
    }
}
开发者ID:korial29,项目名称:escalade,代码行数:58,代码来源:setup.php

示例4: plugin_init_formcreator

/**
 * 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']);
        }
    }
}
开发者ID:jcr0ch4,项目名称:formcreator,代码行数:57,代码来源:setup.php

示例5: plugin_init_purgelogs

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';
        }
    }
}
开发者ID:paisdelconocimiento,项目名称:glpi-smartcities,代码行数:12,代码来源:setup.php

示例6: plugin_init_simcard

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';
        }
    }
}
开发者ID:paisdelconocimiento,项目名称:glpi-smartcities,代码行数:53,代码来源:setup.php

示例7: plugin_init_escalade

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;
        }
    }
}
开发者ID:geldarr,项目名称:hack-space,代码行数:51,代码来源:setup.php

示例8: plugin_init_news

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');
        }
    }
}
开发者ID:paisdelconocimiento,项目名称:glpi-smartcities,代码行数:15,代码来源:setup.php

示例9: plugin_init_moreldap

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');
    }
}
开发者ID:pluginsGLPI,项目名称:moreldap,代码行数:15,代码来源:setup.php

示例10: plugin_init_geninventorynumber

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');
        }
    }
}
开发者ID:paisdelconocimiento,项目名称:glpi-smartcities,代码行数:17,代码来源:setup.php

示例11: plugin_init_customfields

/**
 * 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';
        }
    }
}
开发者ID:geldarr,项目名称:hack-space,代码行数:49,代码来源:setup.php

示例12: plugin_init_formcreator

/**
 * 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']);
        }
    }
}
开发者ID:OscarLoayzaB,项目名称:formcreator,代码行数:49,代码来源:setup.php

示例13: plugin_init_moreldap

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';
        }
    }
}
开发者ID:paisdelconocimiento,项目名称:glpi-smartcities,代码行数:18,代码来源:setup.php

示例14: plugin_init_tag

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';
                }
            }
        }
    }
}
开发者ID:korial29,项目名称:tag,代码行数:43,代码来源:setup.php

示例15: plugin_init_genericobject

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";
    }
}
开发者ID:rambeau,项目名称:genericobject,代码行数:42,代码来源:setup.php


注:本文中的Plugin::isInstalled方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。