コード例 #1
0
 /**
  * Create new CjwNewsletterEditionSend object
  *
  * @param CjwNewsletterEdition $editionObject
  * @return object
  */
 static function create(CjwNewsletterEdition $editionObject)
 {
     $editionContentObjectId = $editionObject->attribute('contentobject_id');
     $editionContentObjectVersion = $editionObject->attribute('contentobject_attribute_version');
     $user = eZUser::currentUser();
     $creatorId = $user->attribute('contentobject_id');
     // $outputXml = '<xml>hali hallo</xml>';
     $outputXml = $editionObject->createOutputXml();
     $listAttributeContent = $editionObject->attribute('list_attribute_content');
     $listContentObjectId = $listAttributeContent->attribute('contentobject_id');
     $outputFormatArrayString = $listAttributeContent->attribute('output_format_array_string');
     $mainSiteAccess = $listAttributeContent->attribute('main_siteaccess');
     $emailSender = $listAttributeContent->attribute('email_sender');
     $emailSenderName = $listAttributeContent->attribute('email_sender_name');
     $personalizeContent = $listAttributeContent->attribute('personalize_content');
     $rows = array('list_contentobject_id' => $listContentObjectId, 'edition_contentobject_id' => $editionContentObjectId, 'edition_contentobject_version' => $editionContentObjectVersion, 'siteaccess' => $mainSiteAccess, 'output_format_array_string' => $outputFormatArrayString, 'created' => time(), 'creator_id' => $creatorId, 'status' => CjwNewsletterEditionSend::STATUS_WAIT_FOR_PROCESS, 'output_xml' => $outputXml, 'hash' => CjwNewsletterUtils::generateUniqueMd5Hash($listContentObjectId . $editionContentObjectId . $editionContentObjectVersion), 'email_sender' => $emailSender, 'email_sender_name' => $emailSenderName, 'personalize_content' => $personalizeContent);
     $object = new CjwNewsletterEditionSend($rows);
     return $object;
 }
コード例 #2
0
 /**
  * Create new CjwNewsletterEditionSend object
  *
  * @param CjwNewsletterEdition $editionObject
  * @return object
  */
 static function create(CjwNewsletterEdition $editionObject, $schedule = null)
 {
     $editionContentObjectId = $editionObject->attribute('contentobject_id');
     $editionContentObjectVersion = $editionObject->attribute('contentobject_attribute_version');
     $user = eZUser::currentUser();
     $creatorId = $user->attribute('contentobject_id');
     // $outputXml = '<xml>hali hallo</xml>';
     $outputXml = $editionObject->createOutputXml();
     $listAttributeContent = $editionObject->attribute('list_attribute_content');
     $listContentObjectId = $listAttributeContent->attribute('contentobject_id');
     $listContentObjectVersion = $listAttributeContent->attribute('contentobject_attribute_version');
     $listIsVirtual = $listAttributeContent->attribute('is_virtual');
     $outputFormatArrayString = $listAttributeContent->attribute('output_format_array_string');
     $mainSiteAccess = $listAttributeContent->attribute('main_siteaccess');
     $emailSender = $listAttributeContent->attribute('email_sender');
     $emailSenderName = $listAttributeContent->attribute('email_sender_name');
     $emailReplyTo = $listAttributeContent->attribute('email_reply_to');
     $emailReturnPath = $listAttributeContent->attribute('email_return_path');
     $personalizeContent = $listAttributeContent->attribute('personalize_content');
     $rows = array('list_contentobject_id' => $listContentObjectId, 'list_contentobject_version' => $listContentObjectVersion, 'list_is_virtual' => $listIsVirtual, 'edition_contentobject_id' => $editionContentObjectId, 'edition_contentobject_version' => $editionContentObjectVersion, 'siteaccess' => $mainSiteAccess, 'output_format_array_string' => $outputFormatArrayString, 'created' => time(), 'creator_id' => $creatorId, 'status' => CjwNewsletterEditionSend::STATUS_WAIT_FOR_SCHEDULE, 'mailqueue_process_scheduled' => is_null($schedule) ? time() : $schedule, 'output_xml' => $outputXml, 'hash' => CjwNewsletterUtils::generateUniqueMd5Hash($listContentObjectId . $editionContentObjectId . $editionContentObjectVersion), 'email_sender' => $emailSender, 'email_sender_name' => $emailSenderName, 'email_reply_to' => $emailReplyTo, 'email_return_path' => $emailReturnPath, 'personalize_content' => $personalizeContent);
     $object = new CjwNewsletterEditionSend($rows);
     return $object;
 }
コード例 #3
0
 /**
  * Generated all outputformats
  *
  * @param unknown_type $objectVersion
  * @return array
  */
 function getAllOutputFormatTextByContentObjectVersion($objectVersion, $forceSettingImageIncludeTo = -1)
 {
     $outputFormatTextArray = array();
     $dataMap = $objectVersion->attribute('data_map');
     $editionAttribute = $dataMap['newsletter_edition'];
     $editionAttributeContent = $editionAttribute->attribute('content');
     $listAttributeContent = $editionAttributeContent->attribute('list_attribute_content');
     $outputFormatArray = $listAttributeContent->attribute('output_format_array');
     $mainSiteAccess = $listAttributeContent->attribute('main_siteaccess');
     $skinName = $listAttributeContent->attribute('skin_name');
     $editionContentObjectId = $objectVersion->attribute('contentobject_id');
     $versionId = $objectVersion->attribute('version');
     $emailSender = $listAttributeContent->attribute('email_sender');
     $emailSenderName = $listAttributeContent->attribute('email_sender_name');
     foreach ($outputFormatArray as $outputFormatId => $outputName) {
         $newsletterContentArray = CjwNewsletterEdition::getOutput($editionContentObjectId, $versionId, $outputFormatId, $mainSiteAccess, $skinName, $forceSettingImageIncludeTo);
         $newsletterContentArray['email_sender'] = $emailSender;
         $newsletterContentArray['email_sender_name'] = $emailSenderName;
         $outputFormatTextArray[$outputName] = $newsletterContentArray;
     }
     return $outputFormatTextArray;
 }
コード例 #4
0
 /**
  * @see kernel/classes/eZDataType#deleteStoredObjectAttribute($objectAttribute, $version)
  */
 function deleteStoredObjectAttribute($contentObjectAttribute, $version = null)
 {
     $object = CjwNewsletterEdition::fetch($contentObjectAttribute->attribute("id"), $contentObjectAttribute->attribute("version"));
     if (is_object($object)) {
         $object->remove();
     }
 }
コード例 #5
0
 $ezcOutputOptions = array();
 if ($cli->isQuiet()) {
     $ezcOutputOptions = array('verbosityLevel' => 0);
 }
 $output = new ezcConsoleOutput(null, $ezcOutputOptions);
 $editionSendId = (int) $sendObject->attribute('id');
 $sendItemsStatistic = $sendObject->attribute('send_items_statistic');
 $itemsCountAll = $sendItemsStatistic['items_count'];
 $itemsSend = $sendItemsStatistic['items_send'];
 $itemsNotSend = $sendItemsStatistic['items_not_send'];
 // ### sendObject Data
 $outputFormatStringArray = $sendObject->getParsedOutputXml();
 // embed images
 foreach ($outputFormatStringArray as $outputFormatId => $outputFormatNewsletterContentArray) {
     if ($outputFormatNewsletterContentArray['html_mail_image_include'] == 1) {
         $outputFormatStringArray[$outputFormatId] = CjwNewsletterEdition::prepareImageInclude($outputFormatNewsletterContentArray);
     }
 }
 // embed images ends
 $emailSender = $sendObject->attribute('email_sender');
 $emailSenderName = $sendObject->attribute('email_sender_name');
 $limit = 50;
 $offset = 0;
 $itemCounter = 1;
 $progressMonitor = new ezcConsoleProgressMonitor($output, $itemsNotSend);
 $cjwMail = new CjwNewsletterMail();
 $cjwMail->setTransportMethodCronjobFromIni();
 // process every send_item of current sendobject
 for ($i = 0; $i < $itemsNotSend; $i += $limit) {
     //  $progressBar->advance();
     $sendItemList = CjwNewsletterEditionSendItem::fetchListSendIdAndStatus($editionSendId, CjwNewsletterEditionSendItem::STATUS_NEW, $limit, $offset);
コード例 #6
0
 /**
  * Generate text html of a output for preview and sending email
  *
  * @see classes/cjwnewslettermail.php getAllOutputFormatTextByContentObjectVersion()
  * @see modules/newsletter/preview.php
  * @param unknown_type $editionContentObjectId
  * @param unknown_type $versionId
  * @param unknown_type $outputFormat
  * @param string $siteAccess
  * @param string $skinName
  * @param int $forceImageIncludeSettings -1 - use default settings
  *                                       1 - force do not render all img to file://settings from newsletterContentArray['html_mail_image_include'] will be used
  *                                       0 - force renders all img to file://
  * @return array
  */
 static function getOutput($editionContentObjectId, $versionId, $outputFormat, $siteAccess, $skinName = 'default', $forceSettingImageIncludeTo = -1)
 {
     if ($skinName == '') {
         $skinName = 'default';
     }
     $cjwNewsletterIni = eZINI::instance('cjw_newsletter.ini');
     $phpCli = $cjwNewsletterIni->variable('NewsletterSettings', 'PhpCli');
     $currentHostName = eZSys::hostname();
     $wwwDir = eZSys::wwwDir();
     //$wwwDir = 'tmp';
     $wwwDirString = '';
     if ($wwwDir != '') {
         $wwwDirString = "--www_dir={$wwwDir} ";
     }
     $cmd = "\"{$phpCli}\" extension/cjw_newsletter/bin/php/createoutput.php --object_id={$editionContentObjectId} --object_version={$versionId} --output_format_id={$outputFormat} {$wwwDirString}--current_hostname={$currentHostName} --skin_name={$skinName} -s {$siteAccess}";
     $fileSep = eZSys::fileSeparator();
     $cmd = str_replace('/', $fileSep, $cmd);
     eZDebug::writeDebug("shell_exec( {$cmd} )", 'newsletter/preview');
     // echo "<hr>$cmd<hr>";
     $returnValue = shell_exec(escapeshellcmd($cmd));
     $newsletterContentArray = unserialize(trim($returnValue));
     if (CjwNewsletterEdition::imageIncludeIsEnabled()) {
         $htmlMailImageInclude = 1;
     }
     // forpreview
     $imageInclude = false;
     // render file:// if we want to force it
     // or use setting from $newsletterContentArray['html_mail_image_include']
     if ($forceSettingImageIncludeTo === -1 && $newsletterContentArray['html_mail_image_include'] === 1) {
         $imageInclude = true;
     } elseif ($forceSettingImageIncludeTo === 1) {
         $imageInclude = true;
     } elseif ($forceSettingImageIncludeTo === 0) {
         // $imageInclude = false;
     }
     if ($imageInclude === true) {
         $newsletterContentArray = CjwNewsletterEdition::prepareImageInclude($newsletterContentArray);
     }
     return $newsletterContentArray;
 }
コード例 #7
0
     // html 0
 // html 0
 case CjwNewsletterSubscription::OUTPUT_FORMAT_HTML:
     // textpart
     $template = 'design:newsletter/skin/' . $skinName . '/outputformat/text.tpl';
     $content = $tpl->fetch($template);
     $content = generateAbsoluteLinks($content, $urlArray);
     $content = formatText($content);
     $newsletterEditionContent['text'] = $content;
     // htmlpart
     $template = 'design:newsletter/skin/' . $skinName . '/outputformat/html.tpl';
     $content = $tpl->fetch($template);
     $content = generateAbsoluteLinks($content, $urlArray);
     $newsletterEditionContent['html'] = $content;
     $contentType = 'multipart/alternative';
     if (CjwNewsletterEdition::imageIncludeIsEnabled()) {
         $htmlMailImageInclude = 1;
     }
     break;
     // text 1
 // text 1
 case CjwNewsletterSubscription::OUTPUT_FORMAT_TEXT:
     $template = 'design:newsletter/skin/' . $skinName . '/outputformat/text.tpl';
     $content = $tpl->fetch($template);
     // TODO text version erstellen
     $content = generateAbsoluteLinks($content, $urlArray);
     $content = formatText($content);
     $newsletterEditionContent['text'] = $content;
     $contentType = 'text/plain';
     break;
     // text - html
コード例 #8
0
ファイル: preview.php プロジェクト: hudri/cjw_newsletter
            $forceSettingImageIncludeTo = 0;
        } elseif ($forceSetting === '1') {
            $forceSettingImageIncludeTo = 1;
        } elseif ($forceSetting === '-1') {
            $forceSettingImageIncludeTo = -1;
        }
    }
    if ($http->hasVariable('ShowRawContent') && (int) $http->variable('ShowRawContent') == 1) {
        $showRawContent = true;
    }
    // show mailcontent inline to get debug messages
    if ($http->hasVariable('Debug') && (int) $http->variable('Debug') == 1) {
        $debug = true;
    }
    $newsletterContent = '';
    $newsletterContentArray = CjwNewsletterEdition::getOutput($editionContentObjectId, $versionId, $outputFormat, $siteAccess, $skinName, $forceSettingImageIncludeTo);
    if ($newsletterContentArray['content_type'] == 'text/html') {
        $newsletterContent .= $newsletterContentArray['body']['html'];
    } elseif ($newsletterContentArray['content_type'] == 'multipart/alternative') {
        $newsletterContent .= $newsletterContentArray['body']['html'];
        if ($showRawContent === false) {
            $textContent = "<hr /><pre>" . $newsletterContentArray['body']['text'] . "</pre></body>";
            $newsletterContent = str_replace('</body>', $textContent, $newsletterContent);
        }
    } elseif ($newsletterContentArray['content_type'] == 'text/plain') {
        if ($showRawContent === false) {
            $newsletterContent .= '<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title>newsletter - outputformat - text</title></head><body>
<pre>' . $newsletterContentArray['body']['text'] . '</pre></body></html>';
        } else {
            $newsletterContent = $newsletterContentArray['body']['text'];