ILIAS  release_4-4 Revision
All Data Structures Namespaces Files Functions Variables Modules Pages
ilLMTOCExplorerGUI Class Reference

LM editor 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="-")
 Constructor. 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)
 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...
 
 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...
 
 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
 
- 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
 

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...
 
- 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 editor 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 = "-" 
)

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 27 of file class.ilLMTOCExplorerGUI.php.

References ilTreeExplorerGUI\setTypeWhiteList().

28  {
29  $this->lm_pres = $a_lm_pres;
30  $this->lm = $this->lm_pres->lm;
31  parent::__construct($a_parent_obj, $a_parent_cmd, $this->lm);
32  $this->lm_set = new ilSetting("lm");
33  $this->lang = $a_lang;
34  if ($this->lm->getTOCMode() != "pages")
35  {
36  $this->setTypeWhiteList(array("st", "du"));
37  }
38 
39  }
ILIAS Setting Class.
setTypeWhiteList($a_val)
Set type white list.
+ Here is the call graph for this function:

Member Function Documentation

◆ getHighlightNode()

ilLMTOCExplorerGUI::getHighlightNode ( )

Get highlighted node.

Returns
int node id

Definition at line 56 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

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

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

83  {
84  if ($a_node["child"] == $this->getNodeId($this->getRootNode()))
85  {
86  return $this->lm->getTitle();
87  }
88 
89  if ($a_node["type"] == "st")
90  {
91  return ilStructureObject::_getPresentationTitle($a_node["child"],
92  $this->lm->isActiveNumbering(), false, $this->lm->getId(), $this->lang);
93  }
94 
95  if ($a_node["type"] == "pg")
96  {
97  return ilLMPageObject::_getPresentationTitle($a_node["child"],
98  $this->lm->getPageHeader(), $this->lm->isActiveNumbering(),
99  $this->lm_set->get("time_scheduled_page_activation"), true, $this->lm->getId(), $this->lang);
100  }
101 
102  return $a_node["title"];
103  }
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.
getRootNode()
Get root node.
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...
+ 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

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

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

263  {
264  if (!$this->getOfflineMode())
265  {
266  return $this->lm_pres->getLink($this->lm->getRefId(), "", $a_node["child"]);
267  //return parent::buildLinkTarget($a_node_id, $a_type);
268  }
269  else
270  {
271  if ($a_node["type"] != "pg")
272  {
273  // get next activated page
274  $found = false;
275  while (!$found)
276  {
277  $a_node = $this->getTree()->fetchSuccessorNode($a_node["child"], "pg");
278  include_once("./Modules/LearningModule/classes/class.ilLMPage.php");
279  $active = ilLMPage::_lookupActive($a_node["child"], $this->lm->getType(),
280  $this->lm_set->get("time_scheduled_page_activation"));
281 
282  if ($a_node["child"] > 0 && !$active)
283  {
284  $found = false;
285  }
286  else
287  {
288  $found = true;
289  }
290  }
291  }
292  include_once("./Modules/LearningModule/classes/class.ilLMPageObject.php");
293  if ($nid = ilLMPageObject::getExportId($this->lm->getId(), $a_node["child"]))
294  {
295  return "lm_pg_".$nid.".html";
296  }
297  return "lm_pg_".$a_node["child"].".html";
298  }
299 
300  }
static _lookupActive($a_id, $a_parent_type, $a_check_scheduled_activation=false, $a_lang="-")
lookup activation status
static getExportId($a_lm_id, $a_lmobj_id, $a_type="pg")
Get export ID.
getOfflineMode()
Get offline mode.
+ 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

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

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

113  {
114  // overwrite chapter icons with lp info?
115  if(!$this->getOfflineMode() && $a_node["type"] == "st")
116  {
117  $icon = $this->checkLPIcon($a_node["child"]);
118  if ($icon != "")
119  {
120  return $icon;
121  }
122  }
123 
124  include_once("./Modules/LearningModule/classes/class.ilLMObject.php");
125 
126  if ($a_node["type"] == "du")
127  {
128  $a_node["type"] = "lm";
129  }
130  $a_name = "icon_".$a_node["type"]."_s.png";
131  if ($a_node["type"] == "pg")
132  {
133  include_once("./Modules/LearningModule/classes/class.ilLMPage.php");
134  $lm_set = new ilSetting("lm");
135  $active = ilLMPage::_lookupActive($a_node["child"], $this->lm->getType(),
136  $lm_set->get("time_scheduled_page_activation"));
137 
138  // is page scheduled?
139  $img_sc = ($lm_set->get("time_scheduled_page_activation") &&
140  ilLMPage::_isScheduledActivation($a_node["child"], $this->lm->getType()) && !$active
141  && !$this->getOfflineMode())
142  ? "_sc"
143  : "";
144 
145  $a_name = "icon_pg".$img_sc."_s.png";
146 
147  if (!$active && !$this->getOfflineMode())
148  {
149  $a_name = "icon_pg_d".$img_sc."_s.png";
150  }
151  }
152 
153  return ilUtil::getImagePath($a_name, false, "output", $this->getOfflineMode());
154  }
ILIAS Setting Class.
checkLPIcon($a_id)
Check learning progress icon.
static _lookupActive($a_id, $a_parent_type, $a_check_scheduled_activation=false, $a_lang="-")
lookup activation status
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)
getOfflineMode()
Get offline mode.
static _isScheduledActivation($a_id, $a_parent_type, $a_lang="-")
Check whether page is activated by time schedule.
$lm_set
+ 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

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

253  {
254  }

◆ isNodeClickable()

ilLMTOCExplorerGUI::isNodeClickable (   $a_node)

Is node clickable.

Parameters
array$a_nodenode array
Returns
bool clickable?

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

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

163  {
164  global $ilUser;
165 
166  $orig_node_id = $a_node["child"];
167 
168  if ($a_node["type"] == "st")
169  {
170  if (!$this->getOfflineMode())
171  {
172  if ($this->lm->getTOCMode() != "pages")
173  {
174  $a_node = $this->getTree()->fetchSuccessorNode($a_node["child"], "pg");
175  }
176  else
177  {
178  // faster, but needs pages to be in explorer
179  $a_node = $this->getSuccessorNode($a_node["child"], "pg");
180  }
181  if ($a_node["child"] == 0)
182  {
183  return false;
184  }
185  }
186  else
187  {
188  // get next activated page
189  $found = false;
190  while (!$found)
191  {
192  if ($this->lm->getTOCMode() != "pages")
193  {
194  $a_node = $this->getTree()->fetchSuccessorNode($a_node["child"], "pg");
195  }
196  else
197  {
198  $a_node = $this->getSuccessorNode($a_node["child"], "pg");
199  }
200  include_once("./Modules/LearningModule/classes/class.ilLMPage.php");
201  $active = ilLMPage::_lookupActive($a_node["child"], $this->lm->getType(),
202  $this->lm_set->get("time_scheduled_page_activation"));
203 
204  if ($a_node["child"] > 0 && !$active)
205  {
206  $found = false;
207  }
208  else
209  {
210  $found = true;
211  }
212  }
213  if ($a_node["child"] <= 0)
214  {
215  return false;
216  }
217  else
218  {
219  $path = $this->getTree()->getPathId($a_node["child"]);
220  if (!in_array($orig_node_id, $path))
221  {
222  return false;
223  }
224  }
225  }
226  }
227 
228  if ($a_node["type"] == "pg")
229  {
230  // check public area mode
231  include_once("./Modules/LearningModule/classes/class.ilLMObject.php");
232  include_once 'Services/Payment/classes/class.ilPaymentObject.php';
233  if (($ilUser->getId() == ANONYMOUS_USER_ID ||
234  ilPaymentObject::_requiresPurchaseToAccess((int)$this->lm->getRefId())) &&
235  !ilLMObject::_isPagePublic($a_node["child"], true))
236  {
237  return false;
238  }
239  }
240 
241  return true;
242 
243  }
getSuccessorNode($a_node_id, $a_type="")
Get successor node (currently only(!) based on lft/rgt tree values)
static _requiresPurchaseToAccess($a_ref_id, $a_purchasetype='')
this function should be used by all buyable repository objects !!
static _lookupActive($a_id, $a_parent_type, $a_check_scheduled_activation=false, $a_lang="-")
lookup activation status
getOfflineMode()
Get offline mode.
global $ilUser
Definition: imgupload.php:15
$path
Definition: index.php:22
static _isPagePublic($a_node_id, $a_check_public_mode=false)
+ 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

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

References getHighlightNode().

68  {
69  if ($a_node["child"] == $this->getHighlightNode())
70  {
71  return true;
72  }
73  return false;
74  }
getHighlightNode()
Get highlighted node.
+ 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

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

References ilPageObject\_lookupActivationData(), ilPageObject\_lookupActive(), and ilUtil\now().

309  {
310  include_once("./Services/COPage/classes/class.ilPageObject.php");
311 
312  if ($a_node["type"] != "pg")
313  {
314  return true;
315  }
316 
317  $active = ilPageObject::_lookupActive($a_node["child"], "lm",
318  $this->lm_set->get("time_scheduled_page_activation"));
319 
320  if(!$active)
321  {
322  $act_data = ilPageObject::_lookupActivationData((int) $a_node["child"], "lm");
323  if ($act_data["show_activation_info"] &&
324  (ilUtil::now() < $act_data["activation_start"]))
325  {
326  return true;
327  }
328  else
329  {
330  return false;
331  }
332  }
333  else
334  {
335  return true;
336  }
337  }
static now()
Return current timestamp in Y-m-d H:i:s format.
_lookupActivationData($a_id, $a_parent_type, $a_lang="-")
Lookup activation data.
static _lookupActive($a_id, $a_parent_type, $a_check_scheduled_activation=false, $a_lang="-")
lookup activation status
+ Here is the call graph for this function:

◆ setHighlightNode()

ilLMTOCExplorerGUI::setHighlightNode (   $a_val)

Set highlighted node.

Parameters
int$a_valnode id

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

47  {
48  $this->highlight_node = $a_val;
49  }

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.

Referenced by getNodeContent().


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