当前位置: 首页>>代码示例>>PHP>>正文


PHP CRM_Core_SelectValues::emailSelectMethods方法代码示例

本文整理汇总了PHP中CRM_Core_SelectValues::emailSelectMethods方法的典型用法代码示例。如果您正苦于以下问题:PHP CRM_Core_SelectValues::emailSelectMethods方法的具体用法?PHP CRM_Core_SelectValues::emailSelectMethods怎么用?PHP CRM_Core_SelectValues::emailSelectMethods使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CRM_Core_SelectValues的用法示例。


在下文中一共展示了CRM_Core_SelectValues::emailSelectMethods方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: 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");
     }
 }
开发者ID:JSProffitt,项目名称:civicrm-website-org,代码行数:60,代码来源:Group.php


注:本文中的CRM_Core_SelectValues::emailSelectMethods方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。