2011-12-28 06:37:46 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
class LoginForm extends Zend_Form
|
|
|
|
{
|
|
|
|
public function __construct($options = null)
|
|
|
|
{
|
|
|
|
parent::__construct($options);
|
|
|
|
$this->setName('login');
|
|
|
|
|
|
|
|
$username = new Zend_Form_Element_Text('username');
|
|
|
|
$username->setLabel('用户名')
|
|
|
|
->setRequired(true)
|
|
|
|
->addFilter('StripTags')
|
|
|
|
->addFilter('StringTrim')
|
|
|
|
->addValidator('NotEmpty');
|
|
|
|
|
|
|
|
$password=new Zend_Form_Element_Password('password');
|
|
|
|
$password->setLabel('密码')->setRequired(true);
|
|
|
|
|
|
|
|
$remember=new Zend_Form_Element_Checkbox('remember');
|
|
|
|
$remember->setLabel('记住我');
|
|
|
|
|
|
|
|
$id = new Zend_Form_Element_Hidden('id');
|
|
|
|
|
|
|
|
$submit = new Zend_Form_Element_Submit('submit');
|
|
|
|
$submit->setLabel('登录');
|
|
|
|
$submit->setAttrib('id', 'submitbutton');
|
|
|
|
|
|
|
|
$this->addElements(array($id, $username, $password, $remember));
|
|
|
|
$this->clearDecorators();
|
|
|
|
$this->addDecorator('FormElements')
|
|
|
|
->addDecorator('HtmlTag', array('tag' => '<ul>','class'=>'loginform'))
|
|
|
|
->addDecorator('Form');
|
|
|
|
|
|
|
|
/*
|
|
|
|
$this->setElementDecorators(array(
|
|
|
|
array('ViewHelper'),
|
|
|
|
array('Errors'),
|
|
|
|
array('Description'),
|
|
|
|
array('Label', array('separator'=>' ')),
|
|
|
|
array('HtmlTag', array('tag' => 'li', 'class'=>'element-group')),
|
|
|
|
));
|
|
|
|
*/
|
|
|
|
|
|
|
|
$captcha = $this->addElement('captcha', 'captcha', array(
|
|
|
|
'captcha' => array(
|
|
|
|
// First the type...
|
|
|
|
'captcha' => 'Image',
|
|
|
|
// Length of the word...
|
2012-01-13 07:01:45 +00:00
|
|
|
'wordLen' => 4,
|
2011-12-28 06:37:46 +00:00
|
|
|
'fontsize'=>16,
|
|
|
|
'width' => 100,
|
|
|
|
'height' => 38,
|
|
|
|
'dotNoiseLevel'=>2,
|
2012-01-15 02:30:04 +00:00
|
|
|
'lineNoiseLevel'=>1,
|
2011-12-28 06:37:46 +00:00
|
|
|
// Captcha timeout, 5 mins
|
|
|
|
'timeout' => 300,
|
|
|
|
// What font to use...
|
|
|
|
'font' => '../data/fonts/ggbi.ttf',
|
|
|
|
// Where to put the image
|
|
|
|
'imgDir' => 'vdimg/',
|
|
|
|
// URL to the images
|
|
|
|
// This was bogus, here's how it should be... Sorry again :S
|
|
|
|
'imgUrl' => '/vdimg',
|
|
|
|
),
|
|
|
|
'label' => '验证码'
|
|
|
|
));
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
|
|
|
// buttons do not need labels
|
|
|
|
$submit->setDecorators(array(
|
|
|
|
array('ViewHelper'),
|
|
|
|
array('Description'),
|
|
|
|
array('HtmlTag', array('tag' => 'li', 'class'=>'submit-group')),
|
|
|
|
));
|
|
|
|
*/
|
|
|
|
|
|
|
|
$this->addElements(array($submit));
|
|
|
|
|
|
|
|
}
|
2012-01-15 02:30:04 +00:00
|
|
|
}
|