diff --git a/application/default/controllers/DataController.php b/application/default/controllers/DataController.php index 0ab51b1b..bae1277e 100755 --- a/application/default/controllers/DataController.php +++ b/application/default/controllers/DataController.php @@ -1947,7 +1947,76 @@ class DataController extends Zend_Controller_Action $paginator->setView($this->view); Zend_View_Helper_PaginationControl::setDefaultViewPartial('pagination_param.phtml'); $this->view->paginator=$paginator; - + } + + //基于数据作者的浏览(包括认证后的数据作者以及未认证的数据作者) + function authorAction() + { + $ac = $this->_request->getParam('ac'); + $id = (int)$this->_request->getParam('id'); + if ($ac=='verified') { + //已经认证过的数据作者 + $this->view->pageID='author-verified'; + $this->view->ac='verified'; + if ($id) { + //列出作者的数据 + $sql="select username,realname from users where id=?"; + $this->view->author=$this->db->fetchRow($sql,array($id)); + $sql="select m.* from normalmetadata m left join mdauthor a on a.uuid=m.uuid where a.userid=?"; + $sth = $this->db->prepare($sql); + $sth->execute(array($id)); + $rows = $sth->fetchAll(); + $paginator = Zend_Paginator::factory($rows); + $paginator->setCurrentPageNumber($this->_getParam('page')); + $paginator->setItemCountPerPage(10); + $paginator->setView($this->view); + Zend_View_Helper_PaginationControl::setDefaultViewPartial('pagination_param.phtml'); + $this->view->paginator=$paginator; + } else { + //已经认证过的数据作者 + $sql="select u.username,u.realname,u.id,count(u.id) as count from mdauthor a left join users u on a.userid=u.id where a.status=1 and a.uuid in (select uuid from normalmetadata) group by u.id,u.username,u.realname"; + $sth = $this->db->prepare($sql); + $sth->execute(); + $rows = $sth->fetchAll(); + $paginator = Zend_Paginator::factory($rows); + $paginator->setCurrentPageNumber($this->_getParam('page')); + $paginator->setItemCountPerPage(50); + $paginator->setView($this->view); + Zend_View_Helper_PaginationControl::setDefaultViewPartial('pagination_param.phtml'); + $this->view->paginator=$paginator; + } + } else if ($ac=='unverified' || empty($ac)) { + //未认证的数据作者 + $this->view->pageID='author-unverified'; + $this->view->ac='unverified'; + if ($id) { + //列出数据 + $sql="select individual as username from responsible where id=?"; + $this->view->author=$this->db->fetchRow($sql,array($id)); + $sql="select distinct m.* from normalmetadata m left join role r on m.uuid=r.uuid left join responsible s on r.resid=s.id where r.role in ('pointOfContact','resourceProvider','owner') and s.id=?"; + $sth = $this->db->prepare($sql); + $sth->execute(array($id)); + $rows = $sth->fetchAll(); + $paginator = Zend_Paginator::factory($rows); + $paginator->setCurrentPageNumber($this->_getParam('page')); + $paginator->setItemCountPerPage(10); + $paginator->setView($this->view); + Zend_View_Helper_PaginationControl::setDefaultViewPartial('pagination_param.phtml'); + $this->view->paginator=$paginator; + } else { + //列出所有作者 + $sql="select distinct responsible.individual as username,responsible.id from responsible left join role on role.resid=responsible.id where role.role in ('pointOfContact','resourceProvider','owner')"; + $sth = $this->db->prepare($sql); + $sth->execute(); + $rows = $sth->fetchAll(); + $paginator = Zend_Paginator::factory($rows); + $paginator->setCurrentPageNumber($this->_getParam('page')); + $paginator->setItemCountPerPage(50); + $paginator->setView($this->view); + Zend_View_Helper_PaginationControl::setDefaultViewPartial('pagination_param.phtml'); + $this->view->paginator=$paginator; + } + } } } diff --git a/application/default/views/scripts/data/author.phtml b/application/default/views/scripts/data/author.phtml new file mode 100644 index 00000000..45b1903e --- /dev/null +++ b/application/default/views/scripts/data/author.phtml @@ -0,0 +1,68 @@ +headTitle($this->config->title->site); +$this->headTitle($this->config->title->data); +$this->headTitle('数据作者浏览'); +$this->headTitle()->setSeparator(' - '); +$this->breadcrumb('首页'); +$this->breadcrumb(''.$this->config->title->data.''); +$this->breadcrumb('数据作者浏览'); +$this->breadcrumb()->setSeparator(' > '); +$this->theme->AppendPlus($this,'colorbox'); +?> +