/**
    * 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;
   }
  @author    David Durieux
  @co-author
  @comment
  @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     2013

  ------------------------------------------------------------------------
*/
include "../../../inc/includes.php";
Session::checkCentralAccess();
Html::header(__('Monitoring - unavailabilities', 'monitoring'), $_SERVER["PHP_SELF"], "plugins", "monitoring", "unavailability");
// if (isset($_GET['contains'])) {
// $pmUnavailability = new PluginMonitoringUnavailability();
// $pmUnavailability->showList($_GET);
// }
if (isset($_GET['component_catalog_id'])) {
    $pmUnavailability = new PluginMonitoringUnavailability();
    $pmUnavailability->displayComponentscatalog($_GET['component_catalog_id']);
}
// forceUpdate request parameter is to force an update ...
if (isset($_GET['forceUpdate'])) {
    // A services_id may be specified as a parameter ...
    // Default services_id is 0 for all services
    // start and limit may also be specified, defaults are 0 / 100
    PluginMonitoringUnavailability::runUnavailability(isset($_GET['services_id']) ? $_GET['services_id'] : 0, isset($_GET['start']) ? $_GET['start'] : 0, isset($_GET['limit']) ? $_GET['limit'] : 100);
}
Search::show('PluginMonitoringUnavailability');
Html::footer();