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


PHP CRM_Contact_BAO_Contact::exportableFields方法代码示例

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


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

示例1: buildQuickForm

 /**
  * Function to actually build the form
  *
  * @return void
  * @access 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);
         $defaults['field_name'] = array($defaults['field_type'], $defaults['field_name'], $defaults['location_type_id'], $defaults['phone_type']);
         $this->_gid = $defaults['uf_group_id'];
     } else {
         $defaults['is_active'] = 1;
     }
     if ($this->_action & CRM_CORE_ACTION_ADD) {
         $uf =& new CRM_Core_DAO();
         $sql = "SELECT weight FROM civicrm_uf_field  WHERE uf_group_id = " . $this->_gid . " ORDER BY weight  DESC LIMIT 0, 1";
         $uf->query($sql);
         while ($uf->fetch()) {
             $defaults['weight'] = $uf->weight + 1;
         }
         if (empty($defaults['weight'])) {
             $defaults['weight'] = 1;
         }
     }
     // 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::exportableFields('Individual');
     $fields['Household'] =& CRM_Contact_BAO_Contact::exportableFields('Household');
     $fields['Organization'] =& CRM_Contact_BAO_Contact::exportableFields('Organization');
     $contribFields =& CRM_Contribute_BAO_Contribution::getContributionFields();
     if (!empty($contribFields)) {
         $fields['Contribution'] =& $contribFields;
     }
     foreach ($fields as $key => $value) {
         foreach ($value as $key1 => $value1) {
             $this->_mapperFields[$key][$key1] = $value1['title'];
             $hasLocationTypes[$key][$key1] = $value1['hasLocationType'];
         }
     }
     require_once 'CRM/Core/BAO/LocationType.php';
     $this->_location_types =& CRM_Core_PseudoConstant::locationType();
     $defaultLocationType =& CRM_Core_BAO_LocationType::getDefault();
     /* FIXME: dirty hack to make the default option show up first.  This
      * avoids a mozilla browser bug with defaults on dynamically constructed
      * selector widgets. */
     if ($defaultLocationType) {
         $defaultLocation = $this->_location_types[$defaultLocationType->id];
         unset($this->_location_types[$defaultLocationType->id]);
         $this->_location_types = array($defaultLocationType->id => $defaultLocation) + $this->_location_types;
     }
     $sel1 = array('' => '-select-') + CRM_Core_SelectValues::contactType();
     if (!empty($contribFields)) {
         $sel1['Contribution'] = 'Contributions';
     }
     foreach ($sel1 as $key => $sel) {
         if ($key) {
             $sel2[$key] = $this->_mapperFields[$key];
         }
     }
     $sel3[''] = null;
     $phoneTypes = CRM_Core_SelectValues::phoneType();
     foreach ($sel1 as $k => $sel) {
         if ($k) {
             foreach ($this->_location_types as $key => $value) {
                 $sel4[$k]['phone'][$key] =& $phoneTypes;
             }
         }
     }
     foreach ($sel1 as $k => $sel) {
         if ($k) {
             foreach ($this->_mapperFields[$k] as $key => $value) {
                 if ($hasLocationTypes[$k][$key]) {
                     $sel3[$k][$key] = $this->_location_types;
                 } else {
                     $sel3[$key] = null;
                 }
             }
         }
     }
     $this->_defaults = array();
     $js = "<script type='text/javascript'>\n";
     $formName = "document.{$this->_name}";
     $sel =& $this->addElement('hierselect', "field_name", ts('Field Name'), 'onclick="showLabel();"');
     $formValues = array();
     //$formValues = $this->controller->exportValues( $this->_name );
     $formValues = $_POST;
     // using $_POST since export values don't give values on first submit
     if (empty($formValues)) {
//.........这里部分代码省略.........
开发者ID:bhirsch,项目名称:voipdrupal-4.7-1.0,代码行数:101,代码来源:Field.php

示例2: browse

 /**
  * Browse all CiviCRM Profile group fields.
  *
  * @return void
  * @access public
  * @static
  */
 function browse()
 {
     $ufField = array();
     $ufFieldBAO =& new CRM_Core_BAO_UFField();
     // fkey is gid
     $ufFieldBAO->uf_group_id = $this->_gid;
     $ufFieldBAO->orderBy('weight', 'field_name');
     $ufFieldBAO->find();
     $locationType = array();
     $locationType =& CRM_Core_PseudoConstant::locationType();
     require_once 'CRM/Contact/BAO/Contact.php';
     $fields =& CRM_Contact_BAO_Contact::exportableFields('All', false, true);
     $fields = array_merge(CRM_Contribute_BAO_Contribution::getContributionFields(), $fields);
     $select = array();
     foreach ($fields as $name => $field) {
         if ($name) {
             $select[$name] = $field['title'];
         }
     }
     $select['group'] = ts('Group(s)');
     $select['tag'] = ts('Tag(s)');
     while ($ufFieldBAO->fetch()) {
         $ufField[$ufFieldBAO->id] = array();
         $phoneType = $locType = '';
         CRM_Core_DAO::storeValues($ufFieldBAO, $ufField[$ufFieldBAO->id]);
         CRM_Core_DAO_UFField::addDisplayEnums($ufField[$ufFieldBAO->id]);
         // fix the field_name value
         $ufField[$ufFieldBAO->id]['field_name'] = $select[$ufField[$ufFieldBAO->id]['field_name']];
         if ($ufFieldBAO->location_type_id) {
             $locType = ' (' . $locationType[$ufFieldBAO->location_type_id] . ') ';
         }
         if ($ufFieldBAO->phone_type) {
             if ($ufFieldBAO->phone_type != 'Phone') {
                 // this hack is to prevent Phone Phone
                 $phoneType .= '-' . $ufFieldBAO->phone_type;
             }
         }
         $ufField[$ufFieldBAO->id]['field_name'] .= $phoneType . $locType;
         $action = array_sum(array_keys($this->actionLinks()));
         if ($ufFieldBAO->is_active) {
             $action -= CRM_CORE_ACTION_ENABLE;
         } else {
             $action -= CRM_CORE_ACTION_DISABLE;
         }
         $ufField[$ufFieldBAO->id]['action'] = CRM_Core_Action::formLink(CRM_UF_Page_Field::actionLinks(), $action, array('id' => $ufFieldBAO->id, 'gid' => $this->_gid));
     }
     $this->assign('ufField', $ufField);
 }
开发者ID:bhirsch,项目名称:voipdrupal-4.7-1.0,代码行数:55,代码来源:Field.php

示例3: buildMappingForm

 /**
  * Build the mapping form.
  *
  * @param CRM_Core_Form $form
  * @param string $mappingType
  *   (Export/Import/Search Builder).
  * @param int $mappingId
  * @param int $columnNo
  * @param int $blockCount
  *   (no of blocks shown).
  * @param NULL $exportMode
  *
  * @return void
  */
 public static function buildMappingForm(&$form, $mappingType = 'Export', $mappingId = NULL, $columnNo, $blockCount = 3, $exportMode = NULL)
 {
     if ($mappingType == 'Export') {
         $name = "Map";
         $columnCount = array('1' => $columnNo);
     } elseif ($mappingType == 'Search Builder') {
         $name = "Builder";
         $columnCount = $columnNo;
     }
     //get the saved mapping details
     if ($mappingType == 'Export') {
         $form->applyFilter('saveMappingName', 'trim');
         //to save the current mappings
         if (!isset($mappingId)) {
             $saveDetailsName = ts('Save this field mapping');
             $form->add('text', 'saveMappingName', ts('Name'));
             $form->add('text', 'saveMappingDesc', ts('Description'));
         } else {
             $form->assign('loadedMapping', $mappingId);
             $params = array('id' => $mappingId);
             $temp = array();
             $mappingDetails = CRM_Core_BAO_Mapping::retrieve($params, $temp);
             $form->assign('savedName', $mappingDetails->name);
             $form->add('hidden', 'mappingId', $mappingId);
             $form->addElement('checkbox', 'updateMapping', ts('Update this field mapping'), NULL);
             $saveDetailsName = ts('Save as a new field mapping');
             $form->add('text', 'saveMappingName', ts('Name'));
             $form->add('text', 'saveMappingDesc', ts('Description'));
         }
         $form->addElement('checkbox', 'saveMapping', $saveDetailsName, NULL, array('onclick' => "showSaveDetails(this)"));
         $form->addFormRule(array('CRM_Export_Form_Map', 'formRule'), $form->get('mappingTypeId'));
     } elseif ($mappingType == 'Search Builder') {
         $form->addElement('submit', 'addBlock', ts('Also include contacts where'), array('class' => 'submit-link'));
     }
     $defaults = array();
     $hasLocationTypes = array();
     $hasRelationTypes = array();
     $fields = array();
     if ($mappingType == 'Export') {
         $required = TRUE;
     } elseif ($mappingType == 'Search Builder') {
         $required = FALSE;
     }
     $contactType = array('Individual', 'Household', 'Organization');
     foreach ($contactType as $value) {
         $contactFields = CRM_Contact_BAO_Contact::exportableFields($value, FALSE, $required);
         $contactFields = array_merge($contactFields, CRM_Contact_BAO_Query_Hook::singleton()->getFields());
         // exclude the address options disabled in the Address Settings
         $fields[$value] = CRM_Core_BAO_Address::validateAddressOptions($contactFields);
         ksort($fields[$value]);
         if ($mappingType == 'Export') {
             $relationships = array();
             $relationshipTypes = CRM_Contact_BAO_Relationship::getContactRelationshipType(NULL, NULL, NULL, $value);
             asort($relationshipTypes);
             foreach ($relationshipTypes as $key => $var) {
                 list($type) = explode('_', $key);
                 $relationships[$key]['title'] = $var;
                 $relationships[$key]['headerPattern'] = '/' . preg_quote($var, '/') . '/';
                 $relationships[$key]['export'] = TRUE;
                 $relationships[$key]['relationship_type_id'] = $type;
                 $relationships[$key]['related'] = TRUE;
                 $relationships[$key]['hasRelationType'] = 1;
             }
             if (!empty($relationships)) {
                 $fields[$value] = array_merge($fields[$value], array('related' => array('title' => ts('- related contact info -'))), $relationships);
             }
         }
     }
     //get the current employer for mapping.
     if ($required) {
         $fields['Individual']['current_employer']['title'] = ts('Current Employer');
     }
     // add component fields
     $compArray = array();
     //we need to unset groups, tags, notes for component export
     if ($exportMode != CRM_Export_Form_Select::CONTACT_EXPORT) {
         foreach (array('groups', 'tags', 'notes') as $value) {
             unset($fields['Individual'][$value]);
             unset($fields['Household'][$value]);
             unset($fields['Organization'][$value]);
         }
     }
     if ($mappingType == 'Search Builder') {
         //build the common contact fields array.
         $fields['Contact'] = array();
         foreach ($fields['Individual'] as $key => $value) {
//.........这里部分代码省略.........
开发者ID:riyadennis,项目名称:my_civicrm,代码行数:101,代码来源:Mapping.php

示例4: __construct

 /**
  * class constructor which also does all the work
  *
  * @param array   $params
  * @param array   $returnProperties
  * @param array   $fields
  * @param boolean $includeContactIds
  * @param boolean $strict
  * @param boolean $mode - mode the search is operating on
  *
  * @return Object
  * @access public
  */
 function __construct($params = NULL, $returnProperties = NULL, $fields = NULL, $includeContactIds = FALSE, $strict = FALSE, $mode = 1, $skipPermission = FALSE, $searchDescendentGroups = TRUE, $smartGroupCache = TRUE, $displayRelationshipType = NULL, $operator = 'AND')
 {
     // CRM_Core_Error::backtrace( );
     // CRM_Core_Error::debug( 'params', $params );
     // CRM_Core_Error::debug( 'post', $_POST );
     // CRM_Core_Error::debug( 'r', $returnProperties );
     $this->_params =& $params;
     if ($this->_params == NULL) {
         $this->_params = array();
     }
     if (empty($returnProperties)) {
         $this->_returnProperties = self::defaultReturnProperties($mode);
     } else {
         $this->_returnProperties =& $returnProperties;
     }
     $this->_includeContactIds = $includeContactIds;
     $this->_strict = $strict;
     $this->_mode = $mode;
     $this->_skipPermission = $skipPermission;
     $this->_smartGroupCache = $smartGroupCache;
     $this->_displayRelationshipType = $displayRelationshipType;
     $this->setOperator($operator);
     if ($fields) {
         $this->_fields =& $fields;
         $this->_search = FALSE;
         $this->_skipPermission = TRUE;
     } else {
         $this->_fields = CRM_Contact_BAO_Contact::exportableFields('All', FALSE, TRUE, TRUE);
         $fields = CRM_Core_Component::getQueryFields();
         unset($fields['note']);
         $this->_fields = array_merge($this->_fields, $fields);
         // add activity fields
         $fields = CRM_Activity_BAO_Activity::exportableFields();
         $this->_fields = array_merge($this->_fields, $fields);
     }
     // basically do all the work once, and then reuse it
     $this->initialize();
 }
开发者ID:peteainsworth,项目名称:civicrm-4.2.9-drupal,代码行数:51,代码来源:Query.php

示例5: getTokenDetails

 /**
  * Gives required details of contacts in an indexed array format so we
  * can iterate in a nice loop and do token evaluation
  *
  * @param $contactIDs
  * @param array $returnProperties
  *   Of required properties.
  * @param bool $skipOnHold Don't return on_hold contact info also.
  *   Don't return on_hold contact info also.
  * @param bool $skipDeceased Don't return deceased contact info.
  *   Don't return deceased contact info.
  * @param array $extraParams
  *   Extra params.
  * @param array $tokens
  *   The list of tokens we've extracted from the content.
  * @param null $className
  * @param int $jobID
  *   The mailing list jobID - this is a legacy param.
  *
  * @return array
  */
 public static function getTokenDetails($contactIDs, $returnProperties = NULL, $skipOnHold = TRUE, $skipDeceased = TRUE, $extraParams = NULL, $tokens = array(), $className = NULL, $jobID = NULL)
 {
     if (empty($contactIDs)) {
         // putting a fatal here so we can track if/when this happens
         CRM_Core_Error::fatal();
     }
     // @todo this functions needs unit tests.
     $params = array();
     foreach ($contactIDs as $key => $contactID) {
         $params[] = array(CRM_Core_Form::CB_PREFIX . $contactID, '=', 1, 0, 0);
     }
     // fix for CRM-2613
     if ($skipDeceased) {
         $params[] = array('is_deceased', '=', 0, 0, 0);
     }
     //fix for CRM-3798
     if ($skipOnHold) {
         $params[] = array('on_hold', '=', 0, 0, 0);
     }
     if ($extraParams) {
         $params = array_merge($params, $extraParams);
     }
     // if return properties are not passed then get all return properties
     if (empty($returnProperties)) {
         $fields = array_merge(array_keys(CRM_Contact_BAO_Contact::exportableFields()), array('display_name', 'checksum', 'contact_id'));
         foreach ($fields as $key => $val) {
             // The unavailable fields are not available as tokens, do not have a one-2-one relationship
             // with contacts and are expensive to resolve.
             // @todo see CRM-17253 - there are some other fields (e.g note) that should be excluded
             // and upstream calls to this should populate return properties.
             $unavailableFields = array('group', 'tag');
             if (!in_array($val, $unavailableFields)) {
                 $returnProperties[$val] = 1;
             }
         }
     }
     $custom = array();
     foreach ($returnProperties as $name => $dontCare) {
         $cfID = CRM_Core_BAO_CustomField::getKeyID($name);
         if ($cfID) {
             $custom[] = $cfID;
         }
     }
     //get the total number of contacts to fetch from database.
     $numberofContacts = count($contactIDs);
     $query = new CRM_Contact_BAO_Query($params, $returnProperties);
     $details = $query->apiQuery($params, $returnProperties, NULL, NULL, 0, $numberofContacts);
     $contactDetails =& $details[0];
     foreach ($contactIDs as $key => $contactID) {
         if (array_key_exists($contactID, $contactDetails)) {
             if (CRM_Utils_Array::value('preferred_communication_method', $returnProperties) == 1 && array_key_exists('preferred_communication_method', $contactDetails[$contactID])) {
                 $pcm = CRM_Core_PseudoConstant::get('CRM_Contact_DAO_Contact', 'preferred_communication_method');
                 // communication Preference
                 $contactPcm = explode(CRM_Core_DAO::VALUE_SEPARATOR, $contactDetails[$contactID]['preferred_communication_method']);
                 $result = array();
                 foreach ($contactPcm as $key => $val) {
                     if ($val) {
                         $result[$val] = $pcm[$val];
                     }
                 }
                 $contactDetails[$contactID]['preferred_communication_method'] = implode(', ', $result);
             }
             foreach ($custom as $cfID) {
                 if (isset($contactDetails[$contactID]["custom_{$cfID}"])) {
                     $contactDetails[$contactID]["custom_{$cfID}"] = CRM_Core_BAO_CustomField::getDisplayValue($contactDetails[$contactID]["custom_{$cfID}"], $cfID, $details[1]);
                 }
             }
             // special case for greeting replacement
             foreach (array('email_greeting', 'postal_greeting', 'addressee') as $val) {
                 if (!empty($contactDetails[$contactID][$val])) {
                     $contactDetails[$contactID][$val] = $contactDetails[$contactID]["{$val}_display"];
                 }
             }
         }
     }
     // also call a hook and get token details
     CRM_Utils_Hook::tokenValues($details[0], $contactIDs, $jobID, $tokens, $className);
     return $details;
 }
开发者ID:rameshrr99,项目名称:civicrm-core,代码行数:100,代码来源:Token.php

示例6: testMergeHousehold

 public function testMergeHousehold()
 {
     $this->markTestSkipped('Skipping for now as it works fine locally.');
     $this->webtestLogin();
     // Create new  group
     $groupName = 'TestGroup_' . substr(sha1(rand()), 0, 7);
     $this->WebtestAddGroup($groupName);
     // Adding Parent group contact
     // We're using Quick Add block on the main page for this.
     $houseHold = 'H' . substr(sha1(rand()), 0, 5) . ' House';
     $this->openCiviPage("contact/add", "reset=1&ct=Household");
     $this->click('household_name');
     $this->type('household_name', $houseHold);
     //address section
     $this->click("addressBlock");
     $this->waitForElementPresent("address_1_street_address");
     // fill in address
     $this->click("//div[@id='addressBlockId']/div[1]");
     $this->type("address_1_street_address", "121A Sherman St. Apt. 12");
     $this->type("address_1_city", "Dumfries");
     $this->type("address_1_postal_code", "1234");
     $this->select("address_1_country_id", "United States");
     $this->select("address_1_state_province_id", "value=1019");
     $this->click('_qf_Contact_upload_view');
     $this->waitForPageToLoad($this->getTimeoutMsec());
     // Add contact to group
     // visit group tab.
     $this->click("css=li#tab_group a");
     $this->waitForElementPresent("group_id");
     // Add to group.
     $this->select("group_id", "label={$groupName}");
     $this->click("_qf_GroupContact_next");
     $this->waitForAjaxContent();
     $firstName1 = 'aa' . substr(sha1(rand()), 0, 5);
     $this->webtestAddContact($firstName1, "Smith", "{$firstName1}.smith@example.org");
     $sortName1 = "Smith, {$firstName1}";
     $displayName1 = "{$firstName1} Smith";
     // Add contact to parent  group
     // visit group tab.
     $this->click("css=li#tab_group a");
     $this->waitForElementPresent("group_id");
     // Add to group.
     $this->select("group_id", "label={$groupName}");
     $this->click("_qf_GroupContact_next");
     $this->waitForAjaxContent();
     $firstName2 = 'bb' . substr(sha1(rand()), 0, 5);
     $this->openCiviPage("contact/add", "reset=1&ct=Individual", "_qf_Contact_upload_view-bottom");
     $this->type('first_name', $firstName2);
     $this->type('last_name', "Smith");
     $this->type('email_1_email', "{$firstName2}.smith@example.org");
     //address section
     $this->click("addressBlock");
     $this->waitForElementPresent("address_1_street_address");
     $this->click("//div[@id='addressBlockId']/div[1]");
     $this->click("address[1][use_shared_address]");
     $this->waitForElementPresent("address_1_master_contact_id");
     $this->select2('address_1_master_contact_id', $houseHold);
     $this->waitForTextPresent("121A Sherman");
     $this->click('_qf_Contact_upload_view-bottom');
     $this->waitForPageToLoad($this->getTimeoutMsec());
     $sortName2 = "Smith, {$firstName2}";
     $displayName2 = "{$firstName2} Smith";
     // Add contact to parent  group
     // visit group tab.
     $this->click("css=li#tab_group a");
     $this->waitForElementPresent("group_id");
     // Add to group.
     $this->select("group_id", "label={$groupName}");
     $this->click("_qf_GroupContact_next");
     $this->waitForAjaxContent();
     $this->openCiviPage("contact/search", "reset=1", NULL);
     // Select group.
     $this->select("group", "label={$groupName}");
     // Click to search.
     $this->clickLink("_qf_Basic_refresh");
     // Is contact present in search result?
     $this->assertElementContainsText('css=div.crm-search-results', $sortName1, "Contact did not found in search result!");
     // Is contact present in search result?
     $this->assertElementContainsText('css=div.crm-search-results', $sortName2, "Contact did not found in search result!");
     // Is contact present in search result?
     $this->assertElementContainsText('css=div.crm-search-results', $houseHold, "Contact did not found in search result!");
     // select to export all the contasct from search result.
     $this->click("CIVICRM_QFID_ts_all_4");
     // Select the task action to export.
     $this->click("task");
     $this->select("task", "label=Export Contacts");
     $this->waitForPageToLoad($this->getTimeoutMsec());
     $this->click("CIVICRM_QFID_2_10");
     $csvFile = $this->downloadCSV("_qf_Select_next-bottom");
     // Build header row for assertion.
     require_once 'CRM/Contact/BAO/Contact.php';
     $expotableFields = CRM_Contact_BAO_Contact::exportableFields('All', FALSE, TRUE);
     $checkHeaders = array();
     foreach ($expotableFields as $key => $field) {
         // Exclude custom fields.
         if ($key && substr($key, 0, 6) == 'custom') {
             continue;
         }
         $checkHeaders[] = $field['title'];
     }
//.........这里部分代码省略.........
开发者ID:rajeshrhino,项目名称:civicrm-core,代码行数:101,代码来源:ContactTest.php

示例7: array

 /**
  * different type of Contact Tokens
  *
  * @static
  * return array
  */
 static function &contactTokens()
 {
     static $tokens = null;
     if (!$tokens) {
         require_once 'CRM/Contact/BAO/Contact.php';
         require_once 'CRM/Core/BAO/CustomField.php';
         $additionalFields = array('checksum' => array('title' => ts('Checksum')), 'contact_id' => array('title' => ts('Internal Contact ID')));
         $exportFields = array_merge(CRM_Contact_BAO_Contact::exportableFields(), $additionalFields);
         $values = array_merge(array_keys($exportFields));
         unset($values[0]);
         //FIXME:skipping some tokens for time being.
         $skipTokens = array('is_bulkmail', 'group', 'tag', 'contact_sub_type', 'note', 'is_deceased', 'deceased_date', 'legal_identifier', 'contact_sub_type', 'user_unique_id');
         $customFields = array();
         $customFields = CRM_Core_BAO_CustomField::getFields('Individual');
         foreach ($values as $key => $val) {
             if (in_array($val, $skipTokens)) {
                 continue;
             }
             //keys for $tokens should be constant. $token Values are changed for Custom Fields. CRM-3734
             if ($customFieldId = CRM_Core_BAO_CustomField::getKeyID($val)) {
                 $tokens["{contact.{$val}}"] = $customFields[$customFieldId]['label'] . " :: " . $customFields[$customFieldId]['groupTitle'];
             } else {
                 $tokens["{contact.{$val}}"] = $exportFields[$val]['title'];
             }
         }
         // might as well get all the hook tokens to
         require_once 'CRM/Utils/Hook.php';
         $hookTokens = array();
         CRM_Utils_Hook::tokens($hookTokens);
         foreach ($hookTokens as $category => $tokenValues) {
             foreach ($tokenValues as $key => $value) {
                 if (is_numeric($key)) {
                     $key = $value;
                 }
                 if (!preg_match('/^\\{[^\\}]+\\}$/', $key)) {
                     $key = '{' . $key . '}';
                 }
                 if (preg_match('/^\\{([^\\}]+)\\}$/', $value, $matches)) {
                     $value = $matches[1];
                 }
                 $tokens[$key] = $value;
             }
         }
     }
     return $tokens;
 }
开发者ID:hampelm,项目名称:Ginsberg-CiviDemo,代码行数:52,代码来源:SelectValues.php

示例8: browse

 /**
  * Browse all CiviCRM Profile group fields.
  *
  * @return void
  */
 public function browse()
 {
     $resourceManager = CRM_Core_Resources::singleton();
     if (!empty($_GET['new']) && $resourceManager->ajaxPopupsEnabled) {
         $resourceManager->addScriptFile('civicrm', 'js/crm.addNew.js', 999, 'html-header');
     }
     $ufField = array();
     $ufFieldBAO = new CRM_Core_BAO_UFField();
     // fkey is gid
     $ufFieldBAO->uf_group_id = $this->_gid;
     $ufFieldBAO->orderBy('weight', 'field_name');
     $ufFieldBAO->find();
     $otherModules = CRM_Core_BAO_UFGroup::getUFJoinRecord($this->_gid);
     $this->assign('otherModules', $otherModules);
     $isGroupReserved = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_UFGroup', $this->_gid, 'is_reserved');
     $this->assign('isGroupReserved', $isGroupReserved);
     $profileType = CRM_Core_BAO_UFField::getProfileType($this->_gid);
     if ($profileType == 'Contribution' || $profileType == 'Membership' || $profileType == 'Activity' || $profileType == 'Participant') {
         $this->assign('skipCreate', TRUE);
     }
     $locationType = array();
     $locationType = CRM_Core_PseudoConstant::get('CRM_Core_DAO_Address', 'location_type_id');
     $fields = CRM_Contact_BAO_Contact::exportableFields('All', FALSE, TRUE);
     $fields = array_merge(CRM_Contribute_BAO_Contribution::getContributionFields(), $fields);
     $select = array();
     foreach ($fields as $name => $field) {
         if ($name) {
             $select[$name] = $field['title'];
         }
     }
     $select['group'] = ts('Group(s)');
     $select['tag'] = ts('Tag(s)');
     $visibility = CRM_Core_SelectValues::ufVisibility();
     while ($ufFieldBAO->fetch()) {
         $ufField[$ufFieldBAO->id] = array();
         $phoneType = $locType = '';
         CRM_Core_DAO::storeValues($ufFieldBAO, $ufField[$ufFieldBAO->id]);
         $ufField[$ufFieldBAO->id]['visibility_display'] = $visibility[$ufFieldBAO->visibility];
         $ufField[$ufFieldBAO->id]['label'] = $ufFieldBAO->label;
         $action = array_sum(array_keys($this->actionLinks()));
         if ($ufFieldBAO->is_active) {
             $action -= CRM_Core_Action::ENABLE;
         } else {
             $action -= CRM_Core_Action::DISABLE;
         }
         if ($ufFieldBAO->is_reserved) {
             $action -= CRM_Core_Action::UPDATE;
             $action -= CRM_Core_Action::DISABLE;
             $action -= CRM_Core_Action::DELETE;
         }
         $ufField[$ufFieldBAO->id]['order'] = $ufField[$ufFieldBAO->id]['weight'];
         $ufField[$ufFieldBAO->id]['action'] = CRM_Core_Action::formLink(self::actionLinks(), $action, array('id' => $ufFieldBAO->id, 'gid' => $this->_gid), ts('more'), FALSE, 'ufField.row.actions', 'UFField', $ufFieldBAO->id);
     }
     $returnURL = CRM_Utils_System::url('civicrm/admin/uf/group/field', "reset=1&action=browse&gid={$this->_gid}");
     $filter = "uf_group_id = {$this->_gid}";
     CRM_Utils_Weight::addOrder($ufField, 'CRM_Core_DAO_UFField', 'id', $returnURL, $filter);
     $this->assign('ufField', $ufField);
     // retrieve showBestResult from session
     $session = CRM_Core_Session::singleton();
     $showBestResult = $session->get('showBestResult');
     $this->assign('showBestResult', $showBestResult);
     $session->set('showBestResult', 0);
 }
开发者ID:kidaa30,项目名称:yes,代码行数:68,代码来源:Field.php

示例9: exportContacts

 /**
  * Function to get the list the export fields
  *
  * @param int $exportContact type of export
  *
  * @access public
  */
 function exportContacts($selectAll, $ids, $formValues, $order = null, $fields = null)
 {
     $headerRows = array();
     $returnProperties = array();
     $primary = false;
     if ($fields) {
         $location = array();
         $locationType = array("Work" => array(), "Home" => array(), "Main" => array(), "Other" => array());
         $returnFields = $fields;
         foreach ($returnFields as $key => $field) {
             $flag = true;
             $phone_type = "";
             $phoneFlag = false;
             if ($field[3] && $field[1] == 'phone') {
                 if ($field[3] == 'Phone') {
                     $phone_type = $field[1] . "-" . "Phone";
                 } else {
                     if ($field[3] == 'Mobile') {
                         $phone_type = $field[1] . "-" . "Mobile";
                     } else {
                         if ($field[3] == 'Fax') {
                             $phone_type = $field[1] . "-" . "Fax";
                         } else {
                             if ($field[3] == 'Pager') {
                                 $phone_type = $field[1] . "-" . "Pager";
                             }
                         }
                     }
                 }
                 $phoneFlag = true;
             }
             if ($field[2]) {
                 if ($field[2] == 1) {
                     if ($phoneFlag) {
                         $locationType["Home"][$phone_type] = 1;
                     } else {
                         $locationType["Home"][$field[1]] = 1;
                     }
                 } else {
                     if ($field[2] == 2) {
                         if ($phoneFlag) {
                             $locationType["Work"][$phone_type] = 1;
                         } else {
                             $locationType["Work"][$field[1]] = 1;
                         }
                     } else {
                         if ($field[2] == 3) {
                             if ($phoneFlag) {
                                 $locationType["Main"][$phone_type] = 1;
                             } else {
                                 $locationType["Main"][$field[1]] = 1;
                             }
                         } else {
                             if ($field[2] == 4) {
                                 if ($phoneFlag) {
                                     $locationType["Other"][$phone_type] = 1;
                                 } else {
                                     $locationType["Other"][$field[1]] = 1;
                                 }
                             }
                         }
                     }
                 }
                 $flag = false;
             }
             if ($flag) {
                 $returnProperties[$field[1]] = 1;
             }
         }
         $returnProperties['location'] = $locationType;
     } else {
         $primary = true;
         $fields = CRM_Contact_BAO_Contact::exportableFields('All', true, true);
         foreach ($fields as $key => $var) {
             if ($key) {
                 $returnProperties[$key] = 1;
             }
         }
     }
     if ($primary) {
         $returnProperties['location_type'] = 1;
         $returnProperties['im_provider'] = 1;
         $returnProperties['phone_type'] = 1;
     }
     $session =& new CRM_Core_Session();
     if ($selectAll) {
         if ($primary) {
             $query =& new CRM_Contact_BAO_Query($formValues, $returnProperties, $fields);
         } else {
             $query =& new CRM_Contact_BAO_Query($formValues, $returnProperties);
         }
     } else {
         $params = array();
//.........这里部分代码省略.........
开发者ID:bhirsch,项目名称:voipdrupal-4.7-1.0,代码行数:101,代码来源:Export.php

示例10: exportComponents

 public static function exportComponents($selectAll, $ids, $params, $order = NULL, $fields = NULL, $moreReturnProperties = NULL, $exportMode = CRM_Export_Form_Select_Relationship::RELATIONSHIP_EXPORT, $componentClause = NULL, $componentTable = NULL, $mergeSameAddress = FALSE, $mergeSameHousehold = FALSE, $exportParams = array(), $queryOperator = 'AND')
 {
     $headerRows = $returnProperties = array();
     $queryMode = CRM_Relationship_BAO_Query::MODE_RELATIONSHIPS;
     //Welke velden exporteren, gezet bij een mapping, indien niet gezet, primary fields.
     if ($fields) {
         foreach ($fields as $key => $value) {
             $fieldName = CRM_Utils_Array::value(0, $value);
             if (!$fieldName) {
                 continue;
             }
             $returnProperties[$fieldName] = 1;
         }
     } else {
         // Copied from CRM_Relationship_BAO_QUERY should be refactored to seperate
         // method.
         $fields = CRM_Contact_BAO_Relationship::fields();
         // Add display_name for both contacts
         $contact_fields = CRM_Contact_BAO_Contact::exportableFields('All', FALSE, TRUE, TRUE);
         $fields['contact_a'] = $contact_fields['display_name'];
         $fields['contact_a']['where'] = 'contact_a.display_name';
         $fields['contact_b'] = $contact_fields['display_name'];
         $fields['contact_b']['where'] = 'contact_b.display_name';
         // Add relationship type field
         $relationship_type_fields = CRM_Contact_BAO_RelationshipType::fields();
         $fields['relationship_type'] = $relationship_type_fields['label_a_b'];
         $fields['relationship_type']['where'] = 'relationship_type.label_a_b';
         // Add custom fields
         $fields = array_merge($fields, CRM_Core_BAO_CustomField::getFieldsForImport('Relationship'));
         $returnProperties = CRM_Relationship_BAO_Query::defaultReturnProperties();
     }
     if ($moreReturnProperties) {
         $returnProperties = array_merge($returnProperties, $moreReturnProperties);
     }
     $query = new CRM_Relationship_BAO_Query($params, $returnProperties, NULL, FALSE, FALSE, FALSE, TRUE, $queryOperator);
     //sort by state
     //CRM-15301
     $query->_sort = $order;
     list($select, $from, $where, $having) = $query->query();
     $allRelContactArray = $relationQuery = array();
     if (!$selectAll && $componentTable) {
         // TODO For not select all
         //$from .= " INNER JOIN $componentTable ctTable ON ctTable.contact_id = contact_a.id ";
     } elseif ($componentClause) {
         if (empty($where)) {
             $where = "WHERE {$componentClause}";
         } else {
             $where .= " AND {$componentClause}";
         }
     }
     $queryString = "{$select} {$from} {$where} {$having}";
     $groupBy = "";
     if ($queryMode & CRM_Relationship_BAO_Query::MODE_RELATIONSHIPS && $query->_useGroupBy) {
         $groupBy = " GROUP BY relationship.id";
     }
     $queryString .= $groupBy;
     // always add relationship.id to the ORDER clause
     // so the order is deterministic
     if (strpos('relationship.id', $order) === FALSE) {
         $order .= ", relationship.id";
     }
     if ($order) {
         list($field, $dir) = explode(' ', $order, 2);
         $field = trim($field);
         if (!empty($returnProperties[$field])) {
             //CRM-15301
             $queryString .= " ORDER BY {$order}";
         }
     }
     $componentDetails = $headerRows = $sqlColumns = array();
     $setHeader = TRUE;
     $rowCount = self::EXPORT_ROW_COUNT;
     $offset = 0;
     // we write to temp table often to avoid using too much memory
     $tempRowCount = 100;
     $count = -1;
     // for CRM-3157 purposes
     $i18n = CRM_Core_I18n::singleton();
     $outputColumns = array();
     //@todo - it would be clearer to start defining output columns earlier in this function rather than stick with return properties until this point
     // as the array is not actually 'returnProperties' after the sql query is formed - making the alterations to it confusing
     foreach ($returnProperties as $key => $value) {
         $outputColumns[$key] = $value;
     }
     while (1) {
         $limitQuery = "{$queryString} LIMIT {$offset}, {$rowCount}";
         $dao = CRM_Core_DAO::executeQuery($limitQuery);
         if ($dao->N <= 0) {
             break;
         }
         while ($dao->fetch()) {
             $count++;
             $row = array();
             //convert the pseudo constants
             // CRM-14398 there is problem in this architecture that is not easily solved. For now we are using the cloned
             // temporary iterationDAO object to get around it.
             // the issue is that the convertToPseudoNames function is adding additional properties (e.g for campaign) to the DAO object
             // these additional properties are NOT reset when the $dao cycles through the while loop
             // nor are they overwritten as they are not in the loop
             // the convertToPseudoNames will not adequately over-write them either as it doesn't 'kick-in' unless the
//.........这里部分代码省略.........
开发者ID:Chirojeugd-Vlaanderen,项目名称:civicrm-relationship-entity,代码行数:101,代码来源:Relationship.php

示例11: __construct

 /**
  * class constructor which also does all the work
  *
  * @param array   $params
  * @param array   $returnProperties
  * @param array   $fields
  * @param boolean $includeContactIds
  * @param boolean $strict
  * @param boolean $mode - mode the search is operating on
  *
  * @return Object
  * @access public
  */
 function __construct($params = null, $returnProperties = null, $fields = null, $includeContactIds = false, $strict = false, $mode = 1, $skipPermission = false, $searchDescendentGroups = true, $smartGroupCache = true)
 {
     require_once 'CRM/Contact/BAO/Contact.php';
     // CRM_Core_Error::backtrace( );
     // CRM_Core_Error::debug_var( 'params', $params );
     // CRM_Core_Error::debug( 'post', $_POST );
     // CRM_Core_Error::debug( 'r', $returnProperties );
     $this->_params =& $params;
     if ($this->_params == null) {
         $this->_params = array();
     }
     if (empty($returnProperties)) {
         $this->_returnProperties =& self::defaultReturnProperties($mode);
     } else {
         $this->_returnProperties =& $returnProperties;
     }
     $this->_includeContactIds = $includeContactIds;
     $this->_strict = $strict;
     $this->_mode = $mode;
     $this->_skipPermission = $skipPermission;
     $this->_smartGroupCache = $smartGroupCache;
     if ($fields) {
         $this->_fields =& $fields;
         $this->_search = false;
         $this->_skipPermission = true;
     } else {
         require_once 'CRM/Contact/BAO/Contact.php';
         $this->_fields = CRM_Contact_BAO_Contact::exportableFields('All', false, true);
         require_once 'CRM/Core/Component.php';
         $fields =& CRM_Core_Component::getQueryFields();
         unset($fields['note']);
         $this->_fields = array_merge($this->_fields, $fields);
         // add activity fields
         require_once 'CRM/Activity/BAO/Activity.php';
         $fields = CRM_Activity_BAO_Activity::exportableFields();
         $this->_fields = array_merge($this->_fields, $fields);
     }
     // basically do all the work once, and then reuse it
     $this->initialize();
     // CRM_Core_Error::debug( $this );
 }
开发者ID:hampelm,项目名称:Ginsberg-CiviDemo,代码行数:54,代码来源:Query.php

示例12: exportComponents


//.........这里部分代码省略.........
                     }
                 } else {
                     //hack to fix component fields
                     if ($fieldName == 'event_id') {
                         $returnProperties['event_title'] = 1;
                     } else {
                         $returnProperties[$fieldName] = 1;
                     }
                 }
             }
         }
         // hack to add default returnproperty based on export mode
         if ($exportMode == CRM_Export_Form_Select::CONTRIBUTE_EXPORT) {
             $returnProperties['contribution_id'] = 1;
         } else {
             if ($exportMode == CRM_Export_Form_Select::EVENT_EXPORT) {
                 $returnProperties['participant_id'] = 1;
             } else {
                 if ($exportMode == CRM_Export_Form_Select::MEMBER_EXPORT) {
                     $returnProperties['membership_id'] = 1;
                 } else {
                     if ($exportMode == CRM_Export_Form_Select::PLEDGE_EXPORT) {
                         $returnProperties['pledge_id'] = 1;
                     } else {
                         if ($exportMode == CRM_Export_Form_Select::CASE_EXPORT) {
                             $returnProperties['case_id'] = 1;
                         }
                     }
                 }
             }
         }
     } else {
         $primary = true;
         $fields = CRM_Contact_BAO_Contact::exportableFields('All', true, true);
         foreach ($fields as $key => $var) {
             if ($key && substr($key, 0, 6) != 'custom') {
                 //for CRM=952
                 $returnProperties[$key] = 1;
             }
         }
         if ($primary) {
             $returnProperties['location_type'] = 1;
             $returnProperties['im_provider'] = 1;
             $returnProperties['phone_type_id'] = 1;
             $returnProperties['provider_id'] = 1;
             $returnProperties['current_employer'] = 1;
         }
         $extraReturnProperties = array();
         $paymentFields = false;
         switch ($queryMode) {
             case CRM_Contact_BAO_Query::MODE_EVENT:
                 $paymentFields = true;
                 $paymentTableId = "participant_id";
                 break;
             case CRM_Contact_BAO_Query::MODE_MEMBER:
                 $paymentFields = true;
                 $paymentTableId = "membership_id";
                 break;
             case CRM_Contact_BAO_Query::MODE_PLEDGE:
                 require_once 'CRM/Pledge/BAO/Query.php';
                 $extraReturnProperties = CRM_Pledge_BAO_Query::extraReturnProperties($queryMode);
                 $paymentFields = true;
                 $paymentTableId = "pledge_payment_id";
                 break;
             case CRM_Contact_BAO_Query::MODE_CASE:
                 require_once 'CRM/Case/BAO/Query.php';
开发者ID:ksecor,项目名称:civicrm,代码行数:67,代码来源:Export.php

示例13: getDetails

 /**
  * gives required details of contacts 
  *
  * @param  array   $contactIds       of conatcts
  * @param  array   $returnProperties of required properties
  * @param  boolean $skipOnHold       don't return on_hold contact info also.
  * @param  boolean $skipDeceased     don't return deceased contact info.
  * @param  array   $extraParams      extra params
  *
  * @return array
  * @access public
  */
 function getDetails($contactIDs, $returnProperties = null, $skipOnHold = true, $skipDeceased = true, $extraParams = null)
 {
     $params = array();
     foreach ($contactIDs as $key => $contactID) {
         $params[] = array(CRM_Core_Form::CB_PREFIX . $contactID, '=', 1, 0, 0);
     }
     // fix for CRM-2613
     if ($skipDeceased) {
         $params[] = array('is_deceased', '=', 0, 0, 0);
     }
     //fix for CRM-3798
     if ($skipOnHold) {
         $params[] = array('on_hold', '=', 0, 0, 0);
     }
     if ($extraParams) {
         $params = array_merge($params, $extraParams);
     }
     // if return properties are not passed then get all return properties
     if (empty($returnProperties)) {
         require_once 'CRM/Contact/BAO/Contact.php';
         $fields = array_merge(array_keys(CRM_Contact_BAO_Contact::exportableFields()), array('display_name', 'checksum', 'contact_id'));
         foreach ($fields as $key => $val) {
             $returnProperties[$val] = 1;
         }
     }
     $custom = array();
     foreach ($returnProperties as $name => $dontCare) {
         $cfID = CRM_Core_BAO_CustomField::getKeyID($name);
         if ($cfID) {
             $custom[] = $cfID;
         }
     }
     //get the total number of contacts to fetch from database.
     $numberofContacts = count($contactIDs);
     require_once 'CRM/Contact/BAO/Query.php';
     $query = new CRM_Contact_BAO_Query($params, $returnProperties);
     $details = $query->apiQuery($params, $returnProperties, NULL, NULL, 0, $numberofContacts);
     $contactDetails =& $details[0];
     foreach ($contactIDs as $key => $contactID) {
         if (array_key_exists($contactID, $contactDetails)) {
             if (CRM_Utils_Array::value('preferred_communication_method', $returnProperties) == 1 && array_key_exists('preferred_communication_method', $contactDetails[$contactID])) {
                 require_once 'CRM/Core/PseudoConstant.php';
                 $pcm = CRM_Core_PseudoConstant::pcm();
                 // communication Prefferance
                 require_once 'CRM/Core/BAO/CustomOption.php';
                 $contactPcm = explode(CRM_Core_BAO_CustomOption::VALUE_SEPERATOR, $contactDetails[$contactID]['preferred_communication_method']);
                 $result = array();
                 foreach ($contactPcm as $key => $val) {
                     if ($val) {
                         $result[$val] = $pcm[$val];
                     }
                 }
                 $contactDetails[$contactID]['preferred_communication_method'] = implode(', ', $result);
             }
             foreach ($custom as $cfID) {
                 if (isset($contactDetails[$contactID]["custom_{$cfID}"])) {
                     $contactDetails[$contactID]["custom_{$cfID}"] = CRM_Core_BAO_CustomField::getDisplayValue($contactDetails[$contactID]["custom_{$cfID}"], $cfID, $details[1]);
                 }
             }
             //special case for greeting replacement
             foreach (array('email_greeting', 'postal_greeting', 'addressee') as $val) {
                 if (CRM_Utils_Array::value($val, $contactDetails[$contactID])) {
                     $contactDetails[$contactID][$val] = $contactDetails[$contactID]["{$val}_display"];
                 }
             }
         }
     }
     // also call a hook and get token details
     require_once 'CRM/Utils/Hook.php';
     CRM_Utils_Hook::tokenValues($details[0], $contactIDs);
     return $details;
 }
开发者ID:hampelm,项目名称:Ginsberg-CiviDemo,代码行数:84,代码来源:Mailing.php

示例14: exportComponents


//.........这里部分代码省略.........
         if ($exportMode == CRM_Export_Form_Select::CONTRIBUTE_EXPORT) {
             $returnProperties['contribution_id'] = 1;
         } else {
             if ($exportMode == CRM_Export_Form_Select::EVENT_EXPORT) {
                 $returnProperties['participant_id'] = 1;
                 if ($returnProperties['participant_role']) {
                     unset($returnProperties['participant_role']);
                     $returnProperties['participant_role_id'] = 1;
                 }
             } else {
                 if ($exportMode == CRM_Export_Form_Select::MEMBER_EXPORT) {
                     $returnProperties['membership_id'] = 1;
                 } else {
                     if ($exportMode == CRM_Export_Form_Select::PLEDGE_EXPORT) {
                         $returnProperties['pledge_id'] = 1;
                     } else {
                         if ($exportMode == CRM_Export_Form_Select::CASE_EXPORT) {
                             $returnProperties['case_id'] = 1;
                         } else {
                             if ($exportMode == CRM_Export_Form_Select::GRANT_EXPORT) {
                                 $returnProperties['grant_id'] = 1;
                             } else {
                                 if ($exportMode == CRM_Export_Form_Select::ACTIVITY_EXPORT) {
                                     $returnProperties['activity_id'] = 1;
                                 }
                             }
                         }
                     }
                 }
             }
         }
     } else {
         $primary = true;
         $fields = CRM_Contact_BAO_Contact::exportableFields('All', true, true);
         foreach ($fields as $key => $var) {
             if ($key && substr($key, 0, 6) != 'custom') {
                 //for CRM=952
                 $returnProperties[$key] = 1;
             }
         }
         if ($primary) {
             $returnProperties['location_type'] = 1;
             $returnProperties['im_provider'] = 1;
             $returnProperties['phone_type_id'] = 1;
             $returnProperties['provider_id'] = 1;
             $returnProperties['current_employer'] = 1;
         }
         $extraReturnProperties = array();
         $paymentFields = false;
         switch ($queryMode) {
             case CRM_Contact_BAO_Query::MODE_EVENT:
                 $paymentFields = true;
                 $paymentTableId = "participant_id";
                 break;
             case CRM_Contact_BAO_Query::MODE_MEMBER:
                 $paymentFields = true;
                 $paymentTableId = "membership_id";
                 break;
             case CRM_Contact_BAO_Query::MODE_PLEDGE:
                 require_once 'CRM/Pledge/BAO/Query.php';
                 $extraReturnProperties = CRM_Pledge_BAO_Query::extraReturnProperties($queryMode);
                 $paymentFields = true;
                 $paymentTableId = "pledge_payment_id";
                 break;
             case CRM_Contact_BAO_Query::MODE_CASE:
                 require_once 'CRM/Case/BAO/Query.php';
开发者ID:hampelm,项目名称:Ginsberg-CiviDemo,代码行数:67,代码来源:Export.php

示例15: __construct

 /**
  * Class constructor which also does all the work.
  *
  * @param array $params
  * @param array $returnProperties
  * @param array $fields
  * @param bool $includeContactIds
  * @param bool $strict
  * @param bool|int $mode - mode the search is operating on
  *
  * @param bool $skipPermission
  * @param bool $searchDescendentGroups
  * @param bool $smartGroupCache
  * @param null $displayRelationshipType
  * @param string $operator
  *
  * @return \CRM_Contact_BAO_Query
  */
 public function __construct($params = NULL, $returnProperties = NULL, $fields = NULL, $includeContactIds = FALSE, $strict = FALSE, $mode = 1, $skipPermission = FALSE, $searchDescendentGroups = TRUE, $smartGroupCache = TRUE, $displayRelationshipType = NULL, $operator = 'AND')
 {
     $this->_params =& $params;
     if ($this->_params == NULL) {
         $this->_params = array();
     }
     if (empty($returnProperties)) {
         $this->_returnProperties = self::defaultReturnProperties($mode);
     } else {
         $this->_returnProperties =& $returnProperties;
     }
     $this->_includeContactIds = $includeContactIds;
     $this->_strict = $strict;
     $this->_mode = $mode;
     $this->_skipPermission = $skipPermission;
     $this->_smartGroupCache = $smartGroupCache;
     $this->_displayRelationshipType = $displayRelationshipType;
     $this->setOperator($operator);
     if ($fields) {
         $this->_fields =& $fields;
         $this->_search = FALSE;
         $this->_skipPermission = TRUE;
     } else {
         $this->_fields = CRM_Contact_BAO_Contact::exportableFields('All', FALSE, TRUE, TRUE, FALSE, !$skipPermission);
         $fields = CRM_Core_Component::getQueryFields(!$this->_skipPermission);
         unset($fields['note']);
         $this->_fields = array_merge($this->_fields, $fields);
         // add activity fields
         $fields = CRM_Activity_BAO_Activity::exportableFields();
         $this->_fields = array_merge($this->_fields, $fields);
         // add any fields provided by hook implementers
         $extFields = CRM_Contact_BAO_Query_Hook::singleton()->getFields();
         $this->_fields = array_merge($this->_fields, $extFields);
     }
     // basically do all the work once, and then reuse it
     $this->initialize();
 }
开发者ID:vincent1892,项目名称:civicrm-core,代码行数:55,代码来源:Query.php


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