archires.graph.php 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. <?php
  2. /*
  3. * @version $Id: archires.graph.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. $PluginArchiresView = new PluginArchiresView();
  31. $PluginArchiresPrototype = new PluginArchiresPrototype();
  32. $object = $_GET["querytype"];
  33. $obj = new $object();
  34. if (isset($_GET["displayview"])) {
  35. $obj->getFromDB($_GET["plugin_archires_queries_id"]);
  36. Html::redirect(Plugin::getWebDir('archires')."/front/archires.graph.php?id=".
  37. $obj->fields["id"]."&querytype=".$_GET["querytype"]."&plugin_archires_views_id=".
  38. $_GET["plugin_archires_views_id"]);
  39. } else {
  40. Html::header(PluginArchiresArchires::getTypeName(),'',"tools","pluginarchires");
  41. $obj->getFromDB($_GET["id"]);
  42. $object_view = $obj->fields["plugin_archires_views_id"];
  43. $entities_id = $obj->fields["entities_id"];
  44. if ($PluginArchiresView->getFromDB($object_view)
  45. && Session::haveAccessToEntity($entities_id)) {
  46. if (!isset($_GET["plugin_archires_views_id"])) {
  47. $plugin_archires_views_id = $object_view;
  48. } else {
  49. $plugin_archires_views_id = $_GET["plugin_archires_views_id"];
  50. }
  51. $PluginArchiresPrototype->displayGraph($obj,$plugin_archires_views_id,1);
  52. } else {
  53. Html::redirect(Plugin::getWebDir('archires')."/front/archires.php");
  54. }
  55. Html::footer();
  56. }