本文整理汇总了PHP中CRM_Core_BAO_CustomGroup::getAllCustomGroupsByBaseEntity方法的典型用法代码示例。如果您正苦于以下问题:PHP CRM_Core_BAO_CustomGroup::getAllCustomGroupsByBaseEntity方法的具体用法?PHP CRM_Core_BAO_CustomGroup::getAllCustomGroupsByBaseEntity怎么用?PHP CRM_Core_BAO_CustomGroup::getAllCustomGroupsByBaseEntity使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CRM_Core_BAO_CustomGroup
的用法示例。
在下文中一共展示了CRM_Core_BAO_CustomGroup::getAllCustomGroupsByBaseEntity方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: entityCustomDataLogTables
/**
* Return custom data tables for specified entity / extends.
*/
public function entityCustomDataLogTables($extends)
{
$customGroupTables = array();
$customGroupDAO = CRM_Core_BAO_CustomGroup::getAllCustomGroupsByBaseEntity($extends);
$customGroupDAO->find();
while ($customGroupDAO->fetch()) {
$customGroupTables[$customGroupDAO->table_name] = $this->logs[$customGroupDAO->table_name];
}
return $customGroupTables;
}
示例2: convertCiviModelToBackboneModel
/**
* FIXME: Move to somewhere more useful
* FIXME: Do real mapping of "types"
*
* @param string $extends
* Entity type; note: "Individual" means "Individual|Contact"; "Household" means "Household|Contact".
* @param string $title
* A string to use in section headers.
* @param array $availableFields
* List of fields that are allowed in profiles, e.g. $availableFields['my_field']['field_type'].
* @return array
* with keys 'sections' and 'schema'
* @see js/model/crm.core.js
* @see js/model/crm.mappedcore.js
*/
public static function convertCiviModelToBackboneModel($extends, $title, $availableFields)
{
$locationFields = CRM_Core_BAO_UFGroup::getLocationFields();
$result = array('schema' => array(), 'sections' => array());
// build field list
foreach ($availableFields as $fieldName => $field) {
switch ($extends) {
case 'Individual':
case 'Organization':
case 'Household':
if ($field['field_type'] != $extends && $field['field_type'] != 'Contact' && !in_array($field['field_type'], CRM_Contact_BAO_ContactType::subTypes($extends))) {
continue 2;
}
break;
default:
if ($field['field_type'] != $extends) {
continue 2;
}
}
$result['schema'][$fieldName] = array('type' => 'Text', 'title' => $field['title'], 'civiFieldType' => $field['field_type']);
if (in_array($fieldName, $locationFields)) {
$result['schema'][$fieldName]['civiIsLocation'] = TRUE;
}
if ($fieldName == 'url') {
$result['schema'][$fieldName]['civiIsWebsite'] = TRUE;
}
if (in_array($fieldName, array('phone', 'phone_and_ext'))) {
// FIXME what about phone_ext?
$result['schema'][$fieldName]['civiIsPhone'] = TRUE;
}
}
// build section list
$result['sections']['default'] = array('title' => $title, 'is_addable' => FALSE);
$customGroup = CRM_Core_BAO_CustomGroup::getAllCustomGroupsByBaseEntity($extends);
$customGroup->orderBy('weight');
$customGroup->is_active = 1;
$customGroup->find();
while ($customGroup->fetch()) {
$sectionName = 'cg_' . $customGroup->id;
$section = array('title' => ts('%1: %2', array(1 => $title, 2 => $customGroup->title)), 'is_addable' => $customGroup->is_reserved ? FALSE : TRUE, 'custom_group_id' => $customGroup->id, 'extends_entity_column_id' => $customGroup->extends_entity_column_id, 'extends_entity_column_value' => CRM_Utils_Array::explodePadded($customGroup->extends_entity_column_value), 'is_reserved' => $customGroup->is_reserved ? TRUE : FALSE);
$result['sections'][$sectionName] = $section;
}
// put fields in their sections
$fields = CRM_Core_BAO_CustomField::getFields($extends);
foreach ($fields as $fieldId => $field) {
$sectionName = 'cg_' . $field['custom_group_id'];
$fieldName = 'custom_' . $fieldId;
if (isset($result['schema'][$fieldName])) {
$result['schema'][$fieldName]['section'] = $sectionName;
$result['schema'][$fieldName]['civiIsMultiple'] = (bool) CRM_Core_BAO_CustomField::isMultiRecordField($fieldId);
}
}
return $result;
}
示例3: triggerInfo
/**
* Get a list of triggers for the contact table.
*
* @see hook_civicrm_triggerInfo
* @see CRM_Core_DAO::triggerRebuild
* @see http://issues.civicrm.org/jira/browse/CRM-10554
*
* @param $info
* @param null $tableName
*/
public static function triggerInfo(&$info, $tableName = NULL)
{
//during upgrade, first check for valid version and then create triggers
//i.e the columns created_date and modified_date are introduced in 4.3.alpha1 so dont create triggers for older version
if (CRM_Core_Config::isUpgradeMode()) {
$currentVer = CRM_Core_BAO_Domain::version(TRUE);
//if current version is less than 4.3.alpha1 dont create below triggers
if (version_compare($currentVer, '4.3.alpha1') < 0) {
return;
}
}
// Update timestamp for civicrm_contact itself
if ($tableName == NULL || $tableName == self::getTableName()) {
$info[] = array('table' => array(self::getTableName()), 'when' => 'BEFORE', 'event' => array('INSERT'), 'sql' => "\nSET NEW.created_date = CURRENT_TIMESTAMP;\n");
}
// Update timestamp when modifying closely related core tables
$relatedTables = array('civicrm_address', 'civicrm_email', 'civicrm_im', 'civicrm_phone', 'civicrm_website');
self::generateTimestampTriggers($info, $tableName, $relatedTables, 'contact_id');
// Update timestamp when modifying related custom-data tables
$customGroupTables = array();
$customGroupDAO = CRM_Core_BAO_CustomGroup::getAllCustomGroupsByBaseEntity('Contact');
$customGroupDAO->is_multiple = 0;
$customGroupDAO->find();
while ($customGroupDAO->fetch()) {
$customGroupTables[] = $customGroupDAO->table_name;
}
if (!empty($customGroupTables)) {
self::generateTimestampTriggers($info, $tableName, $customGroupTables, 'entity_id');
}
// Update phone table to populate phone_numeric field
if (!$tableName || $tableName == 'civicrm_phone') {
// Define stored sql function needed for phones
CRM_Core_DAO::executeQuery(self::DROP_STRIP_FUNCTION_43);
CRM_Core_DAO::executeQuery(self::CREATE_STRIP_FUNCTION_43);
$info[] = array('table' => array('civicrm_phone'), 'when' => 'BEFORE', 'event' => array('INSERT', 'UPDATE'), 'sql' => "\nSET NEW.phone_numeric = civicrm_strip_non_numeric(NEW.phone);\n");
}
}
示例4: addCustomTablesExtendingContactsToCidRefs
/**
* Add custom tables that extend contacts to the list of contact references.
*
* CRM_Core_BAO_CustomGroup::getAllCustomGroupsByBaseEntity seems like a safe-ish
* function to be sure all are retrieved & we don't miss subtypes or inactive or multiples
* - the down side is it is not cached.
*
* Further changes should be include tests in the CRM_Core_MergerTest class
* to ensure that disabled, subtype, multiple etc groups are still captured.
*
* @param array $cidRefs
*/
public static function addCustomTablesExtendingContactsToCidRefs(&$cidRefs)
{
$customValueTables = CRM_Core_BAO_CustomGroup::getAllCustomGroupsByBaseEntity('Contact');
$customValueTables->find();
while ($customValueTables->fetch()) {
$cidRefs[$customValueTables->table_name] = array('entity_id');
}
}