3 declare(strict_types=1);
    22     $ui_factory = $DIC[
'ui.factory'];
    24     $data_factory = new \ILIAS\Data\Factory();
    25     $request = $DIC->http()->request();
    26     $ctrl = $DIC[
'ilCtrl'];
    27     $spacer = $ui_factory->divider()->horizontal();
    29     $url = $data_factory->uri($DIC->http()->request()->getUri()->__toString());
    30     $url = 
$url->withParameter(
'launcher_redirect', 
'');
    33     $description = 
'<p>Before you can join this group, you will have to accept the terms and conditions</p>';
    34     $instruction = $ui_factory->messageBox()->info(
'Accept the conditions.');
    35     $group = $ui_factory->input()->field()->group([
    36             $ui_factory->input()->field()->checkbox(
'Understood', 
'ok')
    38     $evaluation = 
function (
Result $result, 
Launcher &$launcher) use ($ctrl, $ui_factory) {
    39         if ($result->
isOK() && $result->
value()[0]) {
    41                 (
string) $launcher->getTarget()->getURL()->withParameter(
'launcher_redirect', 
'terms accepted (' . $launcher->getButtonLabel() . 
')')
    44         $launcher = $launcher->withStatusMessageBox($ui_factory->messageBox()->failure(
'You must accept the conditions.'));
    47     $target = $data_factory->link(
'Join Group', 
$url->withParameter(
'launcher_id', 
'l1'));
    49     $launcher = $ui_factory->launcher()
    51         ->withDescription($description)
    52         ->withInputs($group, $evaluation, $instruction);
    54     if (array_key_exists(
'launcher_id', $request->getQueryParams()) && $request->getQueryParams()[
'launcher_id'] === 
'l1') {
    55         $launcher = $launcher->withRequest($request);
    59     $icon = $ui_factory->symbol()->icon()->standard(
'auth', 
'authentification needed', 
'large');
    60     $description = 
'<p>Before you can take the survey, you have to agree to our terms and conditions.</p>';
    61     $target = $data_factory->link(
'Take Survey', 
$url->withParameter(
'launcher_id', 
'l2'));
    62     $launcher2 = $ui_factory->launcher()
    64         ->withStatusIcon($icon)
    65         ->withButtonLabel(
'Take Survey')
    66         ->withDescription($description)
    67         ->withInputs($group, $evaluation);
    69     if (array_key_exists(
'launcher_id', $request->getQueryParams()) && $request->getQueryParams()[
'launcher_id'] === 
'l2') {
    70         $launcher2 = $launcher2->withRequest($request);
    75     $icon = $ui_factory->symbol()->icon()->standard(
'ps', 
'authentification needed', 
'large');
    76     $status_message = $ui_factory->messageBox()->info(
"You will be asked for your personal passcode when you start the test.");
    77     $instruction = $ui_factory->messageBox()->info(
'Fill the form; use password "ilias" to pass');
    78     $group = $ui_factory->input()->field()->group([
    79             $ui_factory->input()->field()->password(
'pwd', 
'Password')
    81     $evaluation = 
function (
Result $result, 
Launcher &$launcher) use ($ctrl, $ui_factory) {
    82         if ($result->
isOK() && $result->
value()[0]->toString() === 
'ilias') {
    84                 (
string) $launcher->getTarget()->getURL()->withParameter(
'launcher_redirect', 
'password protected')
    87         $launcher = $launcher->withStatusMessageBox($ui_factory->messageBox()->failure(
'nope. wrong pass.'));
    90     $target = $data_factory->link(
'Begin Exam', 
$url->withParameter(
'launcher_id', 
'l3'));
    91     $launcher3 = $ui_factory->launcher()
    94         ->withInputs($group, $evaluation, $instruction)
    95         ->withStatusIcon($icon)
    96         ->withStatusMessageBox($status_message)
    97         ->withModalSubmitLabel(
'Begin Exam')
    98         ->withModalCancelLabel(
'Cancel')
   101     if (array_key_exists(
'launcher_id', $request->getQueryParams()) && $request->getQueryParams()[
'launcher_id'] === 
'l3') {
   102         $launcher3 = $launcher3->withRequest($request);
   106     $result = 
"not submitted or wrong pass";
   108     if (array_key_exists(
'launcher_redirect', $request->getQueryParams())
   109         && $v = $request->getQueryParams()[
'launcher_redirect']
   111         $result = 
"<b>sucessfully redirected ($v)</b>";
   114     return $result . 
"<hr/>" . 
$renderer->render([
 isOK()
Get to know if the result is ok. 
 
value()
Get the encapsulated value. 
 
with_fields()
 expected output: > ILIAS shows the rendered Component.