Пример #1
0
 /**
  * @return string
  */
 function Body()
 {
     $this->Set('To', Configuration::Instance()->GetKey(ConfigKeys::ADMIN_EMAIL_NAME) ? Configuration::Instance()->GetKey(ConfigKeys::ADMIN_EMAIL_NAME) : 'Administrator');
     $this->Set('FullName', $this->user->FullName());
     $this->Set('EmailAddress', $this->user->EmailAddress());
     $this->Set('Phone', $this->user->GetAttribute('Phone'));
     $this->Set('Organization', $this->user->GetAttribute('Organization'));
     $this->Set('Position', $this->user->GetAttribute('Position'));
     if ($this->userSession != null && $this->userSession->UserId != $this->user->Id()) {
         $this->Set('CreatedBy', new FullName($this->userSession->FirstName, $this->userSession->LastName));
     }
     return $this->FetchTemplate('AccountCreation.tpl');
 }
Пример #2
0
 public function __construct(IRestServer $server, User $user, IEntityAttributeList $attributes)
 {
     $userId = $user->Id();
     $this->id = $userId;
     $this->emailAddress = $user->EmailAddress();
     $this->firstName = $user->FirstName();
     $this->lastName = $user->LastName();
     $this->language = $user->Language();
     $this->lastLogin = Date::FromDatabase($user->LastLogin())->ToIso();
     $this->organization = $user->GetAttribute(UserAttribute::Organization);
     $this->phoneNumber = $user->GetAttribute(UserAttribute::Phone);
     $this->position = $user->GetAttribute(UserAttribute::Position);
     $this->statusId = $user->StatusId();
     $this->timezone = $user->Timezone();
     $this->username = $user->Username();
     $attributeValues = $attributes->GetAttributes($userId);
     if (!empty($attributeValues)) {
         foreach ($attributeValues as $av) {
             $this->customAttributes[] = new CustomAttributeResponse($server, $av->Id(), $av->Label(), $av->Value());
         }
     }
     foreach ($user->AllowedResourceIds() as $allowedResourceId) {
         $this->permissions[] = new ResourceItemResponse($server, $allowedResourceId, '');
     }
     foreach ($user->Groups() as $group) {
         $this->groups[] = new GroupItemResponse($server, $group->GroupId, $group->GroupName);
     }
     if ($user->GetIsCalendarSubscriptionAllowed()) {
         $url = new CalendarSubscriptionUrl($user->GetPublicId(), null, null);
         $this->icsUrl = $url->__toString();
     }
 }
 private function PopulateTemplate()
 {
     $this->Set('UserName', $this->reservationOwner->FullName());
     $currentInstance = $this->reservationSeries->CurrentInstance();
     $this->Set('StartDate', $currentInstance->StartDate()->ToTimezone($this->timezone));
     $this->Set('EndDate', $currentInstance->EndDate()->ToTimezone($this->timezone));
     $this->Set('ResourceName', $this->resource->GetName());
     $this->Set('Title', $this->reservationSeries->Title());
     $this->Set('Description', $this->reservationSeries->Description());
     $repeatDates = array();
     foreach ($this->reservationSeries->Instances() as $repeated) {
         $repeatDates[] = $repeated->StartDate()->ToTimezone($this->timezone);
     }
     $this->Set('RequiresApproval', $this->reservationSeries->RequiresApproval());
     $this->Set('RepeatDates', $repeatDates);
     $this->Set('ReservationUrl', Pages::RESERVATION . "?" . QueryStringKeys::REFERENCE_NUMBER . '=' . $currentInstance->ReferenceNumber());
     $resourceNames = array();
     foreach ($this->reservationSeries->AllResources() as $resource) {
         $resourceNames[] = $resource->GetName();
     }
     $this->Set('ResourceNames', $resourceNames);
     $this->Set('Accessories', $this->reservationSeries->Accessories());
     $attributes = $this->attributeRepository->GetByCategory(CustomAttributeCategory::RESERVATION);
     $attributeValues = array();
     foreach ($attributes as $attribute) {
         $attributeValues[] = new Attribute($attribute, $this->reservationSeries->GetAttributeValue($attribute->Id()));
     }
     $this->Set('Attributes', $attributeValues);
     $bookedBy = $this->reservationSeries->BookedBy();
     if ($bookedBy != null && $bookedBy->UserId != $this->reservationOwner->Id()) {
         $this->Set('CreatedBy', new FullName($bookedBy->FirstName, $bookedBy->LastName));
     }
 }
 protected function PopulateTemplate()
 {
     $currentInstance = $this->reservationSeries->CurrentInstance();
     $this->Set('UserName', $this->reservationOwner->FullName());
     $this->Set('StartDate', $currentInstance->StartDate()->ToTimezone($this->timezone));
     $this->Set('EndDate', $currentInstance->EndDate()->ToTimezone($this->timezone));
     $this->Set('ResourceName', $this->reservationSeries->Resource()->GetName());
     $img = $this->reservationSeries->Resource()->GetImage();
     if (!empty($img)) {
         $this->Set('ResourceImage', $this->GetFullImagePath($img));
     }
     $this->Set('Title', $this->reservationSeries->Title());
     $this->Set('Description', $this->reservationSeries->Description());
     $repeatDates = array();
     if ($this->reservationSeries->IsRecurring()) {
         foreach ($this->reservationSeries->Instances() as $repeated) {
             $repeatDates[] = $repeated->StartDate()->ToTimezone($this->timezone);
         }
     }
     $this->Set('RepeatDates', $repeatDates);
     $this->Set('RequiresApproval', $this->reservationSeries->RequiresApproval());
     $this->Set('ReservationUrl', sprintf("%s?%s=%s", Pages::RESERVATION, QueryStringKeys::REFERENCE_NUMBER, $currentInstance->ReferenceNumber()));
     $icalUrl = sprintf("export/%s?%s=%s", Pages::CALENDAR_EXPORT, QueryStringKeys::REFERENCE_NUMBER, $currentInstance->ReferenceNumber());
     $this->Set('ICalUrl', $icalUrl);
     $resourceNames = array();
     foreach ($this->reservationSeries->AllResources() as $resource) {
         $resourceNames[] = $resource->GetName();
     }
     $this->Set('ResourceNames', $resourceNames);
     $this->Set('Accessories', $this->reservationSeries->Accessories());
     $attributes = $this->attributeRepository->GetByCategory(CustomAttributeCategory::RESERVATION);
     $attributeValues = array();
     foreach ($attributes as $attribute) {
         $attributeValues[] = new Attribute($attribute, $this->reservationSeries->GetAttributeValue($attribute->Id()));
     }
     $this->Set('Attributes', $attributeValues);
     $bookedBy = $this->reservationSeries->BookedBy();
     if ($bookedBy != null && $bookedBy->UserId != $this->reservationOwner->Id()) {
         $this->Set('CreatedBy', new FullName($bookedBy->FirstName, $bookedBy->LastName));
     }
 }
Пример #5
0
 public function AddActivation(User $user, $activationCode)
 {
     ServiceLocator::GetDatabase()->ExecuteInsert(new AddAccountActivationCommand($user->Id(), $activationCode));
 }
Пример #6
0
 /**
  * @param User $user
  * @param string $loginTime
  * @return UserSession
  */
 private function GetUserSession(User $user, $loginTime)
 {
     $userSession = new UserSession($user->Id());
     $userSession->Email = $user->EmailAddress();
     $userSession->FirstName = $user->FirstName();
     $userSession->LastName = $user->LastName();
     $userSession->Timezone = $user->Timezone();
     $userSession->HomepageId = $user->Homepage();
     $userSession->LanguageCode = $user->Language();
     $userSession->LoginTime = $loginTime;
     $userSession->PublicId = $user->GetPublicId();
     $userSession->ScheduleId = $user->GetDefaultScheduleId();
     $userSession->IsAdmin = $this->roleService->IsApplicationAdministrator($user);
     $userSession->IsGroupAdmin = $this->roleService->IsGroupAdministrator($user);
     $userSession->IsResourceAdmin = $this->roleService->IsResourceAdministrator($user);
     $userSession->IsScheduleAdmin = $this->roleService->IsScheduleAdministrator($user);
     $userSession->CSRFToken = base64_encode(md5(uniqid(rand(), true)));
     foreach ($user->Groups() as $group) {
         $userSession->Groups[] = $group->GroupId;
     }
     foreach ($user->GetAdminGroups() as $group) {
         $userSession->AdminGroups[] = $group->GroupId;
     }
     return $userSession;
 }
Пример #7
0
 public static function Add($bet, $payout, $profit, $coinCode)
 {
     DB::table('History')->insert(['userId' => User::Id(), 'time' => time(), 'bet' => $bet, 'payout' => $payout, 'profit' => $profit, 'currency' => $coinCode, 'created_at' => time(), 'updated_at' => time()]);
 }