ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5
class.ilPublicSectionExplorerGUI.php
Go to the documentation of this file.
1 <?php
2 /*
3  * Copyright (c) 1998-2014 ILIAS open source, Extended GPL, see docs/LICENSE
4  * Date: 23.10.14
5  * Time: 10:47
6  */
7 
8 include_once("./Services/UIComponent/Explorer2/classes/class.ilTreeExplorerGUI.php");
9 
19 {
20  var $exp_id = "public_section";
21 
29  public function __construct($a_parent_obj,$a_parent_cmd, $a_lm)
30  {
31  $this->lm = $a_lm;
32 
33  include_once("./Modules/LearningModule/classes/class.ilLMTree.php");
34  $tree = ilLMTree::getInstance($this->lm->getId());
35 
36  parent::__construct("lm_public_section_".$this->lm->getId(),$a_parent_obj,$a_parent_cmd,$tree);
37  }
38 
45  public function getNodeContent($a_node)
46  {
47  $lang = ($_GET["transl"] != "")
48  ? $_GET["transl"]
49  : "-";
51  $this->lm->isActiveNumbering(), false, false, $this->lm->getId(), $lang);
52  }
53 
60  function getNodeIcon($a_node)
61  {
62  if ($a_node["child"] == $this->getNodeId($this->getRootNode()))
63  {
64  $icon = ilUtil::getImagePath("icon_lm.svg");
65  }
66  else
67  {
68  $a_name = "icon_".$a_node["type"].".svg";
69  if ($a_node["type"] == "pg")
70  {
71  include_once("./Modules/LearningModule/classes/class.ilLMPage.php");
72  $lm_set = new ilSetting("lm");
73  $active = ilLMPage::_lookupActive($a_node["child"], $this->lm->getType(),
74  $lm_set->get("time_scheduled_page_activation"));
75 
76  // is page scheduled?
77  $img_sc = ($lm_set->get("time_scheduled_page_activation") &&
78  ilLMPage::_isScheduledActivation($a_node["child"], $this->lm->getType()))
79  ? "_sc"
80  : "";
81 
82  $a_name = "icon_pg".$img_sc.".svg";
83 
84  if (!$active)
85  {
86  $a_name = "icon_pg_d".$img_sc.".svg";
87  }
88  else
89  {
90  include_once("./Modules/LearningModule/classes/class.ilLMPage.php");
91  $contains_dis = ilLMPage::_lookupContainsDeactivatedElements($a_node["child"],
92  $this->lm->getType());
93  if ($contains_dis)
94  {
95  $a_name = "icon_pg_del".$img_sc.".svg";
96  }
97  }
98  }
99  $icon = ilUtil::getImagePath($a_name);
100  }
101 
102  return $icon;
103  }
104 
108  public function beforeRendering()
109  {
110  //select public pages and open public chapters
111  foreach($this->getAllNodes() as $node)
112  {
113  if($node["public_access"] == "y" && $node["type"] == "pg")
114  {
115  $this->setNodeSelected($node["obj_id"]);
116  }
117  if($node["public_access"] == "y" && $node["type"]== "st")
118  {
119  $this->setNodeOpen($node["obj_id"]);
120  }
121  }
122  }
123 
130  protected function getAllNodes($from_id = null)
131  {
132  $nodes = array();
133 
134  if($from_id === null)
135  {
136  $from_id = $this->getNodeId($this->getRootNode());
137  }
138 
139  foreach($this->getChildsOfNode($from_id) as $node)
140  {
141  $nodes[] = $node;
142 
143  if($node["type"] == "st")
144  {
145  $nodes = array_merge($nodes, $this->getAllNodes($node["obj_id"]));
146  }
147  }
148  return $nodes;
149  }
150 
157  function isNodeClickable($a_node)
158  {
159  if ($a_node["type"] == "pg")
160  {
161  return true;
162  }
163  return false;
164  }
165 
166 }
ILIAS Setting Class.
__construct($a_parent_obj, $a_parent_cmd, $a_lm)
constructor
const IL_PAGE_TITLE
$_GET["client_id"]
setNodeOpen($a_id)
Set node to be opened (additional custom opened node, not standard expand behaviour) ...
setNodeSelected($a_id)
Set node to be opened (additional custom opened node, not standard expand behaviour) ...
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)
static getInstance($a_tree_id)
Get Instance.
getAllNodes($from_id=null)
Returns all nodes from tree recursive.
beforeRendering()
select public pages and open public chapter
getNodeId($a_node)
Get id for node.
static _lookupContainsDeactivatedElements($a_id, $a_parent_type, $a_lang="-")
lookup whether page contains deactivated elements
static _isScheduledActivation($a_id, $a_parent_type, $a_lang="-")
Check whether page is activated by time schedule.
getRootNode()
Get root node.
$lm_set
Explorer class that works on tree objects (Services/Tree)
getChildsOfNode($a_parent_node_id)
Get childs of node.
static _getPresentationTitle($a_node, $a_mode=IL_PAGE_TITLE, $a_include_numbers=false, $a_time_scheduled_activation=false, $a_force_content=false, $a_lm_id=0, $a_lang="-")
Get affective title.