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


PHP _civicrm_api3_get_BAO函数代码示例

本文整理汇总了PHP中_civicrm_api3_get_BAO函数的典型用法代码示例。如果您正苦于以下问题:PHP _civicrm_api3_get_BAO函数的具体用法?PHP _civicrm_api3_get_BAO怎么用?PHP _civicrm_api3_get_BAO使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: civicrm_api3_contribution_create

/**
 * Add or update a Contribution.
 *
 * @param array $params
 *   Input parameters.
 *
 * @throws API_Exception
 * @return array
 *   Api result array
 */
function civicrm_api3_contribution_create(&$params)
{
    $values = array();
    _civicrm_api3_custom_format_params($params, $values, 'Contribution');
    $params = array_merge($params, $values);
    if (!empty($params['id']) && !empty($params['contribution_status_id'])) {
        $error = array();
        //throw error for invalid status change such as setting completed back to pending
        //@todo this sort of validation belongs in the BAO not the API - if it is not an OK
        // action it needs to be blocked there. If it is Ok through a form it needs to be OK through the api
        CRM_Contribute_BAO_Contribution::checkStatusValidation(NULL, $params, $error);
        if (array_key_exists('contribution_status_id', $error)) {
            throw new API_Exception($error['contribution_status_id']);
        }
    }
    if (!empty($params['id']) && !empty($params['financial_type_id'])) {
        $error = array();
        CRM_Contribute_BAO_Contribution::checkFinancialTypeChange($params['financial_type_id'], $params['id'], $error);
        if (array_key_exists('financial_type_id', $error)) {
            throw new API_Exception($error['financial_type_id']);
        }
    }
    _civicrm_api3_contribution_create_legacy_support_45($params);
    // Make sure tax calculation is handled via api.
    $params = CRM_Contribute_BAO_Contribution::checkTaxAmount($params);
    return _civicrm_api3_basic_create(_civicrm_api3_get_BAO(__FUNCTION__), $params, 'Contribution');
}
开发者ID:utkarshsharma,项目名称:civicrm-core,代码行数:37,代码来源:Contribution.php

示例2: civicrm_api3_h_r_job_contract_get

/**
 * HRJobContract.get API
 *
 * @param array $params
 * @return array API result descriptor
 * @throws API_Exception
 */
function civicrm_api3_h_r_job_contract_get($params)
{
    $returnFields = array();
    if (!empty($params['return'])) {
        if (is_array($params['return'])) {
            $returnFields = $params['return'];
        } else {
            $returnFields = explode(',', $params['return']);
        }
    }
    $contracts = _civicrm_api3_basic_get(_civicrm_api3_get_BAO(__FUNCTION__), $params);
    foreach ($contracts['values'] as $key => $contract) {
        $isCurrent = true;
        $contractDetails = civicrm_api3('HRJobDetails', 'get', array('sequential' => 1, 'jobcontract_id' => $contract['id']));
        $details = CRM_Utils_Array::first($contractDetails['values']);
        if (!empty($details['period_end_date'])) {
            if ($details['period_end_date'] < date('Y-m-d')) {
                $isCurrent = false;
            }
        }
        $contracts['values'][$key]['is_current'] = (int) $isCurrent;
        foreach ($returnFields as $returnField) {
            if (!empty($details[$returnField])) {
                $contracts['values'][$key][$returnField] = $details[$returnField];
            }
        }
    }
    return $contracts;
}
开发者ID:JoeMurray,项目名称:civihr,代码行数:36,代码来源:HRJobContract.php

示例3: civicrm_api3_pledge_create

/**
 * Creates or updates an Activity. See the example for usage
 *
 * @param array  $params       Associative array of property name/value
 *                             pairs for the activity.
 * {@getfields pledge_create}
 *
 * @return array Array containing 'is_error' to denote success or failure and details of the created pledge
 *
 * @example PledgeCreate.php Standard create example
 *
 */
function civicrm_api3_pledge_create($params)
{
    _civicrm_api3_pledge_format_params($params, TRUE);
    $values = $params;
    //format the custom fields
    _civicrm_api3_custom_format_params($params, $values, 'Pledge');
    return _civicrm_api3_basic_create(_civicrm_api3_get_BAO(__FUNCTION__), $values);
}
开发者ID:prashantgajare,项目名称:civicrm-core,代码行数:20,代码来源:Pledge.php

示例4: civicrm_api3_option_value_create

/**
 *  Add a OptionValue. OptionValues are used to classify CRM entities (including Contacts, Groups and Actions).
 *
 * Allowed @params array keys are:
 *
 * {@example OptionValueCreate.php}
 *
 * @param $params
 *
 * @throws API_Exception
 * @return array of newly created option_value property values.
 * {@getfields OptionValue_create}
 * @access public
 */
function civicrm_api3_option_value_create($params)
{
    $result = _civicrm_api3_basic_create(_civicrm_api3_get_BAO(__FUNCTION__), $params);
    if (!empty($params['id']) && !array_key_exists('option_group_id', $params)) {
        $groupId = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_OptionValue', $params['id'], 'option_group_id', 'id');
    } else {
        $groupId = $params['option_group_id'];
    }
    civicrm_api('option_value', 'getfields', array('version' => 3, 'cache_clear' => 1, 'option_group_id' => $groupId));
    return $result;
}
开发者ID:prashantgajare,项目名称:civicrm-core,代码行数:25,代码来源:OptionValue.php

示例5: civicrm_api3_option_value_get

/**
 * Retrieve one or more OptionValues
 *
 * @param  array  $ params input parameters
 *
 * {@example OptionValueGet.php 0}
 * @example OptionValueGet.php
 *
 * @return  array details of found Option Values
 * {@getfields OptionValue_get}
 * @access public
 */
function civicrm_api3_option_value_get($params)
{
    if (empty($params['option_group_id']) && !empty($params['option_group_name'])) {
        $opt = array('version' => 3, 'name' => $params['option_group_name']);
        $optionGroup = civicrm_api('OptionGroup', 'Get', $opt);
        if (empty($optionGroup['id'])) {
            return civicrm_api3_create_error("option group name does not correlate to a single option group");
        }
        $params['option_group_id'] = $optionGroup['id'];
    }
    return _civicrm_api3_basic_get(_civicrm_api3_get_BAO(__FUNCTION__), $params);
}
开发者ID:peteainsworth,项目名称:civicrm-4.2.9-drupal,代码行数:24,代码来源:OptionValue.php

示例6: civicrm_api3_group_get

/**
 * Returns array of groups matching a set of one or more Group properties.
 *
 * @param array $params
 *   Array of properties. If empty, all records will be returned.
 *
 * @return array
 *   Array of matching groups
 */
function civicrm_api3_group_get($params)
{
    $options = _civicrm_api3_get_options_from_params($params, TRUE, 'Group', 'get');
    if (empty($options['return']) || !in_array('member_count', $options['return'])) {
        return _civicrm_api3_basic_get(_civicrm_api3_get_BAO(__FUNCTION__), $params, TRUE, 'Group');
    }
    $groups = _civicrm_api3_basic_get(_civicrm_api3_get_BAO(__FUNCTION__), $params, FALSE, 'Group');
    foreach ($groups as $id => $group) {
        $groups[$id]['member_count'] = CRM_Contact_BAO_Group::memberCount($id);
    }
    return civicrm_api3_create_success($groups, $params, 'Group', 'get');
}
开发者ID:rajeshrhino,项目名称:civicrm-core,代码行数:21,代码来源:Group.php

示例7: civicrm_api3_event_create

/**
 * Create a Event
 *
 * This API is used for creating a Event
 *
 * @param  array   $params   input parameters
 * Allowed @params array keys are:
 * {@getfields event_create}
 *
 * @return array API result Array.
 * @access public
 */
function civicrm_api3_event_create($params)
{
    civicrm_api3_verify_one_mandatory($params, NULL, array('event_type_id', 'template_id'));
    // Clone event from template
    if (!empty($params['template_id']) && empty($params['id'])) {
        $copy = CRM_Event_BAO_Event::copy($params['template_id']);
        $params['id'] = $copy->id;
        unset($params['template_id']);
    }
    _civicrm_api3_event_create_legacy_support_42($params);
    return _civicrm_api3_basic_create(_civicrm_api3_get_BAO(__FUNCTION__), $params, 'Event');
}
开发者ID:prashantgajare,项目名称:civicrm-core,代码行数:24,代码来源:Event.php

示例8: civicrm_api3_option_value_create

/**
 *  Add a OptionValue. OptionValues are used to classify CRM entities (including Contacts, Groups and Actions).
 *
 * Allowed @params array keys are:
 *
 * {@example OptionValueCreate.php}
 *
 * @return array of newly created option_value property values.
 * {@getfields OptionValue_create}
 * @access public
 */
function civicrm_api3_option_value_create($params)
{
    $result = _civicrm_api3_basic_create(_civicrm_api3_get_BAO(__FUNCTION__), $params);
    // CRM-13814 : evalute option group id
    // option group id would be passed in case of adding a new option value record
    if (!empty($params['id']) && !array_key_exists('option_group_id', $params)) {
        $groupId = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_OptionValue', $params['id'], 'option_group_id', 'id');
    } else {
        $groupId = $params['option_group_id'];
    }
    civicrm_api('option_value', 'getfields', array('version' => 3, 'cache_clear' => 1, 'option_group_id' => $groupId));
    return $result;
}
开发者ID:hguru,项目名称:224Civi,代码行数:24,代码来源:OptionValue.php

示例9: civicrm_api3_h_r_job_contract_revision_get

/**
 * HRJobContractRevision.get API
 *
 * @param array $params
 * @return array API result descriptor
 * @throws API_Exception
 */
function civicrm_api3_h_r_job_contract_revision_get($params)
{
    $revisions = _civicrm_api3_basic_get(_civicrm_api3_get_BAO(__FUNCTION__), $params);
    foreach ($revisions['values'] as $key => $revision) {
        $editorName = '';
        if (!empty($revision['editor_uid'])) {
            $civiUser = civicrm_custom_user_profile_get_contact($revision['editor_uid']);
            $editorName = $civiUser['sort_name'];
        }
        $revisions['values'][$key]['editor_name'] = $editorName;
    }
    return $revisions;
}
开发者ID:JoeMurray,项目名称:civihr,代码行数:20,代码来源:HRJobContractRevision.php

示例10: civicrm_api3_entity_tag_get

/**
 * Get entity tags.
 *
 * @param array $params
 *
 * @return array
 */
function civicrm_api3_entity_tag_get($params)
{
    if (empty($params['entity_id'])) {
        return _civicrm_api3_basic_get(_civicrm_api3_get_BAO(__FUNCTION__), $params);
    } else {
        //do legacy non-standard behaviour
        $values = CRM_Core_BAO_EntityTag::getTag($params['entity_id'], $params['entity_table']);
        $result = array();
        foreach ($values as $v) {
            $result[$v] = array('tag_id' => $v);
        }
        return civicrm_api3_create_success($result, $params, 'EntityTag');
    }
}
开发者ID:FundingWorks,项目名称:civicrm-core,代码行数:21,代码来源:EntityTag.php

示例11: civicrm_api3_activity_getabsences

/**
 * Activity.GetAbsences API
 *
 * This is a variation on Activity.get with additional filtering behavior suitable for activities.
 *
 * @param array $params
 * @return array API result descriptor
 * @see civicrm_api3_create_success
 * @see civicrm_api3_create_error
 * @throws API_Exception
 */
function civicrm_api3_activity_getabsences($params)
{
    // activity_type_id: int|string|array(int|string)
    // period_id: int|array(int)
    // target_contact_id: int
    $activityTypes = CRM_Core_PseudoConstant::activityType();
    // ****** Defaults ******
    if (!isset($params['activity_type_id'])) {
        $params['activity_type_id'] = CRM_HRAbsence_BAO_HRAbsenceType::getActivityTypes();
    }
    // ****** Build query ******
    $select = new CRM_HRAbsence_DGWDIHTWT('civicrm_activity request');
    $select->select('request.*')->groupBy('request.id')->join('absence', 'INNER JOIN civicrm_activity absence ON (absence.source_record_id = request.id AND absence.activity_type_id = #typeId)', array('#typeId' => array_search('Absence', $activityTypes)));
    if (!empty($params['period_id'])) {
        $periodIds = (array) $params['period_id'];
        $dateExprs = array();
        // array(string $sqlExpression)
        foreach ($periodIds as $periodId) {
            $period = civicrm_api3('HRAbsencePeriod', 'getsingle', array('id' => $periodId));
            $dateExprs[] = $select->interpolate('min(absence.activity_date_time) between @start and @end', array('@start' => $period['start_date'], '@end' => $period['end_date']));
        }
        $select->having(implode(' or ', $dateExprs));
    }
    if (!empty($params['activity_type_id'])) {
        $typeIds = (array) $params['activity_type_id'];
        foreach (array_keys($typeIds) as $key) {
            if (!is_numeric($typeIds[$key])) {
                $typeIds[$key] = array_search($typeIds[$key], $activityTypes);
                if ($typeIds[$key] === FALSE) {
                    throw new API_Exception("Invalid activity type");
                }
            }
        }
        $select->where('request.activity_type_id IN (#typeIds)', array('#typeIds' => $typeIds));
    }
    if (!empty($params['target_contact_id'])) {
        $activityContactTypes = CRM_Core_OptionGroup::values('activity_contacts', FALSE, FALSE, FALSE, NULL, 'name');
        $select->join('tgt', 'INNER JOIN civicrm_activity_contact tgt
        ON tgt.activity_id = request.id
        AND tgt.record_type_id = #tgt
        AND tgt.contact_id IN (#targetIds)', array('#tgt' => CRM_Utils_Array::key('Activity Targets', $activityContactTypes), '#targetIds' => (array) $params['target_contact_id']));
    }
    // ****** Execute query ******
    $entity = _civicrm_api3_get_BAO(__FUNCTION__);
    $bao = CRM_Core_DAO::executeQuery($select->toSQL(), array(), TRUE, 'CRM_Activity_BAO_Activity');
    $activities = _civicrm_api3_dao_to_array($bao, $params, FALSE, $entity, FALSE);
    $activities = _civicrm_api3_activity_get_formatResult($params, $activities);
    return civicrm_api3_create_success($activities, $params, $entity, 'getAbsences');
}
开发者ID:JoeMurray,项目名称:civihr,代码行数:60,代码来源:Getabsences.php

示例12: civicrm_api3_group_get

/**
 * Returns array of groups matching a set of one or more Group properties.
 *
 * @param array $params
 *   Array of properties. If empty, all records will be returned.
 *
 * @return array
 *   Array of matching groups
 */
function civicrm_api3_group_get($params)
{
    $options = _civicrm_api3_get_options_from_params($params, TRUE, 'Group', 'get');
    if ((empty($options['return']) || !in_array('member_count', $options['return'])) && empty($params['check_permissions'])) {
        return _civicrm_api3_basic_get(_civicrm_api3_get_BAO(__FUNCTION__), $params, TRUE, 'Group');
    }
    $groups = _civicrm_api3_basic_get(_civicrm_api3_get_BAO(__FUNCTION__), $params, FALSE, 'Group');
    foreach ($groups as $id => $group) {
        if (!empty($params['check_permissions']) && !CRM_Contact_BAO_Group::checkPermission($group['id'])) {
            unset($groups[$id]);
        } elseif (!empty($options['return']) && in_array('member_count', $options['return'])) {
            $groups[$id]['member_count'] = CRM_Contact_BAO_Group::memberCount($id);
        }
    }
    return civicrm_api3_create_success($groups, $params, 'Group', 'get');
}
开发者ID:kidaa30,项目名称:yes,代码行数:25,代码来源:Group.php

示例13: civicrm_api3_event_create

/**
 * Create a Event.
 *
 * @param array $params
 *   Input parameters.
 *
 * @return array
 *   API result Array.
 */
function civicrm_api3_event_create($params)
{
    // Required fields for creating an event
    if (empty($params['id']) && empty($params['is_template'])) {
        civicrm_api3_verify_mandatory($params, NULL, array('start_date', 'title', array('event_type_id', 'template_id')));
    } elseif (empty($params['id']) && !empty($params['is_template'])) {
        civicrm_api3_verify_mandatory($params, NULL, array('template_title'));
    }
    // Clone event from template
    if (!empty($params['template_id']) && empty($params['id'])) {
        $copy = CRM_Event_BAO_Event::copy($params['template_id']);
        $params['id'] = $copy->id;
        unset($params['template_id']);
    }
    _civicrm_api3_event_create_legacy_support_42($params);
    return _civicrm_api3_basic_create(_civicrm_api3_get_BAO(__FUNCTION__), $params, 'Event');
}
开发者ID:vajeevan,项目名称:civicrm-core,代码行数:26,代码来源:Event.php

示例14: mergeSubquery

 /**
  * Helper function for adding the permissioned subquery from one entity onto another
  *
  * @param string $entity
  * @param string $joinColumn
  * @return array
  */
 public static function mergeSubquery($entity, $joinColumn = 'id')
 {
     require_once 'api/v3/utils.php';
     $baoName = _civicrm_api3_get_BAO($entity);
     $bao = new $baoName();
     $clauses = $subclauses = array();
     foreach ((array) $bao->addSelectWhereClause() as $field => $vals) {
         if ($vals && $field == $joinColumn) {
             $clauses = array_merge($clauses, (array) $vals);
         } elseif ($vals) {
             $subclauses[] = "{$field} " . implode(" AND {$field} ", (array) $vals);
         }
     }
     if ($subclauses) {
         $clauses[] = "IN (SELECT `{$joinColumn}` FROM `" . $bao->tableName() . "` WHERE " . implode(' AND ', $subclauses) . ")";
     }
     return $clauses;
 }
开发者ID:kcristiano,项目名称:civicrm-core,代码行数:25,代码来源:SQL.php

示例15: civicrm_api3_volunteer_need_get

/**
 * Returns array of needs  matching a set of one or more group properties
 *
 * @param array $params  Array of one or more valid
 *                       property_name=>value pairs. If $params is set
 *                       as null, all needs will be returned
 *
 * @return array  (referance) Array of matching needs
 * {@getfields need_get}
 * @access public
 */
function civicrm_api3_volunteer_need_get($params)
{
    $result = _civicrm_api3_basic_get(_civicrm_api3_get_BAO(__FUNCTION__), $params);
    if (!empty($result['values'])) {
        foreach ($result['values'] as &$need) {
            if (!empty($need['start_time'])) {
                $need['display_time'] = CRM_Volunteer_BAO_Need::getTimes($need['start_time'], CRM_Utils_Array::value('duration', $need));
            } else {
                $need['display_time'] = ts('Flexible', array('domain' => 'org.civicrm.volunteer'));
            }
            if (isset($need['role_id'])) {
                $need['role_label'] = CRM_Core_OptionGroup::getLabel(CRM_Volunteer_Upgrader::customOptionGroupName, $need['role_id']);
            } elseif (CRM_Utils_Array::value('is_flexible', $need)) {
                $need['role_label'] = CRM_Volunteer_BAO_Need::getFlexibleRoleLabel();
            }
        }
    }
    return $result;
}
开发者ID:relldoesphp,项目名称:civivolunteer,代码行数:30,代码来源:VolunteerNeed.php


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