/** * @param Customweb_IForm $form */ public function __construct(Customweb_IForm $form = null) { if ($form !== null) { $this->setButtons($form->getButtons())->setElementGroups($form->getElementGroups())->setId($form->getId())->setMachineName($form->getMachineName())->setRequestMethod($form->getRequestMethod())->setTargetUrl($form->getTargetUrl())->setTargetWindow($form->getTargetWindow())->setTitle($form->getTitle()); } else { $this->id = Customweb_Util_Rand::getUuid(); } }
public function renderForm(Customweb_IForm $form) { $output = '<form class="' . $this->getFormCssClass() . '" action="' . $form->getTargetUrl() . '" method="' . $form->getRequestMethod() . '" target="' . $form->getTargetWindow() . '" id="' . $form->getId() . '" name="' . $form->getMachineName() . '">'; $output .= $this->renderElementGroups($form->getElementGroups()); $token = $this->getFormToken($form); if ($token !== null) { $output .= '<input type="hidden" name="' . self::FORM_TOKEN_FIELD_NAME . '" value="' . $token . '" />'; } $output .= $this->renderButtons($form->getButtons()); $output .= '</form>'; if ($this->isAddJs()) { $output .= '<script type="text/javascript">' . "\n"; $output .= $this->renderElementsJavaScript($form->getElements()); $output .= "\n</script>"; } return $output; }
public function renderForm(Customweb_IForm $form) { $this->formId = $form->getId(); $output = '<div class="content-header"><table cellspacing="0"><tbody><tr><td><h3>' . $form->getTitle() . '</h3></td>'; $output .= '<td class="form-buttons">'; $output .= $this->renderButtons($form->getButtons()); $output .= '</td>'; $output .= '</tr></tbody></table></div>'; $output .= '<form class="' . $this->getFormCssClass() . '" action="' . $form->getTargetUrl() . '" method="' . $form->getRequestMethod() . '" target="' . $form->getTargetWindow() . '" id="' . $form->getId() . '" name="' . $form->getMachineName() . '">'; $output .= '<div class="entry-edit">'; $output .= $this->renderElementGroups($form->getElementGroups()); $output .= '</div>'; $output .= '<input type="hidden" name="form_key" value="' . Mage::getSingleton('core/session')->getFormKey() . '" />'; $output .= '<input type="hidden" name="button" id="' . $form->getId() . '-button" value="" />'; $output .= '</form>'; if ($this->isAddJs()) { $output .= '<script type="text/javascript">' . "\n"; $output .= '$$(\'.use-default-checkbox\').each(function(element){ toggleValueElements(element, Element.previous(element.parentNode)); });' . "\n"; $output .= $this->renderElementsJavaScript($form->getElements()); $output .= "\n</script>"; } return $output; }