UPDATE-RATE

Die Test-Installation wird aktuell zwischen 8:00 und 18:00 Uhr stündlich zur vollen Stunde aktualisiert.

Alles neu macht der Mai

ILIAS 9 ist da! Alle Infos zu den Highlights der neuen Version gibt es hier!

Documentation

Kitchen Sink documentation of style: 'Delos' of skin: 'ILIAS'

Sortation

Description

Purpose
The sortation view control enables users to change the order in which some data is presented. This control applies to all sorts of _structured_ data, like tables and lists.
Composition
Sortation uses a Dropdown to display a collection of shy-buttons.
Effect
A click on an option will change the ordering of the associated data-list by calling a page with a parameter according to the selected option or triggering a signal. The label displayed in the dropdown will be set to the selected sorting.

Rules

Usage
  1. A Sortation MUST NOT be used standalone.
  2. Sortations MUST BE visually close to the list or table their operation will have effect upon.
  3. There SHOULD NOT be more than one Sortation per view.
Accessibility
  1. Sortation MUST be operable via keyboard only.

Example 1: Async

<?php
 
declare(strict_types=1);
 
namespace ILIAS\UI\examples\ViewControl\Sortation;
 
//Async example show-casing how this control can be used, without reloading the page
function async()
{
    //Loading factories
    global $DIC;
    $f = $DIC->ui()->factory();
    $renderer = $DIC->ui()->renderer();
    $refinery = $DIC->refinery();
    $request_wrapper = $DIC->http()->wrapper()->query();
 
    //Initializing the options, note that the label is taken care of by JS
    $options = [
        'default_option' => 'Default Ordering',
        'latest' => 'Most Recent Ordering',
        'oldest' => 'Oldest Ordering'
    ];
 
    //Note that the selected option needs to be displayed in the label
    $select_option = 'default_option';
    if ($request_wrapper->has('sortation') && $request_wrapper->retrieve('sortation', $refinery->kindlyTo()->string())) {
        $select_option = $request_wrapper->retrieve('sortation', $refinery->kindlyTo()->string());
    }
 
    //Generation of the UI Component
    $modal = $f->modal()->lightbox($f->modal()->lightboxTextPage('Note: This is just used to show case, how 
        this control can be used,to change an other components content.', "Sortation has changed: " . $options[$select_option]));
    $s = $f->viewControl()->sortation($options)
            ->withTargetURL($DIC->http()->request()->getRequestTarget(), 'sortation')
            ->withLabel($options[$select_option])
            ->withOnSort($modal->getShowSignal());
 
    //Rendering
    return $renderer->render([$s,$modal]);
}
 

Example 2: Base

<?php
 
declare(strict_types=1);
 
namespace ILIAS\UI\examples\ViewControl\Sortation;
 
//Base example, show-casing how this control is used if firing leads to some
//Reload of the page
function _Base()
{
    //Loading factories
    global $DIC;
    $f = $DIC->ui()->factory();
    $renderer = $DIC->ui()->renderer();
    $refinery = $DIC->refinery();
    $request_wrapper = $DIC->http()->wrapper()->query();
 
    //Initializing the options
    $options = [
        'default_option' => 'Default Ordering',
        'latest' => 'Most Recent Ordering',
        'oldest' => 'Oldest Ordering'
    ];
 
    //Note that the selected option needs to be displayed in the label
    $select_option = 'default_option';
    if ($request_wrapper->has('sortation') && $request_wrapper->retrieve('sortation', $refinery->kindlyTo()->string())) {
        $select_option = $request_wrapper->retrieve('sortation', $refinery->kindlyTo()->string());
    }
 
    //Generation of the UI Component
    $s = $f->viewControl()->sortation($options)
           ->withTargetURL($DIC->http()->request()->getRequestTarget(), 'sortation')
           ->withLabel($options[$select_option]);
 
    //Rendering
    return $renderer->render($s);
}
 

Example 3: Small

<?php
 
declare(strict_types=1);
 
namespace ILIAS\UI\examples\ViewControl\Sortation;
 
//This can be used, when space is very scarce and the label can not be displayed
function small()
{
    //Loading factories
    global $DIC;
    $f = $DIC->ui()->factory();
    $renderer = $DIC->ui()->renderer();
 
    $options = array(
        'default_option' => 'Default Ordering',
        'latest' => 'Most Recent Ordering',
        'oldest' => 'Oldest Ordering'
    );
 
    //Note that no label is attached
    $s = $f->viewControl()->sortation($options)
        ->withTargetURL($DIC->http()->request()->getRequestTarget(), 'sortation');
 
 
    return $renderer->render($s);
}
 

Relations

Parents
  1. UIComponent
  2. View Control