diff --git a/application/admin/controllers/DataController.php b/application/admin/controllers/DataController.php index 61947c8f..ff3554e4 100755 --- a/application/admin/controllers/DataController.php +++ b/application/admin/controllers/DataController.php @@ -5,6 +5,7 @@ use Reference\Ris; use Reference\RisOutput; use Helpers\dbh; use \Files\Files; +use Fund\Fund; class Admin_DataController extends Zend_Controller_Action { @@ -1168,7 +1169,7 @@ class Admin_DataController extends Zend_Controller_Action $this->view->years = $reference->countByYear(); return true; } - else if (!empty($uuid)) + else if (empty($ac) && !empty($uuid)) { $sql="select * from metadata where uuid='$uuid'"; $this->view->md=$this->db->fetchRow($sql); @@ -1180,7 +1181,7 @@ class Admin_DataController extends Zend_Controller_Action view::addPaginator($reference->fetchReferencesByUUID($uuid),$this, $this->view->pagelimit); } else { $this->_helper->viewRenderer('ref-data-search'); - view::addPaginator($reference->fetchReferences(),$this, $this->view->pagelimit); + view::addPaginator($reference->fetchReferencesWithUUID($uuid),$this, $this->view->pagelimit); } return true; } @@ -3734,238 +3735,169 @@ class Admin_DataController extends Zend_Controller_Action public function fundAction() { - $this->_helper->layout->setLayout('administry'); + $fund = new Fund($this->db); + + $this->view->ac = $ac = $this->_getParam('ac'); + $submit = $this->_getParam('submit'); + $keyword = $this->view->q = trim($this->_getParam('q')); + $order = $this->view->search_order = trim($this->_getParam('order')); + $sort = $this->view->search_sort = trim($this->_getParam('sort')); + $field = $this->view->search_field = $this->_getParam('field'); + $this->view->uuid = $uuid = $this->_getParam('uuid'); + + if(!empty($keyword)) + { + $fund->keyword = $keyword; + } + + if(!empty($field)) + { + $fund->field = $field; + } + + if(!empty($order)) + { + $fund->order = $order; + } + + if(!empty($sort)) + { + $fund->sort = $sort; + } + + $this->view->fund = $fund; + $this->view->page = $this->_getParam('page'); + $this->view->pagelimit = 10; $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); - - $auth = Zend_Auth::getInstance(); - if($auth->hasIdentity()) + //所有项目 + if(empty($ac) && empty($uuid)) { - $user = $auth->getIdentity(); - $uid = $user->id; + view::addPaginator($fund->fetchFunds(),$this, $this->view->pagelimit); + return true; } - - if($ac=='index' || empty($ac)) + //单条数据 + else if (empty($ac) && !empty($uuid)) { - $uuid = $this->_getParam('uuid'); - if(empty($uuid)) + $sql="select * from metadata where uuid='$uuid'"; + $this->view->md=$this->db->fetchRow($sql); + if (empty($keyword)) + { + $this->_helper->viewRenderer('fund-data-add'); + unset($fund->keyword); + view::addPaginator($fund->fetchFundsByUUID($uuid),$this, $this->view->pagelimit); + } else { + $this->_helper->viewRenderer('fund-data-search'); + view::addPaginator($fund->fetchFundsWithUUID($uuid),$this, $this->view->pagelimit); + } + return true; + } + //数据相关项目 + else if ($ac == "datalist") + { + $this->_helper->viewRenderer('fund-data-list'); + view::addPaginator($fund->fetchDataFunds(),$this,$this->view->pagelimit); + return true; + } + //无数据的项目 + else if ($ac == "nodata") + { + view::addPaginator($fund->fetchNoDataFunds(),$this,$this->view->pagelimit); + return true; + } + //删除项目 + else if($ac == "delete") + { + if($fund->delete($this->_getParam('id'))) { - $rows = $fund->fetch(NULL,true,0,$keyword); - view::addPaginator($rows,$this,10); + view::Post($this,"删除项目信息成功!",-1); }else{ - include('data/Metadata.php'); - $md = new Metadata($this->db); - $this->view->md = $md->view($uuid); - $rows = $fund->fetch($uuid); - view::addPaginator($rows,$this,10); + view::Post($this,"删除项目信息失败!",-1); } return true; } - - if($ac == 'datalist') + //删除项目和数据对应关系 + else if($ac == "remove") { - $this->_helper->viewRenderer('fund-data-list'); - $this->view->q = $q = $this->_getParam('q'); - $rows = $fund->fetchFromData(true,0,$q); - view::addPaginator($rows,$this,10); - return true; - } - - if($ac == 'dataview') - { - $this->_helper->viewRenderer('fund-data-view'); - $this->view->q = $q = $this->_getParam('q'); - $id = $this->_getParam('id'); - $this->view->fund = $fund->view($id); - $rows = $fund->fetchFromData($id,0,$q); - view::addPaginator($rows,$this,10); - return true; - } - - if($ac == "add") - { - $this->_helper->viewRenderer('fund-add'); - if(!empty($submit)) - { - $data = $fund->_getParams($this->_request); - $data['userid'] = $uid; - - if($fund->add($data) == true) - { - $this->view->AlertType = "alert-success"; - $this->view->msg = "添加成功!"; - $this->view->jump_url = "/admin/data/fund/"; - return true; - }else{ - $this->view->data = $data; - $this->view->error = "添加失败,请重试"; - return true; - } + if($fund->remove($this->_getParam('id'))) + { + view::Post($this,"移除数据-项目信息成功!",-1); + }else{ + view::Post($this,"移除数据-项目信息失败!",-1); } return true; - }//add - - if($ac == "edit") + } + //添加数据项目对应 + else if($ac == "mdfund" && view::isXmlHttpRequest($this)) + { + $mdfundid = $this->_getParam('id'); + $status = $fund->makeMdfund($mdfundid); + if($status !== true) + { + $this->jsonexit(array('error'=>$status)); + }else{ + $this->jsonexit(array('success' => 1)); + } + return true; + } + //相关数据 + else if($ac == "data") + { + $fid = $this->view->fid = $this->_getParam('id'); + $this->view->info=$fund->getOneFund($fid); + if(view::isXmlHttpRequest($this)){ + $this->jsonexit($fund->getDataByFund($fid)); + return true; + }else{ + $this->_helper->viewRenderer('fund-data'); + view::addPaginator($fund->getDataByFund($fid),$this,$this->view->pagelimit); + return true; + } + } + //添加或编辑项目 + else if($ac == "add") { $this->_helper->viewRenderer('fund-add'); $id = $this->_getParam('id'); - - if(empty($id)) - { - $this->view->AlertType = "alert-error"; - $this->view->msg = "参数错误"; - $this->view->jump_url = "/admin/data/fund/"; - } if(!empty($submit)) { - $data = $fund->_getParams($this->_request); - $data['userid'] = $uid; - if($fund->update($data,$id) == true) + $this->view->data = $fund->getFundParam(); + + if(empty($id) || !is_numeric($id)) { - $this->view->AlertType = "alert-success"; - $this->view->msg = "修改成功!"; - $this->view->jump_url = "/admin/data/fund/"; - return true; + $status = $fund->fund(); }else{ - $this->view->data = $data; - $this->view->error = "修改失败,请重试"; - return true; + $status = $fund->fund($id); + } + + if($status !== true) + { + $this->view->error = view::Error($status); + }else{ + if(!empty($id)) + { + $msg = "项目修改成功!"; + view::Post($this,$msg,-2); + return true; + }else{ + $msg = "项目添加成功!"; + view::Post($this,$msg,"/admin/data/ref/ac/add"); + return true; + } } }else{ - $this->view->data = $fund->view($id); + $this->view->data = array(); + if(!empty($id) && is_numeric($id)) + { + $this->view->data = $fund->getOneFund($id); + } } + return true; - }//edit - - if($ac == "del") - { - $this->_helper->layout->disableLayout(); - $this->_helper->viewRenderer->setNoRender(); - - $id = $this->_getParam('id'); - - if(empty($id)) - { - $this->jsonexit(array('error'=>'参数错误')); - return true; - } - - if($fund->delete($id) == true) - { - $this->jsonexit(array('success'=>$id)); - return true; - }else{ - $this->jsonexit(array('error'=>'删除失败')); - return true; - } - - }//del - - if($ac == "formd") - { - $uuid = $this->_getParam('uuid'); - - if(empty($uuid)) - { - $this->view->AlertType = "alert-error"; - $this->view->msg = "参数错误"; - $this->view->jump_url = "/admin/data/fund/"; - } - - $id = $this->_getParam('id'); - $order = $this->_getParam('order'); - - if(!empty($id)) - { - if($fund->addToMdfund($uuid,$id,$order)) - { - $this->view->AlertType = "alert-success"; - $this->view->error = "添加成功!可以继续选择并添加"; - }else{ - $this->view->AlertType = "alert-error"; - $this->view->error = "添加失败!该数据可能已被添加"; - } - } - - $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,0,$this->_getParam('q')); - } - - include('data/Metadata.php'); - $md = new Metadata($this->db); - $this->view->md = $md->view($uuid); - - view::addPaginator($rows,$this,10); - - 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 - - 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,10); } - }//fund public function doiAction() diff --git a/application/admin/views/scripts/data/fund-add.phtml b/application/admin/views/scripts/data/fund-add.phtml index 1100ff4d..bac54c07 100644 --- a/application/admin/views/scripts/data/fund-add.phtml +++ b/application/admin/views/scripts/data/fund-add.phtml @@ -15,11 +15,7 @@ $this->theme->AppendPlus($this,'colorbox');
- + partial('data/fund-nav.phtml',array('ac'=>$this->ac,'uuid'=>$this->uuid)); ?>
error)) { ?> diff --git a/application/admin/views/scripts/data/fund-data-add.phtml b/application/admin/views/scripts/data/fund-data-add.phtml new file mode 100644 index 00000000..83e1d8e9 --- /dev/null +++ b/application/admin/views/scripts/data/fund-data-add.phtml @@ -0,0 +1,107 @@ +headTitle($this->config->title->site); +$this->headTitle('后台管理'); +$this->headTitle()->setSeparator(' - '); +$this->breadcrumb('首页'); +$this->breadcrumb('数据管理'); +$this->breadcrumb('项目管理'); +$this->breadcrumb()->setSeparator(' > '); +$this->theme->AppendPlus($this,'colorbox'); +$this->theme->AppendPlus($this,'admin_plugin'); +$this->theme->AppendModel($this,'admin-data-fund'); +?> + +
+
+ partial('data/left.phtml'); ?> +
+
+
+ partial('data/fund-nav.phtml',array('ac'=>$this->ac,'uuid'=>$this->uuid)); ?> +
+
+

md['title']; ?> 查看

+
+
+ + + + +
+
+
+ error)) { ?> + error ?> + + msg)) { ?> + msg ?> + + +
+ paginator)): ?> + + + + + + + + + + + + + + page > 1) + { + $autoindex = ($this->page - 1) * $this->pagelimit; + }else{ + $autoindex=0; + } + foreach ($this->paginator as $item): + $autoindex++;?> + + + + + + + + + + + +
项目名称 + + + 编号 + + + 类型 + + + 英文标题 + + + 英文类型 + + + 操作
+ []  + 项目编辑 + 数据 + + 编辑 + 移除 +
+ + +
+ +
+
+ +partial('data/fund-mdfund-form.phtml'); ?> \ No newline at end of file diff --git a/application/admin/views/scripts/data/fund-data-list.phtml b/application/admin/views/scripts/data/fund-data-list.phtml index 1875c90d..14be2af7 100644 --- a/application/admin/views/scripts/data/fund-data-list.phtml +++ b/application/admin/views/scripts/data/fund-data-list.phtml @@ -17,24 +17,8 @@ table thead tr th {background:#EBF2F6;}
- + partial('data/fund-nav.phtml',array('ac'=>$this->ac,'uuid'=>$this->uuid)); ?>
- md)) { ?> -
- ct)) { ?> - 为此数据添加项目 - - 返回 -
点击“添加此项目”即可将项目添加到元数据
- -

md['title'] ?>》 的支持项目

-
-
-
@@ -68,33 +52,59 @@ table thead tr th {background:#EBF2F6;}
paginator)): ?> - + - - - - - + + + + + + + - page > 1) + { + $autoindex = ($this->page - 1) * $this->pagelimit; + }else{ + $autoindex=0; + } foreach ($this->paginator as $item): $autoindex++;?> - md)) { ?> - - - - - + + - + + + - +
名称项目编号项目类型数据个数操作项目名称 + + + 编号 + + + 类型 + + + 英文标题 + + + 英文类型 + + + 操作
+ []  + + - 查看数据 + 数据 + 编辑 + 删除
@@ -103,11 +113,4 @@ table thead tr th {background:#EBF2F6;}
- - + \ No newline at end of file diff --git a/application/admin/views/scripts/data/fund-data-search.phtml b/application/admin/views/scripts/data/fund-data-search.phtml new file mode 100644 index 00000000..52082caf --- /dev/null +++ b/application/admin/views/scripts/data/fund-data-search.phtml @@ -0,0 +1,107 @@ +headTitle($this->config->title->site); +$this->headTitle('后台管理'); +$this->headTitle()->setSeparator(' - '); +$this->breadcrumb('首页'); +$this->breadcrumb('数据管理'); +$this->breadcrumb('项目管理'); +$this->breadcrumb()->setSeparator(' > '); +$this->theme->AppendPlus($this,'colorbox'); +$this->theme->AppendPlus($this,'admin_plugin'); +$this->theme->AppendModel($this,'admin-data-fund'); +?> + +
+
+ partial('data/left.phtml'); ?> +
+
+
+ partial('data/fund-nav.phtml',array('ac'=>$this->ac,'uuid'=>$this->uuid)); ?> +
+
+

md['title']; ?> 查看

+
+ + + + + + +
+
+ error)) { ?> + error ?> + + msg)) { ?> + msg ?> + + +
+ paginator)): ?> + + + + + + + + + + + + + + page > 1) + { + $autoindex = ($this->page - 1) * $this->pagelimit; + }else{ + $autoindex=0; + } + foreach ($this->paginator as $item): + $autoindex++;?> + + + + + + + + + + + +
项目名称 + + + 编号 + + + 类型 + + + 英文标题 + + + 英文类型 + + + 操作
+ []  + 项目编辑 + 数据 + + + 移除 +
+ + +
+ +
+
+ +partial('data/fund-mdfund-form.phtml'); ?> \ No newline at end of file diff --git a/application/admin/views/scripts/data/fund-data.phtml b/application/admin/views/scripts/data/fund-data.phtml index ba9fec7b..77883a6c 100644 --- a/application/admin/views/scripts/data/fund-data.phtml +++ b/application/admin/views/scripts/data/fund-data.phtml @@ -1,13 +1,14 @@ headTitle($this->config->title->site); -$this->headTitle($this->config->title->author); +$this->headTitle('后台管理'); $this->headTitle()->setSeparator(' - '); $this->breadcrumb('首页'); $this->breadcrumb('数据管理'); -$this->breadcrumb('支持项目'); +$this->breadcrumb('项目管理'); $this->breadcrumb()->setSeparator(' > '); $this->theme->AppendPlus($this,'colorbox'); $this->theme->AppendPlus($this,'admin_plugin'); +$this->theme->AppendModel($this,'admin-data-fund'); ?>