100 if (!isset($a_target) or !is_string($a_target))
102 $this->ilias->raiseError(get_class($this).
"::Constructor(): No target given!",$this->ilias->error_obj->WARNING);
105 if (!isset($a_directory) or !is_string($a_directory))
107 $this->ilias->raiseError(get_class($this).
"::Constructor(): No directory given!",$this->ilias->error_obj->WARNING);
111 $this->directory = $a_directory;
112 $this->output = array();
113 $this->expanded = array();
114 $this->target = $a_target;
115 $this->target_get =
'ref_id';
116 $this->frame_target =
"_top";
117 $this->order_column =
"title";
118 $this->expand_target = $_SERVER[
"PATH_INFO"];
119 $this->rbac_check =
true;
120 $this->output_icons =
true;
130 $this->order_column = $a_column;
140 if (!isset($a_target_get) or !is_string($a_target_get))
142 $this->ilias->raiseError(get_class($this).
"::setTargetGet(): No target given!",$this->ilias->error_obj->WARNING);
145 $this->target_get = $a_target_get;
155 if (!isset($a_params_get) or !is_array($a_params_get))
157 $this->ilias->raiseError(get_class($this).
"::setTargetGet(): No target given!",$this->ilias->error_obj->WARNING);
160 foreach ($a_params_get as $key => $val)
162 $str .=
"&".$key.
"=".$val;
165 $this->params_get = $str;
177 $this->expand_target = $a_exp_target;
187 $this->rbac_check = $a_check;
197 $this->output_icons = $a_icons;
213 if (!isset($a_parent_id))
215 $this->ilias->raiseError(get_class($this).
"::setOutput(): No node_id given!",$this->ilias->error_obj->WARNING);
220 $tab = ++$a_depth - 2;
221 foreach ($objects as $key => $object)
224 if ($this->filtered ==
false || $this->
checkFilter($object[
"type"])==
true)
226 if ($object[
"child"] != $this->tree->getRootId())
228 $parent_index = $this->
getIndex($object);
230 $this->format_options[
"$counter"][
"parent"] = $object[
"parent"];
231 $this->format_options[
"$counter"][
"child"] = $object[
"child"];
232 $this->format_options[
"$counter"][
"title"] = $object[
"title"];
233 $this->format_options[
"$counter"][
"type"] = $object[
"type"];
234 $this->format_options[
"$counter"][
"desc"] =
"obj_".$object[
"type"];
235 $this->format_options[
"$counter"][
"depth"] =
$tab;
236 $this->format_options[
"$counter"][
"container"] =
false;
237 $this->format_options[
"$counter"][
"visible"] =
true;
240 for ($i = 0; $i <
$tab; ++$i)
242 $this->format_options[
"$counter"][
"tab"][] =
'blank';
246 if ($object[
"child"] != $this->tree->getRootId() and (!in_array($object[
"parent"],$this->expanded)
247 or !$this->format_options[
"$parent_index"][
"visible"]))
249 $this->format_options[
"$counter"][
"visible"] =
false;
253 if ($object[
"child"] != $this->tree->getRootId())
255 $this->format_options[
"$parent_index"][
"container"] =
true;
257 if (in_array($object[
"parent"],$this->expanded))
259 $this->format_options[
"$parent_index"][
"tab"][($tab-2)] =
'minus';
263 $this->format_options[
"$parent_index"][
"tab"][($tab-2)] =
'plus';
270 $this->
setOutput($object[
"child"],$a_depth);
280 $handle = opendir($a_parent_dir);
285 $files[] = array(
"type" =>
"file",
"name" =>
$file);
289 $files[] = array(
"type" =>
"dir",
"name" =>
$file);
303 $this->format_options[0][
"tab"] = array();
313 foreach ($this->format_options as $key => $options)
315 if ($options[
"visible"] and $key != 0)
325 return implode(
'',$this->output);
352 if (!isset($a_node_id) or !is_array($a_option))
354 $this->ilias->raiseError(get_class($this).
"::formatObject(): Missing parameter or wrong datatype! ".
355 "node_id: ".$a_node_id.
" options:".var_dump($a_option),$this->ilias->error_obj->WARNING);
360 foreach ($a_option[
"tab"] as $picture)
362 if ($picture ==
'plus')
365 $tpl->setCurrentBlock(
"expander");
368 $tpl->parseCurrentBlock();
371 if ($picture ==
'minus')
374 $tpl->setCurrentBlock(
"expander");
377 $tpl->parseCurrentBlock();
380 if ($picture ==
'blank' or $picture ==
'winkel'
381 or $picture ==
'hoch' or $picture ==
'quer' or $picture ==
'ecke')
383 $tpl->setCurrentBlock(
"expander");
385 $tpl->setVariable(
"TXT_ALT_IMG", $lng->txt($a_option[
"desc"]));
386 $tpl->parseCurrentBlock();
390 if ($this->output_icons)
392 $tpl->setCurrentBlock(
"icon");
394 $tpl->setVariable(
"TXT_ALT_IMG", $lng->txt($a_option[
"desc"]));
395 $tpl->parseCurrentBlock();
397 $tpl->setCurrentBlock(
"row");
398 $target = (strpos($this->target,
"?") ===
false) ?
399 $this->target.
"?" : $this->target.
"&";
400 $tpl->setVariable(
"LINK_TARGET",
$target.$this->target_get.
"=".$a_node_id.$this->params_get);
401 $tpl->setVariable(
"TITLE", $a_option[
"title"]);
403 if ($this->frame_target !=
"")
405 $tpl->setVariable(
"TARGET",
" target=\"".$this->frame_target.
"\"");
408 $tpl->parseCurrentBlock();
410 $this->output[] =
$tpl->get();
422 if (!isset($a_type) or !is_string($a_type) or !isset($a_node_id))
424 $this->ilias->raiseError(get_class($this).
"::createTarget(): Missing parameter or wrong datatype! ".
425 "type: ".$a_type.
" node_id:".$a_node_id,$this->ilias->error_obj->WARNING);
431 $a_node_id = $a_type ==
'+' ? $a_node_id : -(int) $a_node_id;
433 $sep = (is_int(strpos($this->expand_target,
"?")))
436 return $this->expand_target.$sep.
"expand=".$a_node_id.$this->params_get;
447 $this->frame_target = $a_target;
457 for ($i = 0; $i < count($this->format_options); ++$i)
459 if ($this->format_options[$i][
"depth"] == $a_depth+1
460 and !$this->format_options[$i][
"container"]
461 and $this->format_options[$i][
"depth"] != 1)
463 $this->format_options[$i][
"tab"][
"$a_depth"] =
"quer";
466 if ($this->format_options[$i][
"depth"] == $a_depth+2)
468 if ($this->
is_in_array($i+1,$this->format_options[$i][
"depth"]))
470 $this->format_options[$i][
"tab"][
"$a_depth"] =
"winkel";
474 $this->format_options[$i][
"tab"][
"$a_depth"] =
"ecke";
478 if ($this->format_options[$i][
"depth"] > $a_depth+2)
482 $this->format_options[$i][
"tab"][
"$a_depth"] =
"hoch";
497 for ($i=$a_start;$i<count($this->format_options);++$i)
499 if ($this->format_options[$i][
"depth"] < $a_depth)
504 if ($this->format_options[$i][
"depth"] == $a_depth)
520 foreach ($this->format_options as $key => $value)
522 if (($value[
"child"] == $a_data[
"parent"]))
529 $this->ilias->raiseError(get_class($this).
"::getIndex(): Error in tree. No index found!",$this->ilias->error_obj->FATAL);
542 if (is_array($this->filter))
545 foreach ($this->filter as $item)
547 if ($item == $a_item)
557 $this->filter = array();
560 if ($is_present == 0)
562 $this->filter[] = $a_item;
578 if (is_array($this->filter))
583 foreach ($this->filter as $item)
585 if ($item != $a_item)
594 $this->filter = $tmp;
622 $_SESSION[
"expand"] = array($this->tree->getRootId());
625 if ($a_node_id > 0 && !in_array($a_node_id,
$_SESSION[
"expand"]))
627 array_push(
$_SESSION[
"expand"],$a_node_id);
632 $key = array_keys(
$_SESSION[
"expand"],-(
int) $a_node_id);
646 $this->filtered = $a_bool;
658 if (is_array($this->filter))
660 return in_array($a_item, $this->filter);