本文整理汇总了PHP中CRM_Mailing_DAO_Mailing::storeValues方法的典型用法代码示例。如果您正苦于以下问题:PHP CRM_Mailing_DAO_Mailing::storeValues方法的具体用法?PHP CRM_Mailing_DAO_Mailing::storeValues怎么用?PHP CRM_Mailing_DAO_Mailing::storeValues使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CRM_Mailing_DAO_Mailing
的用法示例。
在下文中一共展示了CRM_Mailing_DAO_Mailing::storeValues方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setDefaultValues
/**
* Set default values for the form.
* the default values are retrieved from the database
*
*
* @return void
*/
public function setDefaultValues()
{
$mailingID = CRM_Utils_Request::retrieve('mid', 'Integer', $this, FALSE, NULL);
// CRM-14716 - Pick up mailingID from session since most of the time it's not in the URL
if (!$mailingID) {
$mailingID = $this->get('mailing_id');
}
$count = $this->get('count');
$this->assign('count', $count);
$defaults = array();
$componentFields = array('reply_id' => 'Reply', 'optout_id' => 'OptOut', 'unsubscribe_id' => 'Unsubscribe', 'resubscribe_id' => 'Resubscribe');
foreach ($componentFields as $componentVar => $componentType) {
$defaults[$componentVar] = CRM_Mailing_PseudoConstant::defaultComponent($componentType, '');
}
if ($mailingID) {
$dao = new CRM_Mailing_DAO_Mailing();
$dao->id = $mailingID;
$dao->find(TRUE);
// override_verp must be flipped, as in 3.2 we reverted
// its meaning to ‘should CiviMail manage replies?’ – i.e.,
// ‘should it *not* override Reply-To: with VERP-ed address?’
$dao->override_verp = !$dao->override_verp;
$dao->storeValues($dao, $defaults);
$defaults['visibility'] = $dao->visibility;
}
return $defaults;
}
示例2: setDefaultValues
/**
* This function sets the default values for the form.
* the default values are retrieved from the database
*
* @access public
*
* @return void
*/
function setDefaultValues()
{
$mailingID = CRM_Utils_Request::retrieve('mid', 'Integer', $this, FALSE, NULL);
//need to differentiate new/reuse mailing, CRM-2873
$reuseMailing = FALSE;
if ($mailingID) {
$reuseMailing = TRUE;
} else {
$mailingID = $this->_mailingID;
}
$count = $this->get('count');
$this->assign('count', $count);
$this->set('skipTextFile', FALSE);
$defaults = array();
if ($mailingID) {
$dao = new CRM_Mailing_DAO_Mailing();
$dao->id = $mailingID;
$dao->find(TRUE);
$dao->storeValues($dao, $defaults);
//we don't want to retrieve template details once it is
//set in session
$templateId = $this->get('template');
$this->assign('templateSelected', $templateId ? $templateId : 0);
if (isset($defaults['msg_template_id']) && !$templateId) {
$defaults['template'] = $defaults['msg_template_id'];
$messageTemplate = new CRM_Core_DAO_MessageTemplate();
$messageTemplate->id = $defaults['msg_template_id'];
$messageTemplate->selectAdd();
$messageTemplate->selectAdd('msg_text');
$messageTemplate->find(TRUE);
$defaults['text_message'] = $messageTemplate->msg_text;
}
if (isset($defaults['body_text'])) {
$defaults['text_message'] = $defaults['body_text'];
$this->set('textFile', $defaults['body_text']);
$this->set('skipTextFile', TRUE);
}
}
//fix for CRM-2873
if (!$reuseMailing) {
$textFilePath = $this->get('textFilePath');
if ($textFilePath && file_exists($textFilePath)) {
$defaults['text_message'] = file_get_contents($textFilePath);
if (strlen($defaults['text_message']) > 0) {
$this->set('skipTextFile', TRUE);
}
}
}
$defaults['upload_type'] = 1;
return $defaults;
}
示例3: setDefaultValues
/**
* Set default values for the form.
* the default values are retrieved from the database
*
*
* @return void
*/
public function setDefaultValues()
{
$mailingID = CRM_Utils_Request::retrieve('mid', 'Integer', $this, FALSE, NULL);
//need to differentiate new/reuse mailing, CRM-2873
$reuseMailing = FALSE;
if ($mailingID) {
$reuseMailing = TRUE;
} else {
$mailingID = $this->_mailingID;
}
$count = $this->get('count');
$this->assign('count', $count);
$this->set('skipTextFile', FALSE);
$this->set('skipHtmlFile', FALSE);
$defaults = array();
$htmlMessage = NULL;
if ($mailingID) {
$dao = new CRM_Mailing_DAO_Mailing();
$dao->id = $mailingID;
$dao->find(TRUE);
$dao->storeValues($dao, $defaults);
//we don't want to retrieve template details once it is
//set in session
$templateId = $this->get('template');
$this->assign('templateSelected', $templateId ? $templateId : 0);
if (isset($defaults['msg_template_id']) && !$templateId) {
$defaults['template'] = $defaults['msg_template_id'];
$messageTemplate = new CRM_Core_DAO_MessageTemplate();
$messageTemplate->id = $defaults['msg_template_id'];
$messageTemplate->selectAdd();
$messageTemplate->selectAdd('msg_text, msg_html');
$messageTemplate->find(TRUE);
$defaults['text_message'] = $messageTemplate->msg_text;
$htmlMessage = $messageTemplate->msg_html;
}
if (isset($defaults['body_text'])) {
$defaults['text_message'] = $defaults['body_text'];
$this->set('textFile', $defaults['body_text']);
$this->set('skipTextFile', TRUE);
}
if (isset($defaults['body_html'])) {
$htmlMessage = $defaults['body_html'];
$this->set('htmlFile', $defaults['body_html']);
$this->set('skipHtmlFile', TRUE);
}
//set default from email address.
if (!empty($defaults['from_name']) && !empty($defaults['from_email'])) {
$defaults['from_email_address'] = array_search('"' . $defaults['from_name'] . '" <' . $defaults['from_email'] . '>', CRM_Core_OptionGroup::values('from_email_address'));
} else {
//get the default from email address.
$defaultAddress = CRM_Core_OptionGroup::values('from_email_address', NULL, NULL, NULL, ' AND is_default = 1');
foreach ($defaultAddress as $id => $value) {
$defaults['from_email_address'] = $id;
}
}
if (!empty($defaults['replyto_email'])) {
$replyToEmail = CRM_Core_OptionGroup::values('from_email_address');
foreach ($replyToEmail as $value) {
if (strstr($value, $defaults['replyto_email'])) {
$replyToEmailAddress = $value;
break;
}
}
$replyToEmailAddress = explode('<', $replyToEmailAddress);
if (count($replyToEmailAddress) > 1) {
$replyToEmailAddress = $replyToEmailAddress[0] . '<' . $replyToEmailAddress[1];
}
$defaults['reply_to_address'] = array_search($replyToEmailAddress, $replyToEmail);
}
}
//fix for CRM-2873
if (!$reuseMailing) {
$textFilePath = $this->get('textFilePath');
if ($textFilePath && file_exists($textFilePath)) {
$defaults['text_message'] = file_get_contents($textFilePath);
if (strlen($defaults['text_message']) > 0) {
$this->set('skipTextFile', TRUE);
}
}
$htmlFilePath = $this->get('htmlFilePath');
if ($htmlFilePath && file_exists($htmlFilePath)) {
$defaults['html_message'] = file_get_contents($htmlFilePath);
if (strlen($defaults['html_message']) > 0) {
$htmlMessage = $defaults['html_message'];
$this->set('skipHtmlFile', TRUE);
}
}
}
if ($this->get('html_message')) {
$htmlMessage = $this->get('html_message');
}
$htmlMessage = str_replace(array("\n", "\r"), ' ', $htmlMessage);
$htmlMessage = str_replace("'", "\\'", $htmlMessage);
//.........这里部分代码省略.........
示例4: setDefaultValues
/**
* This function sets the default values for the form.
* the default values are retrieved from the database
*
* @access public
*
* @return None
*/
function setDefaultValues()
{
// to continue the unscheduled or draft mailing
$continue = $this->_continue = CRM_Utils_Request::retrieve('continue', 'String', $this, FALSE, NULL);
$mailingID = CRM_Utils_Request::retrieve('mid', 'Integer', $this, FALSE, NULL);
$defaults = array();
if ($this->_mailingID) {
// check that the user has permission to access mailing id
CRM_Mailing_BAO_Mailing::checkPermission($this->_mailingID);
$mailing = new CRM_Mailing_DAO_Mailing();
$mailing->id = $this->_mailingID;
$mailing->addSelect('name', 'campaign_id');
$mailing->find(TRUE);
$defaults['name'] = $mailing->name;
if (!$continue) {
$defaults['name'] = ts('Copy of %1', array(1 => $mailing->name));
} else {
// CRM-7590, reuse same mailing ID if we are continuing
$this->set('mailing_id', $this->_mailingID);
}
$defaults['campaign_id'] = $mailing->campaign_id;
$defaults['dedupe_email'] = $mailing->dedupe_email;
$dao = new CRM_Mailing_DAO_MailingGroup();
$mailingGroups = array('civicrm_group' => array(), 'civicrm_mailing' => array());
$dao->mailing_id = $this->_mailingID;
$dao->find();
while ($dao->fetch()) {
// account for multi-lingual
// CRM-11431
$entityTable = 'civicrm_group';
if (substr($dao->entity_table, 0, 15) == 'civicrm_mailing') {
$entityTable = 'civicrm_mailing';
}
$mailingGroups[$entityTable][$dao->group_type][] = $dao->entity_id;
}
$defaults['includeGroups'] = $mailingGroups['civicrm_group']['include'];
$defaults['excludeGroups'] = CRM_Utils_Array::value('exclude', $mailingGroups['civicrm_group']);
if (!empty($mailingGroups['civicrm_mailing'])) {
$defaults['includeMailings'] = CRM_Utils_Array::value('include', $mailingGroups['civicrm_mailing']);
$defaults['excludeMailings'] = CRM_Utils_Array::value('exclude', $mailingGroups['civicrm_mailing']);
}
} else {
$defaults['url_tracking'] = TRUE;
$defaults['open_tracking'] = TRUE;
}
//set default message body
$reuseMailing = FALSE;
if ($mailingID) {
$reuseMailing = TRUE;
} else {
$mailingID = $this->_mailingID;
}
$count = $this->get('count');
$this->assign('count', $count);
$this->set('skipTextFile', FALSE);
$this->set('skipHtmlFile', FALSE);
$htmlMessage = NULL;
if ($mailingID) {
$dao = new CRM_Mailing_DAO_Mailing();
$dao->id = $mailingID;
$dao->find(TRUE);
$dao->storeValues($dao, $defaults);
//we don't want to retrieve template details once it is
//set in session
$templateId = $this->get('template');
$this->assign('templateSelected', $templateId ? $templateId : 0);
if (isset($defaults['msg_template_id']) && !$templateId) {
$defaults['template'] = $defaults['msg_template_id'];
$messageTemplate = new CRM_Core_DAO_MessageTemplate();
$messageTemplate->id = $defaults['msg_template_id'];
$messageTemplate->selectAdd();
$messageTemplate->selectAdd('msg_text, msg_html');
$messageTemplate->find(TRUE);
$defaults['text_message'] = $messageTemplate->msg_text;
$htmlMessage = $messageTemplate->msg_html;
}
if (isset($defaults['body_text'])) {
$defaults['text_message'] = $defaults['body_text'];
$this->set('textFile', $defaults['body_text']);
$this->set('skipTextFile', TRUE);
}
if (isset($defaults['body_html'])) {
$htmlMessage = $defaults['body_html'];
$this->set('htmlFile', $defaults['body_html']);
$this->set('skipHtmlFile', TRUE);
}
//set default from email address.
if (CRM_Utils_Array::value('from_name', $defaults) && CRM_Utils_Array::value('from_email', $defaults)) {
$defaults['from_email_address'] = array_search('"' . $defaults['from_name'] . '" <' . $defaults['from_email'] . '>', CRM_Core_OptionGroup::values('from_email_address'));
} else {
//get the default from email address.
$defaultAddress = CRM_Core_OptionGroup::values('from_email_address', NULL, NULL, NULL, ' AND is_default = 1');
//.........这里部分代码省略.........
示例5: setDefaultValues
/**
* This function sets the default values for the form.
* the default values are retrieved from the database
*
* @access public
* @return None
*/
function setDefaultValues()
{
$mailingID = CRM_Utils_Request::retrieve('mid', 'Integer', $this, false, null);
//need to differentiate new/reuse mailing, CRM-2873
$reuseMailing = false;
if ($mailingID) {
$reuseMailing = true;
} else {
$mailingID = $this->_mailingID;
}
$count = $this->get('count');
$this->assign('count', $count);
$this->set('skipTextFile', false);
$this->set('skipHtmlFile', false);
$defaults = array();
$htmlMessage = null;
if ($mailingID) {
require_once 'CRM/Mailing/DAO/Mailing.php';
$dao = new CRM_Mailing_DAO_Mailing();
$dao->id = $mailingID;
$dao->find(true);
$dao->storeValues($dao, $defaults);
//we don't want to retrieve template details once it is
//set in session
$templateId = $this->get('template');
$this->assign('templateSelected', $templateId ? $templateId : 0);
if (isset($defaults['msg_template_id']) && !$templateId) {
$defaults['template'] = $defaults['msg_template_id'];
$messageTemplate = new CRM_Core_DAO_MessageTemplates();
$messageTemplate->id = $defaults['msg_template_id'];
$messageTemplate->selectAdd();
$messageTemplate->selectAdd('msg_text, msg_html');
$messageTemplate->find(true);
$defaults['text_message'] = $messageTemplate->msg_text;
$htmlMessage = $messageTemplate->msg_html;
}
if (isset($defaults['body_text'])) {
$defaults['text_message'] = $defaults['body_text'];
$this->set('textFile', $defaults['body_text']);
$this->set('skipTextFile', true);
}
if (isset($defaults['body_html'])) {
$htmlMessage = $defaults['body_html'];
$this->set('htmlFile', $defaults['body_html']);
$this->set('skipHtmlFile', true);
}
//set default from email address.
require_once 'CRM/Core/OptionGroup.php';
if (CRM_Utils_Array::value('from_name', $defaults) && CRM_Utils_Array::value('from_email', $defaults)) {
$defaults['from_email_address'] = array_search('"' . $defaults['from_name'] . '" <' . $defaults['from_email'] . '>', CRM_Core_OptionGroup::values('from_email_address'));
} else {
//get the default from email address.
$defaultAddress = CRM_Core_OptionGroup::values('from_email_address', null, null, null, ' AND is_default = 1');
foreach ($defaultAddress as $id => $value) {
$defaults['from_email_address'] = $id;
}
}
}
//fix for CRM-2873
if (!$reuseMailing) {
$textFilePath = $this->get('textFilePath');
if ($textFilePath && file_exists($textFilePath)) {
$defaults['text_message'] = file_get_contents($textFilePath);
if (strlen($defaults['text_message']) > 0) {
$this->set('skipTextFile', true);
}
}
$htmlFilePath = $this->get('htmlFilePath');
if ($htmlFilePath && file_exists($htmlFilePath)) {
$defaults['html_message'] = file_get_contents($htmlFilePath);
if (strlen($defaults['html_message']) > 0) {
$htmlMessage = $defaults['html_message'];
$this->set('skipHtmlFile', true);
}
}
}
if ($this->get('html_message')) {
$htmlMessage = $this->get('html_message');
}
$htmlMessage = str_replace(array("\n", "\r"), ' ', $htmlMessage);
$htmlMessage = str_replace("'", "\\'", $htmlMessage);
$this->assign('message_html', $htmlMessage);
$defaults['upload_type'] = 1;
if (isset($defaults['body_html'])) {
$defaults['html_message'] = $defaults['body_html'];
}
//CRM-4678 setdefault to default component when composing new mailing.
if (!$reuseMailing) {
$componentFields = array('header_id' => 'Header', 'footer_id' => 'Footer');
foreach ($componentFields as $componentVar => $componentType) {
$defaults[$componentVar] = CRM_Mailing_PseudoConstant::defaultComponent($componentType, '');
}
}
//.........这里部分代码省略.........