本文整理汇总了PHP中CRM_Core_DAO_UFGroup::addSelect方法的典型用法代码示例。如果您正苦于以下问题:PHP CRM_Core_DAO_UFGroup::addSelect方法的具体用法?PHP CRM_Core_DAO_UFGroup::addSelect怎么用?PHP CRM_Core_DAO_UFGroup::addSelect使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CRM_Core_DAO_UFGroup
的用法示例。
在下文中一共展示了CRM_Core_DAO_UFGroup::addSelect方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: buildQuickForm
//.........这里部分代码省略.........
$this->assign('fields', $this->_fields);
$this->assign('fieldset', isset($this->_fieldset) ? $this->_fieldset : "");
// should we restrict what we display
$admin = TRUE;
if ($this->_mode == self::MODE_EDIT) {
$admin = FALSE;
// show all fields that are visibile:
// if we are a admin OR the same user OR acl-user with access to the profile
// or we have checksum access to this contact (i.e. the user without a login) - CRM-5909
if (CRM_Core_Permission::check('administer users') || $this->_id == $this->_currentUserID || $this->_isPermissionedChecksum || in_array($this->_gid, CRM_ACL_API::group(CRM_Core_Permission::EDIT, NULL, 'civicrm_uf_group', CRM_Core_PseudoConstant::get('CRM_Core_DAO_UFField', 'uf_group_id')))) {
$admin = TRUE;
}
}
// if false, user is not logged-in.
$anonUser = FALSE;
if (!$this->_currentUserID) {
$defaultLocationType = CRM_Core_BAO_LocationType::getDefault();
$primaryLocationType = $defaultLocationType->id;
$anonUser = TRUE;
}
$this->assign('anonUser', $anonUser);
$addCaptcha = array();
$emailPresent = FALSE;
// add the form elements
foreach ($this->_fields as $name => $field) {
// make sure that there is enough permission to expose this field
if (!$admin && $field['visibility'] == 'User and User Admin Only') {
unset($this->_fields[$name]);
continue;
}
// since the CMS manages the email field, suppress the email display if in
// register mode which occur within the CMS form
if ($this->_mode == self::MODE_REGISTER && substr($name, 0, 5) == 'email') {
unset($this->_fields[$name]);
continue;
}
list($prefixName, $index) = CRM_Utils_System::explode('-', $name, 2);
CRM_Core_BAO_UFGroup::buildProfile($this, $field, $this->_mode);
if ($field['add_to_group_id']) {
$addToGroupId = $field['add_to_group_id'];
}
//build array for captcha
if ($field['add_captcha']) {
$addCaptcha[$field['group_id']] = $field['add_captcha'];
}
if ($name == 'email-Primary' || ($name == 'email-' . isset($primaryLocationType) ? $primaryLocationType : "")) {
$emailPresent = TRUE;
$this->_mail = $name;
}
}
// add captcha only for create mode.
if ($this->_mode == self::MODE_CREATE) {
// suppress captcha for logged in users only
if ($this->_currentUserID) {
$this->_isAddCaptcha = FALSE;
} elseif (!$this->_isAddCaptcha && !empty($addCaptcha)) {
$this->_isAddCaptcha = TRUE;
}
if ($this->_gid) {
$dao = new CRM_Core_DAO_UFGroup();
$dao->id = $this->_gid;
$dao->addSelect();
$dao->addSelect('is_update_dupe');
if ($dao->find(TRUE)) {
if ($dao->is_update_dupe) {
$this->_isUpdateDupe = $dao->is_update_dupe;
}
}
}
} else {
$this->_isAddCaptcha = FALSE;
}
//finally add captcha to form.
if ($this->_isAddCaptcha) {
$captcha = CRM_Utils_ReCAPTCHA::singleton();
$captcha->add($this);
}
$this->assign("isCaptcha", $this->_isAddCaptcha);
if ($this->_mode != self::MODE_SEARCH) {
if (isset($addToGroupId)) {
$this->_ufGroup['add_to_group_id'] = $addToGroupId;
}
}
//let's do set defaults for the profile
$this->setDefaultsValues();
$action = CRM_Utils_Request::retrieve('action', 'String', $this, FALSE, NULL);
if ($this->_mode == self::MODE_CREATE) {
CRM_Core_BAO_CMSUser::buildForm($this, $this->_gid, $emailPresent, $action);
} else {
$this->assign('showCMS', FALSE);
}
$this->assign('groupId', $this->_gid);
// if view mode pls freeze it with the done button.
if ($this->_action & CRM_Core_Action::VIEW) {
$this->freeze();
}
if ($this->_context == 'dialog') {
$this->addElement('submit', $this->_duplicateButtonName, ts('Save Matching Contact'));
}
}
示例2: buildQuickForm
//.........这里部分代码省略.........
if (!$userID) {
require_once 'CRM/Core/BAO/LocationType.php';
$defaultLocationType =& CRM_Core_BAO_LocationType::getDefault();
$primaryLocationType = $defaultLocationType->id;
$anonUser = true;
$this->assign('anonUser', true);
}
$addCaptcha = array();
$emailPresent = false;
// cache the state country fields. based on the results, we could use our javascript solution
// in create or register mode
$stateCountryMap = array();
// add the form elements
foreach ($this->_fields as $name => $field) {
// make sure that there is enough permission to expose this field
if (!$admin && $field['visibility'] == 'User and User Admin Only' || CRM_Utils_Array::value('is_view', $field)) {
unset($this->_fields[$name]);
continue;
}
// since the CMS manages the email field, suppress the email display if in
// register mode which occur within the CMS form
if ($this->_mode == self::MODE_REGISTER && substr($name, 0, 5) == 'email') {
unset($this->_fields[$name]);
continue;
}
list($prefixName, $index) = CRM_Utils_System::explode('-', $name, 2);
if ($prefixName == 'state_province' || $prefixName == 'country') {
if (!array_key_exists($index, $stateCountryMap)) {
$stateCountryMap[$index] = array();
}
$stateCountryMap[$index][$prefixName] = $name;
}
CRM_Core_BAO_UFGroup::buildProfile($this, $field, $this->_mode);
if ($field['add_to_group_id']) {
$addToGroupId = $field['add_to_group_id'];
}
//build array for captcha
if ($field['add_captcha']) {
$addCaptcha[$field['group_id']] = $field['add_captcha'];
}
if ($name == 'email-Primary' || ($name == 'email-' . isset($primaryLocationType) ? $primaryLocationType : "")) {
$emailPresent = true;
$this->_mail = $name;
}
}
$setCaptcha = false;
// do this only for CiviCRM created forms
if ($this->_mode == self::MODE_CREATE) {
if (!empty($addCaptcha)) {
$setCaptcha = true;
}
if ($this->_gid) {
$dao = new CRM_Core_DAO_UFGroup();
$dao->id = $this->_gid;
$dao->addSelect();
$dao->addSelect('add_captcha', 'is_update_dupe');
if ($dao->find(true)) {
if ($dao->add_captcha) {
$setCaptcha = true;
}
if ($dao->is_update_dupe) {
$this->_isUpdateDupe = true;
}
}
}
if ($setCaptcha) {
require_once 'CRM/Utils/ReCAPTCHA.php';
$captcha =& CRM_Utils_ReCAPTCHA::singleton();
$captcha->add($this);
$this->assign("isCaptcha", true);
}
}
if ($this->_mode != self::MODE_SEARCH) {
if (isset($addToGroupId)) {
$this->add('hidden', "group[{$addToGroupId}]", 1);
$this->_addToGroupID = $addToGroupId;
}
}
// also do state country js
require_once 'CRM/Core/BAO/Address.php';
CRM_Core_BAO_Address::addStateCountryMap($stateCountryMap, $this->_defaults);
$action = CRM_Utils_Request::retrieve('action', 'String', $this, false, null);
if ($this->_mode == self::MODE_CREATE) {
require_once 'CRM/Core/BAO/CMSUser.php';
CRM_Core_BAO_CMSUser::buildForm($this, $this->_gid, $emailPresent, $action);
} else {
$this->assign('showCMS', false);
}
$this->assign('groupId', $this->_gid);
// now fix all state country selectors
require_once 'CRM/Core/BAO/Address.php';
CRM_Core_BAO_Address::fixAllStateSelects($this, $this->_defaults);
// if view mode pls freeze it with the done button.
if ($this->_action & CRM_Core_Action::VIEW) {
$this->freeze();
}
if ($this->_context == 'dialog') {
$this->addElement('submit', $this->_duplicateButtonName, ts('Save Matching Contact'));
}
}