本文整理汇总了PHP中_civicrm_api3_dao_set_filter函数的典型用法代码示例。如果您正苦于以下问题:PHP _civicrm_api3_dao_set_filter函数的具体用法?PHP _civicrm_api3_dao_set_filter怎么用?PHP _civicrm_api3_dao_set_filter使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了_civicrm_api3_dao_set_filter函数的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: civicrm_api3_dashboard_get
/**
* Gets a CiviCRM Dashlets according to parameters.
*
* @param array $params
*
* @return array
*/
function civicrm_api3_dashboard_get($params)
{
$bao = new CRM_Core_BAO_Dashboard();
_civicrm_api3_dao_set_filter($bao, $params, TRUE);
$dashlets = _civicrm_api3_dao_to_array($bao, $params, TRUE, 'Dashboard');
return civicrm_api3_create_success($dashlets, $params, 'Dashboard', 'get', $bao);
}
示例2: civicrm_api3_domain_get
/**
* Get CiviCRM domain details
* {@getfields domain_create}
* @example DomainGet.php
*/
function civicrm_api3_domain_get($params)
{
$params['version'] = CRM_Utils_Array::value('domain_version', $params);
unset($params['version']);
$bao = new CRM_Core_BAO_Domain();
if (CRM_Utils_Array::value('current_domain', $params)) {
$domainBAO = CRM_Core_Config::domainID();
$params['id'] = $domainBAO;
}
_civicrm_api3_dao_set_filter($bao, $params, true, 'domain');
$domains = _civicrm_api3_dao_to_array($bao, $params, true, 'domain');
foreach ($domains as $domain) {
if (!empty($domain['contact_id'])) {
$values = array();
$locparams = array('contact_id' => $domain['contact_id']);
$values['location'] = CRM_Core_BAO_Location::getValues($locparams, TRUE);
$address_array = array('street_address', 'supplemental_address_1', 'supplemental_address_2', 'city', 'state_province_id', 'postal_code', 'country_id', 'geo_code_1', 'geo_code_2');
if (!empty($values['location']['email'])) {
$domain['domain_email'] = CRM_Utils_Array::value('email', $values['location']['email'][1]);
}
if (!empty($values['location']['phone'])) {
$domain['domain_phone'] = array('phone_type' => CRM_Core_PseudoConstant::getLabel('CRM_Core_BAO_Phone', 'phone_type_id', CRM_Utils_Array::value('phone_type_id', $values['location']['phone'][1])), 'phone' => CRM_Utils_Array::value('phone', $values['location']['phone'][1]));
}
if (!empty($values['location']['address'])) {
foreach ($address_array as $value) {
$domain['domain_address'][$value] = CRM_Utils_Array::value($value, $values['location']['address'][1]);
}
}
list($domain['from_name'], $domain['from_email']) = CRM_Core_BAO_Domain::getNameAndEmail(TRUE);
$domains[$domain['id']] = array_merge($domains[$domain['id']], $domain);
}
}
return civicrm_api3_create_success($domains, $params, 'domain', 'get', $bao);
}
示例3: civicrm_api3_action_schedule_get
/**
* Get CiviCRM Action Schedule details
* {@getfields action_schedule_create}
*
*/
function civicrm_api3_action_schedule_get($params)
{
$bao = new CRM_Core_BAO_ActionSchedule();
_civicrm_api3_dao_set_filter($bao, $params, true, 'ActionSchedule');
$actionSchedules = _civicrm_api3_dao_to_array($bao, $params, true, 'ActionSchedule');
return civicrm_api3_create_success($actionSchedules, $params, 'action_schedule', 'get', $bao);
}
示例4: civicrm_api3_word_replacement_get
/**
* Get CiviCRM Word Replacement details
* {@getfields word_replacement_create}
*
*/
function civicrm_api3_word_replacement_get($params)
{
$bao = new CRM_Core_BAO_WordReplacement();
_civicrm_api3_dao_set_filter($bao, $params, true, 'WordReplacement');
$wordReplacements = _civicrm_api3_dao_to_array($bao, $params, true, 'WordReplacement');
return civicrm_api3_create_success($wordReplacements, $params, 'word_replacement', 'get', $bao);
}
示例5: civicrm_api3_word_replacement_get
/**
* Get CiviCRM Word Replacement details.
*
* @param array $params
*
* @return array
* @throws \API_Exception
*/
function civicrm_api3_word_replacement_get($params)
{
// NEVER COPY THIS. No idea why a newish api would not use basic_get.
$bao = new CRM_Core_BAO_WordReplacement();
_civicrm_api3_dao_set_filter($bao, $params, TRUE);
$wordReplacements = _civicrm_api3_dao_to_array($bao, $params, TRUE, 'WordReplacement');
return civicrm_api3_create_success($wordReplacements, $params, 'WordReplacement', 'get', $bao);
}
示例6: buildRecipientContacts
/**
* @param $mappingID
* @param $now
* @param array $params
*
* @throws API_Exception
*/
static function buildRecipientContacts($mappingID, $now, $params = array())
{
$actionSchedule = new CRM_Core_DAO_ActionSchedule();
$actionSchedule->mapping_id = $mappingID;
$actionSchedule->is_active = 1;
if (!empty($params)) {
_civicrm_api3_dao_set_filter($actionSchedule, $params, FALSE, 'ActionSchedule');
}
$actionSchedule->find();
while ($actionSchedule->fetch()) {
$mapping = new CRM_Core_DAO_ActionMapping();
$mapping->id = $mappingID;
$mapping->find(TRUE);
// note: $where - this filtering applies for both
// 'limit to' and 'addition to' options
// $limitWhere - this filtering applies only for
// 'limit to' option
$select = $join = $where = $limitWhere = array();
$limitTo = $actionSchedule->limit_to;
$value = explode(CRM_Core_DAO::VALUE_SEPARATOR, trim($actionSchedule->entity_value, CRM_Core_DAO::VALUE_SEPARATOR));
$value = implode(',', $value);
$status = explode(CRM_Core_DAO::VALUE_SEPARATOR, trim($actionSchedule->entity_status, CRM_Core_DAO::VALUE_SEPARATOR));
$status = implode(',', $status);
$anniversary = false;
if (!CRM_Utils_System::isNull($mapping->entity_recipient)) {
$recipientOptions = CRM_Core_OptionGroup::values($mapping->entity_recipient, FALSE, FALSE, FALSE, NULL, 'name');
}
$from = "{$mapping->entity} e";
if ($mapping->entity == 'civicrm_activity') {
$contactField = 'r.contact_id';
$table = 'civicrm_activity e';
$activityContacts = CRM_Core_OptionGroup::values('activity_contacts', FALSE, FALSE, FALSE, NULL, 'name');
$sourceID = CRM_Utils_Array::key('Activity Source', $activityContacts);
$assigneeID = CRM_Utils_Array::key('Activity Assignees', $activityContacts);
$targetID = CRM_Utils_Array::key('Activity Targets', $activityContacts);
if ($limitTo == 0) {
// including the activity target contacts if 'in addition' is defined
$join[] = "INNER JOIN civicrm_activity_contact r ON r.activity_id = e.id AND record_type_id = {$targetID}";
} else {
switch (CRM_Utils_Array::value($actionSchedule->recipient, $recipientOptions)) {
case 'Activity Assignees':
$join[] = "INNER JOIN civicrm_activity_contact r ON r.activity_id = e.id AND record_type_id = {$assigneeID}";
break;
case 'Activity Source':
$join[] = "INNER JOIN civicrm_activity_contact r ON r.activity_id = e.id AND record_type_id = {$sourceID}";
break;
default:
case 'Activity Targets':
$join[] = "INNER JOIN civicrm_activity_contact r ON r.activity_id = e.id AND record_type_id = {$targetID}";
break;
}
}
// build where clause
if (!empty($value)) {
$where[] = "e.activity_type_id IN ({$value})";
} else {
$where[] = "e.activity_type_id IS NULL";
}
if (!empty($status)) {
$where[] = "e.status_id IN ({$status})";
}
$where[] = ' e.is_current_revision = 1 ';
$where[] = ' e.is_deleted = 0 ';
$dateField = 'e.activity_date_time';
}
if ($mapping->entity == 'civicrm_participant') {
$table = 'civicrm_event r';
$contactField = 'e.contact_id';
$join[] = 'INNER JOIN civicrm_event r ON e.event_id = r.id';
if ($actionSchedule->recipient_listing && $limitTo) {
$rList = explode(CRM_Core_DAO::VALUE_SEPARATOR, trim($actionSchedule->recipient_listing, CRM_Core_DAO::VALUE_SEPARATOR));
$rList = implode(',', $rList);
switch ($recipientOptions[$actionSchedule->recipient]) {
case 'participant_role':
$where[] = "e.role_id IN ({$rList})";
break;
default:
break;
}
}
// build where clause
if (!empty($value)) {
$where[] = $mapping->entity_value == 'event_type' ? "r.event_type_id IN ({$value})" : "r.id IN ({$value})";
} else {
$where[] = $mapping->entity_value == 'event_type' ? "r.event_type_id IS NULL" : "r.id IS NULL";
}
// participant status criteria not to be implemented
// for additional recipients
if (!empty($status)) {
$limitWhere[] = "e.status_id IN ({$status})";
}
$where[] = 'r.is_active = 1';
$where[] = 'r.is_template = 0';
//.........这里部分代码省略.........
示例7: _civicrm_hrjobcontract_api3_custom_get
/**
* Function to do a 'custom' api get
*
* @param string $bao_name name of BAO
* @param array $params params from api
* @param bool $returnAsSuccess return in api success format
* @param string $entity
*
* @return array
*/
function _civicrm_hrjobcontract_api3_custom_get($bao_name, &$params, $returnAsSuccess = TRUE, $entity = "")
{
$bao = new $bao_name();
$callbacks = array();
$fields = $bao::fields();
foreach ($fields as $field) {
if (!empty($field['callback'])) {
$callback = $field['callback'];
if (CRM_Utils_System::validCallback($callback)) {
list($className, $fnName) = explode('::', $callback);
if (method_exists($className, $fnName)) {
$callbacks[$field['name']] = array('className' => $className, 'fnName' => $fnName);
}
}
}
}
_civicrm_api3_dao_set_filter($bao, $params, TRUE, $entity);
if ($returnAsSuccess) {
$daoToArray = _civicrm_api3_dao_to_array($bao, $params, FALSE, $entity);
if (!empty($callbacks)) {
foreach ($daoToArray as $entryKey => $entryValue) {
foreach ($callbacks as $callbackKey => $callbackValue) {
$daoToArray[$entryKey][$callbackKey] = call_user_func(array($callbackValue['className'], $callbackValue['fnName']), $entryValue[$callbackKey]);
}
}
}
return civicrm_api3_create_success($daoToArray, $params, $entity, 'get');
} else {
return _civicrm_api3_dao_to_array($bao, $params, FALSE, $entity, 'get');
}
}
示例8: civicrm_api3_event_get
/**
* Get Event record.
*
*
* @param array $params an associative array of name/value property values of civicrm_event
* {@getfields event_get}
*
* @return Array of all found event property values.
* @access public
*
*/
function civicrm_api3_event_get($params)
{
//legacy support for $params['return.sort']
if (!empty($params['return.sort'])) {
$params['options']['sort'] = $params['return.sort'];
unset($params['return.sort']);
}
//legacy support for $params['return.offset']
if (!empty($params['return.offset'])) {
$params['options']['offset'] = $params['return.offset'];
unset($params['return.offset']);
}
//legacy support for $params['return.max_results']
if (!empty($params['return.max_results'])) {
$params['options']['limit'] = $params['return.max_results'];
unset($params['return.max_results']);
}
$eventDAO = new CRM_Event_BAO_Event();
_civicrm_api3_dao_set_filter($eventDAO, $params, TRUE, 'Event');
if (!empty($params['is_template'])) {
$eventDAO->whereAdd('( is_template = 1 )');
} elseif (empty($eventDAO->id)) {
$eventDAO->whereAdd('( is_template IS NULL ) OR ( is_template = 0 )');
}
if (!empty($params['isCurrent'])) {
$eventDAO->whereAdd('(start_date >= CURDATE() || end_date >= CURDATE())');
}
// @todo should replace all this with _civicrm_api3_dao_to_array($bao, $params, FALSE, $entity) - but we still have
// the return.is_full to deal with.
// NB the std dao_to_array function should only return custom if required.
$event = array();
$eventDAO->find();
while ($eventDAO->fetch()) {
$event[$eventDAO->id] = array();
CRM_Core_DAO::storeValues($eventDAO, $event[$eventDAO->id]);
if (!empty($params['return.is_full'])) {
_civicrm_api3_event_getisfull($event, $eventDAO->id);
}
_civicrm_api3_event_get_legacy_support_42($event, $eventDAO->id);
_civicrm_api3_custom_data_get($event[$eventDAO->id], 'Event', $eventDAO->id, NULL, $eventDAO->event_type_id);
}
//end of the loop
return civicrm_api3_create_success($event, $params, 'event', 'get', $eventDAO);
}
示例9: _civicrm_api3_basic_get
/**
* Function to do a 'standard' api get - when the api is only doing a $bao->find then use this.
*
* @param string $bao_name
* Name of BAO.
* @param array $params
* Params from api.
* @param bool $returnAsSuccess
* Return in api success format.
* @param string $entity
*
* @return array
*/
function _civicrm_api3_basic_get($bao_name, &$params, $returnAsSuccess = TRUE, $entity = "")
{
$bao = new $bao_name();
_civicrm_api3_dao_set_filter($bao, $params, TRUE);
if ($returnAsSuccess) {
return civicrm_api3_create_success(_civicrm_api3_dao_to_array($bao, $params, FALSE, $entity), $params, $entity, 'get');
} else {
return _civicrm_api3_dao_to_array($bao, $params, FALSE, $entity, 'get');
}
}
示例10: buildRecipientContacts
/**
* @param int $mappingID
* @param $now
* @param array $params
*
* @throws API_Exception
*/
public static function buildRecipientContacts($mappingID, $now, $params = array())
{
$actionSchedule = new CRM_Core_DAO_ActionSchedule();
$actionSchedule->mapping_id = $mappingID;
$actionSchedule->is_active = 1;
if (!empty($params)) {
_civicrm_api3_dao_set_filter($actionSchedule, $params, FALSE);
}
$actionSchedule->find();
while ($actionSchedule->fetch()) {
/** @var \Civi\ActionSchedule\Mapping $mapping */
$mapping = CRM_Utils_Array::first(self::getMappings(array('id' => $mappingID)));
$builder = new \Civi\ActionSchedule\RecipientBuilder($now, $actionSchedule, $mapping);
$builder->build();
}
}