本文整理汇总了PHP中CRM_Core_BAO_CMSUser类的典型用法代码示例。如果您正苦于以下问题:PHP CRM_Core_BAO_CMSUser类的具体用法?PHP CRM_Core_BAO_CMSUser怎么用?PHP CRM_Core_BAO_CMSUser使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了CRM_Core_BAO_CMSUser类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: civicrm_api3_nsynch_user
/**
* Add an execute function for nsynch
* http://booki.flossmanuals.net/civicrm-developer-guide/api/
*/
function civicrm_api3_nsynch_user($params)
{
// execute function
try {
// execute
CRM_Core_BAO_CMSUser::synchronize(FALSE);
return civicrm_api3_create_success($values, $params);
} catch (Exception $e) {
// exception
return civicrm_api3_create_error('Caught exception: ', $e->getMessage(), '\\n');
}
}
示例2: run
/**
* Run the page.
*
* This method is called after the page is created. It checks for the
* type of action and executes that action.
* Finally it calls the parent's run method.
*
* @return void
* @access public
*
*/
function run()
{
//if javascript is enabled
if (CRM_Utils_Request::retrieve('confirmed', 'Boolean', $this, '', '', 'GET')) {
CRM_Core_BAO_CMSUser::synchronize();
return;
}
$controller = new CRM_Core_Controller_Simple('CRM_Admin_Form_CMSUser', 'Synchronize CMS Users');
// set the userContext stack
$session = CRM_Core_Session::singleton();
$session->pushUserContext(CRM_Utils_System::url('civicrm/admin', 'reset=1'));
$controller->setEmbedded(TRUE);
$controller->process();
$controller->run();
return parent::run();
}
示例3: buildQuickForm
//.........这里部分代码省略.........
//lets display status to primary page only.
$this->assign('waitlistMsg', $this->_waitlistMsg);
$this->assign('requireApprovalMsg', $this->_requireApprovalMsg);
$this->assign('allowGroupOnWaitlist', $allowGroupOnWaitlist);
$this->assign('isAdditionalParticipants', $isAdditionalParticipants);
//lets get js on two different qf elements.
$showHidePayfieldName = NULL;
$showHidePaymentInformation = FALSE;
if ($this->_values['event']['is_monetary']) {
self::buildAmount($this);
}
$pps = array();
//@todo this processor adding fn is another one duplicated on contribute - a shared
// common class would make this sort of thing extractable
$onlinePaymentProcessorEnabled = FALSE;
if (!empty($this->_paymentProcessors)) {
foreach ($this->_paymentProcessors as $key => $name) {
if ($name['billing_mode'] == 1) {
$onlinePaymentProcessorEnabled = TRUE;
}
$pps[$key] = $name['name'];
}
}
if ($this->getContactID() === '0' && !$this->_values['event']['is_multiple_registrations']) {
//@todo we are blocking for multiple registrations because we haven't tested
$this->addCidZeroOptions($onlinePaymentProcessorEnabled);
}
if (CRM_Utils_Array::value('is_pay_later', $this->_values['event']) && ($this->_allowConfirmation || !$this->_requireApproval && !$this->_allowWaitlist)) {
$pps[0] = $this->_values['event']['pay_later_text'];
}
if ($this->_values['event']['is_monetary']) {
if (count($pps) > 1) {
$this->addRadio('payment_processor', ts('Payment Method'), $pps, NULL, " ");
} elseif (!empty($pps)) {
$ppKeys = array_keys($pps);
$currentPP = array_pop($ppKeys);
$this->addElement('hidden', 'payment_processor', $currentPP);
}
}
//lets add some qf element to bypass payment validations, CRM-4320
if ($bypassPayment) {
$this->addElement('hidden', 'bypass_payment', NULL, array('id' => 'bypass_payment'));
}
$this->assign('bypassPayment', $bypassPayment);
$this->assign('showHidePaymentInformation', $showHidePaymentInformation);
$userID = $this->getContactID();
if (!$userID) {
$createCMSUser = FALSE;
if ($this->_values['custom_pre_id']) {
$profileID = $this->_values['custom_pre_id'];
$createCMSUser = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_UFGroup', $profileID, 'is_cms_user');
}
if (!$createCMSUser && $this->_values['custom_post_id']) {
if (!is_array($this->_values['custom_post_id'])) {
$profileIDs = array($this->_values['custom_post_id']);
} else {
$profileIDs = $this->_values['custom_post_id'];
}
foreach ($profileIDs as $pid) {
if (CRM_Core_DAO::getFieldValue('CRM_Core_DAO_UFGroup', $pid, 'is_cms_user')) {
$profileID = $pid;
$createCMSUser = TRUE;
break;
}
}
}
if ($createCMSUser) {
CRM_Core_BAO_CMSUser::buildForm($this, $profileID, TRUE);
}
}
//we have to load confirm contribution button in template
//when multiple payment processor as the user
//can toggle with payment processor selection
$billingModePaymentProcessors = 0;
if (!CRM_Utils_System::isNull($this->_paymentProcessors)) {
foreach ($this->_paymentProcessors as $key => $values) {
if ($values['billing_mode'] == CRM_Core_Payment::BILLING_MODE_BUTTON) {
$billingModePaymentProcessors++;
}
}
}
if ($billingModePaymentProcessors && count($this->_paymentProcessors) == $billingModePaymentProcessors) {
$allAreBillingModeProcessors = TRUE;
} else {
$allAreBillingModeProcessors = FALSE;
}
if (!$allAreBillingModeProcessors || CRM_Utils_Array::value('is_pay_later', $this->_values['event']) || $bypassPayment) {
//freeze button to avoid multiple calls.
$js = NULL;
if (!CRM_Utils_Array::value('is_monetary', $this->_values['event'])) {
$js = array('onclick' => "return submitOnce(this,'" . $this->_name . "','" . ts('Processing') . "');");
}
$this->addButtons(array(array('type' => 'upload', 'name' => ts('Continue >>'), 'spacing' => ' ', 'isDefault' => TRUE, 'js' => $js)));
}
$this->addFormRule(array('CRM_Event_Form_Registration_Register', 'formRule'), $this);
// add pcp fields
if ($this->_pcpId) {
CRM_PCP_BAO_PCP::buildPcp($this->_pcpId, $this);
}
}
示例4: buildQuickForm
/**
* Function to build the form
*
* @return None
* @access public
*/
public function buildQuickForm()
{
$id = CRM_PCP_BAO_PCP::getSupporterProfileId($this->_pageId, $this->_component);
if (CRM_PCP_BAO_PCP::checkEmailProfile($id)) {
$this->assign('profileDisplay', TRUE);
}
$fields = NULL;
if ($this->_contactID) {
if (CRM_Core_BAO_UFGroup::filterUFGroups($id, $this->_contactID)) {
$fields = CRM_Core_BAO_UFGroup::getFields($id, FALSE, CRM_Core_Action::ADD);
}
$this->addFormRule(array('CRM_PCP_Form_PCPAccount', 'formRule'), $this);
} else {
CRM_Core_BAO_CMSUser::buildForm($this, $id, TRUE);
$fields = CRM_Core_BAO_UFGroup::getFields($id, FALSE, CRM_Core_Action::ADD);
}
if ($fields) {
$this->assign('fields', $fields);
$addCaptcha = FALSE;
foreach ($fields as $key => $field) {
if (isset($field['data_type']) && $field['data_type'] == 'File') {
// ignore file upload fields
continue;
}
CRM_Core_BAO_UFGroup::buildProfile($this, $field, CRM_Profile_Form::MODE_CREATE);
$this->_fields[$key] = $field;
// CRM-11316 Is ReCAPTCHA enabled for this profile AND is this an anonymous visitor
if ($field['add_captcha'] && !$this->_contactID) {
$addCaptcha = TRUE;
}
}
if ($addCaptcha) {
$captcha =& CRM_Utils_ReCAPTCHA::singleton();
$captcha->add($this);
$this->assign('isCaptcha', TRUE);
}
}
if ($this->_component == 'contribute') {
$this->assign('campaignName', CRM_Contribute_PseudoConstant::contributionPage($this->_pageId));
} elseif ($this->_component == 'event') {
$this->assign('campaignName', CRM_Event_PseudoConstant::event($this->_pageId));
}
if ($this->_single) {
$button = array(array('type' => 'next', 'name' => ts('Save'), 'spacing' => ' ', 'isDefault' => TRUE), array('type' => 'cancel', 'name' => ts('Cancel')));
} else {
$button[] = array('type' => 'next', 'name' => ts('Continue >>'), 'spacing' => ' ', 'isDefault' => TRUE);
}
$this->addFormRule(array('CRM_PCP_Form_PCPAccount', 'formRule'), $this);
$this->addButtons($button);
}
示例5: updateUFName
/**
* update the uf_name in the user object
*
* @param int $contactId id of the contact to update
*
* @return void
* @access public
* @static
*/
static function updateUFName($contactId)
{
if (!$contactId) {
return;
}
$config = CRM_Core_Config::singleton();
if ($config->userFramework == 'Standalone') {
$ufName = CRM_Contact_BAO_Contact::getPrimaryOpenId($contactId);
} else {
$ufName = CRM_Contact_BAO_Contact::getPrimaryEmail($contactId);
}
if (!$ufName) {
return;
}
$update = false;
// 1.do check for contact Id.
$ufmatch = new CRM_Core_DAO_UFMatch();
$ufmatch->contact_id = $contactId;
$ufmatch->domain_id = CRM_Core_Config::domainID();
if (!$ufmatch->find(true)) {
return;
}
if ($ufmatch->uf_name != $ufName) {
$update = true;
}
// CRM-6928
// 2.do check for duplicate ufName.
$ufDupeName = new CRM_Core_DAO_UFMatch();
$ufDupeName->uf_name = $ufName;
$ufDupeName->domain_id = CRM_Core_Config::domainID();
if ($ufDupeName->find(true) && $ufDupeName->contact_id != $contactId) {
$update = false;
}
if (!$update) {
return;
}
// save the updated ufmatch object
$ufmatch->uf_name = $ufName;
$ufmatch->save();
require_once 'CRM/Core/BAO/CMSUser.php';
CRM_Core_BAO_CMSUser::updateUFName($ufmatch->uf_id, $ufName);
}
示例6: buildQuickForm
//.........这里部分代码省略.........
if ($this->_priceSetId && empty($this->_ccid)) {
$is_quick_config = CRM_Core_DAO::getFieldValue('CRM_Price_DAO_PriceSet', $this->_priceSetId, 'is_quick_config');
if ($is_quick_config) {
$this->_useForMember = 0;
$this->set('useForMember', $this->_useForMember);
}
}
//we allow premium for pledge during pledge creation only.
if (empty($this->_values['pledge_id']) && empty($this->_ccid)) {
CRM_Contribute_BAO_Premium::buildPremiumBlock($this, $this->_id, TRUE);
}
//don't build pledge block when mid is passed
if (!$this->_mid && empty($this->_ccid)) {
$config = CRM_Core_Config::singleton();
if (in_array('CiviPledge', $config->enableComponents) && !empty($this->_values['pledge_block_id'])) {
CRM_Pledge_BAO_PledgeBlock::buildPledgeBlock($this);
}
}
//to create an cms user
if (!$this->_contactID && empty($this->_ccid)) {
$createCMSUser = FALSE;
if ($this->_values['custom_pre_id']) {
$profileID = $this->_values['custom_pre_id'];
$createCMSUser = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_UFGroup', $profileID, 'is_cms_user');
}
if (!$createCMSUser && $this->_values['custom_post_id']) {
if (!is_array($this->_values['custom_post_id'])) {
$profileIDs = array($this->_values['custom_post_id']);
} else {
$profileIDs = $this->_values['custom_post_id'];
}
foreach ($profileIDs as $pid) {
if (CRM_Core_DAO::getFieldValue('CRM_Core_DAO_UFGroup', $pid, 'is_cms_user')) {
$profileID = $pid;
$createCMSUser = TRUE;
break;
}
}
}
if ($createCMSUser) {
CRM_Core_BAO_CMSUser::buildForm($this, $profileID, TRUE);
}
}
if ($this->_pcpId && empty($this->_ccid)) {
if ($pcpSupporter = CRM_PCP_BAO_PCP::displayName($this->_pcpId)) {
$pcp_supporter_text = ts('This contribution is being made thanks to the effort of <strong>%1</strong>, who supports our campaign.', array(1 => $pcpSupporter));
// Only tell people that can also create a PCP if the contribution page has a non-empty value in the "Create Personal Campaign Page link" field.
$text = CRM_PCP_BAO_PCP::getPcpBlockStatus($this->_id, 'contribute');
if (!empty($text)) {
$pcp_supporter_text .= ts("You can support it as well - once you complete the donation, you will be able to create your own Personal Campaign Page!");
}
$this->assign('pcpSupporterText', $pcp_supporter_text);
}
$prms = array('id' => $this->_pcpId);
CRM_Core_DAO::commonRetrieve('CRM_PCP_DAO_PCP', $prms, $pcpInfo);
if ($pcpInfo['is_honor_roll']) {
$this->assign('isHonor', TRUE);
$this->add('checkbox', 'pcp_display_in_roll', ts('Show my contribution in the public honor roll'), NULL, NULL, array('onclick' => "showHideByValue('pcp_display_in_roll','','nameID|nickID|personalNoteID','block','radio',false); pcpAnonymous( );"));
$extraOption = array('onclick' => "return pcpAnonymous( );");
$elements = array();
$elements[] =& $this->createElement('radio', NULL, '', ts('Include my name and message'), 0, $extraOption);
$elements[] =& $this->createElement('radio', NULL, '', ts('List my contribution anonymously'), 1, $extraOption);
$this->addGroup($elements, 'pcp_is_anonymous', NULL, ' ');
$this->add('text', 'pcp_roll_nickname', ts('Name'), array('maxlength' => 30));
$this->add('textarea', 'pcp_personal_note', ts('Personal Note'), array('style' => 'height: 3em; width: 40em;'));
}
}
if (empty($this->_values['fee']) && empty($this->_ccid)) {
CRM_Core_Error::fatal(ts('This page does not have any price fields configured or you may not have permission for them. Please contact the site administrator for more details.'));
}
//we have to load confirm contribution button in template
//when multiple payment processor as the user
//can toggle with payment processor selection
$billingModePaymentProcessors = 0;
if (!empty($this->_paymentProcessors)) {
foreach ($this->_paymentProcessors as $key => $values) {
if ($values['billing_mode'] == CRM_Core_Payment::BILLING_MODE_BUTTON) {
$billingModePaymentProcessors++;
}
}
}
if ($billingModePaymentProcessors && count($this->_paymentProcessors) == $billingModePaymentProcessors) {
$allAreBillingModeProcessors = TRUE;
} else {
$allAreBillingModeProcessors = FALSE;
}
if (!($allAreBillingModeProcessors && !$this->_values['is_pay_later'])) {
$submitButton = array('type' => 'upload', 'name' => CRM_Utils_Array::value('is_confirm_enabled', $this->_values) ? ts('Confirm Contribution') : ts('Contribute'), 'spacing' => ' ', 'isDefault' => TRUE);
// Add submit-once behavior when confirm page disabled
if (empty($this->_values['is_confirm_enabled'])) {
$submitButton['js'] = array('onclick' => "return submitOnce(this,'" . $this->_name . "','" . ts('Processing') . "');");
}
//change button name for updating contribution
if (!empty($this->_ccid)) {
$submitButton['name'] = ts('Confirm Payment');
}
$this->addButtons(array($submitButton));
}
$this->addFormRule(array('CRM_Contribute_Form_Contribution_Main', 'formRule'), $this);
}
示例7: postProcess
/**
* Post process function.
*/
public function postProcess()
{
// store the submitted values in an array
$params = $this->exportValues();
CRM_Core_BAO_CMSUser::create($params, 'email');
CRM_Core_Session::setStatus('', ts('User Added'), 'success');
}
示例8: createCMSUser
/**
* @param array $params
* @param int $contactID
* @param $mail
*/
public static function createCMSUser(&$params, $contactID, $mail)
{
// lets ensure we only create one CMS user
static $created = FALSE;
if ($created) {
return;
}
$created = TRUE;
if (!empty($params['cms_create_account'])) {
$params['contactID'] = $contactID;
if (!CRM_Core_BAO_CMSUser::create($params, $mail)) {
CRM_Core_Error::statusBounce(ts('Your profile is not saved and Account is not created.'));
}
}
}
示例9: buildQuickForm
//.........这里部分代码省略.........
if ($this->_values['is_monetary'] && $this->_values['is_recur'] && !CRM_Utils_Array::value('pledge_id', $this->_values)) {
self::buildRecur($this);
}
} elseif (CRM_Utils_Array::value('amount_block_is_active', $this->_values) && !CRM_Utils_Array::value('pledge_id', $this->_values)) {
$this->buildAmount($this->_separateMembershipPayment);
}
if ($this->_priceSetId) {
$is_quick_config = CRM_Core_DAO::getFieldValue('CRM_Price_DAO_Set', $this->_priceSetId, 'is_quick_config');
if ($is_quick_config) {
$this->_useForMember = 0;
$this->set('useForMember', $this->_useForMember);
}
}
if ($this->_values['is_for_organization']) {
$this->buildOnBehalfOrganization();
}
//we allow premium for pledge during pledge creation only.
if (!CRM_Utils_Array::value('pledge_id', $this->_values)) {
CRM_Contribute_BAO_Premium::buildPremiumBlock($this, $this->_id, TRUE);
}
if ($this->_values['honor_block_is_active']) {
$this->buildHonorBlock();
}
//don't build pledge block when mid is passed
if (!$this->_mid) {
$config = CRM_Core_Config::singleton();
if (in_array('CiviPledge', $config->enableComponents) && CRM_Utils_Array::value('pledge_block_id', $this->_values)) {
CRM_Pledge_BAO_PledgeBlock::buildPledgeBlock($this);
}
}
$this->buildCustom($this->_values['custom_pre_id'], 'customPre');
$this->buildCustom($this->_values['custom_post_id'], 'customPost');
if (!empty($this->_fields)) {
$profileAddressFields = array();
foreach ($this->_fields as $key => $value) {
CRM_Core_BAO_UFField::assignAddressField($key, $profileAddressFields);
}
$this->set('profileAddressFields', $profileAddressFields);
}
//to create an cms user
if (!$this->_userID) {
$createCMSUser = FALSE;
if ($this->_values['custom_pre_id']) {
$profileID = $this->_values['custom_pre_id'];
$createCMSUser = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_UFGroup', $profileID, 'is_cms_user');
}
if (!$createCMSUser && $this->_values['custom_post_id']) {
if (!is_array($this->_values['custom_post_id'])) {
$profileIDs = array($this->_values['custom_post_id']);
} else {
$profileIDs = $this->_values['custom_post_id'];
}
foreach ($profileIDs as $pid) {
if (CRM_Core_DAO::getFieldValue('CRM_Core_DAO_UFGroup', $pid, 'is_cms_user')) {
$profileID = $pid;
$createCMSUser = TRUE;
break;
}
}
}
if ($createCMSUser) {
CRM_Core_BAO_CMSUser::buildForm($this, $profileID, TRUE);
}
}
if ($this->_pcpId) {
if ($pcpSupporter = CRM_PCP_BAO_PCP::displayName($this->_pcpId)) {
$this->assign('pcpSupporterText', ts('This contribution is being made thanks to effort of <strong>%1</strong>, who supports our campaign. You can support it as well - once you complete the donation, you will be able to create your own Personal Campaign Page!', array(1 => $pcpSupporter)));
}
$this->assign('pcp', TRUE);
$this->add('checkbox', 'pcp_display_in_roll', ts('Show my contribution in the public honor roll'), NULL, NULL, array('onclick' => "showHideByValue('pcp_display_in_roll','','nameID|nickID|personalNoteID','block','radio',false); pcpAnonymous( );"));
$extraOption = array('onclick' => "return pcpAnonymous( );");
$elements = array();
$elements[] =& $this->createElement('radio', NULL, '', ts('Include my name and message'), 0, $extraOption);
$elements[] =& $this->createElement('radio', NULL, '', ts('List my contribution anonymously'), 1, $extraOption);
$this->addGroup($elements, 'pcp_is_anonymous', NULL, ' ');
$this->_defaults['pcp_is_anonymous'] = 0;
$this->add('text', 'pcp_roll_nickname', ts('Name'), array('maxlength' => 30));
$this->add('textarea', 'pcp_personal_note', ts('Personal Note'), array('style' => 'height: 3em; width: 40em;'));
}
//we have to load confirm contribution button in template
//when multiple payment processor as the user
//can toggle with payment processor selection
$billingModePaymentProcessors = 0;
if (!empty($this->_paymentProcessors)) {
foreach ($this->_paymentProcessors as $key => $values) {
if ($values['billing_mode'] == CRM_Core_Payment::BILLING_MODE_BUTTON) {
$billingModePaymentProcessors++;
}
}
}
if ($billingModePaymentProcessors && count($this->_paymentProcessors) == $billingModePaymentProcessors) {
$allAreBillingModeProcessors = TRUE;
} else {
$allAreBillingModeProcessors = FALSE;
}
if (!($allAreBillingModeProcessors && !$this->_values['is_pay_later'])) {
$this->addButtons(array(array('type' => 'upload', 'name' => ts('Confirm Contribution'), 'spacing' => ' ', 'isDefault' => TRUE)));
}
$this->addFormRule(array('CRM_Contribute_Form_Contribution_Main', 'formRule'), $this);
}
示例10: buildQuickForm
//.........这里部分代码省略.........
if ((CRM_Utils_Array::value('is_multiple_registrations', $this->_values['event']) || $this->_priceSetId) && !$this->_allowConfirmation && is_numeric($this->_availableRegistrations) && CRM_Utils_Array::value('has_waitlist', $this->_values['event'])) {
$bypassPayment = true;
//case might be group become as a part of waitlist.
//If not waitlist then they require admin approve.
$allowGroupOnWaitlist = true;
$this->_waitlistMsg = ts("This event has only %1 space(s) left. If you continue and register more than %1 people (including yourself ), the whole group will be wait listed. Or, you can reduce the number of people you are registering to %1 to avoid being put on the waiting list.", array(1 => $this->_availableRegistrations));
if ($this->_requireApproval) {
$this->_requireApprovalMsg = CRM_Utils_Array::value('approval_req_text', $this->_values['event'], ts('Registration for this event requires approval. Once your registration(s) have been reviewed, you will receive an email with a link to a web page where you can complete the registration process.'));
}
}
//case where only approval needed - no waitlist.
if ($this->_requireApproval && !$this->_allowWaitlist && !$bypassPayment) {
$this->_requireApprovalMsg = CRM_Utils_Array::value('approval_req_text', $this->_values['event'], ts('Registration for this event requires approval. Once your registration has been reviewed, you will receive an email with a link to a web page where you can complete the registration process.'));
}
//lets display status to primary page only.
$this->assign('waitlistMsg', $this->_waitlistMsg);
$this->assign('requireApprovalMsg', $this->_requireApprovalMsg);
$this->assign('allowGroupOnWaitlist', $allowGroupOnWaitlist);
$this->assign('isAdditionalParticipants', $isAdditionalParticipants);
$this->buildCustom($this->_values['custom_pre_id'], 'customPre');
$this->buildCustom($this->_values['custom_post_id'], 'customPost');
//lets get js on two different qf elements.
$buildExpressPayBlock = false;
$showHidePayfieldName = null;
$showHidePaymentInformation = false;
if ($this->_values['event']['is_monetary']) {
self::buildAmount($this);
$attributes = null;
$freezePayLater = true;
if (is_array($this->_paymentProcessor)) {
$freezePayLater = false;
if (!in_array($this->_paymentProcessor['billing_mode'], array(2, 4))) {
$showHidePayfieldName = 'payment_information';
$attributes = array('onclick' => "showHidePaymentInfo( );");
}
if ($this->_paymentProcessor['payment_processor_type'] == 'PayPal_Express') {
$showHidePayfieldName = 'PayPalExpress';
$attributes = array('onclick' => "showHidePayPalExpressOption();");
}
}
//lets build only when there is no waiting and no required approval.
if ($this->_allowConfirmation || !$this->_requireApproval && !$this->_allowWaitlist) {
if ($this->_values['event']['is_pay_later']) {
$element = $this->addElement('checkbox', 'is_pay_later', $this->_values['event']['pay_later_text'], null, $attributes);
//if payment processor is not available then freeze
//the paylater checkbox with default checked.
if ($freezePayLater) {
$element->freeze();
}
}
require_once 'CRM/Core/Payment/Form.php';
CRM_Core_Payment_Form::buildCreditCard($this);
if ($showHidePayfieldName == 'payment_information') {
$showHidePaymentInformation = true;
}
if ($showHidePayfieldName == 'PayPalExpress') {
$buildExpressPayBlock = true;
}
}
}
//lets add some qf element to bypass payment validations, CRM-4320
if ($bypassPayment) {
$attributes = null;
if ($showHidePayfieldName == 'payment_information' && $showHidePaymentInformation) {
$attributes = array('onclick' => "showHidePaymentInfo();");
}
if ($showHidePayfieldName == 'PayPalExpress') {
$attributes = array('onclick' => "showHidePayPalExpressOption();");
}
$this->addElement('hidden', 'bypass_payment', null, array('id' => 'bypass_payment'));
}
$this->assign('bypassPayment', $bypassPayment);
$this->assign('buildExpressPayBlock', $buildExpressPayBlock);
$this->assign('showHidePaymentInformation', $showHidePaymentInformation);
$userID = parent::getContactID();
if (!$userID) {
$createCMSUser = false;
if ($this->_values['custom_pre_id']) {
$profileID = $this->_values['custom_pre_id'];
$createCMSUser = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_UFGroup', $profileID, 'is_cms_user');
}
if (!$createCMSUser && $this->_values['custom_post_id']) {
$profileID = $this->_values['custom_post_id'];
$createCMSUser = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_UFGroup', $profileID, 'is_cms_user');
}
if ($createCMSUser) {
require_once 'CRM/Core/BAO/CMSUser.php';
CRM_Core_BAO_CMSUser::buildForm($this, $profileID, true);
}
}
if ($this->_paymentProcessor['billing_mode'] != CRM_Core_Payment::BILLING_MODE_BUTTON || CRM_Utils_Array::value('is_pay_later', $this->_values['event']) || $bypassPayment || !$buildExpressPayBlock) {
//freeze button to avoid multiple calls.
$js = null;
if (!CRM_Utils_Array::value('is_monetary', $this->_values['event'])) {
$js = array('onclick' => "return submitOnce(this,'" . $this->_name . "','" . ts('Processing') . "');");
}
$this->addButtons(array(array('type' => 'upload', 'name' => ts('Continue >>'), 'spacing' => ' ', 'isDefault' => true, 'js' => $js)));
}
$this->addFormRule(array('CRM_Event_Form_Registration_Register', 'formRule'), $this);
}
示例11: confirmPostProcess
/**
* Function to handle process after the confirmation of payment by User
*
* @return None
* @access public
*/
function confirmPostProcess($contactID = null, $contribution = null, $payment = null)
{
// add/update contact information
$fields = array();
unset($this->_params['note']);
//to avoid conflict overwrite $this->_params
$this->_params = $this->get('value');
// create CMS user
if (CRM_Utils_Array::value('cms_create_account', $this->_params)) {
$this->_params['contactID'] = $contactID;
$mail = 'email-5';
// we should use primary email for
// 1. free event registration.
// 2. pay later participant.
// 3. waiting list participant.
// 4. require approval participant.
if (CRM_Utils_Array::value('is_pay_later', $this->_params) || $this->_allowWaitlist || $this->_requireApproval || !CRM_Utils_Array::value('is_monetary', $this->_values['event'])) {
$mail = 'email-Primary';
}
require_once "CRM/Core/BAO/CMSUser.php";
if (!CRM_Core_BAO_CMSUser::create($this->_params, $mail)) {
CRM_Core_Error::statusBounce(ts('Your profile is not saved and Account is not created.'));
}
}
//get the amount of primary participant
if (CRM_Utils_Array::value('is_primary', $this->_params)) {
$this->_params['fee_amount'] = $this->get('primaryParticipantAmount');
}
// add participant record
$participant = $this->addParticipant($this->_params, $contactID);
$this->_participantIDS[] = $participant->id;
//setting register_by_id field and primaryContactId
if (CRM_Utils_Array::value('is_primary', $this->_params)) {
$this->set('registerByID', $participant->id);
$this->set('primaryContactId', $contactID);
}
require_once 'CRM/Core/BAO/CustomValueTable.php';
CRM_Core_BAO_CustomValueTable::postProcess($this->_params, CRM_Core_DAO::$_nullArray, 'civicrm_participant', $participant->id, 'Participant');
$createPayment = $this->_params['amount'] != 0 ? true : false;
// force to create zero amount payment, CRM-5095
if (!$createPayment && $contribution->id && $this->_params['amount'] == 0 && $this->_priceSetId && $this->_lineItem) {
$createPayment = true;
}
if ($createPayment && $this->_values['event']['is_monetary'] && CRM_Utils_Array::value('contributionID', $this->_params)) {
require_once 'CRM/Event/BAO/ParticipantPayment.php';
$paymentParams = array('participant_id' => $participant->id, 'contribution_id' => $contribution->id);
$ids = array();
$paymentPartcipant = CRM_Event_BAO_ParticipantPayment::create($paymentParams, $ids);
}
//set only primary participant's params for transfer checkout.
if (($this->_contributeMode == 'checkout' || $this->_contributeMode == 'notify') && CRM_Utils_Array::value('is_primary', $this->_params)) {
$this->_params['participantID'] = $participant->id;
$this->set('primaryParticipant', $this->_params);
}
$this->assign('action', $this->_action);
}
示例12: updateUFName
/**
* update the uf_name in the user object
*
* @param int $contactId id of the contact to update
*
* @return void
* @access public
* @static
*/
static function updateUFName($contactId)
{
$config =& CRM_Core_Config::singleton();
if ($config->userFramework == 'Standalone') {
$ufName = CRM_Contact_BAO_Contact::getPrimaryOpenId($contactId);
} else {
$ufName = CRM_Contact_BAO_Contact::getPrimaryEmail($contactId);
}
if (!$ufName) {
return;
}
$ufmatch =& new CRM_Core_DAO_UFMatch();
$ufmatch->contact_id = $contactId;
$ufmatch->domain_id = CRM_Core_Config::domainID();
if (!$ufmatch->find(true) || $ufmatch->uf_name == $ufName) {
// if object does not exist or the OpenID has not changed
return;
}
// save the updated ufmatch object
$ufmatch->uf_name = $ufName;
$ufmatch->save();
require_once 'CRM/Core/BAO/CMSUser.php';
CRM_Core_BAO_CMSUser::updateUFName($ufmatch->uf_id, $ufName);
}
示例13: checkUserName
public static function checkUserName()
{
$config = CRM_Core_Config::singleton();
$username = trim(htmlentities($_POST['cms_name']));
$isDrupal = ucfirst($config->userFramework) == 'Drupal' ? TRUE : FALSE;
$isJoomla = ucfirst($config->userFramework) == 'Joomla' ? TRUE : FALSE;
$params = array('name' => $username);
$errors = array();
require_once 'CRM/Core/BAO/CMSUser.php';
CRM_Core_BAO_CMSUser::checkUserNameEmailExists($params, $errors);
if (isset($errors['cms_name']) || isset($errors['name'])) {
//user name is not availble
$user = array('name' => 'no');
echo json_encode($user);
} else {
//user name is available
$user = array('name' => 'yes');
echo json_encode($user);
}
CRM_Utils_System::civiExit();
}
示例14: buildQuickForm
//.........这里部分代码省略.........
if ($this->_action & CRM_Core_Action::PREVIEW) {
$isTest = 1;
}
if ($this->_priceSetId && CRM_Core_Component::getComponentID('CiviMember') == CRM_Utils_Array::value('extends', $this->_priceSet)) {
$this->_useForMember = 1;
$this->set('useForMember', $this->_useForMember);
}
require_once 'CRM/Member/BAO/Membership.php';
$this->_separateMembershipPayment = CRM_Member_BAO_Membership::buildMembershipBlock($this, $this->_id, true, null, false, $isTest, $this->_membershipContactID);
}
$this->set('separateMembershipPayment', $this->_separateMembershipPayment);
}
$this->assign('useForMember', $this->_useForMember);
// If we configured price set for contribution page
// we are not allow membership signup as well as any
// other contribution amount field, CRM-5095
if (isset($this->_priceSetId) && $this->_priceSetId) {
$this->add('hidden', 'priceSetId', $this->_priceSetId);
// build price set form.
$this->set('priceSetId', $this->_priceSetId);
require_once 'CRM/Price/BAO/Set.php';
CRM_Price_BAO_Set::buildPriceSet($this);
} else {
if (CRM_Utils_Array::value('amount_block_is_active', $this->_values) && !CRM_Utils_Array::value('pledge_id', $this->_values)) {
$this->buildAmount($this->_separateMembershipPayment);
if ($this->_values['is_monetary'] && $this->_values['is_recur'] && $this->_paymentProcessor['is_recur']) {
self::buildRecur($this);
}
}
}
if (CRM_Utils_Array::value('is_pay_later', $this->_values)) {
$this->buildPayLater();
}
if ($this->_values['is_for_organization']) {
$this->buildOnBehalfOrganization();
}
//we allow premium for pledge during pledge creation only.
if (!CRM_Utils_Array::value('pledge_id', $this->_values)) {
require_once 'CRM/Contribute/BAO/Premium.php';
CRM_Contribute_BAO_Premium::buildPremiumBlock($this, $this->_id, true);
}
if ($this->_values['honor_block_is_active']) {
$this->buildHonorBlock();
}
//don't build pledge block when mid is passed
if (!$this->_mid) {
$config = CRM_Core_Config::singleton();
if (in_array('CiviPledge', $config->enableComponents) && CRM_Utils_Array::value('pledge_block_id', $this->_values)) {
require_once 'CRM/Pledge/BAO/PledgeBlock.php';
CRM_Pledge_BAO_PledgeBlock::buildPledgeBlock($this);
}
}
$this->buildCustom($this->_values['custom_pre_id'], 'customPre');
$this->buildCustom($this->_values['custom_post_id'], 'customPost');
// doing this later since the express button type depends if there is an upload or not
if ($this->_values['is_monetary']) {
require_once 'CRM/Core/Payment/Form.php';
if ($this->_paymentProcessor['payment_type'] & CRM_Core_Payment::PAYMENT_TYPE_DIRECT_DEBIT) {
CRM_Core_Payment_Form::buildDirectDebit($this);
} else {
CRM_Core_Payment_Form::buildCreditCard($this);
}
}
//to create an cms user
if (!$this->_userID) {
$createCMSUser = false;
if ($this->_values['custom_pre_id']) {
$profileID = $this->_values['custom_pre_id'];
$createCMSUser = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_UFGroup', $profileID, 'is_cms_user');
}
if (!$createCMSUser && $this->_values['custom_post_id']) {
$profileID = $this->_values['custom_post_id'];
$createCMSUser = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_UFGroup', $profileID, 'is_cms_user');
}
if ($createCMSUser) {
require_once 'CRM/Core/BAO/CMSUser.php';
CRM_Core_BAO_CMSUser::buildForm($this, $profileID, true);
}
}
if ($this->_pcpId) {
require_once 'CRM/Contribute/BAO/PCP.php';
if ($pcpSupporter = CRM_Contribute_BAO_PCP::displayName($this->_pcpId)) {
$this->assign('pcpSupporterText', ts('This contribution is being made thanks to effort of <strong>%1</strong>, who supports our campaign. You can support it as well - once you complete the donation, you will be able to create your own Personal Campaign Page!', array(1 => $pcpSupporter)));
}
$this->assign('pcp', true);
$this->add('checkbox', 'pcp_display_in_roll', ts('Show my contribution in the public honor roll'), null, null, array('onclick' => "showHideByValue('pcp_display_in_roll','','nameID|nickID|personalNoteID','block','radio',false); pcpAnonymous( );"));
$extraOption = array('onclick' => "return pcpAnonymous( );");
$elements = array();
$elements[] =& $this->createElement('radio', null, '', ts('Include my name and message'), 0, $extraOption);
$elements[] =& $this->createElement('radio', null, '', ts('List my contribution anonymously'), 1, $extraOption);
$this->addGroup($elements, 'pcp_is_anonymous', null, ' ');
$this->_defaults['pcp_is_anonymous'] = 0;
$this->add('text', 'pcp_roll_nickname', ts('Name'), array('maxlength' => 30));
$this->add('textarea', 'pcp_personal_note', ts('Personal Note'), array('style' => 'height: 3em; width: 40em;'));
}
if (!($this->_paymentProcessor['billing_mode'] == CRM_Core_Payment::BILLING_MODE_BUTTON && !$this->_values['is_pay_later'])) {
$this->addButtons(array(array('type' => 'upload', 'name' => ts('Confirm Contribution'), 'spacing' => ' ', 'isDefault' => true)));
}
$this->addFormRule(array('CRM_Contribute_Form_Contribution_Main', 'formRule'), $this);
}
示例15: postProcess
/**
* Function to process the form
*
* @access public
*
* @return None
*/
public function postProcess()
{
CRM_Core_BAO_CMSUser::synchronize();
}