1. 合并了search功能,并利用Search类实现多词搜索。
2. 添加了查看用户申请表的功能 3. 修复了处理离线申请中的逻辑错误,即通过/拒绝申请时应针对单条数据而不是一次申请。 4. 数据记录查看详细功能增强,样式进行了统一。
This commit is contained in:
parent
68e9fbfa04
commit
298f038b47
|
@ -71,13 +71,22 @@ class AuthorController extends Zend_Controller_Action
|
|||
$u_email = $user->email;
|
||||
}
|
||||
|
||||
if(empty($ac) || $ac=="online")
|
||||
if(empty($ac) || $ac=="online" || $ac == "searchonline")
|
||||
{
|
||||
$sql = "SELECT o.id,o.userid,o.unit,o.username,o.ts_created,o.project,m.title,m.uuid FROM onlineapp as o
|
||||
LEFT JOIN metadata as m ON o.uuid=m.uuid
|
||||
LEFT JOIN mdauthor as a ON a.uuid=o.uuid
|
||||
WHERE (o.id in (SELECT distinct(onlineappid) from dataorder where status>=0)) AND a.userid = ? AND a.status=1
|
||||
ORDER BY o.id desc";
|
||||
WHERE (o.id in (SELECT distinct(onlineappid) from dataorder where status>=0)) AND a.userid = ? AND a.status=1 ";
|
||||
if ($ac=="searchonline")
|
||||
{
|
||||
$keywords = $this->_request->getParam('q');
|
||||
if(!empty($keywords))
|
||||
$this->view->q = $keywords;
|
||||
$search=new Search($keywords);
|
||||
$where=$search->sql_expr(array("m.title","m.description"));
|
||||
$sql.=' and '.$where;
|
||||
}
|
||||
$sql.=" ORDER BY o.id desc";
|
||||
|
||||
$sth = $this->db->prepare($sql);
|
||||
$sth->execute(array($u_id));
|
||||
|
@ -91,38 +100,11 @@ class AuthorController extends Zend_Controller_Action
|
|||
$this->view->paginator=$paginator;
|
||||
}//在线申请记录
|
||||
|
||||
if($ac == "searchonline")
|
||||
{
|
||||
$keywords = $this->_request->getParam('q');
|
||||
if(!empty($keywords))
|
||||
{
|
||||
$this->view->q = $keywords;
|
||||
}
|
||||
|
||||
|
||||
$sql = "SELECT o.id,o.userid,o.unit,o.username,o.ts_created,o.project,m.title,m.uuid FROM onlineapp as o
|
||||
LEFT JOIN metadata as m ON o.uuid=m.uuid
|
||||
LEFT JOIN mdauthor as a ON a.uuid=o.uuid
|
||||
WHERE (o.id in (SELECT distinct(onlineappid) from dataorder)) AND a.userid = ? AND (m.title like ? or m.description like ?) AND a.status=1
|
||||
ORDER BY o.id desc";
|
||||
|
||||
$sth = $this->db->prepare($sql);
|
||||
$sth->execute(array($u_id,"%$keywords%","%$keywords%"));
|
||||
$rows = $sth->fetchAll();
|
||||
|
||||
$paginator = Zend_Paginator::factory($rows);
|
||||
$paginator->setCurrentPageNumber($this->_getParam('page'));
|
||||
$paginator->setItemCountPerPage(10);
|
||||
$paginator->setView($this->view);
|
||||
Zend_View_Helper_PaginationControl::setDefaultViewPartial('pagination_param.phtml');
|
||||
$this->view->paginator=$paginator;
|
||||
|
||||
}//在线申请记录搜索
|
||||
|
||||
if($ac == "offline")
|
||||
if($ac == "offline" || $ac=="searchoffline")
|
||||
{
|
||||
$pr = $this->_request->getParam('pr');
|
||||
$oid = $this->_request->getParam('oid');
|
||||
$pdf = $this->_request->getParam('pdf');
|
||||
|
||||
if(!empty($pr))
|
||||
{
|
||||
|
@ -138,11 +120,12 @@ class AuthorController extends Zend_Controller_Action
|
|||
}
|
||||
|
||||
//如果用户已经下载过了,就无法在更改对数据申请的意见
|
||||
$sql = "select md.title,d.uuid,d.status as datastatus,d.authorpermitted from offlineapp o
|
||||
left join dataorder d on o.id=d.offlineappid
|
||||
$sql = "select md.title,d.uuid,d.status as datastatus,d.authorpermitted from dataorder d
|
||||
left join offlineapp o on o.id=d.offlineappid
|
||||
left join metadata md on md.uuid=d.uuid
|
||||
left join mdauthor a on a.uuid=d.uuid
|
||||
where o.ts_approved is null and o.pdflink is not null and d.uuid=? and a.userid=? and d.offlineappid=? AND a.status=1
|
||||
where o.ts_approved is null and o.pdflink is not null
|
||||
and d.uuid=? and a.userid=? and d.id=? AND a.status=1
|
||||
order by o.ts_created desc";
|
||||
|
||||
$sth = $this->db->prepare($sql);
|
||||
|
@ -154,11 +137,16 @@ class AuthorController extends Zend_Controller_Action
|
|||
echo "该申请已经通过并且发放数据";
|
||||
exit();
|
||||
}
|
||||
else if (empty($row) || $row['datastatus']!=4)
|
||||
{
|
||||
echo "该数据申请存在问题,请联系数据中心!";
|
||||
exit();
|
||||
}
|
||||
|
||||
//同意用户下载
|
||||
if($pr=="confrim")
|
||||
if($pr=="confirm")
|
||||
{
|
||||
$sql = "UPDATE dataorder SET authorpermitted=1 WHERE uuid=? AND offlineappid=?";
|
||||
$sql = "UPDATE dataorder SET authorpermitted=1 WHERE uuid=? and id=?";
|
||||
$sth = $this->db->prepare($sql);
|
||||
if($sth->execute(array($uuid,$oid)))
|
||||
{
|
||||
|
@ -174,12 +162,12 @@ class AuthorController extends Zend_Controller_Action
|
|||
//反对用户下载
|
||||
if($pr == "objection")
|
||||
{
|
||||
$sql = "UPDATE dataorder SET authorpermitted=-1 WHERE uuid=? AND offlineappid=?";
|
||||
$sql = "UPDATE dataorder SET authorpermitted=-1 WHERE uuid=? AND id=?";
|
||||
$sth = $this->db->prepare($sql);
|
||||
if($sth->execute(array($uuid,$oid)))
|
||||
{
|
||||
$btn = $this->createOfflineCtBtn($uuid,'o',$oid);
|
||||
echo ''.$btn.'<script>alert("您已经反对用户的离线数据申请");</script>';
|
||||
echo ''.$btn.'<script>alert("您已经拒绝该用户的此次离线数据申请");</script>';
|
||||
exit();
|
||||
}else{
|
||||
echo "<script>alert('处理过程中遇到错误,请刷新页面');</script>";
|
||||
|
@ -192,16 +180,39 @@ class AuthorController extends Zend_Controller_Action
|
|||
exit();
|
||||
}
|
||||
}
|
||||
else if (!empty($pdf))
|
||||
{
|
||||
$sql="select o.pdflink from dataorder d left join offlineapp o on d.offlineappid=o.id
|
||||
left join mdauthor m on d.uuid=m.uuid
|
||||
where d.id=? and m.userid=?";
|
||||
$sth = $this->db->prepare($sql);
|
||||
$sth->execute(array($pdf,$u_id));
|
||||
$row = $sth->fetch();
|
||||
$content=file_get_contents($this->view->config->offline->savepath."/".$row['pdflink']);
|
||||
header("Content-Disposition: inline; filename=".$row['pdflink']);
|
||||
header("Content-Type:application/pdf");
|
||||
echo $content;
|
||||
die(); // do not change current html output
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->_helper->viewRenderer('inauthor-offline');
|
||||
|
||||
$select="select distinct(o.*),md.title,d.uuid,d.status as datastatus,d.authorpermitted from offlineapp o
|
||||
$select="select distinct(o.*),md.title,d.id as doid,d.uuid,d.status as datastatus,d.authorpermitted from offlineapp o
|
||||
left join dataorder d on o.id=d.offlineappid
|
||||
left join metadata md on md.uuid=d.uuid
|
||||
left join mdauthor a on a.uuid=d.uuid
|
||||
where o.ts_approved is null and o.pdflink is not null and d.status=4 and a.userid=? AND a.status=1
|
||||
order by o.ts_created desc";
|
||||
where o.ts_approved is null and o.pdflink is not null and d.status=4 and a.userid=? AND a.status=1 ";
|
||||
if($ac == "searchoffline")
|
||||
{
|
||||
$keywords = $this->_request->getParam('q');
|
||||
if(!empty($keywords))
|
||||
$this->view->q = $keywords;
|
||||
$search=new Search($keywords);
|
||||
$where=$search->sql_expr(array("md.title","md.description"));
|
||||
$select.=' and '.$where;
|
||||
}
|
||||
$select.=" order by o.ts_created desc";
|
||||
|
||||
$sth = $this->db->prepare($select);
|
||||
$sth->execute(array($u_id));
|
||||
|
@ -210,11 +221,11 @@ class AuthorController extends Zend_Controller_Action
|
|||
foreach ($rows as $k=>$v)
|
||||
{
|
||||
if($v['authorpermitted']==0)
|
||||
{$rows[$k]['btns']=$this->createOfflineCtBtn($v['uuid'],'',$v['id']);}
|
||||
{$rows[$k]['btns']=$this->createOfflineCtBtn($v['uuid'],'',$v['doid']);}
|
||||
if($v['authorpermitted']>0)
|
||||
{$rows[$k]['btns']=$this->createOfflineCtBtn($v['uuid'],'c',$v['id']);}
|
||||
{$rows[$k]['btns']=$this->createOfflineCtBtn($v['uuid'],'c',$v['doid']);}
|
||||
if($v['authorpermitted']<0)
|
||||
{$rows[$k]['btns']=$this->createOfflineCtBtn($v['uuid'],'o',$v['id']);}
|
||||
{$rows[$k]['btns']=$this->createOfflineCtBtn($v['uuid'],'o',$v['doid']);}
|
||||
}
|
||||
|
||||
$paginator = Zend_Paginator::factory($rows);
|
||||
|
@ -226,48 +237,9 @@ class AuthorController extends Zend_Controller_Action
|
|||
}
|
||||
}//离线申请
|
||||
|
||||
if($ac == "searchoffline")
|
||||
{
|
||||
|
||||
$keywords = $this->_request->getParam('q');
|
||||
if(!empty($keywords))
|
||||
{
|
||||
$this->view->q = $keywords;
|
||||
}
|
||||
|
||||
$this->_helper->viewRenderer('inauthor-offline');
|
||||
|
||||
$select="select distinct(o.*),md.title,md.description,d.uuid,d.status as datastatus,d.authorpermitted from offlineapp o
|
||||
left join dataorder d on o.id=d.offlineappid
|
||||
left join metadata md on md.uuid=d.uuid
|
||||
left join mdauthor a on a.uuid=d.uuid
|
||||
where o.ts_approved is null and o.pdflink is not null and d.status=4 and (md.title like ? or md.description like ?) and a.userid=? AND a.status=1
|
||||
order by o.ts_created desc";
|
||||
|
||||
$sth = $this->db->prepare($select);
|
||||
$sth->execute(array("%$keywords%","%$keywords%",$u_id));
|
||||
$rows = $sth->fetchAll();
|
||||
|
||||
foreach ($rows as $k=>$v)
|
||||
{
|
||||
if($v['authorpermitted']==0)
|
||||
{$rows[$k]['btns']=$this->createOfflineCtBtn($v['uuid'],'',$v['id']);}
|
||||
if($v['authorpermitted']>0)
|
||||
{$rows[$k]['btns']=$this->createOfflineCtBtn($v['uuid'],'c',$v['id']);}
|
||||
if($v['authorpermitted']<0)
|
||||
{$rows[$k]['btns']=$this->createOfflineCtBtn($v['uuid'],'o',$v['id']);}
|
||||
}
|
||||
|
||||
$paginator = Zend_Paginator::factory($rows);
|
||||
$paginator->setCurrentPageNumber($this->_getParam('page'));
|
||||
$paginator->setItemCountPerPage(10);
|
||||
$paginator->setView($this->view);
|
||||
Zend_View_Helper_PaginationControl::setDefaultViewPartial('pagination_param.phtml');
|
||||
$this->view->paginator=$paginator;
|
||||
}//离线申请搜索
|
||||
|
||||
//按数据显示
|
||||
if($ac == 'datalist')
|
||||
if($ac == 'datalist' || $ac == "searchdata")
|
||||
{
|
||||
$uuid = $this->_request->getParam('uuid');
|
||||
if(!empty($uuid))
|
||||
|
@ -276,7 +248,7 @@ class AuthorController extends Zend_Controller_Action
|
|||
|
||||
if(preg_match("/^[0-9A-Za-z]{8}-[0-9A-Za-z]{4}-[0-9A-Za-z]{4}-[0-9A-Za-z]{4}-[0-9A-Za-z]{12}$/",$uuid))
|
||||
{
|
||||
$sql = "select md.title,d.uuid,d.authorpermitted,d.status
|
||||
$sql = "select md.title,d.id as doid,d.uuid,d.authorpermitted,d.status
|
||||
,offa.id as offa_id,offa.username as offa_name,offa.unit as offa_unit,offa.email as offa_email,offa.project as offa_project
|
||||
,ona.id as ona_id,ona.username as ona_name,ona.unit as ona_unit,ona.email as ona_email,ona.project as ona_project
|
||||
from dataorder d
|
||||
|
@ -291,15 +263,16 @@ class AuthorController extends Zend_Controller_Action
|
|||
$sth = $this->db->prepare($sql);
|
||||
$sth->execute(array($uuid,$u_id));
|
||||
$rows = $sth->fetchAll();
|
||||
@$this->view->mdtitle=$rows[0]['title'];
|
||||
|
||||
foreach ($rows as $k=>$v)
|
||||
{
|
||||
if($v['authorpermitted']==0)
|
||||
{$rows[$k]['btns']=$this->createOfflineCtBtn($v['uuid'],'',$v['offa_id']);}
|
||||
{$rows[$k]['btns']=$this->createOfflineCtBtn($v['uuid'],'',$v['doid']);}
|
||||
if($v['authorpermitted']>0)
|
||||
{$rows[$k]['btns']=$this->createOfflineCtBtn($v['uuid'],'c',$v['offa_id']);}
|
||||
{$rows[$k]['btns']=$this->createOfflineCtBtn($v['uuid'],'c',$v['doid']);}
|
||||
if($v['authorpermitted']<0)
|
||||
{$rows[$k]['btns']=$this->createOfflineCtBtn($v['uuid'],'o',$v['offa_id']);}
|
||||
{$rows[$k]['btns']=$this->createOfflineCtBtn($v['uuid'],'o',$v['doid']);}
|
||||
}
|
||||
|
||||
$paginator = Zend_Paginator::factory($rows);
|
||||
|
@ -313,12 +286,20 @@ class AuthorController extends Zend_Controller_Action
|
|||
}
|
||||
}else{
|
||||
$this->_helper->viewRenderer('inauthor-datalist');
|
||||
|
||||
$sql = "select md.title,d.uuid,count(md.id) as c from dataorder d
|
||||
left join metadata md on md.uuid=d.uuid
|
||||
left join mdauthor a on a.uuid=d.uuid
|
||||
where a.status=1 AND a.userid=?
|
||||
GROUP BY md.title,d.uuid";
|
||||
where a.status=1 AND a.userid=? ";
|
||||
if($ac == "searchdata")
|
||||
{
|
||||
$keywords = $this->_request->getParam('q');
|
||||
if(!empty($keywords))
|
||||
$this->view->q = $keywords;
|
||||
$search=new Search($keywords);
|
||||
$where=$search->sql_expr(array("md.title","md.description"));
|
||||
$sql.=' and '.$where;
|
||||
}
|
||||
$sql.=" GROUP BY md.title,d.uuid";
|
||||
|
||||
$sth = $this->db->prepare($sql);
|
||||
$sth->execute(array($u_id));
|
||||
|
@ -334,35 +315,6 @@ class AuthorController extends Zend_Controller_Action
|
|||
|
||||
}//按数据显示
|
||||
|
||||
//按数据列表搜索
|
||||
if($ac == "searchdata")
|
||||
{
|
||||
$keywords = $this->_request->getParam('q');
|
||||
if(!empty($keywords))
|
||||
{
|
||||
$this->view->q = $keywords;
|
||||
}
|
||||
|
||||
$this->_helper->viewRenderer('inauthor-datalist');
|
||||
|
||||
$sql = "select md.title,d.uuid,count(md.id) as c from dataorder d
|
||||
left join metadata md on md.uuid=d.uuid
|
||||
left join mdauthor a on a.uuid=d.uuid
|
||||
where a.status=1 AND a.userid=? AND (md.title like ? OR md.description like ?)
|
||||
GROUP BY md.title,d.uuid";
|
||||
|
||||
$sth = $this->db->prepare($sql);
|
||||
$sth->execute(array($u_id,"%$keywords%","%$keywords%"));
|
||||
$rows = $sth->fetchAll();
|
||||
|
||||
$paginator = Zend_Paginator::factory($rows);
|
||||
$paginator->setCurrentPageNumber($this->_getParam('page'));
|
||||
$paginator->setItemCountPerPage(10);
|
||||
$paginator->setView($this->view);
|
||||
Zend_View_Helper_PaginationControl::setDefaultViewPartial('pagination_param.phtml');
|
||||
$this->view->paginator=$paginator;
|
||||
}
|
||||
|
||||
} // inauthorAction() 数据申请管理
|
||||
|
||||
|
||||
|
@ -376,7 +328,7 @@ class AuthorController extends Zend_Controller_Action
|
|||
$selectedStyle = "offline-select";
|
||||
|
||||
$confrimText = "同意";
|
||||
$confrimFunc = 'onclick="confrim(\''.$uuid.'\',\''.$oid.'\')"';
|
||||
$confrimFunc = 'onclick="confirm(\''.$uuid.'\',\''.$oid.'\')"';
|
||||
|
||||
$objectionText = "反对";
|
||||
$objectionFunc = 'onclick="objection(\''.$uuid.'\',\''.$oid.'\')"';
|
||||
|
|
|
@ -40,13 +40,14 @@ $this->breadcrumb()->setSeparator(' > ');
|
|||
foreach ($this->paginator as $item):
|
||||
$autoindex++;?>
|
||||
<li>
|
||||
<p><a href="/data/<?php echo $item['uuid'];?>" target="_blank"><?php echo $item['title'];?></a></p>
|
||||
<p><a href="/data/<?php echo $item['uuid'];?>" target="_blank"><?php echo $item['title'];?></a>
|
||||
【<a href="/author/inauthor/ac/offline/pdf/<?php echo $item['doid']; ?>">查看用户申请表</a>】</p>
|
||||
<p>用户:<?php echo $item['username'];?>
|
||||
单位:<?php echo $item['unit'];?>
|
||||
申请时间:<?php echo date("Y-m-d H:i:s",strtotime($item['ts_created']));?></p>
|
||||
<p>项目:<?php echo $item['project'];?></p>
|
||||
<p><span id="ct_<?php echo $item['id'];?>">
|
||||
<?php echo $item['btns'];?> </span><span id="data_<?php echo $item['id'];?>"></span></p>
|
||||
<p><span id="ct_<?php echo $item['doid'];?>">
|
||||
<?php echo $item['btns'];?> </span><span id="data_<?php echo $item['doid'];?>"></span></p>
|
||||
</li>
|
||||
<?php endforeach;
|
||||
echo "</ul>";
|
||||
|
@ -56,8 +57,8 @@ $this->breadcrumb()->setSeparator(' > ');
|
|||
</div>
|
||||
<!-- //页面内容 -->
|
||||
<script>
|
||||
function confrim(uuid,oid){
|
||||
doPD(uuid,"confrim",oid);
|
||||
function confirm(uuid,oid){
|
||||
doPD(uuid,"confirm",oid);
|
||||
}
|
||||
function objection(uuid,oid){
|
||||
doPD(uuid,"objection",oid);
|
||||
|
|
|
@ -27,7 +27,7 @@ $this->breadcrumb()->setSeparator(' > ');
|
|||
<li class="box-shadow"><a class="text-shadow" href="/author/inauthor/ac/datalist">按数据查看</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="box box-info" id="head_tip" onclick="$('#head_tip').hide();" title="点击关闭提示">这里仅显示您的数据的离线及在线数据申请。</div>
|
||||
<div class="box box-info" id="head_tip" onclick="$('#head_tip').hide();" title="点击关闭提示">这里仅显示您的数据的在线数据记录。</div>
|
||||
<p>请输入元数据标题关键字进行搜索</p>
|
||||
<form id="datasearch" class="search_form" action="/author/inauthor/ac/searchonline">
|
||||
<input type="text" id="keyword" name="q" value="<?php if(!empty($this->q)) echo $this->q; ?>" />
|
||||
|
|
|
@ -6,7 +6,7 @@ $this->headScript()->appendFile('/js/jquery-1.7.min.js');
|
|||
$this->headLink()->appendStylesheet('/css/author.css');
|
||||
$this->breadcrumb('<a href="/">首页</a>');
|
||||
$this->breadcrumb('<a href="/author">数据作者</a>');
|
||||
$this->breadcrumb('查看数据作者');
|
||||
$this->breadcrumb('查看数据申请记录');
|
||||
$this->breadcrumb()->setSeparator(' > ');
|
||||
?>
|
||||
<!-- 左侧导航 -->
|
||||
|
@ -25,9 +25,17 @@ $this->breadcrumb()->setSeparator(' > ');
|
|||
echo $this->error;
|
||||
}
|
||||
?>
|
||||
<div id="tabs-controller">
|
||||
<ul>
|
||||
<li class="box-shadow"><a class="text-shadow" href="/author/inauthor/ac/online">在线下载记录</a></li>
|
||||
<li class="box-shadow"><a class="text-shadow" href="/author/inauthor/ac/offline">离线申请记录</a></li>
|
||||
<li class="box-shadow active"><a class="text-shadow" href="/author/inauthor/ac/datalist">按数据查看</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
<div id="datalist">
|
||||
<?php
|
||||
if (count($this->paginator)):
|
||||
echo "<h2>申请记录:".$this->mdtitle."</h2>";
|
||||
echo "<ul>";
|
||||
$autoindex=0;
|
||||
foreach ($this->paginator as $item):
|
||||
|
@ -38,8 +46,8 @@ $this->breadcrumb()->setSeparator(' > ');
|
|||
<p>【离线申请】<?php echo $item['offa_name'];?> (<?php echo $item['offa_email'];?>)</p>
|
||||
<p>单位:<?php echo $item['offa_unit'];?></p>
|
||||
<p>项目:<?php echo $item['offa_project'];?></p>
|
||||
<p><span id="ct_<?php echo $item['offa_id'];?>">
|
||||
<?php if($item['status']==4): echo $item['btns']; endif;?> </span><span id="data_<?php echo $item['offa_id'];?>"></span></p>
|
||||
<p><span id="ct_<?php echo $item['doid'];?>">
|
||||
<?php if($item['status']==4): echo $item['btns']; endif;?> </span><span id="data_<?php echo $item['doid'];?>"></span></p>
|
||||
</li>
|
||||
<?php
|
||||
endif;
|
||||
|
@ -62,8 +70,8 @@ $this->breadcrumb()->setSeparator(' > ');
|
|||
<!-- //页面内容 -->
|
||||
<script>
|
||||
$('#wapper').width($('body').width()-300);
|
||||
function confrim(uuid,oid){
|
||||
doPD(uuid,"confrim",oid);
|
||||
function confirm(uuid,oid){
|
||||
doPD(uuid,"confirm",oid);
|
||||
}
|
||||
function objection(uuid,oid){
|
||||
doPD(uuid,"objection",oid);
|
||||
|
|
Loading…
Reference in New Issue