From 7a9d11a977c9c73e1c4d6f641f7506776d3ef993 Mon Sep 17 00:00:00 2001 From: wlx Date: Mon, 3 Mar 2014 13:34:19 +0000 Subject: [PATCH] add elements to dci --- .../default/controllers/ServiceController.php | 50 +++++++++++++++++-- 1 file changed, 47 insertions(+), 3 deletions(-) diff --git a/application/default/controllers/ServiceController.php b/application/default/controllers/ServiceController.php index 426c0ccb..eede4257 100644 --- a/application/default/controllers/ServiceController.php +++ b/application/default/controllers/ServiceController.php @@ -1826,7 +1826,8 @@ class ServiceController extends Zend_Controller_Action '; - $sql="select title_en,doi,author_en,ts_published from datadoi where uuid=".$this->db->quote($uuid); + $sql="select d.title_en,d.doi,author_en,d.ts_published,m.description,m.timebegin,m.timeend + from datadoi d left join en.normalmetadata m on d.uuid=m.uuid where d.uuid=".$this->db->quote($uuid); $row=$this->db->fetchRow($sql); $authors=explode(',',str_replace('"','',substr($row['author_en'],1,-1))); $i=0; @@ -1839,7 +1840,7 @@ class ServiceController extends Zend_Controller_Action $xml.=' - '.$row['title_en'].' + http://card.westgis.ac.cn/data/'.$uuid.' @@ -1849,7 +1850,50 @@ class ServiceController extends Zend_Controller_Action English - + '; + $xml.=''; + $xml.=''; + $sql="select k.keyword from en.keyword k left join en.normalmetadata m on k.id=m.id where k.keytype='theme' and m.uuid=".$this->db->quote($uuid); + $rowk=$this->db->fetchAll($sql); + $xml.=''; + foreach ($rowk as $k) + { + $xml.=''; + } + $xml.=' + '; + if ($row['timebegin']) + { + $xml.=' + '.date('Y-m-d',strtotime($row['timebegin'])).''; + if ($row['timeend'] && (date('Y-m-d',strtotime($row['timebegin']))!=date('Y-m-d',strtotime($row['timeend'])))) $xml.=' + '.$row['timeend'].''; + $xml.=''; + } + $xml.=''; + $sql="select f.* from fund f left join mdfund mf on f.id=mf.fid where mf.uuid=".$this->db->quote($uuid).' order by mf.place asc'; + $rowf=$this->db->fetchAll($sql); + $xml.=''; + foreach ($rowf as $f) + { + $xml.=' + + '.$f['fund_id'].''.$f['fund_type_en'].' + '; + } + $xml.=''; + $sql="select r.* from reference r left join mdref mr on r.id=mr.refid where mr.reftype=1 and r.language<>'zh' and mr.uuid=".$this->db->quote($uuid).' order by mr.place asc'; + $rowc=$this->db->fetchAll($sql); + $xml.=''; + foreach ($rowc as $c) + { + $xml.=' + '.$c['reference'].''; + if ($c['doi']) + $xml.=''.$c['doi'].''; + $xml.=''; + } + $xml.=' '; $this->getResponse()->setHeader('Content-Type', 'text/xml')