/**
  * creates a virtual subscriptioobejct
  * for a userId and editionSendId
  * @param int $newsletterUserId
  * @param int $editionSendId
  * @return false or CjwNewsletterSubscriptionVirtual object
  */
 static function createByUserIdAndEditionSendId($newsletterUserId, $editionSendId)
 {
     $newsletterUserRow = CjwNewsletterUser::fetch($newsletterUserId, false);
     if (!is_array($newsletterUserRow)) {
         return false;
     }
     $editionSendObject = CjwNewsletterEditionSend::fetch($editionSendId);
     if (is_object($editionSendObject)) {
         $subcriptionVirtualObject = self::createFromUserRow($newsletterUserRow, $editionSendObject->attribute('list_contentobject_id'), true);
         return $subcriptionVirtualObject;
     } else {
         return false;
     }
 }
예제 #2
0
 * @filesource
 */
require_once 'kernel/common/i18n.php';
include_once 'kernel/common/template.php';
$module = $Params["Module"];
$http = eZHTTPTool::instance();
$editionSendId = (int) $Params['EditionSendId'];
$outputFormatId = 0;
$newsletterUserId = 0;
if ($Params['OutputFormat']) {
    $outputFormatId = (int) $Params['OutputFormat'];
}
if ($Params['NewsletterUserId']) {
    $newsletterUserId = $Params['NewsletterUserId'];
}
$editionSendObject = CjwNewsletterEditionSend::fetch($editionSendId);
if (!is_object($editionSendObject)) {
    return $module->handleError(eZError::KERNEL_NOT_AVAILABLE, 'kernel');
}
$newsletterDataArray = $editionSendObject->getParsedOutputXml();
$newsletterContent = false;
if (isset($newsletterDataArray[$outputFormatId])) {
    $newsletterContentArray = $newsletterDataArray[$outputFormatId];
}
// html / text  - multipart/alternative
if ($outputFormatId === 0) {
    $newsletterContent .= $newsletterContentArray['body']['html'];
    $textContent = "<hr /><pre>" . $newsletterContentArray['body']['text'] . "</pre></body>";
    $newsletterContent = preg_replace(array('%</body>%'), array($textContent), $newsletterContent);
} elseif ($outputFormatId === 1) {
    $newsletterContent .= '<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
 /**
  * fetch edition object
  *
  * @return object / boolean
  */
 function getNewsletterEditionObject()
 {
     $tmp = CjwNewsletterEditionSend::fetch($this->attribute('edition_send_id'));
     $obj = eZContentObject::fetch($tmp->attribute('edition_contentobject_id'));
     return $obj;
 }