From f4d5eb973735be4e3dcf6e30934ee35331442158 Mon Sep 17 00:00:00 2001 From: Li Jianxuan Date: Mon, 11 Jun 2012 03:26:41 +0000 Subject: [PATCH] =?UTF-8?q?=E5=9C=A8=E7=A6=BB=E7=BA=BF=E7=94=B3=E8=AF=B7?= =?UTF-8?q?=E4=B8=AD=E6=B7=BB=E5=8A=A0=E4=BA=86=E9=A1=B9=E7=9B=AE=E4=BF=A1?= =?UTF-8?q?=E6=81=AF=E7=9A=84=E5=A1=AB=E5=86=99=E9=A1=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../default/controllers/DataController.php | 26 ++-- application/models/OfflinePdfForm.php | 129 ++++++++++-------- 2 files changed, 88 insertions(+), 67 deletions(-) diff --git a/application/default/controllers/DataController.php b/application/default/controllers/DataController.php index 04b38399..a0115584 100755 --- a/application/default/controllers/DataController.php +++ b/application/default/controllers/DataController.php @@ -985,10 +985,10 @@ class DataController extends Zend_Controller_Action $datas['address'] = $rows['address']; $datas['postcode'] = $rows['postcode']; $datas['email'] = $rows['email']; - $datas['project'] = $rows['project']; + $datas['project'] = $rows['project']; $datas['project_id'] = $rows['project_id']; - $datas['project_type'] = $rows['project_type']; - $datas['project_title'] = $rows['project_title']; + $datas['project_type'] = $rows['project_type']; + $datas['project_title'] = $rows['project_title']; echo $this->creatform($datas); exit(); @@ -1003,8 +1003,8 @@ class DataController extends Zend_Controller_Action $datas['email'] = $rows['email']; $datas['project'] = $rows['project']; $datas['project_id'] = $rows['project_id']; - $datas['project_type'] = $rows['project_type']; - $datas['project_title'] = $rows['project_title']; + $datas['project_type'] = $rows['project_type']; + $datas['project_title'] = $rows['project_title']; echo $this->creatform($datas); exit(); @@ -1255,11 +1255,11 @@ class DataController extends Zend_Controller_Action $sql="select id from offlineapp where userid=? and (pdflink is null or pdflink='') and (ts_approved is null)"; $row=$this->db->fetchRow($sql,array($userid)); if ($row) { - $sql="update offlineapp set username=?,email=?,phone=?,address=?,postcode=?,project=?,unit=?,datalist=?,ts_created=now() where id=?"; - $this->db->query($sql,array($formData['realname'],$formData['email'],$formData['phone'],$formData['address'],$formData['postcode'],$formData['project'],$formData['unit'],$datalist,$row['id'])); + $sql="update offlineapp set username=?,email=?,phone=?,address=?,postcode=?,project=?,unit=?,datalist=?,ts_created=now(),project_type=?,project_id=?,project_title=? where id=?"; + $this->db->query($sql,array($formData['realname'],$formData['email'],$formData['phone'],$formData['address'],$formData['postcode'],$formData['project'],$formData['unit'],$datalist,$formData['projecttype'],$formData['projectid'],$formData['projecttitle'],$row['id'])); } else { - $sql="insert into offlineapp (userid,username,email,phone,address,postcode,project,unit,datalist) values(?,?,?,?,?,?,?,?,?)"; - $this->db->query($sql,array($userid,$formData['realname'],$formData['email'],$formData['phone'],$formData['address'],$formData['postcode'],$formData['project'],$formData['unit'],$datalist)); + $sql="insert into offlineapp (userid,username,email,phone,address,postcode,project,unit,datalist,project_type,project_id,project_title) values(?,?,?,?,?,?,?,?,?,?,?,?)"; + $this->db->query($sql,array($userid,$formData['realname'],$formData['email'],$formData['phone'],$formData['address'],$formData['postcode'],$formData['project'],$formData['unit'],$datalist,$formData['projecttype'],$formData['projectid'],$formData['projecttitle'])); } $this->_helper->layout->disableLayout(); $this->_helper->viewRenderer->setNoRender(); @@ -1292,11 +1292,11 @@ class DataController extends Zend_Controller_Action $sql="select id from offlineapp where userid=? and pdflink is null and (ts_approved is null)"; $row=$this->db->fetchRow($sql,array($userid)); if ($row) { - $sql="update offlineapp set username=?,email=?,phone=?,address=?,postcode=?,project=?,unit=?,datalist=?,ts_created=now(),pdflink=? where id=?"; - $this->db->query($sql,array($formData['realname'],$formData['email'],$formData['phone'],$formData['address'],$formData['postcode'],$formData['project'],$formData['unit'],$datalist,$fn,$row['id'])); + $sql="update offlineapp set username=?,email=?,phone=?,address=?,postcode=?,project=?,unit=?,datalist=?,ts_created=now(),pdflink=?,project_type=?,project_id=?,project_title=? where id=?"; + $this->db->query($sql,array($formData['realname'],$formData['email'],$formData['phone'],$formData['address'],$formData['postcode'],$formData['project'],$formData['unit'],$datalist,$fn,$formData['projecttype'],$formData['projectid'],$formData['projecttitle'],$row['id'])); } else { - $sql="insert into offlineapp (userid,username,email,phone,address,postcode,project,unit,datalist,pdflink) values(?,?,?,?,?,?,?,?,?,?)"; - $this->db->query($sql,array($userid,$formData['realname'],$formData['email'],$formData['phone'],$formData['address'],$formData['postcode'],$formData['project'],$formData['unit'],$datalist,$fn)); + $sql="insert into offlineapp (userid,username,email,phone,address,postcode,project,unit,datalist,pdflink,project_type,project_id,project_title) values(?,?,?,?,?,?,?,?,?,?,?,?,?)"; + $this->db->query($sql,array($userid,$formData['realname'],$formData['email'],$formData['phone'],$formData['address'],$formData['postcode'],$formData['project'],$formData['unit'],$datalist,$fn,$formData['projecttype'],$formData['projectid'],$formData['projecttitle'])); $sql="select id from offlineapp where userid=? and pdflink=?"; $row=$this->db->fetchRow($sql,array($userid,$fn)); } diff --git a/application/models/OfflinePdfForm.php b/application/models/OfflinePdfForm.php index 7035a2a8..99522ddc 100644 --- a/application/models/OfflinePdfForm.php +++ b/application/models/OfflinePdfForm.php @@ -1,55 +1,76 @@ -setName('OfflinePdf'); - - - $email=new Zend_Form_Element_Text('email'); - $email->setLabel('E-Mail') - ->addFilter('StringTrim') - ->addValidator('NotEmpty') - ->setRequired(true) - ->addValidator('EmailAddress'); - - $realname=new Zend_Form_Element_Text('realname'); - $realname->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); - - $id = new Zend_Form_Element_Hidden('id'); - - $save = new Zend_Form_Element_Submit('save'); - $save->setAttrib('id', 'savebutton')->setLabel('保存并预览PDF'); - $submit = new Zend_Form_Element_Submit('submit'); - $submit->setAttrib('id', 'submitbutton')->setLabel('提交申请到数据中心'); - /*$submit->setDecorators(array( - 'ViewHelper', - 'Description', - 'Errors', - //array(array('elementDiv' => 'HtmlTag'), array('tag' => 'div')), - array(array('dl' => 'HtmlTag'), array('tag' => 'dl','class'=>'submit')) -)); - - $this->setDecorators(array( - 'FormElements', - array('HtmlTag', array('tag' => 'dl', 'class' => 'userform')), - array('Description', array('placement' => 'prepend')), - 'Form' - ));*/ - $this->addElements(array($realname,$email,$phone,$unit,$address,$postcode,$project,$id,$save,$submit)); - } +setName('OfflinePdf'); + + + $email=new Zend_Form_Element_Text('email'); + $email->setLabel('E-Mail') + ->addFilter('StringTrim') + ->addValidator('NotEmpty') + ->setRequired(true) + ->addValidator('EmailAddress'); + + $realname=new Zend_Form_Element_Text('realname'); + $realname->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_id=new Zend_Form_Element_Text('projectid'); + $project_id->setLabel('项目编号')->setRequired(true); + + $project_title=new Zend_Form_Element_Text('projecttitle'); + $project_title->setLabel('项目名称')->setRequired(true); + + $project_type=new Zend_Form_Element_Select('projecttype'); + $project_type->setLabel('项目类型')->setRequired(true); + $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("其他项目工程", "其他项目工程"); + + $project=new Zend_Form_Element_Textarea('project'); + $project->setLabel('用途(请详细描述使用目的)')->setRequired(true)->setAttrib('rows',2); + + $id = new Zend_Form_Element_Hidden('id'); + + $save = new Zend_Form_Element_Submit('save'); + $save->setAttrib('id', 'savebutton')->setLabel('保存并预览PDF'); + $submit = new Zend_Form_Element_Submit('submit'); + $submit->setAttrib('id', 'submitbutton')->setLabel('提交申请到数据中心'); + /*$submit->setDecorators(array( + 'ViewHelper', + 'Description', + 'Errors', + //array(array('elementDiv' => 'HtmlTag'), array('tag' => 'div')), + array(array('dl' => 'HtmlTag'), array('tag' => 'dl','class'=>'submit')) +)); + + $this->setDecorators(array( + 'FormElements', + array('HtmlTag', array('tag' => 'dl', 'class' => 'userform')), + array('Description', array('placement' => 'prepend')), + 'Form' + ));*/ + $this->addElements(array($realname,$email,$phone,$unit,$address,$postcode,$project_id,$project_title,$project_type,$project,$id,$save,$submit)); + } } \ No newline at end of file