bibb-theme/templates/search/history-table.phtml

46 lines
2.6 KiB
PHTML
Executable File

<?php $saveSupported = $this->accountCapabilities()->getSavedSearchSetting() === 'enabled'; ?>
<table class="table table-striped">
<tr>
<th width="20%"><?=$this->transEsc("history_time")?></th>
<th><?=$this->transEsc("history_search")?></th>
<th><?=$this->transEsc("history_limits")?></th>
<th><?=$this->transEsc("history_results")?></th>
<?php if ($saveSupported): ?><th><?=$this->transEsc($this->showSaved ? "history_delete" : "history_save")?></th><?php endif; ?>
</tr>
<?php foreach (($this->showSaved ? array_reverse($this->saved) : array_reverse($this->unsaved)) as $iteration => $info): ?>
<tr class="<?=$iteration % 2 == 1 ? 'even' : 'odd'?>row">
<td><?=$this->escapeHtml(date('d.m.y H:m', $info->getStartTime()))?></td>
<td>
<?=$this->historylabel($info->getParams()->getSearchClassId())?>
<a href="<?=$this->url($info->getOptions()->getSearchAction()) . $info->getUrlQuery()->getParams()?>"><?
$desc = $info->getParams()->getDisplayQuery();
echo empty($desc) ? $this->transEsc("history_empty_search") : $this->escapeHtml($desc);
?></a>
</td>
<td>
<?php $info->getParams()->activateAllFacets(); foreach ($info->getParams()->getFilterList(true) as $field => $filters): ?>
<?php foreach ($filters as $i => $filter): ?>
<?php if ($filter['operator'] == 'NOT') echo $this->transEsc('NOT') . ' '; if ($filter['operator'] == 'OR' && $i > 0) echo $this->transEsc('OR') . ' '; ?>
<strong><?=$this->transEsc($field)?></strong>: <?=$this->escapeHtml($filter['displayText'])?><br/>
<?php endforeach; ?>
<?php endforeach; ?>
<?php foreach($info->getParams()->getCheckboxFacets() as $facet): ?>
<?php if ($facet['selected']): ?>
<strong><?=$this->transEsc($facet['desc'])?></strong><br/>
<?php endif; ?>
<?php endforeach; ?>
</td>
<td><?=$this->escapeHtml($this->localizedNumber($info->getResultTotal()))?></td>
<?php if ($saveSupported): ?>
<td>
<?php if ($this->showSaved): ?>
<a href="<?=$this->url('myresearch-savesearch')?>?delete=<?=urlencode($info->getSearchId())?>&amp;mode=history"><i class="fa fa-remove" aria-hidden="true"></i> <?=$this->transEsc("history_delete_link")?></a>
<?php else: ?>
<a href="<?=$this->url('myresearch-savesearch')?>?save=<?=urlencode($info->getSearchId())?>&amp;mode=history"><i class="fa fa-save" aria-hidden="true"></i> <?=$this->transEsc("history_save_link")?></a>
<?php endif; ?>
</td>
<?php endif; ?>
</tr>
<?php endforeach; ?>
</table>