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


PHP CRM_Core_BAO_Cache::setItem方法代码示例

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


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

示例1: update

 public static function update()
 {
     // lets build the tree in memory first
     $sql = "\nSELECT n.child_group_id  as child ,\n       n.parent_group_id as parent\nFROM   civicrm_group_nesting n,\n       civicrm_group gc,\n       civicrm_group gp\nWHERE  n.child_group_id  = gc.id\n  AND  n.parent_group_id = gp.id\n";
     $dao = CRM_Core_DAO::executeQuery($sql);
     $tree = array();
     while ($dao->fetch()) {
         if (!array_key_exists($dao->child, $tree)) {
             $tree[$dao->child] = array('children' => array(), 'parents' => array());
         }
         if (!array_key_exists($dao->parent, $tree)) {
             $tree[$dao->parent] = array('children' => array(), 'parents' => array());
         }
         $tree[$dao->child]['parents'][] = $dao->parent;
         $tree[$dao->parent]['children'][] = $dao->child;
     }
     if (self::checkCyclicGraph($tree)) {
         CRM_Core_Error::fatal(ts('We detected a cycle which we cant handle. aborting'));
     }
     // first reset the current cache entries
     $sql = "\nUPDATE civicrm_group\nSET    parents  = null,\n       children = null\n";
     CRM_Core_DAO::executeQuery($sql);
     $values = array();
     foreach (array_keys($tree) as $id) {
         $parents = implode(',', $tree[$id]['parents']);
         $children = implode(',', $tree[$id]['children']);
         $parents = $parents == NULL ? 'null' : "'{$parents}'";
         $children = $children == NULL ? 'null' : "'{$children}'";
         $sql = "\nUPDATE civicrm_group\nSET    parents  = {$parents} ,\n       children = {$children}\nWHERE  id = {$id}\n";
         CRM_Core_DAO::executeQuery($sql);
     }
     // this tree stuff is quite useful, so lets store it in the cache
     CRM_Core_BAO_Cache::setItem($tree, 'contact groups', 'nestable tree hierarchy');
 }
开发者ID:prashantgajare,项目名称:civicrm-core,代码行数:34,代码来源:GroupNestingCache.php

示例2: importableFields

 /**
  * combine all the importable fields from the lower levels object
  *
  * The ordering is important, since currently we do not have a weight
  * scheme. Adding weight is super important
  *
  * @param int     $contactType     contact Type
  * @param boolean $status          status is used to manipulate first title
  * @param boolean $showAll         if true returns all fields (includes disabled fields)
  * @param boolean $isProfile       if its profile mode
  * @param boolean $checkPermission if false, do not include permissioning clause (for custom data)
  *
  * @return array array of importable Fields
  * @access public
  * @static
  */
 static function importableFields($contactType = 'HRJobLeave', $status = FALSE, $showAll = FALSE, $isProfile = FALSE, $checkPermission = TRUE, $withMultiCustomFields = FALSE)
 {
     if (empty($contactType)) {
         $contactType = 'HRJobLeave';
     }
     $cacheKeyString = "";
     $cacheKeyString .= $status ? '_1' : '_0';
     $cacheKeyString .= $showAll ? '_1' : '_0';
     $cacheKeyString .= $isProfile ? '_1' : '_0';
     $cacheKeyString .= $checkPermission ? '_1' : '_0';
     $fields = CRM_Utils_Array::value($cacheKeyString, self::$_importableFields);
     if (!$fields) {
         $fields = CRM_HRJob_DAO_HRJobLeave::import();
         $fields = array_merge($fields, CRM_HRJOB_DAO_HRJOBLEAVE::import());
         foreach ($fields as $key => $v) {
             $fields[$key]['hasLocationType'] = TRUE;
         }
         //Sorting fields in alphabetical order
         $fields = CRM_Utils_Array::crmArraySortByField($fields, 'title');
         $fields = CRM_Utils_Array::index(array('name'), $fields);
         CRM_Core_BAO_Cache::setItem($fields, 'contact fields', $cacheKeyString);
     }
     self::$_importableFields[$cacheKeyString] = $fields;
     if (!$isProfile) {
         $fields = array_merge(array('do_not_import' => array('title' => ts('- do not import -'))), self::$_importableFields[$cacheKeyString]);
     }
     return $fields;
 }
开发者ID:JoeMurray,项目名称:civihr,代码行数:44,代码来源:HRJobLeave.php

示例3: importableFields

 static function importableFields($contactType = 'HRJobContractRevision', $status = FALSE, $showAll = FALSE, $isProfile = FALSE, $checkPermission = TRUE, $withMultiCustomFields = FALSE)
 {
     if (empty($contactType)) {
         $contactType = 'HRJobContractRevision';
     }
     $cacheKeyString = "";
     $cacheKeyString .= $status ? '_1' : '_0';
     $cacheKeyString .= $showAll ? '_1' : '_0';
     $cacheKeyString .= $isProfile ? '_1' : '_0';
     $cacheKeyString .= $checkPermission ? '_1' : '_0';
     $fields = CRM_Utils_Array::value($cacheKeyString, self::$_importableFields);
     if (!$fields) {
         $fields = CRM_Hrjobcontract_DAO_HRJobContractRevision::import();
         $fields = array_merge($fields, CRM_Hrjobcontract_DAO_HRJobContractRevision::import());
         //Sorting fields in alphabetical order(CRM-1507)
         $fields = CRM_Utils_Array::crmArraySortByField($fields, 'title');
         $fields = CRM_Utils_Array::index(array('name'), $fields);
         CRM_Core_BAO_Cache::setItem($fields, 'contact fields', $cacheKeyString);
     }
     self::$_importableFields[$cacheKeyString] = $fields;
     if (!$isProfile) {
         $fields = array_merge(array('do_not_import' => array('title' => ts('- do not import -'))), self::$_importableFields[$cacheKeyString]);
     }
     return $fields;
 }
开发者ID:JoeMurray,项目名称:civihr,代码行数:25,代码来源:HRJobContractRevision.php

示例4: batchSave

 function batchSave()
 {
     // save in cache table
     $batchId = CRM_Utils_Type::escape($_POST['batch_id'], 'Positive');
     $cacheKeyString = CRM_Core_BAO_Batch::getCacheKeyForBatch($batchId);
     // check if we can retrieve from database cache
     unset($_POST['qfKey']);
     CRM_Core_BAO_Cache::setItem($_POST, 'batch entry', $cacheKeyString);
     // return true if saved correctly
     CRM_Utils_System::civiExit();
 }
开发者ID:peteainsworth,项目名称:civicrm-4.2.9-drupal,代码行数:11,代码来源:AJAX.php

示例5: testFlush

 /**
  * Test system flush.
  */
 public function testFlush()
 {
     // Note: this operation actually flushes several different caches; we don't
     // check all of them -- just enough to make sure that the API is doing
     // something
     $this->assertTrue(NULL === CRM_Core_BAO_Cache::getItem(self::TEST_CACHE_GROUP, self::TEST_CACHE_PATH));
     $data = 'abc';
     CRM_Core_BAO_Cache::setItem($data, self::TEST_CACHE_GROUP, self::TEST_CACHE_PATH);
     $this->assertEquals('abc', CRM_Core_BAO_Cache::getItem(self::TEST_CACHE_GROUP, self::TEST_CACHE_PATH));
     $params = array();
     $result = $this->callAPIAndDocument('system', 'flush', $params, __FUNCTION__, __FILE__, "Flush all system caches", 'Flush');
     $this->assertTrue(NULL === CRM_Core_BAO_Cache::getItem(self::TEST_CACHE_GROUP, self::TEST_CACHE_PATH));
 }
开发者ID:FundingWorks,项目名称:civicrm-core,代码行数:16,代码来源:SystemTest.php

示例6: testSetGetItem

 public function testSetGetItem()
 {
     $originalValue = array('abc' => 'def');
     CRM_Core_BAO_Cache::setItem($originalValue, __CLASS__, 'testSetGetItem');
     $return_1 = CRM_Core_BAO_Cache::getItem(__CLASS__, 'testSetGetItem');
     $this->assertEquals($originalValue, $return_1);
     // Wipe out any in-memory copies of the cache. Check to see if the SQL
     // read is correct.
     CRM_Core_BAO_Cache::$_cache = NULL;
     CRM_Utils_Cache::$_singleton = NULL;
     $return_2 = CRM_Core_BAO_Cache::getItem(__CLASS__, 'testSetGetItem');
     $this->assertEquals($originalValue, $return_2);
 }
开发者ID:kcristiano,项目名称:civicrm-core,代码行数:13,代码来源:CacheTest.php

示例7: array

 /**
  * Combine all the exportable fields from the lower levels object.
  *
  * Currently we are using importable fields as exportable fields
  *
  * @param int|string $contactType contact Type
  * @param bool $status
  *   True while exporting primary contacts.
  * @param bool $export
  *   True when used during export.
  * @param bool $search
  *   True when used during search, might conflict with export param?.
  *
  * @param bool $withMultiRecord
  *
  * @return array
  *   array of exportable Fields
  */
 public static function &exportableFields($contactType = 'Individual', $status = FALSE, $export = FALSE, $search = FALSE, $withMultiRecord = FALSE)
 {
     if (empty($contactType)) {
         $contactType = 'All';
     }
     $cacheKeyString = "exportableFields {$contactType}";
     $cacheKeyString .= $export ? '_1' : '_0';
     $cacheKeyString .= $status ? '_1' : '_0';
     $cacheKeyString .= $search ? '_1' : '_0';
     //CRM-14501 it turns out that the impact of permissioning here is sometimes inconsistent. The field that
     //calculates custom fields takes into account the logged in user & caches that for all users
     //as an interim fix we will cache the fields by contact
     $cacheKeyString .= '_' . CRM_Core_Session::getLoggedInContactID();
     if (!self::$_exportableFields || !CRM_Utils_Array::value($cacheKeyString, self::$_exportableFields)) {
         if (!self::$_exportableFields) {
             self::$_exportableFields = array();
         }
         // check if we can retrieve from database cache
         $fields = CRM_Core_BAO_Cache::getItem('contact fields', $cacheKeyString);
         if (!$fields) {
             $fields = CRM_Contact_DAO_Contact::export();
             // The fields are meant for contact types.
             if (in_array($contactType, array('Individual', 'Household', 'Organization', 'All'))) {
                 $fields = array_merge($fields, CRM_Core_OptionValue::getFields('', $contactType));
             }
             // add current employer for individuals
             $fields = array_merge($fields, array('current_employer' => array('name' => 'organization_name', 'title' => ts('Current Employer'))));
             $locationType = array('location_type' => array('name' => 'location_type', 'where' => 'civicrm_location_type.name', 'title' => ts('Location Type')));
             $IMProvider = array('im_provider' => array('name' => 'im_provider', 'where' => 'civicrm_im.provider_id', 'title' => ts('IM Provider')));
             $locationFields = array_merge($locationType, CRM_Core_DAO_Address::export(), CRM_Core_DAO_Phone::export(), CRM_Core_DAO_Email::export(), $IMProvider, CRM_Core_DAO_IM::export(TRUE), CRM_Core_DAO_OpenID::export());
             $locationFields = array_merge($locationFields, CRM_Core_BAO_CustomField::getFieldsForImport('Address'));
             foreach ($locationFields as $key => $field) {
                 $locationFields[$key]['hasLocationType'] = TRUE;
             }
             $fields = array_merge($fields, $locationFields);
             //add world region
             $fields = array_merge($fields, CRM_Core_DAO_Worldregion::export());
             $fields = array_merge($fields, CRM_Contact_DAO_Contact::export());
             //website fields
             $fields = array_merge($fields, CRM_Core_DAO_Website::export());
             if ($contactType != 'All') {
                 $fields = array_merge($fields, CRM_Core_BAO_CustomField::getFieldsForImport($contactType, $status, FALSE, $search, TRUE, $withMultiRecord));
             } else {
                 foreach (array('Individual', 'Household', 'Organization') as $type) {
                     $fields = array_merge($fields, CRM_Core_BAO_CustomField::getFieldsForImport($type, FALSE, FALSE, $search, TRUE, $withMultiRecord));
                 }
             }
             //fix for CRM-791
             if ($export) {
                 $fields = array_merge($fields, array('groups' => array('title' => ts('Group(s)'), 'name' => 'groups'), 'tags' => array('title' => ts('Tag(s)'), 'name' => 'tags'), 'notes' => array('title' => ts('Note(s)'), 'name' => 'notes')));
             } else {
                 $fields = array_merge($fields, array('group' => array('title' => ts('Group(s)'), 'name' => 'group'), 'tag' => array('title' => ts('Tag(s)'), 'name' => 'tag'), 'note' => array('title' => ts('Note(s)'), 'name' => 'note')));
             }
             //Sorting fields in alphabetical order(CRM-1507)
             foreach ($fields as $k => $v) {
                 $sortArray[$k] = CRM_Utils_Array::value('title', $v);
             }
             $fields = array_merge($sortArray, $fields);
             //unset the field which are not related to their contact type.
             if ($contactType != 'All') {
                 $commonValues = array('Individual' => array('household_name', 'legal_name', 'sic_code', 'organization_name', 'email_greeting_custom', 'postal_greeting_custom', 'addressee_custom'), 'Household' => array('first_name', 'middle_name', 'last_name', 'formal_title', 'job_title', 'gender_id', 'prefix_id', 'suffix_id', 'birth_date', 'organization_name', 'legal_name', 'legal_identifier', 'sic_code', 'home_URL', 'is_deceased', 'deceased_date', 'current_employer', 'email_greeting_custom', 'postal_greeting_custom', 'addressee_custom', 'prefix_id', 'suffix_id'), 'Organization' => array('first_name', 'middle_name', 'last_name', 'formal_title', 'job_title', 'gender_id', 'prefix_id', 'suffix_id', 'birth_date', 'household_name', 'email_greeting_custom', 'postal_greeting_custom', 'prefix_id', 'suffix_id', 'gender_id', 'addressee_custom', 'is_deceased', 'deceased_date', 'current_employer'));
                 foreach ($commonValues[$contactType] as $value) {
                     unset($fields[$value]);
                 }
             }
             CRM_Core_BAO_Cache::setItem($fields, 'contact fields', $cacheKeyString);
         }
         self::$_exportableFields[$cacheKeyString] = $fields;
     }
     if (!$status) {
         $fields = self::$_exportableFields[$cacheKeyString];
     } else {
         $fields = array_merge(array('' => array('title' => ts('- Contact Fields -'))), self::$_exportableFields[$cacheKeyString]);
     }
     return $fields;
 }
开发者ID:JSProffitt,项目名称:civicrm-website-org,代码行数:94,代码来源:Contact.php

示例8: testGetExtensionSetting

 /**
  * Check that setting defined in extension can be retrieved.
  */
 public function testGetExtensionSetting()
 {
     $this->hookClass->setHook('civicrm_alterSettingsFolders', array($this, 'setExtensionMetadata'));
     $data = NULL;
     // the caching of data to all duplicates the caching of data to the empty string
     CRM_Core_BAO_Cache::setItem($data, 'CiviCRM setting Spec', 'All');
     CRM_Core_BAO_Cache::setItem($data, 'CiviCRM setting Specs', 'settingsMetadata__');
     $fields = $this->callAPISuccess('setting', 'getfields', array('filters' => array('group_name' => 'Test Settings')));
     $this->assertArrayHasKey('test_key', $fields['values']);
     $this->callAPISuccess('setting', 'create', array('test_key' => 'keyset'));
     $result = $this->callAPISuccess('setting', 'getvalue', array('name' => 'test_key', 'group' => 'Test Settings'));
     $this->assertEquals('keyset', $result);
 }
开发者ID:nganivet,项目名称:civicrm-core,代码行数:16,代码来源:SettingTest.php

示例9: buildPrevNextCache

 function buildPrevNextCache($sort)
 {
     //for prev/next pagination
     $crmPID = CRM_Utils_Request::retrieve('crmPID', 'Integer', CRM_Core_DAO::$_nullObject);
     if (!$crmPID) {
         $cacheKey = "civicrm search {$this->_key}";
         CRM_Core_BAO_PrevNextCache::deleteItem(NULL, $cacheKey, 'civicrm_contact');
         $sql = $this->_query->searchQuery(0, 0, $sort, FALSE, FALSE, FALSE, FALSE, TRUE, $this->_campaignWhereClause, NULL, $this->_campaignFromClause);
         list($select, $from) = explode(' FROM ', $sql);
         $insertSQL = "\nINSERT INTO civicrm_prevnext_cache ( entity_table, entity_id1, entity_id2, cacheKey, data )\nSELECT 'civicrm_contact', contact_a.id, contact_a.id, '{$cacheKey}', contact_a.display_name\nFROM {$from}\n";
         CRM_Core_Error::ignoreException();
         $result = CRM_Core_DAO::executeQuery($insertSQL);
         CRM_Core_Error::setCallback();
         if (is_a($result, 'DB_Error')) {
             return;
         }
         // also record an entry in the cache key table, so we can delete it periodically
         CRM_Core_BAO_Cache::setItem($cacheKey, 'CiviCRM Search PrevNextCache', $cacheKey);
     }
 }
开发者ID:hguru,项目名称:224Civi,代码行数:20,代码来源:Search.php

示例10: set

 function set($key, &$value)
 {
     CRM_Core_BAO_Cache::setItem($value, $this->group, $key, $this->componentID);
     $this->frontCache[$key] = $value;
 }
开发者ID:hguru,项目名称:224Civi,代码行数:5,代码来源:SqlGroup.php

示例11: getFeeds

 /**
  * Fetch all feeds & cache results.
  *
  * @return array
  */
 protected function getFeeds()
 {
     $blogFeed = $this->getFeed($this->getBlogUrl());
     // If unable to fetch the first feed, give up and return empty results.
     if (!$blogFeed) {
         return array_fill_keys(array_keys($this->get_template_vars('tabs')), array());
     }
     $eventFeed = $this->getFeed($this->getEventUrl());
     $feeds = array('blog' => $this->formatItems($blogFeed), 'events' => $this->formatItems($eventFeed));
     CRM_Core_BAO_Cache::setItem($feeds, 'dashboard', 'blog');
     return $feeds;
 }
开发者ID:kcristiano,项目名称:civicrm-core,代码行数:17,代码来源:Blog.php

示例12: _multisite_get_all_child_groups

/**
 * Get all groups that are children of the parent group
 * (iterate through all levels)
 *
 * @param integer $groupID
 * @param boolean $includeParent
 * @return array:child groups
 */
function _multisite_get_all_child_groups($groupID, $includeParent = TRUE)
{
    static $_cache = array();
    if (!array_key_exists($groupID, $_cache)) {
        $childGroups =& CRM_Core_BAO_Cache::getItem('descendant groups for an org', $groupID);
        if (empty($childGroups)) {
            $childGroups = array();
            $query = "\nSELECT children\nFROM   civicrm_group\nWHERE  children IS NOT NULL\nAND    id IN ";
            if (!is_array($groupID)) {
                $groupIDs = array($groupID);
            }
            while (!empty($groupIDs)) {
                $groupIDString = implode(',', $groupIDs);
                $realQuery = $query . " ( {$groupIDString} )";
                $dao = CRM_Core_DAO::executeQuery($realQuery);
                $groupIDs = array();
                while ($dao->fetch()) {
                    if ($dao->children) {
                        $childIDs = explode(',', $dao->children);
                        foreach ($childIDs as $childID) {
                            if (!array_key_exists($childID, $childGroups)) {
                                $childGroups[$childID] = 1;
                                $groupIDs[] = $childID;
                            }
                        }
                    }
                }
            }
            CRM_Core_BAO_Cache::setItem($childGroups, 'descendant groups for an org', $groupID);
        }
        $_cache[$groupID] = $childGroups;
    }
    if ($includeParent || CRM_Core_Permission::check('administer Multiple Organizations')) {
        return array_keys(array($groupID => 1) + $_cache[$groupID]);
    } else {
        return array_keys($_cache[$groupID]);
    }
}
开发者ID:prashantgajare,项目名称:civicrm-core,代码行数:46,代码来源:multisite.php

示例13: fillupPrevNextCache

 /**
  * @param object $sort
  * @param string $cacheKey
  * @param int $start
  * @param int $end
  */
 function fillupPrevNextCache($sort, $cacheKey, $start = 0, $end = 500)
 {
     // For custom searches, use the contactIDs method
     if (is_a($this, 'CRM_Contact_Selector_Custom')) {
         $sql = $this->_search->contactIDs($start, $end, $sort, TRUE);
         $replaceSQL = "SELECT contact_a.id as contact_id";
     } else {
         $sql = $this->_query->searchQuery($start, $end, $sort, FALSE, FALSE, FALSE, TRUE, TRUE, NULL);
         $replaceSQL = "SELECT contact_a.id as id";
     }
     // CRM-9096
     // due to limitations in our search query writer, the above query does not work
     // in cases where the query is being sorted on a non-contact table
     // this results in a fatal error :(
     // see below for the gross hack of trapping the error and not filling
     // the prev next cache in this situation
     // the other alternative of running the FULL query will just be incredibly inefficient
     // and slow things down way too much on large data sets / complex queries
     $insertSQL = "\nINSERT INTO civicrm_prevnext_cache ( entity_table, entity_id1, entity_id2, cacheKey, data )\nSELECT 'civicrm_contact', contact_a.id, contact_a.id, '{$cacheKey}', contact_a.display_name\n";
     $sql = str_replace($replaceSQL, $insertSQL, $sql);
     CRM_Core_Error::ignoreException();
     $result = CRM_Core_DAO::executeQuery($sql);
     CRM_Core_Error::setCallback();
     if (is_a($result, 'DB_Error')) {
         // oops the above query failed, so lets just ignore it
         // and return
         // we print a sorry cant figure it out on view page
         return;
     }
     // also record an entry in the cache key table, so we can delete it periodically
     CRM_Core_BAO_Cache::setItem($cacheKey, 'CiviCRM Search PrevNextCache', $cacheKey);
 }
开发者ID:archcidburnziso,项目名称:civicrm-core,代码行数:38,代码来源:Selector.php

示例14: array

 /**
  * combine all the exportable fields from the lower levels object
  * 
  * currentlty we are using importable fields as exportable fields
  *
  * @param int     $contactType contact Type
  * $param boolean $status true while exporting primary contacts
  * $param boolean $export true when used during export
  *
  * @return array array of exportable Fields
  * @access public
  */
 function &exportableFields($contactType = 'Individual', $status = false, $export = false)
 {
     if (empty($contactType)) {
         $contactType = 'All';
     }
     $cacheKeyString = "exportableFields {$contactType}";
     $cacheKeyString .= $export ? "_1" : "_0";
     $cacheKeyString .= $status ? "_1" : "_0";
     if (!self::$_exportableFields || !CRM_Utils_Array::value($cacheKeyString, self::$_exportableFields)) {
         if (!self::$_exportableFields) {
             self::$_exportableFields = array();
         }
         // check if we can retrieve from database cache
         require_once 'CRM/Core/BAO/Cache.php';
         $fields =& CRM_Core_BAO_Cache::getItem('contact fields', $cacheKeyString);
         if (!$fields) {
             $fields = array();
             $fields = array_merge($fields, CRM_Contact_DAO_Contact::export());
             // the fields are meant for contact types
             if (in_array($contactType, array('Individual', 'Household', 'Organization', 'All'))) {
                 require_once 'CRM/Core/OptionValue.php';
                 $fields = array_merge($fields, CRM_Core_OptionValue::getFields('', $contactType));
             }
             // add current employer for individuals
             $fields = array_merge($fields, array('current_employer' => array('name' => 'organization_name', 'title' => ts('Current Employer'))));
             $locationType = array();
             if ($status) {
                 $locationType['location_type'] = array('name' => 'location_type', 'where' => 'civicrm_location_type.name', 'title' => ts('Location Type'));
             }
             $IMProvider = array();
             if ($status) {
                 $IMProvider['im_provider'] = array('name' => 'im_provider', 'where' => 'im_provider.name', 'title' => ts('IM Provider'));
             }
             $locationFields = array_merge($locationType, CRM_Core_DAO_Address::export(), CRM_Core_DAO_Phone::export(), CRM_Core_DAO_Email::export(), $IMProvider, CRM_Core_DAO_IM::export(true), CRM_Core_DAO_OpenID::export());
             foreach ($locationFields as $key => $field) {
                 $locationFields[$key]['hasLocationType'] = true;
             }
             $fields = array_merge($fields, $locationFields);
             //add world region
             require_once "CRM/Core/DAO/Worldregion.php";
             $fields = array_merge($fields, CRM_Core_DAO_Worldregion::export());
             $fields = array_merge($fields, CRM_Contact_DAO_Contact::export());
             if ($contactType != 'All') {
                 $fields = array_merge($fields, CRM_Core_BAO_CustomField::getFieldsForImport($contactType, $status, true));
             } else {
                 foreach (array('Individual', 'Household', 'Organization') as $type) {
                     $fields = array_merge($fields, CRM_Core_BAO_CustomField::getFieldsForImport($type));
                 }
             }
             //fix for CRM-791
             if ($export) {
                 $fields = array_merge($fields, array('groups' => array('title' => ts('Group(s)')), 'tags' => array('title' => ts('Tag(s)')), 'notes' => array('title' => ts('Note(s)'))));
             } else {
                 $fields = array_merge($fields, array('group' => array('title' => ts('Group(s)')), 'tag' => array('title' => ts('Tag(s)')), 'note' => array('title' => ts('Note(s)'))));
             }
             //Sorting fields in alphabetical order(CRM-1507)
             foreach ($fields as $k => $v) {
                 $sortArray[$k] = CRM_Utils_Array::value('title', $v);
             }
             $fields = array_merge($sortArray, $fields);
             //unset the field which are not related to their contact type.
             if ($contactType != 'All') {
                 $commonValues = array('Individual' => array('household_name', 'legal_name', 'sic_code', 'organization_name', 'email_greeting_custom', 'postal_greeting_custom', 'addressee_custom'), 'Household' => array('first_name', 'middle_name', 'last_name', 'job_title', 'gender_id', 'birth_date', 'organization_name', 'legal_name', 'legal_identifier', 'sic_code', 'home_URL', 'is_deceased', 'deceased_date', 'current_employer', 'email_greeting_custom', 'postal_greeting_custom', 'addressee_custom', 'individual_prefix', 'individual_suffix', 'gender'), 'Organization' => array('first_name', 'middle_name', 'last_name', 'job_title', 'gender_id', 'birth_date', 'household_name', 'email_greeting', 'postal_greeting', 'email_greeting_custom', 'postal_greeting_custom', 'individual_prefix', 'individual_suffix', 'gender', 'addressee_custom', 'is_deceased', 'deceased_date', 'current_employer'));
                 foreach ($commonValues[$contactType] as $value) {
                     unset($fields[$value]);
                 }
             }
             CRM_Core_BAO_Cache::setItem($fields, 'contact fields', $cacheKeyString);
         }
         self::$_exportableFields[$cacheKeyString] = $fields;
     }
     if (!$status) {
         $fields = self::$_exportableFields[$cacheKeyString];
     } else {
         $fields = array_merge(array('' => array('title' => ts('- Contact Fields -'))), self::$_exportableFields[$cacheKeyString]);
     }
     return $fields;
 }
开发者ID:ksecor,项目名称:civicrm,代码行数:90,代码来源:Contact.php

示例15: getFeeds

 /**
  * Fetch all feeds & cache results.
  *
  * @return array
  */
 protected function getFeeds()
 {
     $newsFeed = $this->getFeed($this->getNewsUrl());
     // If unable to fetch the feed, return empty results.
     if (!$newsFeed) {
         return array();
     }
     $feeds = $this->formatItems($newsFeed);
     CRM_Core_BAO_Cache::setItem($feeds, 'dashboard', 'newsfeed');
     return $feeds;
 }
开发者ID:nielosz,项目名称:civicrm-core,代码行数:16,代码来源:Blog.php


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