Hourly Updates

To provide you always with the latest bugfixes, we are updating this test installation during daytime at the full hour. The test installation then will be shortly offline. Sorry for any inconvenience.

Layout

Einstellungen für das Erscheinungsbild der Installation und für Styles bestimmter Inhaltsobjekte

Reiter

System-Styles: Unterpunkte

Sequence

Description

Purpose
The Sequence Navigation is used to move through a series of content segments in a particular order. Segments (or the amount of) may change during navigation, however, they will remain in a consecutive order.
Composition
Sequence Navigation consists of several groups of buttons, mainly. First of all, there is the primary navigation of back- and next buttons to navigate through the parts of the sequence; a part is called a "Segment". While every Segment of a sequence is part of a bigger process (i.e. the perception of the entire sequence), there might be additional buttons for actions targeting outer context, or terminating the browsing of the sequence. Every shown segement may also add buttons with actions regarding the current segement. Finally, there may be view controls and filters to change the amount of and manner in which the segments are displayed,
Effect
By pressing the forward and backward navigation buttons, users can switch between the segments of a sequence. Other buttons will trigger their respective actions. Operating view controls and filters will alter the sequence itself or the way its segments are rendered.

Rivals

pagination
Paginations are to display a section of uniform data; segments may vary. Also, a pagination does not enforce linear browsing of its elements - sequences do.

Rules

Usage
  1. Use a sequence when the order of presentation is crucial or the sequencial presentation aids focus. The sequence is not of an explorative nature but rather instructional.
  2. Sequence MUST be called "withRequest", i.e. the current ServerRequest MUST be provided before rendering.
Interaction
  1. Any actions included/provided by (parts of) a segment MUST NOT leave the context of the sequence.

Example 1: Base

pos 1
placeholder for the segment at position 1
<?php

/**
 * This file is part of ILIAS, a powerful learning management system
 * published by ILIAS open source e-Learning e.V.
 *
 * ILIAS is licensed with the GPL-3.0,
 * see https://www.gnu.org/licenses/gpl-3.0.en.html
 * You should have received a copy of said license along with the
 * source code, too.
 *
 * If this is not the case or you just want to try ILIAS, you'll find
 * us at:
 * https://www.ilias.de
 * https://github.com/ILIAS-eLearning
 *
 *********************************************************************/

declare(strict_types=1);

namespace ILIAS\UI\examples\Navigation\Sequence;

use ILIAS\UI\Factory as UIFactory;
use ILIAS\UI\Renderer as UIRenderer;
use ILIAS\UI\Component\Navigation\Sequence\SegmentRetrieval;
use ILIAS\UI\Component\Navigation\Sequence\SegmentBuilder;
use ILIAS\UI\Component\Navigation\Sequence\Segment;
use ILIAS\UI\URLBuilder;
use Psr\Http\Message\ServerRequestInterface;

/**
 * ---
 * description: >
 *   Base example for rendering a sequence navigation.
 *
 * expected output: >
 *   ILIAS shows a group of buttons and different placeholders for the segment.
 *   The navigation buttons are "back" and "next". At first, the "back" button is
 *   inactive until the next button was clicked. On the last segment, the "next"
 *   button will be inactive.
 *   A view control allows the user to select chunks of data, and an additional
 *   button (without real function) is labeled "a global action".
 *   On some segments there is an additional button labeled "a segment action
 *   for pos x". In this example, these buttons don't trigger a function.
 * ---
 */
function base()
{
    global $DIC;
    $f = $DIC['ui.factory'];
    $r = $DIC['ui.renderer'];
    $df = new \ILIAS\Data\Factory();
    $refinery = $DIC['refinery'];
    $request = $DIC->http()->request();

    $binding = new class ($f, $r) implements SegmentRetrieval {
        private array $seq_data;

        public function __construct(
            protected UIFactory $f,
            protected UIRenderer $r
        ) {
            $this->seq_data = [
                ['c0', 'pos 1', '<div style="width: 100%;
                                            height: 500px;
                                            background-color: #b8d7ea;
                                            display: flex;
                                            align-items: center;
                                            justify-content: center;">
                                            placeholder for the segment at position 1</div>'],
                ['c0', 'pos 2', '<div style="width: 100%;
                                            height: 700px;
                                            background-color: #f6d9a1;
                                            display: flex;
                                            align-items: center;
                                            justify-content: center;">
                                            placeholder for the segment at position 2</div>'],
                ['c1', 'pos 3', 'the segment at position 3'],
                ['c2', 'pos 4', 'the segment at position 4'],
                ['c1', 'pos 5', 'the segment at position 5'],
            ];
        }

        public function getAllPositions(
            ServerRequestInterface $request,
            mixed $viewcontrol_values,
            mixed $filter_values,
        ): array {
            $chunks = $viewcontrol_values['chunks'] ?? [];
            $chunks[] = 'c0';
            return array_values(
                array_filter(
                    $this->seq_data,
                    fn($posdata) => in_array($posdata[0], $chunks)
                )
            );
        }

        public function getSegment(
            ServerRequestInterface $request,
            mixed $position_data,
            mixed $viewcontrol_values,
            mixed $filter_values,
        ): Segment {
            list($chunk, $title, $data) = $position_data;

            $segment = $this->f->legacy()->segment($title, $data);

            if ($chunk === 'c0') {
                $segment = $segment->withSegmentActions(
                    $this->f->button()->standard('a segment action for ' . $title, '#')
                );
            }
            return $segment;
        }
    };

    $viewcontrols = $f->input()->container()->viewControl()->standard([
        $f->input()->viewControl()->fieldSelection(
            [
                'c1' => 'chunk 1',
                'c2' => 'chunk 2',
            ],
            'shown chunks',
            'apply'
        )
        ->withAdditionalTransformation($refinery->custom()->transformation(
            fn($v) => ['chunks' => $v]
        ))
    ])
    ->withAdditionalTransformation(
        $refinery->custom()->transformation(fn($v) => array_shift($v))
    );

    $global_actions = [
        $f->button()->standard('a global action', '#')
    ];

    $sequence = $f->navigation()->sequence($binding)
        ->withViewControls($viewcontrols)
        ->withId('example')
        ->withActions($global_actions)
        ->withRequest($request);

    $out = [];
    $out[] = $sequence;

    return $r->render($out);
}

Relations

Parents
  1. UIComponent
  2. Navigation