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();