From 92971d651f3703d971a02faaf157b1100df5add9 Mon Sep 17 00:00:00 2001 From: wlx Date: Tue, 2 Jul 2013 06:44:01 +0000 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E6=95=B0=E6=8D=AE=E5=BC=95?= =?UTF-8?q?=E7=94=A8=E4=BF=A1=E6=81=AF=E4=BB=A5=E5=8F=8A=E9=A1=B9=E7=9B=AE?= =?UTF-8?q?=E4=BF=A1=E6=81=AF=E7=9A=84=E6=94=AF=E6=8C=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../default/controllers/DataController.php | 12 ++++++- application/models/ApplicantPDF.php | 31 ++++++++++++++++--- 2 files changed, 37 insertions(+), 6 deletions(-) diff --git a/application/default/controllers/DataController.php b/application/default/controllers/DataController.php index 605b194b..08311df9 100755 --- a/application/default/controllers/DataController.php +++ b/application/default/controllers/DataController.php @@ -1540,7 +1540,17 @@ class DataController extends Zend_Controller_Action //生成PDF离线申请文件 //用户信息可以从SESSION中读取?离线申请信息 //$sql="select * from users where id=?"; - $sql="select m.title||'('||m.filesize::text||'MB)' as title,m.citation,m.suppinfo from dataorder d left join metadata m on d.uuid=m.uuid where d.status=2 and d.userid=? order by d.ts_created desc"; + $sql="select m.title||'('||m.filesize::text||'MB)' as title,m.ts_published,date_part('year',doi.ts_published) as publish_year,m.citation,m.suppinfo, +array_to_string(ARRAY( +select r.reference from mdref mr left join reference r on mr.refid=r.id +where mr.reftype=3 and mr.uuid=d.uuid order by mr.place),'\n'::text) as reference, +array_to_string(array( +select fund.fund_type||':'||fund.title||'(编号:'||fund.fund_id||')' +from fund left join mdfund on fund.id=mdfund.fid where mdfund.uuid=d.uuid),'\n'::text) as fund, +doi.doi as datadoi,doi.authors,doi.publisher,doi.title as doititle,doi.author_en,doi.publisher_en,doi.title_en +from dataorder d left join metadata m on d.uuid=m.uuid left join datadoi doi on doi.uuid=d.uuid +where d.status=2 and d.userid=? order by d.ts_created desc +"; $rows=$this->db->fetchAll($sql,array($userid)); if ($rows) { $this->view->data2=$rows; diff --git a/application/models/ApplicantPDF.php b/application/models/ApplicantPDF.php index 2fc1ed68..2ed0e0e4 100644 --- a/application/models/ApplicantPDF.php +++ b/application/models/ApplicantPDF.php @@ -49,15 +49,36 @@ class ApplicantPDF extends FPDI $this->SetFont('ugb','',12); $this->Write(5,($i+1).'. '.$md['title']); $this->ln(); - if ($md['citation']) - { - $this->Write(5,'【建议引用方式】'.$md['citation']); + if ($md['reference']) + { + $this->Write(5,'【引用方式】'.$md['reference']); $this->ln(); + if (!empty($md['publish_year'])) + { + $this->Write(5,'【数据的引用】'.substr($md['authors'],1,-1).'. '.$md['doititle'].'. '.$md['publisher'].', ' + .(empty($md['ts_published'])?$md['publish_year']:date('Y',strtotime($md['ts_published']))). + '. doi:'.$md['datadoi'].' ['.str_replace('"','',substr($md['author_en'],1,-1)).'. '.$md['title_en'] + .'. '.$md['publisher_en'].', '.(empty($md['ts_published'])?$md['publish_year']:date('Y',strtotime($md['ts_published']))).'. doi:'.$md['datadoi'].']'); + $this->ln(); + } + } elseif ($md['citation']) + { + $this->Write(5,'【引用方式】'.$md['citation']); + $this->ln(); + if (!empty($md['publish_year']) && !strpos($md['citation'],$md['datadoi'])) + { + $this->Write(5,'【数据的引用】'.substr($md['authors'],1,-1).'. '.$md['doititle'].'. '.$md['publisher'].', ' + .(empty($md['ts_published'])?$md['publish_year']:date('Y',strtotime($md['ts_published']))). + '. doi:'.$md['datadoi'].' ['.str_replace('"','',substr($md['author_en'],1,-1)).'. '.$md['title_en'] + .'. '.$md['publisher_en'].', '.(empty($md['ts_published'])?$md['publish_year']:date('Y',strtotime($md['ts_published']))).'. doi:'.$md['datadoi'].']'); + $this->ln(); + } } - if ($md['suppinfo']) + if ($md['suppinfo'] || $md['fund']) { $this->SetFont('ugb','I',10); - $this->Write(5,'【项目支持信息】'.$md['suppinfo']); + $p=(!empty($md['fund']))?$md['fund']:$md['suppinfo']; + $this->Write(5,'【项目信息】'.$p); $this->ln(); } $this->ln();