/**
  * @return string
  */
 function Body()
 {
     $activationUrl = new Url(Configuration::Instance()->GetScriptUrl());
     $activationUrl->Add(Pages::ACTIVATION)->AddQueryString(QueryStringKeys::ACCOUNT_ACTIVATION_CODE, $this->activationCode);
     $this->Set('FirstName', $this->user->FirstName());
     $this->Set('EmailAddress', $this->user->EmailAddress());
     $this->Set('ActivationUrl', $activationUrl);
     return $this->FetchTemplate('AccountActivation.tpl');
 }
 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());
 }
Example #3
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'));
     return $this->FetchTemplate('AccountCreation.tpl');
 }
Example #4
0
 public function HandleSelfRegistration(User $user, IRegistrationPage $page, ILoginContext $loginContext)
 {
     if ($user->StatusId() == AccountStatus::ACTIVE) {
         Log::Debug('PostRegistration - Handling activate user %s', $user->EmailAddress());
         $this->authentication->Login($user->EmailAddress(), $loginContext);
         $page->Redirect(Pages::UrlFromId($user->Homepage()));
     } else {
         Log::Debug('PostRegistration - Handling pending user %s', $user->EmailAddress());
         $this->activation->Notify($user);
         $page->Redirect(Pages::ACTIVATION);
     }
 }
Example #5
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');
 }
Example #6
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();
     }
 }
Example #7
0
 private function GeneratePayUForm($trainingLevel, $trainingType, User $user)
 {
     //$liveUpdate = new PayuLu('PAYUDEMO','P5@F8*3!m0+?^9s3&u8(');
     $liveUpdate = new PayuLu('OPU_TEST', 'SECRET_KEY');
     //Show all errors
     $liveUpdate->setDebug(PayuLu::DEBUG_ALL);
     //pname,pcode,pinfo,price,priceType,quantity,tax
     $pname = $trainingLevel . " Yelkencilik Egitimi";
     $pcode = "1112000112";
     $pinfo = "Yelkencilik Egitimi";
     $price = $this->_price;
     $priceType = "NET";
     $quantity = "1";
     $tax = "18";
     $product = new PayuProduct($pname, $pcode, $pinfo, $price, $priceType, $quantity, $tax);
     $liveUpdate->setOrderRef($this->user->GetPublicId());
     $liveUpdate->addProduct($product);
     //Billing adresi hash stringe dahil olmaz. Dolay?s?yla hash de?erinin
     //hesab?na bir etkisi yoktur.
     //Fakat billing bilgisinin gönderilmesi zorunludur.
     //Bundan dolay? billing için first name, last name ve email gönderilmelidir
     $billing = new PayuAddress();
     $billing->setFirstName($user->FirstName());
     $billing->setLastName($user->LastName());
     $billing->setEmail($user->EmailAddress());
     //$billing->setCity("Ka??thane"); //Ilce/Semt
     //$billing->setState("Istanbul"); //Sehir
     $billing->setCountryCode("TR");
     $liveUpdate->setBillingAddress($billing);
     $liveUpdate->setPaymentCurrency("TRY");
     $liveUpdate->setInstalments("3,4");
     $liveUpdate->setOrderShipping("");
     $liveUpdate->setBackRef("");
     $liveUpdate->setButtonName('Şimdi Öde');
     $t = $liveUpdate->renderPaymentForm();
     return $t;
 }
Example #8
0
 /**
  * @param User $user
  * @return bool
  */
 public function IsApplicationAdministrator(User $user)
 {
     if ($user->EmailAddress() == Configuration::Instance()->GetKey(ConfigKeys::ADMIN_EMAIL)) {
         return true;
     }
     return $user->IsInRole(RoleLevel::APPLICATION_ADMIN);
 }
 public function To()
 {
     $address = $this->participant->EmailAddress();
     $name = $this->participant->FullName();
     return array(new EmailAddress($address, $name));
 }
Example #10
0
 /**
  * @param User $user
  * @return void
  */
 public function Update(User $user)
 {
     $userId = $user->Id();
     $db = ServiceLocator::GetDatabase();
     $updateUserCommand = new UpdateUserCommand($user->Id(), $user->StatusId(), $user->encryptedPassword, $user->passwordSalt, $user->FirstName(), $user->LastName(), $user->EmailAddress(), $user->Username(), $user->Homepage(), $user->Timezone(), $user->LastLogin(), $user->GetIsCalendarSubscriptionAllowed(), $user->GetPublicId(), $user->Language(), $user->GetDefaultScheduleId());
     $db->Execute($updateUserCommand);
     $removedPermissions = $user->GetRemovedPermissions();
     foreach ($removedPermissions as $resourceId) {
         $db->Execute(new DeleteUserResourcePermission($userId, $resourceId));
     }
     $addedPermissions = $user->GetAddedPermissions();
     foreach ($addedPermissions as $resourceId) {
         $db->Execute(new AddUserResourcePermission($userId, $resourceId));
     }
     if ($user->HaveAttributesChanged()) {
         $updateAttributesCommand = new UpdateUserAttributesCommand($userId, $user->GetAttribute(UserAttribute::Phone), $user->GetAttribute(UserAttribute::Organization), $user->GetAttribute(UserAttribute::Position));
         $db->Execute($updateAttributesCommand);
     }
     $removedPreferences = $user->GetRemovedEmailPreferences();
     foreach ($removedPreferences as $event) {
         $db->Execute(new DeleteEmailPreferenceCommand($userId, $event->EventCategory(), $event->EventType()));
     }
     $addedPreferences = $user->GetAddedEmailPreferences();
     foreach ($addedPreferences as $event) {
         $db->Execute(new AddEmailPreferenceCommand($userId, $event->EventCategory(), $event->EventType()));
     }
     foreach ($user->GetRemovedAttributes() as $removed) {
         $db->Execute(new RemoveAttributeValueCommand($removed->AttributeId, $user->Id()));
     }
     foreach ($user->GetAddedAttributes() as $added) {
         $db->Execute(new AddAttributeValueCommand($added->AttributeId, $added->Value, $user->Id(), CustomAttributeCategory::USER));
     }
     foreach ($user->GetPreferences()->AddedPreferences() as $added) {
         $db->Execute(new AddUserPreferenceCommand($user->Id(), $added, $user->GetPreference($added)));
     }
     foreach ($user->GetPreferences()->ChangedPreferences() as $updated) {
         $db->Execute(new UpdateUserPreferenceCommand($user->Id(), $updated, $user->GetPreference($updated)));
     }
     foreach ($user->GetRemovedGroups() as $removed) {
         $db->Execute(new DeleteUserGroupCommand($user->Id(), $removed->GroupId));
     }
     foreach ($user->GetAddedGroups() as $added) {
         $db->Execute(new AddUserGroupCommand($user->Id(), $added->GroupId));
     }
 }
Example #11
0
 /**
  * @return EmailAddress[]
  */
 function To()
 {
     return new EmailAddress($this->user->EmailAddress(), $this->user->FullName());
 }
 public function From()
 {
     return new EmailAddress($this->reservationOwner->EmailAddress(), $this->reservationOwner->FullName());
 }
Example #13
0
 public function To()
 {
     $address = $this->invitee->EmailAddress();
     $name = $this->invitee->FullName();
     return array(new EmailAddress($address, $name));
 }
Example #14
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;
 }