(IUser $user, ISearchQuery $query)
| 52 | } |
| 53 | |
| 54 | public function search(IUser $user, ISearchQuery $query): SearchResult |
| 55 | { |
| 56 | if (!$this->appManager->isEnabledForUser('analytics', $user)) { |
| 57 | return SearchResult::complete($this->getName(), []); |
| 58 | } |
| 59 | |
| 60 | $reports = $this->ReportService->search($query->getTerm()); |
| 61 | $panoramas = $this->PanoramaService->search($query->getTerm()); |
| 62 | $result = []; |
| 63 | |
| 64 | foreach ($reports as $report) { |
| 65 | $url = $this->urlGenerator->linkToRouteAbsolute('analytics.page.report', ['id' => $report['id']]); |
| 66 | foreach ($this->getReportModes($report) as $mode => $label) { |
| 67 | $result[] = new SearchResultEntry( |
| 68 | $this->urlGenerator->getAbsoluteURL($this->urlGenerator->imagePath('analytics', 'report.svg')), |
| 69 | $report['name'], |
| 70 | $label, |
| 71 | $url . ($mode === '' ? '' : '/' . $mode), |
| 72 | '' |
| 73 | ); |
| 74 | } |
| 75 | } |
| 76 | |
| 77 | foreach ($panoramas as $panorama) { |
| 78 | $url = $this->urlGenerator->linkToRouteAbsolute('analytics.page.panorama', ['id' => $panorama['id']]); |
| 79 | foreach ($this->getPanoramaModes() as $mode => $label) { |
| 80 | $result[] = new SearchResultEntry( |
| 81 | $this->urlGenerator->getAbsoluteURL($this->urlGenerator->imagePath('analytics', 'panorama.svg')), |
| 82 | $panorama['name'], |
| 83 | $label, |
| 84 | $url . ($mode === '' ? '' : '/' . $mode), |
| 85 | '' |
| 86 | ); |
| 87 | } |
| 88 | } |
| 89 | |
| 90 | return SearchResult::complete( |
| 91 | $this->l10n->t('Analytics'), |
| 92 | $result |
| 93 | ); |
| 94 | } |
| 95 | |
| 96 | public function getName(): string |
| 97 | { |
nothing calls this directly
no test coverage detected