Changeset View
Changeset View
Standalone View
Standalone View
branches/5.3.x/core/units/mailing_lists/mailing_list_eh.php
Show All 24 Lines | |||||
*/ | */ | ||||
protected function mapPermissions() | protected function mapPermissions() | ||||
{ | { | ||||
parent::mapPermissions(); | parent::mapPermissions(); | ||||
$permissions = Array ( | $permissions = Array ( | ||||
'OnCancelMailing' => Array ('self' => 'edit'), | 'OnCancelMailing' => Array ('self' => 'edit'), | ||||
'OnGenerateEmailQueue' => Array ('self' => true), | 'OnGenerateEmailQueue' => Array ('self' => true), | ||||
'OnProcessEmailQueue' => Array ('self' => true), | |||||
'OnGetHtmlBody' => Array ('self' => 'edit'), | 'OnGetHtmlBody' => Array ('self' => 'edit'), | ||||
); | ); | ||||
$this->permMapping = array_merge($this->permMapping, $permissions); | $this->permMapping = array_merge($this->permMapping, $permissions); | ||||
} | } | ||||
/** | /** | ||||
* Prepare recipient list | * Prepare recipient list | ||||
▲ Show 20 Lines • Show All 208 Lines • ▼ Show 20 Line(s) | |||||
$object = $event->getObject(); | $object = $event->getObject(); | ||||
$sql = 'DELETE FROM ' . $this->Application->getUnitConfig('email-queue')->getTableName() . ' | $sql = 'DELETE FROM ' . $this->Application->getUnitConfig('email-queue')->getTableName() . ' | ||||
WHERE MailingId = ' . $object->GetID(); | WHERE MailingId = ' . $object->GetID(); | ||||
$this->Conn->Query($sql); | $this->Conn->Query($sql); | ||||
} | } | ||||
/** | /** | ||||
* Allows to safely get mailing configuration variables | |||||
* | |||||
* @param string $variable_name Variable name. | |||||
* | |||||
* @return integer | |||||
* @deprecated 5.3.0-B1 | |||||
* @see MailingListHelper::getSetting() | |||||
*/ | |||||
function _ensureDefault($variable_name) | |||||
{ | |||||
kUtil::deprecatedMethod(__METHOD__, '5.3.0-B1', 'MailingListHelper::getSetting'); | |||||
/** @var MailingListHelper $mailing_list_helper */ | |||||
$mailing_list_helper = $this->Application->recallObject('MailingListHelper'); | |||||
return $mailing_list_helper->getSetting($variable_name); | |||||
} | |||||
/** | |||||
* Generates email queue for active mailing lists | * Generates email queue for active mailing lists | ||||
* | * | ||||
* @param kEvent $event | * @param kEvent $event | ||||
*/ | */ | ||||
function OnGenerateEmailQueue($event) | function OnGenerateEmailQueue($event) | ||||
{ | { | ||||
$config = $event->getUnitConfig(); | $config = $event->getUnitConfig(); | ||||
$id_field = $config->getIDField(); | $id_field = $config->getIDField(); | ||||
▲ Show 20 Lines • Show All 63 Lines • ▼ Show 20 Line(s) | |||||
if ( !$to_queue ) { | if ( !$to_queue ) { | ||||
// emails to be queued per step reached -> leave | // emails to be queued per step reached -> leave | ||||
break; | break; | ||||
} | } | ||||
} | } | ||||
} | } | ||||
/** | /** | ||||
* [SCHEDULED TASK] Process email queue from cron | |||||
* | |||||
* @param kEvent $event Event. | |||||
* | |||||
* @return void | |||||
* @deprecated 5.3.0-B1 | |||||
* @see EmailQueueEventHandler::OnProcess() | |||||
*/ | |||||
function OnProcessEmailQueue($event) | |||||
{ | |||||
kUtil::deprecatedMethod(__METHOD__, '5.3.0-B1', 'EmailQueueEventHandler::OnProcess'); | |||||
$event->CallSubEvent('email-queue:OnProcess'); | |||||
} | |||||
/** | |||||
* Returns HTML of sent e-mail for iframe | * Returns HTML of sent e-mail for iframe | ||||
* | * | ||||
* @param kEvent $event | * @param kEvent $event | ||||
* @return void | * @return void | ||||
* @access protected | * @access protected | ||||
*/ | */ | ||||
protected function OnGetHtmlBody(kEvent $event) | protected function OnGetHtmlBody(kEvent $event) | ||||
{ | { | ||||
$event->status = kEvent::erSTOP; | $event->status = kEvent::erSTOP; | ||||
/** @var kDBItem $object */ | /** @var kDBItem $object */ | ||||
$object = $event->getObject(); | $object = $event->getObject(); | ||||
echo '<html><body style="font-size: 14px;">' . $object->GetDBField('MessageHtml') . '</body></html>'; | echo '<html><body style="font-size: 14px;">' . $object->GetDBField('MessageHtml') . '</body></html>'; | ||||
} | } | ||||
} | } |