Ejemplo n.º 1
0
 public function __construct($options = null)
 {
     parent::__construct($options);
     $this->setMethod('post');
     $this->addElements(array('username' => new Zend_Form_Element_Text(array('name' => 'username', 'required' => true, 'filters' => array('StringTrim'), 'label' => 'User name or email:')), 'password' => new Zend_Form_Element_Password(array('name' => 'password', 'required' => true, 'label' => 'Password')), 'remember' => new Zend_Form_Element_Checkbox(array('name' => 'remember_me', 'description' => 'Keep me logged-in on this computer')), 'submit' => new Zend_Form_Element_Submit(array('name' => 'submit', 'label' => 'Log In', 'class' => 'button-big'))));
     $this->remember->getDecorator('Description')->setOptions(array('tag' => 'span', 'class' => 'checkbox-desc'));
 }
Ejemplo n.º 2
0
 public function __construct($options = null)
 {
     parent::__construct($options);
     $this->addElementPrefixPath('Geves_Validate', 'Geves/Validate/', 'validate');
     $this->setMethod('post');
     $author = new Zend_Form_Element_Text(array('name' => 'author', 'required' => true, 'filters' => array('StringTrim'), 'validators' => array('length' => array('validator' => 'StringLength', 'options' => array('min' => 4, 'max' => 200)), 'content' => array('validator' => 'Regex', 'options' => array('pattern' => '/^[^\\p{C}]+$/u'))), 'label' => 'Your name'));
     $email = new Zend_Form_Element_Text(array('name' => 'author_email', 'required' => true, 'filters' => array('StringTrim'), 'validators' => array('email' => array('validator' => 'EmailAddress')), 'label' => 'Your e-mail address', 'description' => 'will not be viewed or shared'));
     $website = new Zend_Form_Element_Text(array('name' => 'author_url', 'required' => false, 'filters' => array('StringTrim'), 'validators' => array('url' => array('validator' => 'Url')), 'label' => 'Your web site', 'description' => 'we will link to this address, if you provide one'));
     $text = new Zend_Form_Element_Textarea(array('name' => 'content', 'required' => true, 'filters' => array('StringTrim'), 'validators' => array('length' => array('validator' => 'StringLength', 'options' => array('min' => 10, 'messages' => array(Zend_Validate_StringLength::TOO_SHORT => 'Comment is too short - we expect 10 characters at least'))), 'content' => array('validator' => 'Regex', 'options' => array('pattern' => '/^(?:[^\\p{C}]|\\s)+$/u'))), 'label' => 'Comment', 'rows' => 8));
     $submit = new Zend_Form_Element_Submit(array('name' => 'submit', 'label' => 'Post Comment', 'class' => 'button-big'));
     $this->addElement($author)->addElement($email)->addElement($website)->addElement($text)->addElement($submit);
 }
Ejemplo n.º 3
0
 public function __construct($options = null)
 {
     parent::__construct($options);
     $this->setMethod('post');
     $title = new Zend_Form_Element_Text(array('name' => 'title', 'required' => true, 'filters' => array('StringTrim'), 'validators' => array('length' => array('validator' => 'StringLength', 'options' => array('min' => 4, 'max' => 200)), 'content' => array('validator' => 'Regex', 'options' => array('pattern' => '/^[^\\p{C}]+$/u'))), 'label' => 'Post Title'));
     $tags = new Zend_Form_Element_Text(array('name' => 'tags', 'required' => false, 'filters' => array('StringTrim'), 'validators' => array('content' => array('validator' => 'Regex', 'options' => array('pattern' => '/^[\\p{L}\\p{M}\\p{N}_\\-, ]+$/u'))), 'label' => 'Tags', 'description' => 'Comma separated list of tags for this post', 'size' => 40));
     $location = new Zend_Form_Element_Text(array('name' => 'location', 'required' => false, 'filters' => array('StringTrim'), 'validators' => array('content' => array('validator' => 'Regex', 'options' => array('pattern' => '/^[\\p{L}\\p{M}\\p{N}_\\-,\\. ]+$/u'))), 'label' => 'Location', 'description' => 'Your current location', 'size' => 40));
     $text = new Zend_Form_Element_Textarea(array('name' => 'content', 'required' => true, 'filters' => array('StringTrim'), 'validators' => array('length' => array('validator' => 'StringLength', 'options' => array('min' => 10)), 'content' => array('validator' => 'Regex', 'options' => array('pattern' => '/^(?:[^\\p{C}]|\\s)+$/u'))), 'label' => 'Content'));
     $submit = new Zend_Form_Element_Submit(array('name' => 'submit', 'label' => 'Create Post', 'class' => 'button-big'));
     $title->getDecorator('Label')->setOption('class', 'input-big');
     $title->getDecorator('HtmlTag')->setOption('class', 'input-big');
     $this->addElement($title)->addElement($text)->addElement($tags)->addElement($location)->addElement($submit);
 }