本文整理汇总了PHP中CRM_Mailing_BAO_Mailing::getFlattenedTokens方法的典型用法代码示例。如果您正苦于以下问题:PHP CRM_Mailing_BAO_Mailing::getFlattenedTokens方法的具体用法?PHP CRM_Mailing_BAO_Mailing::getFlattenedTokens怎么用?PHP CRM_Mailing_BAO_Mailing::getFlattenedTokens使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CRM_Mailing_BAO_Mailing
的用法示例。
在下文中一共展示了CRM_Mailing_BAO_Mailing::getFlattenedTokens方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: buildQuickForm
public function buildQuickForm()
{
$session = CRM_Core_Session::singleton();
$this->add('text', 'test_email', ts('Send to This Address'));
$defaults['test_email'] = $session->get('ufUniqID');
$qfKey = $this->get('qfKey');
$this->add('select', 'test_group', ts('Send to This Group'), array('' => ts('- none -')) + CRM_Core_PseudoConstant::group('Mailing'));
$this->setDefaults($defaults);
$this->add('submit', 'sendtest', ts('Send a Test Mailing'));
$name = ts('Next');
if (CRM_Mailing_Info::workflowEnabled()) {
if (!CRM_Core_Permission::check('schedule mailings') && CRM_Core_Permission::check('create mailings')) {
$name = ts('Inform Scheduler');
}
}
$buttons = array(array('type' => 'back', 'name' => ts('Previous')), array('type' => 'next', 'name' => $name, 'spacing' => ' ', 'isDefault' => TRUE), array('type' => 'submit', 'name' => ts('Save & Continue Later')), array('type' => 'cancel', 'name' => ts('Cancel')));
$this->addButtons($buttons);
$mailingID = $this->get('mailing_id');
$textFile = $this->get('textFile');
$htmlFile = $this->get('htmlFile');
$this->addFormRule(array('CRM_Mailing_Form_Test', 'testMail'), $this);
$preview = array();
if ($textFile) {
$preview['text_link'] = CRM_Utils_System::url('civicrm/mailing/preview', "type=text&qfKey={$qfKey}");
}
if ($htmlFile) {
$preview['html_link'] = CRM_Utils_System::url('civicrm/mailing/preview', "type=html&qfKey={$qfKey}");
}
$preview['attachment'] = CRM_Core_BAO_File::attachmentInfo('civicrm_mailing', $mailingID);
$this->assign('preview', $preview);
//Token Replacement of Subject in preview mailing
$options = array();
$prefix = "CRM_Mailing_Controller_Send_{$qfKey}";
if ($this->_searchBasedMailing) {
$prefix = "CRM_Contact_Controller_Search_{$qfKey}";
}
$session->getVars($options, $prefix);
$mailing = new CRM_Mailing_BAO_Mailing();
$mailing->id = $options['mailing_id'];
$mailing->find(TRUE);
$fromEmail = $mailing->from_email;
$replyToEmail = $mailing->replyto_email;
$attachments = CRM_Core_BAO_File::getEntityFile('civicrm_mailing', $mailing->id);
$returnProperties = $mailing->getReturnProperties();
$userID = $session->get('userID');
$params = array('contact_id' => $userID);
$details = CRM_Utils_Token::getTokenDetails($params, $returnProperties, TRUE, TRUE, NULL, $mailing->getFlattenedTokens(), get_class($this));
$allDetails =& $mailing->compose(NULL, NULL, NULL, $userID, $fromEmail, $fromEmail, TRUE, $details[0][$userID], $attachments);
$this->assign('subject', $allDetails->_headers['Subject']);
}