static function showItemType($types = '', $options = array())
{
global $CFG_GLPI;
$params['name'] = 'itemtype';
$params['value'] = '';
$params['rand'] = mt_rand();
$params['on_change'] = '';
$params['plural'] = false;
//Parameters about choice 0
//Empty choice's label
$params['emptylabel'] = self::EMPTY_VALUE;
//Display emptychoice ?
$params['display_emptychoice'] = true;
$params['checkright'] = false;
$params['toupdate'] = '';
if (is_array($options) && count($options)) {
foreach ($options as $key => $val) {
$params[$key] = $val;
}
}
if (!is_array($types)) {
$types = $CFG_GLPI["state_types"];
}
$options = array();
foreach ($types as $type) {
if ($item = getItemForItemtype($type)) {
if ($params['checkright'] && !$item->canView()) {
continue;
}
$options[$type] = $item->getTypeName($params['plural'] ? 2 : 1);
}
}
asort($options);
if (count($options)) {
return Dropdown::showFromArray($params['name'], $options, array('value' => $params['value'], 'on_change' => $params['on_change'], 'toupdate' => $params['toupdate'], 'display_emptychoice' => $params['display_emptychoice'], 'emptylabel' => $params['emptylabel']));
}
return 0;
}