本文整理汇总了PHP中CRM_PCP_BAO_PCP::getPcpBlockStatus方法的典型用法代码示例。如果您正苦于以下问题:PHP CRM_PCP_BAO_PCP::getPcpBlockStatus方法的具体用法?PHP CRM_PCP_BAO_PCP::getPcpBlockStatus怎么用?PHP CRM_PCP_BAO_PCP::getPcpBlockStatus使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CRM_PCP_BAO_PCP
的用法示例。
在下文中一共展示了CRM_PCP_BAO_PCP::getPcpBlockStatus方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: buildPcp
/**
* Add PCP form elements to a form.
*
* @param int $pcpId
* @param CRM_Core_Page $page
* @param null $elements
*/
public static function buildPcp($pcpId, &$page, &$elements = NULL)
{
$prms = array('id' => $pcpId);
CRM_Core_DAO::commonRetrieve('CRM_PCP_DAO_PCP', $prms, $pcpInfo);
if ($pcpSupporter = CRM_PCP_BAO_PCP::displayName($pcpId)) {
if ($pcpInfo['page_type'] == 'event') {
$pcp_supporter_text = ts('This event registration is being made thanks to the efforts of <strong>%1</strong>, who supports our campaign. ', array(1 => $pcpSupporter));
$text = CRM_PCP_BAO_PCP::getPcpBlockStatus($pcpInfo['page_id'], 'event');
if (!empty($text)) {
$pcp_supporter_text .= "You can support it as well - once you complete the registration, you will be able to create your own Personal Campaign Page!";
}
} else {
$pcp_supporter_text = ts('This contribution is being made thanks to the efforts of <strong>%1</strong>, who supports our campaign. ', array(1 => $pcpSupporter));
$text = CRM_PCP_BAO_PCP::getPcpBlockStatus($pcpInfo['page_id'], 'contribute');
if (!empty($text)) {
$pcp_supporter_text .= "You can support it as well - once you complete the donation, you will be able to create your own Personal Campaign Page!";
}
}
$page->assign('pcpSupporterText', $pcp_supporter_text);
}
$page->assign('pcp', TRUE);
// build honor roll fields for registration form if supporter has honor roll enabled for their PCP
if ($pcpInfo['is_honor_roll']) {
$page->assign('is_honor_roll', TRUE);
$page->add('checkbox', 'pcp_display_in_roll', ts('Show my support 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[] =& $page->createElement('radio', NULL, '', ts('Include my name and message'), 0, $extraOption);
$elements[] =& $page->createElement('radio', NULL, '', ts('List my support anonymously'), 1, $extraOption);
$page->addGroup($elements, 'pcp_is_anonymous', NULL, ' ');
$page->_defaults['pcp_is_anonymous'] = 0;
$page->add('text', 'pcp_roll_nickname', ts('Name'), array('maxlength' => 30));
$page->add('textarea', "pcp_personal_note", ts('Personal Note'), array('style' => 'height: 3em; width: 40em;'));
} else {
$page->assign('is_honor_roll', FALSE);
}
}
示例2: preProcess
//.........这里部分代码省略.........
}
// get price info
// CRM-5095
CRM_Price_BAO_PriceSet::initSet($this, $this->_id, 'civicrm_contribution_page');
// this avoids getting E_NOTICE errors in php
$setNullFields = array('amount_block_is_active', 'honor_block_is_active', 'is_allow_other_amount', 'footer_text');
foreach ($setNullFields as $f) {
if (!isset($this->_values[$f])) {
$this->_values[$f] = NULL;
}
}
//check if Membership Block is enabled, if Membership Fields are included in profile
//get membership section for this contribution page
$this->_membershipBlock = CRM_Member_BAO_Membership::getMembershipBlock($this->_id);
$this->set('membershipBlock', $this->_membershipBlock);
if ($this->_values['custom_pre_id']) {
$preProfileType = CRM_Core_BAO_UFField::getProfileType($this->_values['custom_pre_id']);
}
if ($this->_values['custom_post_id']) {
$postProfileType = CRM_Core_BAO_UFField::getProfileType($this->_values['custom_post_id']);
}
if ((isset($postProfileType) && $postProfileType == 'Membership' || isset($preProfileType) && $preProfileType == 'Membership') && !$this->_membershipBlock['is_active']) {
CRM_Core_Error::fatal(ts('This page includes a Profile with Membership fields - but the Membership Block is NOT enabled. Please notify the site administrator.'));
}
$pledgeBlock = CRM_Pledge_BAO_PledgeBlock::getPledgeBlock($this->_id);
if ($pledgeBlock) {
$this->_values['pledge_block_id'] = CRM_Utils_Array::value('id', $pledgeBlock);
$this->_values['max_reminders'] = CRM_Utils_Array::value('max_reminders', $pledgeBlock);
$this->_values['initial_reminder_day'] = CRM_Utils_Array::value('initial_reminder_day', $pledgeBlock);
$this->_values['additional_reminder_day'] = CRM_Utils_Array::value('additional_reminder_day', $pledgeBlock);
//set pledge id in values
$pledgeId = CRM_Utils_Request::retrieve('pledgeId', 'Positive', $this);
//authenticate pledge user for pledge payment.
if ($pledgeId) {
$this->_values['pledge_id'] = $pledgeId;
//lets override w/ pledge campaign.
$this->_values['campaign_id'] = CRM_Core_DAO::getFieldValue('CRM_Pledge_DAO_Pledge', $pledgeId, 'campaign_id');
self::authenticatePledgeUser();
}
}
$this->set('values', $this->_values);
$this->set('fields', $this->_fields);
}
// Handle PCP
$pcpId = CRM_Utils_Request::retrieve('pcpId', 'Positive', $this);
if ($pcpId) {
$pcp = CRM_PCP_BAO_PCP::handlePcp($pcpId, 'contribute', $this->_values);
$this->_pcpId = $pcp['pcpId'];
$this->_pcpBlock = $pcp['pcpBlock'];
$this->_pcpInfo = $pcp['pcpInfo'];
}
// Link (button) for users to create their own Personal Campaign page
if ($linkText = CRM_PCP_BAO_PCP::getPcpBlockStatus($this->_id, 'contribute')) {
$linkTextUrl = CRM_Utils_System::url('civicrm/contribute/campaign', "action=add&reset=1&pageId={$this->_id}&component=contribute", FALSE, NULL, TRUE);
$this->assign('linkTextUrl', $linkTextUrl);
$this->assign('linkText', $linkText);
}
//set pledge block if block id is set
if (CRM_Utils_Array::value('pledge_block_id', $this->_values)) {
$this->assign('pledgeBlock', TRUE);
}
// check if one of the (amount , membership) bloks is active or not
$this->_membershipBlock = $this->get('membershipBlock');
if (!$this->_values['amount_block_is_active'] && !$this->_membershipBlock['is_active'] && !$this->_priceSetId) {
CRM_Core_Error::fatal(ts('The requested online contribution page is missing a required Contribution Amount section or Membership section or Price Set. Please check with the site administrator for assistance.'));
}
if ($this->_values['amount_block_is_active']) {
$this->set('amount_block_is_active', $this->_values['amount_block_is_active']);
}
$this->_contributeMode = $this->get('contributeMode');
$this->assign('contributeMode', $this->_contributeMode);
//assigning is_monetary and is_email_receipt to template
$this->assign('is_monetary', $this->_values['is_monetary']);
$this->assign('is_email_receipt', $this->_values['is_email_receipt']);
$this->assign('bltID', $this->_bltID);
//assign cancelSubscription URL to templates
$this->assign('cancelSubscriptionUrl', CRM_Utils_Array::value('cancelSubscriptionUrl', $this->_values));
// assigning title to template in case someone wants to use it, also setting CMS page title
if ($this->_pcpId) {
$this->assign('title', $this->_pcpInfo['title']);
CRM_Utils_System::setTitle($this->_pcpInfo['title']);
} else {
$this->assign('title', $this->_values['title']);
CRM_Utils_System::setTitle($this->_values['title']);
}
$this->_defaults = array();
$this->_amount = $this->get('amount');
//CRM-6907
$config = CRM_Core_Config::singleton();
$config->defaultCurrency = CRM_Utils_Array::value('currency', $this->_values, $config->defaultCurrency);
//lets allow user to override campaign.
$campID = CRM_Utils_Request::retrieve('campID', 'Positive', $this);
if ($campID && CRM_Core_DAO::getFieldValue('CRM_Campaign_DAO_Campaign', $campID)) {
$this->_values['campaign_id'] = $campID;
}
//do check for cancel recurring and clean db, CRM-7696
if (CRM_Utils_Request::retrieve('cancel', 'Boolean', CRM_Core_DAO::$_nullObject)) {
self::cancelRecurring();
}
}
示例3: postProcess
/**
* Process the form submission.
*
*
* @return void
*/
public function postProcess()
{
// get the submitted form values.
$formValues = $this->controller->exportValues($this->_name);
$formValues['entity_id'] = $this->_entityId;
$formValues['entity_table'] = $this->_entityTable;
$formValues['source_contact_id'] = $this->_contactID;
$formValues['is_test'] = $this->_action ? 1 : 0;
$formValues['title'] = $this->_title;
$formValues['campaign_id'] = $this->_campaignId;
CRM_Friend_BAO_Friend::create($formValues);
$this->assign('status', 'thankyou');
$defaults = array();
$defaults['entity_id'] = $this->_entityId;
$defaults['entity_table'] = $this->_entityTable;
CRM_Friend_BAO_Friend::getValues($defaults);
if ($this->_entityTable == 'civicrm_pcp') {
$defaults['thankyou_text'] = $defaults['thankyou_title'] = ts('Thank you for your support');
$defaults['thankyou_text'] = ts('Thanks for supporting this campaign by spreading the word to your friends.');
} elseif ($this->_entityTable == 'civicrm_contribution_page') {
// If this is tell a friend after contributing, give donor link to create their own fundraising page
if ($linkText = CRM_PCP_BAO_PCP::getPcpBlockStatus($defaults['entity_id'], $defaults['entity_table'])) {
$linkTextUrl = CRM_Utils_System::url('civicrm/contribute/campaign', "action=add&reset=1&pageId={$defaults['entity_id']}&component=contribute", FALSE, NULL, TRUE, TRUE);
$this->assign('linkTextUrl', $linkTextUrl);
$this->assign('linkText', $linkText);
}
} elseif ($this->_entityTable == 'civicrm_event') {
// If this is tell a friend after registering for an event, give donor link to create their own fundraising page
require_once 'CRM/PCP/BAO/PCP.php';
if ($linkText = CRM_PCP_BAO_PCP::getPcpBlockStatus($defaults['entity_id'], $defaults['entity_table'])) {
$linkTextUrl = CRM_Utils_System::url('civicrm/contribute/campaign', "action=add&reset=1&pageId={$defaults['entity_id']}&component=event", FALSE, NULL, TRUE, TRUE);
$this->assign('linkTextUrl', $linkTextUrl);
$this->assign('linkText', $linkText);
}
}
CRM_Utils_System::setTitle($defaults['thankyou_title']);
$this->assign('thankYouText', $defaults['thankyou_text']);
}
示例4: 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);
}