diff --git a/application/default/controllers/AuthorController.php b/application/default/controllers/AuthorController.php index 83480790..1f4dde7d 100644 --- a/application/default/controllers/AuthorController.php +++ b/application/default/controllers/AuthorController.php @@ -1406,6 +1406,89 @@ class AuthorController extends Zend_Controller_Action } } - + function versionAction() + { + $ac = $this->_request->getParam('ac'); + $uuid = $this->_request->getParam('uuid'); + + $auth = Zend_Auth::getInstance(); + if($auth->hasIdentity()) + { + $user = $auth->getIdentity(); + $u_id = $user->id; + } + + if (!empty($uuid) && empty($ac)) + { + //view the versions of the data + $sql = "SELECT md.title,md.uuid,v.ts_created,v.changelog,v.userid,v.id FROM mdversion v + LEFT JOIN metadata md ON md.uuid=v.uuid + LEFT JOIN mdauthor a ON md.uuid=a.uuid + WHERE md.title IS NOT NULL AND a.userid=? and v.uuid=? + order by v.ts_created desc + "; + $sth = $this->db->prepare($sql); + $sth->execute(array($u_id,$uuid)); + $rows = $sth->fetchAll(); + @$this->view->mdtitle=$rows[0]['title']; + + $paginator = Zend_Paginator::factory($rows); + $paginator->setCurrentPageNumber($this->_getParam('page')); + $paginator->setItemCountPerPage(15); + $paginator->setView($this->view); + Zend_View_Helper_PaginationControl::setDefaultViewPartial('pagination_param.phtml'); + $this->view->paginator=$paginator; + } + else if((empty($ac) && empty($uuid))|| $ac=='list') + { + $sql = "SELECT md.title,md.uuid,v.ts_created,v.changelog,v.userid,v.id FROM mdversion v + LEFT JOIN metadata md ON md.uuid=v.uuid + LEFT JOIN mdauthor a ON md.uuid=a.uuid + WHERE md.title IS NOT NULL AND a.userid=? + order by v.ts_created desc + "; + $sth = $this->db->prepare($sql); + $sth->execute(array($u_id)); + $rows = $sth->fetchAll(); + + + $paginator = Zend_Paginator::factory($rows); + $paginator->setCurrentPageNumber($this->_getParam('page')); + $paginator->setItemCountPerPage(15); + $paginator->setView($this->view); + Zend_View_Helper_PaginationControl::setDefaultViewPartial('pagination_param.phtml'); + $this->view->paginator=$paginator; + } + else if($ac=="bydata") + { + $keywords = $this->_request->getParam('q'); + if(!empty($keywords)) + $this->view->q = $keywords; + $sql = "SELECT md.title,md.uuid,count(v.id) as c FROM mdversion v + LEFT JOIN metadata md ON md.uuid=v.uuid + LEFT JOIN mdauthor a ON md.uuid=a.uuid + WHERE md.title IS NOT NULL AND a.userid=?"; + if(!empty($keywords)) + { + $search=new Search($keywords); + $where=$search->sql_expr(array("md.title","md.description")); + $sql.=' and '.$where; + } + $sql.=" group by md.uuid,md.title"; + + $sth = $this->db->prepare($sql); + $sth->execute(array($u_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; + + $this->_helper->viewRenderer('version-bydata'); + } + }// versionAction() 数据版本管理 } diff --git a/application/default/views/scripts/author/version-bydata.phtml b/application/default/views/scripts/author/version-bydata.phtml new file mode 100644 index 00000000..733fa6c3 --- /dev/null +++ b/application/default/views/scripts/author/version-bydata.phtml @@ -0,0 +1,53 @@ +headTitle($this->config->title->site); +$this->headTitle($this->config->title->author); +$this->headTitle()->setSeparator(' - '); +$this->headScript()->appendFile('/js/jquery-1.7.min.js'); +$this->headLink()->appendStylesheet('/css/author.css'); +$this->breadcrumb('首页'); +$this->breadcrumb('数据作者'); +$this->breadcrumb('数据版本管理'); +$this->breadcrumb()->setSeparator(' > '); +?> + +
+ + + +请输入元数据标题关键字进行搜索
+ +数据库中共有版本数: (查看详细)
++ 【查看此数据所有版本】
+版本创建时间: + + 删除 + + 恢复到geonetwork + 与前一版对比 + 提交评审发布 +
+ + + +