更新数据引用信息以及项目信息的支持

This commit is contained in:
wlx 2013-07-02 06:44:01 +00:00
parent 36ab07c9ea
commit 92971d651f
2 changed files with 37 additions and 6 deletions

View File

@ -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;

View File

@ -49,15 +49,36 @@ class ApplicantPDF extends FPDI
$this->SetFont('ugb','',12);
$this->Write(5,($i+1).'. '.$md['title']);
$this->ln();
if ($md['citation'])
if ($md['reference'])
{
$this->Write(5,'【建议引用方式】'.$md['citation']);
$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();
}
if ($md['suppinfo'])
} 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'] || $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();