ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5
class.ilShopPublicSectionSelector.php
Go to the documentation of this file.
1 <?php
2 /*
3  +-----------------------------------------------------------------------------+
4  | ILIAS open source |
5  +-----------------------------------------------------------------------------+
6  | Copyright (c) 1998-2001 ILIAS open source, University of Cologne |
7  | |
8  | This program is free software; you can redistribute it and/or |
9  | modify it under the terms of the GNU General Public License |
10  | as published by the Free Software Foundation; either version 2 |
11  | of the License, or (at your option) any later version. |
12  | |
13  | This program is distributed in the hope that it will be useful, |
14  | but WITHOUT ANY WARRANTY; without even the implied warranty of |
15  | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
16  | GNU General Public License for more details. |
17  | |
18  | You should have received a copy of the GNU General Public License |
19  | along with this program; if not, write to the Free Software |
20  | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
21  +-----------------------------------------------------------------------------+
22 */
23 
24 require_once("./Modules/LearningModule/classes/class.ilLMTOCExplorer.php");
25 require_once("./Modules/LearningModule/classes/class.ilLMObject.php");
26 
35 {
41  var $root_id;
42  var $output;
43  var $ctrl;
44 
46  var $ref_id;
47 
55  public function __construct($a_target, $a_lm_obj, $a_gui_class)
56  {
57  global $ilCtrl;
58 
59  $this->ctrl = $ilCtrl;
60  $this->gui_class = $a_gui_class;
61  parent::ilLMTOCExplorer($a_target, $a_lm_obj);
62  $this->setSessionExpandVariable('lmshoppublicselectorexpand');
63  $this->setExpandTarget($a_target);
64  $this->setExpand((int)$_GET['lmshoppublicselectorexpand'] ? (int)$_GET['lmshoppublicselectorexpand'] : $this->tree->readRootId());
65  }
66 
67  public function buildFrameTarget($a_type, $a_child = 0, $a_obj_id = 0)
68  {
69  return '_top';
70  }
71 
72  public function buildLinkTarget($a_node_id, $a_type)
73  {
74  if(!$this->offlineMode())
75  {
76  return parent::buildLinkTarget($a_node_id, $a_type);
77  }
78  else
79  {
80  if ($a_node_id < 1)
81  {
82  $a_node_id = $this->tree->getRootId();
83  }
84  if ($a_type != 'pg')
85  {
86  $a_node = $this->tree->fetchSuccessorNode($a_node_id, 'pg');
87  $a_node_id = $a_node['child'];
88  }
89  if (!$this->lm_obj->cleanFrames())
90  {
91  return 'frame_'.$a_node_id.'_maincontent.html';
92  }
93  else
94  {
95  return 'lm_pg_'.$a_node_id.'.html';
96  }
97  }
98  }
99 
100  public function isClickable($a_type, $a_node_id)
101  {
102  global $ilUser;
103 
104  if($a_type == 'st')
105  {
106  $a_node = $this->tree->fetchSuccessorNode($a_node_id, 'pg');
107  $a_node_id = $a_node['child'];
108  if ($a_node_id == 0)
109  {
110  return false;
111  }
112  }
113 
114  if($a_type == 'pg')
115  {
116  // check public area mode
117  include_once('./Modules/LearningModule/classes/class.ilLMObject.php');
118  if ($this->lm_obj->getPublicAccessMode() == 'selected'
119  && !ilLMObject::_isPagePublic($a_node_id))
120  {
121  return false;
122  }
123  }
124 
125  return true;
126  }
127 
128  public function getOutput()
129  {
130  global $ilBench, $tpl;
131 
132  $ilBench->start('Explorer', 'getOutput');
133 
134  $this->format_options[0]['tab'] = array();
135 
136  $depth = $this->tree->getMaximumDepth();
137 
138  for ($i=0;$i<$depth;++$i)
139  {
140  $this->createLines($i);
141  }
142 
143  // set global body class
144  $tpl->setBodyClass("il_Explorer");
145 
146  $tpl_tree = new ilTemplate('tpl.tree_form.html', true, true, 'Modules/LearningModule');
147 
148  $cur_depth = -1;
149  foreach ($this->format_options as $key => $options)
150  {
151 //echo '-'.$options['depth'].'-';
152  if (!$options['visible'])
153  {
154  continue;
155  }
156 
157  if ($key == 0)
158  {
159  continue;
160  }
161 
162  // end tags
163  $this->handleListEndTags($tpl_tree, $cur_depth, $options['depth']);
164 
165  // start tags
166  $this->handleListStartTags($tpl_tree, $cur_depth, $options['depth']);
167 
168  $cur_depth = $options['depth'];
169 
170  if ($options['visible'] and $key != 0)
171  {
172  $this->formatObject($tpl_tree, $options['child'], $options, $options['obj_id']);
173  }
174  }
175 
176  $this->handleListEndTags($tpl_tree, $cur_depth, -1);
177 
178  $ilBench->stop('Explorer', 'getOutput');
179 
180  return $tpl_tree->get();
181  }
182 }
183 ?>
__construct($a_target, $a_lm_obj, $a_gui_class)
Constructor public.
$_GET["client_id"]
global $tpl
Definition: ilias.php:8
global $ilCtrl
Definition: ilias.php:18
if(!is_array($argv)) $options
special template class to simplify handling of ITX/PEAR
global $ilUser
Definition: imgupload.php:15
global $ilBench
Definition: ilias.php:18
buildFrameTarget($a_type, $a_child=0, $a_obj_id=0)
static _isPagePublic($a_node_id, $a_check_public_mode=false)