/** * @name GetSlots * @description Loads slots for a specific schedule * Optional query string parameters: resourceId, startDateTime, endDateTime. * If no dates are provided the default schedule dates will be returned. * If dates do not include the timezone offset, the timezone of the authenticated user will be assumed. * @response ScheduleSlotsResponse * @param $scheduleId * @return void */ public function GetSlots($scheduleId) { $startDate = $this->GetDate(WebServiceQueryStringKeys::START_DATE_TIME); $endDate = $this->GetDate(WebServiceQueryStringKeys::END_DATE_TIME); $resourceId = $this->server->GetQueryString(WebServiceQueryStringKeys::RESOURCE_ID); $scheduleWebServiceView = new ScheduleWebServiceView($scheduleId, $startDate); $permissionServiceFactory = new PermissionServiceFactory(); $scheduleRepository = new ScheduleRepository(); $userRepository = new UserRepository(); $resourceService = new ResourceService(new ResourceRepository(), $permissionServiceFactory->GetPermissionService(), new AttributeService(new AttributeRepository()), $userRepository); $builder = new ScheduleWebServicePageBuilder($startDate, $endDate, $resourceId); $reservationService = new ReservationService(new ReservationViewRepository(), new ReservationListingFactory()); $dailyLayoutFactory = new DailyLayoutFactory(); $scheduleService = new ScheduleService($scheduleRepository, $resourceService); $presenter = new SchedulePresenter($scheduleWebServiceView, $scheduleService, $resourceService, $builder, $reservationService, $dailyLayoutFactory); $presenter->PageLoad($this->server->GetSession()); $layout = $scheduleWebServiceView->GetDailyLayout(); $isError = $scheduleWebServiceView->IsPermissionError(); $dates = $scheduleWebServiceView->GetDates(); $resources = $scheduleWebServiceView->GetResources(); if ($isError) { $this->server->WriteResponse(RestResponse::Unauthorized(), RestResponse::UNAUTHORIZED_CODE); } else { $response = new ScheduleSlotsResponse($this->server, $scheduleId, $layout, $dates, $resources, $this->privacyFilter); $this->server->WriteResponse($response); } }
public function __construct($title = null) { parent::__construct($title); if (is_null($this->permissionServiceFactory)) { $this->permissionServiceFactory = new PermissionServiceFactory(); } $userRepository = new UserRepository(); $this->initializationFactory = new ReservationInitializerFactory(new ScheduleRepository(), $userRepository, new ResourceService(new ResourceRepository(), $this->permissionServiceFactory->GetPermissionService(), new AttributeService(new AttributeRepository()), $userRepository), new ReservationAuthorization(AuthorizationServiceFactory::GetAuthorizationService()), new AttributeRepository(), ServiceLocator::GetServer()->GetUserSession()); $this->presenter = $this->GetPresenter(); }
public function __construct() { parent::__construct('Schedule'); $permissionServiceFactory = new PermissionServiceFactory(); $scheduleRepository = new ScheduleRepository(); $userRepository = new UserRepository(); $resourceService = new ResourceService(new ResourceRepository(), $permissionServiceFactory->GetPermissionService(), new AttributeService(new AttributeRepository()), $userRepository); $pageBuilder = new SchedulePageBuilder(); $reservationService = new ReservationService(new ReservationViewRepository(), new ReservationListingFactory()); $dailyLayoutFactory = new DailyLayoutFactory(); $scheduleService = new ScheduleService($scheduleRepository, $resourceService); $this->_presenter = new SchedulePresenter($this, $scheduleService, $resourceService, $pageBuilder, $reservationService, $dailyLayoutFactory); }