35 public string $id =
"";
74 protected \ILIAS\HTTP\Wrapper\WrapperFactory
$wrapper;
81 $this->obj_definition = $DIC[
"objDefinition"];
82 $this->error = $DIC[
"ilErr"];
83 $this->rbacsystem = $DIC->rbac()->system();
84 $this->tpl = $DIC[
"tpl"];
85 $this->
lng = $DIC->language();
86 $objDefinition = $DIC[
"objDefinition"];
89 if (!isset($a_target) or !is_string($a_target)) {
90 $ilErr->raiseError(get_class($this) .
"::Constructor(): No target given!",
$ilErr->WARNING);
94 $devtypes = $objDefinition->getDevModeAll();
96 if (count($devtypes) > 0) {
100 foreach ($devtypes as
$type) {
105 $this->expanded = array();
106 $this->target = $a_target;
107 $this->target_get =
'ref_id';
108 $this->frame_target =
"content";
109 $this->order_column =
"title";
111 $this->tree->initLangCode();
112 $this->expand_target =
$_SERVER[
"PATH_INFO"] ??
"";
113 $this->rbac_check =
true;
114 $this->output_icons =
true;
115 $this->expand_variable =
"expand";
117 $this->post_sort =
true;
119 $this->highlighted =
"";
120 $this->show_minus =
true;
122 $this->asnch_expanding =
false;
124 $this->wrapper = $DIC->http()->wrapper();
129 $str = $this->
refinery->kindlyTo()->string();
130 if ($this->wrapper->post()->has($key)) {
131 return $this->wrapper->post()->retrieve($key, $str);
133 if ($this->wrapper->query()->has($key)) {
134 return $this->wrapper->query()->retrieve($key, $str);
139 public function setId(
string $a_val): void
151 $this->asnch_expanding = $a_val;
161 $this->counter = $a_number;
166 $this->title = $a_val;
171 $this->textwidth = $a_length;
186 #$this->tree = new ilTree(ROOT_FOLDER_ID,$a_root_id); 187 $this->root_id = $a_root_id;
192 return $this->root_id ?? $this->tree->getRootId();
197 $this->order_column = $a_column;
202 if ($a_direction ===
"desc") {
203 $this->order_direction = $a_direction;
205 $this->order_direction =
"asc";
216 if (!isset($a_target_get) or !is_string($a_target_get)) {
217 $ilErr->raiseError(get_class($this) .
"::setTargetGet(): No target given!",
$ilErr->WARNING);
220 $this->target_get = $a_target_get;
227 if (!isset($a_params_get) or !is_array($a_params_get)) {
228 $ilErr->raiseError(get_class($this) .
"::setTargetGet(): No target given!",
$ilErr->WARNING);
231 foreach ($a_params_get as
$key => $val) {
232 $str .=
"&" .
$key .
"=" . $val;
235 $this->params_get = $str;
246 $this->expand_target = $a_exp_target;
252 string $a_params =
"" 254 $this->up_frame = $a_up_frame;
256 $this->up_params = $a_params;
262 $this->highlighted = $a_id;
267 $this->rbac_check = $a_check;
272 $this->expand_variable = $a_var_name;
277 $this->output_icons = $a_icons;
283 $this->is_clickable[$a_type] =
"";
285 $this->is_clickable[$a_type] =
"n";
295 if (!$this->rbac_check) {
299 $visible = $rbacsystem->
checkAccess(
'visible', $a_ref_id);
307 $this->tree_lead = $a_val;
324 return $this->is_clickable[
$type] !==
"n";
329 $this->post_sort = $a_sort;
334 $this->filter_mode = $a_mode;
351 $this->use_standard_frame = $a_val;
361 return $this->tree->getChilds($a_parent_id, $this->order_column);
373 bool $a_highlighted_subtree =
false 379 if (!isset($a_parent_id)) {
380 $ilErr->raiseError(get_class($this) .
"::setOutput(): No node_id given!",
$ilErr->WARNING);
392 if ($this->
forceExpanded($a_parent_id) && !in_array($a_parent_id, $this->expanded)) {
393 $this->expanded[] = $a_parent_id;
396 if (count($objects) > 0) {
398 $tab = ++$a_depth - 2;
399 if ($this->post_sort) {
400 $objects = $this->
sortNodes($objects, $a_obj_id);
403 foreach ($objects as
$key => $object) {
410 if ($this->filtered ===
false || $this->
checkFilter($object[
"type"]) ===
false) {
411 if ($this->
isVisible($object[
'child'], $object[
'type'])) {
412 #echo 'CHILD getIndex() '.$object['child'].' parent: '.$this->getRoot(); 413 if ($object[
"child"] != $this->
getRoot()) {
414 $parent_index = $this->
getIndex($object);
416 $this->format_options[(string) $this->counter][
"parent"] = $object[
"parent"];
417 $this->format_options[(string) $this->counter][
"child"] = $object[
"child"];
418 $this->format_options[(string) $this->counter][
"title"] = $object[
"title"];
419 $this->format_options[(string) $this->counter][
"type"] = $object[
"type"];
420 $this->format_options[(string) $this->counter][
"obj_id"] = $object[
"obj_id"];
421 $this->format_options[(string) $this->counter][
"desc"] =
"obj_" . $object[
"type"];
422 $this->format_options[(string) $this->counter][
"depth"] = $tab;
423 $this->format_options[(string) $this->counter][
"container"] =
false;
424 $this->format_options[(string) $this->counter][
"visible"] =
true;
425 $this->format_options[(string) $this->counter][
"highlighted_subtree"] = $a_highlighted_subtree;
428 for (
$i = 0;
$i < $tab; ++
$i) {
429 $this->format_options[(string) $this->counter][
"tab"][] =
'blank';
433 if ($parent_index === 0) {
434 if (!$this->expand_all && !in_array($object[
"parent"], $this->expanded)) {
435 $this->expanded[] = $object[
"parent"];
440 if ($object[
"child"] != $this->
getRoot() && ((!$this->expand_all && !in_array($object[
"parent"], $this->expanded))
441 or !$this->format_options[(
string) $parent_index][
"visible"])) {
450 $this->format_options[(string) $this->counter][
"visible"] =
false;
455 if ($object[
"child"] != $this->
getRoot()) {
456 $this->format_options[(string) $parent_index][
"container"] =
true;
458 if ($this->expand_all || in_array($object[
"parent"], $this->expanded)) {
461 $this->format_options[(string) $parent_index][
"tab"][($tab - 2)] =
'forceexp';
463 $this->format_options[(string) $parent_index][
"tab"][($tab - 2)] =
'minus';
466 $this->format_options[(string) $parent_index][
"tab"][($tab - 2)] =
'plus';
474 if ($this->expand_all || in_array($object[
"parent"], $this->expanded) or ($object[
"parent"] == 0)
476 $highlighted_subtree = $a_highlighted_subtree ||
480 $this->
setOutput($object[
"child"], $a_depth, $object[
'obj_id'], $highlighted_subtree);
515 $this->tree->getMaximumDepth();
525 $this->format_options[0][
"tab"] = array();
529 for (
$i = 0;
$i < $depth;++
$i) {
534 $tpl->
addJavaScript(
"./Services/UIComponent/Explorer/js/ilExplorer.js");
540 $tpl_tree =
new ilTemplate(
"tpl.tree.html",
true,
true,
"Services/UIComponent/Explorer");
545 $this->
requestStr(
"expandAll") !==
"") && $this->up_frame !==
"") {
546 $tpl_tree->setCurrentBlock(
"updater");
547 $tpl_tree->setVariable(
"UPDATE_FRAME", $this->up_frame);
548 $tpl_tree->setVariable(
"UPDATE_SCRIPT", $this->up_script);
549 if (is_array($this->up_params)) {
551 foreach ($this->up_params as $p) {
552 $up_str .= $lim .
"'" . $p .
"'";
555 $tpl_tree->setVariable(
"UPDATE_PARAMS", $up_str);
557 $tpl_tree->parseCurrentBlock();
560 foreach ($this->format_options as
$key => $options) {
562 if (!($options[
"visible"] ??
false)) {
572 $cur_depth = $options[
"depth"];
574 if ($options[
"visible"] and
$key != 0) {
575 $this->
formatObject($tpl_tree, $options[
"child"], $options, $options[
'obj_id']);
578 $this->
formatHeader($tpl_tree, $options[
"child"], $options);
584 $tpl_tree->setVariable(
"TREE_LEAD",
"");
585 if ($this->tree_lead !==
"") {
586 $tpl_tree->setCurrentBlock(
"tree_lead");
587 $tpl_tree->setVariable(
"TREE_LEAD", $this->tree_lead);
588 $tpl_tree->parseCurrentBlock();
590 if ($this->
getId() !==
"") {
591 $tpl_tree->setVariable(
"TREE_ID",
'id="' . $this->
getId() .
'_tree"');
594 $html = $tpl_tree->get();
599 $mtpl->setVariable(
"BODY_CLASS",
"il_Explorer");
600 $mtpl->addBlockFile(
"CONTENT",
"content",
"tpl.explorer.html");
602 $mtpl->setVariable(
"TXT_EXPLORER_HEADER", $this->
getTitle());
604 if ($this->
getId() !==
"") {
605 $mtpl->setVariable(
"ID",
'id="' . $this->
getId() .
'"');
608 $mtpl->setCurrentBlock(
"content");
609 $mtpl->setVariable(
"EXPLORER", $html);
610 $mtpl->setVariable(
"EXP_REFRESH", $lng->
txt(
"refresh"));
611 $mtpl->parseCurrentBlock();
612 $html = $mtpl->get();
628 if ($a_item_depth < $a_cur_depth) {
630 for (
$i = 0;
$i < ($a_cur_depth - $a_item_depth);
$i++) {
637 } elseif ($a_item_depth == $a_cur_depth) {
653 if ($a_item_depth > $a_cur_depth) {
655 if ($a_item_depth > 1) {
658 $a_tpl_tree->
touchBlock(
"start_list_no_indent");
682 if (!isset($a_node_id) or !is_array($a_option)) {
683 $ilErr->raiseError(get_class($this) .
"::formatObject(): Missing parameter or wrong datatype! " .
684 "node_id: " . $a_node_id .
" options:" . var_export($a_option,
true),
$ilErr->WARNING);
688 foreach ((array) $a_option[
"tab"] as $picture) {
689 if ($picture ===
'plus') {
694 $target = $this->
createTarget(
'+', $a_node_id, $a_option[
"highlighted_subtree"]);
695 $tpl->
setVariable(
"LINK_TARGET_EXPANDER", $target);
697 $target = $this->
createTarget(
'+', $a_node_id, $a_option[
"highlighted_subtree"],
false);
698 $tpl->
setVariable(
"ONCLICK_TARGET_EXPANDER",
" onclick=\"return il.Explorer.refresh('tree_div', '" . $target .
"');\"");
706 if ($picture ===
'forceexp') {
711 $tpl->
setVariable(
"LINK_TARGET_EXPANDER", $target);
717 if ($picture ===
'minus' && $this->show_minus) {
722 $target = $this->
createTarget(
'-', $a_node_id, $a_option[
"highlighted_subtree"]);
723 $tpl->
setVariable(
"LINK_TARGET_EXPANDER", $target);
725 $target = $this->
createTarget(
'-', $a_node_id, $a_option[
"highlighted_subtree"],
false);
726 $tpl->
setVariable(
"ONCLICK_TARGET_EXPANDER",
" onclick=\"return il.Explorer.refresh('tree_div', '" . $target .
"');\"");
741 if ($this->output_icons) {
743 $tpl->
setVariable(
"ICON_IMAGE", $this->
getImage(
"icon_" . $a_option[
"type"] .
".svg", $a_option[
"type"], $a_obj_id));
745 $tpl->
setVariable(
"TARGET_ID",
"iconid_" . $a_node_id);
746 $this->iconList[] =
"iconid_" . $a_node_id;
749 $this->
getImageAlt($lng->
txt(
"icon") .
" " . $lng->
txt($a_option[
"desc"]), $a_option[
"type"], $a_obj_id)
754 if (($sel = $this->
buildSelect($a_node_id, $a_option[
'type'])) !==
'') {
760 if ($this->
isClickable($a_option[
"type"], $a_node_id)) {
769 if ($style_class !==
"") {
770 $tpl->
setVariable(
"A_CLASS",
' class="' . $style_class .
'" ');
773 if (($onclick = $this->
buildOnClick($a_node_id, $a_option[
"type"], $a_option[
"title"])) !=
"") {
774 $tpl->
setVariable(
"ONCLICK",
"onClick=\"$onclick\"");
781 $this->
buildTitle($a_option[
"title"], $a_node_id, $a_option[
"type"]),
789 $this->
buildDescription($a_option[
"description"] ??
"", $a_node_id, $a_option[
"type"]),
794 $frame_target = $this->
buildFrameTarget($a_option[
"type"], $a_node_id, $a_option[
"obj_id"]);
795 if ($frame_target !==
"") {
796 $tpl->
setVariable(
"TARGET",
" target=\"" . $frame_target .
"\"");
803 $this->
buildTitle($a_option[
"title"], $a_node_id, $a_option[
"type"]),
833 string $a_default_text,
837 return $a_default_text;
844 if ($a_id == $this->highlighted) {
845 return "il_HighlightedNode";
854 $target = (strpos($this->target,
"?") ===
false)
855 ? $this->target .
"?" 856 : $this->target .
"&";
904 bool $a_highlighted_subtree =
false,
905 bool $a_append_anch =
true 909 if (!isset($a_type) or !is_string($a_type) or !isset($a_node_id)) {
910 $ilErr->raiseError(get_class($this) .
"::createTarget(): Missing parameter or wrong datatype! " .
911 "type: " . $a_type .
" node_id:" . $a_node_id,
$ilErr->WARNING);
917 $a_node_id = $a_type ===
'+' ? $a_node_id : -(
int) $a_node_id;
919 $sep = (is_int(strpos($this->expand_target,
"?")))
924 $ict_str = ($a_highlighted_subtree || $this->highlighted ===
"")
928 $ict_str .=
"&cmdMode=asynch";
930 if ($a_append_anch) {
931 return $this->expand_target . $sep . $this->expand_variable .
"=" . $a_node_id . $this->params_get . $ict_str .
"#" . abs($a_node_id);
933 return $this->expand_target . $sep . $this->expand_variable .
"=" . $a_node_id . $this->params_get . $ict_str;
939 $this->frame_target = $a_target;
944 for (
$i = 0, $iMax = count($this->format_options);
$i < $iMax; ++
$i) {
945 if ($this->format_options[
$i][
"depth"] == $a_depth + 1
946 and !$this->format_options[
$i][
"container"]
947 and $this->format_options[
$i][
"depth"] != 1) {
948 $this->format_options[
$i][
"tab"][(string) $a_depth] =
"quer";
951 if ($this->format_options[
$i][
"depth"] == $a_depth + 2) {
953 $this->format_options[
$i][
"tab"][(string) $a_depth] =
"winkel";
955 $this->format_options[
$i][
"tab"][(string) $a_depth] =
"ecke";
959 if ($this->format_options[
$i][
"depth"] > $a_depth + 2) {
961 $this->format_options[
$i][
"tab"][(string) $a_depth] =
"hoch";
971 for (
$i = $a_start, $iMax = count($this->format_options);
$i < $iMax; ++
$i) {
972 if ($this->format_options[
$i][
"depth"] < $a_depth) {
976 if ($this->format_options[
$i][
"depth"] == $a_depth) {
986 if (!is_array($this->format_options)) {
990 foreach ($this->format_options as
$key => $value) {
991 if (($value[
"child"] == $a_data[
"parent"])) {
1001 if (is_array($this->
filter)) {
1003 foreach ($this->
filter as $item) {
1004 if ($item === $a_item) {
1011 $this->
filter[] = $a_item;
1020 if (is_array($this->
filter)) {
1024 foreach ($this->
filter as $item) {
1025 if ($item !== $a_item) {
1037 return $deleted === 1;
1050 if ($a_node_id > 0 && !in_array($a_node_id,
ilSession::get($this->expand_variable))) {
1052 $exp[] = $a_node_id;
1055 if ($a_node_id < 0) {
1058 if (isset(
$key[0]) && isset($exp[
$key[0]])) {
1059 unset($exp[$key[0]]);
1063 $this->expanded = (array)
ilSession::get($this->expand_variable);
1072 bool $a_show_minus =
true 1074 $this->expand_all = $a_mode;
1075 $this->show_minus = $a_show_minus;
1080 $this->filtered = $a_bool;
1086 if (is_array($this->
filter)) {
1087 if (in_array($a_item, $this->
filter)) {
1106 public function sortNodes(array $a_nodes, $a_parent_obj_id): array
1109 foreach ($a_nodes as
$key => $node) {
1110 if ($node[
"type"] ===
"adm") {
1118 if (isset($match)) {
1119 array_splice($a_nodes, $match, 1);
1125 if (isset($match)) {
1126 $a_nodes[] = $adm_node;
parseCurrentBlock(string $part=ilGlobalTemplateInterface::DEFAULT_BLOCK)
setSessionExpandVariable(string $a_var_name="expand")
setOrderDirection(string $a_direction)
static get(string $a_var)
setOutput( $a_parent_id, int $a_depth=1, int $a_obj_id=0, bool $a_highlighted_subtree=false)
Creates output for explorer view in admin menue recursive method.
createLines(int $a_depth)
sortNodes(array $a_nodes, $a_parent_obj_id)
sort nodes and put adm object to the end of sorted array
is_in_array(int $a_start, int $a_depth)
setFiltered(bool $a_bool)
buildDescription(string $a_desc, $a_id, string $a_type)
outputIcons(bool $a_icons)
handleListEndTags(ilTemplate $a_tpl_tree, int $a_cur_depth, int $a_item_depth)
handle list end tags ( and )
txt(string $a_topic, string $a_default_lang_fallback_mod="")
gets the text for a given topic if the topic is not in the list, the topic itself with "-" will be re...
special template class to simplify handling of ITX/PEAR
buildTitle(string $a_title, $a_id, string $a_type)
setFrameUpdater(string $a_up_frame, string $a_up_script, string $a_params="")
buildSelect($a_node_id, string $a_type)
standard implementation for adding an option select box between image and title
checkFilter(string $a_item)
static getImagePath(string $img, string $module_path="", string $mode="output", bool $offline=false)
get image path (for images located in a template directory)
handleListStartTags(ilTemplate $a_tpl_tree, int $a_cur_depth, int $a_item_depth)
handle list start tags (
ILIAS HTTP Wrapper WrapperFactory $wrapper
ilGlobalTemplateInterface $tpl
setFrameTarget(string $a_target)
const IL_FM_POSITIVE
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
forceExpandAll(bool $a_mode, bool $a_show_minus=true)
force expandAll.
setPostSort(bool $a_sort)
getChildsOfNode($a_parent_id)
ILIAS Refinery Factory $refinery
highlightNode(string $a_id)
static getStyleSheetLocation(string $mode="output", string $a_css_name="", string $a_css_location="")
get full style sheet file name (path inclusive) of current user
delFilter(string $a_item)
setTreeLead(string $a_val)
getImageAlt(string $a_default_text, string $a_type="", $a_obj_id="")
checkAccess(string $a_operations, int $a_ref_id, string $a_type="")
checkAccess represents the main method of the RBAC-system in ILIAS3 developers want to use With this ...
touchBlock(string $block)
parses the objects.xml it handles the xml-description of all ilias objects
setTitleLength(int $a_length)
forceExpanded($a_obj_id)
force expansion of node
formatHeader(ilTemplate $tpl, $a_obj_id, array $a_option)
setVariable($variable, $value='')
Sets a variable value.
initItemCounter(int $a_number)
setClickable(string $a_type, bool $a_clickable)
setUseStandardFrame(bool $a_val)
Set use standard frame.
formatObject(ilTemplate $tpl, $a_node_id, array $a_option, $a_obj_id=0)
setOrderColumn(string $a_column)
showChilds($a_parent_id)
determines wether the childs of an object should be shown or not note: this standard implementation a...
addJavaScript(string $a_js_file, bool $a_add_version_parameter=true, int $a_batch=2)
Add a javascript file that should be included in the header.
isClickable(string $type, int $ref_id=0)
isVisible( $a_ref_id, string $a_type)
class for explorer view in admin frame
buildFrameTarget(string $a_type, $a_child=0, $a_obj_id=0)
getNodeStyleClass( $a_id, string $a_type)
getImage(string $a_name, string $a_type="", $a_obj_id="")
setCurrentBlock(string $part=ilGlobalTemplateInterface::DEFAULT_BLOCK)
checkPermissions(bool $a_check)
Error Handling & global info handling uses PEAR error class.
setAsynchExpanding(bool $a_val)
__construct(Container $dic, ilPlugin $plugin)
static shortenTextExtended(string $a_str, int $a_len, bool $a_dots=false, bool $a_next_blank=false, bool $a_keep_extension=false)
addFilter(string $a_item)
createTarget(string $a_type, $a_node_id, bool $a_highlighted_subtree=false, bool $a_append_anch=true)
buildLinkTarget( $a_node_id, string $a_type)
buildOnClick( $a_node_id, string $a_type, string $a_title)
static initConnection(?ilGlobalTemplateInterface $a_main_tpl=null)
Init YUI Connection module.
setExpandTarget(string $a_exp_target)
target script for expand icons
setTargetGet(string $a_target_get)
static set(string $a_var, $a_val)
Set a value.
setFilterMode(int $a_mode=IL_FM_NEGATIVE)
setExpand($a_node_id)
set the expand option this value is stored in a SESSION variable to save it different view (lo view...
setParamsGet(array $a_params_get)
static sortArray(array $array, string $a_array_sortby_key, string $a_array_sortorder="asc", bool $a_numeric=false, bool $a_keep_keys=false)
ilObjectDefinition $obj_definition
modifyChilds( $a_parent_id, array $a_objects)