static function displayTabContentForItem(CommonGLPI $item, $tabnum = 1, $withtemplate = 0)
 {
     if ($tabnum == 49) {
         $pmServicescatalog = new PluginMonitoringServicescatalog();
         $pmDisplay = new PluginMonitoringDisplay();
         $pmDisplay->showCounters("Businessrules");
         $pmServicescatalog->showChecks();
     }
     return true;
 }
   Html::redirect($CFG_GLPI['root_doc']."/plugins/monitoring/front/perfdatas.php");
   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('service');
$pmDisplay->showCounters("Ressources", 1, 0);
// Manage search
if (isset($_SESSION['plugin_monitoring']['service'])) {
    $_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");
//$_GET = Search::prepareDatasForSearch("PluginMonitoringService", $_GET);
if (isset($_GET['hidesearch'])) {
    echo "<table class='tab_cadre_fixe'>";
    echo "<tr class='tab_bg_1'>";
 function view($id, $config = 0)
 {
     global $DB, $CFG_GLPI;
     $pmDisplayview = new PluginMonitoringDisplayview();
     $pmDisplayview_rule = new PluginMonitoringDisplayview_rule();
     $pmDisplayview->getFromDB($id);
     echo "<script type='text/javascript'>\n            function fittext(itemid) {\n               document.getElementById(itemid).style.fontSize = '50px';\n               var fontsize = 50;\n               while(document.getElementById(itemid).offsetWidth > 120) {\n                  fontsize--;\n                  if (fontsize > 20) {\n                     fontsize--;\n                  }\n                  document.getElementById(itemid).style.fontSize = fontsize + 'px';\n               }\n               while(document.getElementById(itemid).offsetHeight > 67) {\n                  fontsize--;\n                  document.getElementById(itemid).style.fontSize = fontsize + 'px';\n               }\n               if (fontsize > 30) {\n                  document.getElementById(itemid).style.fontSize = '30px';\n               }\n               if (fontsize < 7) {\n                  document.getElementById(itemid).style.fontSize = '7px';\n               }\n            }\n         </script>";
     PluginMonitoringServicegraph::loadLib();
     if ($config == '1') {
         $this->addItem($id);
         $pmDisplayview_rule->showReplayRulesForm($id);
         echo "<div id='updatecoordonates'></div>";
     } else {
         if (!is_null($pmDisplayview->fields['counter'])) {
             $pmDisplay = new PluginMonitoringDisplay();
             $pmDisplay->showCounters($pmDisplayview->fields['counter']);
         }
     }
     echo "<table class='tab_cadre_fixe' id='test' style='width:" . $pmDisplayview->fields['width'] . "px'>";
     echo "<tr class='tab_bg_1'>";
     echo "<th>";
     echo $pmDisplayview->fields['name'];
     echo "</th>";
     echo "</tr>";
     echo "<tr class='tab_bg_1'>";
     echo "<th>";
     echo "<a onClick='Ext.get(\"date_text\").toggle();Ext.get(\"date_select\").toggle();" . "Ext.get(\"time_text\").toggle();Ext.get(\"time_select\").toggle();'>\n      <img src='" . $CFG_GLPI["root_doc"] . "/pics/deplier_down.png' />&nbsp;\n         " . __('Date and time select', 'monitoring') . "\n      &nbsp;<img src='" . $CFG_GLPI["root_doc"] . "/pics/deplier_down.png' /></a>";
     echo "</th>";
     echo "</tr>";
     echo "<tr class='tab_bg_1' id='date_text' style='display: none;'>";
     echo "<th>";
     echo __('Select date', 'monitoring');
     echo "</th>";
     echo "</tr>";
     echo "<tr class='tab_bg_1' id='date_select' style='display: none;'>";
     echo "<td>";
     $query = "SELECT * FROM `glpi_plugin_monitoring_displayviews_items`\n         WHERE `plugin_monitoring_displayviews_id`='" . $id . "'\n            AND `itemtype`='PluginMonitoringService'";
     $result = $DB->query($query);
     $a_items = array();
     $end = time();
     $start = time();
     $pmComponent = new PluginMonitoringComponent();
     while ($data = $DB->fetch_array($result)) {
         $itemtype = $data['itemtype'];
         $item = new $itemtype();
         $item->getFromDB($data['items_id']);
         if (isset($item->fields['plugin_monitoring_components_id'])) {
             $oldvalue = current(getAllDatasFromTable('glpi_plugin_monitoring_serviceevents', "`plugin_monitoring_services_id`='" . $data['items_id'] . "'", false, 'date ASC LIMIT 1'));
             $date = new DateTime($oldvalue['date']);
             if ($date->getTimestamp() < $start) {
                 $start = $date->getTimestamp();
             }
             $pmComponent->getFromDB($item->fields['plugin_monitoring_components_id']);
             $a_items["item" . $data['id']] = array('rrdtool_template' => $pmComponent->fields['graph_template'], 'itemtype' => $data['itemtype'], 'items_id' => $data['items_id'], 'timezone' => 0, 'time' => $data['extra_infos'], 'pmComponents_id' => $pmComponent->fields['id']);
         }
     }
     echo "\n<script type=\"text/javascript\">\n\nExt.onReady(function(){\n\n    var tip = new Ext.slider.Tip({\n        getText: function(thumb){\n            return String.format('<b> ' + new Date(thumb.value * 1000).format('Y-m-d') + '</b>');\n        }\n    });\n\n    new Ext.Slider({\n        renderTo: 'custom-tip-slider',\n        width: 940,\n        increment: 86400,\n        minValue: " . $start . ",\n        maxValue: " . $end . ",\n        value: " . $end . ",\n        plugins: tip,\n        listeners: {\n            dragend: function(slider, thumb, value){\n               document.getElementById('custom_date').textContent = slider.getValue();\n                  ";
     $pmServicegraph = new PluginMonitoringServicegraph();
     foreach ($a_items as $js_id => $js_data) {
         echo "mgr" . $js_data['items_id'] . $js_data['time'] . ".stopAutoRefresh();\n";
         $pmServicegraph->startAutoRefresh($js_data['rrdtool_template'], $js_data['itemtype'], $js_data['items_id'], $js_data['timezone'], $js_data['time'], $js_data['pmComponents_id']);
     }
     echo "\n            }\n        }\n    });\n\n});\n</script>";
     echo '<center><div id="custom-tip-slider"></div></center>';
     echo "</td>";
     echo "</tr>";
     echo "<tr class='tab_bg_1' id='time_text' style='display: none;'>";
     echo "<th>";
     echo __('Select time', 'monitoring');
     echo "</th>";
     echo "</tr>";
     echo "<tr class='tab_bg_1' id='time_select' style='display: none;'>";
     echo "<td>";
     $start = 0 + 86400 - 3600;
     $end = 86400 + 86400 - 3600 - 300;
     $current = mktime(date('H'), date('i'), 0, 1, 2, 1970);
     echo "\n<script type=\"text/javascript\">\n\nExt.onReady(function(){\n\n   var tiptime = new Ext.slider.Tip({\n        getText: function(thumb){\n            return String.format('<b> ' + new Date(thumb.value * 1000).format('H:i:s') + '</b>');\n        }\n    });\n\n    new Ext.Slider({\n        renderTo: 'custom-tip-slider-time',\n        width: 940,\n        increment: 300,\n        minValue: " . $start . ",\n        maxValue: " . $end . ",\n        value: " . $current . ",\n        plugins: tiptime,\n        listeners: {\n            dragend: function(slider, thumb, value){\n               document.getElementById('custom_time').textContent = slider.getValue();\n                  ";
     $pmServicegraph = new PluginMonitoringServicegraph();
     foreach ($a_items as $js_id => $js_data) {
         echo "mgr" . $js_data['items_id'] . $js_data['time'] . ".stopAutoRefresh();\n";
         $pmServicegraph->startAutoRefresh($js_data['rrdtool_template'], $js_data['itemtype'], $js_data['items_id'], $js_data['timezone'], $js_data['time'], $js_data['pmComponents_id']);
     }
     echo "\n            }\n        }\n    });\n\n});\n</script>";
     echo '<center><div id="custom-tip-slider-time"></div></center>';
     echo "</td>";
     echo "</tr>";
     echo "<tr class='tab_bg_1'>";
     echo "<th>";
     echo __('View', 'monitoring');
     echo "</th>";
     echo "</tr>";
     echo "<tr class='tab_bg_1'>";
     echo "<td>";
     echo "<input type='hidden' name='updateviewid' id='updateviewid' value='" . $id . "' />";
     if ($config == 0) {
         echo "<div id='filariane'>&nbsp;</div>";
         echo "<input type='hidden' name='updatefil' id='updatefil' value='" . $id . "!' />";
         echo "<script type=\"text/javascript\">\n            function reloadfil() {\n               Ext.get('filariane').load({\n                   url: '" . $CFG_GLPI["root_doc"] . "/plugins/monitoring/ajax/updateFilariane.php',\n                   scripts: true,\n                      params:'updatefil=' + Ext.get('updatefil').getValue() + '&id=" . $_GET['id'] . "&currentview=' + Ext.get('updateviewid').getValue()\n               });\n            }\n            reloadfil();\n         </script>";
     }
     echo "</td>";
     echo "</tr>";
     echo "<tr class='tab_bg_1'>";
     echo "<td height='1200' id='panel'>";
     echo '<div id="custom_date" style="display:none"></div>';
     echo '<div id="custom_time" style="display:none"></div>';
     echo "<div id='viewform'>";
     echo "<script type='text/javascript'>\n        \n        //Simple 'border layout' panel to house both grids\n        var displayPanel = new Ext.Panel({\n          id       : 'viewpanel',\n          width    : " . $pmDisplayview->fields['width'] . ",\n          height   : 1200,\n          layout: 'absolute',\n          renderTo : 'panel',\n          items    : []\n        });\n\n      </script>";
     echo "</div>";
     echo "<script type=\"text/javascript\">\n         function reloadview() {\n            Ext.get('viewform').load({\n                url: '" . $CFG_GLPI["root_doc"] . "/plugins/monitoring/ajax/loadView.php',\n                scripts: true,\n                   params:'id=' + Ext.get('updateviewid').getValue() + '&config=" . $config . "'\n            });\n         }\n         reloadview();\n      </script>";
     echo "</td>";
     echo "</tr>";
     echo "</table>";
     echo "<br/>";
 }
  @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();
  ------------------------------------------------------------------------

  @package   Plugin Monitoring for GLPI
  @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     2011

  ------------------------------------------------------------------------
*/
include "../../../inc/includes.php";
Session::checkCentralAccess();
Html::header(__('Monitoring - dashboard (services catalogs)', 'monitoring'), $_SERVER["PHP_SELF"], "plugins", "PluginMonitoringDashboard", "dashboard");
// Reduced or normal interface ?
if (!isset($_SESSION['plugin_monitoring_reduced_interface'])) {
    $_SESSION['plugin_monitoring_reduced_interface'] = false;
}
$pmDisplay = new PluginMonitoringDisplay();
$pmServicescatalog = new PluginMonitoringServicescatalog();
$pmMessage = new PluginMonitoringMessage();
$pmMessage->getMessages();
$pmDisplay->menu();
Session::checkRight("plugin_monitoring_servicescatalog", PluginMonitoringServicescatalog::DASHBOARD);
$pmDisplay->showCounters("Businessrules");
$pmServicescatalog->showChecks($_SESSION['plugin_monitoring_reduced_interface']);
Html::footer();
Beispiel #6
0
function plugin_headings_monitoring_dashboadservicecatalog($item)
{
    $pmServicescatalog = new PluginMonitoringServicescatalog();
    $pmDisplay = new PluginMonitoringDisplay();
    $pmDisplay->showCounters("Businessrules");
    $pmServicescatalog->showChecks();
}
 static function methodDashboard($params, $protocol)
 {
     $array = array();
     if (!isset($params['view'])) {
         return array();
     }
     $pm = new PluginMonitoringDisplay();
     $array = $pm->showCounters($params['view'], 0);
     return $array;
 }
 function view($id, $config = 0)
 {
     global $DB, $CFG_GLPI;
     $pmDisplayview = new PluginMonitoringDisplayview();
     $pmDisplayview_rule = new PluginMonitoringDisplayview_rule();
     $pmDisplayview->getFromDB($id);
     echo "<script type='text/javascript'>\n            function fittext(itemid) {\n               document.getElementById(itemid).style.fontSize = '50px';\n               var fontsize = 50;\n               while(document.getElementById(itemid).offsetWidth > 120) {\n                  fontsize--;\n                  if (fontsize > 20) {\n                     fontsize--;\n                  }\n                  document.getElementById(itemid).style.fontSize = fontsize + 'px';\n               }\n               while(document.getElementById(itemid).offsetHeight > 67) {\n                  fontsize--;\n                  document.getElementById(itemid).style.fontSize = fontsize + 'px';\n               }\n               if (fontsize > 30) {\n                  document.getElementById(itemid).style.fontSize = '30px';\n               }\n               if (fontsize < 7) {\n                  document.getElementById(itemid).style.fontSize = '7px';\n               }\n            }\n         </script>";
     PluginMonitoringToolbox::loadLib();
     $style = '';
     if ($config == '1') {
         $this->addItem($id);
         $pmDisplayview_rule->showReplayRulesForm($id);
         echo "<div id='updatecoordonates'></div>";
         if ($pmDisplayview->fields['width'] > 950) {
             $style = ";position:relative;left:-" . ($pmDisplayview->fields['width'] - 950) / 2 . "px";
         }
     } else {
         if (!is_null($pmDisplayview->fields['counter'])) {
             $pmDisplay = new PluginMonitoringDisplay();
             $pmDisplay->showCounters($pmDisplayview->fields['counter']);
         }
     }
     echo "<table class='tab_cadre_fixe' id='test' style='width:" . $pmDisplayview->fields['width'] . "px" . $style . "'>";
     echo "<tr class='tab_bg_1'>";
     echo "<th>";
     echo $pmDisplayview->fields['name'];
     echo "</th>";
     echo "</tr>";
     echo "<tr class='tab_bg_1' id='date_text'>";
     echo "<th>";
     echo __('Select date', 'monitoring') . " - " . __('Select time', 'monitoring');
     echo "</th>";
     echo "</tr>";
     echo "<tr class='tab_bg_1'>";
     echo "<td>";
     $query = "SELECT * FROM `glpi_plugin_monitoring_displayviews_items`\n         WHERE `plugin_monitoring_displayviews_id`='" . $id . "'\n            AND `itemtype`='PluginMonitoringService'";
     $result = $DB->query($query);
     $a_items = array();
     $end = time();
     $start = time();
     $pmComponent = new PluginMonitoringComponent();
     while ($data = $DB->fetch_array($result)) {
         $itemtype = $data['itemtype'];
         $item = new $itemtype();
         $item->getFromDB($data['items_id']);
         if (isset($item->fields['plugin_monitoring_components_id'])) {
             $oldvalue = current(getAllDatasFromTable('glpi_plugin_monitoring_serviceevents', "`plugin_monitoring_services_id`='" . $data['items_id'] . "'", false, 'date ASC LIMIT 1'));
             $date = new DateTime($oldvalue['date']);
             if ($date->getTimestamp() < $start) {
                 $start = $date->getTimestamp();
             }
             $pmComponent->getFromDB($item->fields['plugin_monitoring_components_id']);
             $a_items["item" . $data['id']] = array('rrdtool_template' => $pmComponent->fields['graph_template'], 'itemtype' => $data['itemtype'], 'items_id' => $data['items_id'], 'timezone' => 0, 'time' => $data['extra_infos'], 'pmComponents_id' => $pmComponent->fields['id']);
         }
     }
     $nbdays = round((date('U') - $start) / 86400);
     echo "<script type=\"text/javascript\">\n      \$(function() {\n          \$( \"#custom_date\" ).datepicker({ minDate: -" . $nbdays . ", maxDate: \"+0D\", dateFormat:'mm/dd/yy' });\n          \$( \"#custom_time\" ).timepicker();\n\n      });\n      </script>";
     echo '<center><input type="text" id="custom_date" value="' . date('m/d/Y') . '"> ' . ' <input type="text" id="custom_time" value="' . date('H:i') . '"></center>';
     echo "</td>";
     echo "</tr>";
     echo "<tr class='tab_bg_1' id='time_text' style='display: none;'>";
     echo "<th>";
     echo __('Select time', 'monitoring');
     echo "</th>";
     echo "</tr>";
     echo "<tr class='tab_bg_1'>";
     echo "<th>";
     echo __('View', 'monitoring');
     echo "</th>";
     echo "</tr>";
     echo "<tr class='tab_bg_1'>";
     echo "<td>";
     echo "<input type='hidden' name='updateviewid' id='updateviewid' value='" . $id . "' />";
     if ($config == 0) {
         echo "<div id='filariane'>&nbsp;</div>";
         echo "<input type='hidden' name='updatefil' id='updatefil' value='" . $id . "!' />";
         echo "<script type=\"text/javascript\">\n            function reloadfil() {\n              \$.get('" . $CFG_GLPI["root_doc"] . "/plugins/monitoring/ajax/updateFilariane.php?updatefil=' + \$('#updatefil').val() + '&id=" . $id . "&currentview=' + \$('#updateviewid').val(), function(data) {\n                \$('#filariane').html(data);\n               });\n            }\n            reloadfil();\n         </script>";
     }
     echo "</td>";
     echo "</tr>";
     echo "<tr class='tab_bg_1'>";
     echo "<td height='1200' id='panel'>";
     echo "<script type=\"text/javascript\">\n           \$.get('" . $CFG_GLPI["root_doc"] . "/plugins/monitoring/ajax/showPanel.php?id=" . $id . "&config=" . $config . "', function(data) {\n             \$('#panel').html(data);\n            });\n      </script>";
     echo "</td>";
     echo "</tr>";
     echo "</table>";
     echo "<br/>";
 }
   function view($id, $config=0) {
      global $DB, $CFG_GLPI;

      $pmDisplayview       = new PluginMonitoringDisplayview();
      $pmDisplayview_rule  = new PluginMonitoringDisplayview_rule();

      $pmDisplayview->getFromDB($id);

         echo "<script type='text/javascript'>
            function fittext(itemid) {
               document.getElementById(itemid).style.fontSize = '50px';
               var fontsize = 50;
               while(document.getElementById(itemid).offsetWidth > 120) {
                  fontsize--;
                  if (fontsize > 20) {
                     fontsize--;
                  }
                  document.getElementById(itemid).style.fontSize = fontsize + 'px';
               }
               while(document.getElementById(itemid).offsetHeight > 67) {
                  fontsize--;
                  document.getElementById(itemid).style.fontSize = fontsize + 'px';
               }
               if (fontsize > 30) {
                  document.getElementById(itemid).style.fontSize = '30px';
               }
               if (fontsize < 7) {
                  document.getElementById(itemid).style.fontSize = '7px';
               }
            }
         </script>";

      PluginMonitoringToolbox::loadLib();

      $style = '';
      if ($config == '1') {
         $this->addItem($id);
         $pmDisplayview_rule->showReplayRulesForm($id);
         echo "<div id='updatecoordonates'></div>";
         if ($pmDisplayview->fields['width'] > 950) {
            $style = ";position:relative;left:-".(($pmDisplayview->fields['width'] - 950) / 2)."px";
         }
      } else {
         if (!is_null($pmDisplayview->fields['counter'])) {
            $pmDisplay = new PluginMonitoringDisplay();
            $pmDisplay->showCounters($pmDisplayview->fields['counter']);
         }
      }

      echo "<table class='tab_cadre_fixe' id='test' style='width:".$pmDisplayview->fields['width']."px".$style."'>";

      echo "<tr class='tab_bg_1'>";
      echo "<th>";

      echo $pmDisplayview->fields['name'];
      echo "</th>";
      echo "</tr>";

      echo "<tr class='tab_bg_1' id='date_text'>";
      echo "<th>";
      echo __('Select date', 'monitoring')." - ".__('Select time', 'monitoring');
      echo "</th>";
      echo "</tr>";

      echo "<tr class='tab_bg_1'>";
      echo "<td>";

      $query = "SELECT * FROM `glpi_plugin_monitoring_displayviews_items`
         WHERE `plugin_monitoring_displayviews_id`='".$id."'
            AND `itemtype`='PluginMonitoringService'";
      $result = $DB->query($query);
      $a_items = array();
      $end = time();
      $start = time();

      $pmComponent = new PluginMonitoringComponent();
      while ($data=$DB->fetch_array($result)) {
         $itemtype = $data['itemtype'];
         $item = new $itemtype();
         $item->getFromDB($data['items_id']);
         if (isset($item->fields['plugin_monitoring_components_id'])) {
            $oldvalue = current(getAllDatasFromTable(
                    'glpi_plugin_monitoring_serviceevents',
                    "`plugin_monitoring_services_id`='".$data['items_id']."'",
                    false,
                    'date ASC LIMIT 1'));
            $date = new DateTime($oldvalue['date']);
            if ($date->getTimestamp() < $start) {
               $start = $date->getTimestamp();
            }
            $pmComponent->getFromDB($item->fields['plugin_monitoring_components_id']);

            $a_items["item".$data['id']] = array(
                'rrdtool_template'  => $pmComponent->fields['graph_template'],
                'itemtype'          => $data['itemtype'],
                'items_id'          => $data['items_id'],
                'timezone'          => 0,
                'time'              => $data['extra_infos'],
                'pmComponents_id'   => $pmComponent->fields['id']
            );
         }
      }
      $nbdays = round((date('U') - $start) / 86400);

      echo "<script type=\"text/javascript\">
      $(function() {
          $( \"#custom_date\" ).datepicker({ minDate: -".$nbdays.", maxDate: \"+0D\", dateFormat:'mm/dd/yy' });
          $( \"#custom_time\" ).timepicker();

      });
      </script>";

      echo '<center><input type="text" id="custom_date" value="'.date('m/d/Y').'"> '
              . ' <input type="text" id="custom_time" value="'.date('H:i').'"></center>';
      echo "</td>";
      echo "</tr>";

     echo "<tr class='tab_bg_1' id='time_text' style='display: none;'>";
      echo "<th>";
      echo __('Select time', 'monitoring');
      echo "</th>";
      echo "</tr>";

      echo "<tr class='tab_bg_1'>";
      echo "<th>";
      echo __('View', 'monitoring');
      echo "</th>";
      echo "</tr>";

      echo "<tr class='tab_bg_1'>";
      echo "<td>";
      echo "<input type='hidden' name='updateviewid' id='updateviewid' value='".$id."' />";
      if ($config == 0) {
         echo "<div id='filariane'>&nbsp;</div>";
         echo "<input type='hidden' name='updatefil' id='updatefil' value='".$id."!' />";

/*
         echo "<script type=\"text/javascript\">
            function reloadfil() {
               Ext.get('filariane').load({
                   url: '".$CFG_GLPI["root_doc"]."/plugins/monitoring/ajax/updateFilariane.php',
                   scripts: true,
                      params:'updatefil=' + Ext.get('updatefil').getValue() + '&id=".$id.
                 "&currentview=' + Ext.get('updateviewid').getValue()
               });
            }
            reloadfil();
         </script>";
 */
      }
      echo "</td>";
      echo "</tr>";


      echo "<tr class='tab_bg_1'>";
      echo "<td height='1200' id='panel'>";

      $queryitems = "SELECT * FROM `glpi_plugin_monitoring_displayviews_items`
         WHERE `plugin_monitoring_displayviews_id`='".$id."'";
      $resultitems = $DB->query($queryitems);
      $a_items = array();
      while ($dataitems=$DB->fetch_array($resultitems)) {
//         if ($this->displayItem($dataitems, $config)) {
            $a_items[] = $dataitems;
//         }
//         }
      }

echo "
<script type=\"text/javascript\">
$(function() {
";


foreach ($a_items as $item) {
   if ($config == '1') {
      $event = ", stop: function() {
           pos = $('#draggable".$item['id']."').position();
           $.get('".$CFG_GLPI["root_doc"]."/plugins/monitoring/ajax/displayview_itemcoordinates.php"
                          ."?id=".$item['id']
                          ."&x=' + pos.left + '&y=' + pos.top);
         }";
   } else {
      $event = '';
   }
   $size = $this->getSizeOfWidget($item['itemtype']);
   echo "$( \"#draggable".$item['id']."\" ).draggable({ cursor: 'move', cursorAt: { "
           . "top: ".($size['height']/2).", left: ".($size['width']/2).", "
           . " }, grid: [ 10, 10 ]".$event." } );";
}
echo "
});
</script>";

      echo "<div id='viewform' style='width: ".$pmDisplayview->fields['width']."px;height:1200px;position: relative;'>";

foreach ($a_items as $item) {
   $size = $this->getSizeOfWidget($item['itemtype']);
   echo '<div id="draggable'.$item['id'].'" ';
   if ($item['itemtype'] != 'PluginMonitoringServicescatalog'
           && $item['itemtype'] != 'PluginMonitoringComponentscatalog') {
      echo 'class="ui-widget-content" ';
   }
   echo  'style="width: '.$size['width'].'px; height: '.$size['height'].'px; '
           . 'position: absolute; left: '.$item['x'].'px; top: '.$item['y'].'px;">';

   if ($item['itemtype'] == 'PluginMonitoringService') {
      $pmComponent = new PluginMonitoringComponent();
      $pmService = new PluginMonitoringService();

      $pmService->getFromDB($item['items_id']);
      $pmComponent->getFromDB($pmService->fields['plugin_monitoring_components_id']);
      $pmServicegraph = new PluginMonitoringServicegraph();
      $pmServicegraph->displayGraph($pmComponent->fields['graph_template'],
                                    "PluginMonitoringService",
                                    $item['items_id'],
                                    "0",
                                    $item['extra_infos'],
                                    "",
                                    ($size['width'] - 15));
   } else if ($item['itemtype'] == 'PluginMonitoringWeathermap') {

   } else {
      echo "<div id=\"update".$item['itemtype'].$item['items_id']."\"></div>";

            echo "<script type=\"text/javascript\">";
            echo "
               (function worker() {
                 $.get('".$CFG_GLPI["root_doc"]."/plugins/monitoring/ajax/updateWidgetComponentscatalog.php"
                       ."?id=".$item['items_id']."&is_minemap=".$item['is_minemap'].
                             "', function(data) {
                   $('#update".$item['itemtype'].$item['items_id']."').html(data);
                   setTimeout(worker, 30000);
                 });
               })();";
            echo "</script>";

   }

   echo '</div>';
}

//      echo "<script type='text/javascript'>
//
//        //Simple 'border layout' panel to house both grids
//        var displayPanel = new Ext.Panel({
//          id       : 'viewpanel',
//          width    : ".$pmDisplayview->fields['width'].",
//          height   : 1200,
//          layout: 'absolute',
//          renderTo : 'panel',
//          items    : []
//        });
//
//      </script>";




      echo "</div>";
//      echo "<script type=\"text/javascript\">
//         function reloadview() {
//            Ext.get('viewform').load({
//                url: '".$CFG_GLPI["root_doc"]."/plugins/monitoring/ajax/loadView.php',
//                scripts: true,
//                   params:'id=' + Ext.get('updateviewid').getValue() + '&config=".$config."'
//            });
//         }
//         reloadview();
//      </script>";

      echo "</td>";
      echo "</tr>";
      echo "</table>";
      echo "<br/>";

   }