當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。