/** * This method creates an element to select the date of birth * @param string $fieldName The field name of the date of birth element */ public static function getDateOfBirthElement($dayFieldName, $monthFieldName, $yearFieldName, $defaultDay = '', $defaultMonth = '', $defaultYear = '') { $days = array('none' => Customweb_I18n_Translation::__('Day'), '01' => '01', '02' => '02', '03' => '03', '04' => '04', '05' => '05', '06' => '06', '07' => '07', '08' => '08', '09' => '09', '10' => '10', '11' => '11', '12' => '12', '13' => '13', '14' => '14', '15' => '15', '16' => '16', '17' => '17', '18' => '18', '19' => '19', '20' => '20', '21' => '21', '22' => '22', '23' => '23', '24' => '24', '25' => '25', '26' => '26', '27' => '27', '28' => '28', '29' => '29', '30' => '30', '31' => '31'); $months = array('none' => Customweb_I18n_Translation::__('Month'), '01' => '01', '02' => '02', '03' => '03', '04' => '04', '05' => '05', '06' => '06', '07' => '07', '08' => '08', '09' => '09', '10' => '10', '11' => '11', '12' => '12'); $years = array('none' => Customweb_I18n_Translation::__('Year')); $current = intval(date('Y')); for ($i = 0; $i < 130; $i++) { $years[$current] = $current; $current--; } $dayControl = new Customweb_Form_Control_Select($dayFieldName, $days, $defaultDay); $dayControl->addValidator(new Customweb_Form_Validator_NotEmpty($dayControl, Customweb_I18n_Translation::__("Please select the day on which you were born."))); $monthControl = new Customweb_Form_Control_Select($monthFieldName, $months, $defaultMonth); $monthControl->addValidator(new Customweb_Form_Validator_NotEmpty($monthControl, Customweb_I18n_Translation::__("Please select the month in which you were born."))); $yearControl = new Customweb_Form_Control_Select($yearFieldName, $years, $defaultYear); $yearControl->addValidator(new Customweb_Form_Validator_NotEmpty($yearControl, Customweb_I18n_Translation::__("Please select the year in which you were born."))); $yearControl->addValidator(new Customweb_Saferpay_Method_ValidateDateOfBirth($yearControl, 'dob-day', 'dob-month', 'dob-year')); $control = new Customweb_Form_Control_MultiControl('dayOfBirth', array($dayControl, $monthControl, $yearControl)); $element = new Customweb_Form_Element(Customweb_I18n_Translation::__('Date of birth'), $control, Customweb_I18n_Translation::__('Select your date of birth.')); $element->setElementIntention(Customweb_Form_Intention_Factory::getDateOfBirthIntention()); return $element; }
/** * This method creates a general terms and conditions element. * * @param string $fieldName The field name of the account number element * @return Customweb_Form_IElement */ protected function getGeneralTermsElement($fieldName) { $content = Customweb_I18n_Translation::__("I agree that my personal data are transmitted to\n\t\t\t<a href='https://billpay.de/endkunden' target='blank'> Billpay GmbH</a> in order to perfrom \n\t\t\tan idenity and solvency check. Billpay's <a href=\"!link\">Privacy Policy</a> applies.", array('!link' => $this->getGeneralTermsLink())); $terms = new Customweb_Form_Control_Html('generalTermsText', $content); $checkbox = new Customweb_Form_Control_SingleCheckbox($fieldName, 'accepted', Customweb_I18n_Translation::__('I agree.')); $checkbox->addValidator(new Customweb_Form_Validator_NotEmpty($checkbox, Customweb_I18n_Translation::__("You have to agree to the general terms."))); $control = new Customweb_Form_Control_MultiControl('generalTermsController', array($terms, $checkbox)); $element = new Customweb_Form_Element(Customweb_I18n_Translation::__('Billpay General Terms'), $control, Customweb_I18n_Translation::__('By continuing the checkout you agree to the general terms of this agreement.')); $element->setElementIntention($this->getGeneralTermsIntention()); return $element; }
protected function buildSingleExpiryElement() { $this->createExpiryMonthControl(); $this->createExpiryYearControl(); $this->expiryMonthControl->setCssClass("hidden-control"); $this->expiryYearControl->setCssClass("hidden-control"); $month = $this->getSelectedExpiryMonth(); $year = $this->getSelectedExpiryYear(); $defaultValue = ''; if ($month !== null && $year !== null) { $defaultValue = str_replace('YY', $year, $this->getExpiryFieldFormat()); $defaultValue = str_replace('MM', $month, $defaultValue); } $this->expiryControl = new Customweb_Form_Control_TextInput($this->getExpiryFieldName(), $defaultValue); $control = new Customweb_Form_Control_MultiControl('expiration', array($this->expiryControl, $this->expiryMonthControl, $this->expiryYearControl)); $this->expiryElement = new Customweb_Form_Element(Customweb_I18n_Translation::__('Card Expiration'), $control, Customweb_I18n_Translation::__('Enter the date on which your card expires.') . Customweb_I18n_Translation::__(" <span class='card-expiry-format-note'>The expected format is '!format' where the 'MM' means the month number and 'YY' the year number.</span>", array('!format' => $this->getExpiryFieldFormat()))); $this->expiryElement->setElementIntention(Customweb_Form_Intention_Factory::getExpirationDateIntention())->setErrorMessage($this->getExpiryElementErrorMessage()); }
/** * Create an element for the bank's location. * * @param string $fieldName * @param string $errorMessage * @return Customweb_Form_Element */ public static function getBankLocationElement($fieldName, $errorMessage = null) { $control = new Customweb_Form_Control_TextInput($fieldName); $control->addValidator(new Customweb_Form_Validator_NotEmpty($control, Customweb_I18n_Translation::__("You have to enter the location of your bank."))); $control->setAutocomplete(false); $element = new Customweb_Form_Element(Customweb_I18n_Translation::__('Bank Location'), $control, Customweb_I18n_Translation::__('Please enter the location of your bank.')); $element->setElementIntention(Customweb_Form_Intention_Factory::getBankLocationIntention())->setErrorMessage($errorMessage); return $element; }