service = $service; $this->l10n = $l10n; $this->urlGenerator = $urlGenerator; } public function getId(): string { return Application::ID; } public function getName(): string { return 'BBB'; } public function getOrder(string $route, array $routeParameters): int { if (strpos($route, Application::ID . '.') === 0) { return -1; } return Application::ORDER; } private function getAccess(string $access): string { switch ($access) { case 'public': $translatedAccess = $this->l10n->t('Public'); break; case 'password': $translatedAccess = $this->l10n->t('Internal + Password protection for guests'); break; case 'waiting_room': $translatedAccess = $this->l10n->t('Internal + Waiting room for guests'); break; case 'waiting_room_all': $translatedAccess = $this->l10n->t('Waiting room for all users'); break; case 'internal': $translatedAccess = $this->l10n->t('Internal'); break; case 'internal_restricted': $translatedAccess = $this->l10n->t('Internal restricted'); break; } return $translatedAccess; } public function search(IUser $user, ISearchQuery $query): SearchResult { $rooms = $this->service->search( $user, $query ); $results = array_map(function(Room $room) { return [ new SearchResultEntry( '', $room->getName(), $this->getAccess($room->getAccess()), $this->urlGenerator->linkToRoute('bbb.page.index'), $this->urlGenerator->imagePath('bbb', 'app-grey.svg') ) ]; }, $rooms); return SearchResult::complete( 'BBB', $results ); } }