ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
class.ilBookmarkExplorerGUI.php
Go to the documentation of this file.
1<?php
2/* Copyright (c) 1998-2013 ILIAS open source, Extended GPL, see docs/LICENSE */
3
4include_once("./Services/UIComponent/Explorer2/classes/class.ilTreeExplorerGUI.php");
5
15{
19 protected $user;
20
24 protected $lng;
25
29 protected $ctrl;
30
34 public function __construct($a_parent_obj, $a_parent_cmd, $a_user_id = 0)
35 {
36 global $DIC;
37
38 $this->user = $DIC->user();
39 $this->lng = $DIC->language();
40 $this->ctrl = $DIC->ctrl();
41 $ilUser = $DIC->user();
42
43 if ($a_user_id == 0) {
44 $a_user_id = $ilUser->getId();
45 }
46 include_once("./Services/Bookmarks/classes/class.ilBookmarkTree.php");
47 $tree = new ilBookmarkTree($a_user_id);
48 parent::__construct("bm_exp", $a_parent_obj, $a_parent_cmd, $tree);
49
50 $this->setTypeWhiteList(array("bmf", "dum"));
51
52 $this->setSkipRootNode(false);
53 $this->setAjax(false);
54 $this->setOrderField("title");
55 }
56
63 public function getNodeContent($a_node)
64 {
66
67 if ($a_node["child"] == $this->getNodeId($this->getRootNode())) {
68 return $lng->txt("bookmarks");
69 }
70
71 return $a_node["title"];
72 }
73
80 public function getNodeIcon($a_node)
81 {
82 $icon = ilUtil::getImagePath("icon_" . $a_node["type"] . ".svg");
83
84 return $icon;
85 }
86
93 public function getNodeIconAlt($a_node)
94 {
96
97 return $lng->txt("icon") . " " . $lng->txt($a_node["type"]);
98 }
99
100
107 public function isNodeHighlighted($a_node)
108 {
109 if ($a_node["child"] == $_GET["bmf_id"] ||
110 ($_GET["bmf_id"] == "" && $a_node["child"] == $this->getNodeId($this->getRootNode()))) {
111 return true;
112 }
113 return false;
114 }
115
122 public function getNodeHref($a_node)
123 {
125
126 switch ($a_node["type"]) {
127 // bookmark folder
128 case "bmf":
129 // dummy root
130 case "dum":
131 $ilCtrl->setParameterByClass("ilbookmarkadministrationgui", "bmf_id", $a_node["child"]);
132
133 $ret = $ilCtrl->getLinkTargetByClass("ilbookmarkadministrationgui", "");
134 if (isset($_GET['bm_link'])) {
135 $this->ctrl->setParameterByClass(
136 "ilbookmarkadministrationgui",
137 'bm_link',
138 urlencode(\ilUtil::stripSlashes($_GET['bm_link']))
139 );
140 if (isset($_GET['bm_title'])) {
141 $this->ctrl->setParameterByClass(
142 "ilbookmarkadministrationgui",
143 'bm_title',
144 urlencode(\ilUtil::stripSlashes($_GET['bm_title']))
145 );
146 }
147 $ret = $ilCtrl->getLinkTargetByClass("ilbookmarkadministrationgui", "newFormBookmark");
148 }
149
150 $ilCtrl->setParameterByClass("ilbookmarkadministrationgui", "bmf_id", $_GET["bmf_id"]);
151 return $ret;
152 break;
153 }
154 }
155}
user()
Definition: user.php:4
$_GET["client_id"]
An exception for terminatinating execution or to throw for unit testing.
Bookmark explorer GUI class.
getNodeContent($a_node)
Get node content.
getNodeHref($a_node)
Get href for node.
__construct($a_parent_obj, $a_parent_cmd, $a_user_id=0)
Constructor.
isNodeHighlighted($a_node)
Is node highlighted?
getNodeIconAlt($a_node)
Get node icon alt attribute.
getNodeIcon($a_node)
Get node icon.
setSkipRootNode($a_val)
Set skip root node.
Explorer class that works on tree objects (Services/Tree)
setTypeWhiteList($a_val)
Set type white list.
getNodeId($a_node)
Get id for node.
setOrderField($a_val, $a_numeric=false)
Set order field.
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)
global $ilCtrl
Definition: ilias.php:18
$ret
Definition: parser.php:6
global $DIC
Definition: saml.php:7
$ilUser
Definition: imgupload.php:18