main.itop-welcome-itil.php 3.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  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 */, 10 /* fRank */);
  45. new ShortcutContainerMenuNode('MyShortcuts', $oWelcomeMenu->GetIndex(), 20 /* fRank */);
  46. $oToolsMenu = new MenuGroup('DataAdministration', 70 /* fRank */, 'Organization', UR_ACTION_MODIFY, UR_ALLOWED_YES|UR_ALLOWED_DEPENDS);
  47. new WebPageMenuNode('CSVImportMenu', utils::GetAbsoluteUrlAppRoot().'pages/csvimport.php', $oToolsMenu->GetIndex(), 1 /* fRank */);
  48. // Add the admin menus
  49. if (UserRights::IsAdministrator())
  50. {
  51. $oAdminMenu = new MenuGroup('AdminTools', 80 /* fRank */);
  52. new OQLMenuNode('UserAccountsMenu', 'SELECT User', $oAdminMenu->GetIndex(), 1 /* fRank */);
  53. new OQLMenuNode('ProfilesMenu', 'SELECT URP_Profiles', $oAdminMenu->GetIndex(), 2 /* fRank */);
  54. new TemplateMenuNode('NotificationsMenu', APPROOT.'application/templates/notifications_menu.html', $oAdminMenu->GetIndex(), 3 /* fRank */);
  55. new OQLMenuNode('AuditCategories', 'SELECT AuditCategory', $oAdminMenu->GetIndex(), 4 /* fRank */);
  56. new WebPageMenuNode('RunQueriesMenu', utils::GetAbsoluteUrlAppRoot().'pages/run_query.php', $oAdminMenu->GetIndex(), 8 /* fRank */);
  57. new OQLMenuNode('QueryMenu', 'SELECT Query', $oAdminMenu->GetIndex(), 8.5 /* fRank */);
  58. new WebPageMenuNode('ExportMenu', utils::GetAbsoluteUrlAppRoot().'webservices/export.php', $oAdminMenu->GetIndex(), 9 /* fRank */);
  59. new WebPageMenuNode('DataModelMenu', utils::GetAbsoluteUrlAppRoot().'pages/schema.php', $oAdminMenu->GetIndex(), 10 /* fRank */);
  60. new WebPageMenuNode('UniversalSearchMenu', utils::GetAbsoluteUrlAppRoot().'pages/UniversalSearch.php', $oAdminMenu->GetIndex(), 11 /* fRank */);
  61. }
  62. }
  63. }
  64. /**
  65. * Direct end-users to the standard Portal application
  66. */
  67. class MyPortalURLMaker implements iDBObjectURLMaker
  68. {
  69. public static function MakeObjectURL($sClass, $iId)
  70. {
  71. switch($sClass)
  72. {
  73. case 'UserRequest':
  74. $sAbsoluteUrl = utils::GetAbsoluteUrlAppRoot();
  75. $sUrl = "{$sAbsoluteUrl}portal/index.php?operation=details&class=$sClass&id=$iId";
  76. return $sUrl;
  77. default:
  78. return '';
  79. }
  80. }
  81. }
  82. ?>