Example #1
0
 public function getForm()
 {
     $form = new Stuffpress_PageForm();
     // Add the form element details
     $form->setMethod('post');
     $form->setName("form_page");
     $form->setTemplate('lifestream.phtml');
     // Create and configure title element:
     $e = $form->createElement('text', 'title', array('label' => 'Title:', 'class' => 'width1', 'decorators' => array('ViewHelper', 'Errors')));
     $e->setRequired(true);
     $e->addValidator('stringLength', false, array(0, 32));
     $e->addFilter('StripTags');
     $e->addFilter('StripTags');
     $form->addElement($e);
     // Checkbox sources_filter
     $e = $form->createElement('hidden', 'sources_filter', array('label' => 'Sources filter:', 'decorators' => array('ViewHelper', 'Errors')));
     $form->addElement($e);
     // Sources
     $e = new Zend_Form_Element_MultiCheckbox('sources', array('label' => 'Sources:', 'multiOptions' => $this->getAvailableSources(), 'class' => 'checkbox', 'decorators' => array('ViewHelper', 'Errors')));
     $form->addElement($e);
     // Type
     $e = new Zend_Form_Element_MultiCheckbox('types', array('label' => 'Types:', 'multiOptions' => $this->getAvailableTypes(), 'class' => 'checkbox', 'decorators' => array('ViewHelper', 'Errors')));
     $form->addElement($e);
     // Add a hidden element with the page id
     $e = $form->createElement('hidden', 'id');
     $e->removeDecorator('HtmlTag');
     $form->addElement($e);
     // Add a hidden element with the  page type
     $e = $form->createElement('hidden', 'type');
     $e->setValue('lifestream');
     $e->removeDecorator('HtmlTag');
     $form->addElement($e);
     // Add a submit button
     $button = $form->createElement('submit', 'save', array('onClick' => 'onFormSubmit(); return false;', 'decorators' => array('ViewHelper')));
     $form->addElement($button);
     // Add a cancel button
     $element = $form->createElement('button', 'cancel', array('decorators' => array('ViewHelper')));
     $element->setAttrib('onClick', 'history.go(-1);return false;');
     $form->addElement($element);
     // Group elements
     $form->addDisplayGroup(array('save', 'cancel'), 'buttons', array('decorators' => $form->groupDecorators));
     return $form;
 }
Example #2
0
 public function getForm()
 {
     $form = new Stuffpress_PageForm();
     // Add the form element details
     $form->setMethod('post');
     $form->setName("form_page");
     $form->setTemplate('default.phtml');
     // Create and configure title element:
     $e = $form->createElement('text', 'title', array('label' => 'Title:', 'class' => 'width1', 'decorators' => $form->noDecorators));
     $e->addFilter('StripTags');
     $form->addElement($e);
     // Create and configure description element:
     $element = $form->createElement('textarea', 'description', array('label' => 'Description:', 'rows' => 15, 'cols' => 60, 'class' => 'mceEditor', 'decorators' => array('ViewHelper', 'Errors')));
     $form->addElement($element);
     // Add a hidden element with the page id
     $e = $form->createElement('hidden', 'id');
     $e->removeDecorator('HtmlTag');
     $form->addElement($e);
     // Add a hidden element with the  page type
     $e = $form->createElement('hidden', 'type');
     $e->setValue($this->_prefix);
     $e->removeDecorator('HtmlTag');
     $form->addElement($e);
     // Add a submit button
     $button = $form->createElement('submit', 'save', array('onClick' => 'onFormSubmit(); return false;', 'decorators' => $form->noDecorators));
     $form->addElement($button);
     // Add a cancel button
     $element = $form->createElement('button', 'cancel', array('decorators' => array('ViewHelper')));
     $element->setAttrib('onClick', 'history.go(-1);return false;');
     $form->addElement($element);
     // Group elements
     $form->addDisplayGroup(array('save', 'cancel'), 'buttons', array('decorators' => $form->groupDecorators));
     return $form;
 }