function fetchNewsletterReadStat($newsletterID) { $newsletter = eZNewsletter::fetch($newsletterID); if (!$newsletter) { return array(); } $db = eZDB::instance(); // Get total send $totalSend = eZSendNewsletterItem::sendCount($newsletterID); // Get total read $totalRead = eZSendNewsletterItem::readCount($newsletterID); $objectStat = array(); foreach ($newsletter->attribute('object_relation_id_list') as $objectID) { $objectReadSQL = 'SELECT count(*) AS count FROM ezsendnewsletteritem WHERE newsletter_id = \'' . $db->escapeString($newsletterID) . '\' AND send_status = \'' . eZSendNewsletterItem::SendStatusSent . '\' AND object_read_ids like \'%/' . $db->escapeString($objectID) . '/%\''; $objectReadResult = $db->arrayQuery($objectReadSQL); $objectStat[(string) $objectID] = $objectReadResult[0]['count']; } return array('result' => array('num_sent' => $totalSend, 'num_read' => $totalRead, 'object_list' => $objectStat)); }
$tpl->setVariable('module', $Module); $newslettertypeID = null; $newsletterType = eZNewsletterType::fetch($newsletterTypeID); if (!$newsletterType) { return $Module->handleError(eZError::KERNEL_NOT_AVAILABLE, 'kernel'); } if (!$newsletterType->siteaccessAllowed()) { return $Module->handleError(eZError::KERNEL_ACCESS_DENIED, 'kernel'); } if ($http->hasPostVariable('RemoveNewsletterTypeListButton')) { $newsletterTypeListIDArray = $http->postVariable('NewsletterTypeListIDArray'); $http->setSessionVariable('NewsletterTypeListIDArray', $newsletterTypeListIDArray); $types = array(); if (count($newsletterTypeListIDArray) > 0) { foreach ($newsletterTypeListIDArray as $typeID) { $newsletterTypeList = eZNewsletter::fetch($typeID); $types[] = $newsletterTypeList; } } $tpl->setVariable('delete_result', $types); $Result = array(); $Result['newsletter_menu'] = 'design:parts/content/bounce_menu.tpl'; $Result['left_menu'] = 'design:parts/content/eznewsletter_menu.tpl'; $Result['content'] = $tpl->fetch("design:{$extension}/confirmremove_newslettertype_list.tpl"); $Result['path'] = array(array('url' => false, 'text' => ezpI18n::tr('eznewsletter/list_newsletterbounce', 'Newsletter types'))); return; } if ($http->hasPostVariable('RemoveAllNewsletterTypeListButton')) { $NewsletterTypeID = $http->postVariable('NewsletterTypeID'); $tpl = eZNewsletterTemplateWrapper::templateInit(); $tpl->setVariable('NewsletterTypeID', $NewsletterTypeID);
$redirectAfterDelete = $http->postVariable('RedirectAfterDelete'); $NewsletterTypeID = $http->postVariable('NewsletterTypeID'); $db = eZDB::instance(); $deleteAllNewsletter = 'DELETE eznewsletter FROM eznewsletter, eznewslettertype WHERE eznewslettertype.id = eznewsletter.newslettertype_id AND ' . $NewsletterTypeID . ' = eznewsletter.newslettertype_id '; $db->query($deleteAllNewsletter); return $Module->redirectTo($redirectAfterDelete); } else { if ($http->hasPostVariable('RemoveNewsletterButton')) { $newsletterIDArray = $http->postVariable('NewsletterList'); $http->setSessionVariable('NewsletterList', $newsletterIDArray); $newsletters = array(); foreach ($newsletterIDArray as $id) { $newsletter = eZNewsletter::fetch($id); $newsletters[] = $newsletter; } $tpl->setVariable('delete_result', $newsletters); $Result = array(); $Result['newsletter_menu'] = 'design:parts/content/newsletter_menu.tpl'; $Result['left_menu'] = 'design:parts/content/eznewsletter_menu.tpl'; $Result['content'] = $tpl->fetch("design:{$extension}/confirmremove_newsletter.tpl"); $Result['path'] = array(array('url' => false, 'text' => ezpI18n::tr('eznewsletter/list_newslettertype', 'Newsletter types'))); return; } else { if ($http->hasPostVariable('ConfirmRemoveNewsletterButton')) { $newsletterIDArray = $http->sessionVariable('NewsletterList'); $db = eZDB::instance(); $db->begin(); foreach ($newsletterIDArray as $id) {
function attribute($attr, $noFunction = false) { $retVal = false; switch ($attr) { case 'newsletter_related_object_list': $newsletter = $this->attribute('newsletter'); if ($newsletter) { $retVal = $newsletter->attribute('object_relation_id_list'); } break; case 'newsletter': $retVal = eZNewsletter::fetch($this->attribute('newsletter_id')); break; default: $retVal = eZPersistentObject::attribute($attr); break; } return $retVal; }
static function fetchDraft($id, $asObject = true) { $newsletter = eZNewsletter::fetch($id, array(array(eZNewsletter::StatusDraft, eZNewsletter::StatusPublished)), $asObject); if (eZNewsletter::StatusPublished == $newsletter->attribute('status')) { $newsletter->setAttribute('status', eZNewsletter::StatusDraft); $newsletter->store(); } if (!$newsletter) { return false; } return $newsletter; }
// PROFESSIONAL_LICENCE included in the packaging of this file. // For pricing of this licence please contact us via e-mail to licence@ez.no. // Further contact information is available at http://ez.no/company/contact/. // // The "GNU General Public License" (GPL) is available at // http://www.gnu.org/copyleft/gpl.html. // // Contact licence@ez.no if any conditions of this licencing isn't clear to // you. // $Module = $Params['Module']; $http = eZHTTPTool::instance(); if ($http->hasPostVariable('RecurrenceButton')) { $newsletterID = $http->postVariable('NewsletterID'); if ($newsletterID) { $newsletter = eZNewsletter::fetch($newsletterID); if ($newsletter === null) { return $Module->handleError(eZError::KERNEL_NOT_AVAILABLE, 'kernel'); } if ($http->hasPostVariable('Action')) { if ($http->postVariable('Action') === 'activate') { $newsletter->setAttribute('send_status', eZNewsletter::SendStatusNone); } else { if ($http->postVariable('Action') === 'stop') { $newsletter->setAttribute('send_status', eZNewsletter::SendStatusStopped); } } $newsletter->sync(); eZContentCacheManager::clearContentCacheIfNeeded($newsletter->attribute('contentobject_id')); } } else {