本文整理汇总了PHP中CRM_Utils_Hook::mailingGroups方法的典型用法代码示例。如果您正苦于以下问题:PHP CRM_Utils_Hook::mailingGroups方法的具体用法?PHP CRM_Utils_Hook::mailingGroups怎么用?PHP CRM_Utils_Hook::mailingGroups使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CRM_Utils_Hook
的用法示例。
在下文中一共展示了CRM_Utils_Hook::mailingGroups方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: buildQuickForm
/**
* Build the form object.
*/
public function buildQuickForm()
{
// Get the context.
$context = $this->get('context');
$this->assign('context', $context);
$this->add('text', 'name', ts('Name Your SMS'), CRM_Core_DAO::getAttribute('CRM_Mailing_DAO_Mailing', 'name'), TRUE);
// Get the mailing groups.
$groups = CRM_Core_PseudoConstant::nestedGroup('Mailing');
// Get the sms mailing list.
$mailings = CRM_Mailing_PseudoConstant::completed('sms');
if (!$mailings) {
$mailings = array();
}
// run the groups through a hook so users can trim it if needed
CRM_Utils_Hook::mailingGroups($this, $groups, $mailings);
$select2style = array('multiple' => TRUE, 'style' => 'width: 100%; max-width: 60em;', 'class' => 'crm-select2', 'placeholder' => ts('- select -'));
$this->add('select', 'includeGroups', ts('Include Group(s)'), $groups, TRUE, $select2style);
$this->add('select', 'excludeGroups', ts('Exclude Group(s)'), $groups, FALSE, $select2style);
$this->add('select', 'includeMailings', ts('INCLUDE Recipients of These Message(s)'), $mailings, FALSE, $select2style);
$this->add('select', 'excludeMailings', ts('EXCLUDE Recipients of These Message(s)'), $mailings, FALSE, $select2style);
$this->addFormRule(array('CRM_SMS_Form_Group', 'formRule'));
$buttons = array(array('type' => 'next', 'name' => ts('Next'), 'spacing' => ' ', 'isDefault' => TRUE), array('type' => 'cancel', 'name' => ts('Cancel')));
$this->addButtons($buttons);
$this->assign('groupCount', count($groups));
$this->assign('mailingCount', count($mailings));
}
示例2: buildQuickForm
/**
* Function to actually build the form
*
* @return void
* @access public
*/
public function buildQuickForm()
{
//get the context
$context = $this->get('context');
$this->assign('context', $context);
$this->add('text', 'name', ts('Name Your SMS'), CRM_Core_DAO::getAttribute('CRM_Mailing_DAO_Mailing', 'name'), TRUE);
//get the mailing groups.
$groups = CRM_Core_PseudoConstant::group('Mailing');
//get the sms mailing list
$mailings = CRM_Mailing_PseudoConstant::completed('sms');
if (!$mailings) {
$mailings = array();
}
// run the groups through a hook so users can trim it if needed
CRM_Utils_Hook::mailingGroups($this, $groups, $mailings);
$inG =& $this->addElement('advmultiselect', 'includeGroups', ts('Include Group(s)') . ' ', $groups, array('size' => 5, 'style' => 'width:240px', 'class' => 'advmultiselect'));
$this->addRule('includeGroups', ts('Please select a group to be SMSed.'), 'required');
$outG =& $this->addElement('advmultiselect', 'excludeGroups', ts('Exclude Group(s)') . ' ', $groups, array('size' => 5, 'style' => 'width:240px', 'class' => 'advmultiselect'));
$inG->setButtonAttributes('add', array('value' => ts('Add >>')));
$outG->setButtonAttributes('add', array('value' => ts('Add >>')));
$inG->setButtonAttributes('remove', array('value' => ts('<< Remove')));
$outG->setButtonAttributes('remove', array('value' => ts('<< Remove')));
$inM =& $this->addElement('advmultiselect', 'includeMailings', ts('INCLUDE Recipients of These Mailing(s)') . ' ', $mailings, array('size' => 5, 'style' => 'width:240px', 'class' => 'advmultiselect'));
$outM =& $this->addElement('advmultiselect', 'excludeMailings', ts('EXCLUDE Recipients of These Mailing(s)') . ' ', $mailings, array('size' => 5, 'style' => 'width:240px', 'class' => 'advmultiselect'));
$inM->setButtonAttributes('add', array('value' => ts('Add >>')));
$outM->setButtonAttributes('add', array('value' => ts('Add >>')));
$inM->setButtonAttributes('remove', array('value' => ts('<< Remove')));
$outM->setButtonAttributes('remove', array('value' => ts('<< Remove')));
$this->addFormRule(array('CRM_SMS_Form_Group', 'formRule'));
$buttons = array(array('type' => 'next', 'name' => ts('Next >>'), 'spacing' => ' ', 'isDefault' => TRUE), array('type' => 'cancel', 'name' => ts('Cancel')));
$this->addButtons($buttons);
$this->assign('groupCount', count($groups));
$this->assign('mailingCount', count($mailings));
}
示例3: buildQuickForm
/**
* Function to actually build the form
*
* @return None
* @access public
*/
public function buildQuickForm()
{
require_once 'CRM/Mailing/PseudoConstant.php';
//get the context
$context = $this->get('context');
if ($this->_searchBasedMailing) {
$context = 'search';
}
$this->assign('context', $context);
$this->add('text', 'name', ts('Name Your Mailing'), CRM_Core_DAO::getAttribute('CRM_Mailing_DAO_Mailing', 'name'), true);
//get the mailing groups.
$groups =& CRM_Core_PseudoConstant::group('Mailing');
$mailings =& CRM_Mailing_PseudoConstant::completed();
if (!$mailings) {
$mailings = array();
}
// run the groups through a hook so users can trim it if needed
require_once 'CRM/Utils/Hook.php';
CRM_Utils_Hook::mailingGroups($this, $groups, $mailings);
//when the context is search add base group's.
if ($this->_searchBasedMailing) {
//get the static groups
$staticGroups = CRM_Core_PseudoConstant::staticGroup(false, 'Mailing');
$this->add('select', 'baseGroup', ts('Base Group'), array('' => ts('- select -')) + $staticGroups, true);
}
$inG =& $this->addElement('advmultiselect', 'includeGroups', ts('Include Group(s)') . ' ', $groups, array('size' => 5, 'style' => 'width:240px', 'class' => 'advmultiselect'));
//as we are having hidden smart group so no need.
if (!$this->_searchBasedMailing) {
$this->addRule('includeGroups', ts('Please select a group to be mailed.'), 'required');
}
$outG =& $this->addElement('advmultiselect', 'excludeGroups', ts('Exclude Group(s)') . ' ', $groups, array('size' => 5, 'style' => 'width:240px', 'class' => 'advmultiselect'));
$inG->setButtonAttributes('add', array('value' => ts('Add >>')));
$outG->setButtonAttributes('add', array('value' => ts('Add >>')));
$inG->setButtonAttributes('remove', array('value' => ts('<< Remove')));
$outG->setButtonAttributes('remove', array('value' => ts('<< Remove')));
$inM =& $this->addElement('advmultiselect', 'includeMailings', ts('INCLUDE Recipients of These Mailing(s)') . ' ', $mailings, array('size' => 5, 'style' => 'width:240px', 'class' => 'advmultiselect'));
$outM =& $this->addElement('advmultiselect', 'excludeMailings', ts('EXCLUDE Recipients of These Mailing(s)') . ' ', $mailings, array('size' => 5, 'style' => 'width:240px', 'class' => 'advmultiselect'));
$inM->setButtonAttributes('add', array('value' => ts('Add >>')));
$outM->setButtonAttributes('add', array('value' => ts('Add >>')));
$inM->setButtonAttributes('remove', array('value' => ts('<< Remove')));
$outM->setButtonAttributes('remove', array('value' => ts('<< Remove')));
require_once 'CRM/Contact/Page/CustomSearch.php';
$urls = array('' => ts('- select -'), -1 => ts('CiviCRM Search')) + CRM_Contact_Page_CustomSearch::info();
$this->addFormRule(array('CRM_Mailing_Form_Group', 'formRule'));
//FIXME : currently we are hiding save an continue later when
//search base mailing, we should handle it when we fix CRM-3876
$buttons = array(array('type' => 'next', 'name' => ts('Next >>'), 'spacing' => ' ', 'isDefault' => true), array('type' => 'submit', 'name' => ts('Save & Continue Later')), array('type' => 'cancel', 'name' => ts('Cancel')));
if ($this->_searchBasedMailing) {
$buttons = array(array('type' => 'next', 'name' => ts('Next >>'), 'spacing' => ' ', 'isDefault' => true), array('type' => 'cancel', 'name' => ts('Cancel')));
}
$this->addButtons($buttons);
$this->assign('groupCount', count($groups));
$this->assign('mailingCount', count($mailings));
}
示例4: buildQuickForm
/**
* Function to actually build the form
*
* @return None
* @access public
*/
public function buildQuickForm()
{
//get the context
$context = $this->get('context');
if ($this->_searchBasedMailing) {
$context = 'search';
}
$this->assign('context', $context);
$this->add('text', 'name', ts('Name Your Mailing'), CRM_Core_DAO::getAttribute('CRM_Mailing_DAO_Mailing', 'name'), TRUE);
//CRM-7362 --add campaigns.
$mailingId = CRM_Utils_Request::retrieve('mid', 'Integer', $this, FALSE, NULL);
$campaignId = NULL;
if ($mailingId) {
$campaignId = CRM_Core_DAO::getFieldValue('CRM_Mailing_DAO_Mailing', $mailingId, 'campaign_id');
}
CRM_Campaign_BAO_Campaign::addCampaign($this, $campaignId);
//dedupe on email option
$this->addElement('checkbox', 'dedupe_email', ts('Remove duplicate emails?'));
//get the mailing groups.
$groups = CRM_Core_PseudoConstant::group('Mailing');
$mailings = CRM_Mailing_PseudoConstant::completed();
if (!$mailings) {
$mailings = array();
}
// run the groups through a hook so users can trim it if needed
CRM_Utils_Hook::mailingGroups($this, $groups, $mailings);
//when the context is search add base group's.
if ($this->_searchBasedMailing) {
//get the static groups
$staticGroups = CRM_Core_PseudoConstant::staticGroup(FALSE, 'Mailing');
$this->add('select', 'baseGroup', ts('Unsubscription Group'), array('' => ts('- select -')) + $staticGroups, TRUE);
}
$inG =& $this->addElement('advmultiselect', 'includeGroups', ts('Include Group(s)') . ' ', $groups, array('size' => 5, 'style' => 'width:240px', 'class' => 'advmultiselect'));
//as we are having hidden smart group so no need.
if (!$this->_searchBasedMailing) {
$this->addRule('includeGroups', ts('Please select a group to be mailed.'), 'required');
}
$outG =& $this->addElement('advmultiselect', 'excludeGroups', ts('Exclude Group(s)') . ' ', $groups, array('size' => 5, 'style' => 'width:240px', 'class' => 'advmultiselect'));
$inG->setButtonAttributes('add', array('value' => ts('Add >>')));
$outG->setButtonAttributes('add', array('value' => ts('Add >>')));
$inG->setButtonAttributes('remove', array('value' => ts('<< Remove')));
$outG->setButtonAttributes('remove', array('value' => ts('<< Remove')));
$inM =& $this->addElement('advmultiselect', 'includeMailings', ts('INCLUDE Recipients of These Mailing(s)') . ' ', $mailings, array('size' => 5, 'style' => 'width:240px', 'class' => 'advmultiselect'));
$outM =& $this->addElement('advmultiselect', 'excludeMailings', ts('EXCLUDE Recipients of These Mailing(s)') . ' ', $mailings, array('size' => 5, 'style' => 'width:240px', 'class' => 'advmultiselect'));
$inM->setButtonAttributes('add', array('value' => ts('Add >>')));
$outM->setButtonAttributes('add', array('value' => ts('Add >>')));
$inM->setButtonAttributes('remove', array('value' => ts('<< Remove')));
$outM->setButtonAttributes('remove', array('value' => ts('<< Remove')));
$urls = array('' => ts('- select -'), -1 => ts('CiviCRM Search')) + CRM_Contact_Page_CustomSearch::info();
$this->addFormRule(array('CRM_Mailing_Form_Group', 'formRule'));
//FIXME : currently we are hiding save an continue later when
//search base mailing, we should handle it when we fix CRM-3876
$buttons = array(array('type' => 'next', 'name' => ts('Next >>'), 'spacing' => ' ', 'isDefault' => TRUE), array('type' => 'submit', 'name' => ts('Save & Continue Later')), array('type' => 'cancel', 'name' => ts('Cancel')));
if ($this->_searchBasedMailing) {
$buttons = array(array('type' => 'next', 'name' => ts('Next >>'), 'spacing' => ' ', 'isDefault' => TRUE), array('type' => 'cancel', 'name' => ts('Cancel')));
}
$this->addButtons($buttons);
$this->assign('groupCount', count($groups));
$this->assign('mailingCount', count($mailings));
}
示例5: buildQuickForm
/**
* Build the form object.
*
* @return void
*/
public function buildQuickForm()
{
//get the context
$context = $this->get('context');
if ($this->_searchBasedMailing) {
$context = 'search';
}
$this->assign('context', $context);
$this->add('text', 'name', ts('Name Your Mailing'), CRM_Core_DAO::getAttribute('CRM_Mailing_DAO_Mailing', 'name'), TRUE);
$hiddenMailingGroup = NULL;
$campaignId = NULL;
//CRM-7362 --add campaigns.
if ($this->_mailingID) {
$campaignId = CRM_Core_DAO::getFieldValue('CRM_Mailing_DAO_Mailing', $this->_mailingID, 'campaign_id');
$hiddenMailingGroup = CRM_Mailing_BAO_Mailing::hiddenMailingGroup($this->_mailingID);
}
CRM_Campaign_BAO_Campaign::addCampaign($this, $campaignId);
//dedupe on email option
$this->addElement('checkbox', 'dedupe_email', ts('Remove duplicate emails?'));
// location types
$locationTypes = CRM_Core_PseudoConstant::get('CRM_Core_DAO_Address', 'location_type_id', array('id' => 'display_name'));
$this->addElement('select', 'location_type_id', ts("Location Type"), array('' => ts('Automatic')) + $locationTypes);
$methods = CRM_Core_SelectValues::emailSelectMethods();
$this->addElement('select', 'email_selection_method', ts("Email Selection Method"), $methods);
//get the mailing groups.
$groups = CRM_Core_PseudoConstant::nestedGroup('Mailing');
if ($hiddenMailingGroup) {
$groups[$hiddenMailingGroup] = CRM_Core_DAO::getFieldValue('CRM_Contact_DAO_Group', $hiddenMailingGroup, 'title');
}
$mailings = CRM_Mailing_PseudoConstant::completed();
if (!$mailings) {
$mailings = array();
}
// run the groups through a hook so users can trim it if needed
CRM_Utils_Hook::mailingGroups($this, $groups, $mailings);
//when the context is search add base group's.
if ($this->_searchBasedMailing) {
//get the static groups
$staticGroups = CRM_Core_PseudoConstant::staticGroup(FALSE, 'Mailing');
$this->add('select', 'baseGroup', ts('Unsubscription Group'), array('' => ts('- select -')) + CRM_Contact_BAO_Group::getGroupsHierarchy($staticGroups, NULL, ' ', TRUE), TRUE, array('class' => 'crm-select2 huge'));
}
$select2style = array('multiple' => TRUE, 'style' => 'width: 100%; max-width: 60em;', 'class' => 'crm-select2', 'placeholder' => ts('- select -'));
$this->add('select', 'includeGroups', ts('Include Group(s)'), $groups, !$this->_searchBasedMailing, $select2style);
$this->add('select', 'excludeGroups', ts('Exclude Group(s)'), $groups, FALSE, $select2style);
$this->add('select', 'includeMailings', ts('INCLUDE Recipients of These Mailing(s)') . ' ', $mailings, FALSE, $select2style);
$this->add('select', 'excludeMailings', ts('EXCLUDE Recipients of These Mailing(s)') . ' ', $mailings, FALSE, $select2style);
$this->addFormRule(array('CRM_Mailing_Form_Group', 'formRule'));
$buttons = array(array('type' => 'next', 'name' => ts('Next'), 'spacing' => ' ', 'isDefault' => TRUE), array('type' => 'submit', 'name' => ts('Save & Continue Later')), array('type' => 'cancel', 'name' => ts('Cancel')));
$this->addButtons($buttons);
$this->assign('groupCount', count($groups));
$this->assign('mailingCount', count($mailings));
if (count($groups) == 0 && count($mailings) == 0 && !$this->_searchBasedMailing) {
CRM_Core_Error::statusBounce("To send a mailing, you must have a valid group of recipients - either at least one group that's a Mailing List or at least one previous mailing or start from a search");
}
}
示例6: buildQuickForm
/**
* Function to actually build the form
*
* @return None
* @access public
*/
public function buildQuickForm()
{
//get the context
$context = $this->get('context');
if ($this->_searchBasedMailing) {
$context = 'search';
}
$this->assign('context', $context);
$this->add('text', 'name', ts('Name Your Mailing'), CRM_Core_DAO::getAttribute('CRM_Mailing_DAO_Mailing', 'name'), TRUE);
$hiddenMailingGroup = NULL;
$campaignId = NULL;
//CRM-7362 --add campaigns.
if ($this->_mailingID) {
$campaignId = CRM_Core_DAO::getFieldValue('CRM_Mailing_DAO_Mailing', $this->_mailingID, 'campaign_id');
$hiddenMailingGroup = CRM_Mailing_BAO_Mailing::hiddenMailingGroup($this->_mailingID);
}
CRM_Campaign_BAO_Campaign::addCampaign($this, $campaignId);
//dedupe on email option
$this->addElement('checkbox', 'dedupe_email', ts('Remove duplicate emails?'));
//get the mailing groups.
$groups = CRM_Core_PseudoConstant::nestedGroup('Mailing');
// asort($groups);
if ($hiddenMailingGroup) {
$groups[$hiddenMailingGroup] = CRM_Core_DAO::getFieldValue('CRM_Contact_DAO_Group', $hiddenMailingGroup, 'title');
}
$mailings = CRM_Mailing_PseudoConstant::completed();
if (!$mailings) {
$mailings = array();
}
// run the groups through a hook so users can trim it if needed
CRM_Utils_Hook::mailingGroups($this, $groups, $mailings);
//when the context is search add base group's.
if ($this->_searchBasedMailing) {
//CRM-16600 Include Smart Groups in Unsubscribe list as that matches
//all other practices in CiviMail
$this->add('select', 'baseGroup', ts('Unsubscription Group'), array('' => ts('- select -')) + $groups, TRUE);
}
if (count($groups) <= 10) {
// setting minimum height to 2 since widget looks strange when size (height) is 1
$groupSize = max(count($groups), 2);
} else {
$groupSize = 10;
}
$inG =& $this->addElement('advmultiselect', 'includeGroups', ts('Include Group(s)') . ' ', $groups, array('size' => $groupSize, 'style' => 'width:auto; min-width:240px;', 'class' => 'advmultiselect'));
//as we are having hidden smart group so no need.
if (!$this->_searchBasedMailing) {
$this->addRule('includeGroups', ts('Please select a group to be mailed.'), 'required');
}
$outG =& $this->addElement('advmultiselect', 'excludeGroups', ts('Exclude Group(s)') . ' ', $groups, array('size' => $groupSize, 'style' => 'width:auto; min-width:240px;', 'class' => 'advmultiselect'));
$inG->setButtonAttributes('add', array('value' => ts('Add >>')));
$outG->setButtonAttributes('add', array('value' => ts('Add >>')));
$inG->setButtonAttributes('remove', array('value' => ts('<< Remove')));
$outG->setButtonAttributes('remove', array('value' => ts('<< Remove')));
if (count($mailings) <= 10) {
// setting minimum height to 2 since widget looks strange when size (height) is 1
$mailingSize = max(count($mailings), 2);
} else {
$mailingSize = 10;
}
$inM =& $this->addElement('advmultiselect', 'includeMailings', ts('INCLUDE Recipients of These Mailing(s)') . ' ', $mailings, array('size' => $mailingSize, 'style' => 'width:auto; min-width:240px;', 'class' => 'advmultiselect'));
$outM =& $this->addElement('advmultiselect', 'excludeMailings', ts('EXCLUDE Recipients of These Mailing(s)') . ' ', $mailings, array('size' => $mailingSize, 'style' => 'width:auto; min-width:240px;', 'class' => 'advmultiselect'));
$inM->setButtonAttributes('add', array('value' => ts('Add >>')));
$outM->setButtonAttributes('add', array('value' => ts('Add >>')));
$inM->setButtonAttributes('remove', array('value' => ts('<< Remove')));
$outM->setButtonAttributes('remove', array('value' => ts('<< Remove')));
$urls = array('' => ts('- select -'), -1 => ts('CiviCRM Search')) + CRM_Contact_Page_CustomSearch::info();
$this->addFormRule(array('CRM_Mailing_Form_Group', 'formRule'));
$buttons = array(array('type' => 'next', 'name' => ts('Next >>'), 'spacing' => ' ', 'isDefault' => TRUE), array('type' => 'submit', 'name' => ts('Save & Continue Later')), array('type' => 'cancel', 'name' => ts('Cancel')));
$this->addButtons($buttons);
$this->assign('groupCount', count($groups));
$this->assign('mailingCount', count($mailings));
if (count($groups) == 0 && count($mailings) == 0 && !$this->_searchBasedMailing) {
CRM_Core_Error::statusBounce("To send a mailing, you must have a valid group of recipients - either at least one group that's a Mailing List or at least one previous mailing or start from a search");
}
}