pass record_type to view, some code formating

This commit is contained in:
Uwe Steinmann 2021-11-19 13:49:07 +01:00
parent 582a85947f
commit f2dbe4c18b

View File

@ -64,7 +64,9 @@ if($fullsearch) {
// category
$categories = array();
$categorynames = array();
$category = array();
if(isset($_GET['category']) && $_GET['category']) {
$category = $_GET['category'];
foreach($_GET['category'] as $catid) {
if($catid) {
$cat = $dms->getDocumentCategory($catid);
@ -112,7 +114,6 @@ if($fullsearch) {
}
}
}
// Check to see if the search has been restricted to a particular
// mimetype.
$mimetype = [];
@ -134,6 +135,12 @@ if($fullsearch) {
else
$status = array();
// record_type
if(isset($_GET['record_type']))
$record_type = $_GET['record_type'];
else
$record_type = array();
// Check to see if the search has been restricted to a particular sub-tree in
// the folder hierarchy.
$startFolder = null;
@ -165,7 +172,7 @@ if($fullsearch) {
$index = $fulltextservice->Indexer();
if($index) {
$lucenesearch = $fulltextservice->Search();
$searchresult = $lucenesearch->search($query, array('owner'=>$ownernames, 'status'=>$status, 'category'=>$categorynames, 'user'=>$user->isAdmin() ? [] : [$user->getLogin()], 'mimetype'=>$mimetype, 'startFolder'=>$startFolder, 'rootFolder'=>$rootFolder), ($pageNumber == 'all' ? array() : array('limit'=>$limit, 'offset'=>$limit * ($pageNumber-1))));
$searchresult = $lucenesearch->search($query, array('record_type'=>$record_type, 'owner'=>$ownernames, 'status'=>$status, 'category'=>$categorynames, 'user'=>$user->isAdmin() ? [] : [$user->getLogin()], 'mimetype'=>$mimetype, 'startFolder'=>$startFolder, 'rootFolder'=>$rootFolder), ($pageNumber == 'all' ? array() : array('limit'=>$limit, 'offset'=>$limit * ($pageNumber-1))));
if($searchresult === false) {
$session->setSplashMsg(array('type'=>'error', 'msg'=>getMLText('splash_invalid_searchterm')));
$dcount = 0;
@ -198,6 +205,10 @@ if($fullsearch) {
}
}
}
if(isset($facets['record_type'])) {
$fcount = isset($facets['record_type']['folder']) ? $facets['record_type']['folder'] : 0;
$dcount = isset($facets['record_type']['document']) ? $facets['record_type']['document'] : 0 ;
}
}
if($pageNumber != 'all' && $searchresult['count'] > $limit) {
$totalPages = (int) ($searchresult['count']/$limit);
@ -400,7 +411,9 @@ if($fullsearch) {
// category
$categories = array();
$category = [];
if(isset($_GET['category']) && $_GET['category']) {
$category = $_GET['category'];
foreach($_GET['category'] as $catid) {
if($cat = $dms->getDocumentCategory($catid)) {
$categories[] = $cat;
@ -553,8 +566,10 @@ if($settings->_showSingleSearchHit && count($entries) == 1) {
$view->setParam('creationdate', isset($creationdate) ? $creationdate : '');
$view->setParam('expirationdate', isset($expirationdate) ? $expirationdate: '');
$view->setParam('statusdate', isset($statusdate) ? $statusdate: '');
$view->setParam('status', isset($status) ? $status : array());
$view->setParam('status', $status);
$view->setParam('recordtype', $record_type);
$view->setParam('categories', isset($categories) ? $categories : '');
$view->setParam('category', $category);
$view->setParam('mimetype', isset($mimetype) ? $mimetype : '');
$view->setParam('attributes', isset($attributes) ? $attributes : '');
$attrdefs = $dms->getAllAttributeDefinitions(array(SeedDMS_Core_AttributeDefinition::objtype_document, SeedDMS_Core_AttributeDefinition::objtype_documentcontent, SeedDMS_Core_AttributeDefinition::objtype_folder, SeedDMS_Core_AttributeDefinition::objtype_all));