예제 #1
0
 /**
  * @param ReservationItemView $res
  * @param UserSession $currentUser
  * @param IPrivacyFilter $privacyFilter
  * @param string|null $summaryFormat
  */
 public function __construct($res, UserSession $currentUser, IPrivacyFilter $privacyFilter, $summaryFormat = null)
 {
     if ($summaryFormat == null) {
         $summaryFormat = Configuration::Instance()->GetSectionKey(ConfigSection::RESERVATION_LABELS, ConfigKeys::RESERVATION_LABELS_ICS_SUMMARY);
     }
     $factory = new SlotLabelFactory($currentUser);
     $this->ReservationItemView = $res;
     $canViewUser = $privacyFilter->CanViewUser($currentUser, $res, $res->UserId);
     $canViewDetails = $privacyFilter->CanViewDetails($currentUser, $res, $res->UserId);
     $privateNotice = 'Private';
     $this->DateCreated = $res->CreatedDate;
     $this->DateEnd = $res->EndDate;
     $this->DateStart = $res->StartDate;
     $this->Description = $canViewDetails ? $res->Description : $privateNotice;
     $fullName = new FullName($res->OwnerFirstName, $res->OwnerLastName);
     $this->Organizer = $canViewUser ? $fullName->__toString() : $privateNotice;
     $this->OrganizerEmail = $canViewUser ? $res->OwnerEmailAddress : $privateNotice;
     $this->RecurRule = $this->CreateRecurRule($res);
     $this->ReferenceNumber = $res->ReferenceNumber;
     $this->Summary = $canViewDetails ? $factory->Format($res, $summaryFormat) : $privateNotice;
     $this->ReservationUrl = sprintf("%s/%s?%s=%s", Configuration::Instance()->GetScriptUrl(), Pages::RESERVATION, QueryStringKeys::REFERENCE_NUMBER, $res->ReferenceNumber);
     $this->Location = $res->ResourceName;
     $this->StartReminder = $res->StartReminder;
     $this->EndReminder = $res->EndReminder;
     if ($res->UserId == $currentUser->UserId) {
         $this->OrganizerEmail = str_replace('@', '-noreply@', $res->OwnerEmailAddress);
     }
 }
예제 #2
0
 public function From()
 {
     $bookedBy = $this->reservationSeries->BookedBy();
     if ($bookedBy != null) {
         $name = new FullName($bookedBy->FirstName, $bookedBy->LastName);
         return new EmailAddress($bookedBy->Email, $name->__toString());
     }
     return new EmailAddress($this->reservationOwner->EmailAddress(), $this->reservationOwner->FullName());
 }
예제 #3
0
 /**
  * @return array|EmailAddress[]|EmailAddress
  */
 public function To()
 {
     $name = new FullName($this->reminder->FirstName(), $this->reminder->LastName());
     return new EmailAddress($this->reminder->EmailAddress(), $name->__toString());
 }
예제 #4
0
 public function __construct($userId, $firstName, $lastName, $emailAddress, $timezone = null, $languageCode = null, $preferences = null)
 {
     $this->UserId = $userId;
     $this->FirstName = $firstName;
     $this->LastName = $lastName;
     $this->EmailAddress = $emailAddress;
     $this->Timezone = $timezone;
     $this->LanguageCode = $languageCode;
     $name = new FullName($this->FirstName(), $this->LastName());
     $this->FullName = $name->__toString() . " ({$this->EmailAddress})";
     $this->Preferences = UserPreferences::Parse($preferences)->All();
 }
예제 #5
0
 protected function GetFullName(ReservationItemView $reservation)
 {
     $name = new FullName($reservation->FirstName, $reservation->LastName);
     return $name->__toString();
 }
예제 #6
0
 public function __construct($userId, $firstName, $lastName, $email, $userName)
 {
     $full = new FullName($firstName, $lastName);
     $this->Id = $userId;
     $this->First = $firstName;
     $this->Last = $lastName;
     $this->Name = $full->__toString();
     $this->Email = $email;
     $this->UserName = $userName;
     $this->DisplayName = "{$full} ({$email})";
 }
예제 #7
0
 public function DisplayFullName($params, &$smarty)
 {
     $config = Configuration::Instance();
     $ignorePrivacy = false;
     if (isset($params['ignorePrivacy']) && strtolower($params['ignorePrivacy'] == 'true')) {
         $ignorePrivacy = true;
     }
     if (!$ignorePrivacy && $config->GetSectionKey(ConfigSection::PRIVACY, ConfigKeys::PRIVACY_HIDE_USER_DETAILS, new BooleanConverter()) && !ServiceLocator::GetServer()->GetUserSession()->IsAdmin) {
         return $this->Resources->GetString('Private');
     }
     $fullName = new FullName($params['first'], $params['last']);
     return htmlspecialchars($fullName->__toString());
 }
 public function testOrganizerIsDefaultedIfCurrentUserIsOrganizer()
 {
     // this fixes a bug in outlook which prevents you from adding a meeting that you are the organizer of
     $user = new FakeUserSession();
     $res = new ReservationItemView();
     $res->UserId = $user->UserId;
     $res->OwnerFirstName = "f";
     $res->OwnerLastName = "l";
     $res->OwnerEmailAddress = "*****@*****.**";
     $reservationView = new iCalendarReservationView($res, $user, $this->privacyFilter);
     $this->assertEquals('*****@*****.**', $reservationView->OrganizerEmail);
     $fullName = new FullName($res->OwnerFirstName, $res->OwnerLastName);
     $this->assertEquals($fullName->__toString(), $reservationView->Organizer);
 }