From 3d47587d58ef12e82d001c0ef9b77485d18fd589 Mon Sep 17 00:00:00 2001 From: Li Jianxuan Date: Thu, 13 Oct 2011 07:56:18 +0000 Subject: [PATCH] =?UTF-8?q?Ticket=20#202=20=E5=A2=9E=E5=8A=A0=E4=BA=86?= =?UTF-8?q?=E6=9F=A5=E7=9C=8B=E6=8E=A5=E6=94=B6=E5=8F=8A=E6=9F=A5=E7=9C=8B?= =?UTF-8?q?=E6=88=91=E5=8F=82=E5=AE=A1=E7=9A=84=E5=85=83=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E7=9A=84=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../default/controllers/ReviewController.php | 196 +++++++++++++----- .../default/views/scripts/review/draft.phtml | 57 +++++ .../views/scripts/review/myreview.phtml | 57 +++++ 3 files changed, 262 insertions(+), 48 deletions(-) create mode 100644 application/default/views/scripts/review/draft.phtml create mode 100644 application/default/views/scripts/review/myreview.phtml diff --git a/application/default/controllers/ReviewController.php b/application/default/controllers/ReviewController.php index 5b388c0d..c26f4530 100644 --- a/application/default/controllers/ReviewController.php +++ b/application/default/controllers/ReviewController.php @@ -1,48 +1,148 @@ -view->config = Zend_Registry::get('config'); - $this->db=Zend_Registry::get('db'); - } - function indexAction() - { - //最新10个收稿 - $sql="select m.uuid,m.title,s.ts_created from mdstatus s left join metadata m on m.uuid=s.uuid where s.status=0 order by s.ts_created desc limit 10"; - $this->view->mdreceived = $this->db->fetchAll($sql); - //最新10个接收 - $sql="select m.uuid,m.title,s.ts_accepted from mdstatus s left join metadata m on m.uuid=s.uuid where s.status=1 order by s.ts_created desc limit 10"; - $this->view->mdaccepted = $this->db->fetchAll($sql); - //最新10个送审 - $sql="select m.uuid,m.title,s.ts_accepted from mdstatus s left join metadata m on m.uuid=s.uuid where s.status in (2,3,4) order by s.ts_created desc limit 10"; - $this->view->mdinreview = $this->db->fetchAll($sql); - //最新10个已审 - $sql="select m.uuid,m.title,s.ts_accepted from mdstatus s left join metadata m on m.uuid=s.uuid where s.status=5 order by s.ts_created desc limit 10"; - $this->view->mdreviewed = $this->db->fetchAll($sql); - //统计数字 - $sql="select (select count(*) from mdexperts) as experts,(select count(*) from mdstatus where status=0) as draft,(select count(*) from mdstatus where status=1) as accept,(select count(*) from mdstatus where status in (2,3,4)) as inreview,(select count(*) from mdstatus where status=5) as reviewed,(select count(*) from mdreview) as openreview,(select count(distinct(userid)) from mdreview) as openreviewuser"; - $this->view->stat=$this->db->fetchRow($sql); - } - /* - * 数据浏览 - */ - function browseAction() - { - $md=new MetadataTable(); - $db=$md->getAdapter(); - $page=(int)$this->_request->getParam('page'); - if (empty($page)) $page=1; - $limit=10; - $offset=$limit*($page-1); - $state=$db->query('select count(*) from metadata'); - $row=$state->fetchAll(); - $sum=$row[0]['count']; - $select=$db->select(); - $select->from('metadata','*')->order('id desc')->limitPage($page,$limit); - $this->view->metadata = $db->fetchAll($select); - $this->view->page=new Pagination($sum,$page,$limit); - } - -} - +view->config = Zend_Registry::get('config'); + $this->db=Zend_Registry::get('db'); + $this->messenger=$this->_helper->getHelper('FlashMessenger'); + $this->view->messages = $this->messenger->getMessages(); + } + function indexAction() + { + //最新10个收稿 + $sql="select m.uuid,m.title,s.ts_created from mdstatus s left join metadata m on m.uuid=s.uuid where s.status=0 order by s.ts_created desc limit 10"; + $this->view->mdreceived = $this->db->fetchAll($sql); + //最新10个接收 + $sql="select m.uuid,m.title,s.ts_accepted from mdstatus s left join metadata m on m.uuid=s.uuid where s.status=1 order by s.ts_created desc limit 10"; + $this->view->mdaccepted = $this->db->fetchAll($sql); + //最新10个送审 + $sql="select m.uuid,m.title,s.ts_accepted from mdstatus s left join metadata m on m.uuid=s.uuid where s.status in (2,3,4) order by s.ts_created desc limit 10"; + $this->view->mdinreview = $this->db->fetchAll($sql); + //最新10个已审 + $sql="select m.uuid,m.title,s.ts_accepted from mdstatus s left join metadata m on m.uuid=s.uuid where s.status=5 order by s.ts_created desc limit 10"; + $this->view->mdreviewed = $this->db->fetchAll($sql); + //统计数字 + $sql="select (select count(*) from mdexperts) as experts,(select count(*) from mdstatus where status=0) as draft,(select count(*) from mdstatus where status=1) as accept,(select count(*) from mdstatus where status in (2,3,4)) as inreview,(select count(*) from mdstatus where status=5) as reviewed,(select count(*) from mdreview) as openreview,(select count(distinct(userid)) from mdreview) as openreviewuser"; + $this->view->stat=$this->db->fetchRow($sql); + } + /* + * 数据浏览 + */ + function browseAction() + { + $md=new MetadataTable(); + $db=$md->getAdapter(); + $page=(int)$this->_request->getParam('page'); + if (empty($page)) $page=1; + $limit=10; + $offset=$limit*($page-1); + $state=$db->query('select count(*) from metadata'); + $row=$state->fetchAll(); + $sum=$row[0]['count']; + $select=$db->select(); + $select->from('metadata','*')->order('id desc')->limitPage($page,$limit); + $this->view->metadata = $db->fetchAll($select); + $this->view->page=new Pagination($sum,$page,$limit); + } + + function myreviewAction(){ + + $keyword = $this->_request->getParam('q'); + $search = $this->_request->getParam('search'); + + try{ + $auth = Zend_Auth::getInstance(); + if($auth->hasIdentity()) + { + $user = $auth->getIdentity(); + $uid = $user->id; + } + else + { + $this->_redirect('/account/login/?href=/review/myreview'); + } + + $wheresql = array(); + $wheresql[]=" mdexp.id=7381 "; + + if(!empty($keyword) && !empty($search)) + { + if (preg_match("/[<|>|#|$|%|^|*|(|)|{|}|'|\"|;|:]/i",$keyword) || !is_numeric($search)) + { + $this->messenger->addMessage('您的输入的搜索条件包含非法请求,请不要输入特殊符号'); + $this->_redirect('/review/myreview'); + }//非法请求过滤 + $this->view->keyword = $keyword; + $wheresql[] = " md.title like '%$keyword%' "; + // e.g. (... or md.author like '%keyword%') + } + + $wheresql = join(' and ',$wheresql); + + $sql = "select mdexp.id,mdexp.uuid,md.title from mdexpertreview mdexp + left join metadata md on md.uuid=mdexp.uuid + where $wheresql"; + + $rs = $this->db->query($sql); + $rows = $rs->fetchAll(); + + $paginator = Zend_Paginator::factory($rows); + $paginator->setCurrentPageNumber($this->_getParam('page')); + $paginator->setItemCountPerPage($this->view->config->page->max); + $paginator->setView($this->view); + Zend_View_Helper_PaginationControl::setDefaultViewPartial('pagination_param.phtml'); + $this->view->paginator=$paginator; + }catch(Exception $e){ + $this->messenger->addMessage('查询失败,请稍后重试 :('); + $this->_redirect('/review/myreview'); + } + + }//我参审的 + + function draftAction(){ + + $keyword = $this->_request->getParam('q'); + $search = $this->_request->getParam('search'); + + try{ + + $wheresql = array(); + $wheresql[]=" ms.status=1 "; + + if(!empty($keyword) && !empty($search)) + { + if (preg_match("/[<|>|#|$|%|^|*|(|)|{|}|'|\"|;|:]/i",$keyword) || !is_numeric($search)) + { + $this->messenger->addMessage('您的输入的搜索条件包含非法请求,请不要输入特殊符号'); + $this->_redirect('/review/myreview'); + }//非法请求过滤 + $this->view->keyword = $keyword; + $wheresql[] = " md.title like '%$keyword%' "; + } + + $wheresql = join(' and ',$wheresql); + + $sql = "select ms.uuid,ms.status,ms.ts_created,md.title,md.author from mdstatus ms + left join metadata md on md.uuid=ms.uuid + where $wheresql"; + + $rs = $this->db->query($sql); + $rows = $rs->fetchAll(); + + $paginator = Zend_Paginator::factory($rows); + $paginator->setCurrentPageNumber($this->_getParam('page')); + $paginator->setItemCountPerPage($this->view->config->page->max); + $paginator->setView($this->view); + Zend_View_Helper_PaginationControl::setDefaultViewPartial('pagination_param.phtml'); + $this->view->paginator=$paginator; + + }catch(Exception $e){ + $this->messenger->addMessage('查询失败,请稍后重试 :('); + $this->_redirect('/review/draft'); + } + + }//最新收稿 + +} + diff --git a/application/default/views/scripts/review/draft.phtml b/application/default/views/scripts/review/draft.phtml new file mode 100644 index 00000000..8a1806fb --- /dev/null +++ b/application/default/views/scripts/review/draft.phtml @@ -0,0 +1,57 @@ +headTitle($config->title->site); +$this->headTitle($config->title->mdreview); +$this->headTitle()->setSeparator(' - '); +$this->headLink()->appendStylesheet('/css/mdreview.css'); +$this->breadcrumb('首页'); +$this->breadcrumb('元数据评审'); +$this->breadcrumb()->setSeparator(' > '); +?> +
+ +msg or $this->messages) :?> +
+msg) : ?> + msg; ?> +messages): foreach($this->messages as $msg): ?> + + + +
+ + +

最新收稿的元数据:

+ +
+ + +
+ + + + + + + + + + paginator)): + $autoindex=0; + foreach ($this->paginator as $item): + $autoindex++;?> + + + + + + +
元数据标题收稿时间
+ +
+ + +
\ No newline at end of file diff --git a/application/default/views/scripts/review/myreview.phtml b/application/default/views/scripts/review/myreview.phtml new file mode 100644 index 00000000..d4c00d37 --- /dev/null +++ b/application/default/views/scripts/review/myreview.phtml @@ -0,0 +1,57 @@ +headTitle($config->title->site); +$this->headTitle($config->title->mdreview); +$this->headTitle()->setSeparator(' - '); +$this->headLink()->appendStylesheet('/css/mdreview.css'); +$this->breadcrumb('首页'); +$this->breadcrumb('元数据评审'); +$this->breadcrumb()->setSeparator(' > '); +?> +
+ +msg or $this->messages) :?> +
+msg) : ?> + msg; ?> +messages): foreach($this->messages as $msg): ?> + + + +
+ + +

我参审的元数据:

+ +
+ + +
+ + + + + + + + + + paginator)): + $autoindex=0; + foreach ($this->paginator as $item): + $autoindex++;?> + + + + + + +
元数据标题操作
+ 提交评审意见 +
+ + +
\ No newline at end of file