public function __construct(IRestServer $server, IReservationSlot $slot, IPrivacyFilter $privacyFilter) { $user = $server->GetSession(); $slotLabelFactory = $user->IsAdmin ? new AdminSlotLabelFactory() : new SlotLabelFactory($user); $this->slotSpan = $slot->PeriodSpan(); $this->isReserved = $slot->IsReserved(); $this->label = $slot->Label($slotLabelFactory); $this->isReservable = $slot->IsReservable(); $this->color = $slot->Color(); $this->startDateTime = $slot->BeginDate()->ToIso(); $this->endDateTime = $slot->EndDate()->ToIso(); if ($slot->IsReserved()) { /** @var ReservationSlot $slot */ $reservation = $slot->Reservation(); $showUser = $privacyFilter->CanViewUser($user, null, $reservation->UserId); $showDetails = $privacyFilter->CanViewDetails($user, null, $reservation->UserId); $this->reservation = new ReservationItemResponse($reservation, $server, $showUser, $showDetails); } }
private function AmIParticipating(IReservationSlot $slot) { $mySession = ServiceLocator::GetServer()->GetUserSession(); return $slot->IsParticipating($mySession); }
private function IsMyPending(IReservationSlot $slot) { $mySession = ServiceLocator::GetServer()->GetUserSession(); return $slot->IsOwnedBy($mySession) && $slot->IsPending(); }