public function getJobData(kScope $scope = null)
 {
     $jobData = new kEmailNotificationDispatchJobData();
     $jobData->setTemplateId($this->getId());
     $jobData->setFromEmail($this->getFromEmail());
     $jobData->setFromName($this->getFromName());
     $jobData->setPriority($this->getPriority());
     $jobData->setConfirmReadingTo($this->getConfirmReadingTo());
     $jobData->setHostname($this->getHostname());
     $jobData->setMessageID($this->getMessageID());
     $jobData->setCustomHeaders($this->getCustomHeaders());
     if ($this->getTo()) {
         $jobData->setTo($this->getTo()->getScopedProviderJobData($scope));
     }
     if ($this->getCc()) {
         $jobData->setCc($this->getCc()->getScopedProviderJobData($scope));
     }
     if ($this->getBcc()) {
         $jobData->setBcc($this->getBcc()->getScopedProviderJobData($scope));
     }
     if ($this->getReplyTo()) {
         $jobData->setReplyTo($this->getReplyTo()->getScopedProviderJobData($scope));
     }
     $contentParametersValues = array();
     $contentParameters = $this->getContentParameters();
     foreach ($contentParameters as $contentParameter) {
         /* @var $contentParameter kEmailNotificationParameter */
         $value = $contentParameter->getValue();
         if ($scope && $value instanceof kStringField) {
             $value->setScope($scope);
         }
         $contentParametersValues[$contentParameter->getKey()] = $value->getValue();
     }
     $jobData->setContentParameters($contentParametersValues);
     return $jobData;
 }
コード例 #2
0
 protected function getJobData(kScope $scope = null)
 {
     $jobData = new kEmailNotificationDispatchJobData();
     $jobData->setTemplateId($this->getId());
     $jobData->setFromEmail($this->getFromEmail());
     $jobData->setFromName($this->getFromName());
     $jobData->setPriority($this->getPriority());
     $jobData->setConfirmReadingTo($this->getConfirmReadingTo());
     $jobData->setHostname($this->getHostname());
     $jobData->setMessageID($this->getMessageID());
     $jobData->setCustomHeaders($this->getCustomHeaders());
     if ($this->getTo()) {
         $jobData->setTo($this->getTo()->getScopedProviderJobData($scope));
     }
     if ($this->getCc()) {
         $jobData->setCc($this->getCc()->getScopedProviderJobData($scope));
     }
     if ($this->getBcc()) {
         $jobData->setBcc($this->getBcc()->getScopedProviderJobData($scope));
     }
     if ($this->getReplyTo()) {
         $jobData->setReplyTo($this->getReplyTo()->getScopedProviderJobData($scope));
     }
     $contentParametersValues = array();
     $contentParameters = $this->getContentParameters();
     foreach ($contentParameters as $contentParameter) {
         /* @var $contentParameter kEventNotificationParameter */
         $value = $contentParameter->getValue();
         if ($scope && $value instanceof kStringField) {
             $value->setScope($scope);
         }
         $contentParametersValues[$contentParameter->getKey()] = $value->getValue();
     }
     KalturaLog::info("Sweeping Email Notification Template with id {$this->getId()} for metadata tokens.");
     $jobDataFields = array('to', 'cc', 'bcc');
     $templateFields = array('subject', 'body');
     $sweepFieldValues = array();
     foreach ($jobDataFields as $field) {
         //Get the field value
         $getter = "get{$field}";
         $fieldValue = $jobData->{$getter}();
         if (is_string($fieldValue)) {
             $sweepFieldValues[] = $fieldValue;
         } elseif ($fieldValue instanceof kEmailNotificationStaticRecipientJobData) {
             /* @var $fieldValue kEmailNotificationStaticRecipientJobData */
             foreach ($fieldValue->getEmailRecipients() as $email => $name) {
                 /* @var $emailRecipient kEmailNotificationRecipient */
                 $sweepFieldValues[] = $email;
                 $sweepFieldValues[] = $name;
             }
         }
     }
     foreach ($templateFields as $field) {
         //Get the field value
         $getter = "get{$field}";
         $fieldValue = $this->{$getter}();
         if (is_string($fieldValue)) {
             $sweepFieldValues[] = $fieldValue;
         }
     }
     $editorPlugins = KalturaPluginManager::getPluginInstances("IKalturaEventNotificationContentEditor");
     foreach ($editorPlugins as $plugin) {
         $pluginContentParameters = $plugin->editTemplateFields($sweepFieldValues, $scope, $this->getObjectType());
         $contentParametersValues = array_merge($contentParametersValues, $pluginContentParameters);
     }
     $jobData->setContentParameters($contentParametersValues);
     return $jobData;
 }