diff --git a/application/admin/views/scripts/data/fund.phtml b/application/admin/views/scripts/data/fund.phtml index 741a5f6f..f3e7cb89 100644 --- a/application/admin/views/scripts/data/fund.phtml +++ b/application/admin/views/scripts/data/fund.phtml @@ -89,7 +89,11 @@ table thead tr th {background:#EBF2F6;} paginator as $item): $autoindex++;?> + md)) { ?> +
"; - print_r($body); - echo ""; - - return true; - }// 元数据处理 - - }//metadata() - - /* - * jsonexit() 退出并返回json数据 - * - * param array $data 要返回的JSON数据,可以是任意数组 - * - * return JSON-response - */ - public function jsonexit($data){ - $this->getResponse()->setHeader('Content-Type', 'application/json')->appendBody(Zend_Json::encode($data)); - return true; - }//jsonexit() 退出并返回json数据 - - private function genRandomString($len) - { - $chars = array( - "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", - "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", - "w", "x", "y", "z", "A", "B", "C", "D", "E", "F", "G", - "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", - "S", "T", "U", "V", "W", "X", "Y", "Z", "0", "1", "2", - "3", "4", "5", "6", "7", "8", "9" - ); - $charsLen = count($chars) - 1; - - shuffle($chars); // 将数组打乱 - - $output = ""; - for ($i=0; $i<$len; $i++) - { - $output .= $chars[mt_rand(0, $charsLen)]; - } - return $output; - } - - //ajax 提示框 - public function alertbox($type='',$body){ - if($type == "error") - { - $img = ''; - $text = '
"; + print_r($body); + echo ""; + + return true; + }// 元数据处理 + + }//metadata() + + public function fundAction() + { + //$this->_helper->layout->setLayout('administry'); + $ac = $this->_getParam('ac'); + $submit = $this->_getParam('submit'); + + include_once("data/Fund.php"); + $fund = new Fund($this->db); + + $auth = Zend_Auth::getInstance(); + if($auth->hasIdentity()) + { + $user = $auth->getIdentity(); + $uid = $user->id; + }else{ + exit("请重新登录"); + } + + if($ac=='index' || empty($ac)) + { + $uuid = $this->_getParam('uuid'); + if(empty($uuid)) + { + $rows = $fund->fetch(0,true,$uid); + $fund->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); + } + 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 = "/author/fund/"; + return true; + }else{ + $this->view->data = $data; + $this->view->error = "添加失败,请重试"; + return true; + } + } + return true; + }//add + + if($ac == "edit") + { + $this->_helper->viewRenderer('fund-add'); + $id = $this->_getParam('id'); + + if(empty($id)) + { + $this->view->AlertType = "alert-error"; + $this->view->msg = "参数错误"; + $this->view->jump_url = "/author/fund/"; + } + + if(!empty($submit)) + { + $data = $fund->_getParams($this->_request); + $data['userid'] = $uid; + $state = $fund->update($data,$id,$uid); + if( $state == true) + { + $this->view->AlertType = "alert-success"; + $this->view->msg = "修改成功!"; + $this->view->jump_url = "/author/fund/"; + return true; + }else{ + $this->view->data = $data; + if(is_string($state)) + { + $this->view->error = $state; + }else{ + $this->view->error = "修改失败,请重试"; + } + return true; + } + }else{ + $this->view->data = $fund->view($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,$uid) == 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,true,$uid); + }else{ + $this->view->ct = "ct"; + $rows = $fund->fetch($uuid,false,$uid); + } + + include('data/Metadata.php'); + $md = new Metadata($this->db); + $this->view->md = $md->view($uuid); + + $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 + + /* + * jsonexit() 退出并返回json数据 + * + * param array $data 要返回的JSON数据,可以是任意数组 + * + * return JSON-response + */ + public function jsonexit($data){ + $this->getResponse()->setHeader('Content-Type', 'application/json')->appendBody(Zend_Json::encode($data)); + return true; + }//jsonexit() 退出并返回json数据 + + private function genRandomString($len) + { + $chars = array( + "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", + "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", + "w", "x", "y", "z", "A", "B", "C", "D", "E", "F", "G", + "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", + "S", "T", "U", "V", "W", "X", "Y", "Z", "0", "1", "2", + "3", "4", "5", "6", "7", "8", "9" + ); + $charsLen = count($chars) - 1; + + shuffle($chars); // 将数组打乱 + + $output = ""; + for ($i=0; $i<$len; $i++) + { + $output .= $chars[mt_rand(0, $charsLen)]; + } + return $output; + } + + //ajax 提示框 + public function alertbox($type='',$body){ + if($type == "error") + { + $img = ''; + $text = '
请输入元数据标题关键字进行搜索
-400?$this->escape(mb_substr($item['description'],0,400,'UTF-8').'...'):$this->escape($item['description']); ?>
-- 您已经申请该数据(如果长时间没有收到回应请联系数据中心)'; - } - ?> - -
-请输入元数据标题关键字进行搜索
+400?$this->escape(mb_substr($item['description'],0,400,'UTF-8').'...'):$this->escape($item['description']); ?>
++ 您已经申请该数据(如果长时间没有收到回应请联系数据中心)'; + } + ?> + +
+名称 | +编号 | +类型 | + md) { ?> +排序 | + +英文标题 | +英文类型 | + + ct) { ?> +添加 | + +操作 | +|
---|---|---|---|---|---|---|---|---|
= $item['title'] ?> | += $item['fund_id'] ?> | += $item['fund_type'] ?> | + md) { ?> + ct) { ?> ++ + | + + + | = $item['title_en'] ?> | += $item['fund_type_en'] ?> | + + ct) { ?> +添加此项目 | + ++ md)) { ?> + 编辑 + 删除 + + ct)) { ?>排序 + 移除 + + | +
请输入元数据标题关键字进行搜索
- -申请次数: (查看详细)
-请输入元数据标题关键字进行搜索
+ +申请次数: (查看详细)
+