getMenuInfos() static public méthode

static public getMenuInfos ( ) : string
Résultat string
Exemple #1
0
 /**
  * @since version 0.84
  *
  * @param $field
  * @param $name            (default '')
  * @param $values          (default '')
  * @param $options   array
  **/
 static function getSpecificValueToSelect($field, $name = '', $values = '', array $options = array())
 {
     if (!is_array($values)) {
         $values = array($field => $values);
     }
     $options['display'] = false;
     $options['value'] = $values[$field];
     switch ($field) {
         case 'type_menu':
             $tab = array('' => Dropdown::EMPTY_VALUE);
             $menus = Html::getMenuInfos();
             foreach ($menus as $key => $value) {
                 if ($key != 'plugins' && $key != 'preference') {
                     $tab[$key] = $menus[$key]['title'];
                 }
             }
             return Dropdown::showFromArray($name, $tab, $options);
             break;
     }
     return parent::getSpecificValueToSelect($field, $name, $values, $options);
 }
Exemple #2
0
 /**
  * @covers Html::getMenuInfos
  */
 public function testGetMenuInfos()
 {
     $menu = Html::getMenuInfos();
     $this->assertEquals(8, count($menu));
     $expected = ['assets', 'helpdesk', 'management', 'tools', 'plugins', 'admin', 'config', 'preference'];
     $this->assertEquals($expected, array_keys($menu));
     $expected = ['Computer', 'Monitor', 'Software', 'NetworkEquipment', 'Peripheral', 'Printer', 'CartridgeItem', 'ConsumableItem', 'Phone'];
     $this->assertEquals('Assets', $menu['assets']['title']);
     $this->assertEquals($expected, $menu['assets']['types']);
     $expected = ['Ticket', 'Problem', 'Change', 'Planning', 'Stat', 'TicketRecurrent'];
     $this->assertEquals('Assistance', $menu['helpdesk']['title']);
     $this->assertEquals($expected, $menu['helpdesk']['types']);
     $expected = ['SoftwareLicense', 'Budget', 'Supplier', 'Contact', 'Contract', 'Document'];
     $this->assertEquals('Management', $menu['management']['title']);
     $this->assertEquals($expected, $menu['management']['types']);
     $expected = ['Project', 'Reminder', 'RSSFeed', 'KnowbaseItem', 'ReservationItem', 'Report', 'MigrationCleaner'];
     $this->assertEquals('Tools', $menu['tools']['title']);
     $this->assertEquals($expected, $menu['tools']['types']);
     $expected = [];
     $this->assertEquals('Plugins', $menu['plugins']['title']);
     $this->assertEquals($expected, $menu['plugins']['types']);
     $expected = ['User', 'Group', 'Entity', 'Rule', 'Profile', 'QueuedMail', 'Backup', 'Event'];
     $this->assertEquals('Administration', $menu['admin']['title']);
     $this->assertEquals($expected, $menu['admin']['types']);
     $expected = ['CommonDropdown', 'CommonDevice', 'Notification', 'SLA', 'Config', 'Control', 'Crontask', 'Auth', 'MailCollector', 'Link', 'Plugin'];
     $this->assertEquals('Setup', $menu['config']['title']);
     $this->assertEquals($expected, $menu['config']['types']);
     $this->assertEquals('My settings', $menu['preference']['title']);
     $this->assertNull($menu['preference']['types']);
     $this->assertEquals('/front/preference.php', $menu['preference']['default']);
 }
Exemple #3
0
 static function getMenuNameByItemtype($itemtype)
 {
     //Note : can be name getItemtypesByMenu
     $menu = Html::getMenuInfos();
     if (isset($menu['helpdesk']['types']['Planning'])) {
         unset($menu['helpdesk']['types']['Planning']);
     }
     if (isset($menu['helpdesk']['types']['Stat'])) {
         unset($menu['helpdesk']['types']['Stat']);
     }
     $itemtypes['assets'] = $menu['assets']['types'];
     $itemtypes['helpdesk'] = $menu['helpdesk']['types'];
     $itemtypes['management'] = $menu['management']['types'];
     $itemtypes['tools'] = array('Project', 'Reminder', 'RSSFeed', 'KnowbaseItem');
     $itemtypes['admin'] = array('User', 'Group', 'Entity', 'Profile');
     //Manque les différentes Rules...
     //Manque tout les intitulés, les composants, Notification -> Modèle de notifications, Notification -> Traduction de modèle (mais pas front/notification)
     $itemtypes['config'] = array('SLA', 'SlaLevel', 'FieldUnicity', 'Link');
     //Manque les différents intutulés, les Device*,
     foreach ($itemtypes as $key => $value) {
         if (in_array($itemtype, $value)) {
             return $key;
         }
     }
     return '';
 }
Exemple #4
0
You should have received a copy of the GNU General Public License
along with GLPI. If not, see <http://www.gnu.org/licenses/>.
--------------------------------------------------------------------------
*/
// Based on:
// IRMA, Information Resource-Management and Administration
// Christian Bauer
/** @file
* @brief
*/
include '../inc/includes.php';
Session::checkCentralAccess();
if (isset($_GET["itemtype"])) {
    $itemtype = $_GET['itemtype'];
    $link = $itemtype::getFormURL();
    // Get right sector
    $sector = 'assets';
    //Get sectors from the menu
    $menu = Html::getMenuInfos();
    //Try to find to which sector the itemtype belongs
    foreach ($menu as $menusector => $infos) {
        if (isset($infos['types']) && in_array($itemtype, $infos['types'])) {
            $sector = $menusector;
            break;
        }
    }
    Html::header(__('Manage templates...'), $_SERVER['PHP_SELF'], $sector, $itemtype);
    CommonDBTM::listTemplates($itemtype, $link, $_GET["add"]);
    Html::footer();
}
Exemple #5
0
function plugin_tag_giveItem($type, $field, $data, $num, $linkfield = "")
{
    switch ($field) {
        case PluginTagTag::TAG_SEARCH_NUM:
            //Note : can declare a const for "10500"
            $out = '<div id="s2id_tag_select" class="select2-container select2-container-multi chosen-select-no-results" style="width: 100%;">
                 <ul class="select2-choices">';
            $separator = '';
            $plugintagtag = new PluginTagTag();
            foreach ($data[$num] as $tag) {
                if (isset($tag['id']) && isset($tag['name'])) {
                    $id = $tag['id'];
                    $name = $tag['name'];
                    $plugintagtag->getFromDB($id);
                    $color = $plugintagtag->fields["color"];
                    $style = "";
                    if (!empty($color)) {
                        $style .= "border-width:2px; border-color:{$color};";
                    }
                    $out .= '<li class="select2-search-choice" style="padding-left:5px;' . $style . '">' . $separator . $name . '</li>';
                    $separator = '<span style="display:none">, </span>';
                    //For export (CSV, PDF) of GLPI core
                }
            }
            $out .= '</ul></div>';
            return $out;
            break;
    }
    if ($type == 'PluginTagTag' && $field == 6) {
        $key = $data[$num][0]['name'];
        $menu = Html::getMenuInfos();
        return $menu[$key]['title'];
    }
    return "";
}