本文整理汇总了PHP中CRM_Mailing_BAO_Mailing::getRecipientsCount方法的典型用法代码示例。如果您正苦于以下问题:PHP CRM_Mailing_BAO_Mailing::getRecipientsCount方法的具体用法?PHP CRM_Mailing_BAO_Mailing::getRecipientsCount怎么用?PHP CRM_Mailing_BAO_Mailing::getRecipientsCount使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CRM_Mailing_BAO_Mailing
的用法示例。
在下文中一共展示了CRM_Mailing_BAO_Mailing::getRecipientsCount方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setDefaultValues
/**
* This function sets the default values for the form.
*
* @access public
* @return None
*/
function setDefaultValues()
{
$defaults = array();
if ($this->_scheduleFormOnly) {
$count = CRM_Mailing_BAO_Mailing::getRecipientsCount(true, false, $this->_mailingID);
} else {
$count = $this->get('count');
}
$this->assign('count', $count);
$defaults['now'] = 1;
return $defaults;
}
示例2: postProcess
public function postProcess()
{
$values = $this->controller->exportValues($this->_name);
//build hidden smart group. when user want to send mailing
//through search contact-> more action -> send Mailing. CRM-3711
$groups = array();
if ($this->_searchBasedMailing && $this->_contactIds) {
//get the hidden smart group id.
$ssId = $this->get('ssID');
$session = CRM_Core_Session::singleton();
$hiddenSmartParams = array('group_type' => array('2' => 1), 'form_values' => $this->get('formValues'), 'saved_search_id' => $ssId, 'search_custom_id' => $this->get('customSearchID'), 'search_context' => $this->get('context'));
require_once 'CRM/Contact/BAO/Group.php';
list($smartGroupId, $savedSearchId) = CRM_Contact_BAO_Group::createHiddenSmartGroup($hiddenSmartParams);
//set the saved search id.
if (!$ssId) {
if ($savedSearchId) {
$this->set('ssID', $savedSearchId);
} else {
CRM_Core_Error::fatal();
}
}
//get the base group for this mailing, CRM-3711
$groups['base'] = array($values['baseGroup']);
$values['includeGroups'][] = $smartGroupId;
}
foreach (array('name', 'group_id', 'search_id', 'search_args') as $n) {
if (CRM_Utils_Array::value($n, $values)) {
$params[$n] = $values[$n];
}
}
$qf_Group_submit = $this->controller->exportValue($this->_name, '_qf_Group_submit');
$this->set('name', $params['name']);
$inGroups = $values['includeGroups'];
$outGroups = $values['excludeGroups'];
$inMailings = $values['includeMailings'];
$outMailings = $values['excludeMailings'];
if (is_array($inGroups)) {
foreach ($inGroups as $key => $id) {
if ($id) {
$groups['include'][] = $id;
}
}
}
if (is_array($outGroups)) {
foreach ($outGroups as $key => $id) {
if ($id) {
$groups['exclude'][] = $id;
}
}
}
$mailings = array();
if (is_array($inMailings)) {
foreach ($inMailings as $key => $id) {
if ($id) {
$mailings['include'][] = $id;
}
}
}
if (is_array($outMailings)) {
foreach ($outMailings as $key => $id) {
if ($id) {
$mailings['exclude'][] = $id;
}
}
}
$session = CRM_Core_Session::singleton();
$params['groups'] = $groups;
$params['mailings'] = $mailings;
if ($this->get('mailing_id')) {
$ids = array();
// don't create a new mailing if already exists
$ids['mailing_id'] = $this->get('mailing_id');
$groupTableName = CRM_Contact_BAO_Group::getTableName();
$mailingTableName = CRM_Mailing_BAO_Mailing::getTableName();
// delete previous includes/excludes, if mailing already existed
require_once 'CRM/Contact/DAO/Group.php';
foreach (array('groups', 'mailings') as $entity) {
$mg = new CRM_Mailing_DAO_Group();
$mg->mailing_id = $ids['mailing_id'];
$mg->entity_table = $entity == 'groups' ? $groupTableName : $mailingTableName;
$mg->find();
while ($mg->fetch()) {
$mg->delete();
}
}
} else {
// new mailing, so lets set the created_id
$session = CRM_Core_Session::singleton();
$params['created_id'] = $session->get('userID');
$params['created_date'] = date('YmdHis');
}
require_once 'CRM/Mailing/BAO/Mailing.php';
$mailing = CRM_Mailing_BAO_Mailing::create($params, $ids);
$this->set('mailing_id', $mailing->id);
$count = CRM_Mailing_BAO_Mailing::getRecipientsCount(true, false, $mailing->id);
$this->set('count', $count);
$this->assign('count', $count);
$this->set('groups', $groups);
$this->set('mailings', $mailings);
if ($qf_Group_submit) {
//.........这里部分代码省略.........