calendarService = $calendarService; } /** * Display the Connect Calendar modal with available providers. */ #[RequiresPermission(CalendarPermissions::CREATE)] public function get(array $params): Response { $providers = self::dispatchFilter('connectOptions.providers', []); $this->tpl->assign('providers', $providers); return $this->tpl->displayPartial('calendar.connectCalendar'); } /** * Handle iCal calendar import submission. */ #[RequiresPermission(CalendarPermissions::CREATE)] public function post(array $params): Response { if (isset($params['name']) || isset($params['url'])) { $values = [ 'url' => $params['url'] ?? '', 'name' => $params['name'] ?? 'My Calendar', 'colorClass' => $params['colorClass'] ?? '#082236', ]; $this->calendarService->addExternalCalendarUrl($values); $this->tpl->setNotification('notification.gcal_imported_successfully', 'success', 'externalcalendar_created'); } return FrontcontrollerCore::redirect(BASE_URL.'/calendar/showMyCalendar'); } }