本文整理汇总了PHP中CRM_Mailing_BAO_Mailing::getContactMailingsCount方法的典型用法代码示例。如果您正苦于以下问题:PHP CRM_Mailing_BAO_Mailing::getContactMailingsCount方法的具体用法?PHP CRM_Mailing_BAO_Mailing::getContactMailingsCount怎么用?PHP CRM_Mailing_BAO_Mailing::getContactMailingsCount使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CRM_Mailing_BAO_Mailing
的用法示例。
在下文中一共展示了CRM_Mailing_BAO_Mailing::getContactMailingsCount方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getCountComponent
/**
* Given the component name and returns the count of participation of contact.
*
* @param string $component
* Input component name.
* @param int $contactId
* Input contact id.
* @param string $tableName
* Optional tableName if component is custom group.
*
* @return int
* total number in database
*/
public static function getCountComponent($component, $contactId, $tableName = NULL)
{
$object = NULL;
switch ($component) {
case 'tag':
return CRM_Core_BAO_EntityTag::getContactTags($contactId, TRUE);
case 'rel':
$result = CRM_Contact_BAO_Relationship::getRelationship($contactId, CRM_Contact_BAO_Relationship::CURRENT, 0, 1);
return $result;
case 'group':
return CRM_Contact_BAO_GroupContact::getContactGroup($contactId, "Added", NULL, TRUE);
case 'log':
if (CRM_Core_BAO_Log::useLoggingReport()) {
return FALSE;
}
return CRM_Core_BAO_Log::getContactLogCount($contactId);
case 'note':
return CRM_Core_BAO_Note::getContactNoteCount($contactId);
case 'contribution':
return CRM_Contribute_BAO_Contribution::contributionCount($contactId);
case 'membership':
return CRM_Member_BAO_Membership::getContactMembershipCount($contactId, TRUE);
case 'participant':
return CRM_Event_BAO_Participant::getContactParticipantCount($contactId);
case 'pledge':
return CRM_Pledge_BAO_Pledge::getContactPledgeCount($contactId);
case 'case':
return CRM_Case_BAO_Case::caseCount($contactId);
case 'grant':
return CRM_Grant_BAO_Grant::getContactGrantCount($contactId);
case 'activity':
$input = array('contact_id' => $contactId, 'admin' => FALSE, 'caseId' => NULL, 'context' => 'activity');
return CRM_Activity_BAO_Activity::getActivitiesCount($input);
case 'mailing':
$params = array('contact_id' => $contactId);
return CRM_Mailing_BAO_Mailing::getContactMailingsCount($params);
default:
$custom = explode('_', $component);
if ($custom['0'] = 'custom') {
if (!$tableName) {
$tableName = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_CustomGroup', $custom['1'], 'table_name');
}
$queryString = "SELECT count(id) FROM {$tableName} WHERE entity_id = {$contactId}";
return CRM_Core_DAO::singleValueQuery($queryString);
}
}
}
示例2: getContactMailingSelector
/**
* wrapper for ajax activity selector.
*
* @param array $params
* Associated array for params record id.
*
* @return array
* associated array of contact activities
*/
public static function getContactMailingSelector(&$params)
{
// format the params
$params['offset'] = ($params['page'] - 1) * $params['rp'];
$params['rowCount'] = $params['rp'];
$params['sort'] = CRM_Utils_Array::value('sortBy', $params);
$params['caseId'] = NULL;
// get contact mailings
$mailings = CRM_Mailing_BAO_Mailing::getContactMailings($params);
// add total
$params['total'] = CRM_Mailing_BAO_Mailing::getContactMailingsCount($params);
//CRM-12814
if (!empty($mailings)) {
$openCounts = CRM_Mailing_Event_BAO_Opened::getMailingContactCount(array_keys($mailings), $params['contact_id']);
$clickCounts = CRM_Mailing_Event_BAO_TrackableURLOpen::getMailingContactCount(array_keys($mailings), $params['contact_id']);
}
// format params and add links
$contactMailings = array();
foreach ($mailings as $mailingId => $values) {
$mailing = array();
$mailing['subject'] = $values['subject'];
$mailing['creator_name'] = CRM_Utils_System::href($values['creator_name'], 'civicrm/contact/view', "reset=1&cid={$values['creator_id']}");
$mailing['recipients'] = CRM_Utils_System::href(ts('(recipients)'), 'civicrm/mailing/report/event', "mid={$values['mailing_id']}&reset=1&cid={$params['contact_id']}&event=queue&context=mailing");
$mailing['start_date'] = CRM_Utils_Date::customFormat($values['start_date']);
//CRM-12814
$mailing['openstats'] = "Opens: " . CRM_Utils_Array::value($values['mailing_id'], $openCounts, 0) . "<br />Clicks: " . CRM_Utils_Array::value($values['mailing_id'], $clickCounts, 0);
$actionLinks = array(CRM_Core_Action::VIEW => array('name' => ts('View'), 'url' => 'civicrm/mailing/view', 'qs' => "reset=1&id=%%mkey%%", 'title' => ts('View Mailing'), 'class' => 'crm-popup'), CRM_Core_Action::BROWSE => array('name' => ts('Mailing Report'), 'url' => 'civicrm/mailing/report', 'qs' => "mid=%%mid%%&reset=1&cid=%%cid%%&context=mailing", 'title' => ts('View Mailing Report')));
$mailingKey = $values['mailing_id'];
if ($hash = CRM_Mailing_BAO_Mailing::getMailingHash($mailingKey)) {
$mailingKey = $hash;
}
$mailing['links'] = CRM_Core_Action::formLink($actionLinks, NULL, array('mid' => $values['mailing_id'], 'cid' => $params['contact_id'], 'mkey' => $mailingKey), ts('more'), FALSE, 'mailing.contact.action', 'Mailing', $values['mailing_id']);
array_push($contactMailings, $mailing);
}
$contactMailingsDT = array();
$contactMailingsDT['data'] = $contactMailings;
$contactMailingsDT['recordsTotal'] = $params['total'];
$contactMailingsDT['recordsFiltered'] = $params['total'];
return $contactMailingsDT;
}
示例3: getContactMailingSelector
/**
* This function is a wrapper for ajax activity selector
*
* @param array $params associated array for params record id.
*
* @return array $contactActivities associated array of contact activities
* @access public
*/
public static function getContactMailingSelector(&$params)
{
// format the params
$params['offset'] = ($params['page'] - 1) * $params['rp'];
$params['rowCount'] = $params['rp'];
$params['sort'] = CRM_Utils_Array::value('sortBy', $params);
$params['caseId'] = NULL;
// get contact mailings
$mailings = CRM_Mailing_BAO_Mailing::getContactMailings($params);
// add total
$params['total'] = CRM_Mailing_BAO_Mailing::getContactMailingsCount($params);
//CRM-12814
if (!empty($mailings)) {
$openCounts = CRM_Mailing_Event_BAO_Opened::getMailingTotalCount(array_keys($mailings));
$clickCounts = CRM_Mailing_Event_BAO_TrackableURLOpen::getMailingTotalCount(array_keys($mailings));
}
// format params and add links
$contactMailings = array();
foreach ($mailings as $mailingId => $values) {
$contactMailings[$mailingId]['subject'] = $values['subject'];
$contactMailings[$mailingId]['start_date'] = CRM_Utils_Date::customFormat($values['start_date']);
$contactMailings[$mailingId]['recipients'] = CRM_Utils_System::href(ts('(recipients)'), 'civicrm/mailing/report/event', "mid={$values['mailing_id']}&reset=1&cid={$params['contact_id']}&event=queue&context=mailing");
$contactMailings[$mailingId]['mailing_creator'] = CRM_Utils_System::href($values['creator_name'], 'civicrm/contact/view', "reset=1&cid={$values['creator_id']}");
//CRM-12814
$contactMailings[$mailingId]['openstats'] = ts('Opens') . ': ' . $openCounts[$values['mailing_id']] . '<br />' . ts('Clicks') . ': ' . $clickCounts[$values['mailing_id']];
$actionLinks = array(CRM_Core_Action::VIEW => array('name' => ts('View'), 'url' => 'civicrm/mailing/view', 'qs' => "reset=1&id={$values['mailing_id']}", 'title' => ts('View Mailing'), 'class' => 'crm-mailing-view'), CRM_Core_Action::BROWSE => array('name' => ts('Mailing Report'), 'url' => 'civicrm/mailing/report', 'qs' => "mid={$values['mailing_id']}&reset=1&cid={$params['contact_id']}&context=mailing", 'title' => ts('View Mailing Report')));
$contactMailings[$mailingId]['links'] = CRM_Core_Action::formLink($actionLinks, NULL, array());
}
return $contactMailings;
}