westdc-zf1/application/models/OfflinelogForm.php

64 lines
3.3 KiB
PHP
Raw Normal View History

<?php
class OfflinelogForm extends Zend_Form
{
public function __construct($options = null)
{
parent::__construct($options);
$this->setName('OfflinePdf');
$email=new Zend_Form_Element_Text('email');
$email->setLabel('E-Mail')
->addFilter('StringTrim')
->addValidator('NotEmpty')
->addValidator('EmailAddress');
$username=new Zend_Form_Element_Text('username');
$username->setLabel('真实姓名')->setRequired(true);
$phone=new Zend_Form_Element_Text('phone');
$phone->setLabel('电话')->setRequired(true);
$unit=new Zend_Form_Element_Text('unit');
$unit->setLabel('单位')->setRequired(true);
$postcode=new Zend_Form_Element_Text('postcode');
$postcode->setLabel('邮编')->setRequired(true);
$address=new Zend_Form_Element_Text('address');
$address->setLabel('联系地址')->setRequired(true);
$project=new Zend_Form_Element_Textarea('project');
$project->setLabel('用途')->setRequired(true)->setAttrib('rows',2);
$project_id=new Zend_Form_Element_Text('project_id');
$project_id->setLabel('项目编号');
$project_title=new Zend_Form_Element_Text('project_title');
$project_title->setLabel('项目名称');
$project_type=new Zend_Form_Element_Select('project_type');
$project_type->setLabel('项目类型');
$project_type->addMultiOption('','请选择项目类型');
$project_type->addMultiOption('国家973计划项目课题','国家973计划项目课题');
$project_type->addMultiOption('国家863计划课题','国家863计划课题');
$project_type->addMultiOption('国家级科技支撑课题','国家级科技支撑课题');
$project_type->addMultiOption('国家级科技重大专项','国家级科技重大专项');
$project_type->addMultiOption('国家级国家重大工程','国家级国家重大工程');
$project_type->addMultiOption('国家级国家自然科学基金','国家级国家自然科学基金');
$project_type->addMultiOption('国际合作项目','国际合作项目');
$project_type->addMultiOption('省部级项目','省部级项目');
$project_type->addMultiOption('其他项目工程','其他项目工程');
$datalist=new Zend_Form_Element_Textarea('datalist');
$datalist->setLabel('数据清单')->setRequired(true)->setAttrib('rows',2);
$pdf=new Zend_Form_Element_File('pdf');
$pdf->setLabel('离线服务记录PDF')
->setRequired(true)
//->setDestination('../data/offlineapp')
->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
$ts_approved=new Zend_Form_Element_Text('ts_approved');
$ts_approved->setLabel('申请时间(格式2008-12-20)')->setRequired(true);
$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($username,$email,$phone,$unit,$address,$postcode,$pdf,$ts_approved,$project_id,$project_title,$project_type,$project,$datalist,$id,$submit));
}
}