/**
    * Display content of tab
    *
    * @param CommonGLPI $item
    * @param integer $tabnum
    * @param interger $withtemplate
    *
    * @return boolean true
    */
   static function displayTabContentForItem(CommonGLPI $item, $tabnum=1, $withtemplate=0) {

      switch ($item->getType()) {
         case 'Central' :
            $pmDisplay = new PluginMonitoringDisplay();
            $pmComponentscatalog = new PluginMonitoringComponentscatalog();
            // $pmDisplay->showCounters("Componentscatalog");
            $pmComponentscatalog->showChecks();
            return true;

      }
      if ($item->getID() > 0) {
         switch($tabnum) {

            case 1:
               $pmComponentscatalog_Component = new PluginMonitoringComponentscatalog_Component();
               $pmComponentscatalog_Component->showComponents($item->getID());
               break;

            case 2 :
               $pmComponentscatalog_Host = new PluginMonitoringComponentscatalog_Host();
               $pmComponentscatalog_Host->showHosts($item->getID(), 1);
               break;

            case 3 :
               $pmComponentscatalog_rule = new PluginMonitoringComponentscatalog_rule();
               $pmComponentscatalog_rule->showRules($item->getID());
               break;

            case 4 :
               $pmComponentscatalog_Host = new PluginMonitoringComponentscatalog_Host();
               $pmComponentscatalog_Host->showHosts($item->getID(), 0);
               break;

            case 5 :
               $pmContact_Item = new PluginMonitoringContact_Item();
               $pmContact_Item->showContacts("PluginMonitoringComponentscatalog", $item->getID());
               break;

            case 6:
               $pmUnavailability = new PluginMonitoringUnavailability();
               $pmUnavailability->displayComponentscatalog($item->getID());
               break;

            case 7:
               $pmPluginMonitoringComponentscatalog = new PluginMonitoringComponentscatalog();
               $pmPluginMonitoringComponentscatalog->showSimpleReport($item->getID());
               break;

            case 8:
               $pmPluginMonitoringComponentscatalog = new PluginMonitoringComponentscatalog();
               $pmPluginMonitoringComponentscatalog->showSyntheseReport($item->getID());
               break;


            default :

         }

      }
      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     2011

  ------------------------------------------------------------------------
*/
include "../../../inc/includes.php";
Session::checkCentralAccess();
Html::header(__('Monitoring - dashboard (components catalogs)', 'monitoring'), $_SERVER["PHP_SELF"], "plugins", "PluginMonitoringDashboard", "dashboard");
// Display ressources perfdata ?
if (isset($_SESSION['plugin_monitoring']['ressources_perfdata'])) {
    unset($_SESSION['plugin_monitoring']['ressources_perfdata']);
}
// Reduced or normal interface ?
if (!isset($_SESSION['plugin_monitoring_reduced_interface'])) {
    $_SESSION['plugin_monitoring_reduced_interface'] = false;
}
if (isset($_POST['reduced_interface'])) {
    $_SESSION['plugin_monitoring_reduced_interface'] = $_POST['reduced_interface'];
}
$pmDisplay = new PluginMonitoringDisplay();
$pmMessage = new PluginMonitoringMessage();
$pmMessage->getMessages();
$pmDisplay->menu();
$pmDisplay->refreshPage(TRUE);
$pmDisplay->showCounters("Componentscatalog");
$pmComponentscatalog = new PluginMonitoringComponentscatalog();
$pmComponentscatalog->showChecks($_SESSION['plugin_monitoring_reduced_interface']);
Html::footer();
$pmDisplay = new PluginMonitoringDisplay();
$pmBusinessrule = new PluginMonitoringBusinessrule();
$pmDisplayview = new PluginMonitoringDisplayview();
$a_views = $pmDisplayview->getViews();
switch ($_REQUEST['glpi_tab']) {
    case -1:
        break;
    case 1:
        $pmServicescatalog = new PluginMonitoringServicescatalog();
        $pmDisplay->displayCounters("Businessrules");
        $pmServicescatalog->showBAChecks();
        break;
    case 2:
        $pmComponentscatalog = new PluginMonitoringComponentscatalog();
        $pmDisplay->displayCounters("Componentscatalog");
        $pmComponentscatalog->showChecks();
        break;
    case 3:
        $pmDisplay->displayCounters("Ressources");
        // Manage search
        $_GET = $_SESSION['plugin_monitoring']['service'];
        if (isset($_GET['reset'])) {
            unset($_SESSION['glpisearch']['PluginMonitoringService']);
        }
        if (isset($_GET['glpi_tab'])) {
            unset($_GET['glpi_tab']);
        }
        Search::manageGetValues("PluginMonitoringService");
        Search::showGenericSearch("PluginMonitoringService", $_GET);
        $_SESSION['plugin_monitoring']['service'] = $_GET;
        $pmDisplay->showBoard(950);