From 8a4a5c43866e179c92509ff60d6ba2cf7ebfa0c5 Mon Sep 17 00:00:00 2001 From: wlx Date: Thu, 27 Feb 2014 14:11:54 +0000 Subject: [PATCH] add DCI action --- .../default/controllers/ServiceController.php | 52 ++++++++++++++++++- 1 file changed, 50 insertions(+), 2 deletions(-) diff --git a/application/default/controllers/ServiceController.php b/application/default/controllers/ServiceController.php index 1167a21d..426c0ccb 100644 --- a/application/default/controllers/ServiceController.php +++ b/application/default/controllers/ServiceController.php @@ -1805,6 +1805,54 @@ class ServiceController extends Zend_Controller_Action public function jsonexit($data){ $this->getResponse()->setHeader('Content-Type', 'application/json')->appendBody(json_encode($data,JSON_NUMERIC_CHECK)); return true; - } - + } + + public function dciAction() + { + $this->_helper->layout->disableLayout(); + $this->_helper->viewRenderer->setNoRender(); + //must have doi to output dci + $uuid=$this->_request->getParam('uuid'); + + $xml=' + + +
+ '.date("Y-m-d").' + Cold and Arid Regions Science Data Center at Lanzhou + CARD-WDS + '.$uuid.' +
+ + '; + + $sql="select title_en,doi,author_en,ts_published from datadoi where uuid=".$this->db->quote($uuid); + $row=$this->db->fetchRow($sql); + $authors=explode(',',str_replace('"','',substr($row['author_en'],1,-1))); + $i=0; + foreach($authors as $a) + { + $i=$i+1; + $xml.=''; + $xml.=''.$a.''; + } + $xml.=' + + + '.$row['title_en'].' + + + http://card.westgis.ac.cn/data/'.$uuid.' + CARD + '.date('Y',strtotime($row['ts_published'])).' + + + English + + +
+
'; + $this->getResponse()->setHeader('Content-Type', 'text/xml') + ->setBody($xml); + } }