64 lines
2.5 KiB
PHP
Executable File
64 lines
2.5 KiB
PHP
Executable File
<?php
|
|
|
|
class UsereditForm extends Zend_Form
|
|
{
|
|
public function __construct($options = null)
|
|
{
|
|
parent::__construct($options);
|
|
$this->setName('UserEdit');
|
|
|
|
$oldpassword=new Zend_Form_Element_Password('oldpassword');
|
|
$oldpassword->setLabel('旧密码');
|
|
$password=new Zend_Form_Element_Password('password');
|
|
$password->setLabel('新密码')->addValidator('StringLength',false,array(6,20));
|
|
$password1=new Zend_Form_Element_Password('password1');
|
|
$password1->setLabel('确认新密码')
|
|
->addPrefixPath('Validator','validator/','validate')
|
|
->addValidator('Confirmation',false,array('password'));
|
|
|
|
$email=new Zend_Form_Element_Text('email');
|
|
$email->setLabel('E-Mail')
|
|
->addFilter('StringTrim')
|
|
->addValidator('NotEmpty')
|
|
->addValidator('EmailAddress');
|
|
|
|
$realname=new Zend_Form_Element_Text('realname');
|
|
$realname->setLabel('真实姓名')->setRequired(false);
|
|
|
|
$phone=new Zend_Form_Element_Text('phone');
|
|
$phone->setLabel('电话')->setRequired(false);
|
|
|
|
$unit=new Zend_Form_Element_Text('unit');
|
|
$unit->setLabel('单位')->setRequired(false);
|
|
$address=new Zend_Form_Element_Text('address');
|
|
$address->setLabel('联系地址')->setRequired(false);
|
|
$project=new Zend_Form_Element_Textarea('project');
|
|
$project->setLabel('隶属西部项目')->setRequired(false)->setAttrib('rows',4);
|
|
|
|
$id = new Zend_Form_Element_Hidden('id');
|
|
|
|
$submit = new Zend_Form_Element_Submit('submit');
|
|
$submit->setAttrib('id', 'submitbutton')->setLabel('保存');
|
|
|
|
$this->addElements(array($id, $oldpassword,$password,$password1,$email,$realname,$phone,$unit,$address,$project,$submit));
|
|
$this->clearDecorators();
|
|
$this->addDecorator('FormElements')
|
|
->addDecorator('HtmlTag', array('tag' => '<ul>','class'=>'commentform'))
|
|
->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')),
|
|
));
|
|
}
|
|
} |