53 lines
1.8 KiB
PHP
53 lines
1.8 KiB
PHP
|
<?php
|
||
|
|
||
|
class ReplaceForm extends Zend_Form
|
||
|
{
|
||
|
public function __construct($options = null)
|
||
|
{
|
||
|
parent::__construct($options);
|
||
|
$this->setName('Replace');
|
||
|
|
||
|
$pattern = new Zend_Form_Element_Text('pattern');
|
||
|
$pattern->setLabel('正则表达式PATTERN')->setRequired(true)
|
||
|
->addFilter('StripTags') ->addFilter('StringTrim');
|
||
|
|
||
|
|
||
|
$replace=new Zend_Form_Element_Text('replace');
|
||
|
$replace->setLabel('替换表达式')
|
||
|
->setRequired(true)
|
||
|
->addFilter('StringTrim')
|
||
|
->addValidator('NotEmpty');
|
||
|
|
||
|
$source=new Zend_Form_Element_Textarea('source');
|
||
|
$source->setLabel('测试XML数据')->setRequired(true)->setAttrib('rows',10);
|
||
|
|
||
|
$test = new Zend_Form_Element_Submit('test');
|
||
|
$test->setLabel('测试');
|
||
|
|
||
|
$submit = new Zend_Form_Element_Submit('submit');
|
||
|
$submit->setLabel('全部运行!(危险,请先进行测试)');
|
||
|
|
||
|
$this->addElements(array($pattern,$replace,$source,$test,$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')),
|
||
|
));
|
||
|
*/
|
||
|
}
|
||
|
}
|