• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP CRM_Core_DAO_Mapping类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: preProcess

 /**
  * Function to build the form
  *
  * @return None
  * @access public
  */
 public function preProcess()
 {
     parent::preProcess();
     $mapping = new CRM_Core_DAO_Mapping();
     $mapping->id = $this->_id;
     $mapping->find(TRUE);
     $this->assign('mappingName', $mapping->name);
 }
开发者ID:peteainsworth,项目名称:civicrm-4.2.9-drupal,代码行数:14,代码来源:Mapping.php


示例2: preProcess

 /**
  * Set variables up before form is built.
  */
 public function preProcess()
 {
     //get the data from the session
     $dataValues = $this->get('dataValues');
     $mapper = $this->get('mapper');
     $invalidRowCount = $this->get('invalidRowCount');
     $conflictRowCount = $this->get('conflictRowCount');
     $mismatchCount = $this->get('unMatchCount');
     $columnNames = $this->get('columnNames');
     $this->_disableUSPS = $this->get('disableUSPS');
     //assign column names
     $this->assign('columnNames', $columnNames);
     //get the mapping name displayed if the mappingId is set
     $mappingId = $this->get('loadMappingId');
     if ($mappingId) {
         $mapDAO = new CRM_Core_DAO_Mapping();
         $mapDAO->id = $mappingId;
         $mapDAO->find(TRUE);
         $this->assign('loadedMapping', $mappingId);
         $this->assign('savedName', $mapDAO->name);
     }
     $this->assign('rowDisplayCount', 2);
     $groups = CRM_Core_PseudoConstant::nestedGroup();
     $this->set('groups', $groups);
     $tag = CRM_Core_PseudoConstant::get('CRM_Core_DAO_EntityTag', 'tag_id', array('onlyActive' => FALSE));
     if ($tag) {
         $this->set('tag', $tag);
     }
     if ($invalidRowCount) {
         $urlParams = 'type=' . CRM_Import_Parser::ERROR . '&parser=CRM_Contact_Import_Parser';
         $this->set('downloadErrorRecordsUrl', CRM_Utils_System::url('civicrm/export', $urlParams));
     }
     if ($conflictRowCount) {
         $urlParams = 'type=' . CRM_Import_Parser::CONFLICT . '&parser=CRM_Contact_Import_Parser';
         $this->set('downloadConflictRecordsUrl', CRM_Utils_System::url('civicrm/export', $urlParams));
     }
     if ($mismatchCount) {
         $urlParams = 'type=' . CRM_Import_Parser::NO_MATCH . '&parser=CRM_Contact_Import_Parser';
         $this->set('downloadMismatchRecordsUrl', CRM_Utils_System::url('civicrm/export', $urlParams));
     }
     $properties = array('mapper', 'locations', 'phones', 'ims', 'dataValues', 'columnCount', 'totalRowCount', 'validRowCount', 'invalidRowCount', 'conflictRowCount', 'downloadErrorRecordsUrl', 'downloadConflictRecordsUrl', 'downloadMismatchRecordsUrl', 'related', 'relatedContactDetails', 'relatedContactLocType', 'relatedContactPhoneType', 'relatedContactImProvider', 'websites', 'relatedContactWebsiteType');
     foreach ($properties as $property) {
         $this->assign($property, $this->get($property));
     }
     $statusID = $this->get('statusID');
     if (!$statusID) {
         $statusID = md5(uniqid(rand(), TRUE));
         $this->set('statusID', $statusID);
     }
     $statusUrl = CRM_Utils_System::url('civicrm/ajax/status', "id={$statusID}", FALSE, NULL, FALSE);
     $this->assign('statusUrl', $statusUrl);
     $showColNames = TRUE;
     if ('CRM_Import_DataSource_CSV' == $this->get('dataSource') && !$this->get('skipColumnHeader')) {
         $showColNames = FALSE;
     }
     $this->assign('showColNames', $showColNames);
 }
开发者ID:nielosz,项目名称:civicrm-core,代码行数:60,代码来源:Preview.php


示例3: preProcess

 /**
  * Set variables up before form is built.
  */
 public function preProcess()
 {
     $skipColumnHeader = $this->controller->exportValue('DataSource', 'skipColumnHeader');
     //get the data from the session
     $dataValues = $this->get('dataValues');
     $mapper = $this->get('mapper');
     $softCreditFields = $this->get('softCreditFields');
     $mapperSoftCreditType = $this->get('mapperSoftCreditType');
     $invalidRowCount = $this->get('invalidRowCount');
     $conflictRowCount = $this->get('conflictRowCount');
     $mismatchCount = $this->get('unMatchCount');
     //get the mapping name displayed if the mappingId is set
     $mappingId = $this->get('loadMappingId');
     if ($mappingId) {
         $mapDAO = new CRM_Core_DAO_Mapping();
         $mapDAO->id = $mappingId;
         $mapDAO->find(TRUE);
         $this->assign('loadedMapping', $mappingId);
         $this->assign('savedName', $mapDAO->name);
     }
     if ($skipColumnHeader) {
         $this->assign('skipColumnHeader', $skipColumnHeader);
         $this->assign('rowDisplayCount', 3);
     } else {
         $this->assign('rowDisplayCount', 2);
     }
     if ($invalidRowCount) {
         $urlParams = 'type=' . CRM_Import_Parser::ERROR . '&parser=CRM_Contribute_Import_Parser';
         $this->set('downloadErrorRecordsUrl', CRM_Utils_System::url('civicrm/export', $urlParams));
     }
     if ($conflictRowCount) {
         $urlParams = 'type=' . CRM_Import_Parser::CONFLICT . '&parser=CRM_Contribute_Import_Parser';
         $this->set('downloadConflictRecordsUrl', CRM_Utils_System::url('civicrm/export', $urlParams));
     }
     if ($mismatchCount) {
         $urlParams = 'type=' . CRM_Import_Parser::NO_MATCH . '&parser=CRM_Contribute_Import_Parser';
         $this->set('downloadMismatchRecordsUrl', CRM_Utils_System::url('civicrm/export', $urlParams));
     }
     $properties = array('mapper', 'softCreditFields', 'mapperSoftCreditType', 'dataValues', 'columnCount', 'totalRowCount', 'validRowCount', 'invalidRowCount', 'conflictRowCount', 'downloadErrorRecordsUrl', 'downloadConflictRecordsUrl', 'downloadMismatchRecordsUrl');
     foreach ($properties as $property) {
         $this->assign($property, $this->get($property));
     }
 }
开发者ID:FundingWorks,项目名称:civicrm-core,代码行数:46,代码来源:Preview.php


示例4: buildQuickForm

 /**
  * Build the form object.
  *
  * @return void
  */
 public function buildQuickForm()
 {
     //to save the current mappings
     if (!$this->get('savedMapping')) {
         $saveDetailsName = ts('Save this field mapping');
         $this->applyFilter('saveMappingName', 'trim');
         $this->add('text', 'saveMappingName', ts('Name'));
         $this->add('text', 'saveMappingDesc', ts('Description'));
     } else {
         $savedMapping = $this->get('savedMapping');
         list($mappingName, $mappingContactType, $mappingLocation, $mappingPhoneType, $mappingRelation) = CRM_Core_BAO_Mapping::getMappingFields($savedMapping);
         $mappingName = $mappingName[1];
         $mappingContactType = $mappingContactType[1];
         $mappingLocation = CRM_Utils_Array::value('1', $mappingLocation);
         $mappingPhoneType = CRM_Utils_Array::value('1', $mappingPhoneType);
         $mappingRelation = CRM_Utils_Array::value('1', $mappingRelation);
         //mapping is to be loaded from database
         $params = array('id' => $savedMapping);
         $temp = array();
         $mappingDetails = CRM_Core_BAO_Mapping::retrieve($params, $temp);
         $this->assign('loadedMapping', $mappingDetails->name);
         $this->set('loadedMapping', $savedMapping);
         $getMappingName = new CRM_Core_DAO_Mapping();
         $getMappingName->id = $savedMapping;
         $getMappingName->mapping_type = 'Import Memberships';
         $getMappingName->find();
         while ($getMappingName->fetch()) {
             $mapperName = $getMappingName->name;
         }
         $this->assign('savedName', $mapperName);
         $this->add('hidden', 'mappingId', $savedMapping);
         $this->addElement('checkbox', 'updateMapping', ts('Update this field mapping'), NULL);
         $saveDetailsName = ts('Save as a new field mapping');
         $this->add('text', 'saveMappingName', ts('Name'));
         $this->add('text', 'saveMappingDesc', ts('Description'));
     }
     $this->addElement('checkbox', 'saveMapping', $saveDetailsName, NULL, array('onclick' => "showSaveDetails(this)"));
     $this->addFormRule(array('CRM_Member_Import_Form_MapField', 'formRule'), $this);
     //-------- end of saved mapping stuff ---------
     $defaults = array();
     $mapperKeys = array_keys($this->_mapperFields);
     $hasHeaders = !empty($this->_columnHeaders);
     $headerPatterns = $this->get('headerPatterns');
     $dataPatterns = $this->get('dataPatterns');
     $hasLocationTypes = $this->get('fieldTypes');
     /* Initialize all field usages to false */
     foreach ($mapperKeys as $key) {
         $this->_fieldUsed[$key] = FALSE;
     }
     $this->_location_types = CRM_Core_PseudoConstant::get('CRM_Core_DAO_Address', 'location_type_id');
     $sel1 = $this->_mapperFields;
     if (!$this->get('onDuplicate')) {
         unset($sel1['id']);
         unset($sel1['membership_id']);
     }
     $sel2[''] = NULL;
     $js = "<script type='text/javascript'>\n";
     $formName = 'document.forms.' . $this->_name;
     //used to warn for mismatch column count or mismatch mapping
     $warning = 0;
     for ($i = 0; $i < $this->_columnCount; $i++) {
         $sel =& $this->addElement('hierselect', "mapper[{$i}]", ts('Mapper for Field %1', array(1 => $i)), NULL);
         $jsSet = FALSE;
         if ($this->get('savedMapping')) {
             if (isset($mappingName[$i])) {
                 if ($mappingName[$i] != ts('- do not import -')) {
                     $mappingHeader = array_keys($this->_mapperFields, $mappingName[$i]);
                     //When locationType is not set
                     $js .= "{$formName}['mapper[{$i}][1]'].style.display = 'none';\n";
                     //When phoneType is not set
                     $js .= "{$formName}['mapper[{$i}][2]'].style.display = 'none';\n";
                     $js .= "{$formName}['mapper[{$i}][3]'].style.display = 'none';\n";
                     $defaults["mapper[{$i}]"] = array($mappingHeader[0]);
                     $jsSet = TRUE;
                 } else {
                     $defaults["mapper[{$i}]"] = array();
                 }
                 if (!$jsSet) {
                     for ($k = 1; $k < 4; $k++) {
                         $js .= "{$formName}['mapper[{$i}][{$k}]'].style.display = 'none';\n";
                     }
                 }
             } else {
                 // this load section to help mapping if we ran out of saved columns when doing Load Mapping
                 $js .= "swapOptions({$formName}, 'mapper[{$i}]', 0, 3, 'hs_mapper_" . $i . "_');\n";
                 if ($hasHeaders) {
                     $defaults["mapper[{$i}]"] = array($this->defaultFromHeader($this->_columnHeaders[$i], $headerPatterns));
                 } else {
                     $defaults["mapper[{$i}]"] = array($this->defaultFromData($dataPatterns, $i));
                 }
             }
             //end of load mapping
         } else {
             $js .= "swapOptions({$formName}, 'mapper[{$i}]', 0, 3, 'hs_mapper_" . $i . "_');\n";
             if ($hasHeaders) {
//.........这里部分代码省略.........
开发者ID:nielosz,项目名称:civicrm-core,代码行数:101,代码来源:MapField.php


示例5: buildQuickForm

 /**
  * Build the form object.
  */
 public function buildQuickForm()
 {
     //to save the current mappings
     if (!$this->get('savedMapping')) {
         $saveDetailsName = ts('Save this field mapping');
         $this->applyFilter('saveMappingName', 'trim');
         $this->add('text', 'saveMappingName', ts('Name'));
         $this->add('text', 'saveMappingDesc', ts('Description'));
     } else {
         $savedMapping = $this->get('savedMapping');
         list($mappingName, $mappingContactType, $mappingLocation, $mappingPhoneType, $mappingRelation) = CRM_Core_BAO_Mapping::getMappingFields($savedMapping);
         $mappingName = $mappingName[1];
         $mappingContactType = $mappingContactType[1];
         $mappingLocation = CRM_Utils_Array::value('1', CRM_Utils_Array::value(1, $mappingLocation));
         $mappingPhoneType = CRM_Utils_Array::value('1', CRM_Utils_Array::value(1, $mappingPhoneType));
         $mappingRelation = CRM_Utils_Array::value('1', CRM_Utils_Array::value(1, $mappingRelation));
         //mapping is to be loaded from database
         $params = array('id' => $savedMapping);
         $temp = array();
         $mappingDetails = CRM_Core_BAO_Mapping::retrieve($params, $temp);
         $this->assign('loadedMapping', $mappingDetails->name);
         $this->set('loadedMapping', $savedMapping);
         $getMappingName = new CRM_Core_DAO_Mapping();
         $getMappingName->id = $savedMapping;
         $getMappingName->mapping_type = 'Import Contributions';
         $getMappingName->find();
         while ($getMappingName->fetch()) {
             $mapperName = $getMappingName->name;
         }
         $this->assign('savedName', $mapperName);
         $this->add('hidden', 'mappingId', $savedMapping);
         $this->addElement('checkbox', 'updateMapping', ts('Update this field mapping'), NULL);
         $saveDetailsName = ts('Save as a new field mapping');
         $this->add('text', 'saveMappingName', ts('Name'));
         $this->add('text', 'saveMappingDesc', ts('Description'));
     }
     $this->addElement('checkbox', 'saveMapping', $saveDetailsName, NULL, array('onclick' => "showSaveDetails(this)"));
     $this->addFormRule(array('CRM_Contribute_Import_Form_MapField', 'formRule'), $this);
     //-------- end of saved mapping stuff ---------
     $defaults = array();
     $mapperKeys = array_keys($this->_mapperFields);
     $hasHeaders = !empty($this->_columnHeaders);
     $headerPatterns = $this->get('headerPatterns');
     $dataPatterns = $this->get('dataPatterns');
     $hasLocationTypes = $this->get('fieldTypes');
     $mapperKeysValues = $this->controller->exportValue($this->_name, 'mapper');
     /* Initialize all field usages to false */
     foreach ($mapperKeys as $key) {
         $this->_fieldUsed[$key] = FALSE;
     }
     $this->_location_types = CRM_Core_PseudoConstant::get('CRM_Core_DAO_Address', 'location_type_id');
     $sel1 = $this->_mapperFields;
     if (!$this->get('onDuplicate')) {
         unset($sel1['id']);
         unset($sel1['contribution_id']);
     }
     // start of soft credit section
     // get contact type for this import
     $contactTypeId = $this->get('contactType');
     $contactTypes = array(CRM_Import_Parser::CONTACT_INDIVIDUAL => 'Individual', CRM_Import_Parser::CONTACT_HOUSEHOLD => 'Household', CRM_Import_Parser::CONTACT_ORGANIZATION => 'Organization');
     $contactType = isset($contactTypes[$contactTypeId]) ? $contactTypes[$contactTypeId] : '';
     // get importable fields for contact type
     $contactFields = CRM_Contact_BAO_Contact::importableFields($contactType, NULL);
     // get the Dedupe rule for this contact type and build soft credit array
     $ruleParams = array('contact_type' => $contactType, 'used' => 'Unsupervised');
     $fieldsArray = CRM_Dedupe_BAO_Rule::dedupeRuleFields($ruleParams);
     $softCreditFields['contact_id'] = ts('Contact ID');
     $softCreditFields['external_identifier'] = ts('External ID');
     $softCreditFields['email'] = ts('Email');
     $sel2['soft_credit'] = $softCreditFields;
     $sel3['soft_credit']['contact_id'] = $sel3['soft_credit']['external_identifier'] = $sel3['soft_credit']['email'] = CRM_Core_OptionGroup::values('soft_credit_type');
     $sel4 = NULL;
     // end of soft credit section
     $js = "<script type='text/javascript'>\n";
     $formName = 'document.forms.' . $this->_name;
     //used to warn for mismatch column count or mismatch mapping
     $warning = 0;
     for ($i = 0; $i < $this->_columnCount; $i++) {
         $sel =& $this->addElement('hierselect', "mapper[{$i}]", ts('Mapper for Field %1', array(1 => $i)), NULL);
         $jsSet = FALSE;
         if ($this->get('savedMapping')) {
             if (isset($mappingName[$i])) {
                 if ($mappingName[$i] != ts('- do not import -')) {
                     $mappingHeader = array_keys($this->_mapperFields, $mappingName[$i]);
                     // reusing contact_type field array for soft credit
                     $softField = isset($mappingContactType[$i]) ? $mappingContactType[$i] : 0;
                     if (!$softField) {
                         $js .= "{$formName}['mapper[{$i}][1]'].style.display = 'none';\n";
                     }
                     $js .= "{$formName}['mapper[{$i}][2]'].style.display = 'none';\n";
                     $js .= "{$formName}['mapper[{$i}][3]'].style.display = 'none';\n";
                     $defaults["mapper[{$i}]"] = array(CRM_Utils_Array::value(0, $mappingHeader), $softField ? $softField : "", isset($locationId) ? $locationId : "", isset($phoneType) ? $phoneType : "");
                     $jsSet = TRUE;
                 } else {
                     $defaults["mapper[{$i}]"] = array();
                 }
                 if (!$jsSet) {
//.........这里部分代码省略.........
开发者ID:FundingWorks,项目名称:civicrm-core,代码行数:101,代码来源:MapField.php


示例6: mappingDelete

 /**
  * Delete a Mapping
  *
  * @param int $mappingId
  */
 public function mappingDelete($mappingId)
 {
     $mapping = new CRM_Core_DAO_Mapping();
     $mapping->id = $mappingId;
     $mapping->delete();
 }
开发者ID:nielosz,项目名称:civicrm-core,代码行数:11,代码来源:CiviUnitTestCase.php


示例7: checkMapping

 /**
  * Check Duplicate Mapping Name.
  *
  * @param string $nameField
  *   mapping Name.
  * @param string $mapTypeId
  *   mapping Type.
  *
  * @return bool
  */
 public static function checkMapping($nameField, $mapTypeId)
 {
     $mapping = new CRM_Core_DAO_Mapping();
     $mapping->name = $nameField;
     $mapping->mapping_type_id = $mapTypeId;
     return (bool) $mapping->find(TRUE);
 }
开发者ID:riyadennis,项目名称:my_civicrm,代码行数:17,代码来源:Mapping.php


示例8: addDisplayEnums

 /**
  * adds $value['foo_display'] for each $value['foo'] enum from civicrm_mapping
  *
  * @param array $values (reference)  the array up for enhancing
  * @return void
  */
 function addDisplayEnums(&$values)
 {
     $enumFields =& CRM_Core_DAO_Mapping::getEnums();
     foreach ($enumFields as $enum) {
         if (isset($values[$enum])) {
             $values[$enum . '_display'] = CRM_Core_DAO_Mapping::tsEnum($enum, $values[$enum]);
         }
     }
 }
开发者ID:bhirsch,项目名称:voipdrupal-4.7-1.0,代码行数:15,代码来源:Mapping.php


示例9: checkMapping

 /**
  *function to check Duplicate Mapping Name
  *
  * @params $nameField  string mapping Name
  *
  * @params $mapTypeId string mapping Type
  *
  * @param $nameField
  * @param $mapTypeId
  *
  * @return boolean
  */
 static function checkMapping($nameField, $mapTypeId)
 {
     $mapping = new CRM_Core_DAO_Mapping();
     $mapping->name = $nameField;
     $mapping->mapping_type_id = $mapTypeId;
     if ($mapping->find(TRUE)) {
         return TRUE;
     } else {
         return FALSE;
     }
 }
开发者ID:prashantgajare,项目名称:civicrm-core,代码行数:23,代码来源:Mapping.php


示例10: checkMapping

 /**
  *function to check Duplicate Mapping Name
  *
  * @params $nameField  string mapping Name
  *
  * @params $mapTypeId string mapping Type
  *
  * @return boolean
  * 
  */
 static function checkMapping($nameField, $mapTypeId)
 {
     $mapping = new CRM_Core_DAO_Mapping();
     $mapping->name = $nameField;
     $mapping->mapping_type_id = $mapTypeId;
     if ($mapping->find(true)) {
         return true;
     } else {
         return false;
     }
 }
开发者ID:hampelm,项目名称:Ginsberg-CiviDemo,代码行数:21,代码来源:Mapping.php


示例11: array

 /**
  * returns the list of fields that can be exported
  *
  * @access public
  * return array
  * @static
  */
 static function &export($prefix = false)
 {
     if (!self::$_export) {
         self::$_export = array();
         $fields = self::fields();
         foreach ($fields as $name => $field) {
             if (CRM_Utils_Array::value('export', $field)) {
                 if ($prefix) {
                     self::$_export['mapping'] =& $fields[$name];
                 } else {
                     self::$_export[$name] =& $fields[$name];
                 }
             }
         }
     }
     return self::$_export;
 }
开发者ID:peteainsworth,项目名称:civicrm-4.2.9-drupal,代码行数:24,代码来源:Mapping.php


示例12:

 /**
  * class constructor
  */
 function __construct()
 {
     parent::__construct();
 }
开发者ID:bhirsch,项目名称:voipdev,代码行数:7,代码来源:Mapping.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP CRM_Core_DAO_Note类代码示例发布时间:2022-05-20
下一篇:
PHP CRM_Core_DAO_Email类代码示例发布时间:2022-05-20
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap