function menu($refreshtype = '') { global $CFG_GLPI; $redirect = FALSE; $a_url = array(); /* Moke-up for user's preferences ... if (PluginMonitoringProfile::haveRight("preferences", 'r')) { echo "<table class='tab_cadre_fixe' style='width: 120px; position: absolute; right: 15px;'>"; echo "<tr class='tab_bg_1'>"; echo "<td>"; echo "<button><a href='".$CFG_GLPI['root_doc']."/plugins/monitoring/front/restartshinken.form.php'>".__('Restart Shinken', 'monitoring')."</a></button>"; echo "</td>"; echo "</tr>"; echo "</table>"; } */ echo "<table class='tab_cadre_fixe' width='950'>"; echo "<tr class='tab_bg_3'>"; echo "<td>"; $this->restartShinken(); if (Session::haveRight("plugin_monitoring_systemstatus", PluginMonitoringSystem::DASHBOARD) || Session::haveRight("plugin_monitoring_hoststatus", PluginMonitoringHost::DASHBOARD) || Session::haveRight("plugin_monitoring_servicescatalog", PluginMonitoringService::DASHBOARD) || Session::haveRight("plugin_monitoring_componentscatalog", PluginMonitoringComponentscatalog::DASHBOARD) || Session::haveRight("plugin_monitoring_service", PluginMonitoringService::DASHBOARD)) { echo "<table class='tab_cadre_fixe'>"; echo "<tr class='tab_bg_1'>"; if (Session::haveRight("plugin_monitoring_systemstatus", PluginMonitoringSystem::DASHBOARD)) { echo "<th colspan='2'>"; $this->displayPuce('display_system_status'); echo "<a href='" . $CFG_GLPI['root_doc'] . "/plugins/monitoring/front/display_system_status.php'>"; echo __('System status', 'monitoring'); echo "</a>"; $pmTag = new PluginMonitoringTag(); $servers = 'OK'; if (!$pmTag->get_servers_status()) { $servers = 'CRITICAL'; } echo "<div class='service service" . $servers . "' style='float : left;'></div>"; $a_url[] = $CFG_GLPI['root_doc'] . "/plugins/monitoring/front/display_system_status.php"; echo "</th>"; } else { if (basename($_SERVER['PHP_SELF']) == 'display_system_status.php') { $redirect = TRUE; } } if (Session::haveRight("plugin_monitoring_hoststatus", PluginMonitoringHost::DASHBOARD)) { echo "<th colspan='2'>"; $this->displayPuce('host'); echo "<a href='" . $CFG_GLPI['root_doc'] . "/plugins/monitoring/front/host.php'>"; echo __('Hosts status', 'monitoring'); echo "</a>"; $a_url[] = $CFG_GLPI['root_doc'] . "/plugins/monitoring/front/host.php"; echo "</th>"; } else { if (basename($_SERVER['PHP_SELF']) == 'host.php') { $redirect = TRUE; } } if (Session::haveRight("plugin_monitoring_servicescatalog", PluginMonitoringService::DASHBOARD)) { echo "<th colspan='2'>"; $this->displayPuce('service'); echo "<a href='" . $CFG_GLPI['root_doc'] . "/plugins/monitoring/front/service.php'>"; echo __('All resources', 'monitoring'); echo "</a>"; $a_url[] = $CFG_GLPI['root_doc'] . "/plugins/monitoring/front/service.php"; echo "</th>"; } else { if (basename($_SERVER['PHP_SELF']) == 'service.php') { $redirect = TRUE; } } if (Session::haveRight("plugin_monitoring_service", PluginMonitoringService::DASHBOARD)) { echo "<th colspan='2'>"; $this->displayPuce('perfdatas'); echo "<a href='" . $CFG_GLPI['root_doc'] . "/plugins/monitoring/front/perfdatas.php'>"; echo __('Performance data', 'monitoring'); echo "</a>"; $a_url[] = $CFG_GLPI['root_doc'] . "/plugins/monitoring/front/perfdatas.php"; echo "</th>"; } else { if (basename($_SERVER['PHP_SELF']) == 'perfdatas.php') { $redirect = TRUE; } } if (Session::haveRight("plugin_monitoring_servicescatalog", PluginMonitoringService::DASHBOARD)) { echo "<th colspan='2'>"; $this->displayPuce('display_servicescatalog'); echo "<a href='" . $CFG_GLPI['root_doc'] . "/plugins/monitoring/front/display_servicescatalog.php'>"; echo __('Services catalogs', 'monitoring'); echo "</a>"; $a_url[] = $CFG_GLPI['root_doc'] . "/plugins/monitoring/front/display_servicescatalog.php"; echo "</th>"; } else { if (basename($_SERVER['PHP_SELF']) == 'display_servicescatalog.php') { $redirect = TRUE; } } if (Session::haveRight("plugin_monitoring_componentscatalog", PluginMonitoringComponentscatalog::DASHBOARD)) { echo "<th colspan='2'>"; $this->displayPuce('display_componentscatalog'); echo "<a href='" . $CFG_GLPI['root_doc'] . "/plugins/monitoring/front/display_componentscatalog.php'>"; echo __('Components catalogs', 'monitoring'); echo "</a>"; $a_url[] = $CFG_GLPI['root_doc'] . "/plugins/monitoring/front/display_componentscatalog.php"; echo "</th>"; } else { if (basename($_SERVER['PHP_SELF']) == 'display_componentscatalog.php') { $redirect = TRUE; } } echo "</tr>"; echo "</table>"; if (Session::haveRight("plugin_monitoring_acknowledge", READ) || Session::haveRight("plugin_monitoring_downtime", READ)) { echo "<table class='tab_cadre_fixe'>"; echo "<tr class='tab_bg_1'>"; echo "<th>"; echo "<a href='" . $CFG_GLPI['root_doc'] . "/plugins/monitoring/front/downtime.php'>" . __('Downtimes', 'monitoring') . "</a>"; echo "</th>"; echo "<th>"; echo "<a href='" . $CFG_GLPI['root_doc'] . "/plugins/monitoring/front/acknowledge.php'>" . __('Acknowledges', 'monitoring') . "</a>"; echo "</th>"; echo "</tr>"; echo "</table>"; } } else { if (basename($_SERVER['PHP_SELF']) == 'display_servicescatalog.php') { $redirect = TRUE; } else { if (basename($_SERVER['PHP_SELF']) == 'display_componentscatalog.php') { $redirect = TRUE; } else { if (basename($_SERVER['PHP_SELF']) == 'service.php') { $redirect = TRUE; } else { if (basename($_SERVER['PHP_SELF']) == 'host.php') { $redirect = TRUE; } } } } } if (Session::haveRight("plugin_monitoring_displayview", PluginMonitoringDisplayview::DASHBOARD)) { $i = 1; $pmDisplayview = new PluginMonitoringDisplayview(); $a_views = $pmDisplayview->getViews(); if (count($a_views) > 0) { echo "<table class='tab_cadre_fixe' width='950'>"; echo "<tr class='tab_bg_1'>"; foreach ($a_views as $views_id => $name) { $pmDisplayview->getFromDB($views_id); if ($pmDisplayview->haveVisibilityAccess()) { if ($i == 6) { echo "</tr>"; echo "<tr class='tab_bg_1'>"; $i = 1; } echo "<th width='20%'>"; $this->displayPuce('display_view', $views_id); echo "<a href='" . $CFG_GLPI['root_doc'] . "/plugins/monitoring/front/display_view.php?id=" . $views_id . "'>"; echo htmlentities($name); echo "</a>"; echo "</th>"; $i++; $a_url[] = $CFG_GLPI['root_doc'] . "/plugins/monitoring/front/display_view.php?id=" . $views_id; } } // Fred : what is it for ? // It's to finish properly the table for ($i; $i < 6; $i++) { echo "<td width='20%'>"; echo "</td>"; } echo "</tr>"; echo "</table>"; } } if (Session::haveRight("plugin_monitoring_slider", PluginMonitoringSlider::DASHBOARD)) { $i = 1; $pmSlider = new PluginMonitoringSlider(); $a_sliders = $pmSlider->getSliders(); if (count($a_sliders) > 0) { echo "<table class='tab_cadre_fixe' width='950'>"; echo "<tr class='tab_bg_1'>"; foreach ($a_sliders as $sliders_id => $name) { $pmSlider->getFromDB($sliders_id); if ($pmSlider->haveVisibilityAccess()) { if ($i == 6) { echo "</tr>"; echo "<tr class='tab_bg_1'>"; $i = 1; } echo "<th width='20%'>"; $this->displayPuce('slider', $sliders_id); echo "<a href='" . $CFG_GLPI['root_doc'] . "/plugins/monitoring/front/display_slider.php?id=" . $sliders_id . "'>"; echo htmlentities($name); echo "</a>"; echo "</th>"; $i++; $a_url[] = $CFG_GLPI['root_doc'] . "/plugins/monitoring/front/display_slider.php?id=" . $sliders_id; } } for ($i; $i < 6; $i++) { echo "<td width='20%'>"; echo "</td>"; } echo "</tr>"; echo "</table>"; } } if ($refreshtype == 'service') { $this->refreshPage(); } echo "</td>"; echo "</tr>"; echo "</table>"; if ($redirect) { Html::redirect(array_shift($a_url)); } }