Exemplo n.º 1
0
        try {
            $mail_transport->send($mail);
        } catch (Exception $e) {
            $cli->output('Error sending mail: ' . $e->getMessage());
        }
        $delivery->setAttribute('state', 'sent');
        $delivery->setAttribute('sent', time());
        $delivery->store();
        // Check time limit
        $time = time() - $start_time;
        if ($time > $time_limit) {
            $cli->output('Time Limit existed. Stopping delivery');
            break 2;
            // Break out of both loops
        }
    }
    // Check if remaining deliveries
    $deliveries_count = jajNewsletterDelivery::fetchDeliveriesByContentobjectIdCount($object_id, 'pending');
    if ($deliveries_count == 0) {
        $cli->output('Pending deliveries: ' . $deliveries_count . ', archiving newsletter');
        $status = $data_map['status'];
        $status->fromString("archive");
        $status->store();
    }
    if ($batch_limit <= 0) {
        $cli->output('Batch limit reached. Stopping');
        break;
    }
}
//$cli->output( 'Testing... ' );
exec('ls');
Exemplo n.º 2
0
}
$offset = $Params['Offset'];
switch (eZPreferences::value('admin_jaj_newsletter_newsletter_view_limit')) {
    case '25':
        $limit = 25;
        break;
    case '50':
        $limit = 50;
        break;
    default:
        $limit = 10;
        break;
}
$view_parameters = array('offset' => $offset);
$deliveries = jajNewsletterDelivery::fetchDeliveriesByContentobjectID($node->ID, $limit, $offset);
$deliveries_count = jajNewsletterDelivery::fetchDeliveriesByContentobjectIdCount($node->ID);
$newsletter_ini = eZINI::instance('jaj_newsletter.ini');
$from_email = $newsletter_ini->variable('NewsletterSettings', 'FromEmail');
$from_name = $newsletter_ini->variable('NewsletterSettings', 'FromName');
$reply_email = $newsletter_ini->variable('NewsletterSettings', 'ReplyEmail');
$tpl->setVariable('node', $node);
$tpl->setVariable('recipients_lists', $recipients_lists);
$tpl->setVariable('tabs', $tabs);
$tpl->setVariable('selected_tab', $selected_tab);
$tpl->setVariable('error_strings', $error_strings);
$tpl->setVariable('feedback_strings', $feedback_strings);
$tpl->setVariable('total_active_recipients', jajNewsletterSubscription::countByRecipientsLists($recipients_lists, 'active'));
$tpl->setVariable('total_recipients', jajNewsletterSubscription::countByRecipientsLists($recipients_lists));
$tpl->setVariable('from_email', $from_email);
$tpl->setVariable('from_name', $from_name);
$tpl->setVariable('reply_email', $reply_email);
 static function fetchNewsletterDeliveryCount($object_id, $status = array())
 {
     return array('result' => jajNewsletterDelivery::fetchDeliveriesByContentobjectIdCount($object_id, $status));
 }