本文整理汇总了PHP中_civicrm_api3_basic_get函数的典型用法代码示例。如果您正苦于以下问题:PHP _civicrm_api3_basic_get函数的具体用法?PHP _civicrm_api3_basic_get怎么用?PHP _civicrm_api3_basic_get使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了_civicrm_api3_basic_get函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: civicrm_api3_line_item_get
/**
* Returns array of line_items 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 line_items will be returned (default limit is 25)
*
* @return array
* Array of matching line_items
*/
function civicrm_api3_line_item_get($params)
{
if (CRM_Financial_BAO_FinancialType::isACLFinancialTypeStatus() && CRM_Utils_Array::value('check_permissions', $params)) {
CRM_Price_BAO_LineItem::getAPILineItemParams($params);
}
return _civicrm_api3_basic_get(_civicrm_api3_get_BAO(__FUNCTION__), $params);
}
示例2: civicrm_api3_campaign_expense_get
/**
* Get expenses
*
* function passed on to CRM_Financial_BAO_FinancialItem
*/
function civicrm_api3_campaign_expense_get($params)
{
$params['entity_table'] = 'civicrm_campaign';
$params['entity_id'] = $params['campaign_id'];
$reply = _civicrm_api3_basic_get(CRM_Financial_BAO_FinancialItem, $params);
// extract the encoded expense_type_id from description
if (isset($reply['values'])) {
$values = $reply['values'];
// copy array so we can modify while iterating
foreach ($values as $expense_id => $expense) {
if (!empty($expense['description'])) {
$parts = explode(":", $expense['description'], 2);
if (count($parts) > 1) {
$reply['values'][$expense_id]['expense_type_id'] = $parts[0];
$reply['values'][$expense_id]['description'] = $parts[1];
} else {
$reply['values'][$expense_id]['expense_type_id'] = 1;
// TODO: use default?
$reply['values'][$expense_id]['description'] = $expense['description'];
}
} else {
$reply['values'][$expense_id]['expense_type_id'] = 1;
// TODO: use default?
$reply['values'][$expense_id]['description'] = '';
}
$reply['values'][$expense_id]['expense_type'] = CRM_Core_OptionGroup::getLabel('campaign_expense_types', $reply['values'][$expense_id]['expense_type_id']);
}
}
return $reply;
}
示例3: 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;
}
示例4: civicrm_api3_case_type_get
/**
* Function to retrieve case types
*
* @param $params
*
* @return array $caseTypes case types keyed by id
* @access public
*/
function civicrm_api3_case_type_get($params)
{
civicrm_api3_verify_mandatory($params);
$caseTypes = _civicrm_api3_basic_get(_civicrm_api3_get_BAO(__FUNCTION__), $params);
// format case type, to fetch xml definition
return _civicrm_api3_case_type_get_formatResult($caseTypes);
}
示例5: civicrm_api3_price_set_get
/**
* Returns array of price_sets 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 price_sets will be returned (default limit is 25)
*
* @return array Array of matching price_sets
* {@getfields price_set_get}
* @access public
*/
function civicrm_api3_price_set_get($params)
{
$result = _civicrm_api3_basic_get(_civicrm_api3_get_BAO(__FUNCTION__), $params, FALSE);
// Fetch associated entities
foreach ($result as &$item) {
$item['entity'] = CRM_Price_BAO_Set::getUsedBy($item['id'], 'entity');
}
return civicrm_api3_create_success($result, $params);
}
示例6: civicrm_api3_case_type_get
/**
* Retrieve case types.
*
* @param array $params
*
* @return array
* case types keyed by id
*/
function civicrm_api3_case_type_get($params)
{
if (!empty($params['options']) && !empty($params['options']['is_count'])) {
return _civicrm_api3_basic_get(_civicrm_api3_get_BAO(__FUNCTION__), $params);
}
$caseTypes = _civicrm_api3_basic_get(_civicrm_api3_get_BAO(__FUNCTION__), $params);
// format case type, to fetch xml definition
return _civicrm_api3_case_type_get_formatResult($caseTypes);
}
示例7: civicrm_api3_volunteer_project_contact_get
/**
* Returns array of project contacts matching a set of one or more properties
*
* @param array $params Array of one or more valid
* property_name=>value pairs.
*
* @return array Array of matching project contacts
* {@getfields volunteer_project_contact_get}
* @access public
*/
function civicrm_api3_volunteer_project_contact_get($params)
{
$result = _civicrm_api3_basic_get(_civicrm_api3_get_BAO(__FUNCTION__), $params);
if (!empty($result['values'])) {
foreach ($result['values'] as &$projectContact) {
$optionValue = civicrm_api3('OptionValue', 'getsingle', array('option_group_id' => CRM_Volunteer_BAO_ProjectContact::RELATIONSHIP_OPTION_GROUP, 'value' => $projectContact['relationship_type_id']));
$projectContact['relationship_type_label'] = $optionValue['label'];
$projectContact['relationship_type_name'] = $optionValue['name'];
}
}
return $result;
}
示例8: 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');
}
示例9: civicrm_api3_option_value_get
/**
* Retrieve one or more OptionValues
*
* @param $params
*
* @internal 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);
}
示例10: 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;
}
示例11: civicrm_api3_group_contact_get
/**
* This API will give list of the groups for particular contact
* Particualr status can be sent in params array
* If no status mentioned in params, by default 'added' will be used
* to fetch the records
*
* @param array $params name value pair of contact information
* {@getfields GroupContact_get}
*
* @return array list of groups, given contact subsribed to
*/
function civicrm_api3_group_contact_get($params)
{
if (empty($params['contact_id'])) {
if (empty($params['status'])) {
//default to 'Added'
$params['status'] = 'Added';
}
//ie. id passed in so we have to return something
return _civicrm_api3_basic_get('CRM_Contact_BAO_GroupContact', $params);
}
$status = CRM_Utils_Array::value('status', $params, 'Added');
$values =& CRM_Contact_BAO_GroupContact::getContactGroup($params['contact_id'], $status, NULL, FALSE, TRUE);
return civicrm_api3_create_success($values, $params);
}
示例12: civicrm_api3_account_contact_get
/**
* AccountContact.get API
*
* @param array $params
* @return array API result descriptor
* @throws API_Exception
*/
function civicrm_api3_account_contact_get($params)
{
$accountContacts = _civicrm_api3_basic_get('CRM_Accountsync_BAO_AccountContact', $params);
if (is_array($accountContacts['values'])) {
// e.g when we are dealing with 'getcount we skip this.
foreach ($accountContacts['values'] as $id => $accountContact) {
if (!empty($accountContacts['values'][$id]['accounts_data'])) {
$accountContacts['values'][$id]['accounts_data'] = json_decode($accountContacts['values'][$id]['accounts_data'], TRUE);
CRM_Accountsync_Hook::mapAccountsData($accountContacts['values'][$id]['accounts_data'], 'contact', $params['plugin']);
}
}
}
return $accountContacts;
}
示例13: 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');
}
}
示例14: civicrm_api3_membership_type_get
/**
* Get a Membership Type.
*
* This api is used for finding an existing membership type.
*
* @param array $params
* Array of name/value property values of civicrm_membership_type.
*
* @return array
* API result array.
*/
function civicrm_api3_membership_type_get($params)
{
$results = _civicrm_api3_basic_get(_civicrm_api3_get_BAO(__FUNCTION__), $params);
if (!empty($results['values']) && is_array($results['values'])) {
foreach ($results['values'] as &$item) {
// Workaround for fields using nonstandard serialization
foreach (array('relationship_type_id', 'relationship_direction') as $field) {
if (isset($item[$field]) && !is_array($item[$field])) {
$item[$field] = (array) $item[$field];
}
}
}
}
return $results;
}
示例15: 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');
}