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


PHP CRM_Core_BAO_CustomField::getFieldsForImport方法代码示例

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


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

示例1: defaultReturnProperties

 static function defaultReturnProperties($mode)
 {
     $properties = null;
     if ($mode & CRM_Contact_BAO_Query::MODE_ACTIVITY) {
         $properties = array('activity_id' => 1, 'contact_type' => 1, 'contact_sub_type' => 1, 'sort_name' => 1, 'display_name' => 1, 'activity_type' => 1, 'activity_subject' => 1, 'activity_date_time' => 1, 'activity_duration' => 1, 'activity_location' => 1, 'activity_details' => 1, 'activity_status' => 1, 'source_contact_id' => 1, 'source_record_id' => 1, 'activity_is_test' => 1);
         // also get all the custom activity properties
         require_once "CRM/Core/BAO/CustomField.php";
         $fields = CRM_Core_BAO_CustomField::getFieldsForImport('Activity');
         if (!empty($fields)) {
             foreach ($fields as $name => $dontCare) {
                 $properties[$name] = 1;
             }
         }
     }
     return $properties;
 }
开发者ID:hampelm,项目名称:Ginsberg-CiviDemo,代码行数:16,代码来源:Query.php

示例2: array

 /**
  * Combine all the exportable fields from the lower level objects.
  *
  * @param bool $checkPermission
  *
  * @return array
  *   array of exportable Fields
  */
 public static function &exportableFields($checkPermission = TRUE)
 {
     if (!self::$_exportableFields) {
         if (!self::$_exportableFields) {
             self::$_exportableFields = array();
         }
         $participantFields = CRM_Event_DAO_Participant::export();
         $eventFields = CRM_Event_DAO_Event::export();
         $noteField = array('participant_note' => array('title' => 'Participant Note', 'name' => 'participant_note', 'type' => CRM_Utils_Type::T_STRING));
         $participantStatus = array('participant_status' => array('title' => 'Participant Status', 'name' => 'participant_status', 'type' => CRM_Utils_Type::T_STRING));
         $participantRole = array('participant_role' => array('title' => 'Participant Role', 'name' => 'participant_role', 'type' => CRM_Utils_Type::T_STRING));
         $discountFields = CRM_Core_DAO_Discount::export();
         $fields = array_merge($participantFields, $participantStatus, $participantRole, $eventFields, $noteField, $discountFields);
         // add custom data
         $fields = array_merge($fields, CRM_Core_BAO_CustomField::getFieldsForImport('Participant', FALSE, FALSE, FALSE, $checkPermission));
         self::$_exportableFields = $fields;
     }
     return self::$_exportableFields;
 }
开发者ID:kcristiano,项目名称:civicrm-core,代码行数:27,代码来源:Participant.php

示例3: getMembershipFields

 /**
  * Get list of membership fields for profile.
  *
  * For now we only allow custom membership fields to be in
  * profile
  *
  * @param null $mode
  *   FIXME: This param is ignored
  *
  * @return array
  *   the list of membership fields
  */
 public static function getMembershipFields($mode = NULL)
 {
     $fields = CRM_Member_DAO_Membership::export();
     unset($fields['membership_contact_id']);
     $fields = array_merge($fields, CRM_Core_BAO_CustomField::getFieldsForImport('Membership'));
     $membershipType = CRM_Member_DAO_MembershipType::export();
     $membershipStatus = CRM_Member_DAO_MembershipStatus::export();
     $fields = array_merge($fields, $membershipType, $membershipStatus);
     return $fields;
 }
开发者ID:konadave,项目名称:civicrm-core,代码行数:22,代码来源:Membership.php

示例4: array

 /**
  * Get the exportable fields for Activities.
  *
  * @param string $name
  *   If it is called by case $name = Case else $name = Activity.
  *
  * @return array
  *   array of exportable Fields
  */
 public static function &exportableFields($name = 'Activity')
 {
     if (!isset(self::$_exportableFields[$name])) {
         self::$_exportableFields[$name] = array();
         // TODO: ideally we should retrieve all fields from xml, in this case since activity processing is done
         // my case hence we have defined fields as case_*
         if ($name == 'Activity') {
             $exportableFields = CRM_Activity_DAO_Activity::export();
             $exportableFields['source_contact_id']['title'] = ts('Source Contact ID');
             $exportableFields['source_contact'] = array('title' => ts('Source Contact'), 'type' => CRM_Utils_Type::T_STRING);
             $Activityfields = array('activity_type' => array('title' => ts('Activity Type'), 'name' => 'activity_type', 'type' => CRM_Utils_Type::T_STRING, 'searchByLabel' => TRUE), 'activity_status' => array('title' => ts('Activity Status'), 'name' => 'activity_status', 'type' => CRM_Utils_Type::T_STRING, 'searchByLabel' => TRUE));
             $fields = array_merge($Activityfields, $exportableFields);
         } else {
             // Set title to activity fields.
             $fields = array('case_activity_subject' => array('title' => ts('Activity Subject'), 'type' => CRM_Utils_Type::T_STRING), 'case_source_contact_id' => array('title' => ts('Activity Reporter'), 'type' => CRM_Utils_Type::T_STRING), 'case_recent_activity_date' => array('title' => ts('Activity Actual Date'), 'type' => CRM_Utils_Type::T_DATE), 'case_scheduled_activity_date' => array('title' => ts('Activity Scheduled Date'), 'type' => CRM_Utils_Type::T_DATE), 'case_recent_activity_type' => array('title' => ts('Activity Type'), 'type' => CRM_Utils_Type::T_STRING), 'case_activity_status' => array('title' => ts('Activity Status'), 'type' => CRM_Utils_Type::T_STRING), 'case_activity_duration' => array('title' => ts('Activity Duration'), 'type' => CRM_Utils_Type::T_INT), 'case_activity_medium_id' => array('title' => ts('Activity Medium'), 'type' => CRM_Utils_Type::T_INT), 'case_activity_details' => array('title' => ts('Activity Details'), 'type' => CRM_Utils_Type::T_TEXT), 'case_activity_is_auto' => array('title' => ts('Activity Auto-generated?'), 'type' => CRM_Utils_Type::T_BOOLEAN));
         }
         // add custom data for case activities
         $fields = array_merge($fields, CRM_Core_BAO_CustomField::getFieldsForImport('Activity'));
         self::$_exportableFields[$name] = $fields;
     }
     return self::$_exportableFields[$name];
 }
开发者ID:saurabhbatra96,项目名称:civicrm-core,代码行数:31,代码来源:Activity.php

示例5: getContributionFields

 /**
  * Function to get list of contribution fields for profile
  * For now we only allow custom contribution fields to be in
  * profile
  *
  * @return return the list of contribution fields
  * @static
  * @access public
  */
 static function getContributionFields()
 {
     $contributionFields =& CRM_Contribute_DAO_Contribution::export();
     require_once 'CRM/Core/OptionValue.php';
     $contributionFields = array_merge($contributionFields, CRM_Core_OptionValue::getFields($mode = 'contribute'));
     require_once 'CRM/Contribute/DAO/ContributionType.php';
     $contributionFields = array_merge($contributionFields, CRM_Contribute_DAO_ContributionType::export());
     foreach ($contributionFields as $key => $var) {
         if ($key == 'contribution_contact_id') {
             continue;
         }
         $fields[$key] = $var;
     }
     $fields = array_merge($fields, CRM_Core_BAO_CustomField::getFieldsForImport('Contribution'));
     return $fields;
 }
开发者ID:hampelm,项目名称:Ginsberg-CiviDemo,代码行数:25,代码来源:Contribution.php

示例6: addHierarchicalElements

 /**
  * If the return Properties are set in a hierarchy, traverse the hierarchy to get
  * the return values
  *
  * @return void
  * @access public
  */
 function addHierarchicalElements()
 {
     if (!CRM_Utils_Array::value('location', $this->_returnProperties)) {
         return;
     }
     if (!is_array($this->_returnProperties['location'])) {
         return;
     }
     $locationTypes = CRM_Core_PseudoConstant::locationType();
     $processed = array();
     $index = 0;
     // CRM_Core_Error::debug( 'd', $this->_fields );
     // CRM_Core_Error::debug( 'r', $this->_returnProperties );
     $addressCustomFields = CRM_Core_BAO_CustomField::getFieldsForImport('Address');
     $addressCustomFieldIds = array();
     foreach ($this->_returnProperties['location'] as $name => $elements) {
         $lCond = self::getPrimaryCondition($name);
         if (!$lCond) {
             $locationTypeId = array_search($name, $locationTypes);
             if ($locationTypeId === FALSE) {
                 continue;
             }
             $lCond = "location_type_id = {$locationTypeId}";
             $this->_useDistinct = TRUE;
             //commented for CRM-3256
             $this->_useGroupBy = TRUE;
         }
         $name = str_replace(' ', '_', $name);
         $tName = "{$name}-location_type";
         $ltName = "`{$name}-location_type`";
         $this->_select["{$tName}_id"] = "`{$tName}`.id as `{$tName}_id`";
         $this->_select["{$tName}"] = "`{$tName}`.name as `{$tName}`";
         $this->_element["{$tName}_id"] = 1;
         $this->_element["{$tName}"] = 1;
         $locationTypeName = $tName;
         $locationTypeJoin = array();
         $addAddress = FALSE;
         $addWhereCount = 0;
         foreach ($elements as $elementFullName => $dontCare) {
             $index++;
             $elementName = $elementCmpName = $elementFullName;
             if (substr($elementCmpName, 0, 5) == 'phone') {
                 $elementCmpName = 'phone';
             }
             if (in_array($elementCmpName, array_keys($addressCustomFields))) {
                 if ($cfID = CRM_Core_BAO_CustomField::getKeyID($elementCmpName)) {
                     $addressCustomFieldIds[$cfID][$name] = 1;
                 }
             }
             //add address table only once
             if ((in_array($elementCmpName, self::$_locationSpecificFields) || !empty($addressCustomFieldIds)) && !$addAddress && !in_array($elementCmpName, array('email', 'phone', 'im', 'openid'))) {
                 $tName = "{$name}-address";
                 $aName = "`{$name}-address`";
                 $this->_select["{$tName}_id"] = "`{$tName}`.id as `{$tName}_id`";
                 $this->_element["{$tName}_id"] = 1;
                 $addressJoin = "\nLEFT JOIN civicrm_address {$aName} ON ({$aName}.contact_id = contact_a.id AND {$aName}.{$lCond})";
                 $this->_tables[$tName] = $addressJoin;
                 $locationTypeJoin[$tName] = " ( {$aName}.location_type_id = {$ltName}.id ) ";
                 $processed[$aName] = 1;
                 $addAddress = TRUE;
             }
             $cond = $elementType = '';
             if (strpos($elementName, '-') !== FALSE) {
                 // this is either phone, email or IM
                 list($elementName, $elementType) = explode('-', $elementName);
                 if ($elementName != 'phone' && $elementName != 'im') {
                     $cond = self::getPrimaryCondition($elementType);
                 }
                 if (!$cond && $elementName == 'phone') {
                     $cond = "phone_type_id = '{$elementType}'";
                 } elseif (!$cond && $elementName == 'im') {
                     // IM service provider id, CRM-3140
                     $cond = "provider_id = '{$elementType}'";
                 }
                 $elementType = '-' . $elementType;
             }
             $field = CRM_Utils_Array::value($elementName, $this->_fields);
             // hack for profile, add location id
             if (!$field) {
                 if ($elementType && !is_numeric($elementType)) {
                     if (is_numeric($name)) {
                         $field = CRM_Utils_Array::value($elementName . "-Primary{$elementType}", $this->_fields);
                     } else {
                         $field = CRM_Utils_Array::value($elementName . "-{$locationTypeId}{$elementType}", $this->_fields);
                     }
                 } elseif (is_numeric($name)) {
                     //this for phone type to work
                     if ($elementName == "phone") {
                         $field = CRM_Utils_Array::value($elementName . "-Primary" . $elementType, $this->_fields);
                     } else {
                         $field = CRM_Utils_Array::value($elementName . "-Primary", $this->_fields);
                     }
                 } else {
//.........这里部分代码省略.........
开发者ID:peteainsworth,项目名称:civicrm-4.2.9-drupal,代码行数:101,代码来源:Query.php

示例7: getContributionFields

 /**
  * Get list of contribution fields for profile.
  * For now we only allow custom contribution fields to be in
  * profile
  *
  * @param bool $addExtraFields
  *   True if special fields needs to be added.
  *
  * @return array
  *   the list of contribution fields
  */
 public static function getContributionFields($addExtraFields = TRUE)
 {
     $contributionFields = CRM_Contribute_DAO_Contribution::export();
     $contributionFields = array_merge($contributionFields, CRM_Core_OptionValue::getFields($mode = 'contribute'));
     if ($addExtraFields) {
         $contributionFields = array_merge($contributionFields, self::getSpecialContributionFields());
     }
     $contributionFields = array_merge($contributionFields, CRM_Financial_DAO_FinancialType::export());
     foreach ($contributionFields as $key => $var) {
         if ($key == 'contribution_contact_id') {
             continue;
         } elseif ($key == 'contribution_campaign_id') {
             $var['title'] = ts('Campaign');
         }
         $fields[$key] = $var;
     }
     $fields = array_merge($fields, CRM_Core_BAO_CustomField::getFieldsForImport('Contribution'));
     return $fields;
 }
开发者ID:nganivet,项目名称:civicrm-core,代码行数:30,代码来源:Contribution.php

示例8: array

 /**
  * combine all the exportable fields from the lower levels object
  *
  * @return array array of exportable Fields
  * @access public
  */
 function &exportableFields()
 {
     if (!self::$_exportableFields) {
         if (!self::$_exportableFields) {
             self::$_exportableFields = array();
         }
         $fields = array();
         require_once 'CRM/Core/DAO/Note.php';
         $participantFields = CRM_Event_DAO_Participant::export();
         $noteField = array('participant_note' => array('title' => 'Participant Note', 'name' => 'participant_note'));
         $participantStatus = array('participant_status' => array('title' => 'Participant Status', 'name' => 'participant_status'));
         $participantRole = array('participant_role' => array('title' => 'Participant Role', 'name' => 'participant_role'));
         require_once 'CRM/Core/DAO/Discount.php';
         $discountFields = CRM_Core_DAO_Discount::export();
         $fields = array_merge($participantFields, $participantStatus, $participantRole, $noteField, $discountFields);
         // add custom data
         $fields = array_merge($fields, CRM_Core_BAO_CustomField::getFieldsForImport('Participant'));
         self::$_exportableFields = $fields;
     }
     return self::$_exportableFields;
 }
开发者ID:hampelm,项目名称:Ginsberg-CiviDemo,代码行数:27,代码来源:Participant.php

示例9: defaultReturnProperties

 static function defaultReturnProperties($mode)
 {
     $properties = null;
     if ($mode & CRM_Contact_BAO_Query::MODE_CONTRIBUTE) {
         $properties = array('contact_type' => 1, 'contact_sub_type' => 1, 'sort_name' => 1, 'display_name' => 1, 'contribution_type' => 1, 'contribution_source' => 1, 'receive_date' => 1, 'thankyou_date' => 1, 'cancel_date' => 1, 'total_amount' => 1, 'accounting_code' => 1, 'payment_instrument' => 1, 'check_number' => 1, 'non_deductible_amount' => 1, 'fee_amount' => 1, 'net_amount' => 1, 'trxn_id' => 1, 'invoice_id' => 1, 'currency' => 1, 'cancel_date' => 1, 'cancel_reason' => 1, 'receipt_date' => 1, 'thankyou_date' => 1, 'product_name' => 1, 'sku' => 1, 'product_option' => 1, 'fulfilled_date' => 1, 'contribution_start_date' => 1, 'contribution_end_date' => 1, 'is_test' => 1, 'is_pay_later' => 1, 'contribution_status_id' => 1, 'contribution_recur_id' => 1, 'amount_level' => 1, 'contribution_note' => 1);
         // also get all the custom contribution properties
         require_once "CRM/Core/BAO/CustomField.php";
         $fields = CRM_Core_BAO_CustomField::getFieldsForImport('Contribution');
         if (!empty($fields)) {
             foreach ($fields as $name => $dontCare) {
                 $properties[$name] = 1;
             }
         }
     }
     return $properties;
 }
开发者ID:bhirsch,项目名称:voipdev,代码行数:16,代码来源:Query.php

示例10: setProfileDefaults

 /**
  * Function to set profile defaults
  *
  * @params int     $contactId      contact id
  * @params array   $fields         associative array of fields
  * @params array   $defaults       defaults array
  * @params boolean $singleProfile  true for single profile else false(batch update)
  * @params int     $componentId    id for specific components like contribute, event etc
  *
  * @return null
  * @static
  * @access public
  */
 static function setProfileDefaults($contactId, &$fields, &$defaults, $singleProfile = true, $componentId = null, $component = null)
 {
     if (!$componentId) {
         //get the contact details
         require_once 'CRM/Contact/BAO/Contact.php';
         list($contactDetails, $options) = CRM_Contact_BAO_Contact::getHierContactDetails($contactId, $fields);
         $details = $contactDetails[$contactId];
         require_once 'CRM/Contact/Form/Edit/TagsAndGroups.php';
         //start of code to set the default values
         foreach ($fields as $name => $field) {
             //set the field name depending upon the profile mode(single/batch)
             if ($singleProfile) {
                 $fldName = $name;
             } else {
                 $fldName = "field[{$contactId}][{$name}]";
             }
             if ($name == 'group') {
                 CRM_Contact_Form_Edit_TagsAndGroups::setDefaults($contactId, $defaults, CRM_Contact_Form_Edit_TagsAndGroups::GROUP, $fldName);
             }
             if ($name == 'tag') {
                 CRM_Contact_Form_Edit_TagsAndGroups::setDefaults($contactId, $defaults, CRM_Contact_Form_Edit_TagsAndGroups::TAG, $fldName);
             }
             if (CRM_Utils_Array::value($name, $details) || isset($details[$name])) {
                 //to handle custom data (checkbox) to be written
                 // to handle gender / suffix / prefix / greeting_type
                 if ($name == 'gender') {
                     $defaults[$fldName] = $details['gender_id'];
                 } else {
                     if ($name == 'individual_prefix') {
                         $defaults[$fldName] = $details['individual_prefix_id'];
                     } else {
                         if ($name == 'individual_suffix') {
                             $defaults[$fldName] = $details['individual_suffix_id'];
                         } else {
                             if ($name == 'birth_date' || $name == 'deceased_date') {
                                 list($defaults[$fldName]) = CRM_Utils_Date::setDateDefaults($details[$name], 'birth');
                             } else {
                                 if ($name == 'email_greeting') {
                                     $defaults[$fldName] = $details['email_greeting_id'];
                                     $defaults['email_greeting_custom'] = $details['email_greeting_custom'];
                                 } else {
                                     if ($name == 'postal_greeting') {
                                         $defaults[$fldName] = $details['postal_greeting_id'];
                                         $defaults['postal_greeting_custom'] = $details['postal_greeting_custom'];
                                     } else {
                                         if ($name == 'addressee') {
                                             $defaults[$fldName] = $details['addressee_id'];
                                             $defaults['addressee_custom'] = $details['addressee_custom'];
                                         } else {
                                             if ($name == 'preferred_communication_method') {
                                                 $v = explode(CRM_Core_BAO_CustomOption::VALUE_SEPERATOR, $details[$name]);
                                                 foreach ($v as $item) {
                                                     if ($item) {
                                                         $defaults[$fldName . "[{$item}]"] = 1;
                                                     }
                                                 }
                                             } else {
                                                 if ($name == 'world_region') {
                                                     $defaults[$fldName] = $details['worldregion_id'];
                                                 } else {
                                                     if ($customFieldId = CRM_Core_BAO_CustomField::getKeyID($name)) {
                                                         //fix for custom fields
                                                         $customFields = CRM_Core_BAO_CustomField::getFields(CRM_Utils_Array::value('Individual', $values));
                                                         // hack to add custom data for components
                                                         $components = array("Contribution", "Participant", "Membership");
                                                         foreach ($components as $value) {
                                                             $customFields = CRM_Utils_Array::crmArrayMerge($customFields, CRM_Core_BAO_CustomField::getFieldsForImport($value));
                                                         }
                                                         switch ($customFields[$customFieldId]['html_type']) {
                                                             case 'Multi-Select State/Province':
                                                             case 'Multi-Select Country':
                                                             case 'AdvMulti-Select':
                                                             case 'Multi-Select':
                                                                 $v = explode(CRM_Core_BAO_CustomOption::VALUE_SEPERATOR, $details[$name]);
                                                                 foreach ($v as $item) {
                                                                     if ($item) {
                                                                         $defaults[$fldName][$item] = $item;
                                                                     }
                                                                 }
                                                                 break;
                                                             case 'CheckBox':
                                                                 $v = explode(CRM_Core_BAO_CustomOption::VALUE_SEPERATOR, $details[$name]);
                                                                 foreach ($v as $item) {
                                                                     if ($item) {
                                                                         $defaults[$fldName][$item] = 1;
                                                                         // seems like we need this for QF style checkboxes in profile where its multiindexed
                                                                         // CRM-2969
//.........这里部分代码省略.........
开发者ID:bhirsch,项目名称:voipdev,代码行数:101,代码来源:UFGroup.php

示例11: array

 /**
  * default set of return properties
  *
  * @return void
  * @access public
  */
 function &defaultReturnProperties($mode = 1)
 {
     if (!isset($GLOBALS['_CRM_CONTACT_BAO_QUERY']['_defaultReturnProperties'])) {
         $GLOBALS['_CRM_CONTACT_BAO_QUERY']['_defaultReturnProperties'] = array();
         if ($mode & CRM_CONTACT_BAO_QUERY_MODE_CONTACTS) {
             $properties = array('home_URL' => 1, 'image_URL' => 1, 'legal_identifier' => 1, 'external_identifier' => 1, 'contact_type' => 1, 'sort_name' => 1, 'display_name' => 1, 'nick_name' => 1, 'first_name' => 1, 'middle_name' => 1, 'last_name' => 1, 'prefix' => 1, 'suffix' => 1, 'birth_date' => 1, 'gender' => 1, 'street_address' => 1, 'supplemental_address_1' => 1, 'supplemental_address_2' => 1, 'city' => 1, 'postal_code' => 1, 'postal_code_suffix' => 1, 'state_province' => 1, 'country' => 1, 'geo_code_1' => 1, 'geo_code_2' => 1, 'email' => 1, 'phone' => 1, 'im' => 1);
             $GLOBALS['_CRM_CONTACT_BAO_QUERY']['_defaultReturnProperties'] = array_merge($GLOBALS['_CRM_CONTACT_BAO_QUERY']['_defaultReturnProperties'], $properties);
         }
         if ($mode & CRM_CONTACT_BAO_QUERY_MODE_CONTRIBUTE) {
             $properties = array('contact_type' => 1, 'sort_name' => 1, 'display_name' => 1, 'contribution_type' => 1, 'source' => 1, 'receive_date' => 1, 'thankyou_date' => 1, 'cancel_date' => 1, 'total_amount' => 1, 'accounting_code' => 1, 'payment_instrument' => 1, 'non_deductible_amount' => 1, 'fee_amount' => 1, 'net_amount' => 1, 'trxn_id' => 1, 'invoice_id' => 1, 'currency' => 1, 'cancel_date' => 1, 'cancel_reason' => 1, 'receipt_date' => 1, 'thankyou_date' => 1, 'source' => 1, 'name' => 1, 'sku' => 1, 'product_option' => 1, 'fulfilled_date' => 1, 'start_date' => 1, 'end_date' => 1);
             // also get all the custom contribution properties
             $fields = CRM_Core_BAO_CustomField::getFieldsForImport('Contribution');
             if (!empty($fields)) {
                 foreach ($fields as $name => $dontCare) {
                     $properties[$name] = 1;
                 }
             }
             $GLOBALS['_CRM_CONTACT_BAO_QUERY']['_defaultReturnProperties'] = array_merge($GLOBALS['_CRM_CONTACT_BAO_QUERY']['_defaultReturnProperties'], $properties);
         }
     }
     return $GLOBALS['_CRM_CONTACT_BAO_QUERY']['_defaultReturnProperties'];
 }
开发者ID:bhirsch,项目名称:voipdrupal-4.7-1.0,代码行数:28,代码来源:Query.php

示例12: buildQuickForm

 /**
  * Function to actually build the form
  *
  * @return void
  * @access public
  */
 public function buildQuickForm()
 {
     if ($this->_action & CRM_Core_Action::DELETE) {
         $this->addButtons(array(array('type' => 'next', 'name' => ts('Delete Profile Field'), 'spacing' => '         ', 'isDefault' => true), array('type' => 'cancel', 'name' => ts('Cancel'))));
         return;
     }
     if (isset($this->_id)) {
         $params = array('id' => $this->_id);
         CRM_Core_BAO_UFField::retrieve($params, $defaults);
         // set it to null if so (avoids crappy E_NOTICE errors below
         $defaults['location_type_id'] = CRM_Utils_Array::value('location_type_id', $defaults);
         $specialFields = array('street_address', 'supplemental_address_1', 'supplemental_address_2', 'city', 'postal_code', 'postal_code_suffix', 'geo_code_1', 'geo_code_2', 'state_province', 'country', 'county', 'phone', 'email', 'im', 'address_name');
         if (!$defaults['location_type_id'] && in_array($defaults['field_name'], $specialFields)) {
             $defaults['location_type_id'] = 0;
         }
         $defaults['field_name'] = array($defaults['field_type'], $defaults['field_name'], $defaults['location_type_id'], CRM_Utils_Array::value('phone_type_id', $defaults));
         $this->_gid = $defaults['uf_group_id'];
     } else {
         $defaults['is_active'] = 1;
     }
     if ($this->_action & CRM_Core_Action::ADD) {
         $fieldValues = array('uf_group_id' => $this->_gid);
         $defaults['weight'] = CRM_Utils_Weight::getDefaultWeight('CRM_Core_DAO_UFField', $fieldValues);
     }
     // lets trim all the whitespace
     $this->applyFilter('__ALL__', 'trim');
     //hidden field to catch the group id in profile
     $this->add('hidden', 'group_id', $this->_gid);
     //hidden field to catch the field id in profile
     $this->add('hidden', 'field_id', $this->_id);
     $fields = array();
     $fields['Individual'] =& CRM_Contact_BAO_Contact::importableFields('Individual', false, false, true);
     $fields['Household'] =& CRM_Contact_BAO_Contact::importableFields('Household', false, false, true);
     $fields['Organization'] =& CRM_Contact_BAO_Contact::importableFields('Organization', false, false, true);
     // add current employer for individuals
     $fields['Individual']['current_employer'] = array('name' => 'organization_name', 'title' => ts('Current Employer'));
     // unset unwanted fields
     $unsetFieldArray = array('note', 'email_greeting_custom', 'postal_greeting_custom', 'addressee_custom', 'id');
     foreach ($unsetFieldArray as $value) {
         unset($fields['Individual'][$value]);
         unset($fields['Household'][$value]);
         unset($fields['Organization'][$value]);
     }
     require_once 'CRM/Core/BAO/Preferences.php';
     $addressOptions = CRM_Core_BAO_Preferences::valueOptions('address_options', true, null, true);
     if (!$addressOptions['county']) {
         unset($fields['Individual']['county']);
         unset($fields['Household']['county']);
         unset($fields['Organization']['county']);
     }
     //build the common contact fields array CRM-3037.
     foreach ($fields['Individual'] as $key => $value) {
         if (CRM_Utils_Array::value($key, $fields['Household']) && CRM_Utils_Array::value($key, $fields['Organization'])) {
             $fields['Contact'][$key] = $value;
             //as we move common fields to contacts. There fore these fields
             //are unset from resoective array's.
             unset($fields['Individual'][$key]);
             unset($fields['Household'][$key]);
             unset($fields['Organization'][$key]);
         }
     }
     // add current employer for individuals
     $fields['Contact']['id'] = array('name' => 'id', 'title' => ts('Internal Contact ID'));
     unset($fields['Contact']['contact_type']);
     // since we need a hierarchical list to display contact types & subtypes,
     // this is what we going to display in first selector
     $contactTypes = CRM_Contact_BAO_ContactType::getSelectElements(false, false);
     unset($contactTypes['']);
     // include Subtypes For Profile
     $subTypes = CRM_Contact_BAO_ContactType::subTypeInfo();
     foreach ($subTypes as $name => $val) {
         //custom fields for sub type
         $subTypeFields = CRM_Core_BAO_CustomField::getFieldsForImport($name);
         if (array_key_exists($val['parent'], $fields)) {
             $fields[$name] = $fields[$val['parent']] + $subTypeFields;
         } else {
             $fields[$name] = $subTypeFields;
         }
     }
     unset($subTypes);
     if (CRM_Core_Permission::access('Quest')) {
         require_once 'CRM/Quest/BAO/Student.php';
         $fields['Student'] =& CRM_Quest_BAO_Student::exportableFields();
     }
     if (CRM_Core_Permission::access('CiviContribute')) {
         $contribFields =& CRM_Contribute_BAO_Contribution::getContributionFields();
         if (!empty($contribFields)) {
             unset($contribFields['is_test']);
             unset($contribFields['is_pay_later']);
             unset($contribFields['contribution_id']);
             $fields['Contribution'] =& $contribFields;
         }
     }
     if (CRM_Core_Permission::access('CiviEvent')) {
//.........这里部分代码省略.........
开发者ID:bhirsch,项目名称:civicrm,代码行数:101,代码来源:Field.php

示例13: preProcess

 /**
  * extracts the parameters from the request and constructs information for
  * the selector object to do a query
  *
  * @return void 
  * @access public 
  * 
  */
 function preProcess()
 {
     $this->_search = true;
     $search = CRM_Utils_Request::retrieve('search', 'Boolean', $this, false, 0, 'GET');
     if (isset($search) && $search == 0) {
         $this->_search = false;
     }
     $this->_gid = $this->get('gid');
     $this->_profileIds = $this->get('profileIds');
     $gids = explode(',', CRM_Utils_Request::retrieve('gid', 'String', CRM_Core_DAO::$_nullObject, false, 0, 'GET'));
     if (count($gids) > 1 && !$this->_profileIds && empty($this->_profileIds)) {
         if (!empty($gids)) {
             foreach ($gids as $pfId) {
                 $this->_profileIds[] = CRM_Utils_Type::escape($pfId, 'Positive');
             }
         }
         // check if we are rendering mixed profiles
         require_once 'CRM/Core/BAO/UFGroup.php';
         if (CRM_Core_BAO_UFGroup::checkForMixProfiles($this->_profileIds)) {
             CRM_Core_Error::fatal(ts('You cannot combine profiles of multiple types.'));
         }
         $this->_gid = $this->_profileIds[0];
         $this->set('profileIds', $this->_profileIds);
         $this->set('gid', $this->_gid);
     }
     if (!$this->_gid) {
         $this->_gid = CRM_Utils_Request::retrieve('gid', 'Positive', $this, false, 0, 'GET');
     }
     require_once 'CRM/Core/BAO/UFGroup.php';
     if (empty($this->_profileIds)) {
         $gids = $this->_gid;
     } else {
         $gids = $this->_profileIds;
     }
     $this->_fields = CRM_Core_BAO_UFGroup::getListingFields(CRM_Core_Action::UPDATE, CRM_Core_BAO_UFGroup::PUBLIC_VISIBILITY | CRM_Core_BAO_UFGroup::LISTINGS_VISIBILITY, false, $gids, false, 'Profile', CRM_Core_Permission::SEARCH);
     $this->_customFields = CRM_Core_BAO_CustomField::getFieldsForImport(null);
     $this->_params = array();
     $resetArray = array('group', 'tag', 'preferred_communication_method', 'do_not_phone', 'do_not_email', 'do_not_mail', 'do_not_sms', 'do_not_trade', 'gender');
     foreach ($this->_fields as $name => $field) {
         if (substr($name, 0, 6) == 'custom' && CRM_Utils_Array::value('is_search_range', $field)) {
             $from = CRM_Utils_Request::retrieve($name . '_from', 'String', $this, false, null, 'REQUEST');
             $to = CRM_Utils_Request::retrieve($name . '_to', 'String', $this, false, null, 'REQUEST');
             $value = array();
             if ($from && $to) {
                 $value['from'] = $from;
                 $value['to'] = $to;
             } else {
                 if ($from) {
                     $value['from'] = $from;
                 } else {
                     if ($to) {
                         $value['to'] = $to;
                     }
                 }
             }
         } else {
             if (substr($name, 0, 7) == 'custom_' && CRM_Core_DAO::getFieldValue('CRM_Core_DAO_CustomField', substr($name, 7), 'html_type') == 'TextArea') {
                 $value = trim(CRM_Utils_Request::retrieve($name, 'String', $this, false, null, 'REQUEST'));
                 if (!empty($value) && !(substr($value, 0, 1) == '%' && substr($value, -1, 1) == '%')) {
                     $value = '%' . $value . '%';
                 }
             } else {
                 if (CRM_Utils_Array::value('html_type', $field) == 'Multi-Select State/Province' || CRM_Utils_Array::value('html_type', $field) == 'Multi-Select Country') {
                     $value = CRM_Utils_Request::retrieve($name, 'String', $this, false, null, 'REQUEST');
                     if (!is_array($value)) {
                         $value = explode(CRM_Core_BAO_CustomOption::VALUE_SEPERATOR, substr($value, 1, -1));
                     }
                 } else {
                     $value = CRM_Utils_Request::retrieve($name, 'String', $this, false, null, 'REQUEST');
                 }
             }
         }
         if (($name == 'group' || $name == 'tag') && !empty($value) && !is_array($value)) {
             $v = explode(',', $value);
             $value = array();
             foreach ($v as $item) {
                 $value[$item] = 1;
             }
         }
         $customField = CRM_Utils_Array::value($name, $this->_customFields);
         if (!empty($_POST) && !CRM_Utils_Array::value($name, $_POST)) {
             if ($customField) {
                 // reset checkbox/radio because a form does not send null checkbox values
                 if (in_array($customField['html_type'], array('Multi-Select', 'CheckBox', 'Multi-Select State/Province', 'Multi-Select Country', 'Radio'))) {
                     // only reset on a POST submission if we dont see any value
                     $value = null;
                     $this->set($name, $value);
                 }
             } else {
                 if (in_array($name, $resetArray)) {
                     $value = null;
                     $this->set($name, $value);
//.........这里部分代码省略.........
开发者ID:hampelm,项目名称:Ginsberg-CiviDemo,代码行数:101,代码来源:Listings.php

示例14: defaultReturnProperties

 /**
  * @param $mode
  * @param bool $includeCustomFields
  *
  * @return array|null
  */
 public static function defaultReturnProperties($mode, $includeCustomFields = TRUE)
 {
     $properties = NULL;
     if ($mode & CRM_Contact_BAO_Query::MODE_ACTIVITY) {
         $properties = array('activity_id' => 1, 'contact_type' => 1, 'contact_sub_type' => 1, 'sort_name' => 1, 'display_name' => 1, 'activity_type' => 1, 'activity_type_id' => 1, 'activity_subject' => 1, 'activity_date_time' => 1, 'activity_duration' => 1, 'activity_location' => 1, 'activity_details' => 1, 'activity_status' => 1, 'source_contact' => 1, 'source_record_id' => 1, 'activity_is_test' => 1, 'activity_campaign_id' => 1, 'result' => 1, 'activity_engagement_level' => 1, 'parent_id' => 1);
         if ($includeCustomFields) {
             // also get all the custom activity properties
             $fields = CRM_Core_BAO_CustomField::getFieldsForImport('Activity');
             if (!empty($fields)) {
                 foreach ($fields as $name => $dontCare) {
                     $properties[$name] = 1;
                 }
             }
         }
     }
     return $properties;
 }
开发者ID:rajeshrhino,项目名称:civicrm-core,代码行数:23,代码来源:Query.php

示例15: buildQuickForm


//.........这里部分代码省略.........
                 } elseif ($name == 'url') {
                     $sel3[$key][$name] = $websiteTypes;
                 } else {
                     $sel3[$name] = NULL;
                 }
             }
             //fix to append custom group name to field name, CRM-2676
             if (empty($this->_formattedFieldNames[$cType]) || $cType == $this->_contactType) {
                 $this->_formattedFieldNames[$cType] = $this->formatCustomFieldName($values);
             }
             $this->_formattedFieldNames[$cType] = array_merge($values, $this->_formattedFieldNames[$cType]);
             //Modified the Relationship fields if the fields are
             //present in dedupe rule
             if ($this->_onDuplicate != CRM_Import_Parser::DUPLICATE_NOCHECK && !empty($this->_dedupeFields[$cType]) && is_array($this->_dedupeFields[$cType])) {
                 static $cTypeArray = array();
                 if ($cType != $this->_contactType && !in_array($cType, $cTypeArray)) {
                     foreach ($this->_dedupeFields[$cType] as $val) {
                         if ($valTitle = CRM_Utils_Array::value($val, $this->_formattedFieldNames[$cType])) {
                             $this->_formattedFieldNames[$cType][$val] = $valTitle . ' (match to contact)';
                         }
                     }
                     $cTypeArray[] = $cType;
                 }
             }
             foreach ($highlightedFields as $k => $v) {
                 if ($v == $cType || $v == 'All') {
                     $highlightedRelFields[$key][] = $k;
                 }
             }
             $this->assign('highlightedRelFields', $highlightedRelFields);
             $sel2[$key] = $this->_formattedFieldNames[$cType];
             if (!empty($cSubType)) {
                 //custom fields for sub type
                 $subTypeFields = CRM_Core_BAO_CustomField::getFieldsForImport($cSubType);
                 if (!empty($subTypeFields)) {
                     $subType = NULL;
                     foreach ($subTypeFields as $customSubTypeField => $details) {
                         $subType[$customSubTypeField] = $details['title'];
                         $sel2[$key] = array_merge($sel2[$key], $this->formatCustomFieldName($subType));
                     }
                 }
             }
             foreach ($this->_location_types as $k => $value) {
                 $sel4[$key]['phone'][$k] =& $phoneTypes;
                 //build array of IM service provider for related contact
                 $sel4[$key]['im'][$k] =& $imProviders;
             }
         } else {
             $options = NULL;
             if (!empty($hasLocationTypes[$key])) {
                 $options = $this->_location_types;
             } elseif ($key == 'url') {
                 $options = $websiteTypes;
             }
             $sel2[$key] = $options;
         }
     }
     $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])) {
开发者ID:nganivet,项目名称:civicrm-core,代码行数:67,代码来源:MapField.php


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