本文整理汇总了PHP中CRM_Event_BAO_Event::fetch方法的典型用法代码示例。如果您正苦于以下问题:PHP CRM_Event_BAO_Event::fetch方法的具体用法?PHP CRM_Event_BAO_Event::fetch怎么用?PHP CRM_Event_BAO_Event::fetch使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CRM_Event_BAO_Event
的用法示例。
在下文中一共展示了CRM_Event_BAO_Event::fetch方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: preProcess
function preProcess()
{
parent::preProcess();
$matches = array();
preg_match("/.*_(\\d+)_(\\d+)/", $this->getAttribute('name'), $matches);
$event_id = $matches[1];
$participant_id = $matches[2];
$event_in_cart = $this->cart->get_event_in_cart_by_event_id($event_id);
$this->conference_event = $event_in_cart->event;
$this->main_participant = $event_in_cart->get_participant_by_id($participant_id);
$this->contact_id = $this->main_participant->contact_id;
$this->main_participant->display_name = CRM_Contact_BAO_Contact::displayName($this->contact_id);
$events = new CRM_Event_BAO_Event();
$query = <<<EOS
\t SELECT
civicrm_event.*,
slot.label AS slot_label
FROM
civicrm_event
JOIN
civicrm_option_value slot ON civicrm_event.slot_label_id = slot.value
JOIN
civicrm_option_group og ON slot.option_group_id = og.id
\t WHERE
\t\tparent_event_id = {$this->conference_event->id}
AND civicrm_event.is_active = 1
AND COALESCE(civicrm_event.is_template, 0) = 0
AND og.name = 'conference_slot'
\t ORDER BY
\t\tslot.weight, start_date
EOS;
$events->query($query);
while ($events->fetch()) {
if (!array_key_exists($events->slot_label, $this->events_by_slot)) {
$this->events_by_slot[$events->slot_label] = array();
}
$this->events_by_slot[$events->slot_label][] = clone $events;
}
}
示例2: crm_get_event
/**
* Get an Event.
*
* This api is used to retrieve all data for an existing Event.
* Required parameters : id of event
*
* @param array $params an associative array of title/value property values of civicrm_event
*
* @return If successful array of event data; otherwise object of CRM_Core_Error.
* @access public
*/
function crm_get_event($params)
{
_crm_initialize();
if (!is_array($params)) {
return _crm_error('Params is not an array.');
}
if (!isset($params['id'])) {
return _crm_error('Required id (event ID) parameter is missing.');
}
$event = array();
require_once 'CRM/Event/BAO/Event.php';
$eventBAO = new CRM_Event_BAO_Event();
$eventBAO->copyValues($params);
$eventBAO->find();
while ($eventBAO->fetch()) {
$event = array();
_crm_object_to_array(clone $eventBAO, $event);
$event[$eventBAO->id] = $event;
}
return $event;
}
示例3: 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';
}
$returnProperties[] = 'is_template';
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->orderBy($sort);
$eventDAO->limit((int) $offset, (int) $rowCount);
$eventDAO->find();
while ($eventDAO->fetch()) {
// ignore event templates
// ideally need to put this in the query, but not sure how to do this with the below
// ( ( is_template IS NULL ) OR ( is_template = 0 ) )
// hence doing this here for now, please fix on a future rewrite
if ($eventDAO->is_template) {
continue;
}
$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;
}
示例4: 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', 'isCurrent');
$sort = array_key_exists('return.sort', $params) ? $params['return.sort'] : FALSE;
// don't check if empty, more meaningful error for API user instead of silent 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;
$isCurrent = array_key_exists('isCurrent', $params) ? $params['isCurrent'] : 0;
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('sort', '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 )');
if ($isCurrent) {
$eventDAO->whereAdd('(start_date >= CURDATE() || end_date >= CURDATE())');
}
$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;
}