30 protected array
$nr = array();
36 $this->list_class[0] =
"il_Explorer";
37 $this->childs[0] = array();
43 $this->item_class = $a_val;
52 public function setListClass(
string $a_val,
int $a_depth = 0): void
54 $this->list_class[$a_depth] = $a_val;
59 return $this->list_class[$a_depth] ??
"";
67 $this->nodes[$a_id] = $a_content;
68 $this->childs[$a_parent][] = $a_id;
73 $this->auto_numbering = $a_val;
78 return $this->auto_numbering;
88 $tpl =
new ilTemplate(
"tpl.nested_list.html",
true,
true,
"components/ILIAS/UIComponent/NestedList");
92 if (isset($this->childs[0]) && count($this->childs[0]) > 0) {
93 $this->listStart($tpl, $depth);
94 foreach ($this->childs[0] as $child) {
95 $this->renderNode($child, $tpl, $depth, $nr);
109 if (!isset($nr[$depth])) {
116 if ($this->getAutoNumbering()) {
117 for ($i = 1; $i <= $depth; $i++) {
118 $nr_str .= $sep . $nr[$i];
123 $this->listItemStart($tpl);
124 $tpl->setCurrentBlock(
"content");
125 $tpl->setVariable(
"CONTENT", $nr_str .
" " . $this->nodes[$a_id]);
126 $this->nr[$a_id] = $nr_str;
128 $tpl->parseCurrentBlock();
129 $tpl->touchBlock(
"tag");
131 if (isset($this->childs[$a_id]) && count($this->childs[$a_id]) > 0) {
132 $this->listStart($tpl, $depth + 1);
133 foreach ($this->childs[$a_id] as $child) {
134 $this->renderNode($child, $tpl, $depth + 1, $nr);
136 $this->listEnd($tpl);
138 unset($nr[$depth + 1]);
140 $this->listItemEnd($tpl);
145 if ($this->getItemClass() !==
"") {
147 $tpl->
setVariable(
"LI_CLASS",
' class="' . $this->getItemClass() .
'" ');
165 $class = ($this->getListClass($depth) !==
"")
166 ? $this->getListClass($depth)
167 : $this->getListClass();
171 $tpl->
setVariable(
"UL_CLASS",
' class="' . $class .
'" ');
setVariable($variable, $value='')
Sets a variable value.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
listItemStart(ilTemplate $tpl)
listStart(ilTemplate $tpl, int $depth)
getListClass(int $a_depth=0)
renderNode( $a_id, ilTemplate $tpl, int $depth, array &$nr)
listItemEnd(ilTemplate $tpl)
setListClass(string $a_val, int $a_depth=0)
setItemClass(string $a_val)
setAutoNumbering(bool $a_val)
addListNode(string $a_content, string $a_id, $a_parent=0)
special template class to simplify handling of ITX/PEAR
setCurrentBlock(string $part=ilGlobalTemplateInterface::DEFAULT_BLOCK)
parseCurrentBlock(string $part=ilGlobalTemplateInterface::DEFAULT_BLOCK)
touchBlock(string $block)
if(!file_exists('../ilias.ini.php'))