viewHandler = $viewHandler; } /** * Returns the user specific locale configuration * * @SWG\Response( * response=200, * description="Returns the locale specific configurations for this user", * @SWG\Schema(ref=@Model(type=I18nConfig::class)) * ) * * @Rest\Get(path="/config/i18n") * * @ApiSecurity(name="apiUser") * @ApiSecurity(name="apiToken") */ public function i18nAction(LanguageFormattings $formats): Response { /** @var User $user */ $user = $this->getUser(); $locale = $user->getLocale(); $model = new I18nConfig(); $model ->setFormDate($formats->getDateTypeFormat($locale)) ->setDateTime($formats->getDateTimeFormat($locale)) ->setDate($formats->getDateFormat($locale)) ->setDuration($formats->getDurationFormat($locale)) ->setTime($formats->getTimeFormat($locale)) ->setIs24hours($user->is24Hour()) ->setNow($this->getDateTimeFactory()->createDateTime()) ; $view = new View($model, 200); $view->getContext()->setGroups(['Default', 'Config']); return $this->viewHandler->handle($view); } /** * Returns the timesheet configuration * * @SWG\Response( * response=200, * description="Returns the instance specific timesheet configuration", * @SWG\Schema(ref=@Model(type=TimesheetConfig::class)) * ) * * @Rest\Get(path="/config/timesheet") * * @ApiSecurity(name="apiUser") * @ApiSecurity(name="apiToken") */ public function timesheetConfigAction(SystemConfiguration $configuration): Response { $model = new TimesheetConfig(); $model ->setTrackingMode($configuration->getTimesheetTrackingMode()) ->setDefaultBeginTime($configuration->getTimesheetDefaultBeginTime()) ->setActiveEntriesHardLimit($configuration->getTimesheetActiveEntriesHardLimit()) ->setActiveEntriesSoftLimit($configuration->getTimesheetActiveEntriesSoftLimit()) ->setIsAllowFutureTimes($configuration->isTimesheetAllowFutureTimes()) ->setIsAllowOverlapping($configuration->isTimesheetAllowOverlappingRecords()) ; $view = new View($model, 200); $view->getContext()->setGroups(['Default', 'Config']); return $this->viewHandler->handle($view); } }