#484, 实现doi元数据的导出

This commit is contained in:
wlx 2013-05-13 06:33:35 +00:00
parent c93608a38d
commit 742de40d5e
2 changed files with 54 additions and 5 deletions

View File

@ -3579,13 +3579,13 @@ class Admin_DataController extends Zend_Controller_Action
return true; return true;
}//index }//index
if($ac == "add") else if($ac == "add")
{ {
$this->_helper->viewRenderer('doi-add'); $this->_helper->viewRenderer('doi-add');
}//add }//add
if($ac == "edit") else if($ac == "edit")
{ {
$this->_helper->viewRenderer('doi-add'); $this->_helper->viewRenderer('doi-add');
$id = $this->_getParam('id'); $id = $this->_getParam('id');
@ -3644,7 +3644,7 @@ class Admin_DataController extends Zend_Controller_Action
} }
}//edit }//edit
if($ac == "del") else if($ac == "del")
{ {
$this->_helper->layout->disableLayout(); $this->_helper->layout->disableLayout();
$this->_helper->viewRenderer->setNoRender(); $this->_helper->viewRenderer->setNoRender();
@ -3667,7 +3667,54 @@ class Admin_DataController extends Zend_Controller_Action
} }
}//del }//del
else if ($ac=="convert") //转换为chinadoi所需元数据格式
{
$this->_helper->layout->disableLayout();
$this->_helper->viewRenderer->setNoRender();
$sql="select d.*,m.description from datadoi d left join metadata m on d.uuid=m.uuid where d.uuid='$uuid'";
$row=$this->db->fetchRow($sql);
$timestamp=date('YmdHis');
$authors=explode(',',substr($row['authors'],1,-1));
$orgs=explode(',',substr($row['organization'],1,-1));
$doi='<doi_batch version="1.0.0">
<head>
<doi_batch_id>'.$timestamp.'</doi_batch_id>
<timestamp>'.$timestamp.'</timestamp>
<depositor>
<name>ISTIC</name>
<email_address>tuy@istic.ac.cn</email_address>
</depositor>
<registrant>ISTIC</registrant>
</head>
<body>
<science_data>
<database>
<contributors>';
foreach($authors as $k=>$v)
{
$doi.='<person_name sequence="'.$k.'" contributor_role="author">'.$v.'</person_name>';
$doi.='<organization sequence="'.$k.'" contributor_role="author">'.$orgs[$k].'</organization>';
}
$doi.='</contributors>
<titles>
<title>'.$row['title'].'</title>
<subtitle></subtitle>
</titles>';
$doi.='<description>'.$row['description'].'</description>';
$doi.='<publisher><publisher_name>'.$row['publisher'].'</publisher_name></publisher>';
$doi.='<doi_data>
<doi>'.$row['doi'].'</doi>
<timestamp>'.$timestamp.'</timestamp>
<resource><![CDATA[http://westdc.westgis.ac.cn/data/'.$row['uuid'].']]></resource>
</doi_data>';
$doi.='</database>
</science_data>
</body>
</doi_batch>';
$this->getResponse()->setHeader('Content-Type', 'text/xml')->setHeader('Content-Disposition','attachment; filename="'.$row['uuid'].'.xml"')
->setHeader('Content-Type','application/force-download')->setBody($doi);
$this->db->query('update datadoi set ts_submitted=now() where uuid=?',array($uuid));
}
}//doi }//doi
//发送邀请专家的邮件 //发送邀请专家的邮件

View File

@ -44,7 +44,7 @@ table thead tr th {background:#EBF2F6;}
<th>状态</th> <th>状态</th>
<th>元数据</th> <th>元数据</th>
<th>DOI</th> <th>DOI</th>
<th width="70">操作</th> <th width="140">操作</th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
@ -57,6 +57,8 @@ table thead tr th {background:#EBF2F6;}
<td><?= $item['doi'] ?></td> <td><?= $item['doi'] ?></td>
<td> <td>
<a href="/admin/data/doi/ac/edit/uuid/<?= $item['uuid']?>">编辑</a> <a href="/admin/data/doi/ac/edit/uuid/<?= $item['uuid']?>">编辑</a>
<a href="/admin/data/doi/ac/convert/uuid/<?= $item['uuid']?>">导出</a>
<a href="/admin/data/doi/ac/convert/uuid/<?= $item['uuid']?>">成功</a>
<a href="javascript:void(0);" onclick="onedel(<?= $item['id']?>)" id="delbtn_<?= $item['id']?>">删除</a> <a href="javascript:void(0);" onclick="onedel(<?= $item['id']?>)" id="delbtn_<?= $item['id']?>">删除</a>
</td> </td>
</tr> </tr>