You are here

public function NewsletterAutomated::__construct in Newsletter 7

Same name and namespace in other branches
  1. 7.2 includes/newsletter.automated.inc \NewsletterAutomated::__construct()

Overrides NewsletterBasic::__construct

File

includes/newsletter.automated.inc, line 27
Contains NewsletterMail and NewsletterCustom that extend NewsletterBasic.

Class

NewsletterAutomated
Newsletter class that sends automated, non-custom newsletters with dynamic content based on taxonomy terms.

Code

public function __construct($nlid) {
  parent::__construct();
  $this->left = variable_get('newsletter_for_next_cron', array());
  $this->list = newsletter_list_load($nlid);
  $template = field_get_items('newsletter_list', $this->list, 'field_newsletter_template');
  $this->template = newsletter_template_load($template[0]['target_id']);
  $this->subscribers = $this
    ->getSubscribers();
  $this->manualSendRate = (bool) ($this->list->send_rate == 'Manual');
  $this->customSendRate = (bool) is_numeric($this->list->send_rate);
  $this->nodes = $this
    ->getNodes();
  $this->newsletter = $this
    ->getNewsletterData();
  $this->left[$this->list->nlid] = array();
}