* @param string $language * @param IEvent $event * @param IEvent|null $previousEvent * @return IEvent * @throws UnknownActivityException * @since 11.0.0 */
($language, IEvent $event, ?IEvent $previousEvent = null)
| 47 | * @since 11.0.0 |
| 48 | */ |
| 49 | public function parse($language, IEvent $event, ?IEvent $previousEvent = null) { |
| 50 | if ($event->getApp() !== 'analytics') { |
| 51 | throw new UnknownActivityException(); |
| 52 | } |
| 53 | if (!$this->isAnalyticsEnabledForCurrentUser()) { |
| 54 | throw new UnknownActivityException(); |
| 55 | } |
| 56 | |
| 57 | $parsedSubject = ''; |
| 58 | $ownActivity = ($event->getAuthor() === $this->userId); |
| 59 | |
| 60 | switch ($event->getSubject()) { |
| 61 | case ActivityManager::SUBJECT_REPORT_ADD: |
| 62 | // TRANSLATORS: {report} is the report name, e.g. Sales. |
| 63 | $parsedSubject = $this->l10n->t('You created a new report: {report}'); |
| 64 | break; |
| 65 | case ActivityManager::SUBJECT_REPORT_DELETE: |
| 66 | // TRANSLATORS: {report} is the report name, e.g. Sales. |
| 67 | $parsedSubject = $this->l10n->t('You deleted the report {report}'); |
| 68 | break; |
| 69 | case ActivityManager::SUBJECT_REPORT_SHARE: |
| 70 | if ($ownActivity) { |
| 71 | // TRANSLATORS: {report} is the report name, e.g. Sales. |
| 72 | $parsedSubject = $this->l10n->t('You shared the report {report}'); |
| 73 | } else { |
| 74 | // TRANSLATORS: {report} is the report name, e.g. Sales. The acting user name is prepended to this sentence fragment. |
| 75 | $parsedSubject = $event->getSubjectParameters()['author'] . ' ' . $this->l10n->t('shared the report {report} with you'); |
| 76 | } |
| 77 | break; |
| 78 | |
| 79 | case ActivityManager::SUBJECT_DATASET_ADD: |
| 80 | // TRANSLATORS: {report} is the dataset name, e.g. Sales. |
| 81 | $parsedSubject = $this->l10n->t('You created a new dataset: {report}'); |
| 82 | break; |
| 83 | case ActivityManager::SUBJECT_DATASET_DELETE: |
| 84 | // TRANSLATORS: {report} is the dataset name, e.g. Sales. |
| 85 | $parsedSubject = $this->l10n->t('You deleted the dataset {report}'); |
| 86 | break; |
| 87 | case ActivityManager::SUBJECT_DATASET_SHARE: |
| 88 | if ($ownActivity) { |
| 89 | // TRANSLATORS: {report} is the dataset name, e.g. Sales. |
| 90 | $parsedSubject = $this->l10n->t('You shared the dataset {report}'); |
| 91 | } else { |
| 92 | // TRANSLATORS: {report} is the dataset name, e.g. Sales. The acting user name is prepended to this sentence fragment. |
| 93 | $parsedSubject = $event->getSubjectParameters()['author'] . ' ' . $this->l10n->t('shared the dataset {report} with you'); |
| 94 | } |
| 95 | break; |
| 96 | |
| 97 | case ActivityManager::SUBJECT_PANORAMA_ADD: |
| 98 | // TRANSLATORS: {report} is the panorama name, e.g. Sales. |
| 99 | $parsedSubject = $this->l10n->t('You created a new panorama: {report}'); |
| 100 | break; |
| 101 | case ActivityManager::SUBJECT_PANORAMA_DELETE: |
| 102 | // TRANSLATORS: {report} is the panorama name, e.g. Sales. |
| 103 | $parsedSubject = $this->l10n->t('You deleted the panorama {report}'); |
| 104 | break; |
| 105 | case ActivityManager::SUBJECT_PANORAMA_SHARE: |
| 106 | if ($ownActivity) { |
nothing calls this directly
no test coverage detected