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


PHP CRM_Activity_BAO_Activity::getActivities方法代码示例

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


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

示例1: 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

示例2: 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

示例3: array

 /**
  * returns all the rows in the given offset and rowCount
  *
  * @param enum   $action   the action being performed
  * @param int    $offset   the row number to start from
  * @param int    $rowCount the number of rows to return
  * @param string $sort     the sql string that describes the sort order
  * @param enum   $output   what should the result set include (web/email/csv)
  *
  * @return int   the total number of rows for this action
  */
 function &getRows($action, $offset, $rowCount, $sort, $output = null, $case = null)
 {
     $params['contact_id'] = $this->_contactId;
     $config = CRM_Core_Config::singleton();
     $rows =& CRM_Activity_BAO_Activity::getActivities($params, $offset, $rowCount, $sort, $this->_admin, $case, $this->_context);
     if (empty($rows)) {
         return $rows;
     }
     $activityStatus = CRM_Core_PseudoConstant::activityStatus();
     //CRM-4418
     $permissions = array($this->_permission);
     if (CRM_Core_Permission::check('delete activities')) {
         $permissions[] = CRM_Core_Permission::DELETE;
     }
     $mask = CRM_Core_Action::mask($permissions);
     foreach ($rows as $k => $row) {
         $row =& $rows[$k];
         // DRAFTING: provide a facility for db-stored strings
         // localize the built-in activity names for display
         // (these are not enums, so we can't use any automagic here)
         switch ($row['activity_type']) {
             case 'Meeting':
                 $row['activity_type'] = ts('Meeting');
                 break;
             case 'Phone Call':
                 $row['activity_type'] = ts('Phone Call');
                 break;
             case 'Email':
                 $row['activity_type'] = ts('Email');
                 break;
             case 'SMS':
                 $row['activity_type'] = ts('SMS');
                 break;
             case 'Event':
                 $row['activity_type'] = ts('Event');
                 break;
         }
         // add class to this row if overdue
         if (CRM_Utils_Date::overdue(CRM_Utils_Array::value('activity_date_time', $row)) && CRM_Utils_Array::value('status_id', $row) == 1) {
             $row['overdue'] = 1;
             $row['class'] = 'status-overdue';
         } else {
             $row['overdue'] = 0;
             $row['class'] = 'status-ontime';
         }
         $row['status'] = $row['status_id'] ? $activityStatus[$row['status_id']] : null;
         //CRM-3553
         $accessMailingReport = false;
         if (CRM_Utils_Array::value('mailingId', $row)) {
             $accessMailingReport = true;
         }
         $actionLinks = $this->actionLinks(CRM_Utils_Array::value('activity_type_id', $row), CRM_Utils_Array::value('source_record_id', $row), $accessMailingReport, CRM_Utils_Array::value('activity_id', $row), $this->_key);
         $actionMask = array_sum(array_keys($actionLinks)) & $mask;
         if ($output != CRM_Core_Selector_Controller::EXPORT && $output != CRM_Core_Selector_Controller::SCREEN) {
             $row['action'] = CRM_Core_Action::formLink($actionLinks, $actionMask, array('id' => $row['activity_id'], 'cid' => $this->_contactId, 'cxt' => $this->_context, 'caseid' => CRM_Utils_Array::value('case_id', $row)));
         }
         unset($row);
     }
     return $rows;
 }
开发者ID:hampelm,项目名称:Ginsberg-CiviDemo,代码行数:71,代码来源:Activity.php

示例4: testGetActivitiesforContactSummaryWithNoActivities

 /**
  * Test getActivities BAO method.
  */
 public function testGetActivitiesforContactSummaryWithNoActivities()
 {
     $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);
     $activities = CRM_Activity_BAO_Activity::getActivities($params);
     //since we are loading activities from dataset, we know total number of activities for this contact
     // This contact does not have any activities
     $this->assertEquals(0, count($activities));
 }
开发者ID:FundingWorks,项目名称:civicrm-core,代码行数:13,代码来源:ActivityTest.php

示例5: testGetActivitiesforContactSummaryWithNoActivities

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


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