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,date(s.ts_created) as 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 myreviewAction(){ $auth = Zend_Auth::getInstance(); if($auth->hasIdentity()) { $user = $auth->getIdentity(); $uid = $user->id; }else{ $this->_redirect('/account/login/?href=/review/myreview'); } $page=@(int)$this->_request->getParam('page'); if (empty($page)) $page=1; $offset=$this->limit*($page-1); $row=$this->db->fetchAll("select count(s.*) from mdstatus s left join normalmetadata m on s.uuid=m.uuid where m.uuid in (select uuid from mdexpertreview er where er.id=$uid union select uuid from mdreview r where r.userid=$uid)"); $sum=$row[0]['count']; $sql="select m.uuid,m.title,m.id,m.description,s.status,s.ts_accepted,s.ts_finished,g.id as gid,t.filename from mdstatus s left join normalmetadata m on s.uuid=m.uuid left join geonetworkmetadata g on g.uuid=m.uuid left join thumbnail t on t.id=m.id where m.uuid in (select uuid from mdexpertreview er where er.id=$uid union select uuid from mdreview r where r.userid=$uid) order by s.ts_created desc,m.title limit ? offset ?"; $this->view->metadata=$this->db->fetchAll($sql,array($this->limit,$offset)); $this->view->page=new Pagination($sum,$page,$this->limit); foreach($this->view->metadata as $k=>$v) { $this->view->metadata[$k]['statustext']=$this->rewritestatus($v['status']); } }//我参审的 function draftAction(){ $page=@(int)$this->_request->getParam('page'); if (empty($page)) $page=1; $offset=$this->limit*($page-1); $row=$this->db->fetchAll("select count(s.*) from mdstatus s left join metadata m on s.uuid=m.uuid where s.status in (0)"); $sum=$row[0]['count']; $sql="select m.uuid,m.title,m.id,m.description,s.status,s.ts_created,g.id as gid,t.filename from mdstatus s left join metadata m on s.uuid=m.uuid left join geonetworkmetadata g on g.uuid=m.uuid left join thumbnail t on t.id=m.id where s.status in (0) order by s.ts_created desc,m.title limit ? offset ?"; $this->view->metadata=$this->db->fetchAll($sql,array($this->limit,$offset)); $this->view->page=new Pagination($sum,$page,$this->limit); }//最新收稿 function acceptAction(){ $page=@(int)$this->_request->getParam('page'); if (empty($page)) $page=1; $offset=$this->limit*($page-1); $row=$this->db->fetchAll("select count(s.*) from mdstatus s left join normalmetadata m on s.uuid=m.uuid where s.status in (1)"); $sum=$row[0]['count']; $sql="select m.uuid,m.title,m.id,m.description,s.status,s.ts_accepted,g.id as gid,t.filename from mdstatus s left join normalmetadata m on s.uuid=m.uuid left join geonetworkmetadata g on g.uuid=m.uuid left join thumbnail t on t.id=m.id where s.status in (1) order by s.ts_created desc,m.title limit ? offset ?"; $this->view->metadata=$this->db->fetchAll($sql,array($this->limit,$offset)); $this->view->page=new Pagination($sum,$page,$this->limit); }//最新收稿 function inreviewAction(){ $page=@(int)$this->_request->getParam('page'); if (empty($page)) $page=1; $offset=$this->limit*($page-1); $row=$this->db->fetchAll("select count(s.*) from mdstatus s left join normalmetadata m on s.uuid=m.uuid where s.status in (2,3,4)"); $sum=$row[0]['count']; $sql="select m.uuid,m.title,m.id,m.description,s.status,s.ts_accepted,g.id as gid,t.filename from mdstatus s left join normalmetadata m on s.uuid=m.uuid left join geonetworkmetadata g on g.uuid=m.uuid left join thumbnail t on t.id=m.id where s.status in (2,3,4) order by s.ts_created desc,m.title limit ? offset ?"; $this->view->metadata=$this->db->fetchAll($sql,array($this->limit,$offset)); $this->view->page=new Pagination($sum,$page,$this->limit); }//在审阶段的元数据 function reviewedAction(){ $page=@(int)$this->_request->getParam('page'); if (empty($page)) $page=1; $offset=$this->limit*($page-1); $row=$this->db->fetchAll("select count(s.*) from mdstatus s left join normalmetadata m on s.uuid=m.uuid where s.status in (5)"); $sum=$row[0]['count']; $sql="select m.uuid,m.title,m.id,m.description,s.status,s.ts_finished,g.id as gid,t.filename from mdstatus s left join normalmetadata m on s.uuid=m.uuid left join geonetworkmetadata g on g.uuid=m.uuid left join thumbnail t on t.id=m.id where s.status in (5) order by s.ts_created desc,m.title limit ? offset ?"; $this->view->metadata=$this->db->fetchAll($sql,array($this->limit,$offset)); $this->view->page=new Pagination($sum,$page,$this->limit); }//已完成评审的元数据 function rewritestatus($status){ if($status==-1) {return "取消评审";} else if($status==0) {return "投稿元数据";} else if($status==1) {return "接收元数据";} else if($status==2) {return "专家评审中";} else if($status==3) {return "专家评审中";} else if($status==4) {return "专家反馈";} else if($status==5) {return "已发布";} else {return "";} }//function rewriterstatus function replace($string){ $patterns = array("/\"/i","/\'/i"); $replacements = array("“","‘"); ksort($patterns); ksort($replacements); return preg_replace($patterns, $replacements, $string); } function reviewAction() { $uuid = $this->_request->getParam('uuid'); $sql=$this->db->quoteInto("select m.id,m.uuid,m.title,m.description,m.title_en,r.status from metadata m left join mdstatus r on r.uuid=m.uuid where m.uuid=?",$uuid); $md = $this->db->fetchRow($sql); $this->view->metadata = $md; $auth = Zend_Auth::getInstance(); if($auth->hasIdentity()) { $user = $auth->getIdentity(); $userid = $user->id; $sql = "select * from mdreview where userid='$userid' and uuid='$uuid'"; $rs = $this->db->query($sql); $row = $rs->fetch(); $this->view->review = $row; } }//reviewAction() function allreviewAction(){ $this->_helper->layout->disableLayout(); $this->_helper->viewRenderer->setNoRender(); $uuid = $this->_request->getParam('uuid'); $sql = "select r.uuid,r.userid,r.ts_created,u.realname,r.mdcomment,r.conclusion from mdreview r left join users u on u.id=r.userid where r.uuid='$uuid' and r.status>-1"; $rs = $this->db->query($sql); $rows = $rs->fetchAll(); $paginator = Zend_Paginator::factory($rows); $paginator->setCurrentPageNumber($this->_getParam('page')); $paginator->setItemCountPerPage(5); $paginator->setView($this->view); Zend_View_Helper_PaginationControl::setDefaultViewPartial('review/pagination_ajax.phtml'); $list = ""; foreach($paginator as $k=>$v) { $list.='
'.str_replace(array("\r\n", "\n", "\r"),'
',$v['mdcomment']).'
暂无评审数据
"; } $stringbuffer = "