mirror of
				https://git.code.sf.net/p/seeddms/code
				synced 2025-10-31 05:11:27 +00:00 
			
		
		
		
	get total number of hits, some code formating
This commit is contained in:
		
							parent
							
								
									f2dbe4c18b
								
							
						
					
					
						commit
						a4bb363799
					
				|  | @ -127,6 +127,7 @@ function typeahead() { /* {{{ */ | ||||||
| 		$dms = $this->params['dms']; | 		$dms = $this->params['dms']; | ||||||
| 		$user = $this->params['user']; | 		$user = $this->params['user']; | ||||||
| 		$fullsearch = $this->params['fullsearch']; | 		$fullsearch = $this->params['fullsearch']; | ||||||
|  | 		$total = $this->params['total']; | ||||||
| 		$totaldocs = $this->params['totaldocs']; | 		$totaldocs = $this->params['totaldocs']; | ||||||
| 		$totalfolders = $this->params['totalfolders']; | 		$totalfolders = $this->params['totalfolders']; | ||||||
| 		$attrdefs = $this->params['attrdefs']; | 		$attrdefs = $this->params['attrdefs']; | ||||||
|  | @ -139,6 +140,7 @@ function typeahead() { /* {{{ */ | ||||||
| 		$enableclipboard = $this->params['enableclipboard']; | 		$enableclipboard = $this->params['enableclipboard']; | ||||||
| 		$attributes = $this->params['attributes']; | 		$attributes = $this->params['attributes']; | ||||||
| 		$categories = $this->params['categories']; | 		$categories = $this->params['categories']; | ||||||
|  | 		$category = $this->params['category']; | ||||||
| 		$mimetype = $this->params['mimetype']; | 		$mimetype = $this->params['mimetype']; | ||||||
| 		$owner = $this->params['owner']; | 		$owner = $this->params['owner']; | ||||||
| 		$startfolder = $this->params['startfolder']; | 		$startfolder = $this->params['startfolder']; | ||||||
|  | @ -152,6 +154,7 @@ function typeahead() { /* {{{ */ | ||||||
| 		$expirationdate = $this->params['expirationdate']; | 		$expirationdate = $this->params['expirationdate']; | ||||||
| 		$statusdate = $this->params['statusdate']; | 		$statusdate = $this->params['statusdate']; | ||||||
| 		$status = $this->params['status']; | 		$status = $this->params['status']; | ||||||
|  | 		$record_type = $this->params['recordtype']; | ||||||
| 		$this->query = $this->params['query']; | 		$this->query = $this->params['query']; | ||||||
| 		$orderby = $this->params['orderby']; | 		$orderby = $this->params['orderby']; | ||||||
| 		$entries = $this->params['searchhits']; | 		$entries = $this->params['searchhits']; | ||||||
|  | @ -331,8 +334,8 @@ function typeahead() { /* {{{ */ | ||||||
| 			$tmpcatids[] = $tmpcat->getID(); | 			$tmpcatids[] = $tmpcat->getID(); | ||||||
| 		$options = array(); | 		$options = array(); | ||||||
| 		$allcategories = $dms->getDocumentCategories(); | 		$allcategories = $dms->getDocumentCategories(); | ||||||
| 		foreach($allcategories as $category) { | 		foreach($allcategories as $acategory) { | ||||||
| 			$options[] = array($category->getID(), $category->getName(), in_array($category->getId(), $tmpcatids)); | 			$options[] = array($acategory->getID(), $acategory->getName(), in_array($acategory->getId(), $tmpcatids)); | ||||||
| 		} | 		} | ||||||
| 		$this->formField( | 		$this->formField( | ||||||
| 			getMLText("categories"), | 			getMLText("categories"), | ||||||
|  | @ -449,93 +452,127 @@ function typeahead() { /* {{{ */ | ||||||
| 			); | 			); | ||||||
| 			$this->formField(getMLText("under_folder"), $this->getFolderChooserHtml("form1", M_READ, -1, $startfolder, 'folderfullsearchid')); | 			$this->formField(getMLText("under_folder"), $this->getFolderChooserHtml("form1", M_READ, -1, $startfolder, 'folderfullsearchid')); | ||||||
| 			if(!isset($facets['owner'])) { | 			if(!isset($facets['owner'])) { | ||||||
| 			$options = array(); | 				$options = array(); | ||||||
| 			foreach ($allUsers as $currUser) { | 				foreach ($allUsers as $currUser) { | ||||||
| 				if($user->isAdmin() || (!$currUser->isGuest() && (!$currUser->isHidden() || $currUser->getID() == $user->getID()))) | 					if($user->isAdmin() || (!$currUser->isGuest() && (!$currUser->isHidden() || $currUser->getID() == $user->getID()))) | ||||||
| 					$options[] = array($currUser->getID(), htmlspecialchars($currUser->getLogin()), in_array($currUser->getID(), $owner), array(array('data-subtitle', htmlspecialchars($currUser->getFullName())))); | 						$options[] = array($currUser->getID(), htmlspecialchars($currUser->getLogin()), in_array($currUser->getID(), $owner), array(array('data-subtitle', htmlspecialchars($currUser->getFullName())))); | ||||||
|  | 				} | ||||||
|  | 				$this->formField( | ||||||
|  | 					getMLText("owner"), | ||||||
|  | 					array( | ||||||
|  | 						'element'=>'select', | ||||||
|  | 						'name'=>'owner[]', | ||||||
|  | 						'class'=>'chzn-select', | ||||||
|  | 						'multiple'=>true, | ||||||
|  | 						'options'=>$options | ||||||
|  | 					) | ||||||
|  | 				); | ||||||
| 			} | 			} | ||||||
| 			$this->formField( | 			if(!isset($facets['category'])) { | ||||||
| 				getMLText("owner"), | 				$tmpcatids = array(); | ||||||
| 				array( | 				foreach($categories as $tmpcat) | ||||||
| 					'element'=>'select', | 					$tmpcatids[] = $tmpcat->getID(); | ||||||
| 					'name'=>'owner[]', | 				$options = array(); | ||||||
| 					'class'=>'chzn-select', | 				$allcategories = $dms->getDocumentCategories(); | ||||||
| 					'multiple'=>true, | 				foreach($allcategories as $acategory) { | ||||||
| 					'options'=>$options | 					$options[] = array($acategory->getID(), $acategory->getName(), in_array($acategory->getId(), $tmpcatids)); | ||||||
| 				) | 				} | ||||||
| 			); | 				$this->formField( | ||||||
| 		} | 					getMLText("category_filter"), | ||||||
| 		if(!isset($facets['category'])) { | 					array( | ||||||
| 			$tmpcatids = array(); | 						'element'=>'select', | ||||||
| 			foreach($categories as $tmpcat) | 						'class'=>'chzn-select', | ||||||
| 				$tmpcatids[] = $tmpcat->getID(); | 						'name'=>'category[]', | ||||||
| 			$options = array(); | 						'multiple'=>true, | ||||||
| 			$allcategories = $dms->getDocumentCategories(); | 						'attributes'=>array(array('data-placeholder', getMLText('select_category'), array('data-no_results_text', getMLText('unknown_document_category')))), | ||||||
| 			foreach($allcategories as $category) { | 						'options'=>$options | ||||||
| 				$options[] = array($category->getID(), $category->getName(), in_array($category->getId(), $tmpcatids)); | 					) | ||||||
|  | 				); | ||||||
| 			} | 			} | ||||||
| 			$this->formField( | 			if(!isset($facets['status'])) { | ||||||
| 				getMLText("category_filter"), | 				$options = array(); | ||||||
| 				array( | 				if($workflowmode == 'traditional' || $workflowmode == 'traditional_only_approval') { | ||||||
| 					'element'=>'select', | 					if($workflowmode == 'traditional') {  | ||||||
| 					'class'=>'chzn-select', | 						$options[] = array(S_DRAFT_REV, getOverallStatusText(S_DRAFT_REV), in_array(S_DRAFT_REV, $status)); | ||||||
| 					'name'=>'category[]', | 					} | ||||||
| 					'multiple'=>true, | 				} elseif($workflowmode == 'advanced') { | ||||||
| 					'attributes'=>array(array('data-placeholder', getMLText('select_category'), array('data-no_results_text', getMLText('unknown_document_category')))), | 					$options[] = array(S_IN_WORKFLOW, getOverallStatusText(S_IN_WORKFLOW), in_array(S_IN_WORKFLOW, $status)); | ||||||
| 					'options'=>$options | 				} | ||||||
| 				) | 				$options[] = array(S_DRAFT_APP, getOverallStatusText(S_DRAFT_APP), in_array(S_DRAFT_APP, $status)); | ||||||
| 			); | 				$options[] = array(S_RELEASED, getOverallStatusText(S_RELEASED), in_array(S_RELEASED, $status)); | ||||||
| 		} | 				$options[] = array(S_REJECTED, getOverallStatusText(S_REJECTED), in_array(S_REJECTED, $status)); | ||||||
| 		$options = array(); | 				$options[] = array(S_EXPIRED, getOverallStatusText(S_EXPIRED), in_array(S_EXPIRED, $status)); | ||||||
| 		if($workflowmode == 'traditional' || $workflowmode == 'traditional_only_approval') { | 				$options[] = array(S_OBSOLETE, getOverallStatusText(S_OBSOLETE), in_array(S_OBSOLETE, $status)); | ||||||
| 			if($workflowmode == 'traditional') {  | 				$this->formField( | ||||||
| 				$options[] = array(S_DRAFT_REV, getOverallStatusText(S_DRAFT_REV), in_array(S_DRAFT_REV, $status)); | 					getMLText("status"), | ||||||
|  | 					array( | ||||||
|  | 						'element'=>'select', | ||||||
|  | 						'class'=>'chzn-select', | ||||||
|  | 						'name'=>'status[]', | ||||||
|  | 						'multiple'=>true, | ||||||
|  | 						'attributes'=>array(array('data-placeholder', getMLText('select_status')), array('data-no_results_text', getMLText('unknown_status'))), | ||||||
|  | 						'options'=>$options | ||||||
|  | 					) | ||||||
|  | 				); | ||||||
| 			} | 			} | ||||||
| 		} elseif($workflowmode == 'advanced') { |  | ||||||
| 			$options[] = array(S_IN_WORKFLOW, getOverallStatusText(S_IN_WORKFLOW), in_array(S_IN_WORKFLOW, $status)); |  | ||||||
| 		} |  | ||||||
| 		$options[] = array(S_DRAFT_APP, getOverallStatusText(S_DRAFT_APP), in_array(S_DRAFT_APP, $status)); |  | ||||||
| 		$options[] = array(S_RELEASED, getOverallStatusText(S_RELEASED), in_array(S_RELEASED, $status)); |  | ||||||
| 		$options[] = array(S_REJECTED, getOverallStatusText(S_REJECTED), in_array(S_REJECTED, $status)); |  | ||||||
| 		$options[] = array(S_EXPIRED, getOverallStatusText(S_EXPIRED), in_array(S_EXPIRED, $status)); |  | ||||||
| 		$options[] = array(S_OBSOLETE, getOverallStatusText(S_OBSOLETE), in_array(S_OBSOLETE, $status)); |  | ||||||
| 		$this->formField( |  | ||||||
| 			getMLText("status"), |  | ||||||
| 			array( |  | ||||||
| 				'element'=>'select', |  | ||||||
| 				'class'=>'chzn-select', |  | ||||||
| 				'name'=>'status[]', |  | ||||||
| 				'multiple'=>true, |  | ||||||
| 				'attributes'=>array(array('data-placeholder', getMLText('select_status')), array('data-no_results_text', getMLText('unknown_status'))), |  | ||||||
| 				'options'=>$options |  | ||||||
| 			) |  | ||||||
| 		); |  | ||||||
| 
 | 
 | ||||||
| 		if($facets) { | 			if($facets) { | ||||||
| foreach($facets as $facetname=>$values) { | 				foreach($facets as $facetname=>$values) { | ||||||
| 	$options = array(); | 					$multiple = true; | ||||||
| 	foreach($values as $v=>$c) { | //					if(in_array($facetname, ['owner', 'status', 'mimetype']))
 | ||||||
| 		$option = array($v, $v.' ('.$c.')'); | //						$multiple = false;
 | ||||||
| 		if(isset(${$facetname}) && in_array($v, ${$facetname})) | 					$options = array(); | ||||||
| 			$option[] = true; | 					if($facetname == 'owner') { | ||||||
| 		$options[] = $option; | 						foreach($values as $v=>$c) { | ||||||
| 	} | 							$uu = $dms->getUserByLogin($v); | ||||||
| 	$this->formField( | 							if($uu) { | ||||||
| 		getMLText($facetname), | 								$option = array($uu->getId(), $v.' ('.$c.')'); | ||||||
| 		array( | 								if(isset(${$facetname}) && in_array($uu->getId(), ${$facetname})) | ||||||
| 			'element'=>'select', | 									$option[] = true; | ||||||
| 			'id'=>$facetname, | 								$options[] = $option; | ||||||
| 			'name'=>$facetname."[]", | 							} | ||||||
| 			'class'=>'chzn-select', | 						} | ||||||
| 			'attributes'=>array(array('data-placeholder', getMLText('select_'.$facetname))), | 					} elseif($facetname == 'category') { | ||||||
| 			'options'=>$options, | 						foreach($values as $v=>$c) { | ||||||
| 			'multiple'=>true | 							$cat = $dms->getDocumentCategoryByName($v); | ||||||
| 		) | 							if($cat) { | ||||||
| 	); | 								$option = array($cat->getId(), $v.' ('.$c.')'); | ||||||
| } | 								if(isset(${$facetname}) && in_array($cat->getId(), ${$facetname})) | ||||||
| 		} | 									$option[] = true; | ||||||
| 	$this->contentContainerEnd(); | 								$options[] = $option; | ||||||
| 	$this->formSubmit("<i class=\"fa fa-search\"></i> ".getMLText('search')); | 							} | ||||||
|  | 						} | ||||||
|  | 					} elseif($facetname == 'status') { | ||||||
|  | 						foreach($values as $v=>$c) { | ||||||
|  | 								$option = array($v, getOverallStatusText($v).' ('.$c.')'); | ||||||
|  | 								if(isset(${$facetname}) && in_array($v, ${$facetname})) | ||||||
|  | 									$option[] = true; | ||||||
|  | 								$options[] = $option; | ||||||
|  | 						} | ||||||
|  | 					} else { | ||||||
|  | 						foreach($values as $v=>$c) { | ||||||
|  | 							$option = array($v, $v.' ('.$c.')'); | ||||||
|  | 							if(isset(${$facetname}) && in_array($v, ${$facetname})) | ||||||
|  | 								$option[] = true; | ||||||
|  | 							$options[] = $option; | ||||||
|  | 						} | ||||||
|  | 					} | ||||||
|  | 					$this->formField( | ||||||
|  | 						getMLText($facetname), | ||||||
|  | 						array( | ||||||
|  | 							'element'=>'select', | ||||||
|  | 							'id'=>$facetname, | ||||||
|  | 							'name'=>$facetname."[]", | ||||||
|  | 							'class'=>'chzn-select', | ||||||
|  | 							'attributes'=>array(array('data-placeholder', getMLText('select_'.$facetname)), array('data-allow-clear', 'true')), | ||||||
|  | 							'options'=>$options, | ||||||
|  | 							'multiple'=>$multiple | ||||||
|  | 						) | ||||||
|  | 					); | ||||||
|  | 				} | ||||||
|  | 			} | ||||||
|  | 			$this->contentContainerEnd(); | ||||||
|  | 			$this->formSubmit("<i class=\"fa fa-search\"></i> ".getMLText('search')); | ||||||
| ?>
 | ?>
 | ||||||
| </form> | </form> | ||||||
| <?php | <?php | ||||||
|  | @ -562,7 +599,7 @@ foreach($facets as $facetname=>$values) { | ||||||
| 				} | 				} | ||||||
| 			} | 			} | ||||||
| 			 */ | 			 */ | ||||||
| 			echo $this->infoMsg(getMLText("search_report", array("doccount" => $totaldocs, "foldercount" => $totalfolders, 'searchtime'=>$searchTime))); | 			echo $this->infoMsg(getMLText("search_report", array("count"=>$total, "doccount" => $totaldocs, "foldercount" => $totalfolders, 'searchtime'=>$searchTime))); | ||||||
| 			$this->pageList($pageNumber, $totalpages, "../out/out.Search.php", $urlparams); | 			$this->pageList($pageNumber, $totalpages, "../out/out.Search.php", $urlparams); | ||||||
| //			$this->contentContainerStart();
 | //			$this->contentContainerStart();
 | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue
	
	Block a user
	 Uwe Steinmann
						Uwe Steinmann