locationquery.form.php 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. <?php
  2. /*
  3. * @version $Id: locationquery.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. @author Nelly Mahu-Lasson, Xavier Caillaud
  19. @copyright Copyright (c) 2016-2021 Archires plugin team
  20. @license AGPL License 3.0 or (at your option) any later version
  21. http://www.gnu.org/licenses/agpl-3.0-standalone.html
  22. @link https://forge.glpi-project.org/projects/archires
  23. @since version 2.2
  24. --------------------------------------------------------------------------
  25. */
  26. include ("../../../inc/includes.php");
  27. if (!isset($_GET["id"])) {
  28. $_GET["id"] = "";
  29. }
  30. if (isset($_GET["start"])) {
  31. $start = $_GET["start"];
  32. } else {
  33. $start = 0;
  34. }
  35. $PluginArchiresLocationQuery = new PluginArchiresLocationQuery();
  36. $PluginArchiresQueryType = new PluginArchiresQueryType();
  37. if (isset($_POST["add"])) {
  38. $PluginArchiresLocationQuery->check(-1, CREATE,$_POST);
  39. $PluginArchiresLocationQuery->add($_POST);
  40. Html::back();
  41. } else if (isset($_POST["delete"])) {
  42. $PluginArchiresLocationQuery->check($_POST['id'],DELETE);
  43. $PluginArchiresLocationQuery->delete($_POST);
  44. Html::redirect(Toolbox::getItemTypeSearchURL('PluginArchiresLocationQuery'));
  45. } else if (isset($_POST["restore"])) {
  46. $PluginArchiresLocationQuery->check($_POST['id'],PURGE);
  47. $PluginArchiresLocationQuery->restore($_POST);
  48. Html::redirect(Toolbox::getItemTypeSearchURL('PluginArchiresLocationQuery'));
  49. } else if (isset($_POST["purge"])) {
  50. $PluginArchiresLocationQuery->check($_POST['id'],PURGE);
  51. $PluginArchiresLocationQuery->delete($_POST,1);
  52. Html::redirect(Toolbox::getItemTypeSearchURL('PluginArchiresLocationQuery'));
  53. } else if (isset($_POST["update"])) {
  54. $PluginArchiresLocationQuery->check($_POST['id'],UPDATE);
  55. $PluginArchiresLocationQuery->update($_POST);
  56. Html::back();
  57. } else if (isset($_POST["duplicate"])) {
  58. $PluginArchiresLocationQuery->check($_POST['id'],CREATE);
  59. unset($_POST['id']);
  60. $PluginArchiresLocationQuery->add($_POST);
  61. Html::back();
  62. } else if (isset($_POST["addtype"]) && isset($_POST['_itemtype'])) {
  63. if ($PluginArchiresQueryType->canCreate()) {
  64. $PluginArchiresQueryType->addType('PluginArchiresLocationQuery', $_POST['type'],
  65. $_POST['_itemtype'], $_POST['query']);
  66. }
  67. Html::back();
  68. } else if (isset($_POST["deletetype"])) {
  69. if ($PluginArchiresQueryType->canCreate()) {
  70. $PluginArchiresQueryType->getFromDB($_POST["id"],-1);
  71. foreach ($_POST["item"] as $key => $val) {
  72. if ($val == 1) {
  73. $PluginArchiresQueryType->delete(['id' => $key]);
  74. }
  75. }
  76. }
  77. Html::back();
  78. } else {
  79. $PluginArchiresLocationQuery->checkGlobal(READ);
  80. Html::header(PluginArchiresArchires::getTypeName()." ".PluginArchiresLocationQuery::getTypeName(),
  81. '',"tools","pluginarchiresmenu","location");
  82. $PluginArchiresLocationQuery->display($_GET);
  83. Html::footer();
  84. }