mirror of
https://git.code.sf.net/p/seeddms/code
synced 2025-05-14 21:51:32 +00:00
allow to set creation date in full search with facets
This commit is contained in:
parent
3f699ebe62
commit
96a0091002
|
@ -902,7 +902,6 @@ $(document).ready(function() {
|
||||||
$options[] = $option;
|
$options[] = $option;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} elseif(substr($facetname, 0, 5) == 'attr_') {
|
|
||||||
} elseif($facetname == 'status') {
|
} elseif($facetname == 'status') {
|
||||||
foreach($values as $v=>$c) {
|
foreach($values as $v=>$c) {
|
||||||
$option = array($v, getOverallStatusText($v)/*.' ('.$c.')'*/);
|
$option = array($v, getOverallStatusText($v)/*.' ('.$c.')'*/);
|
||||||
|
@ -913,6 +912,8 @@ $(document).ready(function() {
|
||||||
$option[] = array(array('data-subtitle', $c.' ×'));
|
$option[] = array(array('data-subtitle', $c.' ×'));
|
||||||
$options[] = $option;
|
$options[] = $option;
|
||||||
}
|
}
|
||||||
|
} elseif(substr($facetname, 0, 5) == 'attr_' || $facetname == 'created') {
|
||||||
|
/* Do not even create a list of options, because it isn't used */
|
||||||
} else {
|
} else {
|
||||||
foreach($values as $v=>$c) {
|
foreach($values as $v=>$c) {
|
||||||
$option = array($v, $v);
|
$option = array($v, $v);
|
||||||
|
@ -924,7 +925,7 @@ $(document).ready(function() {
|
||||||
$options[] = $option;
|
$options[] = $option;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(substr($facetname, 0, 5) != 'attr_') {
|
if(substr($facetname, 0, 5) != 'attr_' && $facetname != 'created') {
|
||||||
$this->formField(
|
$this->formField(
|
||||||
getMLText($facetname),
|
getMLText($facetname),
|
||||||
array(
|
array(
|
||||||
|
@ -1080,12 +1081,18 @@ $(document).ready(function() {
|
||||||
/* Create a link to remove the filter */
|
/* Create a link to remove the filter */
|
||||||
$allparams = $request->query->all();
|
$allparams = $request->query->all();
|
||||||
if(isset($allparams[$facetname])) {
|
if(isset($allparams[$facetname])) {
|
||||||
$oldvalue = is_array($allparams[$facetname]) ? implode(',', $allparams[$facetname]) : $allparams[$facetname];
|
|
||||||
switch($facetname) {
|
switch($facetname) {
|
||||||
case 'status':
|
case 'status':
|
||||||
|
$oldvalue = is_array($allparams[$facetname]) ? implode(',', $allparams[$facetname]) : $allparams[$facetname];
|
||||||
$oldtransval = getOverallStatusText($oldvalue);
|
$oldtransval = getOverallStatusText($oldvalue);
|
||||||
break;
|
break;
|
||||||
|
case 'created':
|
||||||
|
array_walk($allparams[$facetname], function(&$v, $k){$v=getReadableDate($v);});
|
||||||
|
$oldvalue = $allparams[$facetname];
|
||||||
|
$oldtransval = $oldvalue['from'].' TO '.$oldvalue['to'];
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
|
$oldvalue = is_array($allparams[$facetname]) ? implode(',', $allparams[$facetname]) : $allparams[$facetname];
|
||||||
$oldtransval = $oldvalue;
|
$oldtransval = $oldvalue;
|
||||||
}
|
}
|
||||||
unset($allparams[$facetname]);
|
unset($allparams[$facetname]);
|
||||||
|
@ -1168,6 +1175,18 @@ $(document).ready(function() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} elseif($facetname == 'created') {
|
||||||
|
if(empty($allparams[$facetname]['from']) && empty($allparams[$facetname]['to'])) {
|
||||||
|
$tt = array_keys($values);
|
||||||
|
$content = '<div class="input-group">';
|
||||||
|
$content .= '<span class="input-group-text" style="border-right: 0;"> from </span>';
|
||||||
|
$content .= $this->getDateChooser('', $facetname."[from]", $this->params['session']->getLanguage(), '', getReadableDate(min($tt)), getReadableDate(time()), null, true);
|
||||||
|
$content .= '<span class="input-group-text" style="border-left: 0; border-right: 0;"> to </span>';
|
||||||
|
$content .= $this->getDateChooser('', $facetname."[to]", $this->params['session']->getLanguage(), '', getReadableDate(min($tt)), getReadableDate(time()), null, true);
|
||||||
|
$content .= '<button class="btn btn-primary" type="submit">Set</button>';
|
||||||
|
$content .= '</div>';
|
||||||
|
$this->printAccordion(getMLText('creation_date'), $content);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
/* Further filter makes only sense if the facet has more than 1 value
|
/* Further filter makes only sense if the facet has more than 1 value
|
||||||
* or in case of 1 value, if that value has a count < $total. That second
|
* or in case of 1 value, if that value has a count < $total. That second
|
||||||
|
|
Loading…
Reference in New Issue
Block a user