diff --git a/module/doc/control.php b/module/doc/control.php index eda9360b5d..8c640b4873 100644 --- a/module/doc/control.php +++ b/module/doc/control.php @@ -31,7 +31,7 @@ class doc extends control /** * Go to browse page. - * + * * @access public * @return void */ @@ -89,8 +89,8 @@ class doc extends control if($lib->product or $lib->project) { $type = $lib->product ? 'product' : 'project'; - $productID = $lib->product; - $projectID = $lib->project; + $productID = $lib->product; + $projectID = $lib->project; } } @@ -145,7 +145,17 @@ class doc extends control if($module) $title = $module->name; if($libID) $title = $this->libs[$libID]; if(in_array($browseType, array_keys($this->lang->doc->fastMenuList))) $title = $this->lang->doc->fastMenuList[$browseType]; - if($browseType == 'fastsearch') $title = '"' . $this->post->searchDoc . '" ' . $this->lang->doc->searchResult; + if($browseType == 'fastsearch') + { + if($this->post->searchDoc) $this->session->set('searchDoc', $this->post->searchDoc); + $title = '"' . $this->session->searchDoc . '" ' . $this->lang->doc->searchResult; + } + else + { + $this->session->set('searchDoc', ''); + } + + if($browseType == 'collectedbyme') $this->view->doclibs = $this->doc->getLibs('collectedbyme'); $this->view->title = $title; $this->view->libID = $libID; @@ -165,9 +175,9 @@ class doc extends control /** * Create a library. - * - * @param string $type - * @param int $objectID + * + * @param string $type + * @param int $objectID * @access public * @return void */ @@ -204,8 +214,8 @@ class doc extends control /** * Edit a library. - * - * @param int $libID + * + * @param int $libID * @access public * @return void */ @@ -213,7 +223,7 @@ class doc extends control { if(!empty($_POST)) { - $changes = $this->doc->updateLib($libID); + $changes = $this->doc->updateLib($libID); if(dao::isError()) die(js::error(dao::getError())); if($changes) { @@ -230,14 +240,14 @@ class doc extends control $this->view->groups = $this->loadModel('group')->getPairs(); $this->view->users = $this->user->getPairs('noletter', $lib->users); $this->view->libID = $libID; - + die($this->display()); } /** * Delete a library. - * - * @param int $libID + * + * @param int $libID * @param string $confirm yes|no * @access public * @return void @@ -261,12 +271,12 @@ class doc extends control /** * Create a doc. - * - * @param int|string $libID - * @param int $moduleID - * @param int $productID - * @param int $projectID - * @param string $from + * + * @param int|string $libID + * @param int $moduleID + * @param int $productID + * @param int $projectID + * @param string $from * @access public * @return void */ @@ -333,8 +343,8 @@ class doc extends control /** * Edit a doc. - * - * @param int $docID + * + * @param int $docID * @access public * @return void */ @@ -427,8 +437,8 @@ class doc extends control /** * Delete a doc. - * - * @param int $docID + * + * @param int $docID * @param string $confirm yes|no * @access public * @return void @@ -463,10 +473,10 @@ class doc extends control } /** - * Collect doc, doclib or module of doclib. - * - * @param int $objectID - * @param int $objectType + * Collect doc, doclib or module of doclib. + * + * @param int $objectID + * @param int $objectType * @access public * @return void */ @@ -497,7 +507,7 @@ class doc extends control /** * Sort doc lib. - * + * * @access public * @return void */ @@ -516,8 +526,8 @@ class doc extends control /** * Ajax get modules by libID. - * - * @param int $libID + * + * @param int $libID * @access public * @return void */ @@ -529,9 +539,9 @@ class doc extends control /** * Ajax fixed menu. - * - * @param int $libID - * @param string $type + * + * @param int $libID + * @param string $type * @access public * @return void */ @@ -549,8 +559,8 @@ class doc extends control { if($name == 'list') continue; $customMenu = new stdclass(); - $customMenu->name = $name; - $customMenu->order = $i; + $customMenu->name = $name; + $customMenu->order = $i; $customMenus[] = $customMenu; $i++; } @@ -565,16 +575,16 @@ class doc extends control $lib = $this->doc->getLibByID($libID); $customMenu = new stdclass(); $customMenu->name = "custom{$libID}"; - $customMenu->order = count($customMenus); - $customMenu->float = 'right'; + $customMenu->order = count($customMenus); + $customMenu->float = 'right'; if($type == 'fixed') $customMenus[] = $customMenu; $this->setting->setItem("{$this->app->user->account}.common.customMenu.{$customMenuKey}", json_encode($customMenus)); die(js::reload('parent')); } /** - * Ajax get all libs - * + * Ajax get all libs + * * @access public * @return void */ @@ -585,12 +595,12 @@ class doc extends control /** * Show all libs by type. - * - * @param string $type - * @param string $product - * @param int $recTotal - * @param int $recPerPage - * @param int $pageID + * + * @param string $type + * @param string $product + * @param int $recTotal + * @param int $recPerPage + * @param int $pageID * @access public * @return void */ @@ -626,9 +636,9 @@ class doc extends control /** * Show files for product or project. - * - * @param int $type - * @param int $objectID + * + * @param int $type + * @param int $objectID * @access public * @return void */ @@ -707,7 +717,7 @@ class doc extends control /** * Show libs for product or project - * + * * @access private * @return void */ @@ -723,10 +733,10 @@ class doc extends control /** * Show libs for product or project - * - * @param string $type - * @param int $objectID - * @param string $from + * + * @param string $type + * @param int $objectID + * @param string $from * @access public * @return void */ diff --git a/module/doc/model.php b/module/doc/model.php index fcf1038b6c..178ebe6d1a 100644 --- a/module/doc/model.php +++ b/module/doc/model.php @@ -206,6 +206,14 @@ class docModel extends model { $stmt = $this->dao->select('*')->from(TABLE_DOCLIB)->where('deleted')->eq(0)->orderBy('`order`, id desc')->query(); } + elseif($type == 'collectedbyme') + { + $stmt = $this->dao->select('*')->from(TABLE_DOCLIB) + ->where('deleted')->eq(0) + ->andWhere('collector')->like("%,{$this->app->user->account},%") + ->orderBy('`order`, id desc') + ->query(); + } else { $stmt = $this->dao->select('*')->from(TABLE_DOCLIB)->where('deleted')->eq(0)->andWhere('product')->eq('0')->andWhere('project')->eq(0)->orderBy('`order`, id desc')->query(); @@ -380,11 +388,11 @@ class docModel extends model } elseif($browseType == 'fastsearch') { - if(!$this->post->searchDoc) return array(); + if($this->session->searchDoc == false) return array(); $docIdList = $this->getPrivDocs($libID, $moduleID); $docs = $this->dao->select('*')->from(TABLE_DOC) ->where('id')->in($docIdList) - ->andWhere('title')->like("%{$this->post->searchDoc}%") + ->andWhere('title')->like("%{$this->session->searchDoc}%") ->andWhere('lib')->in($allLibs) ->orderBy($sort) ->page($pager)