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


PHP CRM_Activity_BAO_Activity::getActivitiesCount方法代码示例

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


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

示例1: getContactActivitySelector

 /**
  * 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 getContactActivitySelector(&$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;
     $context = CRM_Utils_Array::value('context', $params);
     // get contact activities
     $activities = CRM_Activity_BAO_Activity::getActivities($params);
     // add total
     $params['total'] = CRM_Activity_BAO_Activity::getActivitiesCount($params);
     // format params and add links
     $contactActivities = array();
     if (!empty($activities)) {
         $activityStatus = CRM_Core_PseudoConstant::activityStatus();
         // check logged in user for permission
         $page = new CRM_Core_Page();
         CRM_Contact_Page_View::checkUserPermission($page, $params['contact_id']);
         $permissions = array($page->_permission);
         if (CRM_Core_Permission::check('delete activities')) {
             $permissions[] = CRM_Core_Permission::DELETE;
         }
         $mask = CRM_Core_Action::mask($permissions);
         foreach ($activities as $activityId => $values) {
             $contactActivities[$activityId]['activity_type'] = $values['activity_type'];
             $contactActivities[$activityId]['subject'] = $values['subject'];
             if ($params['contact_id'] == $values['source_contact_id']) {
                 $contactActivities[$activityId]['source_contact'] = $values['source_contact_name'];
             } elseif ($values['source_contact_id']) {
                 $contactActivities[$activityId]['source_contact'] = CRM_Utils_System::href($values['source_contact_name'], 'civicrm/contact/view', "reset=1&cid={$values['source_contact_id']}");
             } else {
                 $contactActivities[$activityId]['source_contact'] = '<em>n/a</em>';
             }
             if (isset($values['mailingId']) && !empty($values['mailingId'])) {
                 $contactActivities[$activityId]['target_contact'] = CRM_Utils_System::href($values['recipients'], 'civicrm/mailing/report/event', "mid={$values['source_record_id']}&reset=1&event=queue&cid={$params['contact_id']}&context=activitySelector");
             } elseif (CRM_Utils_Array::value('recipients', $values)) {
                 $contactActivities[$activityId]['target_contact'] = $values['recipients'];
             } elseif (!$values['target_contact_name']) {
                 $contactActivities[$activityId]['target_contact'] = '<em>n/a</em>';
             } elseif (!empty($values['target_contact_name'])) {
                 $count = 0;
                 $contactActivities[$activityId]['target_contact'] = '';
                 foreach ($values['target_contact_name'] as $tcID => $tcName) {
                     if ($tcID && $count < 5) {
                         $contactActivities[$activityId]['target_contact'] .= CRM_Utils_System::href($tcName, 'civicrm/contact/view', "reset=1&cid={$tcID}");
                         $count++;
                         if ($count) {
                             $contactActivities[$activityId]['target_contact'] .= ";&nbsp;";
                         }
                         if ($count == 4) {
                             $contactActivities[$activityId]['target_contact'] .= "(" . ts('more') . ")";
                             break;
                         }
                     }
                 }
             }
             if (empty($values['assignee_contact_name'])) {
                 $contactActivities[$activityId]['assignee_contact'] = '<em>n/a</em>';
             } elseif (!empty($values['assignee_contact_name'])) {
                 $count = 0;
                 $contactActivities[$activityId]['assignee_contact'] = '';
                 foreach ($values['assignee_contact_name'] as $acID => $acName) {
                     if ($acID && $count < 5) {
                         $contactActivities[$activityId]['assignee_contact'] .= CRM_Utils_System::href($acName, 'civicrm/contact/view', "reset=1&cid={$acID}");
                         $count++;
                         if ($count) {
                             $contactActivities[$activityId]['assignee_contact'] .= ";&nbsp;";
                         }
                         if ($count == 4) {
                             $contactActivities[$activityId]['assignee_contact'] .= "(" . ts('more') . ")";
                             break;
                         }
                     }
                 }
             }
             $contactActivities[$activityId]['activity_date'] = CRM_Utils_Date::customFormat($values['activity_date_time']);
             $contactActivities[$activityId]['status'] = $activityStatus[$values['status_id']];
             // add class to this row if overdue
             $contactActivities[$activityId]['class'] = '';
             if (CRM_Utils_Date::overdue(CRM_Utils_Array::value('activity_date_time', $values)) && CRM_Utils_Array::value('status_id', $values) == 1) {
                 $contactActivities[$activityId]['class'] = 'status-overdue';
             } else {
                 $contactActivities[$activityId]['class'] = 'status-ontime';
             }
             // build links
             $contactActivities[$activityId]['links'] = '';
             $accessMailingReport = FALSE;
             if (CRM_Utils_Array::value('mailingId', $values)) {
                 $accessMailingReport = TRUE;
             }
             $actionLinks = CRM_Activity_Selector_Activity::actionLinks(CRM_Utils_Array::value('activity_type_id', $values), CRM_Utils_Array::value('source_record_id', $values), $accessMailingReport, CRM_Utils_Array::value('activity_id', $values));
//.........这里部分代码省略.........
开发者ID:hguru,项目名称:224Civi,代码行数:101,代码来源:Activity.php

示例2: getContactActivitySelector

 /**
  * Wrapper for ajax activity selector.
  *
  * @param array $params
  *   Associated array for params record id.
  *
  * @return array
  *   Associated array of contact activities
  */
 public static function getContactActivitySelector(&$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;
     $context = CRM_Utils_Array::value('context', $params);
     // Get contact activities.
     $activities = CRM_Activity_BAO_Activity::getActivities($params);
     // Add total.
     $params['total'] = CRM_Activity_BAO_Activity::getActivitiesCount($params);
     // Format params and add links.
     $contactActivities = array();
     if (!empty($activities)) {
         $activityStatus = CRM_Core_PseudoConstant::activityStatus();
         // Check logged in user for permission.
         $page = new CRM_Core_Page();
         CRM_Contact_Page_View::checkUserPermission($page, $params['contact_id']);
         $permissions = array($page->_permission);
         if (CRM_Core_Permission::check('delete activities')) {
             $permissions[] = CRM_Core_Permission::DELETE;
         }
         $mask = CRM_Core_Action::mask($permissions);
         foreach ($activities as $activityId => $values) {
             $activity = array();
             $activity['DT_RowId'] = $activityId;
             // Add class to this row if overdue.
             $activity['DT_RowClass'] = 'crm-entity';
             if (CRM_Utils_Date::overdue(CRM_Utils_Array::value('activity_date_time', $values)) && CRM_Utils_Array::value('status_id', $values) == 1) {
                 $activity['DT_RowClass'] .= ' status-overdue';
             } else {
                 $activity['DT_RowClass'] .= ' status-ontime';
             }
             $activity['DT_RowAttr'] = array();
             $activity['DT_RowAttr']['data-entity'] = 'activity';
             $activity['DT_RowAttr']['data-id'] = $activityId;
             $activity['activity_type'] = $values['activity_type'];
             $activity['subject'] = $values['subject'];
             $activity['source_contact_name'] = '';
             if ($params['contact_id'] == $values['source_contact_id']) {
                 $activity['source_contact_name'] = $values['source_contact_name'];
             } elseif ($values['source_contact_id']) {
                 $activity['source_contact_name'] = CRM_Utils_System::href($values['source_contact_name'], 'civicrm/contact/view', "reset=1&cid={$values['source_contact_id']}");
             } else {
                 $activity['source_contact_name'] = '<em>n/a</em>';
             }
             $activity['target_contact_name'] = '';
             if (isset($values['mailingId']) && !empty($values['mailingId'])) {
                 $activity['target_contact'] = CRM_Utils_System::href($values['recipients'], 'civicrm/mailing/report/event', "mid={$values['source_record_id']}&reset=1&event=queue&cid={$params['contact_id']}&context=activitySelector");
             } elseif (!empty($values['recipients'])) {
                 $activity['target_contact_name'] = $values['recipients'];
             } elseif (isset($values['target_contact_counter']) && $values['target_contact_counter']) {
                 $activity['target_contact_name'] = '';
                 foreach ($values['target_contact_name'] as $tcID => $tcName) {
                     $activity['target_contact_name'] .= CRM_Utils_System::href($tcName, 'civicrm/contact/view', "reset=1&cid={$tcID}");
                 }
                 if ($extraCount = $values['target_contact_counter'] - 1) {
                     $activity['target_contact_name'] .= ";<br />" . "(" . ts('%1 more', array(1 => $extraCount)) . ")";
                 }
             } elseif (!$values['target_contact_name']) {
                 $activity['target_contact_name'] = '<em>n/a</em>';
             }
             $activity['assignee_contact_name'] = '';
             if (empty($values['assignee_contact_name'])) {
                 $activity['assignee_contact_name'] = '<em>n/a</em>';
             } elseif (!empty($values['assignee_contact_name'])) {
                 $count = 0;
                 $activity['assignee_contact_name'] = '';
                 foreach ($values['assignee_contact_name'] as $acID => $acName) {
                     if ($acID && $count < 5) {
                         $activity['assignee_contact_name'] .= CRM_Utils_System::href($acName, 'civicrm/contact/view', "reset=1&cid={$acID}");
                         $count++;
                         if ($count) {
                             $activity['assignee_contact_name'] .= ";&nbsp;";
                         }
                         if ($count == 4) {
                             $activity['assignee_contact_name'] .= "(" . ts('more') . ")";
                             break;
                         }
                     }
                 }
             }
             $activity['activity_date_time'] = CRM_Utils_Date::customFormat($values['activity_date_time']);
             $activity['status_id'] = $activityStatus[$values['status_id']];
             // build links
             $activity['links'] = '';
             $accessMailingReport = FALSE;
             if (!empty($values['mailingId'])) {
                 $accessMailingReport = TRUE;
             }
//.........这里部分代码省略.........
开发者ID:saurabhbatra96,项目名称:civicrm-core,代码行数:101,代码来源:Activity.php

示例3: testGetActivitiesCountforContactSummaryWithNoActivities

 /**
  * Test getActivitiesCount BAO method.
  */
 public function testGetActivitiesCountforContactSummaryWithNoActivities()
 {
     $op = new PHPUnit_Extensions_Database_Operation_Insert();
     $op->execute($this->_dbconn, $this->createFlatXMLDataSet(dirname(__FILE__) . '/activities_for_dashboard_count.xml'));
     $params = array('contact_id' => 17, 'admin' => FALSE, 'caseId' => NULL, 'context' => 'home', 'activity_type_id' => NULL, 'offset' => 0, 'rowCount' => 0, 'sort' => NULL);
     $activityCount = CRM_Activity_BAO_Activity::getActivitiesCount($params);
     //since we are loading activities from dataset, we know total number of activities for this contact
     // this contact does not have any activity
     $this->assertEquals(0, $activityCount);
 }
开发者ID:FundingWorks,项目名称:civicrm-core,代码行数:13,代码来源:ActivityTest.php

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

示例5: getTotalCount

 /**
  * Returns total number of rows for the query.
  *
  * @param string $action - action being performed
  * @return int Total number of rows 
  * @access public
  */
 function getTotalCount($action, $case = null)
 {
     require_once 'CRM/Activity/BAO/Activity.php';
     return CRM_Activity_BAO_Activity::getActivitiesCount($this->_contactId, $this->_admin, $case, $this->_context);
 }
开发者ID:hampelm,项目名称:Ginsberg-CiviDemo,代码行数:12,代码来源:Activity.php

示例6: getTotalCount

 /**
  * Returns total number of rows for the query.
  *
  * @param string $action
  *   Action being performed.
  *
  * @param null $case
  *
  * @return int
  *   Total number of rows
  */
 public function getTotalCount($action, $case = NULL)
 {
     $params = array('contact_id' => $this->_contactId, 'admin' => $this->_admin, 'caseId' => $case, 'context' => $this->_context, 'activity_type_id' => $this->_activityTypeIDs, 'offset' => 0, 'rowCount' => 0, 'sort' => NULL);
     return CRM_Activity_BAO_Activity::getActivitiesCount($params);
 }
开发者ID:kcristiano,项目名称:civicrm-core,代码行数:16,代码来源:Activity.php

示例7: getCountComponent

 /**
  * Given the component name and returns 
  * the count of participation of contact
  *
  * @param string $component input component name
  * @param integer $contactId input contact id
  *
  * @return total number of count of occurence in database
  * @access public
  * @static
  */
 static function getCountComponent($component, $contactId)
 {
     $object = null;
     switch ($component) {
         case 'tag':
             require_once 'CRM/Core/BAO/EntityTag.php';
             return count(CRM_Core_BAO_EntityTag::getTag($contactId));
         case 'rel':
             require_once 'CRM/Contact/BAO/Relationship.php';
             return count(CRM_Contact_BAO_Relationship::getRelationship($contactId));
         case 'group':
             require_once 'CRM/Contact/BAO/GroupContact.php';
             return CRM_Contact_BAO_GroupContact::getContactGroup($contactId, null, null, true);
         case 'log':
         case 'note':
             eval('$object =& new CRM_Core_DAO_' . $component . '( );');
             $object->entity_table = 'civicrm_contact';
             $object->entity_id = $contactId;
             $object->orderBy('modified_date desc');
             break;
         case 'contribution':
             require_once 'CRM/Contribute/BAO/Contribution.php';
             return CRM_Contribute_BAO_Contribution::contributionCount($contactId);
             break;
         case 'membership':
             require_once 'CRM/Member/DAO/Membership.php';
             eval('$object =& new CRM_Member_DAO_Membership( );');
             $object->contact_id = $contactId;
             $object->is_test = 0;
             break;
         case 'participant':
             require_once 'CRM/Event/DAO/Participant.php';
             eval('$object =& new CRM_Event_DAO_Participant( );');
             $object->contact_id = $contactId;
             $object->is_test = 0;
             break;
         case 'pledge':
             require_once 'CRM/Pledge/DAO/Pledge.php';
             eval('$object =& new CRM_Pledge_DAO_Pledge( );');
             $object->contact_id = $contactId;
             $object->is_test = 0;
             break;
         case 'case':
             require_once 'CRM/Case/BAO/Case.php';
             return CRM_Case_BAO_Case::caseCount($contactId);
         case 'grant':
             require_once 'CRM/Grant/DAO/Grant.php';
             eval('$object =& new CRM_Grant_DAO_Grant( );');
             $object->contact_id = $contactId;
             break;
         case 'activity':
             require_once 'CRM/Activity/BAO/Activity.php';
             return CRM_Activity_BAO_Activity::getActivitiesCount($contactId, false, null, null);
         default:
             $custom = explode('_', $component);
             if ($custom['0'] = 'custom') {
                 require_once 'CRM/Core/DAO/CustomGroup.php';
                 $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);
             }
     }
     $object->find();
     return $object->N;
 }
开发者ID:ksecor,项目名称:civicrm,代码行数:76,代码来源:Contact.php

示例8: getCountComponent

 /**
  * Given the component name and returns 
  * the count of participation of contact
  *
  * @param string  $component input component name
  * @param integer $contactId input contact id
  * @param string  $tableName optional tableName if component is custom group
  *
  * @return total number of count of occurence in database
  * @access public
  * @static
  */
 static function getCountComponent($component, $contactId, $tableName = null)
 {
     $object = null;
     switch ($component) {
         case 'tag':
             require_once 'CRM/Core/BAO/EntityTag.php';
             return CRM_Core_BAO_EntityTag::getContactTags($contactId, true);
         case 'rel':
             require_once 'CRM/Contact/BAO/Relationship.php';
             return count(CRM_Contact_BAO_Relationship::getRelationship($contactId));
         case 'group':
             require_once 'CRM/Contact/BAO/GroupContact.php';
             return CRM_Contact_BAO_GroupContact::getContactGroup($contactId, null, null, true);
         case 'log':
             require_once 'CRM/Core/BAO/Log.php';
             return CRM_Core_BAO_Log::getContactLogCount($contactId);
         case 'note':
             require_once 'CRM/Core/BAO/Note.php';
             return CRM_Core_BAO_Note::getContactNoteCount($contactId);
         case 'contribution':
             require_once 'CRM/Contribute/BAO/Contribution.php';
             return CRM_Contribute_BAO_Contribution::contributionCount($contactId);
         case 'membership':
             require_once 'CRM/Member/BAO/Membership.php';
             return CRM_Member_BAO_Membership::getContactMembershipCount($contactId);
         case 'participant':
             require_once 'CRM/Event/BAO/Participant.php';
             return CRM_Event_BAO_Participant::getContactParticipantCount($contactId);
         case 'pledge':
             require_once 'CRM/Pledge/BAO/Pledge.php';
             return CRM_Pledge_BAO_Pledge::getContactPledgeCount($contactId);
         case 'case':
             require_once 'CRM/Case/BAO/Case.php';
             return CRM_Case_BAO_Case::caseCount($contactId);
         case 'grant':
             require_once 'CRM/Grant/BAO/Grant.php';
             return CRM_Grant_BAO_Grant::getContactGrantCount($contactId);
         case 'activity':
             require_once 'CRM/Activity/BAO/Activity.php';
             return CRM_Activity_BAO_Activity::getActivitiesCount($contactId, false, null, null);
         default:
             $custom = explode('_', $component);
             if ($custom['0'] = 'custom') {
                 require_once 'CRM/Core/DAO/CustomGroup.php';
                 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);
             }
     }
 }
开发者ID:bhirsch,项目名称:voipdev,代码行数:64,代码来源:Contact.php

示例9: testGetActivitiesCountforContactSummaryWithNoActivities

 /**
  * Function to test getActivitiesCount BAO method
  */
 function testGetActivitiesCountforContactSummaryWithNoActivities()
 {
     $op = new PHPUnit_Extensions_Database_Operation_Insert();
     $op->execute($this->_dbconn, new PHPUnit_Extensions_Database_DataSet_FlatXMLDataSet(dirname(__FILE__) . '/activities_for_dashboard_count.xml'));
     $contactID = 17;
     require_once 'CRM/Activity/BAO/Activity.php';
     $activityCount = CRM_Activity_BAO_Activity::getActivitiesCount($contactID);
     //since we are loading activities from dataset, we know total number of activities for this contact
     // this contact does not have any activity
     $this->assertEquals(0, $activityCount, 'In line ' . __LINE__);
 }
开发者ID:ksecor,项目名称:civicrm,代码行数:14,代码来源:ActivityTest.php


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