/**
  * @param string $label
  *        	The label of the element
  * @param Customweb_Form_Control_IControl $control
  *        	The control of the element.
  * @param string $description
  *        	[optional] The description of the elment.
  * @param boolean $globalScope
  *        	[optional] Can the value be set per store?
  * @param boolean $inherited
  *        	[optional] Are values inherited?
  */
 public function __construct(Customweb_Form_Control_IControl $control, $description = '', $globalScope = true, $inherited = false)
 {
     $this->control = $control;
     $this->elementId = $control->getControlId() . '-element';
     $this->description = $description;
     $this->intention = Customweb_Form_Intention_Factory::getNullIntention();
     if (!$control instanceof Customweb_Form_Control_IEditableControl) {
         $this->globalScope = false;
     } else {
         $this->globalScope = (bool) $globalScope;
     }
     $this->inherited = (bool) $inherited;
 }
 /**
  * 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;
 }
 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());
 }
 /**
  * @param Customweb_Form_Control_IControl $control
  *        	The control of the element.
  */
 public function __construct(Customweb_Form_Control_IControl $control)
 {
     $this->control = $control;
     $this->elementId = $control->getControlId() . '-element';
     $this->intention = Customweb_Form_Intention_Factory::getNullIntention();
 }
 protected function buildBicElement()
 {
     if ($this->getBicFieldName() !== null) {
         if ($this->getBicOptionList() !== null) {
             $list = $this->getBicOptionList();
             asort($list);
             $this->bicControl = new Customweb_Form_Control_Select($this->getBicFieldName(), array_merge(array('none' => ' - ' . Customweb_I18n_Translation::__('Please select') . ' - '), $list));
             $description = Customweb_I18n_Translation::__('Please select the Bank Identifier Code (BIC) of your bank.');
         } else {
             $this->bicControl = new Customweb_Form_Control_TextInput($this->getBicFieldName());
             $description = Customweb_I18n_Translation::__('Please enter here the Bank Identifier Code (BIC).');
             $this->bicControl->setAutocomplete(false);
         }
         $this->bicControl->addValidator(new Customweb_Form_Validator_NotEmpty($this->bicControl, Customweb_I18n_Translation::__("You have to enter the BIC.")));
         $this->bicElement = new Customweb_Form_Element(Customweb_I18n_Translation::__('BIC'), $this->bicControl, $description);
         $this->bicElement->setElementIntention(Customweb_Form_Intention_Factory::getBankCodeIntention())->setErrorMessage($this->getBicErrorMessage());
     }
 }
Beispiel #6
0
 /**
  * This method returns the bank name element intention.
  *
  * @return Customweb_Form_Intention_Intention
  */
 public static function getBankNameIntention()
 {
     if (self::$bankName === null) {
         self::$bankName = new Customweb_Form_Intention_Intention('bank-name');
     }
     return self::$bankName;
 }
 /**
  * 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;
 }