/**
  * Display form for agent configuration
  *
  * @param $items_id integer ID
  * @param $options array
  *
  *@return bool true if form is ok
  *
  **/
 function showForm($items_id, $options = array(), $copy = array())
 {
     global $DB, $CFG_GLPI;
     if ($items_id != '') {
         $this->getFromDB($items_id);
     } else {
         $this->getEmpty();
     }
     $this->showTabs($options);
     $this->showFormHeader($options);
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . __('Name') . " :</td>";
     echo "<td>";
     echo "<input type='text' name='name' value='" . $this->fields["name"] . "' size='30'/>";
     echo "</td>";
     echo "<td>" . __('Type', 'monitoring') . "&nbsp;:</td>";
     echo "<td>";
     $elements = $this->getGaugeTypes();
     Dropdown::showFromArray('type', $elements, array('value' => $this->fields["type"]));
     echo "</td>";
     echo "</tr>";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . __('Time (not used for `last value` type)', 'monitoring') . " :</td>";
     echo "<td>";
     $elements = PluginMonitoringCustomitem_Common::getTimes();
     Dropdown::showFromArray('time', $elements, array('value' => $this->fields["time"]));
     echo "</td>";
     echo "<td>" . __('Calendar', 'monitoring') . "&nbsp;:</td>";
     echo "<td>";
     Dropdown::show('Calendar', array('name' => 'time_specific', 'value' => $this->fields['time_specific']));
     echo "</td>";
     echo "</tr>";
     $this->showFormButtons($options);
     if ($items_id == 0) {
         return;
     }
     echo "<form name='form' method='post' action='" . $CFG_GLPI['root_doc'] . "/plugins/monitoring/front/customitem_gauge.form.php'>";
     echo "<input type='hidden' name='id' value='" . $items_id . "' />";
     echo "<table class='tab_cadre_fixe'>";
     echo "<tr class='tab_bg_1'>";
     echo "<th colspan='4'>";
     echo __('Add gauge', 'monitoring');
     echo "</th>";
     echo "</tr>";
     echo "<tr class='tab_bg_1'>";
     echo "<th>";
     echo PluginMonitoringComponentscatalog::getTypeName();
     echo "</th>";
     echo "<th>";
     echo PluginMonitoringComponent::getTypeName();
     echo "</th>";
     echo "<th colspan='2'>";
     echo "</th>";
     echo "</tr>";
     echo "<tr class='tab_bg_3'>";
     echo "<td>";
     $toupdate = array('value_fieldname' => 'id', 'to_update' => "add_selectcomponent", 'url' => $CFG_GLPI["root_doc"] . "/plugins/monitoring/ajax/gaugeComponents.php");
     Dropdown::show('PluginMonitoringComponentscatalog', array('toupdate' => $toupdate));
     echo "</td>";
     echo "<td id='add_selectcomponent'>";
     echo "</td>";
     echo "<td id='add_data'>";
     echo "</td>";
     echo "<td>";
     echo "<input type='submit' name='add_item' value='" . __('Add') . "' class='submit' />";
     echo "</td>";
     echo "</tr>";
     echo "</table>";
     Html::closeForm();
     $array = importArrayFromDB($this->fields['aggregate_items']);
     $pmPerfdataDetail = new PluginMonitoringPerfdataDetail();
     echo "<table class='tab_cadre_fixe'>";
     foreach ($array as $itemtype => $data1) {
         foreach ($data1 as $items_id1 => $data2) {
             $item1 = new $itemtype();
             $item1->getFromDB(str_replace('id', '', $items_id1));
             echo "<tr class='tab_bg_3'>";
             echo "<td>";
             echo "[" . $item1->getTypeName() . "] ";
             echo $item1->getLink();
             echo "</td>";
             foreach ($data2 as $itemtype2 => $data3) {
                 $nb4 = 0;
                 foreach ($data3 as $items_id2 => $data4) {
                     if ($nb4 > 0) {
                         echo "</tr>";
                         echo "<tr class='tab_bg_3'>";
                         echo "<td>";
                         echo "[" . $item1->getTypeName() . "] ";
                         echo $item1->getLink();
                         echo "</td>";
                     }
                     $item2 = new $itemtype2();
                     $item2->getFromDB(str_replace('id', '', $items_id2));
                     echo "<td>";
                     echo "[" . $item2->getTypeName() . "] ";
                     echo $item2->getLink();
                     echo "</td>";
                     echo "<td>";
                     $j = 0;
                     foreach ($data4 as $num => $data5) {
                         if ($j > 0) {
                             echo "<hr/>";
                         }
                         $this->showDefineDataOfGauge($items_id2, array('a' => $itemtype, 'b' => str_replace('id', '', $items_id1), 'c' => $itemtype2, 'd' => str_replace('id', '', $items_id2), 'num' => $num, 'id' => $items_id), TRUE);
                         $j++;
                         $nb4++;
                     }
                 }
             }
             echo "</td>";
             echo "</tr>";
         }
     }
     echo "</table>";
     echo "<table class='tab_cadre'>";
     echo "<tr class='tab_bg_1'>";
     echo "<th>";
     echo __("Preview", 'monitoring');
     echo "</th>";
     echo "</tr>";
     echo "<tr class='tab_bg_1'>";
     echo "<td align='center'>";
     $this->showWidget($items_id);
     $this->showWidgetFrame($items_id);
     echo "</td>";
     echo "</tr>";
     echo "</table>";
     return true;
 }
 static function getAdditionalMenuOptions()
 {
     global $CFG_GLPI;
     $main_menu = '<img src="' . $CFG_GLPI["root_doc"] . '/plugins/monitoring/pics/main_menu.png" alt="' . __('Main menu', 'monitoring') . '" title="' . __('Main menu', 'monitoring') . '"\\>';
     return array('componentscatalog' => array('title' => PluginMonitoringComponentscatalog::getTypeName(), 'page' => PluginMonitoringComponentscatalog::getSearchURL(false), 'links' => array($main_menu => '/plugins/monitoring/front/menu.php', 'search' => '/plugins/monitoring/front/componentscatalog.php', 'add' => '/plugins/monitoring/front/componentscatalog.form.php')), 'command' => array('title' => PluginMonitoringCommand::getTypeName(), 'page' => PluginMonitoringCommand::getSearchURL(false), 'links' => array($main_menu => '/plugins/monitoring/front/menu.php', 'search' => '/plugins/monitoring/front/command.php', 'add' => '/plugins/monitoring/front/command.form.php')), 'check' => array('title' => PluginMonitoringCheck::getTypeName(), 'page' => PluginMonitoringCheck::getSearchURL(false), 'links' => array($main_menu => '/plugins/monitoring/front/menu.php', 'search' => '/plugins/monitoring/front/check.php', 'add' => '/plugins/monitoring/front/check.form.php')), 'eventhandler' => array('title' => PluginMonitoringEventhandler::getTypeName(), 'page' => PluginMonitoringEventhandler::getSearchURL(false), 'links' => array($main_menu => '/plugins/monitoring/front/menu.php', 'search' => '/plugins/monitoring/front/eventhandler.php', 'add' => '/plugins/monitoring/front/eventhandler.form.php')), 'perfdata' => array('title' => PluginMonitoringPerfdata::getTypeName(), 'page' => PluginMonitoringPerfdata::getSearchURL(false), 'links' => array($main_menu => '/plugins/monitoring/front/menu.php', 'search' => '/plugins/monitoring/front/perfdata.php', 'add' => '/plugins/monitoring/front/perfdata.form.php')), 'component' => array('title' => PluginMonitoringComponent::getTypeName(), 'page' => PluginMonitoringComponent::getSearchURL(false), 'links' => array($main_menu => '/plugins/monitoring/front/menu.php', 'search' => '/plugins/monitoring/front/component.php', 'add' => '/plugins/monitoring/front/component.form.php')), 'contacttemplate' => array('title' => PluginMonitoringContacttemplate::getTypeName(), 'page' => PluginMonitoringContacttemplate::getSearchURL(false), 'links' => array($main_menu => '/plugins/monitoring/front/menu.php', 'search' => '/plugins/monitoring/front/contacttemplate.php', 'add' => '/plugins/monitoring/front/contacttemplate.form.php')), 'notificationcommand' => array('title' => PluginMonitoringNotificationcommand::getTypeName(), 'page' => PluginMonitoringNotificationcommand::getSearchURL(false), 'links' => array($main_menu => '/plugins/monitoring/front/menu.php', 'search' => '/plugins/monitoring/front/notificationcommand.php', 'add' => '/plugins/monitoring/front/notificationcommand.form.php')), 'realm' => array('title' => PluginMonitoringRealm::getTypeName(), 'page' => PluginMonitoringRealm::getSearchURL(false), 'links' => array($main_menu => '/plugins/monitoring/front/menu.php', 'search' => '/plugins/monitoring/front/realm.php', 'add' => '/plugins/monitoring/front/realm.form.php')), 'tag' => array('title' => PluginMonitoringTag::getTypeName(), 'page' => PluginMonitoringTag::getSearchURL(false), 'links' => array($main_menu => '/plugins/monitoring/front/menu.php', 'search' => '/plugins/monitoring/front/tag.php')), 'servicescatalog' => array('title' => PluginMonitoringServicescatalog::getTypeName(), 'page' => PluginMonitoringServicescatalog::getSearchURL(false), 'links' => array($main_menu => '/plugins/monitoring/front/menu.php', 'search' => '/plugins/monitoring/front/servicescatalog.php', 'add' => '/plugins/monitoring/front/servicescatalog.form.php')), 'weathermap' => array('title' => PluginMonitoringWeathermap::getTypeName(), 'page' => PluginMonitoringWeathermap::getSearchURL(false), 'links' => array($main_menu => '/plugins/monitoring/front/menu.php', 'search' => '/plugins/monitoring/front/weathermap.php', 'add' => '/plugins/monitoring/front/weathermap.form.php')), 'displayview' => array('title' => PluginMonitoringDisplayview::getTypeName(), 'page' => PluginMonitoringDisplayview::getSearchURL(false), 'links' => array('search' => '/plugins/monitoring/front/displayview.php', 'add' => '/plugins/monitoring/front/displayview.form.php')), 'slider' => array('title' => PluginMonitoringSlider::getTypeName(), 'page' => PluginMonitoringSlider::getSearchURL(false), 'links' => array($main_menu => '/plugins/monitoring/front/menu.php', 'search' => '/plugins/monitoring/front/slider.php', 'add' => '/plugins/monitoring/front/slider.form.php')), 'downtime' => array('title' => PluginMonitoringDowntime::getTypeName(), 'page' => PluginMonitoringDowntime::getSearchURL(false), 'links' => array('search' => '/plugins/monitoring/front/downtime.php')), 'acknowledge' => array('title' => PluginMonitoringAcknowledge::getTypeName(), 'page' => PluginMonitoringAcknowledge::getSearchURL(false), 'links' => array('search' => '/plugins/monitoring/front/acknowledge.php')), 'menu' => array('title' => PluginMonitoringMenu::getTypeName(), 'links' => array($main_menu => '/plugins/monitoring/front/menu.php', 'config' => '/plugins/monitoring/front/config.form.php')), 'dashboard' => array('title' => PluginMonitoringDisplay::getTypeName(), 'links' => array($main_menu => '/plugins/monitoring/front/menu.php', 'config' => '/plugins/monitoring/front/config.form.php')), 'config' => array('title' => PluginMonitoringConfig::getTypeName(), 'links' => array($main_menu => '/plugins/monitoring/front/menu.php')));
 }