2009-03-06 03:20:46 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
class DatasetcdForm extends Zend_Form
|
|
|
|
{
|
|
|
|
public function __construct($options = null)
|
|
|
|
{
|
|
|
|
parent::__construct($options);
|
|
|
|
$this->setName('Datasetcd');
|
|
|
|
|
|
|
|
$title = new Zend_Form_Element_Text('title');
|
|
|
|
$title->setLabel('标题名')->setRequired(true)
|
|
|
|
->addFilter('StripTags') ->addFilter('StringTrim');
|
|
|
|
|
|
|
|
$size = new Zend_Form_Element_Text('size');
|
|
|
|
$size->setLabel('文件大小(M)')->setRequired(true)
|
|
|
|
->addFilter('Digits');
|
|
|
|
|
|
|
|
$url=new Zend_Form_Element_Text('url');
|
|
|
|
$url->setLabel('下载地址')
|
|
|
|
->setRequired(true)
|
|
|
|
->addFilter('StringTrim')
|
|
|
|
->addValidator('NotEmpty');
|
|
|
|
|
|
|
|
$img=new Zend_Form_Element_File('img');
|
|
|
|
$img->setLabel('上传缩略图')
|
|
|
|
//->setRequired(true)
|
|
|
|
->setDestination('images/datasetcd')
|
|
|
|
->addValidator('Count', false, 1) // ensure only 1 file
|
|
|
|
->addValidator('Size', false, 102400) // limit to 100K
|
|
|
|
->addValidator('Extension', false, 'jpg,png,gif'); // only JPEG, PNG, and GIFs
|
|
|
|
|
|
|
|
$document=new Zend_Form_Element_File('document');
|
|
|
|
$document->setLabel('数据文档')
|
|
|
|
//->setRequired(true)
|
|
|
|
->setDestination('images/datasetcd')
|
|
|
|
->addValidator('Count', false, 1) // ensure only 1 file
|
2009-04-30 06:38:51 +00:00
|
|
|
->addValidator('Size', false, 10240000) // limit to 10M
|
2009-03-06 03:20:46 +00:00
|
|
|
->addValidator('Extension', false, 'pdf,doc'); // only JPEG, PNG, and GIFs
|
|
|
|
|
|
|
|
|
|
|
|
$descript=new Zend_Form_Element_Textarea('descript');
|
|
|
|
$descript->setLabel('内容介绍')->setRequired(true)->setAttrib('rows',4);
|
|
|
|
|
|
|
|
$id = new Zend_Form_Element_Hidden('id');
|
|
|
|
|
|
|
|
$submit = new Zend_Form_Element_Submit('submit');
|
|
|
|
$submit->setAttrib('id', 'submitbutton')->setLabel('发送');
|
|
|
|
$this->setAttrib('enctype', 'multipart/form-data');
|
|
|
|
$this->addElements(array($id, $title,$size,$url,$img,$document,$descript,$submit));
|
|
|
|
}
|
|
|
|
}
|