添加了支持项目的添加和查看功能
This commit is contained in:
parent
6db37f4336
commit
9a63ab891c
|
@ -3324,6 +3324,89 @@ class Admin_DataController extends Zend_Controller_Action
|
|||
|
||||
}//projectsAction()
|
||||
|
||||
public function fundAction()
|
||||
{
|
||||
$ac = $this->_getParam('ac');
|
||||
$submit = $this->_getParam('submit');
|
||||
|
||||
include_once("data/Fund.php");
|
||||
$fund = new Fund($this->db);
|
||||
|
||||
$auth = Zend_Auth::getInstance();
|
||||
if($auth->hasIdentity())
|
||||
{
|
||||
$user = $auth->getIdentity();
|
||||
$uid = $user->id;
|
||||
}
|
||||
|
||||
if($ac=='index' || empty($ac))
|
||||
{
|
||||
$rows = $fund->fetch();
|
||||
$paginator = Zend_Paginator::factory($rows);
|
||||
$paginator->setCurrentPageNumber($this->_getParam('page'));
|
||||
$paginator->setItemCountPerPage(15);
|
||||
$paginator->setView($this->view);
|
||||
Zend_View_Helper_PaginationControl::setDefaultViewPartial('pagination_param.phtml');
|
||||
$this->view->paginator=$paginator;
|
||||
return false;
|
||||
}
|
||||
|
||||
if($ac == "add")
|
||||
{
|
||||
$this->_helper->viewRenderer('fund-add');
|
||||
if(!empty($submit))
|
||||
{
|
||||
$data = $fund->_getParams($this->_request);
|
||||
$data['userid'] = $uid;
|
||||
|
||||
if($fund->add($data) == true)
|
||||
{
|
||||
$this->view->AlertType = "alert-success";
|
||||
$this->view->msg = "添加成功!";
|
||||
$this->view->jump_url = "/admin/data/fund/";
|
||||
return true;
|
||||
}else{
|
||||
$this->view->data = $data;
|
||||
$this->view->error = "添加失败,请重试";
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}//add
|
||||
|
||||
if($ac == "edit")
|
||||
{
|
||||
$this->_helper->viewRenderer('fund-add');
|
||||
if(!empty($submit))
|
||||
{
|
||||
$id = $this->getParam('id');
|
||||
|
||||
if(empty($id))
|
||||
{
|
||||
$this->view->AlertType = "alert-error";
|
||||
$this->view->msg = "参数错误";
|
||||
$this->view->jump_url = "/admin/data/fund/";
|
||||
}
|
||||
|
||||
$data = $fund->_getParams();
|
||||
$data['userid'] = $uid;
|
||||
|
||||
if($fund->update($data,$id) == true)
|
||||
{
|
||||
$this->view->AlertType = "alert-success";
|
||||
$this->view->msg = "添加成功!";
|
||||
$this->view->jump_url = "/admin/data/fund/";
|
||||
return true;
|
||||
}else{
|
||||
$this->view->data = $data;
|
||||
$this->view->error = "添加失败,请重试";
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}//edit
|
||||
}
|
||||
|
||||
//发送邀请专家的邮件
|
||||
public function sendMailToExpert($pid,$name,$email,$code,$test=0)
|
||||
{
|
||||
|
|
|
@ -0,0 +1,127 @@
|
|||
<?php
|
||||
$this->headTitle($this->config->title->site);
|
||||
$this->headTitle($this->config->title->author);
|
||||
$this->headTitle()->setSeparator(' - ');
|
||||
//$this->headLink()->appendStylesheet('/css/admin.css');
|
||||
$this->breadcrumb('<a href="/">首页</a>');
|
||||
$this->breadcrumb('<a href="/admin/data">数据管理</a>');
|
||||
$this->breadcrumb('支持项目');
|
||||
$this->breadcrumb()->setSeparator(' > ');
|
||||
$this->theme->AppendPlus($this,'colorbox');
|
||||
?>
|
||||
<div class="row">
|
||||
<div class="span2">
|
||||
<?= $this->partial('data/left.phtml'); ?>
|
||||
</div>
|
||||
<div class="span10">
|
||||
<div>
|
||||
<ul class="nav nav-tabs">
|
||||
<li><a href="/admin/data/fund/">所有项目</a></li>
|
||||
<li class="active"><a href="/admin/data/fund/ac/add">添加新项目</a></li>
|
||||
<li><a href="/admin/data/author/ac/list">查看所有数据作者</a></li>
|
||||
<li><a href="/admin/data/author/ac/datas">所有数据</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="">
|
||||
<?php if(!empty($this->error)) { ?>
|
||||
<div class="alert alert-block alert-error fade in" 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>
|
||||
<?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 } ?>
|
||||
<?php } else{ ?>
|
||||
<form class="form-horizontal" method="post">
|
||||
<div class="control-group">
|
||||
<label class="control-label" for="title">项目名称</label>
|
||||
<div class="controls">
|
||||
<input type="text" id="title" name="title" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="control-group">
|
||||
<label class="control-label" for="fund_id">编号</label>
|
||||
<div class="controls">
|
||||
<input type="text" id="fund_id" name="fund_id">
|
||||
</div>
|
||||
</div>
|
||||
<div class="control-group">
|
||||
<label class="control-label" for="fund_type">类型</label>
|
||||
<div class="controls">
|
||||
<input type="text" id="fund_type" name="fund_type">
|
||||
</div>
|
||||
</div>
|
||||
<div class="control-group">
|
||||
<label class="control-label" for="title_en">英文名称</label>
|
||||
<div class="controls">
|
||||
<input type="text" id="title_en" name="title_en">
|
||||
</div>
|
||||
</div>
|
||||
<div class="control-group">
|
||||
<label class="control-label" for="fund_type_en">英文类型</label>
|
||||
<div class="controls">
|
||||
<input type="text" id="fund_type_en" name="fund_type_en">
|
||||
</div>
|
||||
</div>
|
||||
<div class="control-group">
|
||||
<div class="controls">
|
||||
<input type="hidden" name="submit" value="1" />
|
||||
<?php if(!empty($this->id)) { ?>
|
||||
<input type="hidden" name="id" value=" <?=$this->id?> " />
|
||||
<?php } ?>
|
||||
<button type="submit" class="btn btn-primary">提交</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
<?php } ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- //页面内容 -->
|
||||
<script>
|
||||
function AddAuthor(id,uuid){
|
||||
$('#addauthor_'+id).html('用户名:<input type="text" id="authorInp_'+id+'"/><button class="btn btn-green" onclick="addAuthor('+id+',\''+uuid+'\')">添加</button>');
|
||||
}
|
||||
function addAuthor(id,uuid){
|
||||
$.ajax({
|
||||
'type':"POST",
|
||||
'url':'/admin/data/author',
|
||||
'data':'ac=add&uuid='+uuid+'&username='+$('#authorInp_'+id).val(),
|
||||
'success':function(data){
|
||||
if (typeof(data)=='object')
|
||||
{
|
||||
if(typeof(data.error)!='undefined')
|
||||
{Alert(data.error);return false;}
|
||||
if(typeof(data.msg)!='undefined')
|
||||
{Alert(data.msg);}
|
||||
if(typeof(data.status)!='undefined')
|
||||
{$('#addauthor_'+id).html('<a href="javascript:;" onclick="AddAuthor('+id+',\''+uuid+'\')">添加作者</a>');}
|
||||
}
|
||||
else{
|
||||
Alert('出现错误,请稍后再试');
|
||||
}
|
||||
},
|
||||
'timeout': 30000,
|
||||
'error': function(){
|
||||
$.colorbox({'innerWidth':'50%','html':'<img src="/images/alert_big_error.png" /><h4>处理中出现错误,请刷新页面后重试</h4>'});
|
||||
}
|
||||
});
|
||||
}
|
||||
$(".iframe").colorbox({iframe:true, width:"80%", height:"80%"});
|
||||
$(".inline").colorbox({inline:true, width:"50%"});
|
||||
function Alert(html){
|
||||
$.colorbox({'innerWidth':'50%','html':'<h4 style="font-size:16px;font-weight:bold;">'+html+'</h4>'});
|
||||
}
|
||||
</script>
|
|
@ -0,0 +1,71 @@
|
|||
<?php
|
||||
$this->headTitle($this->config->title->site);
|
||||
$this->headTitle($this->config->title->author);
|
||||
$this->headTitle()->setSeparator(' - ');
|
||||
//$this->headLink()->appendStylesheet('/css/admin.css');
|
||||
$this->breadcrumb('<a href="/">首页</a>');
|
||||
$this->breadcrumb('<a href="/admin/data">数据管理</a>');
|
||||
$this->breadcrumb('支持项目');
|
||||
$this->breadcrumb()->setSeparator(' > ');
|
||||
$this->theme->AppendPlus($this,'colorbox');
|
||||
?>
|
||||
<div class="row">
|
||||
<div class="span2">
|
||||
<?= $this->partial('data/left.phtml'); ?>
|
||||
</div>
|
||||
<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><a href="/admin/data/author/ac/list">查看所有数据作者</a></li>
|
||||
<li><a href="/admin/data/author/ac/datas">所有数据</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
<div>
|
||||
<div class="input-append">
|
||||
<form id="datasearch" class="search_form" action="">
|
||||
<input type="text" id="keyword" name="q" value="<?php if(!empty($this->q)) echo $this->q; ?>" />
|
||||
<button type="submit" class="btn" id="search_btn">搜索</button>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
<div id="datalist">
|
||||
<?php if (count($this->paginator)): ?>
|
||||
<table class="table table-bordered">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>名称</th>
|
||||
<th>编号</th>
|
||||
<th>类型</th>
|
||||
<th>英文名称</th>
|
||||
<th>英文类型</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php $autoindex=0;
|
||||
foreach ($this->paginator as $item):
|
||||
$autoindex++;?>
|
||||
<tr>
|
||||
<td><?= $item['title'] ?></td>
|
||||
<td><?= $item['fund_id'] ?></td>
|
||||
<td><?= $item['fund_type'] ?></td>
|
||||
<td><?= $item['title_en'] ?></td>
|
||||
<td><?= $item['fund_type_en'] ?></td>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
</tbody>
|
||||
</table>
|
||||
<?php endif; ?>
|
||||
<div class="pagenavi"><?= $this->paginator; ?></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- //页面内容 -->
|
||||
<script>
|
||||
$(".iframe").colorbox({iframe:true, width:"80%", height:"80%"});
|
||||
$(".inline").colorbox({inline:true, width:"50%"});
|
||||
function Alert(html){
|
||||
$.colorbox({'innerWidth':'50%','html':'<h4 style="font-size:16px;font-weight:bold;">'+html+'</h4>'});
|
||||
}
|
||||
</script>
|
|
@ -17,4 +17,5 @@
|
|||
<li><a href="/admin/data/feature">特色推荐</a></li>
|
||||
<li><a href="/admin/data/source">项目来源管理</a></li>
|
||||
<li><a href="/admin/data/project">汇交计划</a></li>
|
||||
<li><a href="/admin/data/fund">支持项目</a></li>
|
||||
</ul>
|
|
@ -8,9 +8,7 @@
|
|||
$this->breadcrumb('<a href="/admin/data">数据管理</a>');
|
||||
$this->breadcrumb('元数据管理</a>');
|
||||
$this->breadcrumb()->setSeparator(' > ');
|
||||
$this->headScript()->appendFile('/js/jquery-1.7.min.js');
|
||||
$this->headScript()->appendFile('/js/jquery.colorbox-min.js');
|
||||
$this->headLink()->appendStylesheet('/css/colorbox.css');
|
||||
$this->theme->AppendPlus($this,'colorbox');
|
||||
?>
|
||||
<div id="leftPanel">
|
||||
<?= $this->partial('data/left.phtml'); ?>
|
||||
|
@ -43,9 +41,11 @@
|
|||
<div class="datalist">
|
||||
<ul>
|
||||
<?php foreach ($this->paginator as $item): ?>
|
||||
<li><p><a href="/data/<?= $item['uuid']; ?>" class="title"><?= $item['title']; ?></a></p>
|
||||
<p>大小:<?= $item['filesize']; ?>M,创建时间:<?= date('Y-m-d',strtotime($item['ts_created'])); ?>
|
||||
,查看:<?= $item['viewed']; ?>次。 操作:
|
||||
<li class="well well-small">
|
||||
<h4><a href="/data/<?= $item['uuid']; ?>" class="title"><?= $item['title']; ?></a></h4>
|
||||
<p>大小:<?= $item['filesize']; ?>M,创建时间:<?= date('Y-m-d',strtotime($item['ts_created'])); ?>,查看:<?= $item['viewed']; ?>次。</p>
|
||||
<p>
|
||||
操作:
|
||||
<a href="/service/geonetwork?url=metadata.edit?id=<?= $item['gid']; ?>" target="_blank">编辑</a> |
|
||||
<a href="/admin/data/md/delete/<?= $item['uuid']; ?>">删除</a> |
|
||||
<a href="/admin/data/sync/uuid/<?= $item['uuid']; ?>">同步</a> |
|
||||
|
@ -54,21 +54,22 @@
|
|||
<a href="/admin/data/comment/uuid/<?php echo $item['uuid'];?>">反馈管理</a> |
|
||||
<a href="/admin/data/author/uuid/<?php echo $item['uuid'];?>">作者管理</a> |
|
||||
<a href="/admin/data/version/uuid/<?php echo $item['uuid'];?>">版本管理</a> |
|
||||
<?php if (@!is_numeric($item['mdstatus'])) : ?>
|
||||
<?php if (@!is_numeric($item['mdstatus'])) : ?>
|
||||
<a href="/admin/review/addon/uuid/<?php echo $item['uuid'];?>">放入元数据评审</a> |
|
||||
<?php endif; ?>
|
||||
<?php endif; ?>
|
||||
<a href="/admin/data/source/do/datasource/uuid/<?php echo $item['uuid'];?>">编辑数据来源</a> |
|
||||
<?php if(!empty($item['datasetid'])):?>
|
||||
<a href="/admin/data/dataset/ac/getdataset/uuid/<?php echo $item['uuid'];?>" class="iframe">存档</a> |
|
||||
<?php else: ?>
|
||||
<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/down/sendmail/uuid/<?php echo $item['uuid'];?>" title="向数据下载者发送通知邮件">邮件通知</a> |
|
||||
<a href="/admin/fund">支持项目</a>
|
||||
</p>
|
||||
<?php if($item['author']) :?>
|
||||
<p>数据贡献者:<?= $item['author']; ?></p>
|
||||
<?php endif;?>
|
||||
<p class="content"><?= $item['description']; ?></p>
|
||||
<p class="content"><?= $item['description']; ?></p>
|
||||
</li>
|
||||
<?php endforeach; ?>
|
||||
</ul>
|
||||
|
|
|
@ -0,0 +1,21 @@
|
|||
<?php
|
||||
class Doi
|
||||
{
|
||||
private $db; //传入PDO对象.
|
||||
private $auth = NULL; //Zend_Auth 对象
|
||||
|
||||
//使用到的公共变量
|
||||
public $tbl_user = "users";
|
||||
|
||||
function __construct($db,Zend_Auth $auth=NULL)
|
||||
{
|
||||
$this->db = $db;
|
||||
$this->auth = $auth;
|
||||
}
|
||||
|
||||
function _create()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,44 @@
|
|||
<?php
|
||||
class Fund extends Zend_Controller_Plugin_Abstract
|
||||
{
|
||||
private $db; //传入PDO对象.
|
||||
private $auth = NULL; //Zend_Auth 对象
|
||||
|
||||
public $tbl_fund = "fund"; //项目
|
||||
public $tbl_mdfund = "mdfund"; //对应表
|
||||
|
||||
private $fundFields;
|
||||
|
||||
function __construct($db,Zend_Auth $auth=NULL)
|
||||
{
|
||||
$this->db = $db;
|
||||
$this->auth = $auth;
|
||||
}
|
||||
|
||||
function fetch(){
|
||||
$sql = "SELECT * FROM ".$this->tbl_fund."";
|
||||
$rs = $this->db->query($sql);
|
||||
$rows = $rs->fetchAll();
|
||||
return $rows;
|
||||
}
|
||||
|
||||
function add($data)
|
||||
{
|
||||
include_once("helper/dbh.php");
|
||||
$dbh = new dbh($this->db);
|
||||
return $dbh->insert($this->tbl_fund,$data);
|
||||
}
|
||||
|
||||
function _getParams(Zend_Controller_Request_Abstract $request)
|
||||
{
|
||||
$data = array(
|
||||
'title' => trim($request->getParam('title')),
|
||||
'fund_id' => trim($request->getParam('fund_id')),
|
||||
'fund_type' => trim($request->getParam('fund_type')),
|
||||
'title_en' => trim($request->getParam('title_en')),
|
||||
'fund_type_en' => trim($request->getParam('fund_type_en')),
|
||||
);
|
||||
return $data;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,50 @@
|
|||
<?php
|
||||
class dbh
|
||||
{
|
||||
private $db; //传入PDO对象.
|
||||
|
||||
|
||||
function __construct($db)
|
||||
{
|
||||
$this->db = $db;
|
||||
}
|
||||
|
||||
function insert($table,$data,$return=false)
|
||||
{
|
||||
$fields = array();
|
||||
$datas = array();
|
||||
|
||||
foreach($data as $k=>$v)
|
||||
{
|
||||
$fields[] = '"'.$k.'"';
|
||||
if(is_int($v) || is_float($v) || is_bool($v))
|
||||
{
|
||||
$datas[] = $v;
|
||||
}else{
|
||||
$datas[] = "'".$v."'";
|
||||
}
|
||||
}
|
||||
|
||||
if($return == false){
|
||||
$fields = join(",",$fields);
|
||||
$datas = join(",",$datas);
|
||||
$sql = "INSERT INTO \"".$table."\" ($fields) VALUES ($datas)";
|
||||
return $this->db->exec($sql);
|
||||
}else{
|
||||
$sql = "INSERT INTO \"".$table."\" ($fields) VALUES ($datas) RETURNING id";
|
||||
try{
|
||||
$sth = $this->db->prepare($sql);
|
||||
if($sth->execute())
|
||||
{
|
||||
$temp = $sth->fetch(PDO::FETCH_ASSOC);
|
||||
return $temp['id'];
|
||||
}else{
|
||||
return false;
|
||||
}
|
||||
}catch(Exception $e)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue