ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
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
8include_once("./Services/UIComponent/Explorer2/classes/class.ilTreeExplorerGUI.php");
9
19{
20 public $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 $a_node,
53 $this->lm->isActiveNumbering(),
54 false,
55 false,
56 $this->lm->getId(),
57 $lang
58 );
59 }
60
67 public function getNodeIcon($a_node)
68 {
69 if ($a_node["child"] == $this->getNodeId($this->getRootNode())) {
70 $icon = ilUtil::getImagePath("icon_lm.svg");
71 } else {
72 $a_name = "icon_" . $a_node["type"] . ".svg";
73 if ($a_node["type"] == "pg") {
74 include_once("./Modules/LearningModule/classes/class.ilLMPage.php");
75 $lm_set = new ilSetting("lm");
77 $a_node["child"],
78 $this->lm->getType(),
79 $lm_set->get("time_scheduled_page_activation")
80 );
81
82 // is page scheduled?
83 $img_sc = ($lm_set->get("time_scheduled_page_activation") &&
84 ilLMPage::_isScheduledActivation($a_node["child"], $this->lm->getType()))
85 ? "_sc"
86 : "";
87
88 $a_name = "icon_pg" . $img_sc . ".svg";
89
90 if (!$active) {
91 $a_name = "icon_pg_d" . $img_sc . ".svg";
92 } else {
93 include_once("./Modules/LearningModule/classes/class.ilLMPage.php");
95 $a_node["child"],
96 $this->lm->getType()
97 );
98 if ($contains_dis) {
99 $a_name = "icon_pg_del" . $img_sc . ".svg";
100 }
101 }
102 }
103 $icon = ilUtil::getImagePath($a_name);
104 }
105
106 return $icon;
107 }
108
112 public function beforeRendering()
113 {
114 //select public pages and open public chapters
115 foreach ($this->getAllNodes() as $node) {
116 if ($node["public_access"] == "y" && $node["type"] == "pg") {
117 $this->setNodeSelected($node["obj_id"]);
118 }
119 if ($node["public_access"] == "y" && $node["type"] == "st") {
120 $this->setNodeOpen($node["obj_id"]);
121 }
122 }
123 }
124
131 protected function getAllNodes($from_id = null)
132 {
133 $nodes = array();
134
135 if ($from_id === null) {
136 $from_id = $this->getNodeId($this->getRootNode());
137 }
138
139 foreach ($this->getChildsOfNode($from_id) as $node) {
140 $nodes[] = $node;
141
142 if ($node["type"] == "st") {
143 $nodes = array_merge($nodes, $this->getAllNodes($node["obj_id"]));
144 }
145 }
146 return $nodes;
147 }
148
155 public function isNodeClickable($a_node)
156 {
157 if ($a_node["type"] == "pg") {
158 return true;
159 }
160 return false;
161 }
162}
$_GET["client_id"]
An exception for terminatinating execution or to throw for unit testing.
const IL_PAGE_TITLE
setNodeSelected($a_id)
Set node to be opened (additional custom opened node, not standard expand behaviour)
setNodeOpen($a_id)
Set node to be opened (additional custom opened node, not standard expand behaviour)
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.
static getInstance($a_tree_id)
Get Instance.
static _lookupActive($a_id, $a_parent_type, $a_check_scheduled_activation=false, $a_lang="-")
lookup activation status
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.
__construct($a_parent_obj, $a_parent_cmd, $a_lm)
constructor
getAllNodes($from_id=null)
Returns all nodes from tree recursive.
beforeRendering()
select public pages and open public chapter
ILIAS Setting Class.
Explorer class that works on tree objects (Services/Tree)
getNodeId($a_node)
Get id for node.
getChildsOfNode($a_parent_node_id)
Get childs of node.
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)
for($i=1; $i<=count($kw_cases_sel); $i+=1) $lang
Definition: langwiz.php:349
$lm_set