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.

Calendar.php 2.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. <?php
  2. /**
  3. * @copyright Copyright (c) 2016 Joas Schilling <coding@schilljs.com>
  4. *
  5. * @author Joas Schilling <coding@schilljs.com>
  6. * @author John Molakvoæ <skjnldsv@protonmail.com>
  7. *
  8. * @license GNU AGPL version 3 or any later version
  9. *
  10. * This program is free software: you can redistribute it and/or modify
  11. * it under the terms of the GNU Affero General Public License as
  12. * published by the Free Software Foundation, either version 3 of the
  13. * License, or (at your option) any later version.
  14. *
  15. * This program is distributed in the hope that it will be useful,
  16. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  17. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  18. * GNU Affero General Public License for more details.
  19. *
  20. * You should have received a copy of the GNU Affero General Public License
  21. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  22. *
  23. */
  24. namespace OCA\DAV\CalDAV\Activity\Filter;
  25. use OCP\Activity\IFilter;
  26. use OCP\IL10N;
  27. use OCP\IURLGenerator;
  28. class Calendar implements IFilter {
  29. /** @var IL10N */
  30. protected $l;
  31. /** @var IURLGenerator */
  32. protected $url;
  33. public function __construct(IL10N $l, IURLGenerator $url) {
  34. $this->l = $l;
  35. $this->url = $url;
  36. }
  37. /**
  38. * @return string Lowercase a-z and underscore only identifier
  39. * @since 11.0.0
  40. */
  41. public function getIdentifier() {
  42. return 'calendar';
  43. }
  44. /**
  45. * @return string A translated string
  46. * @since 11.0.0
  47. */
  48. public function getName() {
  49. return $this->l->t('Calendar');
  50. }
  51. /**
  52. * @return int whether the filter should be rather on the top or bottom of
  53. * the admin section. The filters are arranged in ascending order of the
  54. * priority values. It is required to return a value between 0 and 100.
  55. * @since 11.0.0
  56. */
  57. public function getPriority() {
  58. return 40;
  59. }
  60. /**
  61. * @return string Full URL to an icon, empty string when none is given
  62. * @since 11.0.0
  63. */
  64. public function getIcon() {
  65. return $this->url->getAbsoluteURL($this->url->imagePath('core', 'places/calendar.svg'));
  66. }
  67. /**
  68. * @param string[] $types
  69. * @return string[] An array of allowed apps from which activities should be displayed
  70. * @since 11.0.0
  71. */
  72. public function filterTypes(array $types) {
  73. return array_intersect(['calendar', 'calendar_event'], $types);
  74. }
  75. /**
  76. * @return string[] An array of allowed apps from which activities should be displayed
  77. * @since 11.0.0
  78. */
  79. public function allowedApps() {
  80. return [];
  81. }
  82. }