/** * Enter description here... * * @param unknown_type $template * @param unknown_type $replaceData * @return unknown */ function getMailMessage($template, $replaceData = array()) { App::import('Model', 'Mailtemplate'); $bcc = array(); $search = array_keys($replaceData); $replace = array_values($replaceData); $objMailtemplate = new Mailtemplate(); $objMailtemplate->unbindModel(array('belongsTo' => array('Language'))); $tpl = $objMailtemplate->find(array('code' => $template, 'language_id' => $this->Session->read('User.Lang.id')), array('subject', 'from', 'body', 'bcc'), null, 0); //find unset($objMailtemplate); $tpl = $tpl['Mailtemplate']; if (empty($tpl)) { $this->logErr('Could not find email template: ' . $template); return false; } else { if (!empty($tpl['bcc'])) { $bcc = split(';', $tpl['bcc']); } return array('body' => str_replace($search, $replace, $tpl['body']), 'subject' => str_replace($search, $replace, $tpl['subject']), 'from' => $tpl['from'], 'bcc' => $bcc); //array } }