= $item['title'] ?> |
= $item['fund_id'] ?> |
= $item['fund_type'] ?> |
md) { ?>
ct) { ?>
- |
+ |
- = $item['place'] ?> |
+ |
= $item['title_en'] ?> |
@@ -107,9 +107,12 @@ table thead tr th {background:#EBF2F6;}
添加此项目 |
- 编辑
- ct)) { ?>
+ md)) { ?>
+ 编辑
删除
+
+ ct)) { ?>排序
+ 移除
|
@@ -124,6 +127,7 @@ table thead tr th {background:#EBF2F6;}
diff --git a/application/models/data/Fund.php b/application/models/data/Fund.php
index 8110f229..35517130 100644
--- a/application/models/data/Fund.php
+++ b/application/models/data/Fund.php
@@ -1,139 +1,166 @@
-db = $db;
- $this->auth = $auth;
- }
-
- function fetch($uuid = "",$include = true){
- if(empty($uuid))
- {
- $sql = "SELECT * FROM ".$this->tbl_fund." ORDER BY id DESC";
- $rs = $this->db->query($sql);
- $rows = $rs->fetchAll();
- return $rows;
- }else{
- if($include)
- {
- $sql = "SELECT f.*,mf.place FROM ".$this->tbl_fund." f
- LEFT JOIN ".$this->tbl_mdfund." mf ON mf.fid=f.id
- WHERE uuid='$uuid'
- ORDER BY mf.place DESC";
- }else{
- $fids = $this->getMdFunds($uuid);
- if(count($fids)>0)
- {
- $fids = ' WHERE f.id NOT IN ('.join(",",$fids).')';
- }else{
- $fids = "";
- }
- $sql = "SELECT f.* FROM ".$this->tbl_fund." f $fids ORDER BY f.id DESC";
- }
- $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 update($data,$id)
- {
- include_once("helper/dbh.php");
- $dbh = new dbh($this->db);
-
- if(empty($id))
- {
- return "参数错误";
- }
-
- $state = $dbh->update($this->tbl_fund,$data,"id=$id",true);
-
- if( $state == true)
- {
- return true;
- }else{
- return $state;
- }
- }
-
- function delete($id){
- $sql = "DELETE FROM ".$this->tbl_fund." 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);
- $row = $rs->fetch();
- return $row;
- }
-
- function getMdFunds($uuid){
- $sql = "SELECT * FROM ".$this->tbl_mdfund." WHERE uuid='$uuid'";
- $rs = $this->db->query($sql);
- $rows = $rs->fetchAll();
-
- $fids = array();
- foreach($rows as $k=>$v)
- {
- $fids[] = $v['fid'];
- }
- return $fids;
- }
-
- function addToMdfund($uuid,$id,$order){
- if(empty($order))
- {
- $order = 0;
- }
- $data = array(
- 'uuid'=>$uuid,
- 'fid'=>$id,
- 'place'=>$order
- );
- include_once("helper/dbh.php");
- $dbh = new dbh($this->db);
- return $dbh->insert($this->tbl_mdfund,$data);
- }
-
- function addPaginator($data,$ctl,Zend_Controller_Request_Abstract $request)
- {
- $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;
- }
-
- 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;
- }
-
-}
+db = $db;
+ $this->auth = $auth;
+ }
+
+ function fetch($uuid = "",$include = true){
+ if(empty($uuid))
+ {
+ $sql = "SELECT * FROM ".$this->tbl_fund." ORDER BY id DESC";
+ $rs = $this->db->query($sql);
+ $rows = $rs->fetchAll();
+ return $rows;
+ }else{
+ if($include)
+ {
+ $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";
+ }else{
+ $fids = $this->getMdFunds($uuid);
+ if(count($fids)>0)
+ {
+ $fids = ' WHERE f.id NOT IN ('.join(",",$fids).')';
+ }else{
+ $fids = "";
+ }
+ $sql = "SELECT f.* FROM ".$this->tbl_fund." f $fids ORDER BY f.id DESC";
+ }
+ $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 update($data,$id)
+ {
+ include_once("helper/dbh.php");
+ $dbh = new dbh($this->db);
+
+ if(empty($id))
+ {
+ return "参数错误";
+ }
+
+ $state = $dbh->update($this->tbl_fund,$data,"id=$id",true);
+
+ if( $state == true)
+ {
+ return true;
+ }else{
+ return $state;
+ }
+ }
+
+ function delete($id){
+ $sql = "DELETE FROM ".$this->tbl_fund." WHERE id=$id";
+ 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);
+ $row = $rs->fetch();
+ return $row;
+ }
+
+ function getMdFunds($uuid){
+ $sql = "SELECT * FROM ".$this->tbl_mdfund." WHERE uuid='$uuid'";
+ $rs = $this->db->query($sql);
+ $rows = $rs->fetchAll();
+
+ $fids = array();
+ foreach($rows as $k=>$v)
+ {
+ $fids[] = $v['fid'];
+ }
+ return $fids;
+ }
+
+ function addToMdfund($uuid,$id,$order){
+ if(empty($order))
+ {
+ $order = 0;
+ }
+ $data = array(
+ 'uuid'=>$uuid,
+ 'fid'=>$id,
+ 'place'=>$order
+ );
+ include_once("helper/dbh.php");
+ $dbh = new dbh($this->db);
+ 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');
+
+ $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;
+ }
+
+ 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;
+ }
+
+}
diff --git a/htdocs/js/lib/custom/admin_plugin.js b/htdocs/js/lib/custom/admin_plugin.js
index ee728fbd..563bdcb9 100644
--- a/htdocs/js/lib/custom/admin_plugin.js
+++ b/htdocs/js/lib/custom/admin_plugin.js
@@ -1,115 +1,125 @@
-// JavaScript Document
-$(document).ready(function() {
- gebo_select_row.init();
- gebo_delete_rows.simple();
-});
-
-gebo_select_row = {
- init: function() {
- $('.select_rows').click(function () {
- var tableid = $(this).data('tableid');
- $('#'+tableid).find('input[name=row_sel]').attr('checked', this.checked);
- });
- }
-};
-
-gebo_delete_rows = {
- simple: function() {
- $(".delete_rows_simple").on('click',function (e) {
- e.preventDefault();
- var tableid = $(this).data('tableid');
- if($('input[name=row_sel]:checked', '#'+tableid).length) {
- $.colorbox({
- initialHeight: '0',
- initialWidth: '0',
- href: "#confirm_dialog",
- inline: true,
- opacity: '0.3',
- onComplete: function(){
- $('.confirm_yes').click(function(e){
- e.preventDefault();
- $('input[name=row_sel]:checked', '#'+tableid).each(function(index, element) {
- del($(this).val());
- });
- $('input[name=select_rows]:checked').removeAttr('checked');
- $.colorbox.close();
- });
- $('.confirm_no').click(function(e){
- e.preventDefault();
- $.colorbox.close();
- });
- }
- });
- }
- });
- }
-};
-
-var confrimHTML = '