UPDATE-RATE

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

Documentation

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

Inline

Description

Purpose
The Inline Launcher is meant to be used nested within Components (e.g. Cards or Panels). It provides description and status information at a glance.
Effect
The Form will be shown in an Interruptive Modal when clicking the Button. On Submitting the modal, either a message is being displayed (in case of error) or the process/object is launched.

Example 1: Base

You will have 90 minutes to answer all questions.

Please make sure that you have the time to complete the test and that you will be undisturbed. There is no way for you to pause or re-take this test.


This course goes into advanced knowledge for students preparing for the final exam. You should have a firm understanding of the basics before enrolling.


There are still 8 questions left in the survey.

You have completed this test already. If you want you can try it again.
<?php
 
declare(strict_types=1);
 
namespace ILIAS\UI\examples\Launcher\Inline;
 
function base()
{
    global $DIC;
    $ui_factory = $DIC->ui()->factory();
    $data_factory = new \ILIAS\Data\Factory();
    $renderer = $DIC->ui()->renderer();
    $spacer = $ui_factory->divider()->horizontal();
 
    $url = $data_factory->uri($DIC->http()->request()->getUri()->__toString());
 
    $target = $data_factory->link('Start Test', $url);
    $launcher = $ui_factory->launcher()
        ->inline($target)
        ->withDescription('<p>You will have <strong>90 minutes to answer all questions.</strong></p><p>Please make sure that you have the time to complete the test and that you will be undisturbed. There is no way for you to pause or re-take this test.</p>');
 
    $icon = $ui_factory->symbol()->icon()->standard('ps', '', 'large');
 
    $status_message =  $ui_factory->messageBox()->failure("You have to complete all preconditions first.")
        ->withLinks([
            $ui_factory->link()->standard("Do this first", "#"),
            $ui_factory->link()->standard("And this is mandatory, too", "#")
        ]);
 
    $launcher2 = $launcher
        ->withDescription('<p>This course goes into advanced knowledge for students preparing for the final exam. You should have a firm understanding of the basics before enrolling.</p>')
        ->withButtonLabel('Course is locked', false)
        ->withStatusIcon($icon)
        ->withStatusMessageBox($status_message);
 
    $target = $data_factory->link('Continue Survey', $url);
    $progressmeter = $ui_factory->chart()->progressMeter()->mini(100, 50, 100);
    $status_message = $ui_factory->messageBox()->info("There are still 8 questions left in the survey.");
    $launcher3 = $ui_factory->launcher()
        ->inline($target)
        ->withStatusIcon($progressmeter)
        ->withStatusMessageBox($status_message)
        ->withDescription('');
 
    $target = $data_factory->link('Repeat Test', $url);
    $status_message = $ui_factory->messageBox()->success("You have completed this test already. If you want you can try it again.");
    $icon = $ui_factory->symbol()->icon()->standard('task', '', 'large');
    $launcher4 = $ui_factory->launcher()
        ->inline($target)
        ->withStatusIcon($icon)
        ->withStatusMessageBox($status_message);
 
    return $renderer->render([
            $launcher,
            $spacer,
            $launcher2,
            $spacer,
            $launcher3,
            $spacer,
            $launcher4
    ]);
}
 

Example 2: With fields

not submitted or wrong pass

Before you can join this group, you will have to accept the terms and conditions


authentification needed

Before you can take the survey, you have to agree to our terms and conditions.


You will be asked for your personal passcode when you start the test.
authentification needed
<?php
 
declare(strict_types=1);
 
namespace ILIAS\UI\examples\Launcher\Inline;
 
use ILIAS\Data\URI;
use ILIAS\Data\Result;
use ILIAS\UI\Component\Launcher\Launcher;
 
/**
 * In this example, the Launcher is configured with inputs;
 * a Modal containing a Form will open upon clicking the launch-button.
 */
function with_fields()
{
    global $DIC;
    $ui_factory = $DIC['ui.factory'];
    $renderer = $DIC['ui.renderer'];
    $data_factory = new \ILIAS\Data\Factory();
    $request = $DIC->http()->request();
    $ctrl = $DIC['ilCtrl'];
    $spacer = $ui_factory->divider()->horizontal();
 
    $url = $data_factory->uri($DIC->http()->request()->getUri()->__toString());
    $url = $url->withParameter('launcher_redirect', '');
 
    //A Launcher with a checkbox-form
    $description = '<p>Before you can join this group, you will have to accept the terms and conditions</p>';
    $instruction = $ui_factory->messageBox()->info('Accept the conditions.');
    $group = $ui_factory->input()->field()->group([
            $ui_factory->input()->field()->checkbox('Understood', 'ok')
    ]);
    $evaluation = function (Result $result, Launcher &$launcher) use ($ctrl, $ui_factory) {
        if ($result->isOK() && $result->value()[0]) {
            $ctrl->redirectToURL(
                (string)$launcher->getTarget()->getURL()->withParameter('launcher_redirect', 'terms accepted (' . $launcher->getButtonLabel() . ')')
            );
        }
        $launcher = $launcher->withStatusMessageBox($ui_factory->messageBox()->failure('You must accept the conditions.'));
    };
 
    $target = $data_factory->link('Join Group', $url->withParameter('launcher_id', 'l1'));
 
    $launcher = $ui_factory->launcher()
        ->inline($target)
        ->withDescription($description)
        ->withInputs($group, $evaluation, $instruction);
 
    if (array_key_exists('launcher_id', $request->getQueryParams()) && $request->getQueryParams()['launcher_id'] === 'l1') {
        $launcher = $launcher->withRequest($request);
    }
 
    //A Launcher with icon
    $icon = $ui_factory->symbol()->icon()->standard('auth', 'authentification needed', 'large');
    $description = '<p>Before you can take the survey, you have to agree to our terms and conditions.</p>';
    $target = $data_factory->link('Take Survey', $url->withParameter('launcher_id', 'l2'));
    $launcher2 = $ui_factory->launcher()
        ->inline($target)
        ->withStatusIcon($icon)
        ->withButtonLabel('Take Survey')
        ->withDescription($description)
        ->withInputs($group, $evaluation);
 
    if (array_key_exists('launcher_id', $request->getQueryParams()) && $request->getQueryParams()['launcher_id'] === 'l2') {
        $launcher2 = $launcher2->withRequest($request);
    }
 
 
    //A Launcher with password field
    $icon = $ui_factory->symbol()->icon()->standard('ps', 'authentification needed', 'large');
    $status_message = $ui_factory->messageBox()->info("You will be asked for your personal passcode when you start the test.");
    $instruction = $ui_factory->messageBox()->info('Fill the form; use password "ilias" to pass');
    $group = $ui_factory->input()->field()->group([
            $ui_factory->input()->field()->password('pwd', 'Password')
    ]);
    $evaluation = function (Result $result, Launcher &$launcher) use ($ctrl, $ui_factory) {
        if ($result->isOK() && $result->value()[0]->toString() === 'ilias') {
            $ctrl->redirectToURL(
                (string)$launcher->getTarget()->getURL()->withParameter('launcher_redirect', 'password protected')
            );
        }
        $launcher = $launcher->withStatusMessageBox($ui_factory->messageBox()->failure('nope. wrong pass.'));
    };
 
    $target = $data_factory->link('Begin Exam', $url->withParameter('launcher_id', 'l3'));
    $launcher3 = $ui_factory->launcher()
        ->inline($target)
        ->withDescription('')
        ->withInputs($group, $evaluation, $instruction)
        ->withStatusIcon($icon)
        ->withStatusMessageBox($status_message)
        ->withModalSubmitLabel('Begin Exam')
        ->withModalCancelLabel('Cancel')
    ;
 
    if (array_key_exists('launcher_id', $request->getQueryParams()) && $request->getQueryParams()['launcher_id'] === 'l3') {
        $launcher3 = $launcher3->withRequest($request);
    }
 
 
    $result = "not submitted or wrong pass";
 
    if (array_key_exists('launcher_redirect', $request->getQueryParams())
        && $v = $request->getQueryParams()['launcher_redirect']
    ) {
        $result = "<b>sucessfully redirected ($v)</b>";
    }
 
    return $result . "<hr/>" . $renderer->render([
        $launcher,
        $spacer,
        $launcher2,
        $spacer,
        $launcher3
    ]);
}
 

Relations

Parents
  1. UIComponent
  2. Launcher