19 declare(strict_types=1);
32 TOCBuilder::LP_NOT_STARTED =>
"./assets/images/scorm/not_attempted.svg",
33 TOCBuilder::LP_IN_PROGRESS =>
"./assets/images/scorm/incomplete.svg",
34 TOCBuilder::LP_COMPLETED =>
"./assets/images/scorm/completed.svg",
35 TOCBuilder::LP_FAILED =>
"./assets/images/scorm/failed.svg" 54 TOCBuilder::LP_NOT_STARTED =>
'',
55 TOCBuilder::LP_IN_PROGRESS =>
'',
56 TOCBuilder::LP_COMPLETED =>
'',
57 TOCBuilder::LP_FAILED =>
'' 70 $this->node_icons[TOCBuilder::LP_NOT_STARTED] = $lp_icons->getImagePathNotAttempted();
71 $this->node_icons[TOCBuilder::LP_COMPLETED] = $lp_icons->getImagePathCompleted();
72 $this->node_icons[TOCBuilder::LP_IN_PROGRESS] = $lp_icons->getImagePathInProgress();
73 $this->node_icons[TOCBuilder::LP_FAILED] = $lp_icons->getImagePathFailed();
79 $clone->structure = $clone->addIds(json_decode($json_structure,
true));
80 $clone->buildLookup($clone->structure);
81 $clone->open_nodes = array_keys($clone->nodes);
85 protected function addIds(array $node): array
89 if (array_key_exists(
'childs', $node)) {
90 foreach ($node[
'childs'] as $idx => $child) {
91 $node[
'childs'][$idx] = $this->
addIds($child);
99 $this->nodes[$node[
'_id']] = $node;
100 if (array_key_exists(
'childs', $node)) {
101 foreach ($node[
'childs'] as $child) {
112 return reset($this->nodes);
120 $parent_node = $this->nodes[$a_parent_node_id];
121 return (array) ($parent_node[
'childs'] ?? []);
129 return $a_node[
'label'];
137 $state = $a_node[
'state'] ?? TOCBuilder::LP_NOT_STARTED;
138 return $this->node_icons[$state];
146 return $a_node[
'_id'];
154 return $this->url_builder->getHref($a_node[
'command'], $a_node[
'parameter']);
162 return !is_null($a_node[
'parameter']);
170 return $a_node[
'current'] ??
false;
setSkipRootNode(bool $a_val)
static getInstance(int $variant=ilLPStatusIcons::ICON_VARIANT_DEFAULT, ?\ILIAS\UI\Renderer $renderer=null, ?\ILIAS\UI\Factory $factory=null)
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
__construct(LSUrlBuilder $url_builder)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
getChildsOfNode($a_parent_node_id)
__construct(Container $dic, ilPlugin $plugin)
LSUrlBuilder $url_builder
isNodeHighlighted($a_node)
withStructure(string $json_structure)
setNodeOnclickEnabled(bool $nodeOnclickEnabled)