本文整理汇总了PHP中CRM_Contribute_Form_ContributionPage::buildQuickForm方法的典型用法代码示例。如果您正苦于以下问题:PHP CRM_Contribute_Form_ContributionPage::buildQuickForm方法的具体用法?PHP CRM_Contribute_Form_ContributionPage::buildQuickForm怎么用?PHP CRM_Contribute_Form_ContributionPage::buildQuickForm使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CRM_Contribute_Form_ContributionPage
的用法示例。
在下文中一共展示了CRM_Contribute_Form_ContributionPage::buildQuickForm方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: buildQuickForm
/**
* Build the form object.
*
* @return void
*/
public function buildQuickForm()
{
// TODO:: Is this required?
$this->applyFilter('__ALL__', 'trim');
// Checkbox to ask whether or not to enable web tracking
$this->addElement('checkbox', 'enable_tracking', ts('Enable web tracking'));
// Text field to input the tracking id
$this->add('text', 'tracking_id', ts('Tracking ID'));
// Checkbox to ask whether or not to enable event tracking
$this->addElement('checkbox', 'ga_event_tracking', ts('Enable event tracking'));
// Checkbox to ask whether or not to track when the user visits the contribution page
$this->addElement('checkbox', 'track_register', ts('Track visit to contribution page'));
// Checkbox to ask whether or not to track when the user visits the confirmation page
$this->addElement('checkbox', 'track_confirm_register', ts('Track visit to confirmation page'));
// Checkbox to ask whether or not to track when the user visits the thank you page
$this->addElement('checkbox', 'track_thank_you', ts('Track visit to thank you page'));
// Checkbox to ask whether or not to track when the user changes default price option
$this->addElement('checkbox', 'track_price_change', ts('Track price change'));
// Checkbox to ask whether or not to enable ecommerce tracking
$this->addElement('checkbox', 'track_ecommerce', ts('Enable source tracking'));
// Checkbox to ask whether the page is the primary page of the experiment
$this->addElement('checkbox', 'is_experiment', ts('Primary page of experiment'));
// Text field to input the experiment key
$this->add('text', 'experiment_id', ts('Experiment key'));
$this->addFormRule(array('CRM_WebTracking_Form_ContributionPage_WebTracking', 'formRule'));
parent::buildQuickForm();
}
示例2: buildQuickForm
/**
* Build the form object.
*/
public function buildQuickForm()
{
$attributes = CRM_Core_DAO::getAttribute('CRM_Contribute_DAO_Premium');
$this->addElement('checkbox', 'premiums_active', ts('Premiums Section Enabled?'), NULL);
$this->addElement('text', 'premiums_intro_title', ts('Title'), $attributes['premiums_intro_title']);
$this->add('textarea', 'premiums_intro_text', ts('Introductory Message'), 'rows=5, cols=50');
$this->add('text', 'premiums_contact_email', ts('Contact Email') . ' ', $attributes['premiums_contact_email']);
$this->addRule('premiums_contact_email', ts('Please enter a valid email address.') . ' ', 'email');
$this->add('text', 'premiums_contact_phone', ts('Contact Phone'), $attributes['premiums_contact_phone']);
$this->addRule('premiums_contact_phone', ts('Please enter a valid phone number.'), 'phone');
$this->addElement('checkbox', 'premiums_display_min_contribution', ts('Display Minimum Contribution Amount?'));
// CRM-10999 Control label and position for No Thank-you radio button
$this->add('text', 'premiums_nothankyou_label', ts('No Thank-you Label'), $attributes['premiums_nothankyou_label']);
$positions = array(1 => ts('Before Premiums'), 2 => ts('After Premiums'));
$this->add('select', 'premiums_nothankyou_position', ts('No Thank-you Option'), $positions);
$showForm = TRUE;
if ($this->_single) {
if ($this->_id) {
$daoPremium = new CRM_Contribute_DAO_Premium();
$daoPremium->entity_id = $this->_id;
$daoPremium->entity_table = 'civicrm_contribution_page';
$daoPremium->premiums_active = 1;
if ($daoPremium->find(TRUE)) {
$showForm = FALSE;
}
}
}
$this->assign('showForm', $showForm);
parent::buildQuickForm();
$this->addFormRule(array('CRM_Contribute_Form_ContributionPage_Premium', 'formRule'), $this);
$premiumPage = new CRM_Contribute_Page_Premium();
$premiumPage->browse();
}
示例3: buildQuickForm
/**
* Build the form object.
*
* @return void
*/
public function buildQuickForm()
{
// Register 'contact_1' model
$entities = array();
$entities[] = array('entity_name' => 'contact_1', 'entity_type' => 'IndividualModel');
$allowCoreTypes = array_merge(array('Contact', 'Individual'), CRM_Contact_BAO_ContactType::subTypes('Individual'));
$allowSubTypes = array();
// Register 'contribution_1'
$financialTypeId = CRM_Core_DAO::getFieldValue('CRM_Contribute_DAO_ContributionPage', $this->_id, 'financial_type_id');
$allowCoreTypes[] = 'Contribution';
//CRM-15427
$allowSubTypes['ContributionType'] = array($financialTypeId);
$entities[] = array('entity_name' => 'contribution_1', 'entity_type' => 'ContributionModel', 'entity_sub_type' => '*');
// If applicable, register 'membership_1'
$member = CRM_Member_BAO_Membership::getMembershipBlock($this->_id);
if ($member && $member['is_active']) {
//CRM-15427
$entities[] = array('entity_name' => 'membership_1', 'entity_type' => 'MembershipModel', 'entity_sub_type' => '*');
$allowCoreTypes[] = 'Membership';
$allowSubTypes['MembershipType'] = explode(',', $member['membership_types']);
}
//CRM-15427
$this->addProfileSelector('custom_pre_id', ts('Include Profile') . '<br />' . ts('(top of page)'), $allowCoreTypes, $allowSubTypes, $entities, TRUE);
$this->addProfileSelector('custom_post_id', ts('Include Profile') . '<br />' . ts('(bottom of page)'), $allowCoreTypes, $allowSubTypes, $entities, TRUE);
$this->addFormRule(array('CRM_Contribute_Form_ContributionPage_Custom', 'formRule'), $this->_id);
parent::buildQuickForm();
}
示例4: 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();
}
示例5: buildQuickForm
/**
* Function to actually build the form
*
* @return void
* @access public
*/
function buildQuickForm()
{
$this->_first = true;
// name
$this->add('text', 'title', ts('Title'), CRM_Core_DAO::getAttribute('CRM_Contribute_DAO_ContributionPage', 'title'), true);
$this->add('select', 'contribution_type_id', ts('Contribution Type'), CRM_Contribute_PseudoConstant::contributionType());
// intro_text and footer_text
$this->add('textarea', 'intro_text', ts('Introductory Message'), CRM_Core_DAO::getAttribute('CRM_Contribute_DAO_ContributionPage', 'intro_text'), true);
$this->add('textarea', 'footer_text', ts('Footer Message'), CRM_Core_DAO::getAttribute('CRM_Contribute_DAO_ContributionPage', 'footer_text'), false);
// is this group active ?
$this->addElement('checkbox', 'is_active', ts('Is this Online Contribution Page Active?'));
parent::buildQuickForm();
}
示例6: buildQuickForm
/**
* Function to actually build the form
*
* @return void
* @access public
*/
public function buildQuickForm()
{
$this->registerRule('emailList', 'callback', 'emailList', 'CRM_Utils_Rule');
// thank you title and text (html allowed in text)
$this->add('text', 'thankyou_title', ts('Thank-you Page Title'), CRM_Core_DAO::getAttribute('CRM_Contribute_DAO_ContributionPage', 'thankyou_title'), TRUE);
$this->addWysiwyg('thankyou_text', ts('Thank-you Message'), CRM_Core_DAO::getAttribute('CRM_Contribute_DAO_ContributionPage', 'thankyou_text'));
$this->addWysiwyg('thankyou_footer', ts('Thank-you Page Footer'), CRM_Core_DAO::getAttribute('CRM_Contribute_DAO_ContributionPage', 'thankyou_footer'));
$this->addElement('checkbox', 'is_email_receipt', ts('Email Receipt to Contributor?'), NULL, array('onclick' => "showReceipt()"));
$this->add('text', 'receipt_from_name', ts('Receipt From Name'), CRM_Core_DAO::getAttribute('CRM_Contribute_DAO_ContributionPage', 'receipt_from_name'));
$this->add('text', 'receipt_from_email', ts('Receipt From Email'), CRM_Core_DAO::getAttribute('CRM_Contribute_DAO_ContributionPage', 'receipt_from_email'));
$this->add('textarea', 'receipt_text', ts('Receipt Message'), CRM_Core_DAO::getAttribute('CRM_Contribute_DAO_ContributionPage', 'receipt_text'));
$this->add('text', 'cc_receipt', ts('CC Receipt To'), CRM_Core_DAO::getAttribute('CRM_Contribute_DAO_ContributionPage', 'cc_receipt'));
$this->addRule('cc_receipt', ts('Please enter a valid list of comma delimited email addresses'), 'emailList');
$this->add('text', 'bcc_receipt', ts('BCC Receipt To'), CRM_Core_DAO::getAttribute('CRM_Contribute_DAO_ContributionPage', 'bcc_receipt'));
$this->addRule('bcc_receipt', ts('Please enter a valid list of comma delimited email addresses'), 'emailList');
parent::buildQuickForm();
$this->addFormRule(array('CRM_Contribute_Form_ContributionPage_ThankYou', 'formRule'), $this);
}
示例7: 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();
}
示例8: buildQuickForm
/**
* Function to actually build the form
*
* @return void
* @access public
*/
function buildQuickForm()
{
// do u want to allow a free form text field for amount
$this->addElement('checkbox', 'is_allow_other_amount', ts('Allow Other Amounts?'), null, array('onchange' => "minMax(this);"));
$this->add('text', 'min_amount', ts('Minimum Amount'), array('size' => 8, 'maxlength' => 8));
$this->addRule('min_amount', ts('Please enter a valid money value (e.g. 9.99).'), 'money');
$this->add('text', 'max_amount', ts('Maximum Amount'), array('size' => 8, 'maxlength' => 8));
$this->addRule('max_amount', ts('Please enter a valid money value (e.g. 99.99).'), 'money');
$default = array();
for ($i = 1; $i <= CRM_CONTRIBUTE_FORM_CONTRIBUTIONPAGE_AMOUNT_NUM_OPTION; $i++) {
// label
$this->add('text', "label[{$i}]", ts('Label'), CRM_Core_DAO::getAttribute('CRM_Core_DAO_CustomOption', 'label'));
// value
$this->add('text', "value[{$i}]", ts('Value'), CRM_Core_DAO::getAttribute('CRM_Core_DAO_CustomOption', 'value'));
$this->addRule("value[{$i}]", ts('Please enter a valid money value for this field (e.g. 99.99).'), 'money');
// default
$default[] = $this->createElement('radio', null, null, null, $i);
}
$this->addGroup($default, 'default');
$this->addFormRule(array('CRM_Contribute_Form_ContributionPage_Amount', 'formRule'));
parent::buildQuickForm();
}
示例9: buildQuickForm
/**
* Build the form object.
*
* @return void
*/
public function buildQuickForm()
{
$this->registerRule('emailList', 'callback', 'emailList', 'CRM_Utils_Rule');
// thank you title and text (html allowed in text)
$this->add('text', 'thankyou_title', ts('Thank-you Page Title'), CRM_Core_DAO::getAttribute('CRM_Contribute_DAO_ContributionPage', 'thankyou_title'), TRUE);
$attributes = CRM_Core_DAO::getAttribute('CRM_Contribute_DAO_ContributionPage', 'thankyou_text');
$attributes['click_wysiwyg'] = TRUE;
$this->addWysiwyg('thankyou_text', ts('Thank-you Message'), $attributes);
// FIXME: This hack forces height of editor to 175px. Need to modify QF classes for editors to allow passing
// explicit height and width.
$footerAttribs = array('rows' => 2, 'cols' => 40, 'click_wysiwyg' => TRUE);
$this->addWysiwyg('thankyou_footer', ts('Thank-you Footer'), $footerAttribs);
$this->addElement('checkbox', 'is_email_receipt', ts('Email Receipt to Contributor?'), NULL, array('onclick' => "showReceipt()"));
$this->add('text', 'receipt_from_name', ts('Receipt From Name'), CRM_Core_DAO::getAttribute('CRM_Contribute_DAO_ContributionPage', 'receipt_from_name'));
$this->add('text', 'receipt_from_email', ts('Receipt From Email'), CRM_Core_DAO::getAttribute('CRM_Contribute_DAO_ContributionPage', 'receipt_from_email'));
$this->add('textarea', 'receipt_text', ts('Receipt Message'), CRM_Core_DAO::getAttribute('CRM_Contribute_DAO_ContributionPage', 'receipt_text'));
$this->add('text', 'cc_receipt', ts('CC Receipt To'), CRM_Core_DAO::getAttribute('CRM_Contribute_DAO_ContributionPage', 'cc_receipt'));
$this->addRule('cc_receipt', ts('Please enter a valid list of comma delimited email addresses'), 'emailList');
$this->add('text', 'bcc_receipt', ts('BCC Receipt To'), CRM_Core_DAO::getAttribute('CRM_Contribute_DAO_ContributionPage', 'bcc_receipt'));
$this->addRule('bcc_receipt', ts('Please enter a valid list of comma delimited email addresses'), 'emailList');
parent::buildQuickForm();
$this->addFormRule(array('CRM_Contribute_Form_ContributionPage_ThankYou', 'formRule'), $this);
}
示例10: buildQuickForm
function buildQuickForm()
{
$attributes = CRM_Core_DAO::getAttribute('CRM_Contribute_DAO_Widget');
$this->addElement('checkbox', 'is_active', ts('Enable Widget?'), null, array('onclick' => "widgetBlock(this)"));
$this->addWysiwyg('about', ts('About'), $attributes['about']);
foreach ($this->_fields as $name => $val) {
$this->add($val[1], $name, $val[0], $attributes[$name], $val[2]);
}
foreach ($this->_colorFields as $name => $val) {
$this->add($val[1], $name, $val[0], $attributes[$name], $val[2]);
}
$this->assign_by_ref('fields', $this->_fields);
$this->assign_by_ref('colorFields', $this->_colorFields);
$this->_refreshButtonName = $this->getButtonName('refresh');
$this->addElement('submit', $this->_refreshButtonName, ts('Save and Preview'));
parent::buildQuickForm();
$this->addFormRule(array('CRM_Contribute_Form_ContributionPage_Widget', 'formRule'), $this);
}
示例11: buildQuickForm
/**
* Function to build the form
*
* @return None
* @access public
*/
public function buildQuickForm()
{
CRM_Friend_BAO_Friend::buildFriendForm($this);
parent::buildQuickForm();
}
示例12: buildQuickForm
/**
* Build the form object.
*/
public function buildQuickForm()
{
$this->_first = TRUE;
$attributes = CRM_Core_DAO::getAttribute('CRM_Contribute_DAO_ContributionPage');
// financial Type
$this->addSelect('financial_type_id', array(), TRUE);
// name
$this->add('text', 'title', ts('Title'), $attributes['title'], TRUE);
//CRM-7362 --add campaigns.
CRM_Campaign_BAO_Campaign::addCampaign($this, CRM_Utils_Array::value('campaign_id', $this->_values));
$this->add('wysiwyg', 'intro_text', ts('Introductory Message'), $attributes['intro_text']);
$this->add('wysiwyg', 'footer_text', ts('Footer Message'), $attributes['footer_text']);
//Register schema which will be used for OnBehalOf and HonorOf profile Selector
CRM_UF_Page_ProfileEditor::registerSchemas(array('OrganizationModel', 'HouseholdModel'));
// is on behalf of an organization ?
$this->addElement('checkbox', 'is_organization', ts('Allow individuals to contribute and / or signup for membership on behalf of an organization?'), NULL, array('onclick' => "showHideByValue('is_organization',true,'for_org_text','table-row','radio',false);showHideByValue('is_organization',true,'for_org_option','table-row','radio',false);"));
//CRM-15787 - If applicable, register 'membership_1'
$member = CRM_Member_BAO_Membership::getMembershipBlock($this->_id);
$coreTypes = array('Contact', 'Organization');
$entities[] = array('entity_name' => array('contact_1'), 'entity_type' => 'OrganizationModel');
if ($member && $member['is_active']) {
$coreTypes[] = 'Membership';
$entities[] = array('entity_name' => array('membership_1'), 'entity_type' => 'MembershipModel');
}
$allowCoreTypes = array_merge($coreTypes, CRM_Contact_BAO_ContactType::subTypes('Organization'));
$allowSubTypes = array();
$this->addProfileSelector('onbehalf_profile_id', ts('Organization Profile'), $allowCoreTypes, $allowSubTypes, $entities);
$options = array();
$options[] = $this->createElement('radio', NULL, NULL, ts('Optional'), 1);
$options[] = $this->createElement('radio', NULL, NULL, ts('Required'), 2);
$this->addGroup($options, 'is_for_organization', '');
$this->add('textarea', 'for_organization', ts('On behalf of Label'), array('rows' => 2, 'cols' => 50));
// collect goal amount
$this->add('text', 'goal_amount', ts('Goal Amount'), array('size' => 8, 'maxlength' => 12));
$this->addRule('goal_amount', ts('Please enter a valid money value (e.g. %1).', array(1 => CRM_Utils_Money::format('99.99', ' '))), 'money');
// is confirmation page enabled?
$this->addElement('checkbox', 'is_confirm_enabled', ts('Use a confirmation page?'));
// is this page shareable through social media ?
$this->addElement('checkbox', 'is_share', ts('Allow sharing through social media?'));
// is this page active ?
$this->addElement('checkbox', 'is_active', ts('Is this Online Contribution Page Active?'));
// should the honor be enabled
$this->addElement('checkbox', 'honor_block_is_active', ts('Honoree Section Enabled'), NULL, array('onclick' => "showHonor()"));
$this->add('text', 'honor_block_title', ts('Honoree Section Title'), array('maxlength' => 255, 'size' => 45));
$this->add('textarea', 'honor_block_text', ts('Honoree Introductory Message'), array('rows' => 2, 'cols' => 50));
$this->addSelect('soft_credit_types', array('label' => ts('Honor Types'), 'entity' => 'ContributionSoft', 'field' => 'soft_credit_type_id', 'multiple' => TRUE, 'class' => 'huge'));
$entities = array(array('entity_name' => 'contact_1', 'entity_type' => 'IndividualModel'));
$allowCoreTypes = array_merge(array('Contact', 'Individual', 'Organization', 'Household'), CRM_Contact_BAO_ContactType::subTypes('Individual'));
$allowSubTypes = array();
$this->addProfileSelector('honoree_profile', ts('Honoree Profile'), $allowCoreTypes, $allowSubTypes, $entities);
if (!empty($this->_submitValues['honor_block_is_active'])) {
$this->addRule('soft_credit_types', ts('At least one value must be selected if Honor Section is active'), 'required');
$this->addRule('honoree_profile', ts('Please select a profile used for honoree'), 'required');
}
// add optional start and end dates
$this->addDateTime('start_date', ts('Start Date'));
$this->addDateTime('end_date', ts('End Date'));
$this->addFormRule(array('CRM_Contribute_Form_ContributionPage_Settings', 'formRule'), $this);
parent::buildQuickForm();
}
示例13: buildQuickForm
/**
* Build the form object.
*
* @return void
*/
public function buildQuickForm()
{
if (isset($this->_id)) {
$defaults['entity_table'] = 'civicrm_contribution_page';
$defaults['entity_id'] = $this->_id;
CRM_Friend_BAO_Friend::getValues($defaults);
$this->_friendId = CRM_Utils_Array::value('id', $defaults);
}
CRM_Friend_BAO_Friend::buildFriendForm($this);
parent::buildQuickForm();
}
示例14: buildQuickForm
/**
* Build the form object.
*
* @return void
*/
public function buildQuickForm()
{
$urlParams = 'civicrm/admin/contribute/premium';
if ($this->_action & CRM_Core_Action::DELETE) {
$session = CRM_Core_Session::singleton();
$url = CRM_Utils_System::url($urlParams, 'reset=1&action=update&id=' . $this->_id);
$session->pushUserContext($url);
if (CRM_Utils_Request::retrieve('confirmed', 'Boolean', CRM_Core_DAO::$_nullObject, '', '', 'GET')) {
$dao = new CRM_Contribute_DAO_PremiumsProduct();
$dao->id = $this->_pid;
$dao->delete();
CRM_Core_Session::setStatus(ts('Selected Premium Product has been removed from this Contribution Page.'), ts('Saved'), 'success');
CRM_Utils_System::redirect($url);
}
$this->addButtons(array(array('type' => 'next', 'name' => ts('Delete'), 'spacing' => ' ', 'isDefault' => TRUE), array('type' => 'cancel', 'name' => ts('Cancel'))));
return;
}
if ($this->_action & CRM_Core_Action::PREVIEW) {
CRM_Contribute_BAO_Premium::buildPremiumPreviewBlock($this, NULL, $this->_pid);
$this->addButtons(array(array('type' => 'next', 'name' => ts('Done with Preview'), 'isDefault' => TRUE)));
return;
}
$session = CRM_Core_Session::singleton();
$url = CRM_Utils_System::url($urlParams, 'reset=1&action=update&id=' . $this->_id);
$session->pushUserContext($url);
$this->add('select', 'product_id', ts('Select the Product') . ' ', $this->_products, TRUE);
$this->addElement('text', 'weight', ts('Order'), CRM_Core_DAO::getAttribute('CRM_Contribute_DAO_PremiumsProduct', 'weight'));
$financialType = CRM_Contribute_PseudoConstant::financialType();
$premiumFinancialType = array();
CRM_Core_PseudoConstant::populate($premiumFinancialType, 'CRM_Financial_DAO_EntityFinancialAccount', $all = TRUE, $retrieve = 'entity_id', $filter = NULL, 'account_relationship = 8');
$costFinancialType = array();
CRM_Core_PseudoConstant::populate($costFinancialType, 'CRM_Financial_DAO_EntityFinancialAccount', $all = TRUE, $retrieve = 'entity_id', $filter = NULL, 'account_relationship = 7');
$productFinancialType = array_intersect($costFinancialType, $premiumFinancialType);
foreach ($financialType as $key => $financialTypeName) {
if (!in_array($key, $productFinancialType)) {
unset($financialType[$key]);
}
}
if (count($financialType)) {
$this->assign('financialType', $financialType);
}
$this->add('select', 'financial_type_id', ts('Financial Type'), array('' => ts('- select -')) + $financialType);
$this->addRule('weight', ts('Please enter integer value for weight'), 'integer');
$session->pushUserContext(CRM_Utils_System::url($urlParams, 'action=update&reset=1&id=' . $this->_id));
if ($this->_single) {
$this->addButtons(array(array('type' => 'next', 'name' => ts('Save'), 'spacing' => ' ', 'isDefault' => TRUE), array('type' => 'cancel', 'name' => ts('Cancel'))));
} else {
parent::buildQuickForm();
}
}
示例15: buildQuickForm
/**
* Function to actually build the form
*
* @return void
* @access public
*/
function buildQuickForm()
{
if ($this->_action & CRM_CORE_ACTION_DELETE) {
$session =& CRM_Core_Session::singleton();
$url = CRM_Utils_System::url('/civicrm/admin/contribute', 'reset=1&action=update&id=' . $this->_id . '&subPage=Premium');
$session->pushUserContext($url);
if (CRM_Utils_Request::retrieve('confirmed', $form, '', '', 'GET')) {
require_once 'CRM/Contribute/DAO/PremiumsProduct.php';
$dao =& new CRM_Contribute_DAO_PremiumsProduct();
$dao->id = $this->_pid;
$dao->delete();
CRM_Core_Session::setStatus(ts('Selected Premium Product has been removed from this Contribution Page.'));
CRM_Utils_System::redirect($url);
}
$this->addButtons(array(array('type' => 'next', 'name' => ts('Delete'), 'spacing' => ' ', 'isDefault' => true), array('type' => 'cancel', 'name' => ts('Cancel'))));
return;
}
if ($this->_action & CRM_CORE_ACTION_PREVIEW) {
require_once 'CRM/Contribute/BAO/Premium.php';
CRM_Contribute_BAO_Premium::buildPremiumPreviewBlock($this, null, $this->_pid);
$this->addButtons(array(array('type' => 'next', 'name' => ts('Done With Preview'), 'isDefault' => true)));
return;
}
$session =& CRM_Core_Session::singleton();
$url = CRM_Utils_System::url('/civicrm/admin/contribute', 'reset=1&action=update&id=' . $this->_id . '&subPage=Premium');
$session->pushUserContext($url);
$this->addElement('select', 'product_id', ts('Select the Product') . ' ', $this->_products);
$this->addRule('product_id', ts('Select the Product') . ' ', 'required');
$this->addElement('text', 'sort_position', ts('Weight'), CRM_Core_DAO::getAttribute('CRM_Contribute_DAO_PremiumsProduct', 'sort_position'));
$this->addRule('sort_position', ts('Please enter integer value for weight'), 'integer');
$session =& CRM_Core_Session::singleton();
$single = $session->get('singleForm');
$session->pushUserContext(CRM_Utils_System::url('civicrm/admin/contribute', 'action=update&reset=1&id=' . $this->_id . '&subPage=Premium'));
if ($single) {
$this->addButtons(array(array('type' => 'next', 'name' => ts('Save'), 'spacing' => ' ', 'isDefault' => true), array('type' => 'cancel', 'name' => ts('Cancel'))));
} else {
parent::buildQuickForm();
}
}