diff --git a/application/admin/controllers/DataController.php b/application/admin/controllers/DataController.php index 616c90fc..88297844 100755 --- a/application/admin/controllers/DataController.php +++ b/application/admin/controllers/DataController.php @@ -1,6 +1,7 @@ db->select(); - $select->from('mdref',array('id as mdid','refid','place')) - ->join('metadata','metadata.uuid=mdref.uuid') - ->join('reference','reference.id=mdref.refid') - ->order('metadata.ts_created desc') - ->order('mdref.place'); - $paginator = Zend_Paginator::factory($select); + else{ + $sql="select m.title as mdtitle,m.uuid,mr.id as mdid,mr.refid,mr.place,r.reference + from mdref mr right join metadata m on mr.uuid=m.uuid + left join reference r on mr.refid=r.id + order by m.ts_created desc,mr.place"; + $re=$this->db->query($sql); + $row=$re->fetchAll(); + $paginator = Zend_Paginator::factory($row); $paginator->setCurrentPageNumber($this->_getParam('page')); $paginator->setItemCountPerPage(30); $paginator->setView($this->view); @@ -1122,13 +1123,36 @@ class Admin_DataController extends Zend_Controller_Action { $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')); $reference = new Reference(); + if(!empty($keyword)) + { + $reference->keyword = $keyword; + } + + if(!empty($order)) + { + $reference->order = $order; + } + + if(!empty($sort)) + { + $reference->sort = $sort; + } + //文献首页 if(empty($ac)) { - view::addPaginator($reference->fetchReferences(),$this,10); + view::addPaginator($reference->fetchReferences(),$this,12); + return true; + } + else if ($ac == "water") + { + view::addPaginator($reference->fetchThemeReferences('water'),$this,10); return true; } @@ -1137,9 +1161,13 @@ class Admin_DataController extends Zend_Controller_Action { $this->_helper->viewRenderer('ref-add'); $id = $this->_getParam('id'); + $attid = $this->_getParam('attid'); if(!empty($submit)) { + $this->view->data = $reference->getReferenceParam(); + $attid = $this->view->data['attid']; + if(empty($id) || !is_numeric($id)) { $status = $reference->reference(); @@ -1154,18 +1182,30 @@ class Admin_DataController extends Zend_Controller_Action if(!empty($id)) { $msg = "文献修改成功!"; + view::Post($this,$msg,-2); + return true; }else{ $msg = "文献添加成功!"; + view::Post($this,$msg,"/admin/data/ref/ac/add"); + return true; } - view::Post($this,$msg,"/admin/data/ref/ac/add"); } }else{ + $this->view->data = array(); if(!empty($id) && is_numeric($id)) { $this->view->data = $reference->getOneReferenceData($id); } } + if(!empty($attid)) + { + $files = new Files(); + $attfile = $files->getOne($attid); + $this->view->data['attid'] = $attid; + $this->view->data['file'] = $attfile; + } + return true; } @@ -1174,7 +1214,12 @@ class Admin_DataController extends Zend_Controller_Action { $this->_helper->layout->disableLayout(); $this->_helper->viewRenderer->setNoRender(); - $statu = $reference->uploadReferencePdf($_FILES['Filedata']); + $autoread = false; + if($this->_getParam('multi')) + { + $autoread = true; + } + $statu = $reference->uploadReferencePdf($_FILES['Filedata'],$autoread); $this->jsonexit($statu); return true; } @@ -1189,6 +1234,35 @@ class Admin_DataController extends Zend_Controller_Action return true; } + //批量上传 + if($ac == "multiupload") + { + $this->_helper->viewRenderer('ref-multiupload'); + return true; + } + + //文件管理 + if($ac == "files") + { + $this->_helper->viewRenderer('ref-files'); + view::addPaginator($reference->getReferenceFiles(),$this,10); + return true; + } + + //删除文献 + if($ac == "deleteref") + { + $refid = $this->_getParam('id'); + if($reference->deleteReference($refid)) + { + view::Post($this,"删除成功!",-1); + }else{ + view::Post($this,"删除失败!",-1); + } + return true; + } + + }//文献管理 refAction() /* @@ -2567,7 +2641,7 @@ class Admin_DataController extends Zend_Controller_Action }else{ $mail->addTo($this->debug_email); } - @$mail->send(); + //@$mail->send(); $data = array("commited"=>1,"error"=>'该版本已经成功发布!'); $this->jsonexit($data); @@ -3488,13 +3562,13 @@ class Admin_DataController extends Zend_Controller_Action if(empty($uuid)) { $rows = $fund->fetch(NULL,true,0,$keyword); - view::addPaginator($rows,$this->view,$this->_request); + view::addPaginator($rows,$this,10); }else{ include('data/Metadata.php'); $md = new Metadata($this->db); $this->view->md = $md->view($uuid); $rows = $fund->fetch($uuid); - view::addPaginator($rows,$this->view,$this->_request); + view::addPaginator($rows,$this,10); } return true; } @@ -3504,7 +3578,7 @@ class Admin_DataController extends Zend_Controller_Action $this->_helper->viewRenderer('fund-data-list'); $this->view->q = $q = $this->_getParam('q'); $rows = $fund->fetchFromData(true,0,$q); - view::addPaginator($rows,$this->view,$this->_request); + view::addPaginator($rows,$this,10); return true; } @@ -3515,7 +3589,7 @@ class Admin_DataController extends Zend_Controller_Action $id = $this->_getParam('id'); $this->view->fund = $fund->view($id); $rows = $fund->fetchFromData($id,0,$q); - view::addPaginator($rows,$this->view,$this->_request); + view::addPaginator($rows,$this,10); return true; } @@ -3647,7 +3721,7 @@ class Admin_DataController extends Zend_Controller_Action $md = new Metadata($this->db); $this->view->md = $md->view($uuid); - view::addPaginator($rows,$this->view,$this->_request); + view::addPaginator($rows,$this,10); return true; }//formd @@ -3695,7 +3769,7 @@ class Admin_DataController extends Zend_Controller_Action } $rows = $fund->getData($id,$keyword); - view::addPaginator($rows,$this->view,$this->_request); + view::addPaginator($rows,$this,10); } }//fund @@ -3716,7 +3790,7 @@ class Admin_DataController extends Zend_Controller_Action if(empty($uuid)) { $rows = $doi->fetch(0,$q); - view::addPaginator($rows,$this->view,$this->_request); + view::addPaginator($rows,$this,10); }else{ $this->_redirect('/admin/data/doi/ac/edit/?uuid='.$uuid); return true; diff --git a/application/admin/controllers/DownController.php b/application/admin/controllers/DownController.php index c153ee28..b28592ff 100644 --- a/application/admin/controllers/DownController.php +++ b/application/admin/controllers/DownController.php @@ -170,6 +170,7 @@ class Admin_DownController extends Zend_Controller_Action //离线数据申请管理 function offlineappAction() { + set_time_limit(0); include_once("Dataorder.php"); $DO = new Dataorder($this->db); @@ -181,8 +182,23 @@ class Admin_DownController extends Zend_Controller_Action $page =(int)$this->_getParam('page'); $reset =(int)$this->_getParam('reset'); $status =(int)$this->_getParam('status'); + $ac = $this->_getParam('ac'); $q = $this->_getParam('q'); + if($ac == "pending") + { + $keyword = ""; + if(!empty($q)) + { + $keyword = $q; + } + + $rows = $DO->fetchAllOfflineApp(3,$keyword); + + view::addPaginator($rows,$this,10); + return true; + } + if (!$page) $page=1; if ($view) { //查看此次申请的pdf @@ -215,10 +231,10 @@ class Admin_DownController extends Zend_Controller_Action //如果是wsn数据则生成数据 $dataservice = new DataService(); - $offlineapp = new Offlineapp(); - if ($offlineapp->hasWsnData($start)) - { - @$dataservice->makeWsnData(array('uid'=>$row['userid'],'action'=>'prepare')); + $offlineapp = new Offlineapp(); + if ($offlineapp->hasWsnData($start)) + { + @$dataservice->makeWsnData(array('uid'=>$row['userid'],'action'=>'prepare')); } $sql="select applicationform as pdflink from offlineapp where id=?"; @@ -547,14 +563,14 @@ class Admin_DownController extends Zend_Controller_Action //$this->_redirect('/admin/down/offlineapp/'.$page); } - //如果是wsn数据则生成数据 + //如果是wsn数据则生成数据 //wsn数据在ftp服务器端进行处理 /*$dataservice = new DataService(); @$dataservice->makeWsnData();*/ $sql="update dataorder set status=5,ts_approved=now() where offlineappid=?"; $this->db->query($sql,array($finish)); - $sql="update offlineapp set ts_approved=now() where id=? and ts_approved is null"; + $sql="update offlineapp set ts_approved=now(),status=5 where id=? and ts_approved is null"; $this->db->query($sql,array($finish)); $sql="select * from offlineapp where id=?"; $row=$this->db->fetchRow($sql,array($finish)); @@ -1122,7 +1138,7 @@ class Admin_DownController extends Zend_Controller_Action } $select=$this->db->select(); - $select->from('offlineapp')->where('ts_approved is not null')->where('pdflink is not null')->where('status=0')->order('ts_created desc'); + $select->from('offlineapp')->where('ts_approved is not null')->where('pdflink is not null')->where('status>=0')->order('ts_created desc'); $paginator = Zend_Paginator::factory($select); $paginator->setCurrentPageNumber($this->_getParam('page')); $paginator->setItemCountPerPage($this->view->config->page->max); diff --git a/application/admin/views/scripts/data/ref-add.phtml b/application/admin/views/scripts/data/ref-add.phtml index e9b4f818..ed074b1c 100644 --- a/application/admin/views/scripts/data/ref-add.phtml +++ b/application/admin/views/scripts/data/ref-add.phtml @@ -45,6 +45,12 @@ table thead tr th {background:#EBF2F6;} +