本文整理汇总了PHP中CRM_Core_BAO_UFGroup::getReservedProfiles方法的典型用法代码示例。如果您正苦于以下问题:PHP CRM_Core_BAO_UFGroup::getReservedProfiles方法的具体用法?PHP CRM_Core_BAO_UFGroup::getReservedProfiles怎么用?PHP CRM_Core_BAO_UFGroup::getReservedProfiles使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CRM_Core_BAO_UFGroup
的用法示例。
在下文中一共展示了CRM_Core_BAO_UFGroup::getReservedProfiles方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: buildQuickForm
function buildQuickForm(&$form)
{
// call to build contact autocomplete
$attributes = array('width' => '200px');
$form->add('text', "contact", ts('Select Contact'), $attributes);
$form->addElement('hidden', "contact_select_id");
if (CRM_Core_Permission::check('edit all contacts') || CRM_Core_Permission::check('add contacts')) {
// build select for new contact
require_once 'CRM/Core/BAO/UFGroup.php';
$contactProfiles = CRM_Core_BAO_UFGroup::getReservedProfiles();
$form->add('select', 'profiles', ts('Create New Contact'), array('' => ts('- create new contact -')) + $contactProfiles, false, array('onChange' => "if (this.value) newContact( this.value );"));
}
}
示例2: buildQuickForm
/**
* Function used to build form element for new contact or select contact widget
*
* @param object $form form object
* @param int $blocNo by default it is one, except for address block where it is
* build for each block
* @param array $extrProfiles extra profiles that should be included besides reserved
*
* @access public
*
* @return void
*/
static function buildQuickForm(&$form, $blockNo = 1, $extraProfiles = NULL, $required = FALSE, $prefix = '')
{
// call to build contact autocomplete
$attributes = array('width' => '200px');
$form->add('text', "{$prefix}contact[{$blockNo}]", ts('Select Contact'), $attributes, $required);
$form->addElement('hidden', "{$prefix}contact_select_id[{$blockNo}]");
if (CRM_Core_Permission::check('edit all contacts') || CRM_Core_Permission::check('add contacts')) {
// build select for new contact
$contactProfiles = CRM_Core_BAO_UFGroup::getReservedProfiles('Contact', $extraProfiles);
$form->add('select', "{$prefix}profiles[{$blockNo}]", ts('Create New Contact'), array('' => ts('- create new contact -')) + $contactProfiles, FALSE, array('onChange' => "if (this.value) { newContact{$prefix}{$blockNo}( this.value, {$blockNo}, '{$prefix}' );}"));
}
$form->assign('blockNo', $blockNo);
$form->assign('prefix', $prefix);
}
示例3: getValidContactTypeList
static function getValidContactTypeList($relType)
{
// string looks like 4_a_b
$rel_parts = explode('_', $relType);
$allRelationshipType = CRM_Core_PseudoConstant::relationshipType('label');
$contactProfiles = CRM_Core_BAO_UFGroup::getReservedProfiles('Contact', NULL);
if ($rel_parts[1] == 'a') {
$leftType = $allRelationshipType[$rel_parts[0]]['contact_type_b'];
} else {
$leftType = $allRelationshipType[$rel_parts[0]]['contact_type_a'];
}
// Handle 'All Contacts' contact type for left side of relationship ($leftType is empty in this case)
// In this case all reserved profiles are available
if ($leftType == '') {
$contactTypes = $contactProfiles;
} else {
$contactTypes = array();
foreach ($contactProfiles as $key => $value) {
$groupTypes = CRM_Core_BAO_UFGroup::profileGroups($key);
if (in_array($leftType, $groupTypes)) {
$contactTypes = array($key => $value);
}
}
}
return $contactTypes;
}
示例4: getValidContactTypeList
static function getValidContactTypeList($relType)
{
// string looks like 4_a_b
$rel_parts = explode('_', $relType);
$allRelationshipType = CRM_Core_PseudoConstant::relationshipType('label');
$contactProfiles = CRM_Core_BAO_UFGroup::getReservedProfiles('Contact', NULL);
if ($rel_parts[1] == 'a') {
$leftType = $allRelationshipType[$rel_parts[0]]['contact_type_b'];
} else {
$leftType = $allRelationshipType[$rel_parts[0]]['contact_type_a'];
}
$contactTypes = array();
foreach ($contactProfiles as $key => $value) {
if (strpos($value, $leftType) !== FALSE) {
$contactTypes = array($key => $value);
}
}
return $contactTypes;
}