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


PHP CRM_Core_DAO_Email::fields方法代码示例

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


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

示例1: testHook

 /**
  * Ensure that hook_civicrm_entityTypes runs and correctly handles the
  * 'fields_callback' option.
  */
 public function testHook()
 {
     // 1. First, check the baseline fields()...
     $fields = CRM_Core_DAO_Email::fields();
     $this->assertFalse(isset($fields['location_type_id']['foo']));
     $exports = CRM_Core_DAO_Email::export();
     $this->assertFalse(isset($exports['contact_id']));
     // 2. Now, let's hook into it...
     $this->hookClass->setHook('civicrm_entityTypes', array($this, '_hook_civicrm_entityTypes'));
     unset(Civi::$statics['CRM_Core_DAO_Email']);
     CRM_Core_DAO_AllCoreTables::init(1);
     // 3. And see if the data has changed...
     $fields = CRM_Core_DAO_Email::fields();
     $this->assertEquals('bar', $fields['location_type_id']['foo']);
     $exports = CRM_Core_DAO_Email::export();
     $this->assertTrue(is_array($exports['contact_id']));
 }
开发者ID:nielosz,项目名称:civicrm-core,代码行数:21,代码来源:AllCoreTablesTest.php

示例2: _crm_add_formatted_param

/**
 * This function adds the contact variable in $values to the
 * parameter list $params.  For most cases, $values should have length 1.  If
 * the variable being added is a child of Location, a location_type_id must
 * also be included.  If it is a child of phone, a phone_type must be included.
 *
 * @param array  $values    The variable(s) to be added
 * @param array  $params    The structured parameter list
 * 
 * @return bool|CRM_Utils_Error
 * @access public
 */
function _crm_add_formatted_param(&$values, &$params)
{
    /* Crawl through the possible classes: 
     * Contact 
     *      Individual 
     *      Household
     *      Organization
     *          Location 
     *              Address 
     *              Email 
     *              Phone 
     *              IM 
     *      Note
     *      Custom 
     */
    /* Cache the various object fields */
    static $fields = null;
    if ($fields == null) {
        $fields = array();
    }
    if (isset($values['contact_type'])) {
        /* we're an individual/household/org property */
        if (!isset($fields[$values['contact_type']])) {
            require_once str_replace('_', DIRECTORY_SEPARATOR, 'CRM_Contact_DAO_' . $values['contact_type']) . '.php';
            eval('$fields[' . $values['contact_type'] . '] =& 
                    CRM_Contact_DAO_' . $values['contact_type'] . '::fields();');
        }
        _crm_store_values($fields[$values['contact_type']], $values, $params);
        return true;
    }
    if (isset($values['individual_prefix'])) {
        $params['prefix'] = $values['individual_prefix'];
        return true;
    }
    if (isset($values['individual_suffix'])) {
        $params['suffix'] = $values['individual_suffix'];
        return true;
    }
    if (isset($values['gender'])) {
        $params['gender'] = $values['gender'];
        return true;
    }
    if (isset($values['location_type_id'])) {
        /* find and/or initialize the correct location block in $params */
        $locBlock = null;
        if (!isset($params['location'])) {
            /* if we don't have a location field yet, make one */
            $locBlock = 1;
            $params['location'][$locBlock] = array('location_type_id' => $values['location_type_id'], 'is_primary' => true);
        } else {
            /* search through the location array for a matching loc. type */
            foreach ($params['location'] as $key => $loc) {
                if ($loc['location_type_id'] == $values['location_type_id']) {
                    $locBlock = $key;
                }
            }
            /* if no locBlock has the correct type, make a new one */
            if ($locBlock == null) {
                $locBlock = count($params['location']) + 1;
                $params['location'][$locBlock] = array('location_type_id' => $values['location_type_id']);
            }
        }
        //add location name
        if (isset($values['name'])) {
            $params['location'][$locBlock]['name'] = $values['name'];
        }
        /* if this is a phone value, find or create the correct block */
        if (isset($values['phone'])) {
            if (!isset($params['location'][$locBlock]['phone'])) {
                /* if we don't have a phone array yet, make one */
                $params['location'][$locBlock]['phone'] = array();
            }
            /* add a new phone block to the array */
            $phoneBlock = count($params['location'][$locBlock]['phone']) + 1;
            $params['location'][$locBlock]['phone'][$phoneBlock] = array();
            if (!isset($fields['Phone'])) {
                $fields['Phone'] = CRM_Core_DAO_Phone::fields();
            }
            _crm_store_values($fields['Phone'], $values, $params['location'][$locBlock]['phone'][$phoneBlock]);
            if ($phoneBlock == 1) {
                $params['location'][$locBlock]['phone'][$phoneBlock]['is_primary'] = true;
            }
            return true;
        }
        /* If this is an email value, create a new block to store it */
        if (isset($values['email'])) {
            if (!isset($params['location'][$locBlock]['email'])) {
                $params['location'][$locBlock]['email'] = array();
//.........这里部分代码省略.........
开发者ID:bhirsch,项目名称:voipdrupal-4.7-1.0,代码行数:101,代码来源:utils.php

示例3: array

 /**
  * returns the list of fields that can be exported
  *
  * @access public
  * return array
  */
 function &export($prefix = false)
 {
     if (!$GLOBALS['_CRM_CORE_DAO_EMAIL']['_export']) {
         $GLOBALS['_CRM_CORE_DAO_EMAIL']['_export'] = array();
         $fields =& CRM_Core_DAO_Email::fields();
         foreach ($fields as $name => $field) {
             if (CRM_Utils_Array::value('export', $field)) {
                 if ($prefix) {
                     $GLOBALS['_CRM_CORE_DAO_EMAIL']['_export']['email'] =& $fields[$name];
                 } else {
                     $GLOBALS['_CRM_CORE_DAO_EMAIL']['_export'][$name] =& $fields[$name];
                 }
             }
         }
     }
     return $GLOBALS['_CRM_CORE_DAO_EMAIL']['_export'];
 }
开发者ID:bhirsch,项目名称:voipdrupal-4.7-1.0,代码行数:23,代码来源:Email.php


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