52 lines
2.7 KiB
PHTML
Executable File
52 lines
2.7 KiB
PHTML
Executable File
<?php
|
|
// TODO: This file needs love
|
|
$topFacetSet = $this->recommend->getTopFacetSet();
|
|
$topFacetSettings = $this->recommend->getTopFacetSettings();
|
|
$results = $this->recommend->getResults();
|
|
?>
|
|
<?php if (isset($topFacetSet)): ?>
|
|
<?php foreach($topFacetSet as $title => $cluster): ?>
|
|
<?php $moreClass = ' NarrowGroupHidden_'.$this->escapeHtml($title).' hidden'; ?>
|
|
<?php $allowExclude = $this->recommend->excludeAllowed($title); ?>
|
|
<div class="top-facets">
|
|
<?php $limit = $topFacetSettings['rows'] * $topFacetSettings['cols']; ?>
|
|
<?php foreach($cluster['list'] as $index => $thisFacet): ?>
|
|
<span class="facet <?=$index > $limit ? $moreClass : '' ?>">
|
|
<?php if ($thisFacet['isApplied']):
|
|
if (isset($thisFacet['specialType']) && $thisFacet['specialType'] == 'keyword') {
|
|
$removeLink = $this->currentPath().$results->getUrlQuery()->replaceTerm($thisFacet['value'], '');
|
|
} else {
|
|
$removeLink = $this->currentPath().$results->getUrlQuery()->removeFacet($title, $thisFacet['value'], $thisFacet['operator']);
|
|
} ?>
|
|
<a href="<?=$removeLink ?>" class="applied">
|
|
<?=$this->escapeHtml($thisFacet['displayText'])?> <i class="fa fa-check" aria-hidden="true"></i><!--
|
|
--></a>
|
|
<?php else: ?>
|
|
<span class="badge"><?=$this->localizedNumber($thisFacet['count']) ?>
|
|
<?php if ($allowExclude): ?>
|
|
<a href="<?=$this->currentPath().$results->getUrlQuery()->addFacet($title, $thisFacet['value'], 'NOT')?>" title="<?=$this->transEsc('exclude_facet')?>"><i class="fa fa-times" aria-hidden="true"></i></a>
|
|
<?php endif; ?>
|
|
</span>
|
|
<a href="<?=$this->currentPath().$results->getUrlQuery()->addFacet($title, $thisFacet['value'], $thisFacet['operator'])?>">
|
|
<?=$this->escapeHtml($thisFacet['displayText'])?><!--
|
|
--></a>
|
|
<?php endif; ?>
|
|
</span>
|
|
<?php /* More link */ ?>
|
|
<?php if ($index == $limit): ?>
|
|
<span id="more-NarrowGroupHidden_<?=$this->escapeHtml($title)?>" class="narrow-toggle">
|
|
<a href="#" onclick="moreFacets('NarrowGroupHidden_<?=$this->escapeHtml($title)?>'); return false;">
|
|
<?=$this->transEsc('more') ?> ...
|
|
</a>
|
|
</span>
|
|
<?php endif; ?>
|
|
<?php endforeach; ?>
|
|
<?php if (count($cluster['list']) > $limit): ?>
|
|
<a class="narrow-toggle <?=$moreClass ?>" href="#" onclick="lessFacets('NarrowGroupHidden_<?=$title ?>'); return false;">
|
|
<?=$this->transEsc('less') ?> ...
|
|
</a>
|
|
<?php endif; ?>
|
|
</div>
|
|
<?php endforeach; ?>
|
|
<?php endif; ?>
|