当前位置: 首页>>代码示例>>PHP>>正文


PHP ServiceLocator::GetEmailService方法代码示例

本文整理汇总了PHP中ServiceLocator::GetEmailService方法的典型用法代码示例。如果您正苦于以下问题:PHP ServiceLocator::GetEmailService方法的具体用法?PHP ServiceLocator::GetEmailService怎么用?PHP ServiceLocator::GetEmailService使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ServiceLocator的用法示例。


在下文中一共展示了ServiceLocator::GetEmailService方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: Register

 public function Register($username, $email, $firstName, $lastName, $password, $timezone, $language, $homepageId, $additionalFields = array(), $attributeValues = array(), $groups = null)
 {
     $encryptedPassword = $this->_passwordEncryption->EncryptPassword($password);
     $attributes = new UserAttribute($additionalFields);
     if ($this->CreatePending()) {
         $user = User::CreatePending($firstName, $lastName, $email, $username, $language, $timezone, $encryptedPassword->EncryptedPassword(), $encryptedPassword->Salt(), $homepageId);
     } else {
         $user = User::Create($firstName, $lastName, $email, $username, $language, $timezone, $encryptedPassword->EncryptedPassword(), $encryptedPassword->Salt(), $homepageId);
     }
     $user->ChangeAttributes($attributes->Get(UserAttribute::Phone), $attributes->Get(UserAttribute::Organization), $attributes->Get(UserAttribute::Position));
     $user->ChangeCustomAttributes($attributeValues);
     if ($groups != null) {
         $user->WithGroups($groups);
     }
     if (Configuration::Instance()->GetKey(ConfigKeys::REGISTRATION_AUTO_SUBSCRIBE_EMAIL, new BooleanConverter())) {
         foreach (ReservationEvent::AllEvents() as $event) {
             $user->ChangeEmailPreference($event, true);
         }
     }
     $userId = $this->_userRepository->Add($user);
     $this->AutoAssignPermissions($userId);
     if (Configuration::Instance()->GetKey(ConfigKeys::REGISTRATION_NOTIFY, new BooleanConverter())) {
         ServiceLocator::GetEmailService()->Send(new AccountCreationEmail($user, ServiceLocator::GetServer()->GetUserSession()));
     }
     return $user;
 }
开发者ID:ajeshgeorge22,项目名称:booked,代码行数:26,代码来源:Registration.php

示例2: Notify

 /**
  * @param ReservationSeries $reservationSeries
  * @return void
  */
 public function Notify($reservationSeries)
 {
     $resourceAdmins = array();
     $applicationAdmins = array();
     $groupAdmins = array();
     if ($this->SendForResourceAdmins($reservationSeries)) {
         $resourceAdmins = $this->userViewRepo->GetResourceAdmins($reservationSeries->ResourceId());
     }
     if ($this->SendForApplicationAdmins($reservationSeries)) {
         $applicationAdmins = $this->userViewRepo->GetApplicationAdmins();
     }
     if ($this->SendForGroupAdmins($reservationSeries)) {
         $groupAdmins = $this->userViewRepo->GetGroupAdmins($reservationSeries->UserId());
     }
     $admins = array_merge($resourceAdmins, $applicationAdmins, $groupAdmins);
     if (count($admins) == 0) {
         // skip if there is nobody to send to
         return;
     }
     $owner = $this->userRepo->LoadById($reservationSeries->UserId());
     $resource = $reservationSeries->Resource();
     $adminIds = array();
     /** @var $admin UserDto */
     foreach ($admins as $admin) {
         $id = $admin->Id();
         if (array_key_exists($id, $adminIds) || $id == $owner->Id()) {
             // only send to each person once
             continue;
         }
         $adminIds[$id] = true;
         $message = $this->GetMessage($admin, $owner, $reservationSeries, $resource);
         ServiceLocator::GetEmailService()->Send($message);
     }
 }
开发者ID:Trideon,项目名称:gigolo,代码行数:38,代码来源:AdminEmailNotification.php

示例3: Notify

 /**
  * @param ReservationSeries $reservationSeries
  */
 function Notify($reservationSeries)
 {
     $instance = $reservationSeries->CurrentInstance();
     $owner = $this->userRepository->LoadById($reservationSeries->UserId());
     foreach ($instance->UnchangedParticipants() as $userId) {
         $participant = $this->userRepository->LoadById($userId);
         $message = new ParticipantUpdatedEmail($owner, $participant, $reservationSeries, $this->attributeRepository);
         ServiceLocator::GetEmailService()->Send($message);
     }
 }
开发者ID:ksdtech,项目名称:booked,代码行数:13,代码来源:ParticipantUpdatedEmailNotification.php

示例4: Notify

 /**
  * @param ReservationSeries $reservation
  * @return void
  */
 public function Notify($reservation)
 {
     $owner = $this->_userRepo->LoadById($reservation->UserId());
     if ($this->ShouldSend($owner)) {
         $message = $this->GetMessage($owner, $reservation, $this->_attributeRepo);
         ServiceLocator::GetEmailService()->Send($message);
     } else {
         Log::Debug('Owner does not want these types of email notifications. Email=%s, ReferenceNumber=%s', $owner->EmailAddress(), $reservation->CurrentInstance()->ReferenceNumber());
     }
 }
开发者ID:hugutux,项目名称:booked,代码行数:14,代码来源:OwnerEmailNotification.php

示例5: Notify

 /**
  * @param ReservationSeries $reservationSeries
  */
 function Notify($reservationSeries)
 {
     $owner = null;
     $instance = $reservationSeries->CurrentInstance();
     foreach ($instance->UnchangedInvitees() as $userId) {
         if ($owner == null) {
             $owner = $this->userRepository->LoadById($reservationSeries->UserId());
         }
         $invitee = $this->userRepository->LoadById($userId);
         $message = new InviteeAddedEmail($owner, $invitee, $reservationSeries, $this->attributeRepository);
         ServiceLocator::GetEmailService()->Send($message);
     }
 }
开发者ID:ksdtech,项目名称:booked,代码行数:16,代码来源:InviteeUpdatedEmailNotification.php

示例6: SendRandomPassword

 public function SendRandomPassword()
 {
     $emailAddress = $this->_page->GetEmailAddress();
     Log::Debug('Password reset request for email address %s requested from REMOTE_ADDR: %s REMOTE_HOST: %s', $emailAddress, $_SERVER['REMOTE_ADDR'], $_SERVER['REMOTE_HOST']);
     $temporaryPassword = Password::GenerateRandom();
     $passwordEncryption = new PasswordEncryption();
     $salt = $passwordEncryption->Salt();
     $encrypted = $passwordEncryption->Encrypt($temporaryPassword, $salt);
     $userRepository = new UserRepository();
     $user = $userRepository->FindByEmail($emailAddress);
     if ($user != null) {
         $user->ChangePassword($encrypted, $salt);
         $userRepository->Update($user);
         $emailMessage = new ForgotPasswordEmail($user, $temporaryPassword);
         ServiceLocator::GetEmailService()->Send($emailMessage);
     }
 }
开发者ID:hugutux,项目名称:booked,代码行数:17,代码来源:ForgotPwdPresenter.php

示例7: SendReport

 public function SendReport($report, $definition, $toAddress, $reportUser)
 {
     $message = new ReportEmailMessage($report, $definition, $toAddress, $reportUser);
     ServiceLocator::GetEmailService()->Send($message);
 }
开发者ID:JoseTfg,项目名称:Booked,代码行数:5,代码来源:ReportingService.php

示例8: Add

 /**
  * @param User $user
  * @return int
  */
 public function Add(User $user)
 {
     $db = ServiceLocator::GetDatabase();
     $id = $db->ExecuteInsert(new RegisterUserCommand($user->Username(), $user->EmailAddress(), $user->FirstName(), $user->LastName(), $user->encryptedPassword, $user->passwordSalt, $user->Timezone(), $user->Language(), $user->Homepage(), $user->GetAttribute(UserAttribute::Phone), $user->GetAttribute(UserAttribute::Organization), $user->GetAttribute(UserAttribute::Position), $user->StatusId(), $user->GetPublicId(), $user->GetDefaultScheduleId()));
     $user->WithId($id);
     if (Configuration::Instance()->GetKey(ConfigKeys::REGISTRATION_NOTIFY, new BooleanConverter())) {
         ServiceLocator::GetEmailService()->Send(new AccountCreationEmail($user));
     }
     foreach ($user->GetAddedAttributes() as $added) {
         $db->Execute(new AddAttributeValueCommand($added->AttributeId, $added->Value, $user->Id(), CustomAttributeCategory::USER));
     }
     $addedPreferences = $user->GetAddedEmailPreferences();
     foreach ($addedPreferences as $event) {
         $db->Execute(new AddEmailPreferenceCommand($id, $event->EventCategory(), $event->EventType()));
     }
     $userGroups = $user->Groups();
     if (!empty($userGroups)) {
         foreach ($userGroups as $group) {
             $db->Execute(new AddUserGroupCommand($id, $group->GroupId));
         }
     }
     return $id;
 }
开发者ID:ksdtech,项目名称:booked,代码行数:27,代码来源:UserRepository.php

示例9: define

This script must be executed every minute for to enable Reservation Reminders functionality

* * * * * php -f /home/mydomain/public_html/booked/Jobs/sendreminders.php
* * * * * /path/to/php -f /home/mydomain/public_html/booked/Jobs/sendreminders.php

*/
define('ROOT_DIR', dirname(__FILE__) . '/../');
//define('ROOT_DIR', __DIR__ . '/../');
require_once ROOT_DIR . 'Domain/Access/namespace.php';
require_once ROOT_DIR . 'Domain/Reminder.php';
require_once ROOT_DIR . 'lib/Email/Messages/ReminderEmail.php';
require_once ROOT_DIR . 'Jobs/JobCop.php';
Log::Debug('Running sendreminders.php');
JobCop::EnsureCommandLine();
try {
    $repository = new ReminderRepository();
    $now = Date::Now();
    $startNotices = $repository->GetReminderNotices($now, ReservationReminderType::Start);
    Log::Debug('Found %s start reminders', count($startNotices));
    foreach ($startNotices as $notice) {
        ServiceLocator::GetEmailService()->Send(new ReminderStartEmail($notice));
    }
    $endNotices = $repository->GetReminderNotices(Date::Now(), ReservationReminderType::End);
    Log::Debug('Found %s end reminders', count($endNotices));
    foreach ($endNotices as $notice) {
        ServiceLocator::GetEmailService()->Send(new ReminderEndEmail($notice));
    }
} catch (Exception $ex) {
    Log::Error('Error running sendreminders.php: %s', $ex);
}
Log::Debug('Finished running sendreminders.php');
开发者ID:ksdtech,项目名称:booked,代码行数:31,代码来源:sendreminders.php

示例10: Notify

 public function Notify(User $user)
 {
     $activationCode = uniqid();
     $this->activationRepository->AddActivation($user, $activationCode);
     ServiceLocator::GetEmailService()->Send(new AccountActivationEmail($user, $activationCode));
 }
开发者ID:Trideon,项目名称:gigolo,代码行数:6,代码来源:AccountActivation.php

示例11: DeleteUser

 public function DeleteUser($userId)
 {
     $user = $this->userRepository->LoadById($userId);
     $this->userRepository->DeleteById($userId);
     if (Configuration::Instance()->GetKey(ConfigKeys::REGISTRATION_NOTIFY, new BooleanConverter())) {
         $currentUser = ServiceLocator::GetServer()->GetUserSession();
         $applicationAdmins = $this->userViewRepository->GetApplicationAdmins();
         $groupAdmins = $this->userViewRepository->GetGroupAdmins($userId);
         foreach ($applicationAdmins as $applicationAdmin) {
             ServiceLocator::GetEmailService()->Send(new AccountDeletedEmail($user, $applicationAdmin, $currentUser));
         }
         foreach ($groupAdmins as $groupAdmin) {
             ServiceLocator::GetEmailService()->Send(new AccountDeletedEmail($user, $groupAdmin, $currentUser));
         }
     }
 }
开发者ID:JoseTfg,项目名称:Booked,代码行数:16,代码来源:ManageUsersService.php


注:本文中的ServiceLocator::GetEmailService方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。