/** * returns a number of contacts from the offset that match the criteria * specified in $params. return_properties are the values that are returned * to the calling function * * @param array $params * @param array $returnProperties * @param object|array $sort object or array describing sort order for sql query. * @param int $offset the row number to start from * @param int $rowCount the number of rows to return * * @return int * @access public */ function crm_contact_search(&$params, $return_properties = null, $sort = null, $offset = 0, $row_count = 25) { $sortString = CRM_Core_DAO::getSortString($sort); return CRM_Contact_BAO_Query::apiQuery($params, $return_properties, null, $sortString, $offset, $row_count); }
/** * function to get the list of history for an entity. * * @param array reference $params array of parameters * @param int $offset which row to start from ? * @param int $rowCount how many rows to fetch * @param object|array $sort object or array describing sort order for sql query. * @param type $type type of history we're interested in * * @return array (reference) $values the relevant data object values for history * * @access public * @static */ function &getHistory(&$params, $offset = null, $rowCount = null, $sort = null, $type = 'Activity') { require_once str_replace('_', DIRECTORY_SEPARATOR, 'CRM_Core_DAO_' . $type . 'History') . '.php'; eval('$historyDAO =& new CRM_Core_DAO_' . $type . 'History();'); // if null hence no search criteria if (!isset($params)) { $params = array(); } $historyDAO->copyValues($params); // sort order $historyDAO->orderBy(CRM_Core_DAO::getSortString($sort, 'activity_date desc, activity_type asc')); // how many rows to get ? $historyDAO->limit($offset, $rowCount); // fire query, get rows, populate array and return it please. $values = array(); $historyDAO->find(); while ($historyDAO->fetch()) { $values[$historyDAO->id] = array(); CRM_Core_DAO::storeValues($historyDAO, $values[$historyDAO->id]); } return $values; }