ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
trait.ilSearchResultTableHelper.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
21use ILIAS\UI\Component\ViewControl\Sortation as SortationViewControl;
22
24{
25 protected string $current_sortation;
26
30 abstract protected function getPossibleSortations(): array;
31
32 abstract protected function getDefaultSortation(): string;
33
34 protected function getCurrentSortation(): string
35 {
36 if (isset($this->current_sortation)) {
37 return $this->current_sortation;
38 }
39
40 $sortation = $this->getDefaultSortation();
41 if ($this->http->wrapper()->query()->has('sortation')) {
42 $sortation = $this->http->wrapper()->query()->retrieve(
43 'sortation',
44 $this->refinery->kindlyTo()->string()
45 );
46 }
47 if (!array_key_exists($sortation, $this->getPossibleSortations())) {
48 $sortation = $this->getDefaultSortation();
49 }
50 return $this->current_sortation = $sortation;
51 }
52
53 protected function buildSortationViewControl(): SortationViewControl
54 {
55 $options = $this->getPossibleSortations();
56 $current_sortation = $this->getCurrentSortation();
57
58 return $this->ui->factory()->viewControl()
59 ->sortation($options, $current_sortation)
60 ->withLabelPrefix($this->lng->txt('search_sort_by'))
61 ->withTargetURL(
62 $this->ctrl->getLinkTarget($this->parent_obj, $this->parent_cmd),
63 'sortation'
64 );
65 }
66}
This describes a Sortation Control.
Definition: Sortation.php:32
static http()
Fetches the global http state from ILIAS.
getDefaultSortation()
getPossibleSortations()
Returns key => label.
trait ilSearchResultTableHelper