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


PHP CRM_Mailing_Event_BAO_Subscribe::getContactGroups方法代码示例

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


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

示例1: commonSubscribe

 /**
  * Send subscribe mail.
  *
  * @param array $groups
  *   The list of group ids for subscribe.
  * @param array $params
  *   The list of email.
  * @param int $contactId
  *   Currently used during event registration/contribution.
  *   Specifically to avoid linking group to wrong duplicate contact
  *   during event registration.
  * @param string $context
  *
  * @return void
  */
 public static function commonSubscribe(&$groups, &$params, $contactId = NULL, $context = NULL)
 {
     $contactGroups = CRM_Mailing_Event_BAO_Subscribe::getContactGroups($params['email'], $contactId);
     $group = array();
     $success = NULL;
     foreach ($groups as $groupID) {
         $title = CRM_Core_DAO::getFieldValue('CRM_Contact_DAO_Group', $groupID, 'title');
         if (array_key_exists($groupID, $contactGroups) && $contactGroups[$groupID]['status'] != 'Removed') {
             $group[$groupID]['title'] = $contactGroups[$groupID]['title'];
             $group[$groupID]['status'] = $contactGroups[$groupID]['status'];
             $status = ts('You are already subscribed in %1, your subscription is %2.', array(1 => $group[$groupID]['title'], 2 => ts($group[$groupID]['status'])));
             CRM_Utils_System::setUFMessage($status);
             continue;
         }
         $se = self::subscribe($groupID, $params['email'], $contactId, $context);
         if ($se !== NULL) {
             $success = TRUE;
             $groupAdded[] = $title;
             // Ask the contact for confirmation
             $se->send_confirm_request($params['email']);
         } else {
             $success = FALSE;
             $groupFailed[] = $title;
         }
     }
     if ($success) {
         $groupTitle = implode(', ', $groupAdded);
         CRM_Utils_System::setUFMessage(ts('Your subscription request has been submitted for %1. Check your inbox shortly for the confirmation email(s). If you do not see a confirmation email, please check your spam/junk mail folder.', array(1 => $groupTitle)));
     } elseif ($success === FALSE) {
         $groupTitle = implode(',', $groupFailed);
         CRM_Utils_System::setUFMessage(ts('We had a problem processing your subscription request for %1. You have tried to subscribe to a private group and/or we encountered a database error. Please contact the site administrator.', array(1 => $groupTitle)));
     }
 }
开发者ID:rollox,项目名称:civicrm-core,代码行数:48,代码来源:Subscribe.php

示例2: formRule

 static function formRule(&$fields)
 {
     $groups = CRM_Mailing_Event_BAO_Subscribe::getContactGroups($fields['email']);
     foreach ($fields as $name => $dontCare) {
         if (substr($name, 0, CRM_Core_Form::CB_PREFIX_LEN) == CRM_Core_Form::CB_PREFIX) {
             $gid = substr($name, CRM_Core_Form::CB_PREFIX_LEN);
             if (array_key_exists($gid, $groups)) {
                 $errors[$name] = ts('You are already subscribed in %1, your subscription is %2.', array(1 => $groups[$gid]['title'], 2 => $groups[$gid]['status']));
             }
         }
     }
     if ($errors) {
         return $errors;
     } else {
         foreach ($fields as $name => $dontCare) {
             if (substr($name, 0, CRM_Core_Form::CB_PREFIX_LEN) == CRM_Core_Form::CB_PREFIX) {
                 return true;
             }
         }
     }
     return array('_qf_default' => 'Please select one or more mailing lists.');
 }
开发者ID:ksecor,项目名称:civicrm,代码行数:22,代码来源:Subscribe.php


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