add DCI action
This commit is contained in:
parent
a8f0424aa6
commit
8a4a5c4386
|
@ -1805,6 +1805,54 @@ class ServiceController extends Zend_Controller_Action
|
||||||
public function jsonexit($data){
|
public function jsonexit($data){
|
||||||
$this->getResponse()->setHeader('Content-Type', 'application/json')->appendBody(json_encode($data,JSON_NUMERIC_CHECK));
|
$this->getResponse()->setHeader('Content-Type', 'application/json')->appendBody(json_encode($data,JSON_NUMERIC_CHECK));
|
||||||
return true;
|
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='<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<DigitalContentData>
|
||||||
|
<DataRecord>
|
||||||
|
<Header>
|
||||||
|
<DateProvided>'.date("Y-m-d").'</DateProvided>
|
||||||
|
<RepositoryName>Cold and Arid Regions Science Data Center at Lanzhou</RepositoryName>
|
||||||
|
<Owner>CARD-WDS</Owner>
|
||||||
|
<RecordIdentifier>'.$uuid.'</RecordIdentifier>
|
||||||
|
</Header>
|
||||||
|
<BibliographicData>
|
||||||
|
<AuthorList>';
|
||||||
|
|
||||||
|
$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.='<Author seq="'.$i.'" AuthorRole="Author">';
|
||||||
|
$xml.='<AuthorName>'.$a.'</AuthorName></Author>';
|
||||||
|
}
|
||||||
|
$xml.='
|
||||||
|
</AuthorList>
|
||||||
|
<TitleList>
|
||||||
|
<ItemTitle TitleType="English title">'.$row['title_en'].'</ItemTitle>
|
||||||
|
</TitleList>
|
||||||
|
<Source>
|
||||||
|
<SourceURL>http://card.westgis.ac.cn/data/'.$uuid.'</SourceURL>
|
||||||
|
<SourceRepository AbbreviatedRepository="CARD">CARD</SourceRepository>
|
||||||
|
<PublicationYear>'.date('Y',strtotime($row['ts_published'])).'</PublicationYear>
|
||||||
|
</Source>
|
||||||
|
<LanguageList>
|
||||||
|
<Language>English</Language>
|
||||||
|
</LanguageList>
|
||||||
|
</BibliographicData>
|
||||||
|
</DataRecord>
|
||||||
|
</DigitalContentData>';
|
||||||
|
$this->getResponse()->setHeader('Content-Type', 'text/xml')
|
||||||
|
->setBody($xml);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue