westdc-zf1/application/models/DatasetcdForm.php

51 lines
1.9 KiB
PHP
Raw 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');
$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
->addValidator('Size', false, 1024000) // limit to 1M
->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));
}
}