本文整理汇总了PHP中CRM_Mailing_DAO_Mailing::addSelect方法的典型用法代码示例。如果您正苦于以下问题:PHP CRM_Mailing_DAO_Mailing::addSelect方法的具体用法?PHP CRM_Mailing_DAO_Mailing::addSelect怎么用?PHP CRM_Mailing_DAO_Mailing::addSelect使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CRM_Mailing_DAO_Mailing
的用法示例。
在下文中一共展示了CRM_Mailing_DAO_Mailing::addSelect方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setDefaultValues
/**
* Set default values for the form.
* The default values are retrieved from the database.
*/
public function setDefaultValues()
{
$mailingID = CRM_Utils_Request::retrieve('mid', 'Integer', $this, FALSE, NULL);
$continue = CRM_Utils_Request::retrieve('continue', 'String', $this, FALSE, NULL);
$defaults = array();
if ($mailingID) {
$mailing = new CRM_Mailing_DAO_Mailing();
$mailing->id = $mailingID;
$mailing->addSelect('name');
$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', $mailingID);
}
$dao = new CRM_Mailing_DAO_MailingGroup();
$mailingGroups = array();
$dao->mailing_id = $mailingID;
$dao->find();
while ($dao->fetch()) {
$mailingGroups[$dao->entity_table][$dao->group_type][] = $dao->entity_id;
}
$defaults['includeGroups'] = $mailingGroups['civicrm_group']['Include'];
$defaults['excludeGroups'] = CRM_Utils_Array::value('Exclude', $mailingGroups['civicrm_group']);
$defaults['includeMailings'] = CRM_Utils_Array::value('Include', CRM_Utils_Array::value('civicrm_mailing', $mailingGroups));
$defaults['excludeMailings'] = CRM_Utils_Array::value('Exclude', CRM_Utils_Array::value('civicrm_mailing', $mailingGroups));
}
return $defaults;
}
示例2: 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);
$continue = CRM_Utils_Request::retrieve('continue', 'String', $this, FALSE, NULL);
// check that the user has permission to access mailing id
CRM_Mailing_BAO_Mailing::checkPermission($mailingID);
$defaults = array();
if ($mailingID) {
$mailing = new CRM_Mailing_DAO_Mailing();
$mailing->id = $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', $mailingID);
}
$defaults['campaign_id'] = $mailing->campaign_id;
$defaults['dedupe_email'] = $mailing->dedupe_email;
$dao = new CRM_Mailing_DAO_Group();
$mailingGroups = array();
$dao->mailing_id = $mailingID;
$dao->find();
while ($dao->fetch()) {
$mailingGroups[$dao->entity_table][$dao->group_type][] = $dao->entity_id;
}
$defaults['includeGroups'] = $mailingGroups['civicrm_group']['Include'];
$defaults['excludeGroups'] = CRM_Utils_Array::value('Exclude', $mailingGroups['civicrm_group']);
$defaults['includeMailings'] = CRM_Utils_Array::value('Include', $mailingGroups['civicrm_mailing']);
$defaults['excludeMailings'] = $mailingGroups['civicrm_mailing']['Exclude'];
}
//when the context is search hide the mailing recipients.
$showHide = new CRM_Core_ShowHideBlocks();
$showGroupSelector = TRUE;
if ($this->_searchBasedMailing) {
$showGroupSelector = FALSE;
$formElements = array('includeGroups', 'excludeGroups', 'includeMailings', 'excludeMailings');
$formValues = $this->controller->exportValues($this->_name);
foreach ($formElements as $element) {
if (!empty($formValues[$element])) {
$showGroupSelector = TRUE;
break;
}
}
}
if ($showGroupSelector) {
$showHide->addShow("id-additional");
$showHide->addHide("id-additional-show");
} else {
$showHide->addShow("id-additional-show");
$showHide->addHide("id-additional");
}
$showHide->addToTemplate();
return $defaults;
}
示例3: 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');
//.........这里部分代码省略.........
示例4: setDefaultValues
/**
* Set default values for the form.
* the default values are retrieved from the database
*
*
* @return void
*/
public function setDefaultValues()
{
$continue = CRM_Utils_Request::retrieve('continue', 'String', $this, FALSE, NULL);
$defaults = array();
$defaults['dedupe_email'] = CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::MAILING_PREFERENCES_NAME, 'dedupe_email_default', NULL, FALSE);
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;
$defaults['location_type_id'] = $mailing->location_type_id;
$defaults['email_selection_method'] = $mailing->email_selection_method;
$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'] = CRM_Utils_Array::value('Include', $mailingGroups['civicrm_group']);
$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']);
}
}
//when the context is search hide the mailing recipients.
$showHide = new CRM_Core_ShowHideBlocks();
$showGroupSelector = TRUE;
if ($this->_searchBasedMailing) {
$showGroupSelector = FALSE;
$formElements = array('includeGroups', 'excludeGroups', 'includeMailings', 'excludeMailings');
$formValues = $this->controller->exportValues($this->_name);
foreach ($formElements as $element) {
if (!empty($formValues[$element])) {
$showGroupSelector = TRUE;
break;
}
}
}
if ($showGroupSelector) {
$showHide->addShow("id-additional");
$showHide->addHide("id-additional-show");
} else {
$showHide->addShow("id-additional-show");
$showHide->addHide("id-additional");
}
$showHide->addToTemplate();
return $defaults;
}