为支持项目添加相关数据的查看和关系删除功能
This commit is contained in:
parent
7712a0f910
commit
48f2358599
|
@ -3379,7 +3379,9 @@ class Admin_DataController extends Zend_Controller_Action
|
|||
$this->_helper->layout->setLayout('administry');
|
||||
$ac = $this->_getParam('ac');
|
||||
$submit = $this->_getParam('submit');
|
||||
$this->view->q = $keyword = $this->_getParam('q');
|
||||
|
||||
include_once("helper/view.php");
|
||||
include_once("data/Fund.php");
|
||||
$fund = new Fund($this->db);
|
||||
|
||||
|
@ -3396,13 +3398,13 @@ class Admin_DataController extends Zend_Controller_Action
|
|||
if(empty($uuid))
|
||||
{
|
||||
$rows = $fund->fetch();
|
||||
$fund->addPaginator($rows,$this->view,$this->_request);
|
||||
view::addPaginator($rows,$this->view,$this->_request);
|
||||
}else{
|
||||
include('data/Metadata.php');
|
||||
$md = new Metadata($this->db);
|
||||
$this->view->md = $md->view($uuid);
|
||||
$rows = $fund->fetch($uuid);
|
||||
$fund->addPaginator($rows,$this->view,$this->_request);
|
||||
view::addPaginator($rows,$this->view,$this->_request);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
@ -3535,7 +3537,7 @@ class Admin_DataController extends Zend_Controller_Action
|
|||
$md = new Metadata($this->db);
|
||||
$this->view->md = $md->view($uuid);
|
||||
|
||||
$fund->addPaginator($rows,$this->view,$this->_request);
|
||||
view::addPaginator($rows,$this->view,$this->_request);
|
||||
|
||||
return true;
|
||||
}//formd
|
||||
|
@ -3563,6 +3565,29 @@ class Admin_DataController extends Zend_Controller_Action
|
|||
}
|
||||
}//mdfunddel
|
||||
|
||||
if($ac == "data")
|
||||
{
|
||||
$this->_helper->viewRenderer('fund-data');
|
||||
|
||||
$id = $this->_getParam('id');
|
||||
$del = $this->_getParam('del');
|
||||
$this->view->info = $fund->view($id);
|
||||
|
||||
if(!empty($del))
|
||||
{
|
||||
$s = $fund->dataRelationDelete($del);
|
||||
if($s)
|
||||
{
|
||||
$this->view->error = view::Error("删除成功!","alert-sccuess");
|
||||
}else{
|
||||
$this->view->error = view::Error("删除失败!","alert-error");
|
||||
}
|
||||
}
|
||||
|
||||
$rows = $fund->getData($id,$keyword);
|
||||
view::addPaginator($rows,$this->view,$this->_request);
|
||||
}
|
||||
|
||||
}//fund
|
||||
|
||||
public function doiAction()
|
||||
|
|
|
@ -0,0 +1,78 @@
|
|||
<?php
|
||||
$this->headTitle($this->config->title->site);
|
||||
$this->headTitle($this->config->title->author);
|
||||
$this->headTitle()->setSeparator(' - ');
|
||||
$this->breadcrumb('<a href="/">首页</a>');
|
||||
$this->breadcrumb('<a href="/admin/data">数据管理</a>');
|
||||
$this->breadcrumb('支持项目');
|
||||
$this->breadcrumb()->setSeparator(' > ');
|
||||
$this->theme->AppendPlus($this,'colorbox');
|
||||
$this->theme->AppendPlus($this,'admin_plugin');
|
||||
?>
|
||||
<style>
|
||||
table thead tr th {background:#EBF2F6;}
|
||||
</style>
|
||||
<div class="row-fluid">
|
||||
<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><a href="/admin/data/fund/ac/add">添加新项目</a></li>
|
||||
<li class="active"><a href="/admin/data/fund/ac/data/id/<?= $this->id ?>">相关数据</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>
|
||||
<?php if(!empty($this->error)) { ?>
|
||||
<?= $this->error ?>
|
||||
<?php } ?>
|
||||
<h3><?= $this->info['title'] ?> 的相关数据</h3>
|
||||
<hr />
|
||||
<div id="datalist">
|
||||
<?php if (count($this->paginator)): ?>
|
||||
<table class="table table-bordered table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>名称</th>
|
||||
<th width="70">操作</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?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['title'] ?></td>
|
||||
<td>
|
||||
<a href="javascript:void(0);" onclick="onedel(<?= $item['id']?>)" id="delbtn_<?= $item['id']?>">删除</a>
|
||||
</td>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
</tbody>
|
||||
</table>
|
||||
<?php endif; ?>
|
||||
<div class="pagenavi"><?= $this->paginator; ?></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- //页面内容 -->
|
||||
<script>
|
||||
var info = {
|
||||
btn_prefix : "delbtn_",
|
||||
item_prefix : "DataLine_",
|
||||
url : "/admin/data/fund/ac/mdfunddel/"
|
||||
}
|
||||
</script>
|
|
@ -82,7 +82,7 @@ table thead tr th {background:#EBF2F6;}
|
|||
<?php if($this->ct) { ?>
|
||||
<th>添加</th>
|
||||
<?php } ?>
|
||||
<th width="70">操作</th>
|
||||
<th width="100">操作</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
|
@ -112,6 +112,7 @@ table thead tr th {background:#EBF2F6;}
|
|||
<?php } ?>
|
||||
<td>
|
||||
<?php if(empty($this->md)) { ?>
|
||||
<a href="/admin/data/fund/ac/data/id/<?= $item['id']?>">数据</a>
|
||||
<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{ ?>
|
||||
|
|
|
@ -200,16 +200,20 @@ class Fund extends Zend_Controller_Plugin_Abstract
|
|||
}
|
||||
}
|
||||
|
||||
function addPaginator($data,$ctl,Zend_Controller_Request_Abstract $request)
|
||||
function getData($id,$keyword="")
|
||||
{
|
||||
$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;
|
||||
$search = "";
|
||||
if(!empty($keyword))
|
||||
{
|
||||
$search = " AND md.title LIKE '%$keyword%' ";
|
||||
}
|
||||
$sql = "SELECT md.title,mf.id FROM ".$this->tbl_mdfund." mf
|
||||
LEFT JOIN ".$this->tbl_fund." f ON mf.fid=f.id
|
||||
LEFT JOIN metadata md ON md.uuid=mf.uuid
|
||||
WHERE f.id=$id $search";
|
||||
$rs = $this->db->query($sql);
|
||||
$rows = $rs->fetchAll();
|
||||
return $rows;
|
||||
}
|
||||
|
||||
function _getParams(Zend_Controller_Request_Abstract $request)
|
||||
|
|
Loading…
Reference in New Issue