diff --git a/application/config.ini b/application/config.ini index 747c4acd..1a8175a8 100755 --- a/application/config.ini +++ b/application/config.ini @@ -5,7 +5,7 @@ db.params.username = gis db.params.password = gispassword db.params.dbname = metadata -geonetwork.url=http://www.heihedata.org/geonetwork/ +geonetwork.url=http://test.heihedata.org/geonetwork/ geonetwork.adapter = PDO_PGSQL geonetwork.params.host = localhost geonetwork.params.username = gis @@ -53,7 +53,8 @@ ftp.user=newwestdc ftp.password=westdcforsmall download.max=5 //最多同时申请下载个数 page.max=10 //每页显示条目数 -offline.template=../data/offline.pdf +offline.template=../data/offline.pdf +offline.heihetemplate=../data/heihe.pdf offline.security=../data/security.pdf offline.water_template=../data/water_offline.pdf offline.font=../data/simhei.ttf diff --git a/application/default/controllers/AuthorController.php b/application/default/controllers/AuthorController.php index 71a63662..88e88dd3 100644 --- a/application/default/controllers/AuthorController.php +++ b/application/default/controllers/AuthorController.php @@ -2805,7 +2805,7 @@ class AuthorController extends Zend_Controller_Action $this->jsonexit($data); return true; } - + $author = new Author($this->db); if(!$author->checkAuthor($uuid)) { @@ -2828,7 +2828,7 @@ class AuthorController extends Zend_Controller_Action $sth = $this->db->prepare($sql); $sth->execute(array(trim($ref))); $row = $sth->fetch(); - } + } $sql="insert into mdref (uuid,refid,reftype) values(?,?,?)"; $sth = $this->db->prepare($sql); $ex=$sth->execute(array($uuid,$row['id'],$reftype)); diff --git a/application/default/controllers/DataController.php b/application/default/controllers/DataController.php index 08311df9..53934e97 100755 --- a/application/default/controllers/DataController.php +++ b/application/default/controllers/DataController.php @@ -1579,11 +1579,19 @@ where d.status=2 and d.userid=? order by d.ts_created desc $this->_helper->layout->disableLayout(); $this->_helper->viewRenderer->setNoRender(); //生成PDF + $sql="select m.title||'('||m.filesize::text||'MB)' as title from dataorder d right join heihemetadata m on d.uuid=m.uuid where d.status=2 and d.userid=?"; + $list=$this->db->fetchAll($sql,array($userid)); + foreach($list as $i=>$row) @$formData['heihelist'].=($i+1).". ".$row['title'].";"; + $sql="select m.title||'('||m.filesize::text||'MB)' as title from dataorder d right join normalmetadata m on d.uuid=m.uuid where d.uuid not in (select uuid from heihemetadata) and d.status=2 and d.userid=?"; + $list=$this->db->fetchAll($sql,array($userid)); + foreach($list as $i=>$row) @$formData['westdclist'].=($i+1).". ".$row['title'].";"; $pdf = new ApplicantPDF(); $pdf->template=$this->view->config->offline->template; + $pdf->heihetemplate=$this->view->config->offline->heihetemplate; $formData['project'].='['.$formData['project_title'].' | '.$formData['project_type'].' | '.$formData['project_id'].']'; $pdf->data = $formData; - $pdf->drawWestdc(); + if (isset($formData['westdclist'])) $pdf->drawWestdc(); + if (isset($formData['heihelist'])) $pdf->drawHeihe(); $pdf->addRef($rows); $pdf->addSecurity($this->view->config->offline->security); header("Content-Disposition: inline; filename=westdc-data-apply.pdf"); @@ -1595,11 +1603,19 @@ where d.status=2 and d.userid=? order by d.ts_created desc } elseif ($formData['submit']) { //提交 //生成PDF + $sql="select m.title||'('||m.filesize::text||'MB)' as title from dataorder d right join heihemetadata m on d.uuid=m.uuid where d.status=2 and d.userid=?"; + $list=$this->db->fetchAll($sql,array($userid)); + foreach($list as $i=>$row) @$formData['heihelist'].=($i+1).". ".$row['title'].";"; + $sql="select m.title||'('||m.filesize::text||'MB)' as title from dataorder d right join normalmetadata m on d.uuid=m.uuid where d.uuid not in (select uuid from heihemetadata) and d.status=2 and d.userid=?"; + $list=$this->db->fetchAll($sql,array($userid)); + foreach($list as $i=>$row) @$formData['westdclist'].=($i+1).". ".$row['title'].";"; $pdf = new ApplicantPDF(); $pdf->template=$this->view->config->offline->template; + $pdf->heihetemplate=$this->view->config->offline->heihetemplate; $pdf->data = $formData; $pdf->data['project'].='['.$formData['project_title'].' | '.$formData['project_type'].' | '.$formData['project_id'].']'; - $pdf->drawWestdc(); + if (isset($formData['westdclist'])) $pdf->drawWestdc(); + if (isset($formData['heihelist'])) $pdf->drawHeihe(); $pdf->addRef($rows); $pdf->addSecurity($this->view->config->offline->security); $fn=$formData['realname'].date('YmdHis').".pdf"; @@ -1638,7 +1654,7 @@ where d.status=2 and d.userid=? order by d.ts_created desc $this->_helper->viewRenderer('order'); //跳转到/data/order,并提示帮助信息,告知用户已经发送EMAIL - $this->view->msg=view::Msg('alert-success',"提示信息:您的离线申请已经提交,系统已经发送一封邮件给您,请打印出申请表、签字后拍照或扫描并email给数据中心服务组(仍然可以采用邮寄方式),具体信息请参考邮件说明。",0); + $this->view->msg=view::Msg('alert-success',"提示信息:您的离线申请已经提交,系统已经发送一封邮件给您,请打印出申请表、签字后扫描为pdf并email给数据中心服务组(仍可以采用邮寄方式),具体信息请参考邮件说明。",0); if (empty($ac)) $ac='offline3'; //$this->_redirect('/data/order'); } diff --git a/application/default/views/scripts/data/order.phtml b/application/default/views/scripts/data/order.phtml index 13348b6f..479be521 100644 --- a/application/default/views/scripts/data/order.phtml +++ b/application/default/views/scripts/data/order.phtml @@ -72,7 +72,7 @@ if ($this->tabID=='order-offline1') { echo ' 取消'; break; case 3: - echo "请打印签字然后扫描或拍照申请表并email或邮寄"; + echo "请打印签字扫描为pdf并email或邮寄"; break; default: break; @@ -80,7 +80,7 @@ if ($this->tabID=='order-offline1') { } elseif ($this->tabID=='order-offline3') { switch($order['status']) { case 3: - echo "请打印签字然后扫描或拍照申请表并email或邮寄"; + echo "请打印签字扫描为pdf并email或邮寄"; break; case 4: echo "已收到申请,请等待审批。日期:";echo date('Y-m-d',strtotime($order['ts_received'])); diff --git a/application/models/ApplicantPDF.php b/application/models/ApplicantPDF.php index 2ed0e0e4..b313847c 100644 --- a/application/models/ApplicantPDF.php +++ b/application/models/ApplicantPDF.php @@ -5,36 +5,70 @@ require_once('fpdi/fpdi.php'); class ApplicantPDF extends FPDI { public $template;//模板文件的路径 + public $heihetemplate;//模板文件的路径 public $data;//包含具体的数据,数组 public $fontsize=10; + function __construct() + { + parent::__construct(); + $this->AddUniGBhwFont('ugb','AdobeSongStd-Light-Acro'); + } function drawWestdc() { $pagecount = $this->setSourceFile($this->template); $tplidx = $this->importPage(1); $this->addPage(); - $this->useTemplate($tplidx); - $this->AddUniGBhwFont('ugb','AdobeSongStd-Light-Acro'); + $this->useTemplate($tplidx); $this->SetFont('ugb','',$this->fontsize); - $this->setXY(71,44); + $this->setXY(74,43); $this->Write($this->fontsize,$this->data['realname']); $this->SetXY(34,55); - $this->MultiCell (166, 4, str_replace(";","\n",$this->data['datalist'])); + $this->MultiCell (166, 4, str_replace(";","\n",$this->data['westdclist'])); $this->setXY(30,100); $this->MultiCell(166,4,trim($this->data['project'])); //$this->setXY(34,239); //$this->Write($this->fontsize,$this->data['realname']); - $this->setXY(32,225); + $this->setXY(32,223); $this->Write($this->fontsize,$this->data['unit']); - $this->setXY(112,225); + $this->setXY(112,223); $this->Write($this->fontsize,$this->data['email']); - $this->setXY(174,225); + $this->setXY(174,223); $this->Write($this->fontsize,$this->data['postcode']); - $this->setXY(32,231); + $this->setXY(32,230); $this->Write($this->fontsize,$this->data['address']); - $this->setXY(112,231); + $this->setXY(112,230); $this->Write($this->fontsize,$this->data['phone']); $t=date("Y-m-d"); - $this->setXY(174,231); + $this->setXY(174,230); + $this->Write($this->fontsize,$t); + } + function drawHeihe() + { + $pagecount = $this->setSourceFile($this->heihetemplate); + $tplidx = $this->importPage(1); + $this->addPage(); + $this->useTemplate($tplidx); + $this->SetFont('ugb','',$this->fontsize); + $this->setXY(88,43); + $this->Write($this->fontsize,$this->data['realname']); + $this->SetXY(34,55); + $this->MultiCell (166, 4, str_replace(";","\n",$this->data['heihelist'])); + $this->setXY(30,100); + $this->MultiCell(166,4,trim($this->data['project'])); + //$this->setXY(34,239); + //$this->Write($this->fontsize,$this->data['realname']); + $this->setXY(32,223); + $this->Write($this->fontsize,$this->data['unit']); + $this->setXY(112,223); + $this->Write($this->fontsize,$this->data['email']); + $this->setXY(174,223); + $this->Write($this->fontsize,$this->data['postcode']); + $this->setXY(32,230); + $this->Write($this->fontsize,$this->data['address']); + $this->setXY(112,230); + $this->Write($this->fontsize,$this->data['phone']); + $t=date("Y-m-d"); + $this->setXY(174,230); $this->Write($this->fontsize,$t); } function addRef($mds) diff --git a/data/heihe.pdf b/data/heihe.pdf new file mode 100644 index 00000000..168e0263 Binary files /dev/null and b/data/heihe.pdf differ diff --git a/data/offline.pdf b/data/offline.pdf index d86dadb6..251175a3 100644 Binary files a/data/offline.pdf and b/data/offline.pdf differ