4 define(
"IL_FM_POSITIVE", 1);
5 define(
"IL_FM_NEGATIVE", 2);
190 $this->obj_definition = $DIC[
"objDefinition"];
191 $this->error = $DIC[
"ilErr"];
192 $this->rbacsystem = $DIC->rbac()->system();
193 $this->tpl = $DIC[
"tpl"];
194 $this->lng = $DIC->language();
195 $objDefinition = $DIC[
"objDefinition"];
198 if (!isset($a_target) or !is_string($a_target)) {
199 $ilErr->raiseError(get_class($this) .
"::Constructor(): No target given!",
$ilErr->WARNING);
203 $devtypes = $objDefinition->getDevModeAll();
205 if (count($devtypes) > 0) {
209 foreach ($devtypes as
$type) {
214 $this->
ilias = $DIC[
"ilias"];
215 $this->output =
array();
216 $this->expanded =
array();
217 $this->target = $a_target;
218 $this->target_get =
'ref_id';
219 $this->frame_target =
"content";
220 $this->order_column =
"title";
221 $this->tree =
new ilTree(ROOT_FOLDER_ID);
222 $this->tree->initLangCode();
223 $this->expand_target =
$_SERVER[
"PATH_INFO"];
224 $this->rbac_check =
true;
225 $this->output_icons =
true;
226 $this->expand_variable =
"expand";
228 $this->post_sort=
true;
230 $this->highlighted =
"";
231 $this->show_minus =
true;
233 $this->asnch_expanding =
false;
263 $this->asnch_expanding = $a_val;
273 return $this->asnch_expanding;
285 $this->counter = $a_number;
295 $this->title = $a_val;
305 $this->textwidth = $a_length;
314 return $this->textwidth;
336 #$this->tree = new ilTree(ROOT_FOLDER_ID,$a_root_id); 337 $this->root_id = $a_root_id;
349 return $this->root_id == null ?
350 $this->tree->getRootId() :
361 $this->order_column = $a_column;
371 if ($a_direction ==
"desc") {
372 $this->order_direction = $a_direction;
374 $this->order_direction =
"asc";
387 if (!isset($a_target_get) or !is_string($a_target_get)) {
388 $ilErr->raiseError(get_class($this) .
"::setTargetGet(): No target given!",
$ilErr->WARNING);
391 $this->target_get = $a_target_get;
403 if (!isset($a_params_get) or !is_array($a_params_get)) {
404 $ilErr->raiseError(get_class($this) .
"::setTargetGet(): No target given!",
$ilErr->WARNING);
407 foreach ($a_params_get as
$key => $val) {
408 $str .=
"&" .
$key .
"=" . $val;
411 $this->params_get = $str;
423 $this->expand_target = $a_exp_target;
433 $this->up_frame = $a_up_frame;
434 $this->up_script = $a_up_script;
435 $this->up_params = $a_params;
444 $this->highlighted = $a_id;
454 $this->rbac_check = $a_check;
464 $this->expand_variable = $a_var_name;
474 $this->output_icons = $a_icons;
487 $this->is_clickable[
$a_type] =
"";
489 $this->is_clickable[
$a_type] =
"n";
497 if (!$this->rbac_check) {
501 $visible =
$rbacsystem->checkAccess(
'visible', $a_ref_id);
513 $this->tree_lead = $a_val;
523 return $this->tree_lead;
539 if ($this->is_clickable[
$a_type] ==
"n") {
552 $this->post_sort = $a_sort;
562 $this->filter_mode = $a_mode;
583 $this->use_standard_frame = $a_val;
604 return $this->tree->getChilds($a_parent_id, $this->order_column);
616 public function setOutput($a_parent_id, $a_depth = 1, $a_obj_id = 0, $a_highlighted_subtree =
false)
620 if (!isset($a_parent_id)) {
621 $ilErr->raiseError(get_class($this) .
"::setOutput(): No node_id given!",
$ilErr->WARNING);
624 if ($this->
showChilds($a_parent_id, $a_obj_id)) {
633 if ($this->
forceExpanded($a_parent_id) && !in_array($a_parent_id, $this->expanded)) {
634 $this->expanded[] = $a_parent_id;
637 if (count($objects) > 0) {
639 $tab = ++$a_depth - 2;
640 if ($this->post_sort) {
641 $objects = $this->
sortNodes($objects, $a_obj_id);
644 foreach ($objects as
$key => $object) {
651 if ($this->filtered ==
false or $this->
checkFilter($object[
"type"]) ==
false) {
652 if ($this->
isVisible($object[
'child'], $object[
'type'])) {
653 #echo 'CHILD getIndex() '.$object['child'].' parent: '.$this->getRoot(); 654 if ($object[
"child"] != $this->
getRoot()) {
655 $parent_index = $this->
getIndex($object);
657 $this->format_options[
"$this->counter"][
"parent"] = $object[
"parent"];
658 $this->format_options[
"$this->counter"][
"child"] = $object[
"child"];
659 $this->format_options[
"$this->counter"][
"title"] = $object[
"title"];
660 $this->format_options[
"$this->counter"][
"type"] = $object[
"type"];
661 $this->format_options[
"$this->counter"][
"obj_id"] = $object[
"obj_id"];
662 $this->format_options[
"$this->counter"][
"desc"] =
"obj_" . $object[
"type"];
663 $this->format_options[
"$this->counter"][
"depth"] =
$tab;
664 $this->format_options[
"$this->counter"][
"container"] =
false;
665 $this->format_options[
"$this->counter"][
"visible"] =
true;
666 $this->format_options[
"$this->counter"][
"highlighted_subtree"] = $a_highlighted_subtree;
670 $this->format_options[
"$this->counter"][
"tab"][] =
'blank';
674 if ($parent_index == 0) {
675 if (!$this->expand_all and !in_array($object[
"parent"], $this->expanded)) {
676 $this->expanded[] = $object[
"parent"];
681 if ($object[
"child"] != $this->
getRoot() and ((!$this->expand_all and !in_array($object[
"parent"], $this->expanded))
682 or !$this->format_options[
"$parent_index"][
"visible"])) {
687 if ($this->format_options[
"$this->counter"][
"visible"]) {
691 $this->format_options[
"$this->counter"][
"visible"] =
false;
696 if ($object[
"child"] != $this->
getRoot()) {
697 $this->format_options[
"$parent_index"][
"container"] =
true;
699 if ($this->expand_all or in_array($object[
"parent"], $this->expanded)) {
702 $this->format_options[
"$parent_index"][
"tab"][($tab-2)] =
'forceexp';
704 $this->format_options[
"$parent_index"][
"tab"][($tab-2)] =
'minus';
707 $this->format_options[
"$parent_index"][
"tab"][($tab-2)] =
'plus';
715 if ($this->expand_all or in_array($object[
"parent"], $this->expanded) or ($object[
"parent"] == 0)
717 $highlighted_subtree = ($a_highlighted_subtree ||
718 ($object[
"child"] == $this->highlighted))
723 $this->
setOutput($object[
"child"], $a_depth, $object[
'obj_id'], $highlighted_subtree);
762 $this->tree->getMaximumDepth();
777 $this->format_options[0][
"tab"] =
array();
781 for (
$i=0;
$i<$depth;++
$i) {
785 include_once(
"./Services/YUI/classes/class.ilYuiUtil.php");
787 $tpl->addJavaScript(
"./Services/UIComponent/Explorer/js/ilExplorer.js");
793 $tpl_tree =
new ilTemplate(
"tpl.tree.html",
true,
true,
"Services/UIComponent/Explorer");
796 if ((
$_GET[
"ict"] ||
$_POST[
"collapseAll"] !=
"" ||
$_POST[
"expandAll"] !=
"") && $this->up_frame !=
"") {
797 $tpl_tree->setCurrentBlock(
"updater");
798 $tpl_tree->setVariable(
"UPDATE_FRAME", $this->up_frame);
799 $tpl_tree->setVariable(
"UPDATE_SCRIPT", $this->up_script);
800 if (is_array($this->up_params)) {
802 foreach ($this->up_params as $p) {
803 $up_str.= $lim .
"'" . $p .
"'";
806 $tpl_tree->setVariable(
"UPDATE_PARAMS", $up_str);
808 $tpl_tree->parseCurrentBlock();
836 $tpl_tree->setVariable(
"TREE_LEAD",
"");
837 if ($this->tree_lead !=
"") {
838 $tpl_tree->setCurrentBlock(
"tree_lead");
839 $tpl_tree->setVariable(
"TREE_LEAD", $this->tree_lead);
840 $tpl_tree->parseCurrentBlock();
842 if ($this->
getId() !=
"") {
843 $tpl_tree->setVariable(
"TREE_ID",
'id="' . $this->
getId() .
'_tree"');
846 $html = $tpl_tree->get();
849 $mtpl =
new ilTemplate(
"tpl.main.html",
true,
true);
851 $mtpl->setVariable(
"BODY_CLASS",
"il_Explorer");
852 $mtpl->addBlockFile(
"CONTENT",
"content",
"tpl.explorer.html");
854 $mtpl->setVariable(
"TXT_EXPLORER_HEADER", $this->
getTitle());
856 if ($this->
getId() !=
"") {
857 $mtpl->setVariable(
"ID",
'id="' . $this->
getId() .
'"');
860 $mtpl->setCurrentBlock(
"content");
861 $mtpl->setVariable(
"EXPLORER",
$html);
862 $mtpl->setVariable(
"EXP_REFRESH",
$lng->txt(
"refresh"));
863 $mtpl->parseCurrentBlock();
864 $html = $mtpl->get();
877 if ($a_item_depth < $a_cur_depth) {
879 for (
$i = 0;
$i < ($a_cur_depth - $a_item_depth);
$i++) {
880 $a_tpl_tree->touchBlock(
"end_list_item");
881 $a_tpl_tree->touchBlock(
"element");
883 $a_tpl_tree->touchBlock(
"end_list");
884 $a_tpl_tree->touchBlock(
"element");
886 } elseif ($a_item_depth == $a_cur_depth) {
888 $a_tpl_tree->touchBlock(
"end_list_item");
889 $a_tpl_tree->touchBlock(
"element");
899 if ($a_item_depth > $a_cur_depth) {
901 if ($a_item_depth > 1) {
902 $a_tpl_tree->touchBlock(
"start_list");
904 $a_tpl_tree->touchBlock(
"start_list_no_indent");
906 $a_tpl_tree->touchBlock(
"element");
908 $a_tpl_tree->touchBlock(
"start_list_item");
909 $a_tpl_tree->touchBlock(
"element");
912 $a_tpl_tree->touchBlock(
"start_list_item");
913 $a_tpl_tree->touchBlock(
"element");
942 if (!isset($a_node_id) or !is_array($a_option)) {
943 $ilErr->raiseError(get_class($this) .
"::formatObject(): Missing parameter or wrong datatype! " .
944 "node_id: " . $a_node_id .
" options:" . var_dump($a_option),
$ilErr->WARNING);
948 foreach ((
array) $a_option[
"tab"] as $picture) {
949 if ($picture ==
'plus') {
950 $tpl->setCurrentBlock(
"expander");
951 $tpl->setVariable(
"EXP_DESC",
$lng->txt(
"collapsed"));
952 $tpl->setVariable(
"LINK_NAME", $a_node_id);
955 $tpl->setVariable(
"LINK_TARGET_EXPANDER",
$target);
958 $tpl->setVariable(
"ONCLICK_TARGET_EXPANDER",
" onclick=\"return il.Explorer.refresh('tree_div', '" .
$target .
"');\"");
959 $tpl->setVariable(
"LINK_TARGET_EXPANDER",
"#");
961 $tpl->setVariable(
"IMGPATH", $this->
getImage(
"browser/plus.png"));
962 $tpl->parseCurrentBlock();
966 if ($picture ==
'forceexp') {
967 $tpl->setCurrentBlock(
"expander");
968 $tpl->setVariable(
"EXP_DESC",
$lng->txt(
"expanded"));
970 $tpl->setVariable(
"LINK_NAME", $a_node_id);
971 $tpl->setVariable(
"LINK_TARGET_EXPANDER",
$target);
972 $tpl->setVariable(
"IMGPATH", $this->
getImage(
"browser/forceexp.png"));
973 $tpl->parseCurrentBlock();
977 if ($picture ==
'minus' && $this->show_minus) {
978 $tpl->setCurrentBlock(
"expander");
979 $tpl->setVariable(
"EXP_DESC",
$lng->txt(
"expanded"));
980 $tpl->setVariable(
"LINK_NAME", $a_node_id);
983 $tpl->setVariable(
"LINK_TARGET_EXPANDER",
$target);
986 $tpl->setVariable(
"ONCLICK_TARGET_EXPANDER",
" onclick=\"return il.Explorer.refresh('tree_div', '" .
$target .
"');\"");
987 $tpl->setVariable(
"LINK_TARGET_EXPANDER",
"#");
989 $tpl->setVariable(
"IMGPATH", $this->
getImage(
"browser/minus.png"));
990 $tpl->parseCurrentBlock();
996 $tpl->setCurrentBlock(
"blank");
997 $tpl->setVariable(
"BLANK_PATH", $this->
getImage(
"browser/blank.png"));
998 $tpl->parseCurrentBlock();
1001 if ($this->output_icons) {
1002 $tpl->setCurrentBlock(
"icon");
1003 $tpl->setVariable(
"ICON_IMAGE", $this->
getImage(
"icon_" . $a_option[
"type"] .
".svg", $a_option[
"type"], $a_obj_id));
1005 $tpl->setVariable(
"TARGET_ID",
"iconid_" . $a_node_id);
1006 $this->iconList[] =
"iconid_" . $a_node_id;
1009 $this->
getImageAlt(
$lng->txt(
"icon") .
" " .
$lng->txt($a_option[
"desc"]), $a_option[
"type"], $a_obj_id)
1011 $tpl->parseCurrentBlock();
1014 if (strlen($sel = $this->
buildSelect($a_node_id, $a_option[
'type']))) {
1015 $tpl->setCurrentBlock(
'select');
1016 $tpl->setVariable(
'OBJ_SEL', $sel);
1017 $tpl->parseCurrentBlock();
1020 if ($this->
isClickable($a_option[
"type"], $a_node_id, $a_obj_id)) {
1021 $tpl->setCurrentBlock(
"link");
1029 if ($style_class !=
"") {
1030 $tpl->setVariable(
"A_CLASS",
' class="' . $style_class .
'" ');
1033 if (($onclick = $this->
buildOnClick($a_node_id, $a_option[
"type"], $a_option[
"title"])) !=
"") {
1034 $tpl->setVariable(
"ONCLICK",
"onClick=\"$onclick\"");
1039 $this->
buildTitle($a_option[
"title"], $a_node_id, $a_option[
"type"]),
1044 $this->
buildDescription($a_option[
"description"], $a_node_id, $a_option[
"type"]),
1048 $frame_target = $this->
buildFrameTarget($a_option[
"type"], $a_node_id, $a_option[
"obj_id"]);
1049 if ($frame_target !=
"") {
1050 $tpl->setVariable(
"TARGET",
" target=\"" . $frame_target .
"\"");
1052 $tpl->parseCurrentBlock();
1054 $tpl->setCurrentBlock(
"text");
1056 $this->
buildTitle($a_option[
"title"], $a_node_id, $a_option[
"type"]),
1065 $tpl->parseCurrentBlock();
1068 $tpl->setCurrentBlock(
"list_item");
1069 $tpl->parseCurrentBlock();
1070 $tpl->touchBlock(
"element");
1086 return $a_default_text;
1094 if ($a_id == $this->highlighted) {
1095 return "il_HighlightedNode";
1105 $target = (strpos($this->target,
"?") ===
false)
1106 ? $this->target .
"?" 1107 : $this->target .
"&";
1149 return $this->frame_target;
1164 if (!isset(
$a_type) or !is_string(
$a_type) or !isset($a_node_id)) {
1165 $ilErr->raiseError(get_class($this) .
"::createTarget(): Missing parameter or wrong datatype! " .
1166 "type: " .
$a_type .
" node_id:" . $a_node_id,
$ilErr->WARNING);
1172 $a_node_id =
$a_type ==
'+' ? $a_node_id : -(int) $a_node_id;
1174 $sep = (is_int(strpos($this->expand_target,
"?")))
1179 $ict_str = ($a_highlighted_subtree || $this->highlighted ==
"")
1183 $ict_str.=
"&cmdMode=asynch";
1185 if ($a_append_anch) {
1186 return $this->expand_target . $sep . $this->expand_variable .
"=" . $a_node_id . $this->params_get . $ict_str .
"#" . abs($a_node_id);
1188 return $this->expand_target . $sep . $this->expand_variable .
"=" . $a_node_id . $this->params_get . $ict_str;
1200 $this->frame_target = $a_target;
1210 for (
$i = 0;
$i < count($this->format_options); ++
$i) {
1211 if ($this->format_options[
$i][
"depth"] == $a_depth+1
1212 and !$this->format_options[
$i][
"container"]
1213 and $this->format_options[
$i][
"depth"] != 1) {
1214 $this->format_options[
$i][
"tab"][
"$a_depth"] =
"quer";
1217 if ($this->format_options[
$i][
"depth"] == $a_depth+2) {
1219 $this->format_options[
$i][
"tab"][
"$a_depth"] =
"winkel";
1221 $this->format_options[
$i][
"tab"][
"$a_depth"] =
"ecke";
1225 if ($this->format_options[
$i][
"depth"] > $a_depth+2) {
1227 $this->format_options[
$i][
"tab"][
"$a_depth"] =
"hoch";
1242 for (
$i=$a_start;
$i<count($this->format_options);++
$i) {
1243 if ($this->format_options[
$i][
"depth"] < $a_depth) {
1247 if ($this->format_options[
$i][
"depth"] == $a_depth) {
1262 if (!is_array($this->format_options)) {
1266 foreach ($this->format_options as
$key => $value) {
1267 if (($value[
"child"] == $a_data[
"parent"])) {
1285 if (is_array($this->filter)) {
1287 foreach ($this->filter as $item) {
1288 if ($item == $a_item) {
1295 $this->filter =
array();
1297 if ($is_present == 0) {
1298 $this->filter[] = $a_item;
1313 if (is_array($this->filter)) {
1317 foreach ($this->filter as $item) {
1318 if ($item != $a_item) {
1325 $this->filter = $tmp;
1330 if ($deleted == 1) {
1346 if (!is_array(
$_SESSION[$this->expand_variable])) {
1350 if ($a_node_id > 0 && !in_array($a_node_id,
$_SESSION[$this->expand_variable])) {
1351 array_push(
$_SESSION[$this->expand_variable], $a_node_id);
1354 if ($a_node_id < 0) {
1355 $key = array_keys(
$_SESSION[$this->expand_variable], -(
int) $a_node_id);
1369 $this->expand_all = (bool) $a_mode;
1370 $this->show_minus = $a_show_minus;
1381 $this->filtered = $a_bool;
1393 if (is_array($this->filter)) {
1394 if (in_array($a_item, $this->filter)) {
1418 foreach ($a_nodes as
$key => $node) {
1419 if ($node[
"type"] ==
"adm") {
1427 isset($match) ? array_splice($a_nodes, $match, 1) :
"";
1429 $a_nodes =
ilUtil::sortArray($a_nodes, $this->order_column, $this->order_direction);
1432 isset($match) ? array_push($a_nodes, $adm_node) :
"";
static sortArray( $array, $a_array_sortby, $a_array_sortorder=0, $a_numeric=false, $a_keep_keys=false)
sortArray
formatObject($tpl, $a_node_id, $a_option, $a_obj_id=0)
Creates output recursive method private.
forceExpandAll($a_mode, $a_show_minus=true)
force expandAll.
setPostSort($a_sort)
process post sorting
formatHeader($tpl, $a_obj_id, $a_option)
Creates output for header (is empty here but can be overwritten in derived classes) ...
if((!isset($_SERVER['DOCUMENT_ROOT'])) OR(empty($_SERVER['DOCUMENT_ROOT']))) $_SERVER['DOCUMENT_ROOT']
static shortenText( $a_str, $a_len, $a_dots=false, $a_next_blank=false, $a_keep_extension=false)
shorten a string to given length.
buildFrameTarget($a_type, $a_child=0, $a_obj_id=0)
get frame target (may be overwritten by derived classes)
setFilterMode($a_mode=IL_FM_NEGATIVE)
set filter mode
highlightNode($a_id)
set highlighted node
getNodeStyleClass($a_id, $a_type)
get style class for node
getTitleLength()
Get max title length.
buildLinkTarget($a_node_id, $a_type)
get link target (may be overwritten by derived classes)
__construct($a_target)
Constructor public.
setTargetGet($a_target_get)
set the varname in Get-string public
isVisible($a_ref_id, $a_type)
static getStyleSheetLocation($mode="output", $a_css_name="", $a_css_location="")
get full style sheet file name (path inclusive) of current user
static initConnection(ilTemplate $a_main_tpl=null)
Init YUI Connection module.
getUseStandardFrame()
Get use standard explorer frame.
setTitleLength($a_length)
Set max title length.
is_in_array($a_start, $a_depth)
DESCRIPTION MISSING private.
buildSelect($a_node_id, $a_type)
standard implementation for adding an option select box between image and title
setFrameUpdater($a_up_frame, $a_up_script, $a_params="")
Set Explorer Updater.
modifyChilds($a_parent_id, $a_objects)
setExpandTarget($a_exp_target)
target script for expand icons
getChildsOfNode($a_parent_id)
Get childs of node.
checkPermissions($a_check)
check permissions via rbac
setAsynchExpanding($a_val)
Set asynch expanding.
handleListEndTags(&$a_tpl_tree, $a_cur_depth, $a_item_depth)
handle list end tags ( and )
getIndex($a_data)
get index of format_options array from specific ref_id,parent_id private
setOrderColumn($a_column)
set the order column public
setFiltered($a_bool)
active/deactivate the filter public
getAsynchExpanding()
Get asynch expanding.
setClickable($a_type, $a_clickable)
(de-)activates links for a certain object type
setOutput($a_parent_id, $a_depth=1, $a_obj_id=0, $a_highlighted_subtree=false)
Creates output for explorer view in admin menue recursive method public.
createTarget($a_type, $a_node_id, $a_highlighted_subtree=false, $a_append_anch=true)
Creates Get Parameter private.
setUseStandardFrame($a_val)
Set use standard frame.
buildOnClick($a_node_id, $a_type, $a_title)
get onclick event handling (may be overwritten by derived classes)
forceExpanded($a_obj_id)
force expansion of node
sortNodes($a_nodes, $a_parent_obj_id)
sort nodes and put adm object to the end of sorted array private
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)
getTreeLead()
Get tree leading content.
special template class to simplify handling of ITX/PEAR
showChilds($a_parent_id)
determines wether the childs of an object should be shown or not note: this standard implementation a...
redirection script todo: (a better solution should control the processing via a xml file) ...
setFrameTarget($a_target)
set target frame or not frame?
Tree class data representation in hierachical trees using the Nested Set Model with Gaps by Joe Celco...
Create styles array
The data for the language used.
setRoot($a_root_id)
Set root node.
Class ilExplorer class for explorer view in admin frame.
initItemCounter($a_number)
Init item counter.
buildTitle($a_title, $a_id, $a_type)
standard implementation for title, may be overwritten by derived classes
getFilterMode()
get filter mode
checkFilter($a_item)
check if item is in filter private
getImage($a_name, $a_type="", $a_obj_id="")
get image path (may be overwritten by derived classes)
getMaximumTreeDepth()
Get maximum tree depth.
handleListStartTags(&$a_tpl_tree, $a_cur_depth, $a_item_depth)
handle list start tags (
setParamsGet($a_params_get)
set additional params to be passed in Get-string public
isClickable($a_type, $a_ref_id=0)
check if links for certain object type are activated
setTreeLead($a_val)
Set tree leading content.
setOrderDirection($a_direction)
set the order direction public
setSessionExpandVariable($a_var_name="expand")
set name of expand session variable
addFilter($a_item)
adds item to the filter public
getImageAlt($a_default_text, $a_type="", $a_obj_id="")
get image alt text
delFilter($a_item)
removes item from the filter public
outputIcons($a_icons)
output icons
buildDescription($a_desc, $a_id, $a_type)
standard implementation for description, may be overwritten by derived classes
setTitle($a_val)
Set title.
createLines($a_depth)
Creates lines for explorer view private.
setExpand($a_node_id)
set the expand option this value is stored in a SESSION variable to save it different view (lo view...
if(!isset($_REQUEST['ReturnTo'])) if(!isset($_REQUEST['AuthId'])) $options
getOutput()
Creates output recursive method public.