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 
4 include_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  {
65  $lng = $this->lng;
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  {
95  $lng = $this->lng;
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 }
getNodeHref($a_node)
Get href for node.
global $DIC
Definition: saml.php:7
$_GET["client_id"]
getNodeIcon($a_node)
Get node icon.
setSkipRootNode($a_val)
Set skip root node.
user()
Definition: user.php:4
__construct($a_parent_obj, $a_parent_cmd, $a_user_id=0)
Constructor.
Bookmark explorer GUI class.
setTypeWhiteList($a_val)
Set type white list.
global $ilCtrl
Definition: ilias.php:18
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)
$ilUser
Definition: imgupload.php:18
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled
getNodeId($a_node)
Get id for node.
getNodeContent($a_node)
Get node content.
getRootNode()
Get root node.
isNodeHighlighted($a_node)
Is node highlighted?
Explorer class that works on tree objects (Services/Tree)
$ret
Definition: parser.php:6
setOrderField($a_val, $a_numeric=false)
Set order field.
getNodeIconAlt($a_node)
Get node icon alt attribute.