Пример #1
0
 /**
  * Returns an instance of class
  *
  * @return MEMBERSHIP_BOL_MembershipUserDao
  */
 public static function getInstance()
 {
     if (self::$classInstance === null) {
         self::$classInstance = new self();
     }
     return self::$classInstance;
 }
Пример #2
0
 /**
  * @param $userId
  * @param $membershipLabel
  * @return bool
  */
 public function sendMembershipExpiresTodayNotification($userId, $membershipLabel)
 {
     if (!$userId) {
         return false;
     }
     $user = BOL_UserService::getInstance()->findUserById($userId);
     if (!$user) {
         return false;
     }
     $userMembership = $this->getUserMembership($userId);
     if (!$userMembership) {
         return false;
     }
     $lang = OW::getLanguage();
     $email = $user->email;
     $subject = $lang->text('membership', 'plan_expires_today_notification_subject');
     $assigns = array('membership' => $membershipLabel, 'name' => BOL_UserService::getInstance()->getDisplayName($userId));
     $text = $lang->text('membership', 'plan_expires_today_notification_text', $assigns);
     $html = $lang->text('membership', 'plan_expires_today_notification_html', $assigns);
     try {
         $mail = OW::getMailer()->createMail()->addRecipientEmail($email)->setTextContent($text)->setHtmlContent($html)->setSubject($subject);
         OW::getMailer()->send($mail);
         $userMembership->expirationNotified = 2;
         $this->membershipUserDao->save($userMembership);
     } catch (Exception $e) {
         return false;
     }
     return true;
 }
Пример #3
0
 public function deleleUserMembershipByUserId($userId)
 {
     $membership = $this->getUserMembership($userId);
     if ($membership) {
         $this->membershipUserDao->delete($membership);
     }
     return true;
 }