static function displayLine($data, $displayhost = 1, $displayCounters = 0, $displayGraphs = true)
 {
     global $CFG_GLPI;
     $pMonitoringService = new PluginMonitoringService();
     $pMonitoringService->getFromDB($data['id']);
     $pMonitoringComponent = new PluginMonitoringComponent();
     $pMonitoringComponent->getFromDB($data[1][0]['id']);
     $networkPort = new NetworkPort();
     // If host is acknowledged, force service to be displayed as unknown acknowledged.
     if (isset($data[7][0]['name']) && $data[7][0]['name']) {
         $shortstate = 'yellowblue';
         $data['state'] = 'UNKNOWN';
     } else {
         $shortstate = PluginMonitoringHost::getState($data[2]['displayname'], $data[3]['displayname'], $data[5]['displayname'], $pMonitoringService->isCurrentlyAcknowledged());
     }
     $timezone = '0';
     if (isset($_SESSION['plugin_monitoring_timezone'])) {
         $timezone = $_SESSION['plugin_monitoring_timezone'];
     }
     if ($displayGraphs) {
         if (!isset($_SESSION['plugin_monitoring_reduced_interface']) || !$_SESSION['plugin_monitoring_reduced_interface']) {
             echo "<td class='center'>";
             // Even if not exist incremental perfdata ...
             if ($pMonitoringComponent->hasPerfdata()) {
                 echo "<a href='" . $CFG_GLPI['root_doc'] . "/plugins/monitoring/front/display.form.php?itemtype=PluginMonitoringService&items_id=" . $data['id'] . "'>";
                 ob_start();
                 $pmServicegraph = new PluginMonitoringServicegraph();
                 $pmServicegraph->displayGraph($pMonitoringComponent->fields['graph_template'], "PluginMonitoringService", $data['id'], "0", '2h', "div", "600");
                 $div = ob_get_contents();
                 ob_end_clean();
                 $chart = "<table width='600' class='tab_cadre'><tr><td>" . $div . "</td></tr></table>";
                 $qtip = Html::showToolTip($chart, array('img' => $CFG_GLPI['root_doc'] . "/plugins/monitoring/pics/stats_32.png' width='26' height='32'", 'display' => false));
                 $qtip = str_replace('qtip-shadow qtip-bootstrap', 'qtip-shadow qtip-bootstrap qtip-monitoring', $qtip);
                 echo $qtip;
                 $pmServicegraph->displayGraph($pMonitoringComponent->fields['graph_template'], "PluginMonitoringService", $data['id'], "0", '2h', "js");
                 echo "</a>";
             }
             echo "</td>";
         }
     }
     if ($displayhost) {
         $pmComponentscatalog_Host = new PluginMonitoringComponentscatalog_Host();
         $pmComponentscatalog_Host->getFromDB($data[10]["displayname"]);
         if (isset($pmComponentscatalog_Host->fields['itemtype']) and $pmComponentscatalog_Host->fields['itemtype'] != '') {
             echo "<td>";
             $itemtype = $pmComponentscatalog_Host->fields['itemtype'];
             $item = new $itemtype();
             $item->getFromDB($pmComponentscatalog_Host->fields['items_id']);
             // echo "<span>".$item->getLink(array ("monitoring" => "1"))."</span>&nbsp;";
             if (!is_null($pMonitoringService->fields['networkports_id']) and $pMonitoringService->fields['networkports_id'] > 0) {
                 $networkPort->getFromDB($pMonitoringService->fields['networkports_id']);
                 echo "[" . $networkPort->getLink() . "] ";
             }
             $pm_Host = new PluginMonitoringHost();
             $pm_Host->getFromDB($pMonitoringService->getHostID());
             echo "<span>" . $pm_Host->getLink(array("monitoring" => "1")) . "</span>";
             echo "</td>";
         } else {
             echo "<td>" . __('Resources', 'monitoring') . "</td>";
         }
     }
     echo "<td>";
     if (Session::haveRight("plugin_monitoring_component", READ)) {
         echo $pMonitoringComponent->getLink();
     } else {
         echo $pMonitoringComponent->getName();
     }
     if (!is_null($pMonitoringService->fields['networkports_id']) and $pMonitoringService->fields['networkports_id'] > 0) {
         $networkPort->getFromDB($pMonitoringService->fields['networkports_id']);
         echo " [" . $networkPort->getLink() . "]";
     }
     echo "</td>";
     if ($displayCounters) {
         $ar_counters = $pMonitoringComponent->hasCounters();
         // Toolbox::logInFile("pm", "Counters : ".serialize($ar_counters)."\n");
         if (is_array($ar_counters)) {
             $pmServicegraph = new PluginMonitoringServicegraph();
             foreach ($ar_counters as $counter => $counter_title) {
                 PluginMonitoringDisplay::$ar_counterTypes[$counter] = $counter_title;
                 $html = $pmServicegraph->displayCounter($pMonitoringComponent->fields['graph_template'], $data['id'], false, $counter, $counter_title);
                 echo "<td class='center'>{$html}</td>";
             }
         }
     } else {
         echo "<td class='center page foldtl resource" . $data[2]['displayname'] . " resource" . $data[3]['displayname'] . "'>";
         echo "<div class=''>";
         echo "<div>";
         echo $data[2]['displayname'];
         echo "</div>";
         echo "</div>";
         echo "</td>";
         echo "<td>";
         echo Html::convDate($data[4]['displayname']) . ' ' . substr($data[4]['displayname'], 11, 8);
         echo "</td>";
         echo "<td>";
         echo $data[5]['displayname'];
         echo "</td>";
         echo "<td align='center'>";
         $segments = CalendarSegment::getSegmentsBetween($pMonitoringComponent->fields['calendars_id'], date('w', date('U')), date('H:i:s'), date('w', date('U')), date('H:i:s'));
         if (count($segments) == '0') {
             echo "<img src='" . $CFG_GLPI['root_doc'] . "/plugins/monitoring/pics/service_pause.png' />";
         } else {
             echo "<img src='" . $CFG_GLPI['root_doc'] . "/plugins/monitoring/pics/service_run.png' />";
         }
         echo "</td>";
         if (!$displayhost) {
             $pmUnavailability = new PluginMonitoringUnavailability();
             $pmUnavailability->displayValues($pMonitoringService->fields['id'], 'currentmonth', 1);
             $pmUnavailability->displayValues($pMonitoringService->fields['id'], 'lastmonth', 1);
             $pmUnavailability->displayValues($pMonitoringService->fields['id'], 'currentyear', 1);
             echo "<td class='center'>";
             echo "<a href='" . $CFG_GLPI['root_doc'] . "/plugins/monitoring/front/unavailability.php?" . "&criteria[0][field]=2" . "&criteria[0][searchtype]=equals" . "&criteria[0][value]=" . $pMonitoringService->fields['id'] . "&itemtype=PluginMonitoringUnavailability" . "&start=0" . "&sort=1" . "&order=DESC'>\n               <img src='" . $CFG_GLPI['root_doc'] . "/plugins/monitoring/pics/info.png'/></a>";
             echo "</td>";
         }
         if (Session::haveRight("plugin_monitoring_acknowledge", READ)) {
             echo "<td>";
             if ($pMonitoringService->isCurrentlyAcknowledged()) {
                 if (Session::haveRight("plugin_monitoring_acknowledge", CREATE)) {
                     echo "<span>";
                     echo "<a href='" . $CFG_GLPI['root_doc'] . "/plugins/monitoring/front/acknowledge.form.php?itemtype=Service&items_id=" . $data['id'] . "'>" . "<img src='" . $CFG_GLPI['root_doc'] . "/plugins/monitoring/pics/acknowledge_ok.png'" . " alt='" . htmlspecialchars(__('Modify acknowledge comment for the service', 'monitoring'), ENT_QUOTES) . "'" . " title='" . htmlspecialchars(__('Modify acknowledge comment for the service', 'monitoring'), ENT_QUOTES) . "'" . " width='25' height='20'/>" . "</a>";
                     echo "&nbsp;&nbsp;</span>";
                 } else {
                     echo "<span>";
                     echo "<img src='" . $CFG_GLPI['root_doc'] . "/plugins/monitoring/pics/acknowledge_ok.png'" . " alt='" . htmlspecialchars(__('Service problem has been acknowledged', 'monitoring'), ENT_QUOTES) . "'" . " title='" . htmlspecialchars(__('Service problem has been acknowledged', 'monitoring'), ENT_QUOTES) . "'" . " width='25' height='20'/>";
                     echo "&nbsp;&nbsp;</span>";
                 }
                 // Display acknowledge data ...
                 $pMonitoringService->getAcknowledge();
             } else {
                 if ($shortstate == 'red' || $shortstate == 'yellow' || $shortstate == 'orange' || !empty($data['host_services_state_list'])) {
                     if (Session::haveRight("plugin_monitoring_acknowledge", CREATE)) {
                         echo "<span>";
                         echo "<a href='" . $CFG_GLPI['root_doc'] . "/plugins/monitoring/front/acknowledge.form.php?itemtype=Service&items_id=" . $data['id'] . "'>" . "<img src='" . $CFG_GLPI['root_doc'] . "/plugins/monitoring/pics/acknowledge_ko.png'" . " alt='" . htmlspecialchars(__('Add an acknowledge for the service', 'monitoring'), ENT_QUOTES) . "'" . " title='" . htmlspecialchars(__('Add an acknowledge for the service', 'monitoring'), ENT_QUOTES) . "'" . " width='25' height='20'/>" . "</a>";
                         echo "&nbsp;&nbsp;</span>";
                     }
                 }
             }
             echo "</td>";
         }
     }
     if ($displayhost == '0') {
         echo "<td>";
         if (Session::haveRight("plugin_monitoring_componentscatalog", UPDATE)) {
             if ($pMonitoringComponent->fields['remotesystem'] == 'nrpe' && $pMonitoringComponent->fields['is_arguments'] == 0) {
                 echo __('Managed by NRPE', 'monitoring');
             } else {
                 $a_arg = importArrayFromDB($pMonitoringService->fields['arguments']);
                 $cnt = '';
                 if (count($a_arg) > 0) {
                     $cnt = " (" . count($a_arg) . ")";
                 }
                 echo "<a href='" . $CFG_GLPI['root_doc'] . "/plugins/monitoring/front/servicearg.form.php?id=" . $data['id'] . "'>" . __('Configure', 'monitoring') . $cnt . "</a>";
             }
         }
         echo "</td>";
     }
 }