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


PHP Toolbox::shortcut方法代码示例

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


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

示例1: header

    /**
     * Print a nice HTML head for every page
     *
     * @param $title     title of the page
     * @param $url       not used anymore (default '')
     * @param $sector    sector in which the page displayed is (default 'none')
     * @param $item      item corresponding to the page displayed (default 'none')
     * @param $option    option corresponding to the page displayed (default '')
     **/
    static function header($title, $url = '', $sector = "none", $item = "none", $option = "")
    {
        global $CFG_GLPI, $PLUGIN_HOOKS, $HEADER_LOADED, $DB;
        // If in modal : display popHeader
        if (isset($_REQUEST['_in_modal']) && $_REQUEST['_in_modal']) {
            return self::popHeader($title, $url);
        }
        // Print a nice HTML-head for every page
        if ($HEADER_LOADED) {
            return;
        }
        $HEADER_LOADED = true;
        // Force lower case for sector and item
        $sector = strtolower($sector);
        $item = strtolower($item);
        self::includeHeader($title);
        // Body
        echo "<body>";
        // Generate array for menu and check right
        if (!isset($_SESSION['glpimenu']) || !is_array($_SESSION['glpimenu']) || count($_SESSION['glpimenu']) == 0) {
            // INVENTORY
            //don't change order in array
            $showallassets = false;
            $menu['assets']['title'] = __('Assets');
            $menu['assets']['types'] = array('Computer', 'Monitor', 'Software', 'NetworkEquipment', 'Peripheral', 'Printer', 'CartridgeItem', 'ConsumableItem', 'Phone');
            $menu['helpdesk']['title'] = __('Assistance');
            $menu['helpdesk']['types'] = array('Ticket', 'Problem', 'Change', 'Planning', 'Stat', 'TicketRecurrent');
            $menu['management']['title'] = __('Management');
            $menu['management']['types'] = array('Budget', 'Supplier', 'Contact', 'Contract', 'Document');
            $menu['tools']['title'] = __('Tools');
            $menu['tools']['types'] = array('Project', 'Reminder', 'RSSFeed', 'KnowbaseItem', 'ReservationItem', 'Report', 'MigrationCleaner');
            $menu['plugins']['title'] = _n('Plugin', 'Plugins', Session::getPluralNumber());
            $menu['plugins']['types'] = array();
            $menu['admin']['title'] = __('Administration');
            $menu['admin']['types'] = array('User', 'Group', 'Entity', 'Rule', 'Profile', 'QueuedMail', 'Backup', 'Event');
            $menu['config']['title'] = __('Setup');
            $menu['config']['types'] = array('CommonDropdown', 'CommonDevice', 'Notification', 'SLA', 'Config', 'Control', 'Crontask', 'Auth', 'MailCollector', 'Link', 'Plugin');
            // Special items
            $menu['preference']['title'] = __('My settings');
            $menu['preference']['default'] = '/front/preference.php';
            // Permit to plugins to add entry to others sector !
            if (isset($PLUGIN_HOOKS["menu_toadd"]) && count($PLUGIN_HOOKS["menu_toadd"])) {
                foreach ($PLUGIN_HOOKS["menu_toadd"] as $plugin => $items) {
                    if (count($items)) {
                        foreach ($items as $key => $val) {
                            if (isset($menu[$key])) {
                                $menu[$key]['types'][] = $val;
                            }
                        }
                    }
                }
            }
            foreach ($menu as $category => $datas) {
                if (isset($datas['types']) && count($datas['types'])) {
                    foreach ($datas['types'] as $type) {
                        if ($data = $type::getMenuContent()) {
                            // Multi menu entries management
                            if (isset($data['is_multi_entries']) && $data['is_multi_entries']) {
                                if (!isset($menu[$category]['content'])) {
                                    $menu[$category]['content'] = array();
                                }
                                $menu[$category]['content'] += $data;
                            } else {
                                $menu[$category]['content'][strtolower($type)] = $data;
                            }
                        }
                    }
                }
                // Define default link :
                if (isset($menu[$category]['content']) && count($menu[$category]['content'])) {
                    foreach ($menu[$category]['content'] as $val) {
                        if (isset($val['page'])) {
                            $menu[$category]['default'] = $val['page'];
                            break;
                        }
                    }
                }
            }
            $allassets = array('Computer', 'Monitor', 'Peripheral', 'NetworkEquipment', 'Phone', 'Printer');
            foreach ($allassets as $type) {
                if (isset($menu['assets']['content'][strtolower($type)])) {
                    $menu['assets']['content']['allassets']['title'] = __('Global');
                    $menu['assets']['content']['allassets']['shortcut'] = '';
                    $menu['assets']['content']['allassets']['page'] = '/front/allassets.php';
                    $menu['assets']['content']['allassets']['links']['search'] = '/front/allassets.php';
                    break;
                }
            }
            //  PLUGINS
            //          if (isset($PLUGIN_HOOKS["menu_entry"]) && count($PLUGIN_HOOKS["menu_entry"])) {
            //             $plugins = array();
//.........这里部分代码省略.........
开发者ID:euqip,项目名称:glpi-smartcities,代码行数:101,代码来源:html.class.php

示例2: header

 /**
  * Print a nice HTML head for every page
  *
  * @param $title     title of the page
  * @param $url       not used anymore (default '')
  * @param $sector    sector in which the page displayed is (default 'none')
  * @param $item      item corresponding to the page displayed (default 'none')
  * @param $option    option corresponding to the page displayed (default '')
  **/
 static function header($title, $url = '', $sector = "none", $item = "none", $option = "")
 {
     global $CFG_GLPI, $PLUGIN_HOOKS, $HEADER_LOADED, $DB;
     // If in modal : display popHeader
     if (isset($_REQUEST['_in_modal']) && $_REQUEST['_in_modal']) {
         return self::popHeader($title, $url);
     }
     // Print a nice HTML-head for every page
     if ($HEADER_LOADED) {
         return;
     }
     $HEADER_LOADED = true;
     // Force lower case for sector and item
     $sector = strtolower($sector);
     $item = strtolower($item);
     self::includeHeader($title);
     $body_class = "layout_" . $_SESSION['glpilayout'];
     if (strpos($_SERVER['REQUEST_URI'], "form.php") !== false && isset($_GET['id']) && $_GET['id'] > 0) {
         if (!CommonGLPI::isLayoutExcludedPage()) {
             $body_class .= " form";
         } else {
             $body_class = "";
         }
     }
     // Body
     echo "<body class='{$body_class}'>";
     // Generate array for menu and check right
     if (!isset($_SESSION['glpimenu']) || !is_array($_SESSION['glpimenu']) || count($_SESSION['glpimenu']) == 0) {
         // INVENTORY
         //don't change order in array
         $showallassets = false;
         $menu = self::getMenuInfos();
         // Permit to plugins to add entry to others sector !
         if (isset($PLUGIN_HOOKS["menu_toadd"]) && count($PLUGIN_HOOKS["menu_toadd"])) {
             foreach ($PLUGIN_HOOKS["menu_toadd"] as $plugin => $items) {
                 if (count($items)) {
                     foreach ($items as $key => $val) {
                         if (isset($menu[$key])) {
                             $menu[$key]['types'][] = $val;
                         }
                     }
                 }
             }
         }
         foreach ($menu as $category => $datas) {
             if (isset($datas['types']) && count($datas['types'])) {
                 foreach ($datas['types'] as $type) {
                     if ($data = $type::getMenuContent()) {
                         // Multi menu entries management
                         if (isset($data['is_multi_entries']) && $data['is_multi_entries']) {
                             if (!isset($menu[$category]['content'])) {
                                 $menu[$category]['content'] = array();
                             }
                             $menu[$category]['content'] += $data;
                         } else {
                             $menu[$category]['content'][strtolower($type)] = $data;
                         }
                     }
                 }
             }
             // Define default link :
             if (isset($menu[$category]['content']) && count($menu[$category]['content'])) {
                 foreach ($menu[$category]['content'] as $val) {
                     if (isset($val['page'])) {
                         $menu[$category]['default'] = $val['page'];
                         break;
                     }
                 }
             }
         }
         $allassets = array('Computer', 'Monitor', 'Peripheral', 'NetworkEquipment', 'Phone', 'Printer');
         foreach ($allassets as $type) {
             if (isset($menu['assets']['content'][strtolower($type)])) {
                 $menu['assets']['content']['allassets']['title'] = __('Global');
                 $menu['assets']['content']['allassets']['shortcut'] = '';
                 $menu['assets']['content']['allassets']['page'] = '/front/allassets.php';
                 $menu['assets']['content']['allassets']['links']['search'] = '/front/allassets.php';
                 break;
             }
         }
         //  PLUGINS
         //          if (isset($PLUGIN_HOOKS["menu_entry"]) && count($PLUGIN_HOOKS["menu_entry"])) {
         //             $plugins = array();
         //
         //             foreach  ($PLUGIN_HOOKS["menu_entry"] as $plugin => $active) {
         //                if ($active) { // true or a string
         //                   $plugins[$plugin] = Plugin::getInfo($plugin);
         //                }
         //             }
         //
         //             if (count($plugins)) {
//.........这里部分代码省略.........
开发者ID:OlivierLM,项目名称:glpi,代码行数:101,代码来源:html.class.php

示例3: header

 /**
  * Print a nice HTML head for every page
  *
  * @param $title     title of the page
  * @param $url       not used anymore (default '')
  * @param $sector    sector in which the page displayed is (default 'none')
  * @param $item      item corresponding to the page displayed (default 'none')
  * @param $option    option corresponding to the page displayed (default '')
  **/
 static function header($title, $url = '', $sector = "none", $item = "none", $option = "")
 {
     global $CFG_GLPI, $PLUGIN_HOOKS, $HEADER_LOADED, $DB;
     // Print a nice HTML-head for every page
     if ($HEADER_LOADED) {
         return;
     }
     $HEADER_LOADED = true;
     self::includeHeader($title);
     // Body
     echo "<body>";
     // Generate array for menu and check right
     // INVENTORY
     $showallassets = false;
     $menu['inventory']['title'] = __('Assets');
     if (Session::haveRight("computer", "r")) {
         $menu['inventory']['default'] = '/front/computer.php';
         $menu['inventory']['content']['computer']['title'] = _n('Computer', 'Computers', 2);
         $menu['inventory']['content']['computer']['shortcut'] = 'o';
         $menu['inventory']['content']['computer']['page'] = '/front/computer.php';
         $menu['inventory']['content']['computer']['links']['search'] = '/front/computer.php';
         if (Session::haveRight("computer", "w")) {
             $menu['inventory']['content']['computer']['links']['add'] = '/front/setup.templates.php?' . 'itemtype=Computer&amp;add=1';
             $menu['inventory']['content']['computer']['links']['template'] = '/front/setup.templates.php?' . 'itemtype=Computer&amp;add=0';
         }
         $showallassets = true;
     }
     if (Session::haveRight("monitor", "r")) {
         $menu['inventory']['content']['monitor']['title'] = _n('Monitor', 'Monitors', 2);
         $menu['inventory']['content']['monitor']['shortcut'] = '';
         $menu['inventory']['content']['monitor']['page'] = '/front/monitor.php';
         $menu['inventory']['content']['monitor']['links']['search'] = '/front/monitor.php';
         if (Session::haveRight("monitor", "w")) {
             $menu['inventory']['content']['monitor']['links']['add'] = '/front/setup.templates.php?' . 'itemtype=Monitor&amp;add=1';
             $menu['inventory']['content']['monitor']['links']['template'] = '/front/setup.templates.php?' . 'itemtype=Monitor&amp;add=0';
         }
         $showallassets = true;
     }
     if (Session::haveRight("software", "r")) {
         $menu['inventory']['content']['software']['title'] = _n('Software', 'Software', 2);
         $menu['inventory']['content']['software']['shortcut'] = 's';
         $menu['inventory']['content']['software']['page'] = '/front/software.php';
         $menu['inventory']['content']['software']['links']['search'] = '/front/software.php';
         if (Session::haveRight("software", "w")) {
             $menu['inventory']['content']['software']['links']['add'] = '/front/setup.templates.php?' . 'itemtype=Software&amp;add=1';
             $menu['inventory']['content']['software']['links']['template'] = '/front/setup.templates.php?' . 'itemtype=Software&amp;add=0';
         }
     }
     if (Session::haveRight("networking", "r")) {
         $menu['inventory']['content']['networking']['title'] = _n('Network', 'Networks', 2);
         $menu['inventory']['content']['networking']['shortcut'] = '';
         $menu['inventory']['content']['networking']['page'] = '/front/networkequipment.php';
         $menu['inventory']['content']['networking']['links']['search'] = '/front/networkequipment.php';
         $menu['inventory']['content']['networking']['options']['networkport']['title'] = _n('Network port', 'Network ports', 2);
         $menu['inventory']['content']['networking']['options']['networkport']['page'] = '/front/networkport.form.php';
         $menu['inventory']['content']['networking']['options']['networkport']['links'] = array();
         if (Session::haveRight("networking", "w")) {
             $menu['inventory']['content']['networking']['links']['add'] = '/front/setup.templates.php?' . 'itemtype=NetworkEquipment&amp;add=1';
             $menu['inventory']['content']['networking']['links']['template'] = '/front/setup.templates.php?' . 'itemtype=NetworkEquipment&amp;add=0';
         }
         $showallassets = true;
     }
     if (Session::haveRight("peripheral", "r")) {
         $menu['inventory']['content']['peripheral']['title'] = _n('Device', 'Devices', 2);
         $menu['inventory']['content']['peripheral']['shortcut'] = '';
         $menu['inventory']['content']['peripheral']['page'] = '/front/peripheral.php';
         $menu['inventory']['content']['peripheral']['links']['search'] = '/front/peripheral.php';
         if (Session::haveRight("peripheral", "w")) {
             $menu['inventory']['content']['peripheral']['links']['add'] = '/front/setup.templates.php?' . 'itemtype=Peripheral&amp;add=1';
             $menu['inventory']['content']['peripheral']['links']['template'] = '/front/setup.templates.php?' . 'itemtype=Peripheral&amp;add=0';
         }
         $showallassets = true;
     }
     if (Session::haveRight("printer", "r")) {
         $menu['inventory']['content']['printer']['title'] = _n('Printer', 'Printers', 2);
         $menu['inventory']['content']['printer']['shortcut'] = '';
         $menu['inventory']['content']['printer']['page'] = '/front/printer.php';
         $menu['inventory']['content']['printer']['links']['search'] = '/front/printer.php';
         if (Session::haveRight("printer", "w")) {
             $menu['inventory']['content']['printer']['links']['add'] = '/front/setup.templates.php?' . 'itemtype=Printer&amp;add=1';
             $menu['inventory']['content']['printer']['links']['template'] = '/front/setup.templates.php?' . 'itemtype=Printer&amp;add=0';
         }
         $showallassets = true;
     }
     if (Session::haveRight("cartridge", "r")) {
         $menu['inventory']['content']['cartridge']['title'] = _n('Cartridge', 'Cartridges', 2);
         $menu['inventory']['content']['cartridge']['shortcut'] = '';
         $menu['inventory']['content']['cartridge']['page'] = '/front/cartridgeitem.php';
         $menu['inventory']['content']['cartridge']['links']['search'] = '/front/cartridgeitem.php';
         if (Session::haveRight("cartridge", "w")) {
             $menu['inventory']['content']['cartridge']['links']['add'] = '/front/cartridgeitem.form.php';
//.........这里部分代码省略.........
开发者ID:geldarr,项目名称:hack-space,代码行数:101,代码来源:html.class.php


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