private function sendRegistrationInformation(Partner $partner, kuser $adminKuser, $existingUser, $recipient_email = null, $partner_type = 1)
 {
     $mailType = null;
     $bodyParams = array();
     $partnerId = $partner->getId();
     $userName = $adminKuser->getFullName();
     if (!$userName) {
         $userName = $adminKuser->getPuserId();
     }
     $loginEmail = $adminKuser->getEmail();
     $loginData = $adminKuser->getLoginData();
     $hashKey = $loginData->getNewHashKeyIfCurrentInvalid();
     $resetPasswordLink = UserLoginDataPeer::getPassResetLink($hashKey);
     $kmcLink = trim(kConf::get('apphome_url'), '/') . '/kmc';
     $contactLink = kConf::get('contact_url');
     $contactPhone = kConf::get('contact_phone_number');
     $beginnersGuideLink = kConf::get('beginners_tutorial_url');
     $quickStartGuideLink = kConf::get('quick_start_guide_url');
     if ($recipient_email == null) {
         $recipient_email = $loginEmail;
     }
     // send the $cms_email,$cms_password, TWICE !
     if (kConf::get('kaltura_installation_type') == 'CE') {
         $partner_type = 1;
     }
     switch ($partner_type) {
         // send different email for different partner types
         case 1:
             // KMC signup
             if ($existingUser) {
                 $mailType = self::KALTURAS_EXISTING_USER_REGISTRATION_CONFIRMATION;
                 $bodyParams = array($userName, $loginEmail, $partnerId, $contactLink, $contactPhone, $beginnersGuideLink, $quickStartGuideLink);
             } else {
                 $mailType = self::KALTURAS_CMS_REGISTRATION_CONFIRMATION;
                 $bodyParams = array($userName, $loginEmail, $partnerId, $resetPasswordLink, $kmcLink, $contactLink, $contactPhone, $beginnersGuideLink, $quickStartGuideLink);
             }
             break;
         default:
             // all others
             if ($existingUser) {
                 $mailType = self::KALTURAS_DEFAULT_EXISTING_USER_REGISTRATION_CONFIRMATION;
                 $bodyParams = array($userName, $loginEmail, $partnerId, $contactLink, $contactPhone, $beginnersGuideLink, $quickStartGuideLink);
             } else {
                 $mailType = self::KALTURAS_DEFAULT_REGISTRATION_CONFIRMATION;
                 $bodyParams = array($userName, $loginEmail, $partnerId, $resetPasswordLink, $kmcLink, $contactLink, $contactPhone, $beginnersGuideLink, $quickStartGuideLink);
             }
             break;
     }
     kJobsManager::addMailJob(null, 0, $partnerId, $mailType, kMailJobData::MAIL_PRIORITY_NORMAL, kConf::get("partner_registration_confirmation_email"), kConf::get("partner_registration_confirmation_name"), $recipient_email, $bodyParams);
 }
예제 #2
0
 public static function sendNewUserMail(kuser $user, $existingUser)
 {
     // setup parameters
     $partnerId = $user->getPartnerId();
     $userName = $user->getFullName();
     if (!$userName) {
         $userName = $user->getPuserId();
     }
     $creatorUserName = '******';
     if (!is_null(kCurrentContext::$ks_uid)) {
         $creatorUser = kuserPeer::getKuserByPartnerAndUid($partnerId, kCurrentContext::$ks_uid);
         if ($creatorUser) {
             $creatorUserName = $creatorUser->getFullName();
         }
     }
     $publisherName = PartnerPeer::retrieveByPK($partnerId)->getName();
     $loginEmail = $user->getEmail();
     $roleName = $user->getUserRoleNames();
     $puserId = $user->getPuserId();
     if (!$existingUser) {
         $resetPasswordLink = UserLoginDataPeer::getPassResetLink($user->getLoginData()->getPasswordHashKey());
     }
     $kmcLink = trim(kConf::get('apphome_url'), '/') . '/kmc';
     $adminConsoleLink = trim(kConf::get('admin_console_url'));
     $contactLink = kConf::get('contact_url');
     $beginnersGuideLink = kConf::get('beginners_tutorial_url');
     $quickStartGuideLink = kConf::get('quick_start_guide_url');
     // setup mail
     $mailType = null;
     $bodyParams = array();
     if ($partnerId == Partner::ADMIN_CONSOLE_PARTNER_ID) {
         if ($existingUser) {
             $mailType = self::KALTURA_NEW_EXISTING_USER_ADMIN_CONSOLE_EMAIL;
             $bodyParams = array($userName, $creatorUserName, $loginEmail, $roleName);
         } else {
             $mailType = self::KALTURA_NEW_USER_ADMIN_CONSOLE_EMAIL;
             $bodyParams = array($userName, $creatorUserName, $loginEmail, $resetPasswordLink, $roleName, $adminConsoleLink);
         }
     } else {
         if ($existingUser) {
             $mailType = self::KALTURA_NEW_EXISTING_USER_EMAIL;
             $bodyParams = array($userName, $creatorUserName, $publisherName, $loginEmail, $partnerId, $publisherName, $publisherName, $roleName, $publisherName, $puserId, $kmcLink, $contactLink, $beginnersGuideLink, $quickStartGuideLink);
         } else {
             $mailType = self::KALTURA_NEW_USER_EMAIL;
             $bodyParams = array($userName, $creatorUserName, $publisherName, $loginEmail, $resetPasswordLink, $partnerId, $publisherName, $publisherName, $roleName, $publisherName, $puserId, $kmcLink, $contactLink, $beginnersGuideLink, $quickStartGuideLink);
         }
     }
     // add mail job
     kJobsManager::addMailJob(null, 0, $partnerId, $mailType, kMailJobData::MAIL_PRIORITY_NORMAL, kConf::get("partner_registration_confirmation_email"), kConf::get("partner_registration_confirmation_name"), $loginEmail, $bodyParams);
 }