static function showAddEventForm($params = array())
{
global $CFG_GLPI;
if (count($CFG_GLPI['planning_add_types']) == 1) {
$params['itemtype'] = $CFG_GLPI['planning_add_types'][0];
self::showAddEventSubForm($params);
} else {
$rand = mt_rand();
$select_options = array();
foreach ($CFG_GLPI['planning_add_types'] as $add_types) {
$select_options[$add_types] = $add_types::getTypeName(1);
}
echo __("Event type") . " : <br>";
Dropdown::showFromArray('itemtype', $select_options, array('display_emptychoice' => true, 'rand' => $rand));
echo Html::scriptBlock("\n \$(document).ready(function() {\n \$('#dropdown_itemtype{$rand}').on('change', function() {\n var current_itemtype = \$(this).val();\n \$('#add_planning_subform{$rand}').load('" . $CFG_GLPI['root_doc'] . "/ajax/planning.php',\n {action: 'add_event_sub_form',\n itemtype: current_itemtype,\n begin: '" . $params['begin'] . "',\n end: '" . $params['end'] . "'});\n });\n });");
echo "<br><br>";
echo "<div id='add_planning_subform{$rand}'></div>";
}
}