configService->getAppValueBool(ConfigService::FRONTEND_ENABLED)) { throw new FrontendException('frontend disabled'); } $user = $this->userSession->getUser(); $this->federatedUserService->setLocalCurrentUser($user); $probe = new CircleProbe(); $probe->filterHiddenCircles() ->filterBackendCircles() ->setItemsLimit($limit) ->setItemsOffset($since ? (int)$since : 0); $circles = array_map(function (Circle $circle) { return new WidgetItem( $circle->getDisplayName(), '', $this->urlGenerator->getAbsoluteURL($this->modelManager->generateLinkToCircle($circle->getSingleId())), $this->urlGenerator->getAbsoluteURL($this->urlGenerator->linkToRoute('core.GuestAvatar.getAvatar', ['guestName' => $circle->getDisplayName(), 'size' => 64])) ); }, $this->circleService->probeCircles($probe)); } catch (\Exception $e) { $this->logger->error($e->getMessage(), ['exception' => $e]); } return new WidgetItems($circles); } /** * @inheritDoc */ public function getId(): string { return 'circles'; } /** * @inheritDoc */ public function getTitle(): string { return 'Teams'; } /** * @inheritDoc */ public function getOrder(): int { return 0; } /** * @inheritDoc */ public function getIconClass(): string { return 'icon-teams'; } /** * @inheritDoc */ public function getUrl(): ?string { return $this->getTeamPage(); } /** * @inheritDoc */ public function load(): void { } public function getWidgetButtons(string $userId): array { return [ new WidgetButton( WidgetButton::TYPE_MORE, $this->getTeamPage(), $this->l10n->t('Show all teams') ), new WidgetButton( WidgetButton::TYPE_SETUP, $this->getTeamPage(), $this->l10n->t('Create a new team') ), ]; } public function getIconUrl(): string { return $this->urlGenerator->getAbsoluteURL($this->urlGenerator->imagePath('circles', 'circles-dark.svg')); } private function getTeamPage(): string { return $this->urlGenerator->getAbsoluteURL( $this->urlGenerator->linkToRoute('contacts.page.index') ); } public function isEnabled(): bool { return $this->appManager->isEnabledForUser('contacts') && $this->configService->getAppValueBool(ConfigService::FRONTEND_ENABLED); } }