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


PHP CRM_Core_DAO::fields方法代码示例

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


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

示例1: _civicrm_api3_get_unique_name_array

/**
 * Build fields array.
 *
 * This is the array of fields as it relates to the given DAO
 * returns unique fields as keys by default but if set but can return by DB fields
 *
 * @param CRM_Core_DAO $bao
 *
 * @return array
 */
function _civicrm_api3_get_unique_name_array(&$bao)
{
    $fields = $bao->fields();
    foreach ($fields as $field => $values) {
        $uniqueFields[$field] = CRM_Utils_Array::value('name', $values, $field);
    }
    return $uniqueFields;
}
开发者ID:sugan2111,项目名称:Drupal_code,代码行数:18,代码来源:utils.php

示例2: copyData

 /**
  * @param CRM_Core_DAO $dao
  * @param $xml
  * @param bool $save
  * @param null $keyName
  *
  * @return bool
  */
 public function copyData(&$dao, &$xml, $save = FALSE, $keyName = NULL)
 {
     if ($keyName) {
         if (isset($xml->{$keyName})) {
             $dao->{$keyName} = (string) $xml->{$keyName};
             if ($dao->find(TRUE)) {
                 CRM_Core_Session::setStatus(ts("Found %1, %2, %3", array(1 => $keyName, 2 => $dao->{$keyName}, 3 => $dao->__table)), '', 'info');
                 return FALSE;
             }
         }
     }
     $fields =& $dao->fields();
     foreach ($fields as $name => $dontCare) {
         if (isset($xml->{$name})) {
             $value = (string) $xml->{$name};
             $value = str_replace(CRM_Utils_Migrate_Export::XML_VALUE_SEPARATOR, CRM_Core_DAO::VALUE_SEPARATOR, $value);
             $dao->{$name} = $value;
         }
     }
     if ($save) {
         $dao->save();
     }
     return TRUE;
 }
开发者ID:kidaa30,项目名称:yes,代码行数:32,代码来源:Import.php

示例3: exportDAO

 /**
  * @param string $objectName
  *   Business-entity/xml-tag name.
  * @param CRM_Core_DAO $object
  * @param $mappedFields
  *
  * @return array
  */
 public function exportDAO($objectName, $object, $mappedFields)
 {
     $dbFields =& $object->fields();
     // Filter the list of keys and values so that we only export interesting stuff
     $keyValues = array();
     foreach ($dbFields as $name => $dontCare) {
         // ignore all ids
         if ($name == 'id' || substr($name, -3, 3) == '_id') {
             continue;
         }
         if (isset($object->{$name}) && $object->{$name} !== NULL) {
             // hack for extends_entity_column_value
             if ($name == 'extends_entity_column_value') {
                 if (in_array($object->extends, array('Event', 'Activity', 'Relationship', 'Individual', 'Organization', 'Household', 'Case'))) {
                     if ($object->extends == 'Event') {
                         $key = 'event_type';
                     } elseif ($object->extends == 'Activity') {
                         $key = 'activity_type';
                     } elseif ($object->extends == 'Relationship') {
                         $key = 'relationship_type';
                     } elseif ($object->extends == 'Case') {
                         $key = 'case_type';
                     }
                     $types = explode(CRM_Core_DAO::VALUE_SEPARATOR, substr($object->{$name}, 1, -1));
                     $values = array();
                     if (in_array($object->extends, array('Individual', 'Organization', 'Household'))) {
                         $key = 'contact_type';
                         $values = $types;
                     } else {
                         foreach ($types as $type) {
                             if (in_array($key, array('activity_type', 'event_type', 'case_type'))) {
                                 $ogID = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_OptionGroup', $key, 'id', 'name');
                                 $ovParams = array('option_group_id' => $ogID, 'value' => $type);
                                 CRM_Core_BAO_OptionValue::retrieve($ovParams, $oValue);
                                 $values[] = $oValue['name'];
                             } else {
                                 $relTypeName = CRM_Core_DAO::getFieldValue('CRM_Contact_BAO_RelationshipType', $type, 'name_a_b', 'id');
                                 $values[] = $relTypeName;
                             }
                         }
                     }
                     $keyValues['extends_entity_column_value_option_group'] = $key;
                     $value = implode(',', $values);
                     $object->extends_entity_column_value = $value;
                 } else {
                     echo "This extension: {$object->extends} is not yet handled";
                     exit;
                 }
             }
             $value = $object->{$name};
             if ($name == 'field_name') {
                 // hack for profile field_name
                 if (substr($value, 0, 7) == 'custom_') {
                     $cfID = substr($value, 7);
                     list($tableName, $columnName, $groupID) = CRM_Core_BAO_CustomField::getTableColumnGroup($cfID);
                     $value = "custom.{$tableName}.{$columnName}";
                 }
             }
             $keyValues[$name] = $value;
         }
     }
     $keyValues += $this->computeMappedFields($mappedFields, $object);
     return $keyValues;
 }
开发者ID:rameshrr99,项目名称:civicrm-core,代码行数:72,代码来源:Export.php


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