| @@ 29-90 (lines=62) @@ | ||
| 26 | use OCP\IL10N; |
|
| 27 | use OCP\IURLGenerator; |
|
| 28 | ||
| 29 | class Filter implements IFilter { |
|
| 30 | ||
| 31 | /** @var IL10N */ |
|
| 32 | protected $l; |
|
| 33 | ||
| 34 | /** @var IURLGenerator */ |
|
| 35 | protected $url; |
|
| 36 | ||
| 37 | public function __construct(IL10N $l, IURLGenerator $url) { |
|
| 38 | $this->l = $l; |
|
| 39 | $this->url = $url; |
|
| 40 | } |
|
| 41 | ||
| 42 | /** |
|
| 43 | * @return string Lowercase a-z only identifier |
|
| 44 | * @since 11.0.0 |
|
| 45 | */ |
|
| 46 | public function getIdentifier() { |
|
| 47 | return 'comments'; |
|
| 48 | } |
|
| 49 | ||
| 50 | /** |
|
| 51 | * @return string A translated string |
|
| 52 | * @since 11.0.0 |
|
| 53 | */ |
|
| 54 | public function getName() { |
|
| 55 | return $this->l->t('Comments'); |
|
| 56 | } |
|
| 57 | ||
| 58 | /** |
|
| 59 | * @return int |
|
| 60 | * @since 11.0.0 |
|
| 61 | */ |
|
| 62 | public function getPriority() { |
|
| 63 | return 40; |
|
| 64 | } |
|
| 65 | ||
| 66 | /** |
|
| 67 | * @return string Full URL to an icon, empty string when none is given |
|
| 68 | * @since 11.0.0 |
|
| 69 | */ |
|
| 70 | public function getIcon() { |
|
| 71 | return $this->url->getAbsoluteURL($this->url->imagePath('core', 'actions/comment.svg')); |
|
| 72 | } |
|
| 73 | ||
| 74 | /** |
|
| 75 | * @param string[] $types |
|
| 76 | * @return string[] An array of allowed apps from which activities should be displayed |
|
| 77 | * @since 11.0.0 |
|
| 78 | */ |
|
| 79 | public function filterTypes(array $types) { |
|
| 80 | return $types; |
|
| 81 | } |
|
| 82 | ||
| 83 | /** |
|
| 84 | * @return string[] An array of allowed apps from which activities should be displayed |
|
| 85 | * @since 11.0.0 |
|
| 86 | */ |
|
| 87 | public function allowedApps() { |
|
| 88 | return ['comments']; |
|
| 89 | } |
|
| 90 | } |
|
| 91 | ||
| @@ 29-92 (lines=64) @@ | ||
| 26 | use OCP\IL10N; |
|
| 27 | use OCP\IURLGenerator; |
|
| 28 | ||
| 29 | class Calendar implements IFilter { |
|
| 30 | ||
| 31 | /** @var IL10N */ |
|
| 32 | protected $l; |
|
| 33 | ||
| 34 | /** @var IURLGenerator */ |
|
| 35 | protected $url; |
|
| 36 | ||
| 37 | public function __construct(IL10N $l, IURLGenerator $url) { |
|
| 38 | $this->l = $l; |
|
| 39 | $this->url = $url; |
|
| 40 | } |
|
| 41 | ||
| 42 | /** |
|
| 43 | * @return string Lowercase a-z and underscore only identifier |
|
| 44 | * @since 11.0.0 |
|
| 45 | */ |
|
| 46 | public function getIdentifier() { |
|
| 47 | return 'calendar'; |
|
| 48 | } |
|
| 49 | ||
| 50 | /** |
|
| 51 | * @return string A translated string |
|
| 52 | * @since 11.0.0 |
|
| 53 | */ |
|
| 54 | public function getName() { |
|
| 55 | return $this->l->t('Calendar'); |
|
| 56 | } |
|
| 57 | ||
| 58 | /** |
|
| 59 | * @return int whether the filter should be rather on the top or bottom of |
|
| 60 | * the admin section. The filters are arranged in ascending order of the |
|
| 61 | * priority values. It is required to return a value between 0 and 100. |
|
| 62 | * @since 11.0.0 |
|
| 63 | */ |
|
| 64 | public function getPriority() { |
|
| 65 | return 40; |
|
| 66 | } |
|
| 67 | ||
| 68 | /** |
|
| 69 | * @return string Full URL to an icon, empty string when none is given |
|
| 70 | * @since 11.0.0 |
|
| 71 | */ |
|
| 72 | public function getIcon() { |
|
| 73 | return $this->url->getAbsoluteURL($this->url->imagePath('core', 'places/calendar-dark.svg')); |
|
| 74 | } |
|
| 75 | ||
| 76 | /** |
|
| 77 | * @param string[] $types |
|
| 78 | * @return string[] An array of allowed apps from which activities should be displayed |
|
| 79 | * @since 11.0.0 |
|
| 80 | */ |
|
| 81 | public function filterTypes(array $types) { |
|
| 82 | return array_intersect(['calendar', 'calendar_event'], $types); |
|
| 83 | } |
|
| 84 | ||
| 85 | /** |
|
| 86 | * @return string[] An array of allowed apps from which activities should be displayed |
|
| 87 | * @since 11.0.0 |
|
| 88 | */ |
|
| 89 | public function allowedApps() { |
|
| 90 | return []; |
|
| 91 | } |
|
| 92 | } |
|
| 93 | ||
| @@ 29-92 (lines=64) @@ | ||
| 26 | use OCP\IL10N; |
|
| 27 | use OCP\IURLGenerator; |
|
| 28 | ||
| 29 | class Todo implements IFilter { |
|
| 30 | ||
| 31 | /** @var IL10N */ |
|
| 32 | protected $l; |
|
| 33 | ||
| 34 | /** @var IURLGenerator */ |
|
| 35 | protected $url; |
|
| 36 | ||
| 37 | public function __construct(IL10N $l, IURLGenerator $url) { |
|
| 38 | $this->l = $l; |
|
| 39 | $this->url = $url; |
|
| 40 | } |
|
| 41 | ||
| 42 | /** |
|
| 43 | * @return string Lowercase a-z and underscore only identifier |
|
| 44 | * @since 11.0.0 |
|
| 45 | */ |
|
| 46 | public function getIdentifier() { |
|
| 47 | return 'calendar_todo'; |
|
| 48 | } |
|
| 49 | ||
| 50 | /** |
|
| 51 | * @return string A translated string |
|
| 52 | * @since 11.0.0 |
|
| 53 | */ |
|
| 54 | public function getName() { |
|
| 55 | return $this->l->t('Todos'); |
|
| 56 | } |
|
| 57 | ||
| 58 | /** |
|
| 59 | * @return int whether the filter should be rather on the top or bottom of |
|
| 60 | * the admin section. The filters are arranged in ascending order of the |
|
| 61 | * priority values. It is required to return a value between 0 and 100. |
|
| 62 | * @since 11.0.0 |
|
| 63 | */ |
|
| 64 | public function getPriority() { |
|
| 65 | return 40; |
|
| 66 | } |
|
| 67 | ||
| 68 | /** |
|
| 69 | * @return string Full URL to an icon, empty string when none is given |
|
| 70 | * @since 11.0.0 |
|
| 71 | */ |
|
| 72 | public function getIcon() { |
|
| 73 | return $this->url->getAbsoluteURL($this->url->imagePath('core', 'actions/checkmark.svg')); |
|
| 74 | } |
|
| 75 | ||
| 76 | /** |
|
| 77 | * @param string[] $types |
|
| 78 | * @return string[] An array of allowed apps from which activities should be displayed |
|
| 79 | * @since 11.0.0 |
|
| 80 | */ |
|
| 81 | public function filterTypes(array $types) { |
|
| 82 | return array_intersect(['calendar_todo'], $types); |
|
| 83 | } |
|
| 84 | ||
| 85 | /** |
|
| 86 | * @return string[] An array of allowed apps from which activities should be displayed |
|
| 87 | * @since 11.0.0 |
|
| 88 | */ |
|
| 89 | public function allowedApps() { |
|
| 90 | return []; |
|
| 91 | } |
|
| 92 | } |
|
| 93 | ||