ILIAS  Release_4_0_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
class.ilContainerSessionsContentGUI.php
Go to the documentation of this file.
1 <?php
2 /*
3  +-----------------------------------------------------------------------------+
4  | ILIAS open source |
5  +-----------------------------------------------------------------------------+
6  | Copyright (c) 1998-2008 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 include_once("./Services/Container/classes/class.ilContainerContentGUI.php");
25 
34 {
35  protected $force_details = 0;
36 
41  function __construct($container_gui_obj)
42  {
43  global $lng;
44 
45  parent::__construct($container_gui_obj);
46  $this->lng = $lng;
47  $this->initDetails();
48  }
49 
50 
58  public function getDetailsLevel($a_session_id)
59  {
60  if($this->getContainerGUI()->isActiveAdministrationPanel())
61  {
63  }
64  if(isset($_SESSION['sess']['expanded'][$a_session_id]))
65  {
66  return $_SESSION['sess']['expanded'][$a_session_id];
67  }
68  if($a_session_id == $this->force_details)
69  {
70  return self::DETAILS_ALL;
71  }
72  else
73  {
74  return self::DETAILS_TITLE;
75  }
76  }
77 
78 
82  function getMainContent()
83  {
84  global $lng,$ilTabs;
85 
86  $ilTabs->setSubTabActive($this->getContainerObject()->getType().'_content');
87 
88 
89  include_once './classes/class.ilObjectListGUIFactory.php';
90 
91  $tpl = new ilTemplate ("tpl.container_page.html", true, true,
92  "Services/Container");
93 
94  // Feedback
95  // @todo
96 // $this->__showFeedBack();
97 
98  $this->__showMaterials($tpl);
99 
100  // @todo: Move this completely to GUI class?
101 /* $this->getContainerGUI()->adminCommands = $this->adminCommands;
102  $this->getContainerGUI()->showAdministrationPanel($tpl);
103  $this->getContainerGUI()->showPossibleSubObjects();
104  $this->getContainerGUI()->showPermanentLink($tpl);*/
105 
106  return $tpl->get();
107  }
108 
112  function __showMaterials($a_tpl)
113  {
114  global $ilAccess, $lng;
115 
116  $this->items = $this->getContainerObject()->getSubItems($this->getContainerGUI()->isActiveAdministrationPanel());
118 
119  $output_html = $this->getContainerGUI()->getContainerPageHTML();
120 
121  // get embedded blocks
122  if ($output_html != "")
123  {
124  $output_html = $this->insertPageEmbeddedBlocks($output_html);
125  }
126 
127  // sessions
128  $done_sessions = false;
129  $tpl = $this->newBlockTemplate();
130  if (is_array($this->items["sess"]))
131  {
132  $this->items['sess'] = ilUtil::sortArray($this->items['sess'],'start','ASC',true,true);
133 
134  // all rows
135  $item_html = array();
136  $position = 1;
137  foreach($this->items["sess"] as $item_data)
138  {
139  if ($this->rendered_items[$item_data["child"]] !== true)
140  {
141  $html = $this->renderItem($item_data,$position++,true);
142  if ($html != "")
143  {
144  $item_html[] = $html;
145  }
146  }
147  }
148 
149  // if we have at least one item, output the block
150  if (count($item_html) > 0)
151  {
152  $this->addHeaderRow($tpl, "", $lng->txt("objs_sess"));
153  foreach($item_html as $h)
154  {
155  $this->addStandardRow($tpl, $h);
156  }
157  $done_sessions = true;
158  }
159  }
160 
161  // all other items
162  if ($done_sessions)
163  {
164  #$this->addFooterRow($tpl);
165  $this->addSeparatorRow($tpl);
166  }
167  if (is_array($this->items["_all"]))
168  {
169  // all rows
170  $item_html = array();
171  $position = 1;
172  foreach($this->items["_all"] as $item_data)
173  {
174  if ($this->rendered_items[$item_data["child"]] !== true)
175  {
176  if ($item_data["type"] == "sess")
177  {
178  continue;
179  }
180  $html = $this->renderItem($item_data,$position++,true);
181  if ($html != "")
182  {
183  $item_html[] = $html;
184  }
185  }
186  }
187 
188  // if we have at least one item, output the block
189  if (count($item_html) > 0)
190  {
191  $this->addHeaderRow($tpl, "", $lng->txt("content"));
192  foreach($item_html as $h)
193  {
194  $this->addStandardRow($tpl, $h);
195  }
196  }
197  }
198 
199  $output_html .= $tpl->get();
200 
201  $a_tpl->setVariable("CONTAINER_PAGE_CONTENT", $output_html);
202  }
203 
204 
212  public function addFooterRow($tpl)
213  {
214  $tpl->setCurrentBlock('details_img');
215 
216  $append = $this->details_level == 1 ? 'off' : '';
217  $tpl->setCurrentBlock('details_img');
218  $tpl->setVariable('DETAILS_SRC',ilUtil::getImagePath('details1'.$append.'.gif'));
219  $tpl->setVariable('DETAILS_ALT',$this->lng->txt('details').' 1');
220  $tpl->setVariable('DETAILS_LINK','repository.php?ref_id='.$this->getContainerObject()->getRefId().'&details_level=1');
221  $tpl->parseCurrentBlock();
222 
223  $append = $this->details_level == 2 ? 'off' : '';
224  $tpl->setCurrentBlock('details_img');
225  $tpl->setVariable('DETAILS_SRC',ilUtil::getImagePath('details2'.$append.'.gif'));
226  $tpl->setVariable('DETAILS_ALT',$this->lng->txt('details').' 2');
227  $tpl->setVariable('DETAILS_LINK','repository.php?ref_id='.$this->getContainerObject()->getRefId().'&details_level=2');
228  $tpl->parseCurrentBlock();
229 
230  $append = $this->details_level == 3 ? 'off' : '';
231  $tpl->setCurrentBlock('details_img');
232  $tpl->setVariable('DETAILS_SRC',ilUtil::getImagePath('details3'.$append.'.gif'));
233  $tpl->setVariable('DETAILS_ALT',$this->lng->txt('details').' 3');
234  $tpl->setVariable('DETAILS_LINK','repository.php?ref_id='.$this->getContainerObject()->getRefId().'&details_level=3');
235  $tpl->parseCurrentBlock();
236 
237  $tpl->setCurrentBlock('container_details_row');
238  $tpl->setVariable('TXT_DETAILS',$this->lng->txt('details'));
239  $tpl->parseCurrentBlock();
240  }
241 
249  protected function initDetails()
250  {
251  global $ilUser;
252 
253  if($_GET['expand'])
254  {
255  if($_GET['expand'] > 0)
256  {
257  $_SESSION['sess']['expanded'][abs((int) $_GET['expand'])] = self::DETAILS_ALL;
258  }
259  else
260  {
261  $_SESSION['sess']['expanded'][abs((int) $_GET['expand'])] = self::DETAILS_TITLE;
262  }
263  }
264 
265  include_once('./Modules/Session/classes/class.ilSessionAppointment.php');
266  if($session = ilSessionAppointment::lookupNextSessionByCourse($this->getContainerObject()->getRefId()))
267  {
268  $this->force_details = $session;
269  }
271  {
272  $this->force_details = $session;
273  }
274  }
275 
276 
277 
278 } // END class.ilContainerSessionsContentGUI
279 ?>