本文整理汇总了PHP中CRM_Core_BAO_UFGroup类的典型用法代码示例。如果您正苦于以下问题:PHP CRM_Core_BAO_UFGroup类的具体用法?PHP CRM_Core_BAO_UFGroup怎么用?PHP CRM_Core_BAO_UFGroup使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了CRM_Core_BAO_UFGroup类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: buildQuickForm
/**
* Build the form object.
*/
public function buildQuickForm()
{
CRM_Utils_System::setTitle(ts('Settings - Search Preferences'));
// @todo remove the following adds in favour of setting via the settings array (above).
$this->addYesNo('includeWildCardInName', ts('Automatic Wildcard'));
$this->addYesNo('includeEmailInName', ts('Include Email'));
$this->addYesNo('includeNickNameInName', ts('Include Nickname'));
$this->addYesNo('includeAlphabeticalPager', ts('Include Alphabetical Pager'));
$this->addYesNo('includeOrderByClause', ts('Include Order By Clause'));
$this->addElement('text', 'smartGroupCacheTimeout', ts('Smart group cache timeout'), array('size' => 3, 'maxlength' => 5));
$types = array('Contact', 'Individual', 'Organization', 'Household');
$profiles = CRM_Core_BAO_UFGroup::getProfiles($types);
$this->add('select', 'defaultSearchProfileID', ts('Default Contact Search Profile'), array('' => ts('- none -')) + $profiles, FALSE, array('class' => 'crm-select2 huge'));
// Autocomplete for Contact Search (quick search etc.)
$options = array(ts('Contact Name') => 1) + array_flip(CRM_Core_OptionGroup::values('contact_autocomplete_options', FALSE, FALSE, TRUE));
$this->addCheckBox('autocompleteContactSearch', ts('Autocomplete Contact Search'), $options, NULL, NULL, NULL, NULL, array(' '));
$element = $this->getElement('autocompleteContactSearch');
$element->_elements[0]->_flagFrozen = TRUE;
// Autocomplete for Contact Reference (custom fields)
$optionsCR = array(ts('Contact Name') => 1) + array_flip(CRM_Core_OptionGroup::values('contact_reference_options', FALSE, FALSE, TRUE));
$this->addCheckBox('autocompleteContactReference', ts('Contact Reference Options'), $optionsCR, NULL, NULL, NULL, NULL, array(' '));
$element = $this->getElement('autocompleteContactReference');
$element->_elements[0]->_flagFrozen = TRUE;
parent::buildQuickForm();
}
示例2: preProcess
/**
* Pre processing work done here.
*
* gets session variables for group or field id
*
* @param
*
* @return void
*/
public function preProcess()
{
if ($_SERVER['REQUEST_METHOD'] != 'POST') {
// CRM_Core_Controller validates qfKey for POST requests, but not necessarily
// for GET requests. Allowing GET would therefore be CSRF vulnerability.
CRM_Core_Error::fatal(ts('Preview only supports HTTP POST'));
}
// Inline forms don't get menu-level permission checks
$checkPermission = array(array('administer CiviCRM', 'manage event profiles'));
if (!CRM_Core_Permission::check($checkPermission)) {
CRM_Core_Error::fatal(ts('Permission Denied'));
}
$content = json_decode($_REQUEST['ufData'], TRUE);
foreach (array('ufGroup', 'ufFieldCollection') as $key) {
if (!is_array($content[$key])) {
CRM_Core_Error::fatal("Missing JSON parameter, {$key}");
}
}
//echo '<pre>'.htmlentities(var_export($content, TRUE)) .'</pre>';
//CRM_Utils_System::civiExit();
$fields = CRM_Core_BAO_UFGroup::formatUFFields($content['ufGroup'], $content['ufFieldCollection']);
//$fields = CRM_Core_BAO_UFGroup::getFields(1);
$this->setProfile($fields);
//echo '<pre>'.htmlentities(var_export($fields, TRUE)) .'</pre>';CRM_Utils_System::civiExit();
}
示例3: preProcess
/**
* Heart of the viewing process. The runner gets all the meta data for
* the contact and calls the appropriate type of page to view.
*
* @return void
* @access public
*
*/
function preProcess()
{
$id = CRM_Utils_Request::retrieve('cid', $this, true);
$gid = CRM_Utils_Request::retrieve('gid', $this);
if ($gid) {
require_once 'CRM/Profile/Page/Dynamic.php';
$page =& new CRM_Profile_Page_Dynamic($id, $gid);
$profileGroup = array();
$profileGroup['title'] = $title;
$profileGroup['content'] = $page->run();
$profileGroups[] = $profileGroup;
} else {
$ufGroups =& CRM_Core_BAO_UFGroup::getModuleUFGroup('Profile');
$profileGroups = array();
foreach ($ufGroups as $groupid => $group) {
require_once 'CRM/Profile/Page/Dynamic.php';
$page =& new CRM_Profile_Page_Dynamic($id, $groupid);
$profileGroup = array();
$profileGroup['title'] = $group['title'];
$profileGroup['content'] = $page->run();
$profileGroups[] = $profileGroup;
}
}
$this->assign('profileGroups', $profileGroups);
$this->assign('recentlyViewed', false);
CRM_Utils_System::setTitle(ts('Contact\'s Profile'));
}
示例4: civicrm_api3_uf_group_create
/**
* Use this API to create a new group. See the CRM Data Model for uf_group property definitions
*
* @param $params array Associative array of property name/value pairs to insert in group.
*
* @return Newly create $ufGroupArray array
* {@getfields UFGroup_create}
* @example UFGroupCreate.php
* @access public
*/
function civicrm_api3_uf_group_create($params)
{
$ids = array();
$ids['ufgroup'] = $params['id'];
$ufGroup = CRM_Core_BAO_UFGroup::add($params, $ids);
_civicrm_api3_object_to_array($ufGroup, $ufGroupArray[$ufGroup->id]);
return civicrm_api3_create_success($ufGroupArray, $params);
}
示例5: preProcess
/**
* pre processing work done here.
*
* gets session variables for group or field id
*
* @param
*
* @return void
*
* @access public
*
*/
function preProcess()
{
// Inline forms don't get menu-level permission checks
if (!CRM_Core_Permission::check('access CiviCRM')) {
CRM_Core_Error::fatal(ts('Permission denied'));
}
$gid = CRM_Utils_Request::retrieve('id', 'Positive');
$fields = CRM_Core_BAO_UFGroup::getFields($gid);
$this->setProfile($fields);
}
示例6: buildQuickForm
/**
* Build the form object.
*
*
* @return void
*/
public function buildQuickForm()
{
$types = array('Membership');
$profiles = CRM_Core_BAO_UFGroup::getProfiles($types, TRUE);
if (empty($profiles)) {
CRM_Core_Session::setStatus(ts("You will need to create a Profile containing the %1 fields you want to edit before you can use Batch update memberships via profile. Navigate to Administer CiviCRM >> CiviCRM Profile to configure a Profile. Consult the online Administrator documentation for more information.", array(1 => $types[0])), ts('Batch Update Error'), 'error');
CRM_Utils_System::redirect($this->_userContext);
}
$ufGroupElement = $this->add('select', 'uf_group_id', ts('Select Profile'), array('' => ts('- select profile -')) + $profiles, TRUE);
$this->addDefaultButtons(ts('Continue'));
}
示例7: buildQuickForm
/**
* Build the form object.
*
*
* @return void
*/
public function buildQuickForm()
{
$types = array('Participant');
$profiles = CRM_Core_BAO_UFGroup::getProfiles($types, TRUE);
if (empty($profiles)) {
CRM_Core_Session::setStatus("To use Update multiple participants, you need to configure a profile containing only Participant fields (e.g. Participant Status, Participant Role, etc.). Configure a profile at 'Administer CiviCRM >> Customize >> CiviCRM Profile'.");
CRM_Utils_System::redirect($this->_userContext);
}
$ufGroupElement = $this->add('select', 'uf_group_id', ts('Select Profile'), array('' => ts('- select profile -')) + $profiles, TRUE);
$this->addDefaultButtons(ts('Continue'));
}
示例8: setDefaultValues
function setDefaultValues()
{
$defaults = array($this->html_field_name('email') => $this->participant->email);
list($custom_fields_pre, $custom_fields_post) = $this->get_participant_custom_data_fields($this->participant->event_id);
$all_fields = $custom_fields_pre + $custom_fields_post;
$flat = array();
CRM_Core_BAO_UFGroup::setProfileDefaults($this->participant->contact_id, $all_fields, $flat);
foreach ($flat as $name => $field) {
$defaults["field[{$this->participant->id}][{$name}]"] = $field;
}
return $defaults;
}
示例9: buildQuickForm
function buildQuickForm()
{
$this->add('text', 'email', ts('Email'), CRM_Core_DAO::getAttribute('CRM_Contact_DAO_Contact', 'email'), true);
$fields = CRM_Core_BAO_UFGroup::getFields($this->_profileID, false, CRM_Core_Action::ADD, null, null, false, null, true);
$this->assign('custom', $fields);
require_once 'CRM/Profile/Form.php';
foreach ($fields as $key => $field) {
CRM_Core_BAO_UFGroup::buildProfile($this, $field, CRM_Profile_Form::MODE_CREATE);
$this->_fields[$key] = $field;
}
$this->addButtons(array(array('type' => 'next', 'name' => ts('Save'), 'isDefault' => true), array('type' => 'cancel', 'name' => ts('Cancel'))));
}
示例10: buildQuickForm
/**
* Function to actually build the form
*
* @return void
* @access public
*/
public function buildQuickForm()
{
require_once "CRM/Core/BAO/UFGroup.php";
$types = array('Contact', 'Individual', 'Contribution', 'Membership');
$profiles = CRM_Core_BAO_UFGroup::getProfiles($types);
if (empty($profiles)) {
$this->assign('noProfile', true);
}
$this->add('select', 'custom_pre_id', ts('Include Profile') . '<br />' . ts('(top of page)'), array('' => ts('- select -')) + $profiles);
$this->add('select', 'custom_post_id', ts('Include Profile') . '<br />' . ts('(bottom of page)'), array('' => ts('- select -')) + $profiles);
$this->addFormRule(array('CRM_Contribute_Form_ContributionPage_Custom', 'formRule'), $this->_id);
parent::buildQuickForm();
}
示例11: 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 );"));
}
}
示例12: preProcess
/**
* @param CRM_Contribute_Form_Contribution_Main|CRM_Event_Form_Registration_Register|CRM_Financial_Form_Payment $form
* @param null $type
* @param null $mode
*
* @throws Exception
*/
public static function preProcess(&$form, $type = NULL, $mode = NULL)
{
if ($type) {
$form->_type = $type;
} else {
$form->_type = CRM_Utils_Request::retrieve('type', 'String', $form);
}
if ($form->_type) {
$form->_paymentProcessor = CRM_Financial_BAO_PaymentProcessor::getPayment($form->_type, $form->_mode);
}
if (empty($form->_paymentProcessor)) {
// This would happen when hitting the back-button on a multi-page form with a $0 selection in play.
return;
}
$form->set('paymentProcessor', $form->_paymentProcessor);
$form->_paymentObject = System::singleton()->getByProcessor($form->_paymentProcessor);
$form->assign('suppressSubmitButton', $form->_paymentObject->isSuppressSubmitButtons());
$form->assign('currency', CRM_Utils_Array::value('currency', $form->_values));
// also set cancel subscription url
if (!empty($form->_paymentProcessor['is_recur']) && !empty($form->_values['is_recur'])) {
$form->_values['cancelSubscriptionUrl'] = $form->_paymentObject->subscriptionURL(NULL, NULL, 'cancel');
}
if (!empty($form->_values['custom_pre_id'])) {
$profileAddressFields = array();
$fields = CRM_Core_BAO_UFGroup::getFields($form->_values['custom_pre_id'], FALSE, CRM_Core_Action::ADD, NULL, NULL, FALSE, NULL, FALSE, NULL, CRM_Core_Permission::CREATE, NULL);
foreach ((array) $fields as $key => $value) {
CRM_Core_BAO_UFField::assignAddressField($key, $profileAddressFields, array('uf_group_id' => $form->_values['custom_pre_id']));
}
if (count($profileAddressFields)) {
$form->set('profileAddressFields', $profileAddressFields);
}
}
//checks after setting $form->_paymentProcessor
// we do this outside of the above conditional to avoid
// saving the country/state list in the session (which could be huge)
CRM_Core_Payment_Form::setPaymentFieldsByProcessor($form, $form->_paymentProcessor, CRM_Utils_Request::retrieve('billing_profile_id', 'String'));
$form->assign_by_ref('paymentProcessor', $form->_paymentProcessor);
// check if this is a paypal auto return and redirect accordingly
//@todo - determine if this is legacy and remove
if (CRM_Core_Payment::paypalRedirect($form->_paymentProcessor)) {
$url = CRM_Utils_System::url('civicrm/contribute/transact', "_qf_ThankYou_display=1&qfKey={$form->controller->_key}");
CRM_Utils_System::redirect($url);
}
// make sure we have a valid payment class, else abort
if (!empty($form->_values['is_monetary']) && !$form->_paymentProcessor['class_name'] && empty($form->_values['is_pay_later'])) {
CRM_Core_Error::fatal(ts('Payment processor is not set for this page'));
}
if (!empty($form->_membershipBlock) && !empty($form->_membershipBlock['is_separate_payment']) && (!empty($form->_paymentProcessor['class_name']) && !$form->_paymentObject->supports('MultipleConcurrentPayments'))) {
CRM_Core_Error::fatal(ts('This contribution page is configured to support separate contribution and membership payments. This %1 plugin does not currently support multiple simultaneous payments, or the option to "Execute real-time monetary transactions" is disabled. Please contact the site administrator and notify them of this error', array(1 => $form->_paymentProcessor['payment_processor_type'])));
}
}
示例13: 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);
}
示例14: preProcess
/**
* Set variables up before form is built.
*
* @param CRM_Core_Form $form
*
* @return void
*/
public static function preProcess(&$form)
{
$contriDAO = new CRM_Contribute_DAO_Contribution();
$contriDAO->id = $form->_id;
$contriDAO->find(TRUE);
if ($contriDAO->contribution_page_id) {
$ufJoinParams = array('module' => 'soft_credit', 'entity_table' => 'civicrm_contribution_page', 'entity_id' => $contriDAO->contribution_page_id);
$profileId = CRM_Core_BAO_UFJoin::getUFGroupIds($ufJoinParams);
//check if any honree profile is enabled if yes then assign its profile type to $_honoreeProfileType
// which will be used to constraint soft-credit contact type in formRule, CRM-13981
if ($profileId[0]) {
$form->_honoreeProfileType = CRM_Core_BAO_UFGroup::getContactType($profileId[0]);
}
}
}
示例15: buildQuickForm
/**
* Function to actually build the form
*
* @return void
* @access public
*/
public function buildQuickForm()
{
$types = array_merge(array('Contact', 'Individual', 'Contribution', 'Membership'), CRM_Contact_BAO_ContactType::subTypes('Individual'));
$profiles = CRM_Core_BAO_UFGroup::getProfiles($types);
$excludeTypes = array('Organization', 'Household', 'Participant', 'Activity');
$excludeProfiles = CRM_Core_BAO_UFGroup::getProfiles($excludeTypes);
foreach ($excludeProfiles as $key => $value) {
if (array_key_exists($key, $profiles)) {
unset($profiles[$key]);
}
}
if (empty($profiles)) {
$this->assign('noProfile', TRUE);
}
$this->add('select', 'custom_pre_id', ts('Include Profile') . '<br />' . ts('(top of page)'), array('' => ts('- select -')) + $profiles);
$this->add('select', 'custom_post_id', ts('Include Profile') . '<br />' . ts('(bottom of page)'), array('' => ts('- select -')) + $profiles);
$this->addFormRule(array('CRM_Contribute_Form_ContributionPage_Custom', 'formRule'), $this->_id);
parent::buildQuickForm();
}