add md-fund remove/order

This commit is contained in:
Li Jianxuan 2013-04-21 01:52:07 +00:00
parent e4307011e7
commit b315128848
4 changed files with 3908 additions and 3813 deletions

View File

@ -3450,6 +3450,7 @@ class Admin_DataController extends Zend_Controller_Action
$id = $this->_getParam('id'); $id = $this->_getParam('id');
$order = $this->_getParam('order'); $order = $this->_getParam('order');
if(!empty($id)) if(!empty($id))
{ {
if($fund->addToMdfund($uuid,$id,$order)) 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"; $this->view->ct = "ct";
$rows = $fund->fetch($uuid,false);
}
include('data/Metadata.php'); include('data/Metadata.php');
$md = new Metadata($this->db); $md = new Metadata($this->db);
$this->view->md = $md->view($uuid); $this->view->md = $md->view($uuid);
$rows = $fund->fetch($uuid,false);
$fund->addPaginator($rows,$this->view,$this->_request); $fund->addPaginator($rows,$this->view,$this->_request);
return true; return true;
}//formd }//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) public function sendMailToExpert($pid,$name,$email,$code,$test=0)
{ {

View File

@ -89,7 +89,7 @@ table thead tr th {background:#EBF2F6;}
<?php $autoindex=0; <?php $autoindex=0;
foreach ($this->paginator as $item): foreach ($this->paginator as $item):
$autoindex++;?> $autoindex++;?>
<tr id="DataLine_<?= $item['id']?>"> <tr id="DataLine_<?= $item['mfid']?>">
<td><?= $item['title'] ?></td> <td><?= $item['title'] ?></td>
<td><?= $item['fund_id'] ?></td> <td><?= $item['fund_id'] ?></td>
<td><?= $item['fund_type'] ?></td> <td><?= $item['fund_type'] ?></td>
@ -97,7 +97,7 @@ table thead tr th {background:#EBF2F6;}
<?php if($this->ct) { ?> <?php if($this->ct) { ?>
<td><input type="text" name="order" id="order_<?= $item['id']?>" class="span12" /></td> <td><input type="text" name="order" id="order_<?= $item['id']?>" class="span12" /></td>
<?php }else{ ?> <?php }else{ ?>
<td><?= $item['place'] ?></td> <td><input type="text" name="order" id="order_<?= $item['mfid']?>" class="span12" value="<?= $item['place'] ?>" /></td>
<?php }?> <?php }?>
<?php }else{ ?> <?php }else{ ?>
<td><?= $item['title_en'] ?></td> <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> <td><a href="javascript:void(0);" class="addtomd" rel="<?= $item['id']?>">添加此项目</a></td>
<?php } ?> <?php } ?>
<td> <td>
<?php if(empty($this->md)) { ?>
<a href="/admin/data/fund/ac/edit/id/<?= $item['id']?>">编辑</a> <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> <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 } ?> <?php } ?>
</td> </td>
</tr> </tr>
@ -124,6 +127,7 @@ table thead tr th {background:#EBF2F6;}
</div> </div>
<!-- //页面内容 --> <!-- //页面内容 -->
<script> <script>
<?php if(!empty($this->ct)) { ?>
$('.addtomd').each(function(index, element) { $('.addtomd').each(function(index, element) {
$(this).click(function(){ $(this).click(function(){
id = $(this).attr('rel'); 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 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 = { var info = {
btn_prefix : "delbtn_", btn_prefix : "delbtn_",
item_prefix : "DataLine_", item_prefix : "DataLine_",
url : "/admin/data/fund/ac/del" 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 } ?> <?php } ?>
</script> </script>

View File

@ -25,7 +25,7 @@ class Fund extends Zend_Controller_Plugin_Abstract
}else{ }else{
if($include) 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 LEFT JOIN ".$this->tbl_mdfund." mf ON mf.fid=f.id
WHERE uuid='$uuid' WHERE uuid='$uuid'
ORDER BY mf.place DESC"; ORDER BY mf.place DESC";
@ -77,6 +77,11 @@ class Fund extends Zend_Controller_Plugin_Abstract
return $this->db->exec($sql); 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){ function view($id){
$sql = "SELECT * FROM ".$this->tbl_fund." WHERE id=$id"; $sql = "SELECT * FROM ".$this->tbl_fund." WHERE id=$id";
$rs = $this->db->query($sql); $rs = $this->db->query($sql);
@ -112,6 +117,28 @@ class Fund extends Zend_Controller_Plugin_Abstract
return $dbh->insert($this->tbl_mdfund,$data); 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) function addPaginator($data,$ctl,Zend_Controller_Request_Abstract $request)
{ {
$page = $request->getParam('page'); $page = $request->getParam('page');

View File

@ -50,6 +50,11 @@ var confrimHTML = '<div class=""><div class="modal-header"><h3>是否确定删
function onedel(id) function onedel(id)
{ {
if(typeof(info) == "undefined")
{
Alert('信息参数设置不正确');
return false;
}
$.colorbox({ $.colorbox({
initialHeight: '100', initialHeight: '100',
initialWidth: '200', initialWidth: '200',
@ -72,6 +77,11 @@ function onedel(id)
} }
function del(id){ function del(id){
if(typeof(info) == "undefined")
{
alert('信息参数设置不正确');
return false;
}
btn = $('#'+info.btn_prefix+id); btn = $('#'+info.btn_prefix+id);
func = btn.attr('onclick'); func = btn.attr('onclick');
html = btn.html(); html = btn.html();