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'

Legacy

Description

Purpose
Secondary Legacy Panel present content from a Legacy component.
Composition
The Secondary Legacy Panel is composed of title and a Legacy component. Additionally, it may have an optional footer area containing a Shy Button.
Context
  1. Marginal Grid Calendar.
  2. Marginal Blog section.
  3. Marginal Poll section.

Example 1: Base

Legacy panel title

Legacy content
<?php
 
declare(strict_types=1);
 
namespace ILIAS\UI\examples\Panel\Secondary\Legacy;
 
function base()
{
    global $DIC;
    $factory = $DIC->ui()->factory();
    $renderer = $DIC->ui()->renderer();
 
    $actions = $factory->dropdown()->standard(array(
        $factory->button()->shy("ILIAS", "https://www.ilias.de"),
        $factory->button()->shy("GitHub", "https://www.github.com")
    ));
 
    $legacy = $factory->legacy("Legacy content");
 
    $panel = $factory->panel()->secondary()->legacy(
        "Legacy panel title",
        $legacy
    )->withActions($actions);
 
    return $renderer->render($panel);
}
 

Example 2: With all view controls

List Title

Subtitle 1

  • Item Title

    Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua.

    OriginCourse Title 1
    Last Update24.11.2011
    LocationRoom 123, Main Street 44, 3012 Bern
  • Item 2 Title

    Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua.

Subtitle 2

  • Item 3 Title

    Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua.
<?php
 
declare(strict_types=1);
 
namespace ILIAS\UI\examples\Panel\Secondary\Legacy;
 
function with_all_view_controls(): string
{
    global $DIC;
    $f = $DIC->ui()->factory();
    $renderer = $DIC->ui()->renderer();
    $refinery = $DIC->refinery();
    $request_wrapper = $DIC->http()->wrapper()->query();
 
    $url = $DIC->http()->request()->getRequestTarget();
 
    $actions = $f->dropdown()->standard([
        $f->button()->shy("ILIAS", "https://www.ilias.de"),
        $f->button()->shy("GitHub", "https://www.github.com")
    ]);
    $current_sortation = 'abc';
    if ($request_wrapper->has('sort')) {
        $current_sortation = $request_wrapper->retrieve('sort', $refinery->kindlyTo()->string());
    }
 
    $sortation_options = [
        'abc' => 'Sort by Alphabet',
        'date' => 'Sort by Date',
        'location' => 'Sort by Location'
    ];
    $sortation = $f->viewControl()->sortation($sortation_options)
                   ->withTargetURL($url, "sort")
                   ->withLabel($sortation_options[$current_sortation]);
 
    $current_presentation = 'list';
    if ($request_wrapper->has('mode')) {
        $current_presentation = $request_wrapper->retrieve('mode', $refinery->kindlyTo()->string());
    }
    $presentation_options = [
        'list' => 'List View',
        'tile' => 'Tile View'
    ];
    $modes = $f->viewControl()->mode(
        array_reduce(
            array_keys($presentation_options),
            static function ($carry, $item) use ($presentation_options, $url) {
                $carry[$presentation_options[$item]] = "$url&mode=$item";
                return $carry;
            },
            []
        ),
        'Presentation Mode'
    )
               ->withActive($presentation_options[$current_presentation]);
 
    $current_page = 0;
    if ($request_wrapper->has('page')) {
        $current_page = $request_wrapper->retrieve('page', $refinery->kindlyTo()->int());
    }
    $pagination = $f->viewControl()->pagination()
                    ->withTargetURL($url, "page")
                    ->withTotalEntries(98)
                    ->withPageSize(10)
                    ->withCurrentPage($current_page);
 
    $view_controls = [
        $sortation,
        $modes,
        $pagination
    ];
 
    if ($current_presentation === 'list') {
        $item1 = $f->item()->standard("Item Title")
                   ->withActions($actions)
                   ->withProperties([
                       "Origin" => "Course Title 1",
                       "Last Update" => "24.11.2011",
                       "Location" => "Room 123, Main Street 44, 3012 Bern"
                   ])
                   ->withDescription(
                       "Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua."
                   );
 
        $item2 = $f->item()->standard("Item 2 Title")
                   ->withActions($actions)
                   ->withDescription(
                       "Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua."
                   );
 
        $item3 = $f->item()->standard("Item 3 Title")
                   ->withActions($actions)
                   ->withDescription(
                       "Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua."
                   );
    } else {
        $image = $f->image()->responsive(
            "./templates/default/images/logo/HeaderIcon.svg",
            "Thumbnail Example"
        );
        $content = $f->listing()->descriptive(
            [
                "Entry 1" => "Some text",
                "Entry 2" => "Some more text",
            ]
        );
        $item1 = $item2 = $item3 = $f->card()->standard("Item Title", $image)
                                     ->withSections([$content]);
    }
 
    $std_list = $f->panel()->secondary()->legacy(
        "List Title",
        $f->legacy(
            $renderer->render([
                $f->item()->group("Subtitle 1", [
                    $item1,
                    $item2
                ]),
                $f->item()->group("Subtitle 2", [
                    $item3
                ])
            ])
        )
    )
                  ->withActions($actions)
                  ->withViewControls($view_controls);
 
    return $renderer->render($std_list);
}
 

Example 3: With footer

panel title

<?php
 
declare(strict_types=1);
 
namespace ILIAS\UI\examples\Panel\Secondary\Legacy;
 
function with_footer()
{
    global $DIC;
 
    $factory = $DIC->ui()->factory();
    $renderer = $DIC->ui()->renderer();
 
    $tags = ["PHP", "ILIAS", "Sofware", "SOLID", "Domain Driven"];
 
    $html = "";
    foreach ($tags as $tag) {
        $html .= $renderer->render($factory->button()->tag($tag, ""));
    }
 
    $legacy = $factory->legacy($html);
    $link = $factory->button()->Shy("Edit Keywords", "");
 
    $panel = $factory->panel()->secondary()->legacy("panel title", $legacy)->withFooter($link);
 
    return $renderer->render($panel);
}
 

Relations

Parents
  1. UIComponent
  2. Panel
  3. Secondary