add DCI action

This commit is contained in:
wlx 2014-02-27 14:11:54 +00:00
parent a8f0424aa6
commit 8a4a5c4386
1 changed files with 50 additions and 2 deletions

View File

@ -1807,4 +1807,52 @@ class ServiceController extends Zend_Controller_Action
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);
}
}