diff --git a/module/doc/control.php b/module/doc/control.php index 1121c71599..8ceb4f11ee 100644 --- a/module/doc/control.php +++ b/module/doc/control.php @@ -152,10 +152,17 @@ class doc extends control $this->session->set('searchDoc', ''); } + $libs = array(); + if($browseType == 'collectedbyme') + { + $libs = $this->doc->getAllLibsByType('collector'); + $this->view->itemCounts = $this->doc->statLibCounts(array_keys($libs)); + } + $this->view->title = $title; $this->view->libID = $libID; $this->view->moduleID = $moduleID; - $this->view->modules = $this->doc->getDocMenu($libID, $moduleID, $orderBy == 'title_asc' ? 'name_asc' : 'id_desc'); + $this->view->modules = $this->doc->getDocMenu($libID, $moduleID, $orderBy == 'title_asc' ? 'name_asc' : 'id_desc', $browseType); $this->view->docs = $this->doc->getDocsByBrowseType($libID, $browseType, $queryID, $moduleID, $sort, $pager); $this->view->users = $this->loadModel('user')->getPairs('noletter'); $this->view->orderBy = $orderBy; @@ -164,6 +171,7 @@ class doc extends control $this->view->type = $type; $this->view->from = $from; $this->view->pager = $pager; + $this->view->libs = $libs; $this->display(); } diff --git a/module/doc/model.php b/module/doc/model.php index 33ffe6bfda..d81b91560f 100644 --- a/module/doc/model.php +++ b/module/doc/model.php @@ -789,9 +789,14 @@ class docModel extends model * @access public * @return array */ - public function getDocMenu($libID, $parent, $orderBy = 'name_asc') + public function getDocMenu($libID, $parent, $orderBy = 'name_asc', $browseType = '') { - $modules = $this->dao->select('*')->from(TABLE_MODULE)->where('root')->eq($libID) + if($libID == 0 and $browseType != 'collectedbyme') return array(); + + $modules = $this->dao->select('*')->from(TABLE_MODULE) + ->where(1) + ->beginIF($browseType != "collectedbyme")->andWhere('root')->eq($libID)->fi() + ->beginIF($browseType == "collectedbyme")->andWhere('collector')->like("%,{$this->app->user->account},%")->fi() ->andWhere('type')->eq('doc') ->andWhere('parent')->eq($parent) ->andWhere('deleted')->eq(0) @@ -948,13 +953,17 @@ class docModel extends model { if($product and $type == 'project') $projects = $this->dao->select('*')->from(TABLE_PROJECTPRODUCT)->where('product')->eq($product)->fetchPairs('project', 'project'); - $libs = $this->getLibs($type); + $libs = $this->getLibs($type == 'collector' ? 'all' : $type); $key = ($type == 'product' or $type == 'project') ? $type : 'id'; $stmt = $this->dao->select("DISTINCT $key")->from(TABLE_DOCLIB)->where('deleted')->eq(0); if($type == 'product' or $type == 'project') { $stmt = $stmt->andWhere($type)->ne(0); } + elseif($type == 'collector') + { + $stmt = $stmt->andWhere('collector')->like("%,{$this->app->user->account},%"); + } else { $stmt = $stmt->andWhere('project')->eq(0)->andWhere('product')->eq(0); diff --git a/module/doc/view/browse.html.php b/module/doc/view/browse.html.php index 77f3cc89e2..d704355c41 100644 --- a/module/doc/view/browse.html.php +++ b/module/doc/view/browse.html.php @@ -45,7 +45,7 @@ var browseType = ''; - +
@@ -75,10 +75,28 @@ var browseType = '';
doc->noDoc;?> " . $lang->doc->create, '', "class='btn btn-info'");?>