コード例 #1
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;
 }
コード例 #2
0
 /**
  * Create a xml to save all rendered outputformats as a templatedraft so as
  * later to send several newsletters
  *
  * @return xml
  */
 function createOutputXml()
 {
     $editionContentObjectId = $this->attribute('contentobject_id');
     $editionContentObjectVersion = $this->attribute('contentobject_attribute_version');
     $listAttributeContent = $this->attribute('list_attribute_content');
     $outputFormatArray = $listAttributeContent->attribute('output_format_array');
     $mainSiteAccess = $listAttributeContent->attribute('main_siteaccess');
     $skinName = $listAttributeContent->attribute('skin_name');
     $dom = new DOMDocument('1.0', 'utf-8');
     $root = $dom->createElement('newsletter_edition_send');
     $root = $dom->appendChild($root);
     // in first version attribut xml_version did not exists
     $root->setAttribute('xml_version', '2');
     $root->setAttribute('edition_contentobject_id', $editionContentObjectId);
     $root->setAttribute('edition_contentobject_version', $editionContentObjectVersion);
     $root->setAttribute('main_siteaccess', $mainSiteAccess);
     $outputFormats = $dom->createElement('output_formats');
     $root->appendChild($outputFormats);
     foreach ($outputFormatArray as $id => $name) {
         $formatArray = array('id' => $id, 'name' => $name);
         $text = '<html>1234</html>';
         $forceNotIncludingImages = true;
         $textArray = CjwNewsletterEdition::getOutput($editionContentObjectId, $editionContentObjectVersion, $id, $mainSiteAccess, $skinName, $forceNotIncludingImages);
         $bodyArray = $textArray['body'];
         $subject = $textArray['subject'];
         $contentType = $textArray['content_type'];
         $id = $textArray['output_format'];
         $siteURL = $textArray['site_url'];
         $ezUrl = $textArray['ez_url'];
         $ezRoot = $textArray['ez_root'];
         $locale = $textArray['locale'];
         $imageInclude = $textArray['html_mail_image_include'];
         $outputFormat = $dom->createElement('output_format');
         $outputFormat->setAttribute('id', $id);
         $outputFormat->setAttribute('content_type', $contentType);
         $outputFormat->setAttribute('subject', $subject);
         $outputFormat->setAttribute('site_url', $siteURL);
         $outputFormat->setAttribute('ez_url', $ezUrl);
         $outputFormat->setAttribute('ez_root', $ezRoot);
         $outputFormat->setAttribute('html_mail_image_include', $imageInclude);
         $outputFormats->appendChild($outputFormat);
         $mainTemplateNode = $dom->createElement('main_template');
         foreach ($bodyArray as $typeName => $outputString) {
             $typeNode = $dom->createElement('type');
             $typeNode->setAttribute('name', $typeName);
             $typeNodeCDATA = $dom->createCDATASection($outputString);
             $typeNode->appendChild($typeNodeCDATA);
             $mainTemplateNode->appendChild($typeNode);
         }
         $outputFormat->appendChild($mainTemplateNode);
     }
     $root->setAttribute('locale', $textArray['locale']);
     //$root->setAttribute( 'site_url', $textArray['site_url'] );
     //$root->setAttribute( 'ez_root', $textArray['ez_root'] );
     //$root->setAttribute( 'ez_url', $textArray['ez_url'] );
     //$root->setAttribute( 'html_mail_image_include', $imageInclude );
     $xml = $dom->saveXML();
     return $xml;
 }
コード例 #3
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'];