static function dropdownService($ID, $options = array())
{
global $CFG_GLPI;
$p = array();
$p['name'] = 'networkports_id';
$p['comments'] = 1;
$p['entity'] = -1;
$p['entity_sons'] = false;
if (is_array($options) && count($options)) {
foreach ($options as $key => $val) {
$p[$key] = $val;
}
}
// Manage entity_sons
if (!($p['entity'] < 0) && $p['entity_sons']) {
if (is_array($p['entity'])) {
echo "entity_sons options is not available with array of entity";
} else {
$p['entity'] = getSonsOf('glpi_entities', $p['entity']);
}
}
$rand = mt_rand();
echo "<select name='itemtype[{$ID}]' id='itemtype{$rand}'>";
echo "<option value='0'>" . DROPDOWN_EMPTY_VALUE . "</option>";
// $a_types =array();
echo "<option value='Computer'>" . Computer::getTypeName() . "</option>";
echo "<option value='NetworkEquipment'>" . NetworkEquipment::getTypeName() . "</option>";
echo "</select>";
$params = array('itemtype' => '__VALUE__', 'entity_restrict' => $p['entity'], 'current' => $ID, 'comments' => $p['comments'], 'myname' => $p['name'], 'rand' => $rand);
ajaxUpdateItemOnSelectEvent("itemtype{$rand}", "show_" . $p['name'] . "{$rand}", $CFG_GLPI["root_doc"] . "/plugins/monitoring/ajax/dropdownServiceHostType.php", $params);
echo "<span id='show_" . $p['name'] . "{$rand}'><input type='hidden' name='services_id[]' value='0'/></span>\n";
return $rand;
}