function afterFind($results, $primary) { $results = parent::afterFind($results, $primary); if (!empty($results)) { if (!Set::numeric(array_keys($results))) { $tmp = array(&$results); $myResults =& $tmp; } else { $myResults =& $results; } foreach ($myResults as &$resRoot) { ////// get updated Data ////// if (isset($resRoot[$this->alias])) { $res =& $resRoot[$this->alias]; } else { $res =& $resRoot; } $res['TemplateConfig'] = $this->getConfig($res); if (!empty($res['TemplateConfig'])) { $result = $res['TemplateConfig']->afterFind($this, $res); if (!empty($result)) { $res = $result; } } if (!empty($resRoot['NewsletterAssoc'])) { foreach ($resRoot['NewsletterAssoc'] as $assoc) { $res['associated'][$assoc['type']] = $assoc['newsletter_id']; } } } } return $results; }
public function __construct($id = false, $table = null, $ds = null) { parent::__construct($id, $table, $ds); $this->virtualFields = array('subscriber_name' => 'CASE WHEN COALESCE(User.username, \'\') = \'\' THEN ' . $this->alias . '.prefered_name else User.username end', 'subscriber_email' => 'CASE WHEN COALESCE(User.email, \'\') = \'\' THEN ' . $this->alias . '.email else User.email end'); }
public function __construct($id = false, $table = null, $ds = null) { parent::__construct($id, $table, $ds); $this->validate = array('campaign_id' => array('notEmpty' => array('rule' => 'notEmpty', 'message' => __('Please select the campaign this email belongs to'))), 'from' => array('notEmpty' => array('rule' => 'notEmpty', 'message' => __('Please enter the from address')), 'email' => array('rule' => array('email', true), 'message' => __('Please enter a valid email addres'))), 'reply_to' => array('notEmpty' => array('rule' => 'notEmpty', 'message' => __('Please enter the reply to email')), 'email' => array('rule' => array('email', true), 'message' => __('Please enter a valid email addres'))), 'subject' => array('notEmpty' => array('rule' => 'notEmpty', 'message' => __('Please enter the subject of this newsletter'))), 'html' => array('notEmpty' => array('rule' => 'notEmpty', 'message' => __('Please enter the html version of your email'))), 'text' => array('notEmpty' => array('rule' => 'notEmpty', 'message' => __('Please enter the text version of your email')))); }
public function __construct($id = false, $table = null, $ds = null) { parent::__construct($id, $table, $ds); $this->server = array('server' => Configure::read('Newsletter.smtp_host'), 'username' => Configure::read('Newsletter.smtp_username'), 'email' => Configure::read('Newsletter.smtp_username'), 'password' => Configure::read('Newsletter.smtp_password'), 'ssl' => Configure::read('Newsletter.ssl'), 'port' => Configure::read('Newsletter.port'), 'type' => Configure::read('Newsletter.type')); }
public function __construct($id = false, $table = null, $ds = null) { parent::__construct($id, $table, $ds); $this->validate = array('name' => array('notEmpty' => array('rule' => 'notEmpty', 'message' => __('Please enter the name of this campaign')), 'isUnique' => array('rule' => 'isUnique', 'message' => __('There is already a campaign with that name'))), 'template_id' => array('notEmpty' => array('rule' => 'notEmpty', 'message' => __('Please select the default template for this campaign')))); }
public function __construct($id = false, $table = null, $ds = null) { parent::__construct($id, $table, $ds); $this->validate = array('name' => array('notEmpty' => array('rule' => 'notEmpty', 'message' => 'Please enter the name for this template'), 'isUnique' => array('rule' => 'isUnique', 'message' => 'A template with that name already exists'))); }
function save($data = null, $validate = true, $fieldList = array()) { $this->set($data); $this->parseSave(); return parent::save(null, $validate, $fieldList); }