Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- class Application_Form_Auth extends Zend_Form
- {
- public function init()
- { $this->setAttrib('enctype', 'multipart/form-data');
- $this->setMethod('post');
- $username = $this->createElement('text','username');
- $username->setLabel('Username:')
- ->setRequired(true);
- $username->setDecorators(array(
- 'ViewHelper',
- 'Description',
- 'Errors',
- array(array('data'=>'HtmlTag'), array('tag' => 'td')),
- array('Label', array('tag' => 'td')),
- array(array('row'=>'HtmlTag'),array('tag'=>'tr'))
- ));
- $password=$this->createElement('password','password');
- $password->setLabel('Password:')
- ->setRequired(true);
- $password->setDecorators(array(
- 'ViewHelper',
- 'Description',
- 'Errors',
- array(array('data'=>'HtmlTag'), array('tag' => 'td')),
- array('Label', array('tag' => 'td')),
- array(array('row'=>'HtmlTag'),array('tag'=>'tr'))
- ));
- $file = new Zend_Form_Element_File('file');
- $file->setLabel('Select File:')
- ->setDestination(BASE_PATH . '/data/uploads')
- ->setRequired(true);
- $file->setDecorators(array(
- 'file',
- 'Description',
- 'Errors',
- array(array('data'=>'HtmlTag'), array('tag' => 'td')),
- array('Label', array('tag' => 'td')),
- array(array('row'=>'HtmlTag'),array('tag'=>'tr'))
- ));
- $captcha = $this->createElement('captcha', 'captcha',
- array('required' => true,
- 'captcha' => array(
- 'captcha' => 'Image',
- 'font' => BASE_PATH .'/fonts/Average-Regular.ttf',
- 'fontSize' => '24',
- 'wordLen' => 5,
- 'height' => '75',
- 'width' => '200',
- 'imgDir'=> BASE_PATH.'/images/captcha',
- 'imgUrl'=>'../../images/captcha/',
- 'dotNoiseLevel' => 50,
- 'lineNoiseLevel' => 5)));
- $captcha->setLabel('Please type the words shown:');
- $captcha->setDecorators(array(
- 'captcha',
- 'Description',
- 'Errors',
- array(array('data'=>'HtmlTag'), array('tag' => 'td')),
- array('Label', array('tag' => 'td')),
- array(array('row'=>'HtmlTag'),array('tag'=>'tr'))
- ));
- $form = new ZendX_JQuery_Form();
- $date1 = new ZendX_JQuery_Form_Element_DatePicker(
- 'date1',
- array('label' => 'Date:')
- );
- $date1->setDecorators(array(
- 'UiWidgetElement',
- 'Description',
- 'Errors',
- array(array('data'=>'HtmlTag'), array('tag' => 'td')),
- array('Label', array('tag' => 'td')),
- array(array('row'=>'HtmlTag'),array('tag'=>'tr'))
- ));
- $reg=$this->createElement('submit','submit');
- $reg->setLabel('save');
- $reg->setDecorators(array(
- 'ViewHelper',
- 'Description',
- 'Errors', array(array('data'=>'HtmlTag'), array('tag' => 'td',
- 'colspan'=>'2','align'=>'center')),
- array(array('row'=>'HtmlTag'),array('tag'=>'tr'))
- ));
- $this->setDecorators(array(
- 'FormElements',
- array(array('data'=>'HtmlTag'),array('tag'=>'table')),
- 'Form'
- ));
- $this->addElements(array(
- $username,
- $password,
- $file,
- $captcha,
- $date1,
- $reg
- ));
- $this->addDisplayGroup(array('username', 'password','file','captcha','date1','submit'), 'login',array('legend' =>'Add User'));
- $login = $this->getDisplayGroup('login');
- $login->setDecorators(array(
- 'FormElements',
- 'Fieldset',
- array('HtmlTag',array('tag'=>'div','style'=>'width:70%;;float:left; padding-top:5px;'))
- ));
- return $this;
- }
- }
- ?>
- <?php
- echo $this->form->getDisplayGroup('login'); //This form aligned perfectly
- echo $this->form; //This won't
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement