79 lines
3.2 KiB
PHP
Executable File
79 lines
3.2 KiB
PHP
Executable File
<?php
|
|
|
|
class RegisterForm extends Zend_Form
|
|
{
|
|
public function __construct($options = null)
|
|
{
|
|
parent::__construct($options);
|
|
$this->setName('Register');
|
|
|
|
$username = new Zend_Form_Element_Text('username');
|
|
$username->setLabel('Username')->setRequired(true)
|
|
->addFilter('StripTags') ->addFilter('StringTrim')
|
|
->addValidator('StringLength',false,array(3,50))
|
|
->addPrefixPath('Validator','validator/','validate')
|
|
->addValidator('NotInTable',false,array('username'));
|
|
|
|
$password=new Zend_Form_Element_Password('password');
|
|
$password->setLabel('Password')
|
|
->setRequired(true)
|
|
->setDescription('Length in 6-20 chars')
|
|
->addValidator('StringLength',false,array(6,20));
|
|
$password_confirm=new Zend_Form_Element_Password('password_confirm');
|
|
$password_confirm->setLabel('Confirm password')->addPrefixPath('Validator','validator/','validate')
|
|
->setRequired(true)->addValidator('Confirmation',false,array('password'));
|
|
|
|
$email=new Zend_Form_Element_Text('email');
|
|
$email->setLabel('E-Mail')
|
|
->setRequired(true)
|
|
->addFilter('StringTrim')
|
|
->addValidator('NotEmpty')
|
|
->addValidator('EmailAddress');
|
|
$email_repeat=new Zend_Form_Element_Text('email_repeat');
|
|
$email_repeat->setLabel('Confirm E-Mail')
|
|
->setRequired(true)
|
|
->addPrefixPath('Validator','validator/','validate')
|
|
->addValidator('NotInTable',false,array('email'))
|
|
->addValidator('Confirmation',false,array('email'));
|
|
|
|
|
|
$realname=new Zend_Form_Element_Text('realname');
|
|
$realname->setLabel('Real name')->setRequired(false);
|
|
|
|
$phone=new Zend_Form_Element_Text('phone');
|
|
$phone->setLabel('Phone')->setRequired(false);
|
|
|
|
$unit=new Zend_Form_Element_Text('unit');
|
|
$unit->setLabel('Organization')->setRequired(false);
|
|
$address=new Zend_Form_Element_Text('address');
|
|
$address->setLabel('Address')->setRequired(false);
|
|
$project=new Zend_Form_Element_Textarea('project');
|
|
$project->setLabel('Fund')->setRequired(false)->setAttrib('rows',4);
|
|
|
|
$id = new Zend_Form_Element_Hidden('id');
|
|
|
|
$submit = new Zend_Form_Element_Submit('Register');
|
|
$submit->setAttrib('id', 'submitbutton');
|
|
|
|
$this->addElements(array($id, $username,$password,$password_confirm,$email,$email_repeat,$realname,$phone,$unit,$address,$project,$submit));
|
|
$this->clearDecorators();
|
|
$this->addDecorator('FormElements')
|
|
->addDecorator('HtmlTag', array('tag' => '<ul>','class'=>'registerform'))
|
|
->addDecorator('Form');
|
|
|
|
$this->setElementDecorators(array(
|
|
array('ViewHelper'),
|
|
array('Errors'),
|
|
array('Description'),
|
|
array('Label', array('separator'=>' ')),
|
|
array('HtmlTag', array('tag' => 'li', 'class'=>'element-group')),
|
|
));
|
|
|
|
// buttons do not need labels
|
|
$submit->setDecorators(array(
|
|
array('ViewHelper'),
|
|
array('Description'),
|
|
array('HtmlTag', array('tag' => 'li', 'class'=>'submit-group')),
|
|
));
|
|
}
|
|
} |