Section.php 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. <?php
  2. /**
  3. * @copyright Copyright (c) 2016 Arthur Schiwon <blizzz@arthur-schiwon.de>
  4. *
  5. * @author Arthur Schiwon <blizzz@arthur-schiwon.de>
  6. * @author Joas Schilling <coding@schilljs.com>
  7. * @author Lukas Reschke <lukas@statuscode.ch>
  8. *
  9. * @license GNU AGPL version 3 or any later version
  10. *
  11. * This program is free software: you can redistribute it and/or modify
  12. * it under the terms of the GNU Affero General Public License as
  13. * published by the Free Software Foundation, either version 3 of the
  14. * License, or (at your option) any later version.
  15. *
  16. * This program is distributed in the hope that it will be useful,
  17. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  18. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  19. * GNU Affero General Public License for more details.
  20. *
  21. * You should have received a copy of the GNU Affero General Public License
  22. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  23. *
  24. */
  25. namespace OC\Settings;
  26. use OCP\Settings\IIconSection;
  27. class Section implements IIconSection {
  28. /** @var string */
  29. private $id;
  30. /** @var string */
  31. private $name;
  32. /** @var int */
  33. private $priority;
  34. /** @var string */
  35. private $icon;
  36. /**
  37. * @param string $id
  38. * @param string $name
  39. * @param int $priority
  40. * @param string $icon
  41. */
  42. public function __construct($id, $name, $priority, $icon = '') {
  43. $this->id = $id;
  44. $this->name = $name;
  45. $this->priority = $priority;
  46. $this->icon = $icon;
  47. }
  48. /**
  49. * returns the ID of the section. It is supposed to be a lower case string,
  50. * e.g. 'ldap'
  51. *
  52. * @returns string
  53. */
  54. public function getID() {
  55. return $this->id;
  56. }
  57. /**
  58. * returns the translated name as it should be displayed, e.g. 'LDAP / AD
  59. * integration'. Use the L10N service to translate it.
  60. *
  61. * @return string
  62. */
  63. public function getName() {
  64. return $this->name;
  65. }
  66. /**
  67. * @return int whether the form should be rather on the top or bottom of
  68. * the settings navigation. The sections are arranged in ascending order of
  69. * the priority values. It is required to return a value between 0 and 99.
  70. *
  71. * E.g.: 70
  72. */
  73. public function getPriority() {
  74. return $this->priority;
  75. }
  76. /**
  77. * returns the relative path to an 16*16 icon describing the section.
  78. * e.g. '/core/img/places/files.svg'
  79. *
  80. * @returns string
  81. * @since 12
  82. */
  83. public function getIcon() {
  84. return $this->icon;
  85. }
  86. }