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


PHP _civicrm_initialize函数代码示例

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


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

示例1: civicrm_group_nesting_get

/**
 * Provides group nesting record(s) given parent and/or child id.
 * 
 * @param  array $params  an array containing at least child_group_id or parent_group_id
 *
 * @return  array  list of group nesting records
 */
function civicrm_group_nesting_get(&$params)
{
    _civicrm_initialize();
    if (!is_array($params)) {
        return civicrm_create_error('Params need to be of type array!');
    }
    if (!array_key_exists('child_group_id', $params) && !array_key_exists('parent_group_id', $params)) {
        return civicrm_create_error(ts('At least one of child_group_id or parent_group_id is a required field'));
    }
    require_once 'CRM/Contact/DAO/GroupNesting.php';
    $dao = new CRM_Contact_DAO_GroupNesting();
    if (array_key_exists('child_group_id', $params)) {
        $dao->child_group_id = $params['child_group_id'];
    }
    if (array_key_exists('parent_group_id', $params)) {
        $dao->parent_group_id = $params['parent_group_id'];
    }
    $values = array();
    if ($dao->find()) {
        while ($dao->fetch()) {
            $temp = array();
            _civicrm_object_to_array($dao, $temp);
            $values[$dao->id] = $temp;
        }
        $values['is_error'] = 0;
    } else {
        return civicrm_create_error('No records found.');
    }
    return $values;
}
开发者ID:hampelm,项目名称:Ginsberg-CiviDemo,代码行数:37,代码来源:GroupNesting.php

示例2: _civicrm_initialize

/**
 * create a contribution page
 *
 * @param  array   $params           (reference ) input parameters - need id and contribution_type_id
 *
 * @return array (reference )        contributionType id and other fields
 * @static void
 * @access public
 */
function &civicrm_payment_dodirectpayment( &$params ) {
    _civicrm_initialize( );

    if( ! is_array($params) ) {
        return civicrm_create_error( 'Params need to be of type array!' );
    }	
	
    civicrm_verify_mandatory ($params,null,array ('mode', 'component'));
    
    $mode               = CRM_Utils_Array::value( 'mode', $params );
    $component          = CRM_Utils_Array::value( 'component', $params ); // 'Contribute'
    unset($params['mode']);
    unset($params['component']);
    $paymentProcessor   = $params['paymentProcessor'];
    unset($params['paymentProcessor']);

    $form               = NULL; // todo add that in later
    
    $payment            =& CRM_Core_Payment::singleton($mode, $paymentProcessor, $form);
    $result             =& $payment->doDirectPayment( $params );
    
    if(is_object($result) && get_class($result) == 'CRM_Core_Error') {
        return civicrm_create_error($result->_errors[0]['code']);
    }

    return $result;
}
开发者ID:ryanrd,项目名称:DW-Campaigns,代码行数:36,代码来源:Payment.php

示例3: _civicrm_initialize

function &civicrm_survey_respondant_count(&$params)
{
    _civicrm_initialize();
    $petition = new CRM_Campaign_BAO_Petition();
    if (array_key_exists('groupby', $params) && $params['groupby'] == 'country') {
        $signaturesCount = $petition->getPetitionSignatureTotalbyCountry($params['survey_id']);
    } else {
        $signaturesCount = $petition->getPetitionSignatureTotal($params['survey_id']);
    }
    return $signaturesCount;
}
开发者ID:peteainsworth,项目名称:civicrm-4.2.9-drupal,代码行数:11,代码来源:SurveyRespondant.php

示例4: civicrm_membership_delete

/**
 * Deletes an existing contact membership
 * 
 * This API is used for deleting a contact membership
 * 
 * @param  Int  $membershipID   Id of the contact membership to be deleted
 * 
 * @return null if successfull, object of CRM_Core_Error otherwise
 * @access public
 */
function civicrm_membership_delete(&$membershipID)
{
    _civicrm_initialize();
    if (empty($membershipID)) {
        return civicrm_create_error('Membership ID cannot be empty.');
    }
    require_once 'CRM/Member/BAO/Membership.php';
    CRM_Member_BAO_Membership::deleteRelatedMemberships($membershipID);
    $membership = new CRM_Member_BAO_Membership();
    $result = $membership->deleteMembership($membershipID);
    return $result ? civicrm_create_success() : civicrm_create_error('Error while deleting Membership');
}
开发者ID:bhirsch,项目名称:voipdev,代码行数:22,代码来源:Membership.php

示例5: _civicrm_initialize

/**
 * create a contribution page
 *
 * @param  array   $params           (reference ) input parameters - need id and contribution_type_id
 *
 * @return array (reference )        contributionType id and other fields
 * @static void
 * @access public
 */
function &civicrm_paymentprocessor_getpayment( &$params ) {
    _civicrm_initialize( );

    if( ! is_array($params) ) {
        return civicrm_create_error( 'Params need to be of type array!' );
    }	
	
	civicrm_verify_mandatory ($params,null,array ('id', 'mode'));
	$id		= CRM_Utils_Array::value( 'id', $params );
	$mode	= CRM_Utils_Array::value( 'mode', $params );

	$paymentProcessor =& CRM_Core_BAO_PaymentProcessor::getPayment($id, $mode);

    return $paymentProcessor;
}
开发者ID:ryanrd,项目名称:DW-Campaigns,代码行数:24,代码来源:Paymentprocessor.php

示例6: civicrm_activity_contact_get

/**
 * Retrieve a set of activities, specific to given input params.
 *
 * @param  array  $params (reference ) input parameters.
 *
 * @return array (reference)  array of activities / error message.
 * @access public
 */
function civicrm_activity_contact_get($params)
{
    _civicrm_initialize();
    $contactId = CRM_Utils_Array::value('contact_id', $params);
    if (empty($contactId)) {
        return civicrm_create_error(ts("Required parameter not found"));
    }
    if (!is_numeric($contactId)) {
        return civicrm_create_error(ts("Invalid contact Id"));
    }
    $activities =& _civicrm_activities_get($contactId);
    if ($activities) {
        return civicrm_create_success($activities);
    } else {
        return civicrm_create_error(ts('Invalid Data'));
    }
}
开发者ID:ksecor,项目名称:civicrm,代码行数:25,代码来源:ActivityContact.php

示例7: _civicrm_initialize

/**
 * create a friend
 *
 * @param  array   $params           (reference ) input parameters - need id and contribution_type_id
 *
 * @return (none)
 * @static void
 * @access public
 */
function &civicrm_friend_create( &$params ) {
    _civicrm_initialize( );
	
    $values  = array( );
   
    require_once 'CRM/Contribute/BAO/ContributionType.php';

    $ids     = array( );
    if ( CRM_Utils_Array::value( 'id', $params ) ) {
    
	}
	
    $friend = CRM_Friend_BAO_Friend::create( $params );
    if ( is_a( $friend, 'CRM_Core_Error' ) ) {
        return civicrm_create_error( ts( 'Failed to create Friend' ) );
    }

    _civicrm_object_to_array($friend, $friendArray);
    
    return array('message' => 'Friend Added');
}
开发者ID:ryanrd,项目名称:DW-Campaigns,代码行数:30,代码来源:Friend.php

示例8: _civicrm_initialize

/**
 * Add a contribution type
 *
 * @param  array   $params           (reference ) input parameters
 *
 * @return array (reference )        contributionType id and other fields
 * @static void
 * @access public
 */
function &civicrm_contributiontype_add( &$params ) {
    _civicrm_initialize( );
	
    $values  = array( );
   
    require_once 'CRM/Contribute/BAO/ContributionType.php';

    $ids     = array( );
    if ( CRM_Utils_Array::value( 'id', $params ) ) {
        $ids['contributionType'] = $params['id'];
		unset($params['id']); // we don't need it in params
	}
	
    $contributionType = CRM_Contribute_BAO_ContributionType::add( $params, $ids );
    if ( is_a( $contributionType, 'CRM_Core_Error' ) ) {
        return civicrm_create_error( ts( 'Failed to add contribution type' ) );
    }

    _civicrm_object_to_array($contributionType, $contributeArray);
    
    return $contributeArray;
}
开发者ID:ryanrd,项目名称:DW-Campaigns,代码行数:31,代码来源:ContributionType.php

示例9: civicrm_activity_contact_get

/**
 * Retrieve a set of activities, specific to given input params.
 *
 * @param  array  $params (reference ) input parameters.
 *
 * @return array (reference)  array of activities / error message.
 * @access public
 */
function civicrm_activity_contact_get($params)
{
    _civicrm_initialize();
    $contactId = CRM_Utils_Array::value('contact_id', $params);
    if (empty($contactId)) {
        return civicrm_create_error(ts("Required parameter not found"));
    }
    //check if $contactId is valid
    if (!is_numeric($contactId) || !preg_match('/^\\d+$/', $contactId)) {
        return civicrm_create_error(ts("Invalid contact Id"));
    }
    $activities =& _civicrm_activities_get($contactId);
    //show success for empty $activities array
    if (empty($activities)) {
        return civicrm_create_success(ts("0 activity record matching input params"));
    }
    if ($activities) {
        return civicrm_create_success($activities);
    } else {
        return civicrm_create_error(ts('Invalid Data'));
    }
}
开发者ID:hampelm,项目名称:Ginsberg-CiviDemo,代码行数:30,代码来源:ActivityContact.php

示例10: civicrm_activity_delete

/**
 * Delete a specified Activity.
 * @param CRM_Activity $activity Activity object to be deleted
 *
 * @return void|CRM_Core_Error  An error if 'activityName or ID' is invalid,
 *                         permissions are insufficient, etc.
 *
 * @access public
 *
 */
function civicrm_activity_delete(&$params)
{
    _civicrm_initialize();
    $errors = array();
    //check for various error and required conditions
    $errors = _civicrm_activity_check_params($params);
    if (!empty($errors)) {
        return $errors;
    }
    if (CRM_Activity_BAO_Activity::deleteActivity($params)) {
        return civicrm_create_success();
    } else {
        return civicrm_create_error(ts('Could not delete activity'));
    }
}
开发者ID:hampelm,项目名称:Ginsberg-CiviDemo,代码行数:25,代码来源:Activity.php

示例11: civicrm_event_get

/**
 * 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 civicrm_event_get(&$params)
{
    _civicrm_initialize();
    if (!is_array($params)) {
        return civicrm_create_error('Input parameters is not an array.');
    }
    if (empty($params)) {
        return civicrm_create_error('Params cannot be empty.');
    }
    $event =& civicrm_event_search($params);
    if (count($event) != 1 && !CRM_Utils_Array::value('returnFirst', $params)) {
        return civicrm_create_error(ts('%1 events matching input params', array(1 => count($event))));
    }
    if (civicrm_error($event)) {
        return $event;
    }
    $event = array_values($event);
    $event[0]['is_error'] = 0;
    return $event[0];
}
开发者ID:bhirsch,项目名称:voipdev,代码行数:31,代码来源:Event.php

示例12: _civicrm_initialize

/**
 * Update an existing membership status
 *
 * This api is used for updating an existing membership status.
 * Required parrmeters : id of a membership status
 * 
 * @param  Array   $params  an associative array of name/value property values of civicrm_membership_status
 * 
 * @return array of updated membership status property values
 * @access public
 */
function &civicrm_membership_status_update(&$params)
{
    _civicrm_initialize();
    if (!is_array($params)) {
        return civicrm_create_error('Params is not an array');
    }
    if (!isset($params['id'])) {
        return civicrm_create_error('Required parameter missing');
    }
    require_once 'CRM/Member/BAO/MembershipStatus.php';
    $membershipStatusBAO =& new CRM_Member_BAO_MembershipStatus();
    $membershipStatusBAO->id = $params['id'];
    if ($membershipStatusBAO->find(true)) {
        $fields = $membershipStatusBAO->fields();
        foreach ($fields as $name => $field) {
            if (array_key_exists($name, $params)) {
                $membershipStatusBAO->{$name} = $params[$name];
            }
        }
        $membershipStatusBAO->save();
    }
    $membershipStatus = array();
    _civicrm_object_to_array(clone $membershipStatusBAO, $membershipStatus);
    $membershipStatus['is_error'] = 0;
    return $membershipStatus;
}
开发者ID:ksecor,项目名称:civicrm,代码行数:37,代码来源:MembershipStatus.php

示例13: _civicrm_initialize

/**
 *
 * @param <type> $params
 * @return <type> 
 */
function &civicrm_contribution_format_create(&$params)
{
    _civicrm_initialize();
    // return error if we have no params
    if (empty($params)) {
        return civicrm_create_error('Input Parameters empty');
    }
    $error = _civicrm_contribute_check_params($params);
    if (civicrm_error($error)) {
        return $error;
    }
    $values = array();
    $error = _civicrm_contribute_format_params($params, $values);
    if (civicrm_error($error)) {
        return $error;
    }
    $error = _civicrm_contribute_duplicate_check($params);
    if (civicrm_error($error)) {
        return $error;
    }
    $ids = array();
    CRM_Contribute_BAO_Contribution::resolveDefaults($params, true);
    $contribution = CRM_Contribute_BAO_Contribution::create($params, $ids);
    _civicrm_object_to_array($contribution, $contributeArray);
    return $contributeArray;
}
开发者ID:ksecor,项目名称:civicrm,代码行数:31,代码来源:Contribute.php

示例14: _civicrm_initialize

/**
 * Retrieve a specific participant, given a set of input params
 * If more than one matching participant exists, return an error, unless
 * the client has requested to return the first found contact
 *
 * @param  array   $params           (reference ) input parameters
 *
 * @return array (reference )        array of properties, if error an array with an error id and error message
 * @static void
 * @access public
 */
function &civicrm_contributionpage_get( &$params ) {
    _civicrm_initialize( );
 
    $values = array( );
    if ( empty( $params ) ) {
        $error = civicrm_create_error( ts( 'No input parameters present' ) );
        return $error;
    }
    
    if ( ! is_array( $params ) ) {
        $error = civicrm_create_error( ts( 'Input parameters is not an array' ) );
        return $error;
    }

    $contributionPage  =& civicrm_contributionpage_search( $params );
    
	if ( count( $contributionPage ) != 1 &&
		 ! CRM_Utils_Array::value( 'returnFirst', $params ) ) {

			if( ! CRM_Utils_Array::value( 'returnAll', $params) ) {
		 
				$error = civicrm_create_error( ts( '%1 contributionPages matching input params', array( 1 => count( $contributionPage ) ) ),
									   $contributionPage );
			} else {
				$return = array(
							'count' => count( $contributionPage ), 
							'results' => $contributionPage
						);
						
				return $return;
				
			}
		return $error;
	}

    if ( civicrm_error( $contributionPage ) ) {
        return $contributionPage;
    }

    $contributionPage = array_values( $contributionPage );
    return $contributionPage[0];
}
开发者ID:ryanrd,项目名称:DW-Campaigns,代码行数:53,代码来源:ContributionPage.php

示例15: civicrm_location_get

/**
 * Returns array of location(s) for a contact
 * 
 * @param array $contact  a valid array of contact parameters
 *
 * @return array  an array of location parameters arrays
 *
 * @access public
 */
function civicrm_location_get($contact)
{
    _civicrm_initialize();
    if (!is_array($contact)) {
        return civicrm_create_error('Params need to be of type array!');
    }
    if (!isset($contact['contact_id'])) {
        return civicrm_create_error('$contact is not valid contact datatype');
    }
    $locationTypes = CRM_Utils_Array::value('location_type', $contact);
    if (is_array($locationTypes) && !count($locationTypes)) {
        return civicrm_create_error('Location type array can not be empty');
    }
    $location =& _civicrm_location_get($contact, $locationTypes);
    return $location;
}
开发者ID:ksecor,项目名称:civicrm,代码行数:25,代码来源:Location.php


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