westdc-zf1/application/models/DatasetcdForm.php

51 lines
1.9 KiB
PHP
Raw Permalink Normal View History

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');
$uuid=new Zend_Form_Element_Text('uuid');
$uuid->setLabel('元数据UUID')
2009-03-06 03:20:46 +00:00
->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
->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,$uuid,$img,$document,$descript,$submit));
2009-03-06 03:20:46 +00:00
}
}