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


PHP CRM_Contact_BAO_Query::store方法代码示例

本文整理汇总了PHP中CRM_Contact_BAO_Query::store方法的典型用法代码示例。如果您正苦于以下问题:PHP CRM_Contact_BAO_Query::store方法的具体用法?PHP CRM_Contact_BAO_Query::store怎么用?PHP CRM_Contact_BAO_Query::store使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CRM_Contact_BAO_Query的用法示例。


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

示例1: apiQuery

 /**
  * wrapper for a api search query
  *
  * @param array  $params
  * @param array  $returnProperties
  * @param string $sort
  * @param int    $offset
  * @param int    $row_count
  *
  * @return void
  * @access public
  */
 static function apiQuery($params = NULL, $returnProperties = NULL, $fields = NULL, $sort = NULL, $offset = 0, $row_count = 25, $smartGroupCache = TRUE)
 {
     $query = new CRM_Contact_BAO_Query($params, $returnProperties, NULL, TRUE, FALSE, 1, FALSE, TRUE, $smartGroupCache);
     list($select, $from, $where, $having) = $query->query();
     $options = $query->_options;
     $sql = "{$select} {$from} {$where} {$having}";
     // add group by
     if ($query->_useGroupBy) {
         $sql .= ' GROUP BY contact_a.id';
     }
     if (!empty($sort)) {
         $sql .= " ORDER BY {$sort} ";
     }
     if ($row_count > 0 && $offset >= 0) {
         $sql .= " LIMIT {$offset}, {$row_count} ";
     }
     $dao = CRM_Core_DAO::executeQuery($sql);
     $values = array();
     while ($dao->fetch()) {
         $values[$dao->contact_id] = $query->store($dao);
     }
     $dao->free();
     return array($values, $options);
 }
开发者ID:peteainsworth,项目名称:civicrm-4.2.9-drupal,代码行数:36,代码来源:Query.php

示例2: apiQuery

 /**
  * wrapper for a api search query
  *
  * @param array  $params
  * @param array  $returnProperties
  * @param string $sort
  * @param int    $offset
  * @param int    $row_count
  *
  * @return void 
  * @access public 
  */
 function apiQuery($params = null, $returnProperties = null, $options = null, $sort = null, $offset = 0, $row_count = 25)
 {
     $query = new CRM_Contact_BAO_Query($params, $returnProperties, null);
     list($select, $from, $where) = $query->query();
     $options = $query->_options;
     $sql = "{$select} {$from} {$where}";
     if (!empty($sort)) {
         $sql .= " ORDER BY {$sort} ";
     }
     if ($row_count > 0 && $offset >= 0) {
         $sql .= " LIMIT {$offset}, {$row_count} ";
     }
     $dao =& CRM_Core_DAO::executeQuery($sql);
     $values = array();
     while ($dao->fetch()) {
         $values[$dao->contact_id] = $query->store($dao);
     }
     return array($values, $options);
 }
开发者ID:bhirsch,项目名称:voipdrupal-4.7-1.0,代码行数:31,代码来源:Query.php

示例3: apiQuery

 /**
  * These are stub comments as this function needs more explanation - particularly in terms of how it
  * relates to $this->searchQuery and why it replicates rather than calles $this->searchQuery.
  *
  * This function was originally written as a wrapper for the api query but is called from multiple places
  * in the core code directly so the name is misleading. This function does not use the searchQuery function
  * but it is unclear as to whehter that is historical or there is a reason
  *  CRM-11290 led to the permissioning action being extracted from searchQuery & shared with this function
  *
  * @param array $params
  * @param array $returnProperties
  * @param null $fields
  * @param string $sort
  * @param int $offset
  * @param int $row_count
  * @param bool $smartGroupCache
  *   ?? update smart group cache?.
  * @param bool $count
  *   Return count obnly.
  * @param bool $skipPermissions
  *   Should permissions be ignored or should the logged in user's permissions be applied.
  *
  *
  * @return array
  */
 public static function apiQuery($params = NULL, $returnProperties = NULL, $fields = NULL, $sort = NULL, $offset = 0, $row_count = 25, $smartGroupCache = TRUE, $count = FALSE, $skipPermissions = TRUE)
 {
     $query = new CRM_Contact_BAO_Query($params, $returnProperties, NULL, TRUE, FALSE, 1, $skipPermissions, TRUE, $smartGroupCache);
     //this should add a check for view deleted if permissions are enabled
     if ($skipPermissions) {
         $query->_skipDeleteClause = TRUE;
     }
     $query->generatePermissionClause(FALSE, $count);
     // note : this modifies _fromClause and _simpleFromClause
     $query->includePseudoFieldsJoin($sort);
     list($select, $from, $where, $having) = $query->query($count);
     $options = $query->_options;
     if (!empty($query->_permissionWhereClause)) {
         if (empty($where)) {
             $where = "WHERE {$query->_permissionWhereClause}";
         } else {
             $where = "{$where} AND {$query->_permissionWhereClause}";
         }
     }
     $sql = "{$select} {$from} {$where} {$having}";
     // add group by
     if ($query->_useGroupBy) {
         $sql .= ' GROUP BY contact_a.id';
     }
     if (!empty($sort)) {
         $sort = CRM_Utils_Type::escape($sort, 'String');
         $sql .= " ORDER BY {$sort} ";
     }
     if ($row_count > 0 && $offset >= 0) {
         $offset = CRM_Utils_Type::escape($offset, 'Int');
         $rowCount = CRM_Utils_Type::escape($row_count, 'Int');
         $sql .= " LIMIT {$offset}, {$row_count} ";
     }
     $dao = CRM_Core_DAO::executeQuery($sql);
     $values = array();
     while ($dao->fetch()) {
         if ($count) {
             $noRows = $dao->rowCount;
             $dao->free();
             return array($noRows, NULL);
         }
         $val = $query->store($dao);
         $convertedVals = $query->convertToPseudoNames($dao, TRUE);
         if (!empty($convertedVals)) {
             $val = array_replace_recursive($val, $convertedVals);
         }
         $values[$dao->contact_id] = $val;
     }
     $dao->free();
     return array($values, $options);
 }
开发者ID:hoegrammer,项目名称:civicrm-core,代码行数:76,代码来源:Query.php

示例4: array

/**
 * Retrieve a set of pledges, given a set of input params
 *
 * @param  array   $params           (reference ) input parameters. Use interogate for possible fields
 *
 * @return array (reference )        array of pledges, if error an array with an error id and error message
 * @static void
 * @access public
 */
function &civicrm_pledge_get(&$params)
{
    _civicrm_initialize();
    if (!is_array($params)) {
        return civicrm_create_error('Input parameters is not an array');
    }
    $inputParams = array();
    $returnProperties = array();
    $otherVars = array('sort', 'offset', 'rowCount');
    $sort = NULL;
    $offset = 0;
    $rowCount = 25;
    foreach ($params as $n => $v) {
        if (substr($n, 0, 7) == 'return.') {
            $returnProperties[substr($n, 7)] = $v;
        } elseif (in_array($n, $otherVars)) {
            ${$n} = $v;
        } else {
            $inputParams[$n] = $v;
        }
    }
    // add is_test to the clause if not present
    if (!array_key_exists('pledge_test', $inputParams)) {
        $inputParams['pledge_test'] = 0;
    }
    require_once 'CRM/Pledge/BAO/Query.php';
    require_once 'CRM/Contact/BAO/Query.php';
    if (empty($returnProperties)) {
        $returnProperties = CRM_Pledge_BAO_Query::defaultReturnProperties(CRM_Contact_BAO_Query::MODE_PLEDGE);
    } else {
        $returnProperties['pledge_id'] = 1;
    }
    $newParams = CRM_Contact_BAO_Query::convertFormValues($inputParams);
    $query = new CRM_Contact_BAO_Query($newParams, $returnProperties, NULL);
    list($select, $from, $where) = $query->query();
    $sql = "{$select} {$from} {$where}";
    if (!empty($sort)) {
        $sql .= " ORDER BY {$sort} ";
    }
    $sql .= " LIMIT {$offset}, {$rowCount} ";
    $dao = CRM_Core_DAO::executeQuery($sql);
    $pledge = array();
    while ($dao->fetch()) {
        if ($params['sequential']) {
            $pledge[] = $query->store($dao);
        } else {
            $pledge[$dao->pledge_id] = $query->store($dao);
        }
    }
    $dao->free();
    return $pledge;
}
开发者ID:peteainsworth,项目名称:civicrm-4.2.9-drupal,代码行数:61,代码来源:Pledge.php

示例5: civicrm_api3_pledge_get

/**
 * Retrieve a set of pledges, given a set of input params
 *
 * @param  array   $params           (reference ) input parameters. Use interogate for possible fields
 *
 * @return array (reference )        array of pledges, if error an array with an error id and error message
 * {@getfields pledge_get}
 * @example PledgeGet.php
 * @access public
 */
function civicrm_api3_pledge_get($params)
{
    $options = _civicrm_api3_get_options_from_params($params, TRUE, 'pledge', 'get');
    if (empty($options['return'])) {
        $options['return'] = CRM_Pledge_BAO_Query::defaultReturnProperties(CRM_Contact_BAO_Query::MODE_PLEDGE);
    } else {
        $options['return']['pledge_id'] = 1;
    }
    $newParams = CRM_Contact_BAO_Query::convertFormValues($options['input_params']);
    $query = new CRM_Contact_BAO_Query($newParams, $options['return'], NULL, FALSE, FALSE, CRM_Contact_BAO_Query::MODE_PLEDGE);
    list($select, $from, $where) = $query->query();
    $sql = "{$select} {$from} {$where}";
    if (!empty($options['sort'])) {
        $sql .= " ORDER BY " . $options['sort'];
    }
    $sql .= " LIMIT " . $options['offset'] . " , " . $options['limit'];
    $dao = CRM_Core_DAO::executeQuery($sql);
    $pledge = array();
    while ($dao->fetch()) {
        $pledge[$dao->pledge_id] = $query->store($dao);
    }
    return civicrm_api3_create_success($pledge, $params, 'pledge', 'get', $dao);
}
开发者ID:archcidburnziso,项目名称:civicrm-core,代码行数:33,代码来源:Pledge.php

示例6: array

function &civicrm_contributionsoft_search( &$params ) {

    if( ! is_array($params) ) {
        return civicrm_create_error( 'Params need to be of type array!' );
    }
    
    $inputParams      = array( );
    $returnProperties = array( );
    $otherVars = array( 'sort', 'offset', 'rowCount' );
    
    $sort     = null;
    $offset   = 0;
    $rowCount = 25;
    foreach ( $params as $n => $v ) {
        if ( substr( $n, 0, 7 ) == 'return.' ) {
            $returnProperties[ substr( $n, 7 ) ] = $v;
        } elseif ( in_array ( $n, $otherVars ) ) {
            $$n = $v;
        } else {
            $inputParams[$n] = $v;
        }
    }

    require_once 'CRM/Contribute/BAO/Query.php';
    require_once 'CRM/Contact/BAO/Query.php'; 
    
	if ( empty( $returnProperties ) ) {
		//CRM_Contribute_BAO_Query::defaultReturnProperties( CRM_Contact_BAO_Query::MODE_CONTRIBUTIONPAGE );
		$returnProperties = array ( 
								'id' 					=> 1,
								'contribution_id' 		=> 1,
								'contact_id' 			=> 1,
								'amount'				=> 1,
								'pcp_id'				=> 1,
								'pcp_display_in_roll'	=> 1,
								'pcp_roll_nickname'		=> 1,
								'pcp_personal_note'		=> 1,
								'currency'				=> 1
							);
	}

    $newParams =& CRM_Contact_BAO_Query::convertFormValues( $params );
    $query = new CRM_Contact_BAO_Query( $newParams, $returnProperties, null );
	
	// I'm having a problem understanding how this part works, so I'm just working around it for now...
	/*
    list( $select, $from, $where ) = $query->query( );
    
    $sql = "$select $from $where";  
	*/
	$query->_element = array_merge($query->_element, $returnProperties);
	
	
	$sql = "select * from civicrm_contribution_soft";
	$extra = '';
	
	$possible = array('id', 'contribution_id', 'contact_id', 'pcp_id');
	foreach($possible as $key) {
		if ( CRM_Utils_Array::value( $key , $params) ) {
			$extra .= " and $key='" . mysql_real_escape_string($params[$key]) . "'";
		}
	}
	
	if (!empty($extra)) {
		$extra = substr($extra, 4);
		$sql .= " where $extra";
	}
	// end work around
	
	if ( ! empty( $sort ) ) {
        $sql .= " ORDER BY $sort ";
    }

    $sql .= " LIMIT $offset, $rowCount ";
    $dao =& CRM_Core_DAO::executeQuery( $sql, CRM_Core_DAO::$_nullArray );
    
    $contributionPage = array( );
    while ( $dao->fetch( ) ) {
		$contributionSoft[$dao->id] = $query->store( $dao );
    }

    $dao->free( );

    return $contributionSoft;

}
开发者ID:ryanrd,项目名称:DW-Campaigns,代码行数:86,代码来源:ContributionSoft.php

示例7: array

function &civicrm_contributionpage_search( &$params ) {

    if( ! is_array($params) ) {
        return civicrm_create_error( 'Params need to be of type array!' );
    }
    
    $inputParams      = array( );
    $returnProperties = array( );
    $otherVars = array( 'sort', 'offset', 'rowCount' );
    
    $sort     = null;
    $offset   = 0;
    $rowCount = 25;
    foreach ( $params as $n => $v ) {
        if ( substr( $n, 0, 7 ) == 'return.' ) {
            $returnProperties[ substr( $n, 7 ) ] = $v;
        } elseif ( in_array ( $n, $otherVars ) ) {
            $$n = $v;
        } else {
            $inputParams[$n] = $v;
        }
    }

    require_once 'CRM/Contribute/BAO/Query.php';
    require_once 'CRM/Contact/BAO/Query.php'; 
    
	if ( empty( $returnProperties ) ) {
		$returnProperties = array(
                                'id'                        => 1,
                                'title'                     => 1,
                                'intro_text'                => 1,
                                'contribution_type_id'      => 1,
                                'payment_processor_id'      => 1,
                                'is_credit_card_only'       => 1,
                                'is_monetary'               => 1,
                                'is_recur'                  => 1,
                                'recur_requency_unit'       => 1,
                                'is_recur_interval'         => 1,
                                'is_pay_later'              => 1,
                                'pay_later_text'            => 1,
                                'pay_later_receipt'         => 1,
                                'is_allow_other_amount'     => 1,
                                'default_amount_id'         => 1,
                                'min_amount'                => 1,
                                'max_amount'                => 1,
                                'goal_amount'               => 1,
                                'thankyou_title'            => 1,
                                'thankyou_footer'           => 1,
                                'is_for_organization'       => 1,
                                'is_email_receipt'          => 1,
                                'receipt_from_name'         => 1,
                                'receipt_from_email'        => 1,
                                'cc_receipt'                => 1,
                                'bcc_receipt'               => 1,
                                'receipt_text'              => 1,
                                'is_active'                 => 1,
                                'footer_text'               => 1,
                                'amount_block_is_active'    => 1,
                                'honor_block_is_active'     => 1,
                                'honor_block_title'         => 1,
                                'honor_block_text'          => 1,
                                'start_date'                => 1,
                                'end_date'                  => 1,
                                'created_id'                => 1,
                                'created_date'              => 1,
                                'currency'                  => 1
                            );
	}

    $newParams =& CRM_Contact_BAO_Query::convertFormValues( $params);
    $query = new CRM_Contact_BAO_Query( $newParams, $returnProperties, null );
	
	// I'm having a problem understanding how this part works, so I'm just working around it for now...
	/*
    list( $select, $from, $where ) = $query->query( );
    
    $sql = "$select $from $where";  
	*/
	$query->_element = array_merge($query->_element, $returnProperties);
	
	
	$sql = "select * from civicrm_contribution_page";
	if( CRM_Utils_Array::value( 'id', $params) ) {
		$sql .= " where id=" . mysql_real_escape_string($params['id']);
	}
	// end work around
	
	if ( ! empty( $sort ) ) {
        $sql .= " ORDER BY $sort ";
    }

    $sql .= " LIMIT $offset, $rowCount ";
    $dao =& CRM_Core_DAO::executeQuery( $sql, CRM_Core_DAO::$_nullArray );
    
    $contributionPage = array( );
    while ( $dao->fetch( ) ) {
		$contributionPage[$dao->id] = $query->store( $dao );
    }

    $dao->free( );
//.........这里部分代码省略.........
开发者ID:ryanrd,项目名称:DW-Campaigns,代码行数:101,代码来源:ContributionPage.php

示例8: civicrm_api3_contribution_get

/**
 * Retrieve a set of contributions, given a set of input params
 *
 * @param  array   $params           (reference ) input parameters
 * @param array    $returnProperties Which properties should be included in the
 * returned Contribution object. If NULL, the default
 * set of properties will be included.
 *
 * @return array (reference )        array of contributions, if error an array with an error id and error message
 * @static void
 * @access public
 * {@getfields Contribution_get}
 * @example ContributionGet.php
 */
function civicrm_api3_contribution_get($params)
{
    $options = _civicrm_api3_get_options_from_params($params, TRUE, 'contribution', 'get');
    $sort = CRM_Utils_Array::value('sort', $options, NULL);
    $offset = CRM_Utils_Array::value('offset', $options);
    $rowCount = CRM_Utils_Array::value('limit', $options);
    $smartGroupCache = CRM_Utils_Array::value('smartGroupCache', $params);
    $inputParams = CRM_Utils_Array::value('input_params', $options, array());
    $returnProperties = CRM_Utils_Array::value('return', $options, NULL);
    if (empty($returnProperties)) {
        $returnProperties = CRM_Contribute_BAO_Query::defaultReturnProperties(CRM_Contact_BAO_Query::MODE_CONTRIBUTE);
    }
    $newParams = CRM_Contact_BAO_Query::convertFormValues($inputParams);
    $query = new CRM_Contact_BAO_Query($newParams, $returnProperties, NULL, FALSE, FALSE, CRM_Contact_BAO_Query::MODE_CONTRIBUTE);
    list($select, $from, $where, $having) = $query->query();
    $sql = "{$select} {$from} {$where} {$having}";
    if (!empty($sort)) {
        $sql .= " ORDER BY {$sort} ";
    }
    $sql .= " LIMIT {$offset}, {$rowCount} ";
    $dao = CRM_Core_DAO::executeQuery($sql);
    $contribution = array();
    while ($dao->fetch()) {
        //CRM-8662
        $contribution_details = $query->store($dao);
        $softContribution = CRM_Contribute_BAO_ContributionSoft::getSoftContribution($dao->contribution_id, TRUE);
        $contribution[$dao->contribution_id] = array_merge($contribution_details, $softContribution);
        if (isset($contribution[$dao->contribution_id]['financial_type_id'])) {
            $contribution[$dao->contribution_id]['financial_type_id'] = $contribution[$dao->contribution_id]['financial_type_id'];
        }
        // format soft credit for backward compatibility
        _civicrm_api3_format_soft_credit($contribution[$dao->contribution_id]);
    }
    return civicrm_api3_create_success($contribution, $params, 'contribution', 'get', $dao);
}
开发者ID:archcidburnziso,项目名称:civicrm-core,代码行数:49,代码来源:Contribution.php

示例9: civicrm_api3_participant_get

/**
 * 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
 * {@getfields participant_get}
 * @access public
 */
function civicrm_api3_participant_get($params)
{
    $options = _civicrm_api3_get_options_from_params($params, TRUE, 'participant', 'get');
    $sort = CRM_Utils_Array::value('sort', $options, NULL);
    $offset = CRM_Utils_Array::value('offset', $options);
    $rowCount = CRM_Utils_Array::value('limit', $options);
    $smartGroupCache = CRM_Utils_Array::value('smartGroupCache', $params);
    $inputParams = CRM_Utils_Array::value('input_params', $options, array());
    $returnProperties = CRM_Utils_Array::value('return', $options, NULL);
    if (empty($returnProperties)) {
        $returnProperties = CRM_Event_BAO_Query::defaultReturnProperties(CRM_Contact_BAO_Query::MODE_EVENT);
    }
    $newParams = CRM_Contact_BAO_Query::convertFormValues($inputParams);
    $query = new CRM_Contact_BAO_Query($newParams, $returnProperties, NULL, FALSE, FALSE, CRM_Contact_BAO_Query::MODE_EVENT);
    list($select, $from, $where, $having) = $query->query();
    $sql = "{$select} {$from} {$where} {$having}";
    if (!empty($sort)) {
        $sql .= " ORDER BY {$sort} ";
    }
    $sql .= " LIMIT {$offset}, {$rowCount} ";
    $dao = CRM_Core_DAO::executeQuery($sql);
    $participant = array();
    while ($dao->fetch()) {
        $participant[$dao->participant_id] = $query->store($dao);
        _civicrm_api3_custom_data_get($participant[$dao->participant_id], 'Participant', $dao->participant_id, NULL);
    }
    return civicrm_api3_create_success($participant, $params, 'participant', 'get', $dao);
}
开发者ID:archcidburnziso,项目名称:civicrm-core,代码行数:39,代码来源:Participant.php

示例10: array

/**
 * Get contact participant record.
 *
 * This api is used for finding an existing participant record.
 *
 * @param  array  $params     an associative array of name/value property values of civicrm_participant
 *
 * @return  participant property values.
 * @access public
 */
function &civicrm_participant_search(&$params)
{
    if (!is_array($params)) {
        return civicrm_create_error('Params need to be of type array!');
    }
    $inputParams = array();
    $returnProperties = array();
    $otherVars = array('sort', 'offset', 'rowCount');
    $sort = NULL;
    $offset = 0;
    $rowCount = 25;
    foreach ($params as $n => $v) {
        if (substr($n, 0, 7) == 'return.') {
            $returnProperties[substr($n, 7)] = $v;
        } elseif (in_array($n, $otherVars)) {
            ${$n} = $v;
        } else {
            $inputParams[$n] = $v;
        }
    }
    // add is_test to the clause if not present
    if (!array_key_exists('participant_test', $inputParams)) {
        $inputParams['participant_test'] = 0;
    }
    require_once 'CRM/Contact/BAO/Query.php';
    require_once 'CRM/Event/BAO/Query.php';
    if (empty($returnProperties)) {
        $returnProperties = CRM_Event_BAO_Query::defaultReturnProperties(CRM_Contact_BAO_Query::MODE_EVENT);
    }
    $newParams = CRM_Contact_BAO_Query::convertFormValues($params);
    $query = new CRM_Contact_BAO_Query($newParams, $returnProperties, NULL);
    list($select, $from, $where, $having) = $query->query();
    $sql = "{$select} {$from} {$where} {$having}";
    if (!empty($sort)) {
        $sql .= " ORDER BY {$sort} ";
    }
    $sql .= " LIMIT {$offset}, {$rowCount} ";
    $dao = CRM_Core_DAO::executeQuery($sql, CRM_Core_DAO::$_nullArray);
    $participant = array();
    while ($dao->fetch()) {
        $participant[$dao->participant_id] = $query->store($dao);
    }
    $dao->free();
    return $participant;
}
开发者ID:peteainsworth,项目名称:civicrm-4.2.9-drupal,代码行数:55,代码来源:Participant.php

示例11: array


//.........这里部分代码省略.........
            $returnProperties[ substr( $n, 7 ) ] = $v;
        } elseif ( in_array ( $n, $otherVars ) ) {
            $$n = $v;
        } else {
            $inputParams[$n] = $v;
        }
    }

    $pcpBlock = CRM_Utils_Array::value( 'pcpBlock', $params, TRUE );
	
    require_once 'CRM/Contribute/BAO/Query.php';
    require_once 'CRM/Contact/BAO/Query.php'; 
    
	if ( empty( $returnProperties ) ) {
		if ( $pcpBlock ) {
			$returnProperties = array(
									'id' 					=> 1,
									'entity_table'  		=> 1,
									'supporter_profile_id'  => 1,
									'is_approval_needed'    => 1,
									'is_tellfriend_enabled' => 1,
									'tellfriend_limit'      => 1,
									'link_text'             => 1,
									'is_active'             => 1,
									'notify_email'          => 1
								);			
		} else {
			$returnProperties = array(  
									'id'                    => 1,
									'contact_id'            => 1,
									'title'                 => 1,
									'intro_text'            => 1,
									'page_text'             => 1,
									'donate_link_text'      => 1,
									'contribution_page_id'  => 1,
									'is_thermometer'        => 1,
									'is_honor_roll'         => 1,
									'goal_amount'           => 1,
									'referer'               => 1,
									'is_active'             => 1,
									'currency'              => 1
								);			
		}
	}

    $newParams =& CRM_Contact_BAO_Query::convertFormValues( $params);
    $query = new CRM_Contact_BAO_Query( $newParams, $returnProperties, null );
	
	// I'm having a problem understanding how this part works, so I'm just working around it for now...
	/*
    list( $select, $from, $where ) = $query->query( );
    
    $sql = "$select $from $where";  
	*/
	$where = '';
	
	$query->_element = array_merge($query->_element, $returnProperties);
	if ( !$pcpBlock ) {
		$key = 'id';
		$sql = "select * from civicrm_pcp";
		
/*
		if( CRM_Utils_Array::value( 'id', $params) ) {
			$sql .= " where id=" . mysql_real_escape_string($params['id']);
		}
*/
		foreach($params as $tmp_key => $value) {
			if(isset($returnProperties[$tmp_key])) {
				$where.= sprintf(" and %s='%s'", mysql_real_escape_string($tmp_key), mysql_real_escape_string($value));
			}
		}
	} else {
		$key = 'entity_id';
		$sql = "select * from civicrm_pcp_block";
		if( CRM_Utils_Array::value( 'entity_id', $params) ) {
			$sql .= " where entity_id=" . mysql_real_escape_string($params['entity_id']);
		}
	}
	if(!empty($where)) {
		$sql .= " where " . substr($where, 4);
	}
	// end work around
	
	if ( ! empty( $sort ) ) {
        $sql .= " ORDER BY $sort ";
    }

    $sql .= " LIMIT $offset, $rowCount ";
    $dao =& CRM_Core_DAO::executeQuery( $sql, CRM_Core_DAO::$_nullArray );
    
    $pcp = array( );
    while ( $dao->fetch( ) ) {
		$pcp[$dao->$key] = $query->store( $dao );
    }

    $dao->free( );

    return $pcp;

}
开发者ID:ryanrd,项目名称:DW-Campaigns,代码行数:101,代码来源:PCP.php

示例12: ts

/**
 * Retrieve a set of contributions, given a set of input params
 *
 * @param  array   $params           (reference ) input parameters
 * @param array    $returnProperties Which properties should be included in the
 *                                   returned Contribution object. If NULL, the default
 *                                   set of properties will be included.
 *
 * @return array (reference )        array of contributions, if error an array with an error id and error message
 * @static void
 * @access public
 */
function &civicrm_contribution_search( &$params ) {
    _civicrm_initialize( );

    if ( ! is_array( $params ) ) {
        return civicrm_create_error( ts( 'Input parameters is not an array' ) );
    }

    $inputParams      = array( );
    $returnProperties = array( );
    $otherVars = array( 'sort', 'offset', 'rowCount' );
    
    $sort     = null;
    $offset   = 0;
    $rowCount = 25;
    foreach ( $params as $n => $v ) {
        if ( substr( $n, 0, 7 ) == 'return.' ) {
            $returnProperties[ substr( $n, 7 ) ] = $v;
        } elseif ( in_array( $n, $otherVars ) ) {
            $$n = $v;
        } else {
            $inputParams[$n] = $v;
        }
    }
    
    // add is_test to the clause if not present
    if ( ! array_key_exists( 'contribution_test', $inputParams ) ) {
        $inputParams['contribution_test'] = 0;
    }

    require_once 'CRM/Contribute/BAO/Query.php';
    require_once 'CRM/Contact/BAO/Query.php';
    if ( empty( $returnProperties ) ) {
        $returnProperties = CRM_Contribute_BAO_Query::defaultReturnProperties( CRM_Contact_BAO_Query::MODE_CONTRIBUTE );
    }
    
    $newParams =& CRM_Contact_BAO_Query::convertFormValues( $inputParams );

    $query = new CRM_Contact_BAO_Query( $newParams, $returnProperties, null );
    
    list( $select, $from, $where ) = $query->query( );
    
    $sql = "$select $from $where";  

    if ( ! empty( $sort ) ) {
        $sql .= " ORDER BY $sort ";
    }
    $sql .= " LIMIT $offset, $rowCount ";
    $dao =& CRM_Core_DAO::executeQuery( $sql );
    
    $contribution = array( );
    while ( $dao->fetch( ) ) {
        $contribution[$dao->contribution_id] = $query->store( $dao );
    }
    $dao->free( );
    
    return $contribution;
}
开发者ID:ryanrd,项目名称:DW-Campaigns,代码行数:69,代码来源:Contribution.php


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