PageRenderTime 58ms CodeModel.GetById 12ms RepoModel.GetById 0ms app.codeStats 0ms

/www/include/monitoring/status/Services/serviceSummary.php

https://gitlab.com/florianocomercial/centreon
PHP | 193 lines | 129 code | 23 blank | 41 comment | 7 complexity | 3108f55fa45ab5d715fab821552d72d2 MD5 | raw file
  1. <?php
  2. /*
  3. * Copyright 2005-2015 Centreon
  4. * Centreon is developped by : Julien Mathis and Romain Le Merlus under
  5. * GPL Licence 2.0.
  6. *
  7. * This program is free software; you can redistribute it and/or modify it under
  8. * the terms of the GNU General Public License as published by the Free Software
  9. * Foundation ; either version 2 of the License.
  10. *
  11. * This program is distributed in the hope that it will be useful, but WITHOUT ANY
  12. * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
  13. * PARTICULAR PURPOSE. See the GNU General Public License for more details.
  14. *
  15. * You should have received a copy of the GNU General Public License along with
  16. * this program; if not, see <http://www.gnu.org/licenses>.
  17. *
  18. * Linking this program statically or dynamically with other modules is making a
  19. * combined work based on this program. Thus, the terms and conditions of the GNU
  20. * General Public License cover the whole combination.
  21. *
  22. * As a special exception, the copyright holders of this program give Centreon
  23. * permission to link this program with independent modules to produce an executable,
  24. * regardless of the license terms of these independent modules, and to copy and
  25. * distribute the resulting executable under terms of Centreon choice, provided that
  26. * Centreon also meet, for each linked independent module, the terms and conditions
  27. * of the license of that module. An independent module is a module which is not
  28. * derived from this program. If you modify this program, you may extend this
  29. * exception to your version of the program, but you are not obliged to do so. If you
  30. * do not wish to do so, delete this exception statement from your version.
  31. *
  32. * For more information : contact@centreon.com
  33. *
  34. * SVN : $URL$
  35. * SVN : $Id$
  36. *
  37. */
  38. if (!isset($oreon))
  39. exit();
  40. include("./include/common/autoNumLimit.php");
  41. !isset($_GET["sort_types"]) ? $sort_types = 0 : $sort_types = $_GET["sort_types"];
  42. !isset($_GET["order"]) ? $order = 'ASC' : $order = $_GET["order"];
  43. !isset($_GET["num"]) ? $num = 0 : $num = $_GET["num"];
  44. !isset($_GET["host_search"]) ? $host_search = 0 : $host_search = $_GET["host_search"];
  45. !isset($_GET["search_type_host"]) ? $search_type_host = 1 : $search_type_host = $_GET["search_type_host"];
  46. !isset($_GET["search_type_service"]) ? $search_type_service = 1 : $search_type_service = $_GET["search_type_service"];
  47. !isset($_GET["sort_type"]) ? $sort_type = "host_name" : $sort_type = $_GET["sort_type"];
  48. /*
  49. * Check search value in Host search field
  50. */
  51. if (isset($_GET["host_search"])) {
  52. $centreon->historySearch[$url] = $_GET["host_search"];
  53. }
  54. $tab_class = array("0" => "list_one", "1" => "list_two");
  55. $rows = 10;
  56. include_once("./include/monitoring/status/Common/default_poller.php");
  57. include_once("./include/monitoring/status/Common/default_hostgroups.php");
  58. include_once($svc_path."/serviceSummaryJS.php");
  59. # Smarty template Init
  60. $tpl = new Smarty();
  61. $tpl = initSmartyTpl($svc_path, $tpl, "/templates/");
  62. $tpl->assign("p", $p);
  63. $tpl->assign('o', $o);
  64. $tpl->assign("sort_types", $sort_types);
  65. $tpl->assign("num", $num);
  66. $tpl->assign("limit", $limit);
  67. $tpl->assign("mon_host", _("Hosts"));
  68. $tpl->assign("mon_status", _("Status"));
  69. $tpl->assign("typeDisplay", _("Display"));
  70. $tpl->assign("typeDisplay2", _("Display details"));
  71. $tpl->assign("mon_ip", _("IP"));
  72. $tpl->assign("mon_last_check", _("Last Check"));
  73. $tpl->assign("mon_duration", _("Duration"));
  74. $tpl->assign("mon_status_information", _("Status information"));
  75. $form = new HTML_QuickForm('select_form', 'GET', "?p=".$p);
  76. $tpl->assign("order", strtolower($order));
  77. $tab_order = array("sort_asc" => "sort_desc", "sort_desc" => "sort_asc");
  78. $tpl->assign("tab_order", $tab_order);
  79. $aTypeAffichageLevel1 = array(
  80. "svcOV" => _("Details"),
  81. "svcSum" => _("Summary")
  82. );
  83. $aTypeAffichageLevel2 = array(
  84. "pb" => _("Problems"),
  85. "ack_1" => _("Acknowledge"),
  86. "ack_0" => _("Not Acknowledged"),
  87. );
  88. ##Toolbar select $lang["lgd_more_actions"]
  89. ?>
  90. <script type="text/javascript">
  91. p = <?php echo $p ?>;
  92. function setO(_i) {
  93. document.forms['form'].elements['cmd'].value = _i;
  94. document.forms['form'].elements['o1'].selectedIndex = 0;
  95. document.forms['form'].elements['o2'].selectedIndex = 0;
  96. }
  97. function displayingLevel1(val)
  98. {
  99. _o = val;
  100. if (_o == 'svcOV') {
  101. _addrXML = "./include/monitoring/status/Services/xml/serviceGridXML.php";
  102. _addrXSL = "./include/monitoring/status/Services/xsl/serviceGrid.xsl";
  103. } else {
  104. _addrXML = "./include/monitoring/status/Services/xml/serviceSummaryXML.php";
  105. _addrXSL = "./include/monitoring/status/Services/xsl/serviceSummary.xsl";
  106. }
  107. monitoring_refresh();
  108. }
  109. function displayingLevel2(val)
  110. {
  111. var sel1 = document.getElementById("typeDisplay").value;
  112. _o = "svcSum";
  113. if (val != '') {
  114. _o = _o + "_" + val;
  115. }
  116. monitoring_refresh();
  117. }
  118. </script>
  119. <?php
  120. $form->addElement('select', 'typeDisplay', _('Display'), $aTypeAffichageLevel1, array('id' => 'typeDisplay', 'onChange' => "displayingLevel1(this.value);"));
  121. $form->addElement('select', 'typeDisplay2', _('Display '), $aTypeAffichageLevel2, array('id' => 'typeDisplay2', 'onChange' => "displayingLevel2(this.value);"));
  122. $attrs = array( 'onchange'=>"javascript: setO(this.form.elements['o1'].value); submit();");
  123. $form->addElement('select', 'o1', NULL, array( NULL => _("More actions..."),
  124. "3" => _("Verification Check"),
  125. "4" => _("Verification Check (Forced)"),
  126. "70" => _("Services : Acknowledge"),
  127. "71" => _("Services : Disacknowledge"),
  128. "80" => _("Services : Enable Notification"),
  129. "81" => _("Services : Disable Notification"),
  130. "90" => _("Services : Enable Check"),
  131. "91" => _("Services : Disable Check"),
  132. "72" => _("Hosts : Acknowledge"),
  133. "73" => _("Hosts : Disacknowledge"),
  134. "82" => _("Hosts : Enable Notification"),
  135. "83" => _("Hosts : Disable Notification"),
  136. "92" => _("Hosts : Enable Check"),
  137. "93" => _("Hosts : Disable Check")), $attrs);
  138. $form->setDefaults(array('o1' => NULL));
  139. $o1 = $form->getElement('o1');
  140. $o1->setValue(NULL);
  141. $attrs = array('onchange'=>"javascript: setO(this.form.elements['o2'].value); submit();");
  142. $form->addElement('select', 'o2', NULL, array( NULL => _("More actions..."),
  143. "3" => _("Verification Check"),
  144. "4" => _("Verification Check (Forced)"),
  145. "70" => _("Services : Acknowledge"),
  146. "71" => _("Services : Disacknowledge"),
  147. "80" => _("Services : Enable Notification"),
  148. "81" => _("Services : Disable Notification"),
  149. "90" => _("Services : Enable Check"),
  150. "91" => _("Services : Disable Check"),
  151. "72" => _("Hosts : Acknowledge"),
  152. "73" => _("Hosts : Disacknowledge"),
  153. "82" => _("Hosts : Enable Notification"),
  154. "83" => _("Hosts : Disable Notification"),
  155. "92" => _("Hosts : Enable Check"),
  156. "93" => _("Hosts : Disable Check")), $attrs);
  157. $form->setDefaults(array('o2' => NULL));
  158. $o2 = $form->getElement('o2');
  159. $o2->setValue(NULL);
  160. $o2->setSelected(NULL);
  161. $tpl->assign('limit', $limit);
  162. $renderer = new HTML_QuickForm_Renderer_ArraySmarty($tpl);
  163. $form->accept($renderer);
  164. $tpl->assign('search', _('Search'));
  165. $tpl->assign('pollerStr', _('Poller'));
  166. $tpl->assign('poller_listing', $oreon->user->access->checkAction('poller_listing'));
  167. $tpl->assign('hgStr', _('Hostgroup'));
  168. $tpl->assign('form', $renderer->toArray());
  169. $tpl->display("serviceGrid.ihtml");
  170. ?>