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


PHP CRM_Event_BAO_Event::whereAdd方法代码示例

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


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

示例1: civicrm_event_search

/**
 * Get Event record.
 * 
 *
 * @param  array  $params     an associative array of name/value property values of civicrm_event
 *
 * @return  Array of all found event property values.
 * @access public
 */
function civicrm_event_search(&$params)
{
    if (!is_array($params)) {
        return civicrm_create_error(ts('Input parameters is not an array.'));
    }
    $inputParams = array();
    $returnProperties = array();
    $returnCustomProperties = array();
    $otherVars = array('sort', 'offset', 'rowCount');
    $sort = false;
    // don't check if empty, more meaningful error for API user instead of siletn defaults
    $offset = array_key_exists('return.offset', $params) ? $params['return.offset'] : 0;
    $rowCount = array_key_exists('return.max_results', $params) ? $params['return.max_results'] : 25;
    foreach ($params as $n => $v) {
        if (substr($n, 0, 7) == 'return.') {
            if (substr($n, 0, 14) == 'return.custom_') {
                //take custom return properties separate
                $returnCustomProperties[] = substr($n, 7);
            } elseif (!in_array(substr($n, 7), array('offset', 'max_results'))) {
                $returnProperties[] = substr($n, 7);
            }
        } elseif (in_array($n, $otherVars)) {
            ${$n} = $v;
        } else {
            $inputParams[$n] = $v;
        }
    }
    if (!empty($returnProperties)) {
        $returnProperties[] = 'id';
        $returnProperties[] = 'event_type_id';
    }
    require_once 'CRM/Core/BAO/CustomGroup.php';
    require_once 'CRM/Event/BAO/Event.php';
    $eventDAO = new CRM_Event_BAO_Event();
    $eventDAO->copyValues($inputParams);
    $event = array();
    if (!empty($returnProperties)) {
        $eventDAO->selectAdd();
        $eventDAO->selectAdd(implode(',', $returnProperties));
    }
    $eventDAO->whereAdd('( is_template IS NULL ) OR ( is_template = 0 )');
    $eventDAO->orderBy($sort);
    $eventDAO->limit((int) $offset, (int) $rowCount);
    $eventDAO->find();
    while ($eventDAO->fetch()) {
        $event[$eventDAO->id] = array();
        CRM_Core_DAO::storeValues($eventDAO, $event[$eventDAO->id]);
        $groupTree =& CRM_Core_BAO_CustomGroup::getTree('Event', CRM_Core_DAO::$_nullObject, $eventDAO->id, false, $eventDAO->event_type_id);
        $groupTree = CRM_Core_BAO_CustomGroup::formatGroupTree($groupTree, 1, CRM_Core_DAO::$_nullObject);
        $defaults = array();
        CRM_Core_BAO_CustomGroup::setDefaults($groupTree, $defaults);
        if (!empty($defaults)) {
            foreach ($defaults as $key => $val) {
                if (!empty($returnCustomProperties)) {
                    $customKey = explode('_', $key);
                    //show only return properties
                    if (in_array('custom_' . $customKey['1'], $returnCustomProperties)) {
                        $event[$eventDAO->id][$key] = $val;
                    }
                } else {
                    $event[$eventDAO->id][$key] = $val;
                }
            }
        }
    }
    //end of the loop
    $eventDAO->free();
    return $event;
}
开发者ID:hampelm,项目名称:Ginsberg-CiviDemo,代码行数:78,代码来源:Event.php


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