main.itop-welcome-itil.php 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. <?php
  2. // Copyright (C) 2010-2012 Combodo SARL
  3. //
  4. // This file is part of iTop.
  5. //
  6. // iTop is free software; you can redistribute it and/or modify
  7. // it under the terms of the GNU Affero General Public License as published by
  8. // the Free Software Foundation, either version 3 of the License, or
  9. // (at your option) any later version.
  10. //
  11. // iTop 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. //
  16. // You should have received a copy of the GNU Affero General Public License
  17. // along with iTop. If not, see <http://www.gnu.org/licenses/>
  18. // Add the standard menus
  19. /*
  20. * +--------------------+
  21. * | Welcome |
  22. * +--------------------+
  23. * Welcome To iTop
  24. * +--------------------+
  25. * | Tools |
  26. * +--------------------+
  27. * CSV Import
  28. * +--------------------+
  29. * | Admin Tools | << Only present if the user is an admin
  30. * +--------------------+
  31. * User Accounts
  32. * Profiles
  33. * Notifications
  34. * Run Queries
  35. * Export
  36. * Data Model
  37. * Universal Search
  38. */
  39. class ItopWelcome extends ModuleHandlerAPI
  40. {
  41. public static function OnMenuCreation()
  42. {
  43. //$oWelcomeMenu = new MenuGroup('WelcomeMenu', 10 /* fRank */);
  44. //new DashboardMenuNode('WelcomeMenuPage', dirname(__FILE__).'/welcome_menu.xml', $oWelcomeMenu->GetIndex() /* oParent */, 1 /* fRank */);
  45. $oToolsMenu = new MenuGroup('DataAdministration', 70 /* fRank */, 'Organization', UR_ACTION_MODIFY, UR_ALLOWED_YES|UR_ALLOWED_DEPENDS);
  46. new WebPageMenuNode('CSVImportMenu', utils::GetAbsoluteUrlAppRoot().'pages/csvimport.php', $oToolsMenu->GetIndex(), 1 /* fRank */);
  47. // Add the admin menus
  48. if (UserRights::IsAdministrator())
  49. {
  50. $oAdminMenu = new MenuGroup('AdminTools', 80 /* fRank */);
  51. new OQLMenuNode('UserAccountsMenu', 'SELECT User', $oAdminMenu->GetIndex(), 1 /* fRank */,true);
  52. new OQLMenuNode('ProfilesMenu', 'SELECT URP_Profiles', $oAdminMenu->GetIndex(), 2 /* fRank */);
  53. new TemplateMenuNode('NotificationsMenu', APPROOT.'application/templates/notifications_menu.html', $oAdminMenu->GetIndex(), 3 /* fRank */);
  54. new OQLMenuNode('AuditCategories', 'SELECT AuditCategory', $oAdminMenu->GetIndex(), 4 /* fRank */);
  55. new WebPageMenuNode('RunQueriesMenu', utils::GetAbsoluteUrlAppRoot().'pages/run_query.php', $oAdminMenu->GetIndex(), 8 /* fRank */);
  56. new OQLMenuNode('QueryMenu', 'SELECT Query', $oAdminMenu->GetIndex(), 8.5 /* fRank */);
  57. new WebPageMenuNode('ExportMenu', utils::GetAbsoluteUrlAppRoot().'webservices/export.php', $oAdminMenu->GetIndex(), 9 /* fRank */);
  58. new WebPageMenuNode('DataModelMenu', utils::GetAbsoluteUrlAppRoot().'pages/schema.php', $oAdminMenu->GetIndex(), 10 /* fRank */);
  59. new WebPageMenuNode('UniversalSearchMenu', utils::GetAbsoluteUrlAppRoot().'pages/UniversalSearch.php', $oAdminMenu->GetIndex(), 11 /* fRank */);
  60. }
  61. }
  62. }
  63. /**
  64. * Direct end-users to the standard Portal application
  65. */
  66. class MyPortalURLMaker implements iDBObjectURLMaker
  67. {
  68. public static function MakeObjectURL($sClass, $iId)
  69. {
  70. switch($sClass)
  71. {
  72. case 'UserRequest':
  73. $sAbsoluteUrl = utils::GetAbsoluteUrlAppRoot();
  74. $sUrl = "{$sAbsoluteUrl}portal/index.php?operation=details&class=$sClass&id=$iId";
  75. return $sUrl;
  76. default:
  77. return '';
  78. }
  79. }
  80. }
  81. ?>