1
0

INavigationManager.php 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. <?php
  2. /**
  3. * @copyright Copyright (c) 2016, ownCloud, Inc.
  4. *
  5. * @author Bart Visscher <bartv@thisnet.nl>
  6. * @author Christoph Wurst <christoph@winzerhof-wurst.at>
  7. * @author Joas Schilling <coding@schilljs.com>
  8. * @author John Molakvoæ <skjnldsv@protonmail.com>
  9. * @author Jörn Friedrich Dreyer <jfd@butonic.de>
  10. * @author Julius Härtl <jus@bitgrid.net>
  11. * @author Morris Jobke <hey@morrisjobke.de>
  12. * @author Roeland Jago Douma <roeland@famdouma.nl>
  13. * @author Thomas Müller <thomas.mueller@tmit.eu>
  14. *
  15. * @license AGPL-3.0
  16. *
  17. * This code is free software: you can redistribute it and/or modify
  18. * it under the terms of the GNU Affero General Public License, version 3,
  19. * as published by the Free Software Foundation.
  20. *
  21. * This program is distributed in the hope that it will be useful,
  22. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  23. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  24. * GNU Affero General Public License for more details.
  25. *
  26. * You should have received a copy of the GNU Affero General Public License, version 3,
  27. * along with this program. If not, see <http://www.gnu.org/licenses/>
  28. *
  29. */
  30. // use OCP namespace for all classes that are considered public.
  31. // This means that they should be used by apps instead of the internal ownCloud classes
  32. namespace OCP;
  33. /**
  34. * Manages the ownCloud navigation
  35. * @since 6.0.0
  36. */
  37. interface INavigationManager {
  38. /**
  39. * Navigation entries of the app navigation
  40. * @since 16.0.0
  41. */
  42. public const TYPE_APPS = 'link';
  43. /**
  44. * Navigation entries of the settings navigation
  45. * @since 16.0.0
  46. */
  47. public const TYPE_SETTINGS = 'settings';
  48. /**
  49. * Navigation entries for public page footer navigation
  50. * @since 16.0.0
  51. */
  52. public const TYPE_GUEST = 'guest';
  53. /**
  54. * Creates a new navigation entry
  55. *
  56. * @param array|\Closure $entry Array containing: id, name, order, icon and href key
  57. * The use of a closure is preferred, because it will avoid
  58. * loading the routing of your app, unless required.
  59. * @return void
  60. * @since 6.0.0
  61. */
  62. public function add($entry);
  63. /**
  64. * Sets the current navigation entry of the currently running app
  65. * @param string $appId id of the app entry to activate (from added $entry)
  66. * @return void
  67. * @since 6.0.0
  68. */
  69. public function setActiveEntry($appId);
  70. /**
  71. * Get the current navigation entry of the currently running app
  72. * @return string
  73. * @since 20.0.0
  74. */
  75. public function getActiveEntry();
  76. /**
  77. * Get a list of navigation entries
  78. *
  79. * @param string $type type of the navigation entries
  80. * @return array
  81. * @since 14.0.0
  82. */
  83. public function getAll(string $type = self::TYPE_APPS): array;
  84. /**
  85. * Set an unread counter for navigation entries
  86. *
  87. * @param string $id id of the navigation entry
  88. * @param int $unreadCounter Number of unread entries (0 to hide the counter which is the default)
  89. * @since 22.0.0
  90. */
  91. public function setUnreadCounter(string $id, int $unreadCounter): void;
  92. }