19 declare(strict_types=1);
45 $ilTree = $DIC[
'tree'];
51 $ilTree->getNodeData(1)
55 $data = $ilTree->getChilds($ref);
56 if (count(
$data) === 0) {
62 public function getChildren($record, $environment =
null): array
67 public function build(
71 ): \ILIAS\UI\Component\Tree\Node\Node {
73 $label = $record[
'title']
74 .
' (' . $record[
'type'] .
', ' .
$ref_id .
')';
76 $icon = $environment[
'icon_factory']->standard($record[
"type"],
'');
77 $url = $this->getAsyncURL($environment, (
string)
$ref_id);
79 $node = $factory->simple($label, $icon)
83 if ((
int) $ref_id > 9 && (
int) $ref_id < 20) {
84 $label = $environment[
'modal']->getShowSignal()->getId();
85 $node = $factory->simple($label)
87 ->withOnClick($environment[
'modal']->getShowSignal());
93 protected function getAsyncURL($environment,
string $ref_id):
string 95 $url = $environment[
'url'];
96 $base = substr(
$url, 0, strpos(
$url,
'?') + 1);
97 $query = parse_url(
$url, PHP_URL_QUERY);
109 $f = $DIC->ui()->factory();
111 $image =
$f->image()->responsive(
"assets/ui-examples/images/Image/mountains.jpg",
"Image source: https://stocksnap.io, Creative Commons CC0 license");
112 $page =
$f->modal()->lightboxImagePage($image,
'Mountains');
113 $modal =
$f->modal()->lightbox($page);
116 'url' => $DIC->http()->request()->getRequestTarget(),
118 'icon_factory' =>
$f->symbol()->icon()
121 $tree =
$f->tree()->expandable(
"Label", $recursion)
122 ->withEnvironment($environment)
126 return $renderer->render([$modal, $tree]);
128 echo
$renderer->renderAsync([$modal, $tree->withIsSubTree(
true)]);
if(! $DIC->user() ->getId()||!ilLTIConsumerAccess::hasCustomProviderCreationAccess()) $params
Interface Observer Contains several chained tasks and infos about them.
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
exit
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
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.