添加DOI相关操作功能
This commit is contained in:
parent
33b75a2469
commit
3e9b3b971e
|
@ -3520,9 +3520,54 @@ class Admin_DataController extends Zend_Controller_Action
|
|||
$this->_helper->layout->setLayout('administry');
|
||||
$ac = $this->_getParam('ac');
|
||||
$submit = $this->_getParam('submit');
|
||||
$uuid = $this->_getParam('uuid');
|
||||
|
||||
include_once("data/Doi.php");
|
||||
$fund = new Doi($this->db);
|
||||
$doi = new Doi($this->db);
|
||||
include_once("helper/view.php");
|
||||
|
||||
if( empty($ac) || $ac == "index")
|
||||
{
|
||||
if(empty($uuid))
|
||||
{
|
||||
$rows = $doi->fetch();
|
||||
view::addPaginator($rows,$this->view,$this->_request);
|
||||
}else{
|
||||
$this->_redirect('/admin/data/doi/ac/edit/?uuid='.$uuid);
|
||||
return true;
|
||||
}
|
||||
return true;
|
||||
}//index
|
||||
|
||||
if($ac == "add")
|
||||
{
|
||||
$this->_helper->viewRenderer('doi-add');
|
||||
|
||||
}//add
|
||||
|
||||
if($ac == "edit")
|
||||
{
|
||||
$this->_helper->viewRenderer('doi-add');
|
||||
$id = $this->_getParam('id');
|
||||
if(empty($uuid) && empty($id))
|
||||
{
|
||||
view::Msg('alert-error',"参数错误",-1);
|
||||
return false;
|
||||
}
|
||||
|
||||
if(!empty($uuid))
|
||||
{
|
||||
$this->view->uuid = $uuid;
|
||||
$this->view->data = $doi->view($uuid);
|
||||
if(empty($this->view->data))
|
||||
{
|
||||
$this->view->data['uuid'] = $uuid;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}//add
|
||||
|
||||
}//doi
|
||||
|
||||
//发送邀请专家的邮件
|
||||
|
|
|
@ -19,22 +19,10 @@ table thead tr th {background:#EBF2F6;}
|
|||
<div class="span10">
|
||||
<div>
|
||||
<ul class="nav nav-tabs">
|
||||
<li class="active"><a href="/admin/data/fund/">所有项目</a></li>
|
||||
<li><a href="/admin/data/fund/ac/add">添加新项目</a></li>
|
||||
<li class="active"><a href="/admin/data/doi">浏览所有</a></li>
|
||||
<li><a href="/admin/data/doi/ac/add">添加新DOI</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
<?php if(!empty($this->md)) { ?>
|
||||
<div>
|
||||
<?php if(empty($this->ct)) { ?>
|
||||
<a class="btn btn-primary pull-right" href="/admin/data/fund/ac/formd/uuid/<?= $this->md['uuid'] ?>"><i class="icon-plus"></i>为此数据添加项目</a>
|
||||
<?php }else{ ?>
|
||||
<a class="pull-right btn" href="/admin/data/fund/uuid/<?= $this->md['uuid'] ?>">返回</a>
|
||||
<div class="pull-right label label-info">点击“添加此项目”即可将项目添加到元数据</div>
|
||||
<?php } ?>
|
||||
<h3>《<?= $this->md['title'] ?>》 的支持项目</h3>
|
||||
<hr />
|
||||
</div>
|
||||
<?php } ?>
|
||||
<div>
|
||||
<div class="input-append">
|
||||
<form id="datasearch" class="search_form" action="">
|
||||
|
@ -44,44 +32,19 @@ table thead tr th {background:#EBF2F6;}
|
|||
</div>
|
||||
</div>
|
||||
<?php if(!empty($this->error)) { ?>
|
||||
<?php if(empty($this->AlertType)) $AlertType = "alert-error";else $AlertType = $this->AlertType;?>
|
||||
<div class="alert alert-block fade in <?= $AlertType ?>" id="Alert-error-box">
|
||||
<a class="close" data-dismiss="alert" href="#">×</a>
|
||||
<?php if(!is_array($this->error)) { ?><h4 class="alert-heading"><?= $this->error ?></h4><?php } else { ?>
|
||||
<ul>
|
||||
<?php foreach($this->error as $v) { ?>
|
||||
<li><?= $v ?></li>
|
||||
<?php } ?>
|
||||
</ul>
|
||||
<?php } ?>
|
||||
</div>
|
||||
<?= $this->error ?>
|
||||
<?php } ?>
|
||||
<?php if(!empty($this->msg)) { ?>
|
||||
<div class="alert <?= $this->AlertType;?>">
|
||||
<a data-dismiss="alert" class="close">×</a>
|
||||
<?php echo $this->msg ?>
|
||||
</div>
|
||||
<?php if(!empty($this->jump_url)) { ?>
|
||||
<script language="javascript">setTimeout("self.location='<?php echo $this->jump_url ?>'",3000);</script>
|
||||
<?php } ?>
|
||||
<?= $this->msg ?>
|
||||
<?php } else{ ?>
|
||||
<div id="datalist">
|
||||
<?php if (count($this->paginator)): ?>
|
||||
<table class="table table-bordered table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>名称</th>
|
||||
<th>编号</th>
|
||||
<th>类型</th>
|
||||
<?php if($this->md) { ?>
|
||||
<th width="80">排序</th>
|
||||
<?php }else{ ?>
|
||||
<th>英文标题</th>
|
||||
<th>英文类型</th>
|
||||
<?php } ?>
|
||||
<?php if($this->ct) { ?>
|
||||
<th>添加</th>
|
||||
<?php } ?>
|
||||
<th>UUID</th>
|
||||
<th>元数据</th>
|
||||
<th>DOI</th>
|
||||
<th width="70">操作</th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
@ -89,35 +52,13 @@ table thead tr th {background:#EBF2F6;}
|
|||
<?php $autoindex=0;
|
||||
foreach ($this->paginator as $item):
|
||||
$autoindex++;?>
|
||||
<?php if(empty($this->md)) { ?>
|
||||
<tr id="DataLine_<?= $item['id']?>">
|
||||
<?php }else{?>
|
||||
<tr id="DataLine_<?= $item['mfid']?>">
|
||||
<?php }?>
|
||||
<td><?= $item['uuid'] ?></td>
|
||||
<td><?= $item['title'] ?></td>
|
||||
<td><?= $item['fund_id'] ?></td>
|
||||
<td><?= $item['fund_type'] ?></td>
|
||||
<?php if($this->md) { ?>
|
||||
<?php if($this->ct) { ?>
|
||||
<td><input type="text" name="order" id="order_<?= $item['id']?>" class="span12" /></td>
|
||||
<?php }else{ ?>
|
||||
<td><input type="text" name="order" id="order_<?= $item['mfid']?>" class="span12" value="<?= $item['place'] ?>" /></td>
|
||||
<?php }?>
|
||||
<?php }else{ ?>
|
||||
<td><?= $item['title_en'] ?></td>
|
||||
<td><?= $item['fund_type_en'] ?></td>
|
||||
<?php } ?>
|
||||
<?php if($this->ct) { ?>
|
||||
<td><a href="javascript:void(0);" class="addtomd" rel="<?= $item['id']?>">添加此项目</a></td>
|
||||
<?php } ?>
|
||||
<td><?= $item['doi'] ?></td>
|
||||
<td>
|
||||
<?php if(empty($this->md)) { ?>
|
||||
<a href="/admin/data/fund/ac/edit/id/<?= $item['id']?>">编辑</a>
|
||||
<a href="javascript:void(0);" onclick="onedel(<?= $item['id']?>)" id="delbtn_<?= $item['id']?>">删除</a>
|
||||
<?php }else{ ?>
|
||||
<?php if(empty($this->ct)) { ?><a href="javascript:void(0);" class="changeorder" rel="<?= $item['mfid']?>">排序</a> <?php } ?>
|
||||
<a href="javascript:void(0);" onclick="onedel(<?= $item['mfid']?>)" id="delbtn_<?= $item['mfid']?>">移除</a>
|
||||
<?php } ?>
|
||||
</td>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
|
@ -131,34 +72,9 @@ table thead tr th {background:#EBF2F6;}
|
|||
</div>
|
||||
<!-- //页面内容 -->
|
||||
<script>
|
||||
<?php if(!empty($this->ct)) { ?>
|
||||
$('.addtomd').each(function(index, element) {
|
||||
$(this).click(function(){
|
||||
id = $(this).attr('rel');
|
||||
order = $('#order_'+id).val();
|
||||
self.location='/admin/data/fund/ac/formd/uuid/<?= $this->md['uuid'] ?>/id/'+id+'/order/'+ order
|
||||
});
|
||||
});
|
||||
<?php }else{ ?>
|
||||
$('.changeorder').each(function(index, element) {
|
||||
$(this).click(function(){
|
||||
id = $(this).attr('rel');
|
||||
order = $('#order_'+id).val();
|
||||
self.location='/admin/data/fund/ac/formd/uuid/<?= $this->md['uuid'] ?>/mfid/'+id+'/order/'+ order
|
||||
});
|
||||
});
|
||||
<?php } ?>
|
||||
<?php if(empty($this->md)) { ?>
|
||||
var info = {
|
||||
btn_prefix : "delbtn_",
|
||||
item_prefix : "DataLine_",
|
||||
url : "/admin/data/fund/ac/del"
|
||||
url : "/admin/data/doi/ac/del"
|
||||
}
|
||||
<?php }else{ ?>
|
||||
var info = {
|
||||
btn_prefix : "delbtn_",
|
||||
item_prefix : "DataLine_",
|
||||
url : "/admin/data/fund/ac/mdfunddel/uuid/<?= $this->md['uuid'] ?>"
|
||||
}
|
||||
<?php } ?>
|
||||
</script>
|
||||
|
|
|
@ -64,7 +64,8 @@
|
|||
<a href="/admin/data/dataset/ac/getdataset/uuid/<?php echo $item['uuid'];?>" class="iframe">添加存档</a> |
|
||||
<?php endif;?>
|
||||
<a href="/admin/down/sendmail/uuid/<?php echo $item['uuid'];?>" title="向数据下载者发送通知邮件">邮件通知</a> |
|
||||
<a href="/admin/data/fund/uuid/<?php echo $item['uuid'];?>">支持项目</a>
|
||||
<a href="/admin/data/fund/uuid/<?php echo $item['uuid'];?>">支持项目</a> |
|
||||
<a href="/admin/data/doi/uuid/<?php echo $item['uuid'];?>">DOI</a>
|
||||
</p>
|
||||
<?php if($item['author']) :?>
|
||||
<p>数据贡献者:<?= $item['author']; ?></p>
|
||||
|
|
|
@ -789,7 +789,7 @@ class HeiheController extends DataController
|
|||
{
|
||||
$this->_helper->viewRenderer('project-index');
|
||||
|
||||
$sql = "SELECT * FROM heiheproject WHERE status<4";
|
||||
$sql = "SELECT * FROM heiheproject WHERE status=1";
|
||||
$sth = $this->db->query($sql);
|
||||
$rows = $sth->fetchAll();
|
||||
|
||||
|
|
|
@ -24,7 +24,7 @@ $this->theme->AppendPlus($this,'colorbox');
|
|||
<ul class="nav nav-pills">
|
||||
<li><a class="text-shadow" href="/heihe/projects/">所有项目</a></li>
|
||||
<li><a class="text-shadow" href="/heihe/projects/ac/my">我负责的</a></li>
|
||||
<li><a class="text-shadow" href="/heihe/projects/ac/submitting">正在提交</a></li>
|
||||
<li><a class="text-shadow" href="/heihe/projects/ac/submitting">专家未审核</a></li>
|
||||
<li><a class="text-shadow" href="/heihe/projects/ac/unsubmit">未提交</a></li>
|
||||
<li><a class="text-shadow" href="/heihe/projects/ac/submit">已提交</a></li>
|
||||
</ul>
|
||||
|
|
|
@ -5,16 +5,32 @@ class Doi
|
|||
private $auth = NULL; //Zend_Auth 对象
|
||||
|
||||
//使用到的公共变量
|
||||
public $tbl_user = "users";
|
||||
public $tbl_doi = "datadoi";
|
||||
|
||||
function __construct($db)
|
||||
{
|
||||
$this->db = $db;
|
||||
}
|
||||
|
||||
function _create()
|
||||
function fetch()
|
||||
{
|
||||
$sql = "SELECT * FROM ".$this->tbl_doi." ORDER BY id DESC";
|
||||
$rs = $this->db->query($sql);
|
||||
$rows = $rs->fetchAll();
|
||||
return $rows;
|
||||
}
|
||||
|
||||
function view($id)
|
||||
{
|
||||
if(is_numeric($id))
|
||||
{
|
||||
$sql = "SELECT * FROM ".$this->tbl_doi." WHERE id=$id";
|
||||
}else{
|
||||
$sql = "SELECT * FROM ".$this->tbl_doi." WHERE uuid='$id'";
|
||||
}
|
||||
$rs = $this->db->query($sql);
|
||||
$row = $rs->fetch();
|
||||
return $row;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,61 @@
|
|||
<?php
|
||||
class view extends Zend_Controller_Plugin_Abstract
|
||||
{
|
||||
private $db; //传入PDO对象.
|
||||
private $product = 0; //产品环境
|
||||
|
||||
function __construct($db='')
|
||||
{
|
||||
$this->db = $db;
|
||||
}
|
||||
|
||||
static function addPaginator($data,$ctl,Zend_Controller_Request_Abstract $request)
|
||||
{
|
||||
$page = $request->getParam('page');
|
||||
|
||||
$paginator = Zend_Paginator::factory($data);
|
||||
$paginator->setCurrentPageNumber($page);
|
||||
$paginator->setItemCountPerPage(12);
|
||||
$paginator->setView($ctl);
|
||||
Zend_View_Helper_PaginationControl::setDefaultViewPartial('pagination_param.phtml');
|
||||
$ctl->paginator = $paginator;
|
||||
}
|
||||
|
||||
static function Msg($type,$content,$url=''){
|
||||
$html = '<div class="alert '.$type.'">'."\r\n";
|
||||
$html.= '<a data-dismiss="alert" class="close">×</a>'."\r\n";
|
||||
$html.= $content."\r\n";
|
||||
$html.= '</div>'."\r\n";
|
||||
if(!empty($url))
|
||||
{
|
||||
if($url == -1){
|
||||
$html.= '<script language="javascript">setTimeout("window.history.back(-1);",3000);</script>'."\r\n";
|
||||
}else{
|
||||
$html.= '<script language="javascript">setTimeout("self.location=\''.$url.'\'",3000);</script>'."\r\n";
|
||||
}
|
||||
}
|
||||
return $html;
|
||||
}
|
||||
|
||||
static function Error($type,$content,$url=''){
|
||||
if(empty($type))
|
||||
{
|
||||
$AlertType = "alert-error";
|
||||
}else{
|
||||
$AlertType = $type;
|
||||
}
|
||||
$html = '<div class="alert alert-block fade in '.$AlertType.'" id="Alert-error-box">'."\r\n";
|
||||
$html.= '<a class="close" data-dismiss="alert" href="#">×</a>'."\r\n";
|
||||
if(!is_array($content)) {
|
||||
$html.= '<h4 class="alert-heading">'.$content.'</h4>'."\r\n";
|
||||
}else{
|
||||
$html.= '<ul>'."\r\n";
|
||||
foreach($content as $v) {
|
||||
$html.='<li>'.$v.'</li>'."\r\n";
|
||||
}
|
||||
$html.= '</ul>'."\r\n";
|
||||
}
|
||||
$html.= '</div>'."\r\n";
|
||||
return $html;
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue