add md-fund remove/order
This commit is contained in:
parent
e4307011e7
commit
b315128848
|
@ -3450,6 +3450,7 @@ class Admin_DataController extends Zend_Controller_Action
|
|||
|
||||
$id = $this->_getParam('id');
|
||||
$order = $this->_getParam('order');
|
||||
|
||||
if(!empty($id))
|
||||
{
|
||||
if($fund->addToMdfund($uuid,$id,$order))
|
||||
|
@ -3462,20 +3463,58 @@ class Admin_DataController extends Zend_Controller_Action
|
|||
}
|
||||
}
|
||||
|
||||
$mfid = $this->_getParam('mfid');
|
||||
|
||||
if(!empty($mfid))
|
||||
{
|
||||
if($fund->changeorder($mfid,$order))
|
||||
{
|
||||
$this->view->AlertType = "alert-success";
|
||||
$this->view->error = "排序修改成功!";
|
||||
}else{
|
||||
$this->view->AlertType = "alert-error";
|
||||
$this->view->error = "排序修改失败!";
|
||||
}
|
||||
$rows = $fund->fetch($uuid);
|
||||
}else{
|
||||
$this->view->ct = "ct";
|
||||
$rows = $fund->fetch($uuid,false);
|
||||
}
|
||||
|
||||
include('data/Metadata.php');
|
||||
$md = new Metadata($this->db);
|
||||
$this->view->md = $md->view($uuid);
|
||||
|
||||
$rows = $fund->fetch($uuid,false);
|
||||
$fund->addPaginator($rows,$this->view,$this->_request);
|
||||
|
||||
return true;
|
||||
}//formd
|
||||
|
||||
if($ac == "mdfunddel")
|
||||
{
|
||||
$this->_helper->layout->disableLayout();
|
||||
$this->_helper->viewRenderer->setNoRender();
|
||||
|
||||
$id = $this->_getParam('id');
|
||||
|
||||
if(empty($id))
|
||||
{
|
||||
$this->jsonexit(array('error'=>'参数错误'));
|
||||
return true;
|
||||
}
|
||||
|
||||
if($fund->mfdelete($id) == true)
|
||||
{
|
||||
$this->jsonexit(array('success'=>$id));
|
||||
return true;
|
||||
}else{
|
||||
$this->jsonexit(array('error'=>'删除失败'));
|
||||
return true;
|
||||
}
|
||||
}//mdfunddel
|
||||
|
||||
}//fund
|
||||
|
||||
//发送邀请专家的邮件
|
||||
public function sendMailToExpert($pid,$name,$email,$code,$test=0)
|
||||
{
|
||||
|
|
|
@ -89,7 +89,7 @@ table thead tr th {background:#EBF2F6;}
|
|||
<?php $autoindex=0;
|
||||
foreach ($this->paginator as $item):
|
||||
$autoindex++;?>
|
||||
<tr id="DataLine_<?= $item['id']?>">
|
||||
<tr id="DataLine_<?= $item['mfid']?>">
|
||||
<td><?= $item['title'] ?></td>
|
||||
<td><?= $item['fund_id'] ?></td>
|
||||
<td><?= $item['fund_type'] ?></td>
|
||||
|
@ -97,7 +97,7 @@ table thead tr th {background:#EBF2F6;}
|
|||
<?php if($this->ct) { ?>
|
||||
<td><input type="text" name="order" id="order_<?= $item['id']?>" class="span12" /></td>
|
||||
<?php }else{ ?>
|
||||
<td><?= $item['place'] ?></td>
|
||||
<td><input type="text" name="order" id="order_<?= $item['mfid']?>" class="span12" value="<?= $item['place'] ?>" /></td>
|
||||
<?php }?>
|
||||
<?php }else{ ?>
|
||||
<td><?= $item['title_en'] ?></td>
|
||||
|
@ -107,9 +107,12 @@ table thead tr th {background:#EBF2F6;}
|
|||
<td><a href="javascript:void(0);" class="addtomd" rel="<?= $item['id']?>">添加此项目</a></td>
|
||||
<?php } ?>
|
||||
<td>
|
||||
<?php if(empty($this->md)) { ?>
|
||||
<a href="/admin/data/fund/ac/edit/id/<?= $item['id']?>">编辑</a>
|
||||
<?php if(empty($this->ct)) { ?>
|
||||
<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>
|
||||
|
@ -124,6 +127,7 @@ 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');
|
||||
|
@ -131,11 +135,26 @@ $('.addtomd').each(function(index, element) {
|
|||
self.location='/admin/data/fund/ac/formd/uuid/<?= $this->md['uuid'] ?>/id/'+id+'/order/'+ order
|
||||
});
|
||||
});
|
||||
<?php if(empty($this->ct)) { ?>
|
||||
<?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"
|
||||
}
|
||||
<?php }else{ ?>
|
||||
var info = {
|
||||
btn_prefix : "delbtn_",
|
||||
item_prefix : "DataLine_",
|
||||
url : "/admin/data/fund/ac/mdfunddel/uuid/<?= $this->md['uuid'] ?>"
|
||||
}
|
||||
<?php } ?>
|
||||
</script>
|
||||
|
|
|
@ -25,7 +25,7 @@ class Fund extends Zend_Controller_Plugin_Abstract
|
|||
}else{
|
||||
if($include)
|
||||
{
|
||||
$sql = "SELECT f.*,mf.place FROM ".$this->tbl_fund." f
|
||||
$sql = "SELECT f.*,mf.place,mf.id as mfid FROM ".$this->tbl_fund." f
|
||||
LEFT JOIN ".$this->tbl_mdfund." mf ON mf.fid=f.id
|
||||
WHERE uuid='$uuid'
|
||||
ORDER BY mf.place DESC";
|
||||
|
@ -77,6 +77,11 @@ class Fund extends Zend_Controller_Plugin_Abstract
|
|||
return $this->db->exec($sql);
|
||||
}
|
||||
|
||||
function mfdelete($id){
|
||||
$sql = "DELETE FROM ".$this->tbl_mdfund." WHERE id=$id";
|
||||
return $this->db->exec($sql);
|
||||
}
|
||||
|
||||
function view($id){
|
||||
$sql = "SELECT * FROM ".$this->tbl_fund." WHERE id=$id";
|
||||
$rs = $this->db->query($sql);
|
||||
|
@ -112,6 +117,28 @@ class Fund extends Zend_Controller_Plugin_Abstract
|
|||
return $dbh->insert($this->tbl_mdfund,$data);
|
||||
}
|
||||
|
||||
function changeorder($id,$order){
|
||||
if(!is_numeric($id) || !is_numeric($order))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
$data = array(
|
||||
'place'=>$order
|
||||
);
|
||||
|
||||
include_once("helper/dbh.php");
|
||||
$dbh = new dbh($this->db);
|
||||
$state = $dbh->update($this->tbl_mdfund,$data,"id=$id",true);
|
||||
|
||||
if( $state == true)
|
||||
{
|
||||
return true;
|
||||
}else{
|
||||
return $state;
|
||||
}
|
||||
}
|
||||
|
||||
function addPaginator($data,$ctl,Zend_Controller_Request_Abstract $request)
|
||||
{
|
||||
$page = $request->getParam('page');
|
||||
|
|
|
@ -50,6 +50,11 @@ var confrimHTML = '<div class=""><div class="modal-header"><h3>是否确定删
|
|||
|
||||
function onedel(id)
|
||||
{
|
||||
if(typeof(info) == "undefined")
|
||||
{
|
||||
Alert('信息参数设置不正确');
|
||||
return false;
|
||||
}
|
||||
$.colorbox({
|
||||
initialHeight: '100',
|
||||
initialWidth: '200',
|
||||
|
@ -72,6 +77,11 @@ function onedel(id)
|
|||
}
|
||||
|
||||
function del(id){
|
||||
if(typeof(info) == "undefined")
|
||||
{
|
||||
alert('信息参数设置不正确');
|
||||
return false;
|
||||
}
|
||||
btn = $('#'+info.btn_prefix+id);
|
||||
func = btn.attr('onclick');
|
||||
html = btn.html();
|
||||
|
|
Loading…
Reference in New Issue