本文整理汇总了PHP中CRM_Core_DAO::getSortString方法的典型用法代码示例。如果您正苦于以下问题:PHP CRM_Core_DAO::getSortString方法的具体用法?PHP CRM_Core_DAO::getSortString怎么用?PHP CRM_Core_DAO::getSortString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CRM_Core_DAO
的用法示例。
在下文中一共展示了CRM_Core_DAO::getSortString方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: crm_contact_search
/**
* 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);
}
示例2: str_replace
/**
* 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;
}