ILIAS  release_5-0 Revision 5.0.0-1144-gc4397b1f870
ilLMTOCExplorerGUI Class Reference

LM presentation (left frame) explorer GUI class. More...

+ Inheritance diagram for ilLMTOCExplorerGUI:
+ Collaboration diagram for ilLMTOCExplorerGUI:

Public Member Functions

 __construct ($a_parent_obj, $a_parent_cmd, ilLMPresentationGUI $a_lm_pres, $a_lang="-", $a_focus_id=0)
 Constructor. More...
 
 getRootNode ()
 Get root node. More...
 
 setTracker ($a_val)
 Set tracker. More...
 
 getTracker ()
 Get tracker. More...
 
 setHighlightNode ($a_val)
 Set highlighted node. More...
 
 getHighlightNode ()
 Get highlighted node. More...
 
 isNodeHighlighted ($a_node)
 Is node highlighted? More...
 
 getNodeContent ($a_node)
 Get node content. More...
 
 getNodeIcon ($a_node)
 Get node icon. More...
 
 isNodeClickable ($a_node)
 Is node clickable. More...
 
 getNodeIconAlt ($a_node)
 Get node icon alt text. More...
 
 getNodeHref ($a_node)
 Get href for node. More...
 
 isNodeVisible ($a_node)
 Is node visible? More...
 
- Public Member Functions inherited from ilLMExplorerGUI
 __construct ($a_parent_obj, $a_parent_cmd, ilObjContentObject $a_lm, $a_id="")
 Constructor. More...
 
 beforeRendering ()
 Before rendering. More...
 
 getNodeContent ($a_node)
 Get node content. More...
 
 isNodeHighlighted ($a_node)
 Is node highlighted? More...
 
- Public Member Functions inherited from ilTreeExplorerGUI
 __construct ($a_expl_id, $a_parent_obj, $a_parent_cmd, $a_tree)
 Constructor. More...
 
 getTree ()
 Get tree. More...
 
 setOrderField ($a_val, $a_numeric=false)
 Set order field. More...
 
 getOrderField ()
 Get order field. More...
 
 setTypeWhiteList ($a_val)
 Set type white list. More...
 
 getTypeWhiteList ()
 Get type white list. More...
 
 setTypeBlackList ($a_val)
 Set type black list. More...
 
 getTypeBlackList ()
 Get type black list. More...
 
 setPreloadChilds ($a_val)
 Set preload childs. More...
 
 getPreloadChilds ()
 Get preload childs. More...
 
 getSuccessorNode ($a_node_id, $a_type="")
 Get successor node (currently only(!) based on lft/rgt tree values) More...
 
 getChildsOfNode ($a_parent_node_id)
 Get childs of node. More...
 
 getNodeId ($a_node)
 Get id for node. More...
 
 getNodeIconAlt ($a_node)
 Get node icon alt attribute. More...
 
 getRootNode ()
 Get root node. More...
 
 setPathOpen ($a_id)
 Set node path to be opened. More...
 
 getHTML ()
 Get HTML. More...
 
- Public Member Functions inherited from ilExplorerBaseGUI
 __construct ($a_expl_id, $a_parent_obj, $a_parent_cmd)
 Constructor. More...
 
 getRootNode ()
 Get root node. More...
 
 getChildsOfNode ($a_parent_node_id)
 Get childs of node. More...
 
 getNodeContent ($a_node)
 Get content of a node. More...
 
 getNodeId ($a_node)
 Get id of a node. More...
 
 getNodeHref ($a_node)
 Get href for node. More...
 
 nodeHasVisibleChilds ($a_node)
 Node has childs? More...
 
 sortChilds ($a_childs, $a_parent_node_id)
 Sort childs. More...
 
 getNodeIcon ($a_node)
 Get node icon path. More...
 
 getNodeIconAlt ($a_node)
 Get node icon alt attribute. More...
 
 getNodeTarget ($a_node)
 Get node target (frame) attribute. More...
 
 getNodeOnClick ($a_node)
 Get node onclick attribute. More...
 
 isNodeVisible ($a_node)
 Is node visible? More...
 
 isNodeHighlighted ($a_node)
 Is node highlighted? More...
 
 isNodeClickable ($a_node)
 Is node clickable? More...
 
 getId ()
 Get id of explorer element. More...
 
 setSkipRootNode ($a_val)
 Set skip root node. More...
 
 getSkipRootNode ()
 Get skip root node. More...
 
 setAjax ($a_val)
 Set ajax. More...
 
 getAjax ()
 Get ajax. More...
 
 setSecondaryHighlightedNodes ($a_val)
 Set secondary (background) highlighted nodes. More...
 
 getSecondaryHighlightedNodes ()
 Get secondary (background) highlighted nodes. More...
 
 setNodeOpen ($a_id)
 Set node to be opened (additional custom opened node, not standard expand behaviour) More...
 
 setSelectMode ($a_postvar, $a_multi=false)
 Set select mode (to deactivate, pass an empty string as postvar) More...
 
 setNodeSelected ($a_id)
 Set node to be opened (additional custom opened node, not standard expand behaviour) More...
 
 setOfflineMode ($a_val)
 Set offline mode. More...
 
 getOfflineMode ()
 Get offline mode. More...
 
 handleCommand ()
 Handle explorer internal command. More...
 
 getContainerId ()
 Get container id. More...
 
 openNode ()
 Open node. More...
 
 closeNode ()
 Close node. More...
 
 getNodeAsync ()
 Get node asynchronously. More...
 
 beforeRendering ()
 Before rendering. More...
 
 getOnLoadCode ()
 Get on load code. More...
 
 getHTML ()
 Get HTML. More...
 
 renderNode ($a_node, $tpl)
 Render node. More...
 
 renderChilds ($a_node_id, $tpl)
 Render childs. More...
 
 getDomNodeIdForNodeId ($a_node_id)
 Get DOM node id for node id. More...
 
 getNodeIdForDomNodeId ($a_dom_node_id)
 Get node id for dom node id. More...
 
 listItemStart ($tpl, $a_node)
 List item start. More...
 
 listItemEnd ($tpl)
 List item end. More...
 
 listStart ($tpl)
 List start. More...
 
 listEnd ($tpl)
 List end. More...
 

Protected Attributes

 $lang
 
 $highlight_node
 
 $tracker
 
- Protected Attributes inherited from ilLMExplorerGUI
 $lp_cache
 
 $cnt_lmobj
 
- Protected Attributes inherited from ilTreeExplorerGUI
 $tree = null
 
 $order_field = ""
 
 $order_field_numeric = false
 
 $type_white_list = array()
 
 $type_black_list = array()
 
 $childs = array()
 
 $preloaded = false
 
 $preload_childs = false
 
 $root_node_data = null
 
 $all_childs = array()
 
- Protected Attributes inherited from ilExplorerBaseGUI
 $skip_root_node = false
 
 $ajax = false
 
 $custom_open_nodes = array()
 
 $selected_nodes = array()
 
 $select_postvar = ""
 
 $offline_mode = false
 
 $sec_highl_nodes = array()
 

Additional Inherited Members

- Static Public Member Functions inherited from ilExplorerBaseGUI
static getLocalExplorerJsPath ()
 Get local path of explorer js. More...
 
static getLocalJsTreeJsPath ()
 Get local path of jsTree js. More...
 
static createHTMLExportDirs ($a_target_dir)
 Create html export directories. More...
 
static init ()
 Init JS. More...
 
- Protected Member Functions inherited from ilLMExplorerGUI
 checkLPIcon ($a_id)
 Check learning progress icon. More...
 
- Protected Member Functions inherited from ilTreeExplorerGUI
 preloadChilds ()
 Preload childs. More...
 
- Protected Member Functions inherited from ilExplorerBaseGUI
 getNodeToggleOnClick ($a_node)
 Get onclick attribute for node toggling. More...
 
 getSelectOnClick ($a_node)
 Get onclick attribute for selecting radio/checkbox. More...
 
- Static Protected Attributes inherited from ilExplorerBaseGUI
static $js_tree_path = "./Services/UIComponent/Explorer2/lib/jstree-v.pre1.0/jquery.jstree.js"
 
static $js_expl_path = "./Services/UIComponent/Explorer2/js/Explorer2.js"
 

Detailed Description

LM presentation (left frame) explorer GUI class.

Author
Alex Killing alex..nosp@m.kill.nosp@m.ing@g.nosp@m.mx.d.nosp@m.e
Version
$Id$

Definition at line 14 of file class.ilLMTOCExplorerGUI.php.

Constructor & Destructor Documentation

◆ __construct()

ilLMTOCExplorerGUI::__construct (   $a_parent_obj,
  $a_parent_cmd,
ilLMPresentationGUI  $a_lm_pres,
  $a_lang = "-",
  $a_focus_id = 0 
)

Constructor.

Parameters
object$a_parent_objparent gui object
string$a_parent_cmdparent cmd
ilLMPresentationGUI$a_lm_preslearning module presentation gui object
string$a_langlanguage

Definition at line 28 of file class.ilLMTOCExplorerGUI.php.

30 {
31 $this->lm_pres = $a_lm_pres;
32 $this->lm = $this->lm_pres->lm;
33 $exp_id = (!$this->getOfflineMode() && $this->lm->getProgressIcons())
34 ? "ilLMProgressTree"
35 : "";
36 parent::__construct($a_parent_obj, $a_parent_cmd, $this->lm, $exp_id);
37 $this->lm_set = new ilSetting("lm");
38 $this->lang = $a_lang;
39 if ($a_focus_id > 0)
40 {
41 $this->setSecondaryHighlightedNodes(array($a_focus_id));
42 }
43 if ($this->lm->getTOCMode() != "pages")
44 {
45 $this->setTypeWhiteList(array("st", "du"));
46 }
47 $this->focus_id = $a_focus_id;
48 }
setSecondaryHighlightedNodes($a_val)
Set secondary (background) highlighted nodes.
getOfflineMode()
Get offline mode.
ILIAS Setting Class.
setTypeWhiteList($a_val)
Set type white list.

References ilExplorerBaseGUI\getOfflineMode(), ilExplorerBaseGUI\setSecondaryHighlightedNodes(), and ilTreeExplorerGUI\setTypeWhiteList().

+ Here is the call graph for this function:

Member Function Documentation

◆ getHighlightNode()

ilLMTOCExplorerGUI::getHighlightNode ( )

Get highlighted node.

Returns
int node id

Definition at line 99 of file class.ilLMTOCExplorerGUI.php.

References $highlight_node.

Referenced by isNodeHighlighted().

+ Here is the caller graph for this function:

◆ getNodeContent()

ilLMTOCExplorerGUI::getNodeContent (   $a_node)

Get node content.

Parameters
array$a_nodenode array
Returns
string node content

Reimplemented from ilLMExplorerGUI.

Definition at line 125 of file class.ilLMTOCExplorerGUI.php.

126 {
127 if ($a_node["type"] == "st")
128 {
129 return ilStructureObject::_getPresentationTitle($a_node["child"],
130 $this->lm->isActiveNumbering(), false, $this->lm->getId(), $this->lang);
131 }
132 else if ($a_node["type"] == "pg")
133 {
134 return ilLMPageObject::_getPresentationTitle($a_node["child"],
135 $this->lm->getPageHeader(), $this->lm->isActiveNumbering(),
136 $this->lm_set->get("time_scheduled_page_activation"), true, $this->lm->getId(), $this->lang);
137 }
138 else if ($a_node["child"] == $this->getNodeId($this->getRootNode()))
139 {
140 return $this->lm->getTitle();
141 }
142
143 if ($a_node["type"] == "pg")
144 {
145 return ilLMPageObject::_getPresentationTitle($a_node["child"],
146 $this->lm->getPageHeader(), $this->lm->isActiveNumbering(),
147 $this->lm_set->get("time_scheduled_page_activation"), true, $this->lm->getId(), $this->lang);
148 }
149
150 return $a_node["title"];
151 }
static _getPresentationTitle($a_pg_id, $a_mode=IL_CHAPTER_TITLE, $a_include_numbers=false, $a_time_scheduled_activation=false, $a_force_content=false, $a_lm_id=0, $a_lang="-")
presentation title doesn't have to be page title, it may be chapter title + page title or chapter tit...
static _getPresentationTitle($a_st_id, $a_include_numbers=false, $a_time_scheduled_activation=false, $a_lm_id=0, $a_lang="-")
get presentation title
getNodeId($a_node)
Get id for node.

References ilLMPageObject\_getPresentationTitle(), ilStructureObject\_getPresentationTitle(), ilTreeExplorerGUI\getNodeId(), and getRootNode().

+ Here is the call graph for this function:

◆ getNodeHref()

ilLMTOCExplorerGUI::getNodeHref (   $a_node)

Get href for node.

Parameters
mixed$a_nodenode object/array
Returns
string href attribute

Reimplemented from ilExplorerBaseGUI.

Definition at line 329 of file class.ilLMTOCExplorerGUI.php.

330 {
331 if (!$this->getOfflineMode())
332 {
333 return $this->lm_pres->getLink($this->lm->getRefId(), "", $a_node["child"]);
334 //return parent::buildLinkTarget($a_node_id, $a_type);
335 }
336 else
337 {
338 if ($a_node["type"] != "pg")
339 {
340 // get next activated page
341 $found = false;
342 while (!$found)
343 {
344 $a_node = $this->getTree()->fetchSuccessorNode($a_node["child"], "pg");
345 include_once("./Modules/LearningModule/classes/class.ilLMPage.php");
346 $active = ilLMPage::_lookupActive($a_node["child"], $this->lm->getType(),
347 $this->lm_set->get("time_scheduled_page_activation"));
348
349 if ($a_node["child"] > 0 && !$active)
350 {
351 $found = false;
352 }
353 else
354 {
355 $found = true;
356 }
357 }
358 }
359 include_once("./Modules/LearningModule/classes/class.ilLMPageObject.php");
360 if ($nid = ilLMPageObject::getExportId($this->lm->getId(), $a_node["child"]))
361 {
362 return "lm_pg_".$nid.".html";
363 }
364 return "lm_pg_".$a_node["child"].".html";
365 }
366
367 }
static getExportId($a_lm_id, $a_lmobj_id, $a_type="pg")
Get export ID.
static _lookupActive($a_id, $a_parent_type, $a_check_scheduled_activation=false, $a_lang="-")
lookup activation status

References ilPageObject\_lookupActive(), ilLMObject\getExportId(), ilExplorerBaseGUI\getOfflineMode(), and ilTreeExplorerGUI\getTree().

+ Here is the call graph for this function:

◆ getNodeIcon()

ilLMTOCExplorerGUI::getNodeIcon (   $a_node)

Get node icon.

Parameters
array$a_nodenode array
Returns
string icon path

Reimplemented from ilExplorerBaseGUI.

Definition at line 160 of file class.ilLMTOCExplorerGUI.php.

161 {
162 // overwrite chapter icons with lp info?
163 if(!$this->getOfflineMode() && $a_node["type"] == "st")
164 {
165 $icon = $this->checkLPIcon($a_node["child"]);
166 if ($icon != "")
167 {
168 return $icon;
169 }
170 }
171
172 // use progress icons (does not depend on lp mode)
173 if(!$this->getOfflineMode() && $this->lm->getProgressIcons())
174 {
175 return $this->tracker->getIconForLMObject($a_node, $this->highlight_node);
176 }
177
178 include_once("./Modules/LearningModule/classes/class.ilLMObject.php");
179
180 if ($a_node["type"] == "du")
181 {
182 $a_node["type"] = "lm";
183 }
184 $a_name = "icon_".$a_node["type"].".svg";
185 if ($a_node["type"] == "pg")
186 {
187 include_once("./Modules/LearningModule/classes/class.ilLMPage.php");
188 $lm_set = new ilSetting("lm");
189 $active = ilLMPage::_lookupActive($a_node["child"], $this->lm->getType(),
190 $lm_set->get("time_scheduled_page_activation"));
191
192 // is page scheduled?
193 $img_sc = ($lm_set->get("time_scheduled_page_activation") &&
194 ilLMPage::_isScheduledActivation($a_node["child"], $this->lm->getType()) && !$active
195 && !$this->getOfflineMode())
196 ? "_sc"
197 : "";
198
199 $a_name = "icon_pg".$img_sc.".svg";
200
201 if (!$active && !$this->getOfflineMode())
202 {
203 $a_name = "icon_pg_d".$img_sc.".svg";
204 }
205 }
206
207 return ilUtil::getImagePath($a_name, false, "output", $this->getOfflineMode());
208 }
checkLPIcon($a_id)
Check learning progress icon.
static _isScheduledActivation($a_id, $a_parent_type, $a_lang="-")
Check whether page is activated by time schedule.
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)
$lm_set

References $lm_set, ilPageObject\_isScheduledActivation(), ilPageObject\_lookupActive(), ilLMExplorerGUI\checkLPIcon(), ilUtil\getImagePath(), and ilExplorerBaseGUI\getOfflineMode().

+ Here is the call graph for this function:

◆ getNodeIconAlt()

ilLMTOCExplorerGUI::getNodeIconAlt (   $a_node)

Get node icon alt text.

Parameters
array$a_nodenode array
Returns
string alt text

Reimplemented from ilTreeExplorerGUI.

Definition at line 319 of file class.ilLMTOCExplorerGUI.php.

320 {
321 }

◆ getRootNode()

ilLMTOCExplorerGUI::getRootNode ( )

Get root node.

Reimplemented from ilTreeExplorerGUI.

Definition at line 53 of file class.ilLMTOCExplorerGUI.php.

54 {
55 $root_id = $this->getTree()->readRootId();
56 if ($this->focus_id > 0 && $this->getTree()->isInTree($this->focus_id) &&
57 ilLMObject::_lookupType($this->focus_id) == "st")
58 {
59// $root_id = $this->focus_id;
60 }
61 return $this->getTree()->getNodeData($root_id);
62 }
static _lookupType($a_obj_id, $a_lm_id=0)
Lookup type.

References ilLMObject\_lookupType(), and ilTreeExplorerGUI\getTree().

Referenced by getNodeContent().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getTracker()

ilLMTOCExplorerGUI::getTracker ( )

Get tracker.

Returns
ilLMTracker tracker object

Definition at line 79 of file class.ilLMTOCExplorerGUI.php.

References $tracker.

Referenced by isNodeClickable().

+ Here is the caller graph for this function:

◆ isNodeClickable()

ilLMTOCExplorerGUI::isNodeClickable (   $a_node)

Is node clickable.

Parameters
array$a_nodenode array
Returns
bool clickable?

Reimplemented from ilExplorerBaseGUI.

Definition at line 216 of file class.ilLMTOCExplorerGUI.php.

217 {
218 global $ilUser;
219
220 $orig_node_id = $a_node["child"];
221
222 // if navigation is restricted based on correct answered questions
223 // check if we have preceeding pages including unsanswered/incorrect answered questions
224 if (!$this->getOfflineMode())
225 {
226 if ($this->lm->getRestrictForwardNavigation())
227 {
228 if ($this->getTracker()->hasPredIncorrectAnswers($orig_node_id))
229 {
230 return false;
231 }
232 }
233 }
234
235 if ($a_node["type"] == "st")
236 {
237 if (!$this->getOfflineMode())
238 {
239 if ($this->lm->getTOCMode() != "pages")
240 {
241 $a_node = $this->getTree()->fetchSuccessorNode($a_node["child"], "pg");
242 }
243 else
244 {
245 // faster, but needs pages to be in explorer
246 $a_node = $this->getSuccessorNode($a_node["child"], "pg");
247 }
248 if ($a_node["child"] == 0)
249 {
250 return false;
251 }
252 }
253 else
254 {
255 // get next activated page
256 $found = false;
257 while (!$found)
258 {
259 if ($this->lm->getTOCMode() != "pages")
260 {
261 $a_node = $this->getTree()->fetchSuccessorNode($a_node["child"], "pg");
262 }
263 else
264 {
265 $a_node = $this->getSuccessorNode($a_node["child"], "pg");
266 }
267 include_once("./Modules/LearningModule/classes/class.ilLMPage.php");
268 $active = ilLMPage::_lookupActive($a_node["child"], $this->lm->getType(),
269 $this->lm_set->get("time_scheduled_page_activation"));
270
271 if ($a_node["child"] > 0 && !$active)
272 {
273 $found = false;
274 }
275 else
276 {
277 $found = true;
278 }
279 }
280 if ($a_node["child"] <= 0)
281 {
282 return false;
283 }
284 else
285 {
286 $path = $this->getTree()->getPathId($a_node["child"]);
287 if (!in_array($orig_node_id, $path))
288 {
289 return false;
290 }
291 }
292 }
293 }
294
295 if ($a_node["type"] == "pg")
296 {
297 // check public area mode
298 include_once("./Modules/LearningModule/classes/class.ilLMObject.php");
299 include_once 'Services/Payment/classes/class.ilPaymentObject.php';
300 if (($ilUser->getId() == ANONYMOUS_USER_ID ||
301 ilPaymentObject::_requiresPurchaseToAccess((int)$this->lm->getRefId())) &&
302 !ilLMObject::_isPagePublic($a_node["child"], true))
303 {
304 return false;
305 }
306 }
307
308 return true;
309
310 }
static _isPagePublic($a_node_id, $a_check_public_mode=false)
static _requiresPurchaseToAccess($a_ref_id, $a_purchasetype='')
this function should be used by all buyable repository objects !!
getSuccessorNode($a_node_id, $a_type="")
Get successor node (currently only(!) based on lft/rgt tree values)
$path
Definition: index.php:22
global $ilUser
Definition: imgupload.php:15

References $ilUser, $path, ilLMObject\_isPagePublic(), ilPageObject\_lookupActive(), ilPaymentObject\_requiresPurchaseToAccess(), ilExplorerBaseGUI\getOfflineMode(), ilTreeExplorerGUI\getSuccessorNode(), getTracker(), and ilTreeExplorerGUI\getTree().

+ Here is the call graph for this function:

◆ isNodeHighlighted()

ilLMTOCExplorerGUI::isNodeHighlighted (   $a_node)

Is node highlighted?

Parameters
mixed$a_nodenode object/array
Returns
boolean node visible true/false

Reimplemented from ilLMExplorerGUI.

Definition at line 110 of file class.ilLMTOCExplorerGUI.php.

111 {
112 if ($a_node["child"] == $this->getHighlightNode())
113 {
114 return true;
115 }
116 return false;
117 }
getHighlightNode()
Get highlighted node.

References getHighlightNode().

+ Here is the call graph for this function:

◆ isNodeVisible()

ilLMTOCExplorerGUI::isNodeVisible (   $a_node)

Is node visible?

Parameters
mixed$a_nodenode object/array
Returns
boolean node visible true/false

Reimplemented from ilExplorerBaseGUI.

Definition at line 375 of file class.ilLMTOCExplorerGUI.php.

376 {
377 include_once("./Modules/LearningModule/classes/class.ilLMTracker.php");
378 return ilLMTracker::_isNodeVisible($a_node);
379 }
static _isNodeVisible($a_node)
Is node visible for the learner.

References ilLMTracker\_isNodeVisible().

+ Here is the call graph for this function:

◆ setHighlightNode()

ilLMTOCExplorerGUI::setHighlightNode (   $a_val)

Set highlighted node.

Parameters
int$a_valnode id

Definition at line 89 of file class.ilLMTOCExplorerGUI.php.

90 {
91 $this->highlight_node = $a_val;
92 }

◆ setTracker()

ilLMTOCExplorerGUI::setTracker (   $a_val)

Set tracker.

Parameters
ilLMTracker$a_valtracker object

Definition at line 69 of file class.ilLMTOCExplorerGUI.php.

70 {
71 $this->tracker = $a_val;
72 }

Field Documentation

◆ $highlight_node

ilLMTOCExplorerGUI::$highlight_node
protected

Definition at line 17 of file class.ilLMTOCExplorerGUI.php.

Referenced by getHighlightNode().

◆ $lang

ilLMTOCExplorerGUI::$lang
protected

Definition at line 16 of file class.ilLMTOCExplorerGUI.php.

◆ $tracker

ilLMTOCExplorerGUI::$tracker
protected

Definition at line 18 of file class.ilLMTOCExplorerGUI.php.

Referenced by getTracker().


The documentation for this class was generated from the following file: