odtAction中修改引用方式支持以及项目支持

This commit is contained in:
wlx 2013-06-18 00:18:57 +00:00
parent f865c0289e
commit b626bfc7b8
1 changed files with 46 additions and 4 deletions

View File

@ -465,10 +465,12 @@ class ServiceController extends Zend_Controller_Action
if (!empty($uuid)) if (!empty($uuid))
{ {
$sql="select g.data,m.title,m.citation,m.suppinfo,m.doi,m.filesize,m.fileformat,m.ts_created,m.south,m.east,m.west,m.north,date(m.timebegin) as timebegin,date(m.timeend) as timeend,m.title_en,m.uuid,m.description,g.id,m.projection,t.filetype $sql="select g.data,m.title,m.citation,m.suppinfo,m.doi,m.filesize,m.fileformat,m.ts_created,m.south,m.east,m.west,m.north,date(m.timebegin) as timebegin,date(m.timeend) as timeend,m.title_en,m.uuid,m.description,g.id,m.projection,t.filetype
from metadata m left join thumbnail t on m.id=t.id ,m.ts_published,d.doi as datadoi,d.authors,d.author_en,d.publisher,d.publisher_en, date_part('year',d.ts_published) as publish_year
from metadata m left join thumbnail t on m.id=t.id
left join datadoi d on d.uuid=m.uuid
left join geonetworkmetadata g on g.uuid=m.uuid where m.uuid=".$this->db->quote($uuid); left join geonetworkmetadata g on g.uuid=m.uuid where m.uuid=".$this->db->quote($uuid);
$row=$this->db->fetchRow($sql); $row=$this->db->fetchRow($sql);
$sql="select r.* from reference r left join mdref m on m.refid=r.id where m.uuid=?"; $sql="select r.* from reference r left join mdref m on m.refid=r.id where m.reftype=0 and m.uuid=? order by m.place";
$sql=$this->db->quoteInto($sql,$uuid); $sql=$this->db->quoteInto($sql,$uuid);
$ref=$this->db->fetchAll($sql); $ref=$this->db->fetchAll($sql);
$reference=""; $reference="";
@ -477,6 +479,28 @@ class ServiceController extends Zend_Controller_Action
$reference.=($k+1).'. '.str_replace(array("\r\n", "\n", "\r"),'',$refer['reference'])."\r\n"; $reference.=($k+1).'. '.str_replace(array("\r\n", "\n", "\r"),'',$refer['reference'])."\r\n";
} }
$row['reference']=$reference; $row['reference']=$reference;
//判断是否使用多篇文献引用
$sql="select r.* from reference r left join mdref m on m.refid=r.id where m.reftype=3 and m.uuid=? order by m.place";
$sql=$this->db->quoteInto($sql,$uuid);
$ref=$this->db->fetchAll($sql);
$reference="";
foreach($ref as $k=>$refer)
{
$reference.=($k+1).'. '.str_replace(array("\r\n", "\n", "\r"),'',$refer['reference'])."\r\n";
}
$row['mcitation']=$reference;
//支持项目判断
$sql="select f.* from fund f left join mdfund m on m.fid=f.id where m.uuid=? order by m.place";
$sql=$this->db->quoteInto($sql,$uuid);
$ref=$this->db->fetchAll($sql);
$fund="";
foreach($ref as $k=>$refer)
{
$fund.=($k+1).'. '.$refer['fund_type'].''.str_replace(array("\r\n", "\n", "\r"),'',$refer['title']).'(编号:'.$refer['fund_id'].")\r\n";
}
if (!empty($fund)) $row['suppinfo']=$fund;
$sql="select cc.name as category, cc.name_zh from metadata m left join category c on m.id=c.id left join categorycode cc on c.code=cc.code where m.uuid=".$this->db->quote($uuid); $sql="select cc.name as category, cc.name_zh from metadata m left join category c on m.id=c.id left join categorycode cc on c.code=cc.code where m.uuid=".$this->db->quote($uuid);
$cat=$this->db->fetchAll($sql); $cat=$this->db->fetchAll($sql);
$row['category_zh']=''; $row['category_zh']='';
@ -596,8 +620,26 @@ class ServiceController extends Zend_Controller_Action
@$odf->setVars('filesize',$row['filesize'],true,'utf-8'); @$odf->setVars('filesize',$row['filesize'],true,'utf-8');
@$odf->setVars('fileformat',$row['fileformat'],true,'utf-8'); @$odf->setVars('fileformat',$row['fileformat'],true,'utf-8');
@$odf->setVars('timebegin',$row['timebegin'],true,'utf-8'); @$odf->setVars('timebegin',$row['timebegin'],true,'utf-8');
@$odf->setVars('timeend',$row['timeend'],true,'utf-8'); @$odf->setVars('timeend',$row['timeend'],true,'utf-8');
@$odf->setVars('citation',$row['citation'],true,'utf-8'); $cit='';
if ($row['mcitation'])
{
$cit=$row['mcitation'];
} else if ($row['citation'])
{
if (empty($row['datadoi']))
{
$cit=$row['citation'];
}
elseif (!strpos($row['citation'],$row['datadoi']))
{
$cit='文章引用:'.$row['citation'];
$cit.="\r\n数据的引用:";
$cit.=substr($row['authors'],1,-1).'. '.$row['title'].'. '.$row['publisher'].', '.(empty($row['ts_published'])?$row['publish_year']:date('Y',strtotime($row['ts_published']))).'. doi:'.$row['datadoi'];
$cit.=' ['.str_replace('"','',substr($row['author_en'],1,-1)).'. '.$row['title_en'].'. '.$row['publisher_en'].', '.(empty($row['ts_published'])?$row['publish_year']:date('Y',strtotime($row['ts_published']))).'. doi:'.$row['datadoi'].']';
}
}
@$odf->setVars('citation',$cit,true,'utf-8');
@$odf->setVars('reference',$row['reference'],true,'utf-8'); @$odf->setVars('reference',$row['reference'],true,'utf-8');
@$odf->setVars('doi',$row['doi'],true,'utf-8'); @$odf->setVars('doi',$row['doi'],true,'utf-8');