ILIAS  release_7 Revision v7.30-3-g800a261c036
class.ilPublicSectionExplorerGUI.php
Go to the documentation of this file.
1<?php
2
3/* Copyright (c) 1998-2019 ILIAS open source, Extended GPL, see docs/LICENSE */
4
14{
15 public $exp_id = "public_section";
16
24 public function __construct($a_parent_obj, $a_parent_cmd, $a_lm)
25 {
26 $this->lm = $a_lm;
27
28 $tree = ilLMTree::getInstance($this->lm->getId());
29
30 parent::__construct("lm_public_section_" . $this->lm->getId(), $a_parent_obj, $a_parent_cmd, $tree);
31 }
32
39 public function getNodeContent($a_node)
40 {
41 $lang = ($_GET["transl"] != "")
42 ? $_GET["transl"]
43 : "-";
45 $a_node,
47 $this->lm->isActiveNumbering(),
48 false,
49 false,
50 $this->lm->getId(),
51 $lang
52 );
53 }
54
61 public function getNodeIcon($a_node)
62 {
63 if ($a_node["child"] == $this->getNodeId($this->getRootNode())) {
64 $icon = ilUtil::getImagePath("icon_lm.svg");
65 } else {
66 $a_name = "icon_" . $a_node["type"] . ".svg";
67 if ($a_node["type"] == "pg") {
68 $lm_set = new ilSetting("lm");
70 $a_node["child"],
71 $this->lm->getType(),
72 $lm_set->get("time_scheduled_page_activation")
73 );
74
75 // is page scheduled?
76 $img_sc = ($lm_set->get("time_scheduled_page_activation") &&
77 ilLMPage::_isScheduledActivation($a_node["child"], $this->lm->getType()))
78 ? "_sc"
79 : "";
80
81 $a_name = "icon_pg" . $img_sc . ".svg";
82
83 if (!$active) {
84 $a_name = "icon_pg_d" . $img_sc . ".svg";
85 } else {
87 $a_node["child"],
88 $this->lm->getType()
89 );
90 if ($contains_dis) {
91 $a_name = "icon_pg_del" . $img_sc . ".svg";
92 }
93 }
94 }
95 $icon = ilUtil::getImagePath($a_name);
96 }
97
98 return $icon;
99 }
100
104 public function beforeRendering()
105 {
106 //select public pages and open public chapters
107 foreach ($this->getAllNodes() as $node) {
108 if ($node["public_access"] == "y" && $node["type"] == "pg") {
109 $this->setNodeSelected($node["obj_id"]);
110 }
111 if ($node["public_access"] == "y" && $node["type"] == "st") {
112 $this->setNodeOpen($node["obj_id"]);
113 }
114 }
115 }
116
123 protected function getAllNodes($from_id = null)
124 {
125 $nodes = array();
126
127 if ($from_id === null) {
128 $from_id = $this->getNodeId($this->getRootNode());
129 }
130
131 foreach ($this->getChildsOfNode($from_id) as $node) {
132 $nodes[] = $node;
133
134 if ($node["type"] == "st") {
135 $nodes = array_merge($nodes, $this->getAllNodes($node["obj_id"]));
136 }
137 }
138 return $nodes;
139 }
140
147 public function isNodeClickable($a_node)
148 {
149 if ($a_node["type"] == "pg") {
150 return true;
151 }
152 return false;
153 }
154}
$_GET["client_id"]
An exception for terminatinating execution or to throw for unit testing.
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=self::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)
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
$lm_set
$lang
Definition: xapiexit.php:8