public function renderElementLabel(Customweb_Form_IElement $element)
 {
     $cssClasses = $this->getCssClassPrefix() . $this->getElementLabelCssClass();
     $for = '';
     if ($element->getControl() != null && $element->getControl()->getControlId() !== null && $element->getControl()->getControlId() != '') {
         $for = $element->getControl()->getControlId();
     }
     $label = $element->getLabel();
     if ($element->isRequired()) {
         $label .= $this->renderRequiredTag($element);
         $cssClasses .= ' required';
     }
     return $this->renderLabel($for, $label, $cssClasses);
 }
 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());
     }
 }
 /**
  * @param Customweb_Form_IElement $element
  * @return Customweb_Form_ElementGroup
  */
 public function removeElement(Customweb_Form_IElement $element)
 {
     if (isset($this->elements[$element->getElementId()])) {
         unset($this->elements[$element->getElementId()]);
     }
     return $this;
 }
Esempio n. 4
0
    /**
     * @param Customweb_Form_IElement $element
     * @return string
     */
    protected function renderElementScopeControl(Customweb_Form_IElement $element)
    {
        $scopeControlId = $element->getControl()->getControlId() . '-scope';
        $scopeControlName = implode('_', $element->getControl()->getControlNameAsArray());
        $output = '';
        $output .= '<div class="checkbox">';
        $output .= '<label for="' . $scopeControlId . '">';
        $output .= '<input type="checkbox" ' . ($element->isInherited() ? 'checked="checked"' : '') . ' 
			name="default[' . $scopeControlName . ']"
			id="' . $scopeControlId . '"
			value="default"
			' . ($this->isAddJs() ? 'onclick="scopeToggleElements(this)"' : '') . ' /> ';
        $output .= Customweb_I18n_Translation::__('Use Default');
        $output .= '</label>';
        $output .= '</div>';
        return $output;
    }
    /**
     * @param Customweb_Form_IElement $element
     * @return string
     */
    protected function renderElementScopeControl(Customweb_Form_IElement $element)
    {
        $scopeControlId = $element->getControl()->getControlId() . '-scope';
        $scopeControlName = implode('_', $element->getControl()->getControlNameAsArray());
        $output = '';
        $output .= '<input class="use-default-checkbox"
			type="checkbox" ' . ($element->isInherited() ? 'checked="checked"' : '') . '
			name="default[' . $scopeControlName . ']"
			id="' . $scopeControlId . '"
			value="default"
			' . ($this->isAddJs() ? 'onclick="toggleValueElements(this, Element.previous(this.parentNode))"' : '') . ' />';
        $output .= '<label for="' . $scopeControlId . '">' . Mage::helper('SaferpayCw')->__('Use Default') . '</label>';
        return $output;
    }
 public function useDefaultValue(Customweb_Form_IElement $element, array $formData)
 {
     $controlName = implode('_', $element->getControl()->getControlNameAsArray());
     return isset($formData['default'][$controlName]) && $formData['default'][$controlName] == 'default';
 }