(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 | $result[] = new SearchResultEntry( |
| 66 | $this->urlGenerator->getAbsoluteURL($this->urlGenerator->imagePath('analytics', 'report.svg')), |
| 67 | $report['name'], |
| 68 | '', |
| 69 | $this->urlGenerator->getAbsoluteURL($this->urlGenerator->linkToRoute('analytics.page.report', ['id' => $report['id']])), |
| 70 | '' |
| 71 | ); |
| 72 | } |
| 73 | |
| 74 | foreach ($panoramas as $panorama) { |
| 75 | $result[] = new SearchResultEntry( |
| 76 | $this->urlGenerator->getAbsoluteURL($this->urlGenerator->imagePath('analytics', 'panorama.svg')), |
| 77 | $panorama['name'], |
| 78 | '', |
| 79 | $this->urlGenerator->getAbsoluteURL($this->urlGenerator->linkToRoute('analytics.page.panorama', ['id' => $panorama['id']])), |
| 80 | '' |
| 81 | ); |
| 82 | } |
| 83 | |
| 84 | return SearchResult::complete( |
| 85 | $this->l10n->t('Analytics'), |
| 86 | $result |
| 87 | ); |
| 88 | } |
| 89 | |
| 90 | public function getName(): string |
| 91 | { |
nothing calls this directly
no test coverage detected