/** * 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(); }
/** * 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(); }
/** * 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(); }
/** * 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(); }
/** * 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(); }
/** * 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); }
/** * 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(); }
/** * 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(); }
/** * 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); }
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); }
/** * Function to build the form * * @return None * @access public */ public function buildQuickForm() { CRM_Friend_BAO_Friend::buildFriendForm($this); parent::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(); }
/** * 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(); }
/** * 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(); } }
/** * 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(); } }
/** * Function to actually build the form * * @return void * @access public */ function buildQuickForm() { $this->addElement('checkbox', 'is_active', ts('Enable Personal Campaign Pages (for this contribution page)?'), null, array('onclick' => "return showHideByValue('is_active',true,'pcpFields','table-row','radio',false);")); $this->addElement('checkbox', 'is_approval_needed', ts('Approval required')); $profile = array(); $isUserRequired = null; $config =& CRM_Core_Config::singleton(); if ($config->userFramework != 'Standalone') { $isUserRequired = 2; } CRM_Core_DAO::commonRetrieveAll('CRM_Core_DAO_UFGroup', 'is_cms_user', $isUserRequired, $profiles, array('title', 'is_active')); if (!empty($profiles)) { foreach ($profiles as $key => $value) { if ($value['is_active']) { $profile[$key] = $value['title']; } } $this->assign('profile', $profile); } $this->add('select', 'supporter_profile_id', ts('Supporter profile'), array('' => ts('- select -')) + $profile); $this->addElement('checkbox', 'is_tellfriend_enabled', ts("Allow 'Tell a friend' functionality"), null, array('onclick' => "return showHideByValue('is_tellfriend_enabled',true,'tflimit','table-row','radio',false);")); $this->add('text', 'tellfriend_limit', ts("'Tell a friend' maximum recipients limit"), CRM_Core_DAO::getAttribute('CRM_Contribute_DAO_ContributionPage', 'pcp_tellfriend_limit')); $this->addRule('tellfriend_limit', ts('Please enter a valid limit.'), 'integer'); $this->add('text', 'link_text', ts("'Create Personal Campaign Page' link text"), CRM_Core_DAO::getAttribute('CRM_Contribute_DAO_PCPBlock', 'pcp_link_text')); $this->add('text', 'notify_email', ts('Notify Email'), CRM_Core_DAO::getAttribute('CRM_Contribute_DAO_PCPBlock', 'notify_email')); parent::buildQuickForm(); $this->addFormRule(array('CRM_Contribute_Form_ContributionPage_PCP', 'formRule'), $this); }
/** * Build the form object. */ 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('onclick' => "minMax(this);showHideAmountBlock( this, 'is_allow_other_amount' );")); $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. %1).', array(1 => CRM_Utils_Money::format('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. %1).', array(1 => CRM_Utils_Money::format('99.99', ' '))), 'money'); //CRM-12055 $this->add('text', 'amount_label', ts('Contribution Amounts Label')); $default = array($this->createElement('radio', NULL, NULL, NULL, 0)); $this->add('hidden', "price_field_id", '', array('id' => "price_field_id")); $this->add('hidden', "price_field_other", '', array('id' => "price_field_option")); for ($i = 1; $i <= self::NUM_OPTION; $i++) { // label $this->add('text', "label[{$i}]", ts('Label'), CRM_Core_DAO::getAttribute('CRM_Core_DAO_OptionValue', 'label')); $this->add('hidden', "price_field_value[{$i}]", '', array('id' => "price_field_value[{$i}]")); // value $this->add('text', "value[{$i}]", ts('Value'), CRM_Core_DAO::getAttribute('CRM_Core_DAO_OptionValue', 'value')); $this->addRule("value[{$i}]", ts('Please enter a valid money value (e.g. %1).', array(1 => CRM_Utils_Money::format('99.99', ' '))), 'money'); // default $default[] = $this->createElement('radio', NULL, NULL, NULL, $i); } $this->addGroup($default, 'default'); $this->addElement('checkbox', 'amount_block_is_active', ts('Contribution Amounts section enabled'), NULL, array('onclick' => "showHideAmountBlock( this, 'amount_block_is_active' );")); $this->addElement('checkbox', 'is_monetary', ts('Execute real-time monetary transactions')); $paymentProcessors = CRM_Financial_BAO_PaymentProcessor::getAllPaymentProcessors('live'); $recurringPaymentProcessor = $futurePaymentProcessor = $paymentProcessor = array(); if (!empty($paymentProcessors)) { foreach ($paymentProcessors as $id => $processor) { if ($id != 0) { $paymentProcessor[$id] = $processor['name']; } if (CRM_Utils_Array::value('is_recur', $processor)) { $recurringPaymentProcessor[] = $id; } if (CRM_Utils_Array::value('object', $processor) && $processor['object']->supports('FutureRecurStartDate')) { $futurePaymentProcessor[] = $id; } } } if (count($recurringPaymentProcessor)) { $this->assign('recurringPaymentProcessor', $recurringPaymentProcessor); } if (count($futurePaymentProcessor)) { $this->assign('futurePaymentProcessor', $futurePaymentProcessor); } if (count($paymentProcessor)) { $this->assign('paymentProcessor', $paymentProcessor); } $this->addCheckBox('payment_processor', ts('Payment Processor'), array_flip($paymentProcessor), NULL, NULL, NULL, NULL, array(' ', ' ', ' ', '<br/>')); //check if selected payment processor supports recurring payment if (!empty($recurringPaymentProcessor)) { $this->addElement('checkbox', 'is_recur', ts('Recurring Contributions'), NULL, array('onclick' => "showHideByValue('is_recur',true,'recurFields','table-row','radio',false);")); $this->addCheckBox('recur_frequency_unit', ts('Supported recurring units'), CRM_Core_OptionGroup::values('recur_frequency_units', FALSE, FALSE, TRUE), NULL, NULL, NULL, NULL, array(' ', ' ', ' ', '<br/>'), TRUE); $this->addElement('checkbox', 'is_recur_interval', ts('Support recurring intervals')); $this->addElement('checkbox', 'is_recur_installments', ts('Offer installments')); } // add pay later options $this->addElement('checkbox', 'is_pay_later', ts('Pay later option'), NULL); $this->addElement('textarea', 'pay_later_text', ts('Pay later label'), CRM_Core_DAO::getAttribute('CRM_Contribute_DAO_ContributionPage', 'pay_later_text'), FALSE); $this->add('wysiwyg', 'pay_later_receipt', ts('Pay Later Instructions'), CRM_Core_DAO::getAttribute('CRM_Contribute_DAO_ContributionPage', 'pay_later_receipt')); $this->addElement('checkbox', 'is_billing_required', ts('Billing address required')); //add partial payment options // add price set fields $price = CRM_Price_BAO_PriceSet::getAssoc(FALSE, 'CiviContribute'); if (CRM_Utils_System::isNull($price)) { $this->assign('price', FALSE); } else { $this->assign('price', TRUE); } $this->add('select', 'price_set_id', ts('Price Set'), array('' => ts('- none -')) + $price, NULL, array('onchange' => "showHideAmountBlock( this.value, 'price_set_id' );")); //CiviPledge fields. $config = CRM_Core_Config::singleton(); if (in_array('CiviPledge', $config->enableComponents)) { $this->assign('civiPledge', TRUE); $this->addElement('checkbox', 'is_pledge_active', ts('Pledges'), NULL, array('onclick' => "showHideAmountBlock( this, 'is_pledge_active' ); return showHideByValue('is_pledge_active',true,'pledgeFields','table-row','radio',false);")); $this->addCheckBox('pledge_frequency_unit', ts('Supported pledge frequencies'), CRM_Core_OptionGroup::values('recur_frequency_units', FALSE, FALSE, TRUE), NULL, NULL, NULL, NULL, array(' ', ' ', ' ', '<br/>'), TRUE); $this->addElement('checkbox', 'is_pledge_interval', ts('Allow frequency intervals')); $this->addElement('text', 'initial_reminder_day', ts('Send payment reminder'), array('size' => 3)); $this->addElement('text', 'max_reminders', ts('Send up to'), array('size' => 3)); $this->addElement('text', 'additional_reminder_day', ts('Send additional reminders'), array('size' => 3)); if (!empty($futurePaymentProcessor)) { // CRM-18854 $this->addElement('checkbox', 'adjust_recur_start_date', ts('Adjust Recurring Start Date'), NULL, array('onclick' => "showHideByValue('adjust_recur_start_date',true,'recurDefaults','table-row','radio',false);")); $this->addDate('pledge_calendar_date', ts('Specific Calendar Date')); $month = CRM_Utils_Date::getCalendarDayOfMonth(); $this->add('select', 'pledge_calendar_month', ts('Specific day of Month'), $month); $pledgeDefaults = array('contribution_date' => ts('Day of Contribution'), 'calendar_date' => ts('Specific Calendar Date'), 'calendar_month' => ts('Specific day of Month')); $this->addRadio('pledge_default_toggle', ts('Recurring Contribution Start Date Default'), $pledgeDefaults, array('allowClear' => FALSE), '<br/><br/>'); $this->addElement('checkbox', 'is_pledge_start_date_visible', ts('Show Recurring Donation Start Date?'), NULL); $this->addElement('checkbox', 'is_pledge_start_date_editable', ts('Allow Edits to Recurring Donation Start date?'), NULL); } } //add currency element. $this->addCurrency('currency', ts('Currency')); $this->addFormRule(array('CRM_Contribute_Form_ContributionPage_Amount', 'formRule'), $this); parent::buildQuickForm(); }
/** * Function to actually build the form * * @return void * @access public */ function buildQuickForm() { $this->add('select', 'custom_pre_id', ts('Custom Fields') . '<br />' . ts('(above billing info)'), array('' => ts('- select -')) + CRM_Core_PseudoConstant::ufGroup()); $this->add('select', 'custom_post_id', ts('Custom Fields') . '<br />' . ts('(below billing info)'), array('' => ts('- select -')) + CRM_Core_PseudoConstant::ufGroup()); parent::buildQuickForm(); }
/** * Function to actually build the form * * @return void * @access public */ public function buildQuickForm() { require_once 'CRM/Member/BAO/MembershipType.php'; $membershipTypes = CRM_Member_BAO_MembershipType::getMembershipTypes(); if (!empty($membershipTypes)) { $this->addElement('checkbox', 'is_active', ts('Membership Section Enabled?'), null, array('onclick' => "memberBlock(this);")); $this->addElement('text', 'new_title', ts('Title - New Membership'), CRM_Core_DAO::getAttribute('CRM_Member_DAO_MembershipBlock', 'new_title')); $this->addWysiwyg('new_text', ts('Introductory Message - New Memberships'), CRM_Core_DAO::getAttribute('CRM_Member_DAO_MembershipBlock', 'new_text')); $this->addElement('text', 'renewal_title', ts('Title - Renewals'), CRM_Core_DAO::getAttribute('CRM_Member_DAO_MembershipBlock', 'renewal_title')); $this->addWysiwyg('renewal_text', ts('Introductory Message - Renewals'), CRM_Core_DAO::getAttribute('CRM_Member_DAO_MembershipBlock', 'renewal_text')); $this->addElement('checkbox', 'is_required', ts('Require Membership Signup')); $this->addElement('checkbox', 'display_min_fee', ts('Display Membership Fee')); $this->addElement('checkbox', 'is_separate_payment', ts('Separate Membership Payment')); $paymentProcessor = CRM_Core_PseudoConstant::paymentProcessor(false, false, 'is_recur = 1'); $paymentProcessorId = CRM_Core_DAO::getFieldValue('CRM_Contribute_DAO_ContributionPage', $this->_id, 'payment_processor_id'); $isRecur = false; $membership = array(); $membershipDefault = array(); foreach ($membershipTypes as $k => $v) { $membership[] = HTML_QuickForm::createElement('advcheckbox', $k, null, $v); $membershipDefault[] = HTML_QuickForm::createElement('radio', null, null, null, $k); if (is_array($paymentProcessor) && CRM_Utils_Array::value($paymentProcessorId, $paymentProcessor)) { $isRecur = true; $autoRenew = CRM_Core_DAO::getFieldValue('CRM_Member_DAO_MembershipType', $k, 'auto_renew'); $autoRenewOptions = array(); if ($autoRenew) { $autoRenewOptions = array(ts('Not offered'), ts('Give option'), ts('Required')); $this->addElement('select', "auto_renew_{$k}", ts('Auto-renew'), $autoRenewOptions); $this->_renewOption[$k] = $autoRenew; } } else { $isRecur = false; } } $this->assign('is_recur', $isRecur); $this->assign('auto_renew', $this->_renewOption); $this->addGroup($membership, 'membership_type', ts('Membership Types')); $this->addGroup($membershipDefault, 'membership_type_default', ts('Membership Types Default')); $this->addFormRule(array('CRM_Member_Form_MembershipBlock', 'formRule'), $this->_id); } $session = CRM_Core_Session::singleton(); $single = $session->get('singleForm'); if ($single) { $this->addButtons(array(array('type' => 'next', 'name' => ts('Save'), 'spacing' => ' ', 'isDefault' => true), array('type' => 'cancel', 'name' => ts('Cancel')))); } else { parent::buildQuickForm(); } //$session->set('single', false ); }
/** * Function to actually build the form * * @return void * @access public */ public function buildQuickForm() { $this->_first = TRUE; $attributes = CRM_Core_DAO::getAttribute('CRM_Contribute_DAO_ContributionPage'); // name $this->add('text', 'title', ts('Title'), $attributes['title'], TRUE); $this->add('select', 'contribution_type_id', ts('Contribution Type'), CRM_Contribute_PseudoConstant::contributionType(), TRUE); //CRM-7362 --add campaigns. CRM_Campaign_BAO_Campaign::addCampaign($this, CRM_Utils_Array::value('campaign_id', $this->_values)); $this->addWysiwyg('intro_text', ts('Introductory Message'), $attributes['intro_text']); $this->addWysiwyg('footer_text', ts('Footer Message'), $attributes['footer_text']); // 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);")); $required = array('Contact', 'Organization'); $optional = array('Contribution', 'Membership'); $profiles = CRM_Core_BAO_UFGroup::getValidProfiles($required, $optional); //Check profiles for Organization subtypes $contactSubType = CRM_Contact_BAO_ContactType::subTypes('Organization'); foreach ($contactSubType as $type) { $required = array('Contact', $type); $subTypeProfiles = CRM_Core_BAO_UFGroup::getValidProfiles($required, $optional); foreach ($subTypeProfiles as $profileId => $profileName) { $profiles[$profileId] = $profileName; } } $requiredProfileFields = array('organization_name', 'email'); if (!empty($profiles)) { foreach ($profiles as $id => $dontCare) { $validProfile = CRM_Core_BAO_UFGroup::checkValidProfile($id, $requiredProfileFields); if (!$validProfile) { unset($profiles[$id]); } } } if (empty($profiles)) { $invalidProfiles = TRUE; $this->assign('invalidProfiles', $invalidProfiles); } $this->add('select', 'onbehalf_profile_id', ts('Organization Profile'), array('' => ts('- select -')) + $profiles); $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', ts('')); $this->add('textarea', 'for_organization', ts('On behalf of Label'), $attributes['for_organization']); // 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'), $attributes['honor_block_title']); $this->add('textarea', 'honor_block_text', ts('Honoree Introductory Message'), $attributes['honor_block_text']); // 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')); parent::buildQuickForm(); }
/** * Function to actually build the form * * @return void * @access public */ function buildQuickForm() { $this->assign('showForm', false); $this->addElement('checkbox', 'premiums_active', ts('Premiums Section Enabled?')); $this->addElement('text', 'premiums_intro_title', ts('Title'), CRM_Core_DAO::getAttribute('CRM_Contribute_DAO_Premium', 'premiums_intro_title')); //$this->addRule('premiums_intro_title',ts('Plese Eneter the Title'),'required'); // intro_text $this->add('textarea', 'premiums_intro_text', ts('Introductory Message'), 'rows=5, cols=50'); $this->add('text', 'premiums_contact_email', ts('Contact Email') . ' ', CRM_Core_DAO::getAttribute('CRM_Contribute_DAO_Premium', 'premiums_contact_email')); $this->addRule('premiums_contact_email', ts('Please enter valid email address for Contact Email') . ' ', 'email'); $this->add('text', 'premiums_contact_phone', ts('Contact Phone'), CRM_Core_DAO::getAttribute('CRM_Contribute_DAO_Premium', 'premiums_contact_phone')); $this->addRule('premiums_contact_phone', ts('Please enter valid phone'), 'phone'); $this->addElement('checkbox', 'premiums_display_min_contribution', ts('Display Minimum Contribution Amount?')); $session =& CRM_Core_Session::singleton(); $single = $session->get('singleForm'); if ($single) { $this->addButtons(array(array('type' => 'next', 'name' => ts('Save'), 'spacing' => ' ', 'isDefault' => true), array('type' => 'cancel', 'name' => ts('Cancel')))); } else { $this->assign('showForm', true); parent::buildQuickForm(); } //$session->set('single', false ); }
/** * Function to actually build the form * * @return void * @access public */ 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.')); 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('Weight'), CRM_Core_DAO::getAttribute('CRM_Contribute_DAO_PremiumsProduct', 'weight')); $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(); } }
/** * Build the form object. * * @return void */ public function buildQuickForm() { $membershipTypes = CRM_Member_BAO_MembershipType::getMembershipTypes(); if (!empty($membershipTypes)) { $this->addElement('checkbox', 'member_is_active', ts('Membership Section Enabled?')); $this->addElement('text', 'new_title', ts('Title - New Membership'), CRM_Core_DAO::getAttribute('CRM_Member_DAO_MembershipBlock', 'new_title')); $this->add('wysiwyg', 'new_text', ts('Introductory Message - New Memberships'), CRM_Core_DAO::getAttribute('CRM_Member_DAO_MembershipBlock', 'new_text')); $this->addElement('text', 'renewal_title', ts('Title - Renewals'), CRM_Core_DAO::getAttribute('CRM_Member_DAO_MembershipBlock', 'renewal_title')); $this->add('wysiwyg', 'renewal_text', ts('Introductory Message - Renewals'), CRM_Core_DAO::getAttribute('CRM_Member_DAO_MembershipBlock', 'renewal_text')); $this->addElement('checkbox', 'is_required', ts('Require Membership Signup')); $this->addElement('checkbox', 'display_min_fee', ts('Display Membership Fee')); $this->addElement('checkbox', 'is_separate_payment', ts('Separate Membership Payment')); $this->addElement('text', 'membership_type_label', ts('Membership Types Label'), array('placeholder' => ts('Membership'))); $paymentProcessor = CRM_Core_PseudoConstant::paymentProcessor(FALSE, FALSE, 'is_recur = 1'); $paymentProcessorIds = CRM_Core_DAO::getFieldValue('CRM_Contribute_DAO_ContributionPage', $this->_id, 'payment_processor'); $paymentProcessorId = explode(CRM_Core_DAO::VALUE_SEPARATOR, $paymentProcessorIds); $isRecur = TRUE; foreach ($paymentProcessorId as $dontCare => $id) { if (!array_key_exists($id, $paymentProcessor)) { $isRecur = FALSE; continue; } } $membership = $membershipDefault = $params = array(); foreach ($membershipTypes as $k => $v) { $membership[] = $this->createElement('advcheckbox', $k, NULL, $v); $membershipDefault[] = $this->createElement('radio', NULL, NULL, NULL, $k); $membershipRequired[$k] = NULL; if ($isRecur) { $autoRenew = CRM_Core_DAO::getFieldValue('CRM_Member_DAO_MembershipType', $k, 'auto_renew'); $membershipRequired[$k] = $autoRenew; $autoRenewOptions = array(); if ($autoRenew) { $autoRenewOptions = array(ts('Not offered'), ts('Give option'), ts('Required')); $this->addElement('select', "auto_renew_{$k}", ts('Auto-renew'), $autoRenewOptions); //CRM-15573 if ($autoRenew == 2) { $this->freeze("auto_renew_{$k}"); $params['id'] = CRM_Core_DAO::getFieldValue('CRM_Member_DAO_MembershipBlock', $this->_id, 'id', 'entity_id'); } $this->_renewOption[$k] = $autoRenew; } } } //CRM-15573 if (!empty($params['id'])) { $params['membership_types'] = serialize($membershipRequired); CRM_Member_BAO_MembershipBlock::create($params); } $this->add('hidden', "mem_price_field_id", '', array('id' => "mem_price_field_id")); $this->assign('is_recur', $isRecur); if (isset($this->_renewOption)) { $this->assign('auto_renew', $this->_renewOption); } $this->addGroup($membership, 'membership_type', ts('Membership Types')); $this->addGroup($membershipDefault, 'membership_type_default', ts('Membership Types Default'))->setAttribute('allowClear', TRUE); $this->addFormRule(array('CRM_Member_Form_MembershipBlock', 'formRule'), $this->_id); } $price = CRM_Price_BAO_PriceSet::getAssoc(FALSE, 'CiviMember'); if (CRM_Utils_System::isNull($price)) { $this->assign('price', FALSE); } else { $this->assign('price', TRUE); } $this->add('select', 'member_price_set_id', ts('Membership Price Set'), array('' => ts('- none -')) + $price); $session = CRM_Core_Session::singleton(); $single = $session->get('singleForm'); if ($single) { $this->addButtons(array(array('type' => 'next', 'name' => ts('Save'), 'spacing' => ' ', 'isDefault' => TRUE), array('type' => 'cancel', 'name' => ts('Cancel')))); } else { parent::buildQuickForm(); } }
/** * Function to actually build the form * * @return void * @access public */ public function buildQuickForm() { $this->addElement('checkbox', 'premiums_active', ts('Premiums Section Enabled?'), null, array('onclick' => "premiumBlock(this);")); $this->addElement('text', 'premiums_intro_title', ts('Title'), CRM_Core_DAO::getAttribute('CRM_Contribute_DAO_Premium', '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') . ' ', CRM_Core_DAO::getAttribute('CRM_Contribute_DAO_Premium', 'premiums_contact_email')); $this->addRule('premiums_contact_email', ts('Please enter a valid email address for Contact Email') . ' ', 'email'); $this->add('text', 'premiums_contact_phone', ts('Contact Phone'), CRM_Core_DAO::getAttribute('CRM_Contribute_DAO_Premium', '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?')); $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'; if ($daoPremium->find(true)) { $showForm = false; } } } $this->assign('showForm', $showForm); parent::buildQuickForm(); }
/** * Function to actually build the form * * @return void * @access public */ public function buildQuickForm() { require_once 'CRM/Utils/Money.php'; $this->_first = true; $attributes = CRM_Core_DAO::getAttribute('CRM_Contribute_DAO_ContributionPage'); // name $this->add('text', 'title', ts('Title'), $attributes['title'], true); $this->add('select', 'contribution_type_id', ts('Contribution Type'), CRM_Contribute_PseudoConstant::contributionType(), true); $this->addWysiwyg('intro_text', ts('Introductory Message'), $attributes['intro_text']); $this->addWysiwyg('footer_text', ts('Footer Message'), $attributes['footer_text']); // 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);")); $options = array(); $options[] = HTML_QuickForm::createElement('radio', null, null, ts('Optional'), 1); $options[] = HTML_QuickForm::createElement('radio', null, null, ts('Required'), 2); $this->addGroup($options, 'is_for_organization', ts('')); $this->add('textarea', 'for_organization', ts('On behalf of Label'), $attributes['for_organization']); // 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 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'), $attributes['honor_block_title']); $this->add('textarea', 'honor_block_text', ts('Honoree Introductory Message'), $attributes['honor_block_text']); // 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')); parent::buildQuickForm(); }
/** * Function to actually build the form * * @return void * @access public */ public function buildQuickForm() { require_once 'CRM/Member/BAO/MembershipType.php'; $membershipTypes = CRM_Member_BAO_MembershipType::getMembershipTypes(); if (!empty($membershipTypes)) { $this->addElement('checkbox', 'is_active', ts('Membership Section Enabled?'), null, array('onclick' => "memberBlock(this);")); $this->addElement('text', 'new_title', ts('Title - New Membership'), CRM_Core_DAO::getAttribute('CRM_Member_DAO_MembershipBlock', 'new_title')); $this->addWysiwyg('new_text', ts('Introductory Message - New Memberships'), CRM_Core_DAO::getAttribute('CRM_Member_DAO_MembershipBlock', 'new_text')); $this->addElement('text', 'renewal_title', ts('Title - Renewals'), CRM_Core_DAO::getAttribute('CRM_Member_DAO_MembershipBlock', 'renewal_title')); $this->addWysiwyg('renewal_text', ts('Introductory Message - Renewals'), CRM_Core_DAO::getAttribute('CRM_Member_DAO_MembershipBlock', 'renewal_text')); $this->addElement('checkbox', 'is_required', ts('Require Membership Signup')); $this->addElement('checkbox', 'display_min_fee', ts('Display Membership Fee')); $this->addElement('checkbox', 'is_separate_payment', ts('Separate Membership Payment')); $membership = array(); $membershipDefault = array(); foreach ($membershipTypes as $k => $v) { $membership[] = HTML_QuickForm::createElement('advcheckbox', $k, null, $v); $membershipDefault[] = HTML_QuickForm::createElement('radio', null, null, null, $k); } $this->addGroup($membership, 'membership_type', ts('Membership Types')); $this->addGroup($membershipDefault, 'membership_type_default', ts('Membership Types Default')); $this->addFormRule(array('CRM_Member_Form_MembershipBlock', 'formRule'), $this->_id); } $session =& CRM_Core_Session::singleton(); $single = $session->get('singleForm'); if ($single) { $this->addButtons(array(array('type' => 'next', 'name' => ts('Save'), 'spacing' => ' ', 'isDefault' => true), array('type' => 'cancel', 'name' => ts('Cancel')))); } else { parent::buildQuickForm(); } //$session->set('single', false ); }
/** * Function to actually build the form * * @return void * @access public */ public function buildQuickForm() { require_once 'CRM/Utils/Money.php'; // 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('onclick' => "minMax(this);showHideAmountBlock( this, 'is_allow_other_amount' );")); $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. %1).', array(1 => CRM_Utils_Money::format('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. %1).', array(1 => CRM_Utils_Money::format('99.99', ' '))), 'money'); $default = array(); for ($i = 1; $i <= self::NUM_OPTION; $i++) { // label $this->add('text', "label[{$i}]", ts('Label'), CRM_Core_DAO::getAttribute('CRM_Core_DAO_OptionValue', 'label')); // value $this->add('text', "value[{$i}]", ts('Value'), CRM_Core_DAO::getAttribute('CRM_Core_DAO_OptionValue', 'value')); $this->addRule("value[{$i}]", ts('Please enter a valid money value (e.g. %1).', array(1 => CRM_Utils_Money::format('99.99', ' '))), 'money'); // default $default[] = $this->createElement('radio', null, null, null, $i); } $this->addGroup($default, 'default'); $this->addElement('checkbox', 'amount_block_is_active', ts('Contribution Amounts section enabled'), null, array('onclick' => "showHideAmountBlock( this, 'amount_block_is_active' );")); $this->addElement('checkbox', 'is_monetary', ts('Execute real-time monetary transactions')); $paymentProcessor =& CRM_Core_PseudoConstant::paymentProcessor(); $recurringPaymentProcessor = array(); if (!empty($paymentProcessor)) { $paymentProcessorIds = implode(',', array_keys($paymentProcessor)); $query = "\nSELECT id\n FROM civicrm_payment_processor\n WHERE id IN ({$paymentProcessorIds})\n AND is_recur = 1"; $dao =& CRM_Core_DAO::executeQuery($query); while ($dao->fetch()) { $recurringPaymentProcessor[] = $dao->id; } } $this->assign('recurringPaymentProcessor', $recurringPaymentProcessor); if (count($paymentProcessor)) { $this->assign('paymentProcessor', $paymentProcessor); } $this->add('select', 'payment_processor_id', ts('Payment Processor'), array('' => ts('- select -')) + $paymentProcessor, null, array('onchange' => "showRecurring( this.value );")); require_once "CRM/Contribute/BAO/ContributionPage.php"; //check if selected payment processor supports recurring payment if (!empty($recurringPaymentProcessor)) { $this->addElement('checkbox', 'is_recur', ts('Recurring contributions'), null, array('onclick' => "showHideByValue('is_recur',true,'recurFields','table-row','radio',false); showRecurInterval( );")); require_once 'CRM/Core/OptionGroup.php'; $this->addCheckBox('recur_frequency_unit', ts('Supported recurring units'), CRM_Core_OptionGroup::values('recur_frequency_units', false, false, false, null, 'name'), null, null, null, null, array(' ', ' ', ' ', '<br/>')); $this->addElement('checkbox', 'is_recur_interval', ts('Support recurring intervals')); } // add pay later options $this->addElement('checkbox', 'is_pay_later', ts('Pay later option'), null, array('onclick' => "payLater(this);")); $this->addElement('textarea', 'pay_later_text', ts('Pay later label'), CRM_Core_DAO::getAttribute('CRM_Contribute_DAO_ContributionPage', 'pay_later_text'), false); $this->addElement('textarea', 'pay_later_receipt', ts('Pay later instructions'), CRM_Core_DAO::getAttribute('CRM_Contribute_DAO_ContributionPage', 'pay_later_receipt'), false); // add price set fields require_once 'CRM/Price/BAO/Set.php'; $price = CRM_Price_BAO_Set::getAssoc(false, 'CiviContribute'); if (CRM_Utils_System::isNull($price)) { $this->assign('price', false); } else { $this->assign('price', true); } $this->add('select', 'price_set_id', ts('Price Set'), array('' => ts('- none -')) + $price, null, array('onchange' => "showHideAmountBlock( this.value, 'price_set_id' );")); //CiviPledge fields. $config = CRM_Core_Config::singleton(); if (in_array('CiviPledge', $config->enableComponents)) { $this->assign('civiPledge', true); require_once 'CRM/Core/OptionGroup.php'; $this->addElement('checkbox', 'is_pledge_active', ts('Pledges'), null, array('onclick' => "showHideAmountBlock( this, 'is_pledge_active' ); return showHideByValue('is_pledge_active',true,'pledgeFields','table-row','radio',false);")); $this->addCheckBox('pledge_frequency_unit', ts('Supported pledge frequencies'), CRM_Core_OptionGroup::values("recur_frequency_units", false, false, false, null, 'name'), null, null, null, null, array(' ', ' ', ' ', '<br/>')); $this->addElement('checkbox', 'is_pledge_interval', ts('Allow frequency intervals')); $this->addElement('text', 'initial_reminder_day', ts('Send payment reminder'), array('size' => 3)); $this->addElement('text', 'max_reminders', ts('Send up to'), array('size' => 3)); $this->addElement('text', 'additional_reminder_day', ts('Send additional reminders'), array('size' => 3)); } //add currency element. $this->addCurrency('currency', ts('Currency')); $this->addFormRule(array('CRM_Contribute_Form_ContributionPage_Amount', 'formRule'), $this); parent::buildQuickForm(); }
/** * Function to build the form * * @return void * @access public */ public function buildQuickForm() { CRM_PCP_BAO_PCP::buildPCPForm($this); $this->addElement('checkbox', 'pcp_active', ts('Enable Personal Campaign Pages? (for this contribution page)'), NULL, array('onclick' => "return showHideByValue('pcp_active',true,'pcpFields','table-row','radio',false);")); parent::buildQuickForm(); $this->addFormRule(array('CRM_PCP_Form_Contribute', 'formRule'), $this); }