3 declare(strict_types=1);
29 $ilTree = $DIC[
'tree'];
35 $ilTree->getNodeData(1)
39 $data = $ilTree->getChilds($ref);
40 if (count(
$data) === 0) {
46 public function getChildren($record, $environment = null): array
51 public function build(
55 ): \ILIAS\UI\Component\Tree\Node\Node {
57 $label = $record[
'title']
58 .
' (' . $record[
'type'] .
', ' .
$ref_id .
')';
60 $icon = $environment[
'icon_factory']->standard($record[
"type"],
'');
61 $url = $this->getAsyncURL($environment, (
string)
$ref_id);
63 $node = $factory->simple($label, $icon)
67 if ((
int) $ref_id > 9 && (
int) $ref_id < 20) {
68 $label = $environment[
'modal']->getShowSignal()->getId();
69 $node = $factory->simple($label)
71 ->withOnClick($environment[
'modal']->getShowSignal());
77 protected function getAsyncURL($environment,
string $ref_id):
string 79 $url = $environment[
'url'];
80 $base = substr(
$url, 0, strpos(
$url,
'?') + 1);
81 $query = parse_url(
$url, PHP_URL_QUERY);
93 $f = $DIC->ui()->factory();
95 $image =
$f->image()->responsive(
"assets/ui-examples/images/Image/mountains.jpg",
"Image source: https://stocksnap.io, Creative Commons CC0 license");
96 $page =
$f->modal()->lightboxImagePage($image,
'Mountains');
97 $modal =
$f->modal()->lightbox($page);
100 'url' => $DIC->http()->request()->getRequestTarget(),
102 'icon_factory' =>
$f->symbol()->icon()
105 $tree =
$f->tree()->expandable(
"Label", $recursion)
106 ->withEnvironment($environment)
110 return $renderer->render([$modal, $tree]);
112 echo
$renderer->renderAsync([$modal, $tree->withIsSubTree(
true)]);
if(! $DIC->user() ->getId()||!ilLTIConsumerAccess::hasCustomProviderCreationAccess()) $params
Interface Observer Contains several chained tasks and infos about them.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This is how the factory for UI elements looks.
if($request_wrapper->has('async_ref') && $request_wrapper->retrieve('async_ref', $refinery->kindlyTo() ->bool())) expandable_async_repo($ref=null)
description: > Example for rendering an expandable tree with asynchronous repositories.