/** * 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) { $params['contact_id'] = $this->_contactId; $rows =& CRM_Contact_BAO_Contact::getOpenActivities($params, $offset, $rowCount, $sort, 'Activity'); foreach ($rows as $k => $row) { $row =& $rows[$k]; //check the if the activity type is meeting or phonecall if (is_numeric($row['activity_type'])) { if ($row['activity_type'] == 2) { $row['activity_type'] = ts('Phone Call'); } else { $row['activity_type'] = ts('Meeting'); } } $actionLinks =& CRM_Contact_Selector_Activity::actionLinks($row['activity_type_id']); $actionMask = array_sum(array_keys($actionLinks)) & CRM_Core_Action::mask($this->_permission); if ($output != CRM_CORE_SELECTOR_CONTROLLER_EXPORT && $output != CRM_CORE_SELECTOR_CONTROLLER_SCREEN) { // check if callback exists if (CRM_Utils_Array::value('callback', $row)) { $row['action'] = CRM_Core_Action::formLink($actionLinks, $actionMask, array('activity_history_id' => $k, 'callback' => $row['callback'], 'module' => $row['module'], 'activity_id' => $row['activity_id'], 'cid' => $this->_contactId)); } else { $row['action'] = CRM_Core_Action::formLink($actionLinks, $actionMask, array('id' => $row['id'], 'cid' => $this->_contactId)); } } unset($row); } return $rows; }
/** * Takes a bunch of params that are needed to match certain criteria and * retrieves the relevant objects. Typically the valid params are only * contact_id. We'll tweak this function to be more full featured over a period * of time. This is the inverse function of create. It also stores all the retrieved * values in the default array * * @param array $params (reference ) an assoc array of name/value pairs * @param array $defaults (reference ) an assoc array to hold the name / value pairs * in a hierarchical manner * @param array $ids (reference) the array that holds all the db ids * * @return object CRM_Contact_BAO_Contact object * @access public * @static */ function retrieve(&$params, &$defaults, &$ids) { $contact = CRM_Contact_BAO_Contact::getValues($params, $defaults, $ids); unset($params['id']); require_once str_replace('_', DIRECTORY_SEPARATOR, "CRM_Contact_BAO_" . $contact->contact_type) . ".php"; eval('$contact->contact_type_object =& CRM_Contact_BAO_' . $contact->contact_type . '::getValues( $params, $defaults, $ids );'); $locParams = $params + array('entity_id' => $params['contact_id'], 'entity_table' => CRM_Contact_BAO_Contact::getTableName()); $contact->location =& CRM_Core_BAO_Location::getValues($locParams, $defaults, $ids, 3); $contact->notes =& CRM_Core_BAO_Note::getValues($params, $defaults, $ids); $contact->relationship =& CRM_Contact_BAO_Relationship::getValues($params, $defaults, $ids); $contact->groupContact =& CRM_Contact_BAO_GroupContact::getValues($params, $defaults, $ids); $activityParam = array('entity_id' => $params['contact_id']); $contact->activity =& CRM_Core_BAO_History::getValues($activityParam, $defaults, 'Activity'); $activityParam = array('contact_id' => $params['contact_id']); $defaults['openActivity'] = array('data' => CRM_Contact_BAO_Contact::getOpenActivities($activityParam, 0, 3), 'totalCount' => CRM_Contact_BAO_Contact::getNumOpenActivity($params['contact_id'])); return $contact; }