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


PHP CRM_Mailing_BAO_Mailing::getRecipients方法代码示例

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


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

示例1: create

 function create($params)
 {
     $job = new CRM_Mailing_BAO_MailingJob();
     $job->mailing_id = $params['mailing_id'];
     $job->status = $params['status'];
     $job->scheduled_date = $params['scheduled_date'];
     $job->is_test = $params['is_test'];
     $job->save();
     $mailing = new CRM_Mailing_BAO_Mailing();
     $eq = $mailing->getRecipients($job->id, $params['mailing_id'], NULL, NULL, true, false);
     return $job;
 }
开发者ID:TheCraftyCanvas,项目名称:aegir-platforms,代码行数:12,代码来源:MailingJob.php

示例2: create

 /**
  * @param array $params
  *
  * @return CRM_Mailing_BAO_MailingJob
  */
 public static function create($params)
 {
     $job = new CRM_Mailing_BAO_MailingJob();
     $job->mailing_id = $params['mailing_id'];
     $job->status = $params['status'];
     $job->scheduled_date = $params['scheduled_date'];
     $job->is_test = $params['is_test'];
     $job->save();
     $mailing = new CRM_Mailing_BAO_Mailing();
     $mailing->id = $params['mailing_id'];
     if ($mailing->id && $mailing->find(TRUE)) {
         $mailing->getRecipients($job->id, $params['mailing_id'], NULL, NULL, TRUE, $mailing->dedupe_email);
         return $job;
     } else {
         throw new CRM_Core_Exception("Failed to create job: Unknown mailing ID");
     }
 }
开发者ID:vakeesan26,项目名称:civicrm-core,代码行数:22,代码来源:MailingJob.php

示例3: postProcess

 public function postProcess()
 {
     $values = $this->controller->exportValues($this->_name);
     $groups = array();
     foreach (array('name', 'group_id', 'is_sms') as $n) {
         if (!empty($values[$n])) {
             $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;
     $ids = array();
     if ($this->get('mailing_id')) {
         // don't create a new mass sms 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
         foreach (array('groups', 'mailings') as $entity) {
             $mg = new CRM_Mailing_DAO_MailingGroup();
             $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');
     }
     $mailing = CRM_Mailing_BAO_Mailing::create($params, $ids);
     $this->set('mailing_id', $mailing->id);
     // also compute the recipients and store them in the mailing recipients table
     CRM_Mailing_BAO_Mailing::getRecipients($mailing->id, $mailing->id, TRUE, FALSE, 'sms');
     $count = CRM_Mailing_BAO_Recipients::mailingSize($mailing->id);
     $this->set('count', $count);
     $this->assign('count', $count);
     $this->set('groups', $groups);
     $this->set('mailings', $mailings);
     if ($qf_Group_submit) {
         $status = ts("Your Mass SMS has been saved.");
         CRM_Core_Session::setStatus($status, ts('Saved'), 'success');
         $url = CRM_Utils_System::url('civicrm/mailing', 'reset=1&sms=1');
         return $this->controller->setDestination($url);
     }
 }
开发者ID:sarehag,项目名称:civicrm-core,代码行数:85,代码来源:Group.php

示例4: postProcess


//.........这里部分代码省略.........
         }
     }
     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
         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');
     }
     $mailing = CRM_Mailing_BAO_Mailing::create($params, $ids);
     $this->set('mailing_id', $mailing->id);
     $dedupeEmail = FALSE;
     if (isset($params['dedupe_email'])) {
         $dedupeEmail = $params['dedupe_email'];
     }
     // also compute the recipients and store them in the mailing recipients table
     CRM_Mailing_BAO_Mailing::getRecipients($mailing->id, $mailing->id, NULL, NULL, TRUE, $dedupeEmail);
     $count = CRM_Mailing_BAO_Recipients::mailingSize($mailing->id);
     $this->set('count', $count);
     $this->assign('count', $count);
     $this->set('groups', $groups);
     $this->set('mailings', $mailings);
     if ($qf_Group_submit) {
         //when user perform mailing from search context
         //redirect it to search result CRM-3711.
         $ssID = $this->get('ssID');
         $context = $this->get('context');
         if ($ssID && $this->_searchBasedMailing) {
             if ($this->_action == CRM_Core_Action::BASIC) {
                 $fragment = 'search';
             } elseif ($this->_action == CRM_Core_Action::PROFILE) {
                 $fragment = 'search/builder';
             } elseif ($this->_action == CRM_Core_Action::ADVANCED) {
                 $fragment = 'search/advanced';
             } else {
                 $fragment = 'search/custom';
             }
             $context = $this->get('context');
             if (!CRM_Contact_Form_Search::isSearchContext($context)) {
                 $context = 'search';
             }
             $urlParams = "force=1&reset=1&ssID={$ssID}&context={$context}";
             $qfKey = CRM_Utils_Request::retrieve('qfKey', 'String', $this);
             if (CRM_Utils_Rule::qfKey($qfKey)) {
                 $urlParams .= "&qfKey={$qfKey}";
             }
             $draftURL = CRM_Utils_System::url('civicrm/mailing/browse/unscheduled', 'scheduled=false&reset=1');
             $status = ts("Your mailing has been saved. You can continue later by clicking the 'Continue' action to resume working on it.<br /> From <a href='%1'>Draft and Unscheduled Mailings</a>.", array(1 => $draftURL));
             CRM_Core_Session::setStatus($status);
             //replace user context to search.
             $url = CRM_Utils_System::url('civicrm/contact/' . $fragment, $urlParams);
             return $this->controller->setDestination($url);
         } else {
             $status = ts("Your mailing has been saved. Click the 'Continue' action to resume working on it.");
             CRM_Core_Session::setStatus($status);
             $url = CRM_Utils_System::url('civicrm/mailing/browse/unscheduled', 'scheduled=false&reset=1');
             return $this->controller->setDestination($url);
         }
     }
 }
开发者ID:peteainsworth,项目名称:civicrm-4.2.9-drupal,代码行数:101,代码来源:Group.php

示例5: distributeRecipients

 /**
  * Transfer recipients from the canonical mailing A to the other mailings.
  *
  * @param CRM_Mailing_DAO_MailingAB $dao
  */
 public static function distributeRecipients(CRM_Mailing_DAO_MailingAB $dao)
 {
     CRM_Mailing_BAO_Mailing::getRecipients($dao->mailing_id_a, $dao->mailing_id_a, TRUE);
     //calculate total number of random recipients for mail C from group_percentage selected
     $totalCount = CRM_Mailing_BAO_Recipients::mailingSize($dao->mailing_id_a);
     $totalSelected = max(1, round($totalCount * $dao->group_percentage / 100));
     CRM_Mailing_BAO_Recipients::reassign($dao->mailing_id_a, array($dao->mailing_id_b => 2 * $totalSelected <= $totalCount ? $totalSelected : $totalCount - $totalSelected, $dao->mailing_id_c => max(0, $totalCount - $totalSelected - $totalSelected)));
 }
开发者ID:nielosz,项目名称:civicrm-core,代码行数:13,代码来源:MailingAB.php

示例6: createRecipients

 /**
  * Create recipients for the mailing. This should ideally be done at the end of the wizard, while scheduling a mailing.
  *
  * @param int  $crmMailingId
  * @param bool $removeDuplicateEmails
  */
 protected static function createRecipients($crmMailingId, $removeDuplicateEmails)
 {
     CRM_Mailing_BAO_Mailing::getRecipients($crmMailingId, $crmMailingId, NULL, NULL, TRUE, $removeDuplicateEmails);
 }
开发者ID:jaapjansma,项目名称:uk.co.compucorp.civicrm.simplemail,代码行数:10,代码来源:SimpleMail.php

示例7: updateGroupandRecipients

 /**
  * Function to update group and receipients and create the mailing   
  */
 function updateGroupandRecipients()
 {
     $values = $this->controller->exportValues($this->_name);
     $groups = array();
     $ids = array();
     foreach (array('name', 'group_id', 'search_id', 'search_args', 'campaign_id', 'dedupe_email') 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'];
     $groups['include'][] = $values['includeGroups'];
     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->_continue) {
         $params['id'] = $ids['id'] = $this->_mailingID;
     }
     // new mailing, so lets set the created_id
     $session = CRM_Core_Session::singleton();
     $params['created_id'] = $session->get('userID');
     $params['created_date'] = date('YmdHis');
     $mailing = CRM_Mailing_BAO_Mailing::create($params, $ids);
     $this->set('mailing_id', $mailing->id);
     $dedupeEmail = FALSE;
     if (isset($params['dedupe_email'])) {
         $dedupeEmail = $params['dedupe_email'];
     }
     // also compute the recipients and store them in the mailing recipients table
     CRM_Mailing_BAO_Mailing::getRecipients($mailing->id, $mailing->id, NULL, NULL, TRUE, $dedupeEmail);
     $count = CRM_Mailing_BAO_Recipients::mailingSize($mailing->id);
     $this->set('count', $count);
     $this->assign('count', $count);
     $this->set('groups', $groups);
     $this->set('mailings', $mailings);
 }
开发者ID:krishgopi,项目名称:uk.co.vedaconsulting.quickbulkemail,代码行数:66,代码来源:QuickBulkEmail.php


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