networkequipmentquery.form.php 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. <?php
  2. /*
  3. * @version $Id: networkequipmentquery.form.php 234 2019-12-12 14:34:31Z yllen $
  4. -------------------------------------------------------------------------
  5. LICENSE
  6. This file is part of Archires plugin for GLPI.
  7. Archires is free software: you can redistribute it and/or modify
  8. it under the terms of the GNU Affero General Public License as published by
  9. the Free Software Foundation, either version 3 of the License, or
  10. (at your option) any later version.
  11. Archires is distributed in the hope that it will be useful,
  12. but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. GNU Affero General Public License for more details.
  15. You should have received a copy of the GNU Affero General Public License
  16. along with Archires. If not, see <http://www.gnu.org/licenses/>.
  17. @package archires
  18. @copyright Copyright (c) 2016-2018 Archires plugin team
  19. @license AGPL License 3.0 or (at your option) any later version
  20. http://www.gnu.org/licenses/agpl-3.0-standalone.html
  21. @link https://forge.glpi-project.org/projects/archires
  22. @since version 2.2
  23. --------------------------------------------------------------------------
  24. */
  25. include ("../../../inc/includes.php");
  26. if (!isset($_GET["id"])) {
  27. $_GET["id"] = "";
  28. }
  29. if (isset($_GET["start"])) {
  30. $start = $_GET["start"];
  31. } else {
  32. $start = 0;
  33. }
  34. $PluginArchiresNetworkEquipmentQuery = new PluginArchiresNetworkEquipmentQuery();
  35. $PluginArchiresQueryType = new PluginArchiresQueryType();
  36. if (isset($_POST["add"])) {
  37. $PluginArchiresNetworkEquipmentQuery->check(-1,CREATE,$_POST);
  38. $PluginArchiresNetworkEquipmentQuery->add($_POST);
  39. Html::back();
  40. } else if (isset($_POST["delete"])) {
  41. $PluginArchiresNetworkEquipmentQuery->check($_POST['id'],DELETE);
  42. $PluginArchiresNetworkEquipmentQuery->delete($_POST);
  43. Html::redirect(Toolbox::getItemTypeSearchURL('PluginArchiresNetworkEquipmentQuery'));
  44. } else if (isset($_POST["restore"])) {
  45. $PluginArchiresNetworkEquipmentQuery->check($_POST['id'],PURGE);
  46. $PluginArchiresNetworkEquipmentQuery->restore($_POST);
  47. Html::redirect(Toolbox::getItemTypeSearchURL('PluginArchiresNetworkEquipmentQuery'));
  48. } else if (isset($_POST["purge"])) {
  49. $PluginArchiresNetworkEquipmentQuery->check($_POST['id'],PURGE);
  50. $PluginArchiresNetworkEquipmentQuery->delete($_POST,1);
  51. Html::redirect(Toolbox::getItemTypeSearchURL('PluginArchiresNetworkEquipmentQuery'));
  52. } else if (isset($_POST["update"])) {
  53. $PluginArchiresNetworkEquipmentQuery->check($_POST['id'],UPDATE);
  54. $PluginArchiresNetworkEquipmentQuery->update($_POST);
  55. Html::back();
  56. } else if (isset($_POST["duplicate"])) {
  57. $PluginArchiresNetworkEquipmentQuery->check($_POST['id'],CREATE);
  58. unset($_POST['id']);
  59. $PluginArchiresNetworkEquipmentQuery->add($_POST);
  60. Html::back();
  61. } else if (isset($_POST["addtype"])) {
  62. if ($PluginArchiresQueryType->canCreate()) {
  63. $PluginArchiresQueryType->addType('PluginArchiresNetworkEquipmentQuery', $_POST['type'],
  64. $_POST['_itemtype'], $_POST['query']);
  65. }
  66. Html::back();
  67. } else if (isset($_POST["deletetype"])) {
  68. if ($PluginArchiresQueryType->canCreate()) {
  69. $PluginArchiresQueryType->getFromDB($_POST["id"],-1);
  70. foreach ($_POST["item"] as $key => $val) {
  71. if ($val == 1) {
  72. $PluginArchiresQueryType->delete(['id' => $key]);
  73. }
  74. }
  75. }
  76. Html::back();
  77. } else {
  78. $PluginArchiresNetworkEquipmentQuery->checkGlobal(READ);
  79. Html::header(PluginArchiresArchires::getTypeName()." ".PluginArchiresNetworkEquipmentQuery::getTypeName(),
  80. '',"tools","pluginarchiresmenu","networkequipment");
  81. $PluginArchiresNetworkEquipmentQuery->display($_GET);
  82. Html::footer();
  83. }