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));
     }
 }
Exemplo n.º 2
0
   static function displayTabContentForItem(CommonGLPI $item, $tabnum=1, $withtemplate=0) {

      if ($item->getType() == 'PluginMonitoringSlider') {
         switch($tabnum) {

            case 1:
               $pmSlider_item = new PluginMonitoringSlider_item();
               $pmSlider_item->view($item->getID(), 1);
               break;

            case 2 :
               $item->showVisibility();
               break;

         }
      } else if ($item->getType() == 'Central') {
         if (Session::haveRight("plugin_monitoring_slider", PluginMonitoringSlider::HOMEPAGE)) {
            $pmSlider_item = new PluginMonitoringSlider_item();
            $pmSlider = new PluginMonitoringSlider();
            $a_sliders = $pmSlider->getSliders(1);
            foreach ($a_sliders as $sliders_id=>$name) {
               $pmSlider->getFromDB($sliders_id);
               if ($pmSlider->haveVisibilityAccess()) {
                  $pmSlider_item->view($sliders_id);
              }
            }
         }
      }

      return true;
   }
  @copyright Copyright (c) 2011-2014 Plugin Monitoring for GLPI team
  @license   AGPL License 3.0 or (at your option) any later version
             http://www.gnu.org/licenses/agpl-3.0-standalone.html
  @link      https://forge.indepnet.net/projects/monitoring/
  @since     2014

  ------------------------------------------------------------------------
*/
include "../../../inc/includes.php";
Session::checkCentralAccess();
Html::header(__('Monitoring', 'monitoring'), $_SERVER["PHP_SELF"], "plugins", "monitoring", "display");
$pmDisplay = new PluginMonitoringDisplay();
$pmSlider = new PluginMonitoringSlider();
$pmMessage = new PluginMonitoringMessage();
$pmMessage->getMessages();
$pmDisplay->menu();
$pass = 0;
$a_sliders = $pmSlider->getSliders();
if (isset($a_views[$_GET['id']])) {
    $pmSlider->getFromDB($_GET['id']);
    $pass = $pmSlider->haveVisibilityAccess();
}
if ($pass == 0) {
    Session::checkRight("plugin_monitoring_slider", READ);
}
if (isset($a_sliders[$_GET['id']])) {
    $pmSlider->slideSlider($_GET['id']);
} else {
    Html::displayRightError();
}
Html::footer();