show number of occurances in subtitle of options

This commit is contained in:
Uwe Steinmann 2023-03-06 10:03:28 +01:00
parent 0e712c1554
commit 742929002b

View File

@ -854,9 +854,12 @@ function typeahead() { /* {{{ */
foreach($values as $v=>$c) {
$uu = $dms->getUserByLogin($v);
if($uu) {
$option = array($uu->getId(), $v.' ('.$c.')');
$option = array($uu->getId(), $v/*.' ('.$c.')'*/);
if(isset(${$facetname}) && in_array($uu->getId(), ${$facetname}))
$option[] = true;
else
$option[] = false;
$option[] = array(array('data-subtitle', $c.' ×'));
$options[] = $option;
}
}
@ -864,35 +867,48 @@ function typeahead() { /* {{{ */
foreach($values as $v=>$c) {
$cat = $dms->getDocumentCategoryByName($v);
if($cat) {
$option = array($cat->getId(), $v.' ('.$c.')');
$option = array($cat->getId(), $v/*.' ('.$c.')'*/);
if(isset(${$facetname}) && in_array($cat->getId(), ${$facetname}))
$option[] = true;
else
$option[] = false;
$option[] = array(array('data-subtitle', $c.' ×'));
$options[] = $option;
}
}
} 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;
$option = array($v, getOverallStatusText($v)/*.' ('.$c.')'*/);
if(isset(${$facetname}) && in_array($v, ${$facetname}))
$option[] = true;
else
$option[] = false;
$option[] = array(array('data-subtitle', $c.' ×'));
$options[] = $option;
}
} elseif(substr($facetname, 0, 5) == 'attr_') {
foreach($values as $v=>$c) {
$option = array($v, $v.' ('.$c.')');
if(isset($attributes[$facetname]) && in_array($v, $attributes[$facetname]))
$option[] = true;
$options[] = $option;
$option = array($v, $v/*.' ('.$c.')'*/);
if(isset($attributes[$facetname]) && in_array($v, $attributes[$facetname]))
$option[] = true;
else
$option[] = false;
$option[] = array(array('data-subtitle', $c.' ×'));
$options[] = $option;
}
} else {
foreach($values as $v=>$c) {
$option = array($v, $v.' ('.$c.')');
if(isset(${$facetname}) && in_array($v, ${$facetname}))
$option[] = true;
else
$option[] = false;
$option[] = array(array('data-subtitle', $c.' ×'));
$options[] = $option;
}
}
if(substr($facetname, 0, 5) == 'attr_') {
if($options) {
$tmp = explode('_', $facetname);
if($attrdef = $dms->getAttributeDefinition($tmp[1]))
$dispname = $attrdef->getName();
@ -910,6 +926,7 @@ function typeahead() { /* {{{ */
'multiple'=>$multiple
)
);
}
} else {
$this->formField(
getMLText($facetname),