diff --git a/application/default/controllers/DataController.php b/application/default/controllers/DataController.php index 8dfc3e66..989e35ee 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 1951caa7..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(); @@ -70,21 +91,21 @@ class ApplicantPDF extends FPDI $this->addPage(); $this->useTemplate($tplidx); $this->SetFont('ugb','B',14); - $this->setXY(46,43); + $this->setXY(46,51); $this->Write(10,$this->data['realname']); $this->SetFont('ugb','',12); $this->setXY(122,194); $this->Write(10,$this->data['realname']); $this->setXY(122,201); $this->Write($this->fontsize,$this->data['address']); - $this->setXY(122,209); + $this->setXY(122,208); $this->Write($this->fontsize,$this->data['phone']); - $this->setXY(122,216); + $this->setXY(122,215); $this->Write($this->fontsize,$this->data['email']); $t=date("Y-m-d"); - $this->setXY(32,246); + $this->setXY(32,242); $this->Write($this->fontsize,$t); - $this->setXY(122,246); + $this->setXY(122,242); $this->Write($this->fontsize,$t); } } diff --git a/data/offline.pdf b/data/offline.pdf index 5c10396b..d86dadb6 100644 Binary files a/data/offline.pdf and b/data/offline.pdf differ diff --git a/data/security.pdf b/data/security.pdf index ee2eca30..c7627ceb 100644 Binary files a/data/security.pdf and b/data/security.pdf differ