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


PHP CRM_Core_BAO_CustomField::isMultiRecordField方法代码示例

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


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

示例1: checkIsMultiRecord

 /**
  * Function the check whether the field belongs.
  * to multi-record custom set
  */
 public function checkIsMultiRecord()
 {
     $customId = $_GET['customId'];
     $isMultiple = CRM_Core_BAO_CustomField::isMultiRecordField($customId);
     $isMultiple = array('is_multi' => $isMultiple);
     CRM_Utils_JSON::output($isMultiple);
 }
开发者ID:nielosz,项目名称:civicrm-core,代码行数:11,代码来源:AJAX.php

示例2: checkIsMultiRecord

 /**
  * Function the check whether the field belongs
  * to multi-record custom set
  */
 function checkIsMultiRecord()
 {
     $customId = $_GET['customId'];
     $isMultiple = CRM_Core_BAO_CustomField::isMultiRecordField($customId);
     $isMultiple = array('is_multi' => $isMultiple);
     echo json_encode($isMultiple);
     CRM_Utils_System::civiExit();
 }
开发者ID:hguru,项目名称:224Civi,代码行数:12,代码来源:AJAX.php

示例3: checkMultiRecordFieldExists

 /**
  * Does profile consists of a multi-record custom field
  */
 public static function checkMultiRecordFieldExists($gId)
 {
     $queryString = "SELECT f.field_name\n                        FROM   civicrm_uf_field f, civicrm_uf_group g\n                        WHERE  f.uf_group_id = g.id\n                          AND  g.id = %1 AND f.field_name LIKE 'custom%'";
     $p = array(1 => array($gId, 'Integer'));
     $dao = CRM_Core_DAO::executeQuery($queryString, $p);
     $customFieldIds = array();
     $isMultiRecordFieldPresent = FALSE;
     while ($dao->fetch()) {
         if ($customId = CRM_Core_BAO_CustomField::getKeyID($dao->field_name)) {
             if (is_numeric($customId)) {
                 $customFieldIds[] = $customId;
             }
         }
     }
     if (!empty($customFieldIds) && count($customFieldIds) == 1) {
         $customFieldId = array_pop($customFieldIds);
         $isMultiRecordFieldPresent = CRM_Core_BAO_CustomField::isMultiRecordField($customFieldId);
     } elseif (count($customFieldIds) > 1) {
         $customFieldIds = implode(", ", $customFieldIds);
         $queryString = "\n      SELECT cg.id as cgId\n FROM civicrm_custom_group cg\n INNER JOIN civicrm_custom_field cf\n ON cg.id = cf.custom_group_id\nWHERE cf.id IN (" . $customFieldIds . ") AND is_multiple = 1 LIMIT 0,1";
         $dao = CRM_Core_DAO::executeQuery($queryString);
         if ($dao->fetch()) {
             $isMultiRecordFieldPresent = $dao->cgId ? $dao->cgId : FALSE;
         }
     }
     return $isMultiRecordFieldPresent;
 }
开发者ID:kidaa30,项目名称:yes,代码行数:30,代码来源:UFField.php

示例4: shiftMultiRecordFields

 /**
  * @todo what do I do?
  * @param $source
  * @param $destination
  * @param bool $returnMultiSummaryFields
  *
  * @return array|null
  */
 public static function shiftMultiRecordFields(&$source, &$destination, $returnMultiSummaryFields = FALSE)
 {
     $multiSummaryFields = $returnMultiSummaryFields ? array() : NULL;
     foreach ($source as $field => $properties) {
         if (!CRM_Core_BAO_CustomField::getKeyID($field)) {
             continue;
         }
         if (CRM_Core_BAO_CustomField::isMultiRecordField($field)) {
             $destination[$field] = $properties;
             if ($returnMultiSummaryFields) {
                 if ($properties['is_multi_summary']) {
                     $multiSummaryFields[$field] = $properties;
                 }
             }
             unset($source[$field]);
         }
     }
     return $multiSummaryFields;
 }
开发者ID:rollox,项目名称:civicrm-core,代码行数:27,代码来源:UFGroup.php

示例5: setMultiRecordTableName

 /**
  *  set the _multiRecordTableName to display the result set
  *  according to multi record custom field values
  */
 function setMultiRecordTableName($fields)
 {
     $customGroupId = $multiRecordTableName = NULL;
     $selectorSet = FALSE;
     foreach ($fields as $field => $properties) {
         if (!CRM_Core_BAO_CustomField::getKeyID($field)) {
             continue;
         }
         if ($cgId = CRM_Core_BAO_CustomField::isMultiRecordField($field)) {
             $customGroupId = CRM_Utils_System::isNull($customGroupId) ? $cgId : $customGroupId;
             //if the field is submitted set multiRecordTableName
             if ($customGroupId) {
                 $isSubmitted = FALSE;
                 foreach ($this->_query->_params as $key => $value) {
                     //check the query params 'where' element
                     if ($value[0] == $field) {
                         $isSubmitted = TRUE;
                         break;
                     }
                 }
                 if ($isSubmitted) {
                     $this->_multiRecordTableName = $multiRecordTableName = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_CustomGroup', $customGroupId, 'table_name');
                     if ($multiRecordTableName) {
                         return;
                     }
                 }
                 if (!empty($properties['in_selector'])) {
                     $selectorSet = TRUE;
                 }
             }
         }
     }
     if (!isset($customGroupId) || !$customGroupId) {
         return;
     }
     //if the field is in selector and not a searchable field
     //get the proper customvalue table name
     if ($selectorSet) {
         $this->_multiRecordTableName = $multiRecordTableName = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_CustomGroup', $customGroupId, 'table_name');
     }
 }
开发者ID:archcidburnziso,项目名称:civicrm-core,代码行数:45,代码来源:Listings.php

示例6: convertCiviModelToBackboneModel

 /**
  * FIXME: Move to somewhere more useful
  * FIXME: Do real mapping of "types"
  *
  * @param string $extends
  *   Entity type; note: "Individual" means "Individual|Contact"; "Household" means "Household|Contact".
  * @param string $title
  *   A string to use in section headers.
  * @param array $availableFields
  *   List of fields that are allowed in profiles, e.g. $availableFields['my_field']['field_type'].
  * @return array
  *   with keys 'sections' and 'schema'
  * @see js/model/crm.core.js
  * @see js/model/crm.mappedcore.js
  */
 public static function convertCiviModelToBackboneModel($extends, $title, $availableFields)
 {
     $locationFields = CRM_Core_BAO_UFGroup::getLocationFields();
     $result = array('schema' => array(), 'sections' => array());
     // build field list
     foreach ($availableFields as $fieldName => $field) {
         switch ($extends) {
             case 'Individual':
             case 'Organization':
             case 'Household':
                 if ($field['field_type'] != $extends && $field['field_type'] != 'Contact' && !in_array($field['field_type'], CRM_Contact_BAO_ContactType::subTypes($extends))) {
                     continue 2;
                 }
                 break;
             default:
                 if ($field['field_type'] != $extends) {
                     continue 2;
                 }
         }
         $result['schema'][$fieldName] = array('type' => 'Text', 'title' => $field['title'], 'civiFieldType' => $field['field_type']);
         if (in_array($fieldName, $locationFields)) {
             $result['schema'][$fieldName]['civiIsLocation'] = TRUE;
         }
         if ($fieldName == 'url') {
             $result['schema'][$fieldName]['civiIsWebsite'] = TRUE;
         }
         if (in_array($fieldName, array('phone', 'phone_and_ext'))) {
             // FIXME what about phone_ext?
             $result['schema'][$fieldName]['civiIsPhone'] = TRUE;
         }
     }
     // build section list
     $result['sections']['default'] = array('title' => $title, 'is_addable' => FALSE);
     $customGroup = CRM_Core_BAO_CustomGroup::getAllCustomGroupsByBaseEntity($extends);
     $customGroup->orderBy('weight');
     $customGroup->is_active = 1;
     $customGroup->find();
     while ($customGroup->fetch()) {
         $sectionName = 'cg_' . $customGroup->id;
         $section = array('title' => ts('%1: %2', array(1 => $title, 2 => $customGroup->title)), 'is_addable' => $customGroup->is_reserved ? FALSE : TRUE, 'custom_group_id' => $customGroup->id, 'extends_entity_column_id' => $customGroup->extends_entity_column_id, 'extends_entity_column_value' => CRM_Utils_Array::explodePadded($customGroup->extends_entity_column_value), 'is_reserved' => $customGroup->is_reserved ? TRUE : FALSE);
         $result['sections'][$sectionName] = $section;
     }
     // put fields in their sections
     $fields = CRM_Core_BAO_CustomField::getFields($extends);
     foreach ($fields as $fieldId => $field) {
         $sectionName = 'cg_' . $field['custom_group_id'];
         $fieldName = 'custom_' . $fieldId;
         if (isset($result['schema'][$fieldName])) {
             $result['schema'][$fieldName]['section'] = $sectionName;
             $result['schema'][$fieldName]['civiIsMultiple'] = (bool) CRM_Core_BAO_CustomField::isMultiRecordField($fieldId);
         }
     }
     return $result;
 }
开发者ID:JSProffitt,项目名称:civicrm-website-org,代码行数:69,代码来源:ProfileEditor.php

示例7: formRule

 /**
  * Global validation rules for the form.
  *
  * @param array $fields
  *   Posted values of the form.
  *
  * @param $files
  * @param $self
  *
  * @return array
  *   list of errors to be posted back to the form
  */
 public static function formRule($fields, $files, $self)
 {
     $is_required = CRM_Utils_Array::value('is_required', $fields, FALSE);
     $is_registration = CRM_Utils_Array::value('is_registration', $fields, FALSE);
     $is_view = CRM_Utils_Array::value('is_view', $fields, FALSE);
     $in_selector = CRM_Utils_Array::value('in_selector', $fields, FALSE);
     $is_active = CRM_Utils_Array::value('is_active', $fields, FALSE);
     $errors = array();
     if ($is_view && $is_registration) {
         $errors['is_registration'] = ts('View Only cannot be selected if this field is to be included on the registration form');
     }
     if ($is_view && $is_required) {
         $errors['is_view'] = ts('A View Only field cannot be required');
     }
     $entityName = $fields['field_name'][0];
     if (!$entityName) {
         $errors['field_name'] = ts('Please select a field name');
     }
     if ($in_selector && in_array($entityName, array('Contribution', 'Participant', 'Membership', 'Activity'))) {
         $errors['in_selector'] = ts("'In Selector' cannot be checked for %1 fields.", array(1 => $entityName));
     }
     $isCustomField = FALSE;
     $profileFieldName = CRM_Utils_Array::value(1, $fields['field_name']);
     if ($profileFieldName) {
         //get custom field id
         $customFieldId = explode('_', $profileFieldName);
         if ($customFieldId[0] == 'custom') {
             $customField = new CRM_Core_DAO_CustomField();
             $customField->id = $customFieldId[1];
             $customField->find(TRUE);
             $isCustomField = TRUE;
             if (!empty($fields['field_id']) && !$customField->is_active && $is_active) {
                 $errors['field_name'] = ts('Cannot set this field "Active" since the selected custom field is disabled.');
             }
             //check if profile already has a different multi-record custom set field configured
             $customGroupId = CRM_Core_BAO_CustomField::isMultiRecordField($profileFieldName);
             if ($customGroupId) {
                 if ($profileMultiRecordCustomGid = CRM_Core_BAO_UFField::checkMultiRecordFieldExists($self->_gid)) {
                     if ($customGroupId != $profileMultiRecordCustomGid) {
                         $errors['field_name'] = ts("You cannot configure multi-record custom fields belonging to different custom sets in one profile");
                     }
                 }
             }
         }
     }
     // Get list of fields already in the group
     $groupFields = CRM_Core_BAO_UFGroup::getFields($fields['group_id'], FALSE, NULL, NULL, NULL, TRUE, NULL, TRUE);
     // Check if we already added a primary field of the same communication type
     self::formRulePrimaryCheck($fields, $profileFieldName, $groupFields, $errors);
     //check profile is configured for double option process
     //adding group field, email field should be present in the group
     //fixed for  issue CRM-2861 & CRM-4153
     if (CRM_Core_BAO_UFGroup::isProfileDoubleOptin()) {
         if (CRM_Utils_Array::value(1, $fields['field_name']) == 'group') {
             $dao = new CRM_Core_BAO_UFField();
             $dao->uf_group_id = $fields['group_id'];
             $dao->find();
             $emailField = FALSE;
             while ($dao->fetch()) {
                 //check email field is present in the group
                 if ($dao->field_name == 'email') {
                     $emailField = TRUE;
                     break;
                 }
             }
             if (!$emailField) {
                 $disableSettingURL = CRM_Utils_System::url('civicrm/admin/setting/preferences/mailing', 'reset=1');
                 $errors['field_name'] = ts('Your site is currently configured to require double-opt in when users join (subscribe) to Group(s) via a Profile form. In this mode, you need to include an Email field in a Profile BEFORE you can add the Group(s) field. This ensures that an opt-in confirmation email can be sent. Your site administrator can disable double opt-in on the civimail admin settings: <em>%1</em>', array(1 => $disableSettingURL));
             }
         }
     }
     //fix for CRM-3037
     $fieldType = $fields['field_name'][0];
     //get the group type.
     $groupType = CRM_Core_BAO_UFGroup::calculateGroupType($self->_gid, FALSE, CRM_Utils_Array::value('field_id', $fields));
     switch ($fieldType) {
         case 'Contact':
             self::formRuleSubType($fieldType, $groupType, $errors);
             break;
         case 'Individual':
             if (in_array('Activity', $groupType) || in_array('Household', $groupType) || in_array('Organization', $groupType)) {
                 //CRM-7603 - need to support activity + individual.
                 //$errors['field_name'] =
                 //ts( 'Cannot add or update profile field type Individual with combination of Household or Organization or Activity' );
                 if (in_array('Household', $groupType) || in_array('Organization', $groupType)) {
                     $errors['field_name'] = ts('Cannot add or update profile field type Individual with combination of Household or Organization');
                 }
             } else {
//.........这里部分代码省略.........
开发者ID:kidaa30,项目名称:yes,代码行数:101,代码来源:Field.php


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