本文整理汇总了PHP中CRM_Contact_BAO_Contact::_importableFields方法的典型用法代码示例。如果您正苦于以下问题:PHP CRM_Contact_BAO_Contact::_importableFields方法的具体用法?PHP CRM_Contact_BAO_Contact::_importableFields怎么用?PHP CRM_Contact_BAO_Contact::_importableFields使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CRM_Contact_BAO_Contact
的用法示例。
在下文中一共展示了CRM_Contact_BAO_Contact::_importableFields方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: deleteField
/**
* Delete the Custom Field.
*
* @param object $field - the field object
*
* @return boolean
*
* @access public
* @static
*
*/
public static function deleteField($field)
{
// reset the cache
require_once 'CRM/Core/BAO/Cache.php';
CRM_Core_BAO_Cache::deleteGroup('contact fields');
// reset various static arrays used here
require_once 'CRM/Contact/BAO/Contact.php';
CRM_Contact_BAO_Contact::$_importableFields = CRM_Contact_BAO_Contact::$_exportableFields = self::$_importFields = null;
// first delete the custom option group and values associated with this field
if ($field->option_group_id) {
//check if option group is related to any other field, if
//not delete the option group and related option values
self::checkOptionGroup($field->option_group_id);
}
// next drop the column from the custom value table
self::createField($field, 'delete');
$field->delete();
return;
}
示例2: flushCache
/**
* Reset the various system caches and some important static variables.
*/
public static function flushCache()
{
// flush out all cache entries so we can reload new data
// a bit aggressive, but livable for now
$cache = CRM_Utils_Cache::singleton();
$cache->flush();
// also reset the various static memory caches
// reset the memory or array cache
CRM_Core_BAO_Cache::deleteGroup('contact fields', NULL, FALSE);
// reset ACL cache
CRM_ACL_BAO_Cache::resetCache();
// reset various static arrays used here
CRM_Contact_BAO_Contact::$_importableFields = CRM_Contact_BAO_Contact::$_exportableFields = CRM_Contribute_BAO_Contribution::$_importableFields = CRM_Contribute_BAO_Contribution::$_exportableFields = CRM_Pledge_BAO_Pledge::$_exportableFields = CRM_Contribute_BAO_Query::$_contributionFields = CRM_Core_BAO_CustomField::$_importFields = CRM_Core_BAO_Cache::$_cache = CRM_Core_DAO::$_dbColumnValueCache = NULL;
CRM_Core_OptionGroup::flushAll();
CRM_Utils_PseudoConstant::flushAll();
}
示例3: array
/**
* 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 and should be done in the
* next week or so, before this can be called complete.
*
* @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
*
* @return array array of importable Fields
* @access public
*/
function &importableFields($contactType = 'Individual', $status = false, $showAll = false, $isProfile = false)
{
if (empty($contactType)) {
$contactType = 'All';
}
$cacheKeyString = "importableFields {$contactType}";
$cacheKeyString .= $status ? "_1" : "_0";
$cacheKeyString .= $showAll ? "_1" : "_0";
$cacheKeyString .= $isProfile ? "_1" : "_0";
if (!self::$_importableFields || !CRM_Utils_Array::value($cacheKeyString, self::$_importableFields)) {
if (!self::$_importableFields) {
self::$_importableFields = 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 = CRM_Contact_DAO_Contact::import();
require_once "CRM/Core/OptionValue.php";
// get the fields thar are meant for contact types
if (in_array($contactType, array('Individual', 'Household', 'Organization', 'All'))) {
$fields = array_merge($fields, CRM_Core_OptionValue::getFields('', $contactType));
}
$locationFields = array_merge(CRM_Core_DAO_Address::import(), CRM_Core_DAO_Phone::import(), CRM_Core_DAO_Email::import(), CRM_Core_DAO_IM::import(true), CRM_Core_DAO_OpenID::import());
foreach ($locationFields as $key => $field) {
$locationFields[$key]['hasLocationType'] = true;
}
$fields = array_merge($fields, $locationFields);
$fields = array_merge($fields, CRM_Contact_DAO_Contact::import());
$fields = array_merge($fields, CRM_Core_DAO_Note::import());
if ($contactType != 'All') {
$fields = array_merge($fields, CRM_Core_BAO_CustomField::getFieldsForImport($contactType, $showAll, true));
//unset the fields, which are not related to their
//contact type.
$commonValues = array('Individual' => array('household_name', 'legal_name', 'sic_code', 'organization_name'), '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'), 'Organization' => array('first_name', 'middle_name', 'last_name', 'job_title', 'gender_id', 'birth_date', 'household_name', 'email_greeting', 'email_greeting_custom', 'postal_greeting', 'postal_greeting_custom', 'is_deceased', 'deceased_date'));
foreach ($commonValues[$contactType] as $value) {
unset($fields[$value]);
}
} else {
foreach (array('Individual', 'Household', 'Organization') as $type) {
$fields = array_merge($fields, CRM_Core_BAO_CustomField::getFieldsForImport($type, $showAll));
}
}
if ($isProfile) {
$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] = $v['title'];
}
asort($sortArray);
$fields = array_merge($sortArray, $fields);
CRM_Core_BAO_Cache::setItem($fields, 'contact fields', $cacheKeyString);
}
self::$_importableFields[$cacheKeyString] = $fields;
}
if (!$isProfile) {
if (!$status) {
$fields = array_merge(array('do_not_import' => array('title' => ts('- do not import -'))), self::$_importableFields[$cacheKeyString]);
} else {
$fields = array_merge(array('' => array('title' => ts('- Contact Fields -'))), self::$_importableFields[$cacheKeyString]);
}
}
return $fields;
}