You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

navigationmanager.php 1.3KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. <?php
  2. /**
  3. * Copyright (c) 2013 Bart Visscher <bartv@thisnet.nl>
  4. * This file is licensed under the Affero General Public License version 3 or
  5. * later.
  6. * See the COPYING-README file.
  7. *
  8. */
  9. namespace OC;
  10. /**
  11. * Manages the ownCloud navigation
  12. */
  13. class NavigationManager implements \OCP\INavigationManager {
  14. protected $entries = array();
  15. protected $activeEntry;
  16. /**
  17. * Creates a new navigation entry
  18. * @param array $entry containing: id, name, order, icon and href key
  19. */
  20. public function add(array $entry) {
  21. $entry['active'] = false;
  22. if(!isset($entry['icon'])) {
  23. $entry['icon'] = '';
  24. }
  25. $this->entries[] = $entry;
  26. }
  27. /**
  28. * @brief returns all the added Menu entries
  29. * @return array of the added entries
  30. */
  31. public function getAll() {
  32. return $this->entries;
  33. }
  34. /**
  35. * @brief removes all the entries
  36. */
  37. public function clear() {
  38. $this->entries = array();
  39. }
  40. /**
  41. * Sets the current navigation entry of the currently running app
  42. * @param string $id of the app entry to activate (from added $entry)
  43. */
  44. public function setActiveEntry($id) {
  45. $this->activeEntry = $id;
  46. }
  47. /**
  48. * @brief gets the active Menu entry
  49. * @return string id or empty string
  50. *
  51. * This function returns the id of the active navigation entry (set by
  52. * setActiveEntry
  53. */
  54. public function getActiveEntry() {
  55. return $this->activeEntry;
  56. }
  57. }