Dropdown::getDeviceItemTypes PHP Method

getDeviceItemTypes() static public method

Get the Device list name the user is allowed to edit
static public getDeviceItemTypes ( ) : array
return array (group of dropdown) of array (itemtype => localized name)
    static function getDeviceItemTypes()
    {
        global $CFG_GLPI;
        static $optgroup = NULL;
        if (!Session::haveRightsOr('device', array(CREATE, UPDATE, PURGE))) {
            return array();
        }
        if (is_null($optgroup)) {
            $devices = array();
            foreach (CommonDevice::getDeviceTypes() as $device_type) {
                $devices[$device_type] = $device_type::getTypeName(Session::getPluralNumber());
            }
            asort($devices);
            $optgroup = array(_n('Component', 'Components', Session::getPluralNumber()) => $devices);
        }
        return $optgroup;
    }

Usage Example

 function title()
 {
     Dropdown::showItemTypeMenu(_n('Component', 'Components', Session::getPluralNumber()), Dropdown::getDeviceItemTypes(), $this->getSearchURL());
 }
All Usage Examples Of Dropdown::getDeviceItemTypes