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


PHP CRM_Core_BAO_UFField::getAvailableFieldsFlat方法代码示例

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


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

示例1: getSchema

 /**
  * Get a list of Backbone-Form models
  *
  * @param array $entityTypes model names ("IndividualModel")
  * @return array; keys are model names ("IndividualModel") and values describe 'sections' and 'schema'
  * @see js/model/crm.core.js
  * @see js/model/crm.mappedcore.js
  */
 static function getSchema($entityTypes)
 {
     // FIXME: Depending on context (eg civicrm/profile/create vs search-columns), it may be appropriate to
     // pick importable or exportable fields
     $entityTypes = array_unique($entityTypes);
     $availableFields = NULL;
     foreach ($entityTypes as $entityType) {
         if (!$availableFields) {
             $availableFields = CRM_Core_BAO_UFField::getAvailableFieldsFlat();
             //dpm($availableFields);
         }
         switch ($entityType) {
             case 'IndividualModel':
                 $civiSchema[$entityType] = self::convertCiviModelToBackboneModel('Individual', ts('Individual'), $availableFields);
                 break;
             case 'ActivityModel':
                 $civiSchema[$entityType] = self::convertCiviModelToBackboneModel('Activity', ts('Activity'), $availableFields);
                 break;
             case 'ContributionModel':
                 $civiSchema[$entityType] = self::convertCiviModelToBackboneModel('Contribution', ts('Contribution'), $availableFields);
                 break;
             case 'MembershipModel':
                 $civiSchema[$entityType] = self::convertCiviModelToBackboneModel('Membership', ts('Membership'), $availableFields);
                 break;
             case 'ParticipantModel':
                 $civiSchema[$entityType] = self::convertCiviModelToBackboneModel('Participant', ts('Participant'), $availableFields);
                 break;
             default:
                 throw new CRM_Core_Exception("Unrecognized entity type: {$entityType}");
         }
     }
     return $civiSchema;
 }
开发者ID:TheCraftyCanvas,项目名称:aegir-platforms,代码行数:41,代码来源:ProfileEditor.php

示例2: getSchema

 /**
  * Get a list of Backbone-Form models
  *
  * @param array $entityTypes
  *   Model names ("IndividualModel").
  *
  * @throws CRM_Core_Exception
  * @return array; keys are model names ("IndividualModel") and values describe 'sections' and 'schema'
  * @see js/model/crm.core.js
  * @see js/model/crm.mappedcore.js
  */
 public static function getSchema($entityTypes)
 {
     // FIXME: Depending on context (eg civicrm/profile/create vs search-columns), it may be appropriate to
     // pick importable or exportable fields
     $entityTypes = array_unique($entityTypes);
     $availableFields = NULL;
     $civiSchema = array();
     foreach ($entityTypes as $entityType) {
         if (!$availableFields) {
             $availableFields = CRM_Core_BAO_UFField::getAvailableFieldsFlat();
         }
         switch ($entityType) {
             case 'IndividualModel':
                 $civiSchema[$entityType] = self::convertCiviModelToBackboneModel('Individual', ts('Individual'), $availableFields);
                 break;
             case 'OrganizationModel':
                 $civiSchema[$entityType] = self::convertCiviModelToBackboneModel('Organization', ts('Organization'), $availableFields);
                 break;
             case 'HouseholdModel':
                 $civiSchema[$entityType] = self::convertCiviModelToBackboneModel('Household', ts('Household'), $availableFields);
                 break;
             case 'ActivityModel':
                 $civiSchema[$entityType] = self::convertCiviModelToBackboneModel('Activity', ts('Activity'), $availableFields);
                 break;
             case 'ContributionModel':
                 $civiSchema[$entityType] = self::convertCiviModelToBackboneModel('Contribution', ts('Contribution'), $availableFields);
                 break;
             case 'MembershipModel':
                 $civiSchema[$entityType] = self::convertCiviModelToBackboneModel('Membership', ts('Membership'), $availableFields);
                 break;
             case 'ParticipantModel':
                 $civiSchema[$entityType] = self::convertCiviModelToBackboneModel('Participant', ts('Participant'), $availableFields);
                 break;
             case 'CaseModel':
                 $civiSchema[$entityType] = self::convertCiviModelToBackboneModel('Case', ts('Case'), $availableFields);
                 break;
             default:
                 throw new CRM_Core_Exception("Unrecognized entity type: {$entityType}");
         }
     }
     // Adding the oddball "formatting" field here because there's no other place to put it
     foreach (array('Individual', 'Organization', 'Household') as $type) {
         if (isset($civiSchema[$type . 'Model'])) {
             $civiSchema[$type . 'Model']['schema'] += array('formatting' => array('type' => 'Markup', 'title' => ts('Free HTML'), 'civiFieldType' => 'Formatting', 'section' => 'formatting'));
             $civiSchema[$type . 'Model']['sections'] += array('formatting' => array('title' => ts('Formatting'), 'is_addable' => FALSE));
         }
     }
     return $civiSchema;
 }
开发者ID:rajeshrhino,项目名称:civicrm-core,代码行数:60,代码来源:ProfileEditor.php

示例3: _civicrm_api3_custom_field_flush_static_caches

/**
 * Flush static caches in functions that might have stored available custom fields
 */
function _civicrm_api3_custom_field_flush_static_caches()
{
    civicrm_api('custom_field', 'getfields', array('version' => 3, 'cache_clear' => 1));
    CRM_Core_BAO_UFField::getAvailableFieldsFlat(TRUE);
}
开发者ID:prashantgajare,项目名称:civicrm-core,代码行数:8,代码来源:CustomField.php

示例4: isValidFieldName

 /**
  * Determine whether the given field_name is valid.
  *
  * @param string $fieldName
  * @return bool
  */
 public static function isValidFieldName($fieldName)
 {
     $availableFields = CRM_Core_BAO_UFField::getAvailableFieldsFlat();
     return isset($availableFields[$fieldName]);
 }
开发者ID:kidaa30,项目名称:yes,代码行数:11,代码来源:UFField.php

示例5: testGetAvailableFlat

 /**
  * When omitting a GID, return a list of all fields.
  */
 public function testGetAvailableFlat()
 {
     $fields = CRM_Core_BAO_UFField::getAvailableFieldsFlat();
     // Make sure that each entity appears with at least one field
     $this->assertEquals('Contact', $fields['do_not_sms']['field_type']);
     $this->assertEquals('Contact', $fields['city']['field_type']);
     $this->assertEquals('Individual', $fields['first_name']['field_type']);
     $this->assertEquals('Individual', $fields['birth_date']['field_type']);
     $this->assertEquals('Organization', $fields['organization_name']['field_type']);
     $this->assertEquals('Organization', $fields['legal_name']['field_type']);
     $this->assertEquals('Contribution', $fields['amount_level']['field_type']);
     $this->assertEquals('Contribution', $fields['cancel_reason']['field_type']);
     $this->assertEquals('Participant', $fields['participant_note']['field_type']);
     $this->assertEquals('Participant', $fields['participant_role']['field_type']);
     $this->assertEquals('Membership', $fields['join_date']['field_type']);
     $this->assertEquals('Membership', $fields['membership_end_date']['field_type']);
     $this->assertEquals('Activity', $fields['activity_date_time']['field_type']);
     $this->assertEquals('Activity', $fields['activity_subject']['field_type']);
     // Make sure that some of the blacklisted fields don't appear
     $this->assertFalse(isset($fields['is_pay_later']));
     $this->assertFalse(isset($fields['participant_role_id']));
     $this->assertFalse(isset($fields['membership_type_id']));
 }
开发者ID:nielosz,项目名称:civicrm-core,代码行数:26,代码来源:UFFieldTest.php

示例6: petitionemail_create_custom_fields

/**
 * Create the custom fields used to record subject and body
 *
 */
function petitionemail_create_custom_fields()
{
    $group = 'petitionemail';
    $key = 'petitionemail_custom_message_fields';
    $ret = CRM_Core_BAO_Setting::getItem($group, $key);
    if (!empty($ret)) {
        // Ensure it exists
        $sql = "SELECT id FROM civicrm_custom_group WHERE id = %0";
        $dao = CRM_Core_DAO::executeQuery($sql, array(0 => array($ret, 'Integer')));
        $dao->fetch();
        if ($dao->N == 1) {
            return $ret;
        }
        // Delete this variable - probably the user deleted the profile not knowing
        // what it was used for.
        $sql = "DELETE FROM civicrm_setting WHERE group_name = %0 AND name = %1";
        $params = array(0 => array($group, 'String'), 1 => array($key, 'String'));
        CRM_Core_DAO::executeQuery($sql, $params);
    }
    // Get the value of the petition activity id so our custom group
    // will only extend Activities of type Petition.
    $sql = "SELECT v.value FROM civicrm_option_group g JOIN \n    civicrm_option_value v ON g.id = v.option_group_id WHERE g.name = 'activity_type'\n    AND v.name = 'petition'";
    $dao = CRM_Core_DAO::executeQuery($sql);
    $dao->fetch();
    if ($dao->N > 0) {
        $activity_type_id = $dao->value;
        $params = array('version' => 3, 'name' => 'PetitionEmailMessageFields', 'title' => 'Petition Email Message Fields', 'extends' => 'Activity', 'extends_entity_column_value' => array($activity_type_id), 'style' => 'Inline', 'collapse_display' => 1, 'is_active' => 1, 'api.custom_field.create' => array(array('custom_group_id' => '$value.id', 'label' => 'Custom Message', 'name' => 'Petition_Email_Custom_Message', 'data_type' => 'Memo', 'html_type' => 'TextArea', 'is_required' => 0, 'is_searchable' => 0, 'is_active' => 1), array('custom_group_id' => '$value.id', 'label' => 'Custom Subject', 'name' => 'Petition_Email_Custom_Subject', 'data_type' => 'String', 'html_type' => 'Text', 'is_required' => 0, 'is_searchable' => 0, 'is_active' => 1)));
        try {
            $results = civicrm_api3('CustomGroup', 'create', $params);
        } catch (CiviCRM_API3_Exception $e) {
            $session = CRM_Core_Session::singleton();
            $session->setStatus(ts("Error creating the petition custom fields."));
            $session->setStatus($e->getMessage());
            return FALSE;
        }
        $values = array_pop($results['values']);
        $id = $values['id'];
        CRM_Core_BAO_Setting::setItem($id, $group, $key);
        // Start complex process for clearing the cache of available fields.
        // We need to clear the cache so that when we create a profile that
        // depends on these fields, we won't get an error that it's an invalid field.
        // First clear the static array of exportableFields which is used to determine
        // if a field is valid when being used in a profile.
        CRM_Activity_BAO_Activity::$_exportableFields = NULL;
        // Next clear the cache so we don't pull from an already populated cache.
        CRM_Utils_System::flushCache();
        // Lastly, we have to call the function that is called to validate fields,
        // but specifying that we want to force the re-fecthing of fields to unset
        // yet another static variable.
        CRM_Core_BAO_UFField::getAvailableFieldsFlat(TRUE);
        return $id;
    }
    return FALSE;
}
开发者ID:josephlacey,项目名称:cc.tadpole.petitionemail,代码行数:58,代码来源:petitionemail.php


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