更新doc格式的数据引用方式以及项目支持

This commit is contained in:
wlx 2013-06-18 02:03:32 +00:00
parent c821576353
commit c47d78e7a1
2 changed files with 65 additions and 13 deletions

View File

@ -269,9 +269,13 @@ class ServiceController extends Zend_Controller_Action
$review=$this->_request->getParam('review'); $review=$this->_request->getParam('review');
if (!empty($uuid)) if (!empty($uuid))
{ {
$sql="select g.data,m.title,m.description,g.id,m.projection from metadata m left join xml x on m.id=x.id left join geonetworkmetadata g on g.uuid=m.uuid where m.uuid=".$this->db->quote($uuid); $sql="select g.data,m.title,m.description,g.id,m.projection,m.citation,m.title_en
,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);
$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='<ol>'; $reference='<ol>';
@ -287,8 +291,49 @@ class ServiceController extends Zend_Controller_Action
if ($rs) $projection=$rs['proj4text']; if ($rs) $projection=$rs['proj4text'];
} }
if (empty($projection)) $projection=$row['projection']; if (empty($projection)) $projection=$row['projection'];
} else //判断是否使用多篇文献引用
$projection=''; $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);
$ref1="";
foreach($ref as $k=>$refer)
{
$ref1.='<li>'.str_replace(array("\r\n", "\n", "\r"),'',$refer['reference'])."</li>";
}
$row['mcitation']=$ref1;
$citation='';
if ($row['mcitation'])
{
$citation=$row['mcitation'];
} else if ($row['citation'])
{
if (empty($row['datadoi']))
{
$citation=$row['citation'];
}
elseif (!strpos($row['citation'],$row['datadoi']))
{
$citation='<li>文章引用:'.$row['citation'].'</li>';
$citation.="<li>数据的引用:";
$citation.=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'];
$citation.=' ['.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'].']';
$citation.="</li>";
}
}
//支持项目判断
$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.='<li>'.$refer['fund_type'].''.str_replace(array("\r\n", "\n", "\r"),'',$refer['title']).'(编号:'.$refer['fund_id'].")</li>";
}
if (empty($fund)) $fund=$row['suppinfo'];
}
$dom = new DOMDocument(); $dom = new DOMDocument();
$dom->loadXML($row['data']); $dom->loadXML($row['data']);
@ -307,6 +352,8 @@ class ServiceController extends Zend_Controller_Action
$xslt->setParameter('', 'abstract', $abs); $xslt->setParameter('', 'abstract', $abs);
$xslt->setParameter('','projection',$projection); $xslt->setParameter('','projection',$projection);
$xslt->setParameter('','reference',$reference); $xslt->setParameter('','reference',$reference);
$xslt->setParameter('','citation',$citation);
$xslt->setParameter('','fund',$fund);
$XSL = new DOMDocument(); $XSL = new DOMDocument();
$XSL->load( '../data/doc.xsl', LIBXML_NOCDATA); $XSL->load( '../data/doc.xsl', LIBXML_NOCDATA);
$xslt->importStylesheet($XSL); $xslt->importStylesheet($XSL);
@ -319,7 +366,7 @@ class ServiceController extends Zend_Controller_Action
div{clear: both;margin: 0 auto;width:100%;vertical-align:baseline;} div{clear: both;margin: 0 auto;width:100%;vertical-align:baseline;}
#uuid{text-align: right;} #uuid{text-align: right;}
h3{font-size: 18px;} h3{font-size: 18px;}
img {border:0 none;} img {}
a, a:visited {color:Blue;text-decoration:none;} a, a:visited {color:Blue;text-decoration:none;}
a:hover{text-decoration:underline;} a:hover{text-decoration:underline;}
ul{list-style: none;margin: 0;} ul{list-style: none;margin: 0;}

View File

@ -7,6 +7,8 @@
<xsl:param name="abstract" select="defaultstring"/> <xsl:param name="abstract" select="defaultstring"/>
<xsl:param name="projection" select="defaultstring"/> <xsl:param name="projection" select="defaultstring"/>
<xsl:param name="reference" select="defaultstring"/> <xsl:param name="reference" select="defaultstring"/>
<xsl:param name="citation" select="defaultstring"/>
<xsl:param name="fund" select="defaultstring"/>
<xsl:template match="/"> <xsl:template match="/">
<img> <img>
<xsl:attribute name="src">http://westdc.westgis.ac.cn/images/westdc-logo-1.png</xsl:attribute> <xsl:attribute name="src">http://westdc.westgis.ac.cn/images/westdc-logo-1.png</xsl:attribute>
@ -112,10 +114,9 @@
</li> </li>
<li><h4 style="background-color:#DEE2E4">本数据的引用</h4> <li><h4 style="background-color:#DEE2E4">本数据的引用</h4>
<ol> <ol>
<xsl:for-each select="//Metadata/dataIdInfo/idCitation/otherCitDet"> <xsl:if test="$citation!=''">
<li><xsl:value-of select="."/></li> <xsl:value-of select="$citation" disable-output-escaping="yes"/>
</xsl:for-each> </xsl:if> </ol>
</ol>
</li> </li>
<li><h4 style="background-color:#DEE2E4">建议参考文献</h4> <li><h4 style="background-color:#DEE2E4">建议参考文献</h4>
<xsl:if test="$reference!=''"> <xsl:if test="$reference!=''">
@ -132,7 +133,11 @@
</xsl:if> </xsl:if>
</li> </li>
<li><h4 style="background-color:#DEE2E4">项目支持信息</h4> <li><h4 style="background-color:#DEE2E4">项目支持信息</h4>
<p><xsl:value-of select="//Metadata/dataIdInfo/suppInfo"/></p> <ol>
<xsl:if test="$fund!=''">
<xsl:value-of select="$fund" disable-output-escaping="yes"/>
</xsl:if>
</ol>
</li> </li>
<li><h4 style="background-color:#DEE2E4">数据使用声明</h4> <li><h4 style="background-color:#DEE2E4">数据使用声明</h4>
<ol><xsl:for-each select="//Metadata/dataIdInfo/resConst/Consts/useLimit"> <ol><xsl:for-each select="//Metadata/dataIdInfo/resConst/Consts/useLimit">