bibb-theme/templates/search/searchboxAuthorities.phtml
2026-02-24 07:35:06 +01:00

142 lines
8.5 KiB
PHTML
Executable File

<?
// Set default value if necessary:
if (!isset($this->searchClassId)) {
$this->searchClassId = 'SolrAuth';
}
// Load search actions and settings (if any):
$options = $this->searchOptions($this->searchClassId);
$handlers = $this->searchbox()->getHandlers(
$this->searchClassId,
isset($this->searchIndex) ? $this->searchIndex : null
);
$handlerCount = count($handlers);
$basicSearch = $this->searchbox()->combinedHandlersActive() ? 'combined-searchbox' : $options->getSearchAction();
$searchHome = $options->getSearchHomeAction();
$advSearch = $options->getAdvancedSearchAction();
$lastSort = $this->searchMemory()->getLastSort($this->searchClassId);
$lastLimit = $this->searchMemory()->getLastLimit($this->searchClassId);
$ignoreHiddenFilterMemory = isset($this->ignoreHiddenFilterMemory) && $this->ignoreHiddenFilterMemory;
$ignoreHiddenFiltersInRequest = isset($this->ignoreHiddenFiltersInRequest) && $this->ignoreHiddenFiltersInRequest;
$hiddenFilters = $this->searchtabs()->getHiddenFilters($this->searchClassId, $ignoreHiddenFilterMemory, $ignoreHiddenFiltersInRequest);
if (empty($hiddenFilters) && !$ignoreHiddenFilterMemory) {
$hiddenFilters = $this->searchMemory()->getLastHiddenFilters($this->searchClassId);
if (empty($hiddenFilters)) {
$hiddenFilters = $this->searchtabs()->getHiddenFilters($this->searchClassId);
}
}
$hiddenFilterParams = $this->searchtabs()->getCurrentHiddenFilterParams($this->searchClassId, $ignoreHiddenFilterMemory, '?');
?>
<? $searchTabs = $this->searchtabs()->getTabConfig($this->searchClassId, $this->lookfor, $this->searchIndex, $this->searchType, $hiddenFilters); ?>
<? if ($this->searchType == 'advanced'): ?>
<div class="navbar-form navbar-left flip">
<? $tabs = $this->context($this)->renderInContext('search/searchTabsAuthorities', ['searchTabs' => $searchTabs['tabs']]); ?>
<? if (!empty($tabs)): ?><?=$tabs ?><div class="tab-content clearfix"><? endif; ?>
<p class="adv_search_terms"><?=$this->transEsc("Your search terms")?> : "<strong><?=$this->escapeHtml($this->lookfor)?></strong>"</p>
<p class="adv_search_links">
<a href="<?=$this->url($advSearch)?>?edit=<?=$this->escapeHtmlAttr($this->searchId)?>"><?=$this->transEsc("Edit this Advanced Search")?></a> |
<a href="<?=$this->url($advSearch) . $hiddenFilterParams?>"><?=$this->transEsc("Start a new Advanced Search")?></a> |
<a href="<?=$this->url($searchHome) . $hiddenFilterParams?>"><?=$this->transEsc("Start a new Basic Search")?></a>
</p>
<? if (!empty($tabs)): ?></div><? endif; ?>
</div>
<? else: ?>
<form id="searchForm" class="searchForm navbar-form navbar-left flip" style="padding-top:0px;" method="get" action="<?=$this->url($basicSearch)?>" name="searchForm" autocomplete="off">
<? $placeholder = $this->searchbox()->getPlaceholderText(isset($searchTabs['selected']['id']) ? $searchTabs['selected']['id'] : null); ?>
<input id="searchForm_lookfor" class="searchForm_lookfor form-control search-query<? if($this->searchbox()->autocompleteEnabled($this->searchClassId)):?> autocomplete searcher:<?=$this->escapeHtmlAttr($this->searchClassId) ?><? endif ?>" type="text" name="lookfor" value="<?=$this->escapeHtmlAttr($this->lookfor)?>"<? if ($placeholder): ?> placeholder="<?=$this->transEsc($placeholder) ?>"<? endif ?> />
<? if ($handlerCount > 1): ?>
<select id="searchForm_type" class="searchForm_type form-control" name="type" data-native-menu="false">
<? foreach ($handlers as $handler): ?>
<option value="<?=$this->escapeHtmlAttr($handler['value'])?>"<?=$handler['selected'] ? ' selected="selected"' : ''?>><?=$handler['indent'] ? '-- ' : ''?><?=$this->transEsc($handler['label'])?></option>
<? endforeach; ?>
</select>
<? elseif ($handlerCount == 1): ?>
<input type="hidden" name="type" value="<?=$this->escapeHtmlAttr($handlers[0]['value'])?>" />
<? endif; ?>
<? if (count($searchTabs) > 0): ?>
<? foreach ($searchTabs as $tab): ?>
<? // if ($this->permission()->allowDisplay($tab['permission'])): ?>
<? if (isset($tab['label'])) : ?>
<? if (strcmp($tab['label'],"Gesamtbestand") == 0 || strcmp($tab['label'],"VET Repository") == 0) : ?>
<input type="checkbox" name='filter' value='(format:"Electronic resource" OR format:"eBook")' /> <?=$this->transEsc('Filter_electronic_resource')?>
<!-- <input type="checkbox" name='filter' value='format:"Electronic resource"' /> <?=$this->transEsc('Filter_electronic_resource')?> -->
<? endif; ?>
<? endif; ?>
<? // endif; ?>
<? endforeach; ?>
<? endif; ?>
<? //END RKE: search Field "Fulltext only ?>
<button type="submit" class="btn btn-primary"><i class="fa fa-search" aria-hidden="true"></i></button>
<? if ($advSearch): ?>
<a href="<?=$this->url($advSearch) . ((isset($this->searchId) && $this->searchId) ? '?edit=' . $this->escapeHtmlAttr($this->searchId) : $hiddenFilterParams) ?>" class="btn btn-link advancedSearch" rel="nofollow"><?=$this->transEsc("Advanced Search")?></a>
<? endif; ?>
<?= $this->context($this)->renderInContext('search/searchTabsAuthorities', ['searchTabs' => $searchTabs['tabs']]); ?>
<? if ($geoUrl = $this->geocoords()->getSearchUrl($options)) : ?>
<a href="<?=$geoUrl ?>" class="btn btn-link"><?=$this->transEsc('Geographic Search')?></a>
<? endif; ?>
<? $shards = $options->getShards(); if ($options->showShardCheckboxes() && !empty($shards)): ?>
<?
$selectedShards = isset($this->selectedShards)
? $this->selectedShards : $options->getDefaultSelectedShards();
?>
<br />
<? foreach ($shards as $shard => $val): ?>
<? $isSelected = empty($selectedShards) || in_array($shard, $selectedShards); ?>
<input type="checkbox" <?=$isSelected ? 'checked="checked" ' : ''?>name="shard[]" value='<?=$this->escapeHtmlAttr($shard)?>' /> <?=$this->transEsc($shard)?>
<? endforeach; ?>
<? endif; ?>
<?
$filterDetails = $this->searchbox()->getFilterDetails(
isset($this->filterList) && is_array($this->filterList) ? $this->filterList : [],
isset($this->checkboxFilters) && is_array($this->checkboxFilters) ? $this->checkboxFilters : []
);
?>
<? if ((isset($hasDefaultsApplied) && $hasDefaultsApplied) || !empty($filterDetails)): ?>
<? $defaultFilterState = $options->getRetainFilterSetting() ? ' checked="checked"' : ''; ?>
<div class="checkbox">
<label>
<input onChange="$('.applied-filter').click()" type="checkbox"<?=$defaultFilterState?> class="searchFormKeepFilters"/>
<?=$this->transEsc("basic_search_keep_filters")?>
</label>
</div>
<div class="hidden">
<? foreach ($filterDetails as $current): ?>
<input class="applied-filter" id="<?=$this->escapeHtmlAttr($current['id'])?>" type="checkbox"<?=$defaultFilterState?> name="filter[]" value="<?=$this->escapeHtmlAttr($current['value'])?>" />
<label for="<?=$this->escapeHtmlAttr($current['id'])?>"><?=$this->escapeHtml($current['value'])?></label>
<? endforeach; ?>
<? if (isset($hasDefaultsApplied) && $hasDefaultsApplied): ?>
<!-- this is a hidden element that flags whether or not default filters have been applied;
it is intentionally unlabeled, as users are not meant to manipulate it directly. -->
<input class="applied-filter" id="dfApplied" type="checkbox" name="dfApplied" value="1"<?=$defaultFilterState?> />
<? endif; ?>
</div>
<? endif; ?>
<? foreach ($hiddenFilters as $key => $filter): ?>
<? foreach ($filter as $value): ?>
<input type="hidden" name="hiddenFilters[]" value="<?=$this->escapeHtmlAttr($key) . ':' . $this->escapeHtmlAttr($value)?>" />
<? endforeach; ?>
<? endforeach; ?>
<?
/* Show hidden field for active search class when in combined handler mode. */
if ($this->searchbox()->combinedHandlersActive()) {
echo '<input type="hidden" name="activeSearchClassId" value="' . $this->escapeHtmlAttr($this->searchClassId) . '" />';
}
/* Load hidden limit preference from Session */
if (!empty($lastLimit)) {
echo '<input type="hidden" name="limit" value="' . $this->escapeHtmlAttr($lastLimit) . '" />';
}
if (!empty($lastSort)) {
echo '<input type="hidden" name="sort" value="' . $this->escapeHtmlAttr($lastSort) . '" />';
}
?>
</form>
<? endif; ?>