Example #1
0
 /**
  * NotifyOwner
  * Sends an email to the list owner(s) to tell them what's going on with a send.
  * eg:
  * - send has started
  * - send has finished
  * - send has been paused
  * - send is in 'timeout' mode (for percentage split tests)
  *
  * @param String $jobstatus The new jobstatus. This is used to work out the subject/message for the notification email.
  *
  * @uses SendStudio_Functions::PrintTime
  * @uses SendStudio_Functions::FormatNumber
  * @uses emailssent
  * @uses Send_API::NotifyOwner
  *
  * @return Mixed Returns the status from the parent NotifyOwner call.
  */
 function NotifyOwner($jobstatus = 's')
 {
     $notify_subject = $this->splitcampaign_details['splitname'];
     require_once dirname(__FILE__) . '/language/language.php';
     $time = $this->sendstudio_functions->PrintTime();
     switch ($jobstatus) {
         case 'c':
             $subject = sprintf(GetLang('Addon_splittest_Job_Subject_Complete'), $notify_subject);
             if ($this->emailssent == 1) {
                 $message = sprintf(GetLang('Addon_splittest_Job_Message_Complete_One'), $notify_subject, $time);
             } else {
                 $message = sprintf(GetLang('Addon_splittest_Job_Message_Complete_Many'), $notify_subject, $time, $this->sendstudio_functions->FormatNumber($this->emailssent));
             }
             break;
         case 'p':
             $subject = sprintf(GetLang('Addon_splittest_Job_Subject_Paused'), $notify_subject);
             if ($this->emailssent == 1) {
                 $message = sprintf(GetLang('Addon_splittest_Job_Message_Paused_One'), $notify_subject, $time);
             } else {
                 $message = sprintf(GetLang('Addon_splittest_Job_Message_Paused_Many'), $notify_subject, $time, $this->sendstudio_functions->FormatNumber($this->emailssent));
             }
             break;
         case 't':
             $percent = $this->sendstudio_functions->FormatNumber($this->splitcampaign_details['splitdetails']['percentage']);
             $subject = sprintf(GetLang('Addon_splittest_Job_Subject_Timeout'), $notify_subject, $percent);
             if ($this->emailssent == 1) {
                 $message = sprintf(GetLang('Addon_splittest_Job_Message_Timeout_One'), $notify_subject, $percent);
             } else {
                 $message = sprintf(GetLang('Addon_splittest_Job_Message_Timeout_Many'), $notify_subject, $percent, $this->sendstudio_functions->FormatNumber($this->emailssent));
             }
             break;
         default:
             $subject = sprintf(GetLang('Addon_splittest_Job_Subject_Started'), $notify_subject);
             $message = sprintf(GetLang('Addon_splittest_Job_Message_Started'), $notify_subject, $time);
     }
     $this->notify_email = array('subject' => $subject, 'message' => $message);
     $this->jobstatus = $jobstatus;
     return parent::NotifyOwner();
 }