28 protected array
$nr = array();
34 $this->list_class[0] =
"il_Explorer";
35 $this->childs[0] = array();
41 $this->item_class = $a_val;
50 public function setListClass(
string $a_val,
int $a_depth = 0): void
52 $this->list_class[$a_depth] = $a_val;
57 return $this->list_class[$a_depth] ??
"";
65 $this->nodes[$a_id] = $a_content;
66 $this->childs[$a_parent][] = $a_id;
71 $this->auto_numbering = $a_val;
76 return $this->auto_numbering;
86 $tpl =
new ilTemplate(
"tpl.nested_list.html",
true,
true,
"Services/UIComponent/NestedList");
90 if (isset($this->childs[0]) && count($this->childs[0]) > 0) {
91 $this->listStart(
$tpl, $depth);
92 foreach ($this->childs[0] as $child) {
93 $this->renderNode($child,
$tpl, $depth, $nr);
107 if (!isset($nr[$depth])) {
114 if ($this->getAutoNumbering()) {
115 for (
$i = 1;
$i <= $depth;
$i++) {
116 $nr_str .= $sep . $nr[
$i];
121 $this->listItemStart(
$tpl);
122 $tpl->setCurrentBlock(
"content");
123 $tpl->setVariable(
"CONTENT", $nr_str .
" " . $this->nodes[$a_id]);
124 $this->nr[$a_id] = $nr_str;
126 $tpl->parseCurrentBlock();
127 $tpl->touchBlock(
"tag");
129 if (isset($this->childs[$a_id]) && count($this->childs[$a_id]) > 0) {
130 $this->listStart(
$tpl, $depth + 1);
131 foreach ($this->childs[$a_id] as $child) {
132 $this->renderNode($child,
$tpl, $depth + 1, $nr);
134 $this->listEnd(
$tpl);
136 unset($nr[$depth + 1]);
138 $this->listItemEnd(
$tpl);
143 if ($this->getItemClass() !==
"") {
144 $tpl->setCurrentBlock(
"list_item_start");
145 $tpl->setVariable(
"LI_CLASS",
' class="' . $this->getItemClass() .
'" ');
146 $tpl->parseCurrentBlock();
148 $tpl->touchBlock(
"list_item_start");
150 $tpl->touchBlock(
"tag");
155 $tpl->touchBlock(
"list_item_end");
156 $tpl->touchBlock(
"tag");
163 $class = ($this->getListClass($depth) !==
"")
164 ? $this->getListClass($depth)
165 : $this->getListClass();
168 $tpl->setCurrentBlock(
"list_start");
169 $tpl->setVariable(
"UL_CLASS",
' class="' . $class .
'" ');
170 $tpl->parseCurrentBlock();
172 $tpl->touchBlock(
"list_start");
174 $tpl->touchBlock(
"tag");
180 $tpl->touchBlock(
"list_end");
181 $tpl->touchBlock(
"tag");
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
if(!file_exists(getcwd() . '/ilias.ini.php'))
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
if($DIC->http() ->request() ->getMethod()=="GET" &&isset($DIC->http() ->request() ->getQueryParams()['tex'])) $tpl