Skip to content
Snippets Groups Projects
  • Alexander Purr's avatar
    refs #22511 [finc-accessibility] usability date range slider · d88290bc
    Alexander Purr authored
    * add cluster for extracting possible year ranges
    * set up possible ranges and by user chosen filtered years at the beginning of template to provide fitting variables for inputs and date range slider
    * adjust configuration for loading complete range of years
    d88290bc
Code owners
Assign users and groups as approvers for specific file changes. Learn more.
facet.phtml 3.08 KiB
<!-- finc-accessibility - Recommend - SideFacets - facet.phtml -->
<?php /* #18993 copied from bootstrap to show all applied facets */ ?>
<?php
  $this->results = $results = $this->recommend->getResults();
  $this->options = $options = $results->getOptions();
  $hierarchicalFacetSortOptions = $this->recommend->getHierarchicalFacetSortOptions();
  $hierarchicalFacets = $this->recommend->getHierarchicalFacets();
  $collapsedFacets = $this->recommend->getCollapsedFacets();
  $rangeFacets = $this->recommend->getAllRangeFacets();
  $facet = $this->facet;
?>
<?php if (isset($rangeFacets[$facet])): // special display for ranges ?>
  <?php /* finc: usability date range slider #22511: add cluster for extracting possible year ranges */ ?>
  <?=$this->context($this)->renderInContext(
    'Recommend/SideFacets/range-slider.phtml',
    ['title' => $facet, 'facet' => $rangeFacets[$facet], 'cluster' => $cluster]
  ); ?>
<?php else: ?>
  <?php
    // Set some variables so we can figure out which sub-template(s) to
    // render. If we have a hierarchical facet, we will need to render a
    // jsTree Javascript-based template. If we also support non-JS browsers,
    // we will also need to render the basic default template. If we
    // do NOT support non-JS browsers, we should instead display an error
    // message.
    $isHierarchical = in_array($facet, $hierarchicalFacets);
    $noJsSupport = $this->config()->nonJavascriptSupportEnabled();
  ?>
  <?php if ($isHierarchical): // do we need hierarchical JS display? ?>
    <?=$this->context($this)->renderInContext(
      'Recommend/SideFacets/hierarchical-facet.phtml',
      [
        'allowExclude' => $this->recommend->excludeAllowed($facet),
        'title' => $facet,
        'sortOptions' => $hierarchicalFacetSortOptions[$facet] ?? $hierarchicalFacetSortOptions['*'] ?? null,
        'collapsedFacets' => $this->collapsedFacets
      ]
    ); ?>
    <noscript>
    <?php if (!$noJsSupport): ?>
      <span class="facet"><?=$this->transEsc('Please enable JavaScript.')?></span>
    <?php endif; ?>
  <?php endif; ?>
  <?php if (!$isHierarchical || $noJsSupport): // do we need regular display? ?>
    <?php
      /* finc specific: do not hide selected facet within more-cluster */
      $facetsBeforeMore = $this->recommend->getShowMoreSetting($facet);
      foreach ($cluster['list'] as $i => $clusterFacet) {
        if ($clusterFacet['isApplied'] && $i + 1 > $facetsBeforeMore) {
          $facetsBeforeMore = $i + 1;
        }
      }
      /* finc specific - END */
    ?>
    <?=$this->context($this)->renderInContext(
      'Recommend/SideFacets/cluster-list.phtml',
      [
        'options' => $options, 'title' => $facet, 'cluster' => $cluster,
        'allowExclude' => $this->recommend->excludeAllowed($facet),
        'facets_before_more' => $facetsBeforeMore,
        'showMoreInLightbox' => $this->recommend->getShowInLightboxSetting($facet)
      ]
    ); ?>
  <?php endif; ?>
  <?php if ($isHierarchical): // close tag opened in matching if above ?>
    </noscript>
  <?php endif; ?>
<?php endif; ?>
<!-- finc-accessibility - Recommend - SideFacets - facet.phtml - END -->