ILIAS  Release_5_0_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
class.ilContainerSimpleContentGUI.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;
36 
41  function __construct($container_gui_obj)
42  {
43  parent::__construct($container_gui_obj);
44  $this->initDetails();
45  }
46 
47 
51  function getMainContent()
52  {
53  global $lng,$ilTabs;
54 
55  // see bug #7452
56 // $ilTabs->setSubTabActive($this->getContainerObject()->getType().'_content');
57 
58  include_once 'Services/Object/classes/class.ilObjectListGUIFactory.php';
59 
60  $tpl = new ilTemplate("tpl.container_page.html", true, true,
61  "Services/Container");
62 
63  // Feedback
64  // @todo
65 // $this->__showFeedBack();
66 
67  $this->__showMaterials($tpl);
68 
69  return $tpl->get();
70  }
71 
75  function __showMaterials($a_tpl)
76  {
77  global $ilAccess, $lng;
78 
79  $this->items = $this->getContainerObject()->getSubItems($this->getContainerGUI()->isActiveAdministrationPanel());
81 
82  $this->initRenderer();
83 
84  $output_html = $this->getContainerGUI()->getContainerPageHTML();
85 
86  // get embedded blocks
87  if ($output_html != "")
88  {
89  $output_html = $this->insertPageEmbeddedBlocks($output_html);
90  }
91 
92  // item groups
93  $this->getItemGroupsHTML();
94 
95  if (is_array($this->items["_all"]))
96  {
97  $this->renderer->addCustomBlock("_all", $lng->txt("content"));
98 
99  $position = 1;
100  foreach($this->items["_all"] as $k => $item_data)
101  {
102  if (!$this->renderer->hasItem($item_data["child"]))
103  {
104  $html = $this->renderItem($item_data, $position++, true);
105  if ($html != "")
106  {
107  $this->renderer->addItemToBlock("_all", $item_data["type"], $item_data["child"], $html);
108  }
109  }
110  }
111  }
112 
113  $output_html .= $this->renderer->getHTML();
114 
115  $a_tpl->setVariable("CONTAINER_PAGE_CONTENT", $output_html);
116  }
117 
125  protected function initDetails()
126  {
127  global $ilUser;
128 
129  if($_GET['expand'])
130  {
131  if($_GET['expand'] > 0)
132  {
133  $_SESSION['sess']['expanded'][abs((int) $_GET['expand'])] = self::DETAILS_ALL;
134  }
135  else
136  {
137  $_SESSION['sess']['expanded'][abs((int) $_GET['expand'])] = self::DETAILS_TITLE;
138  }
139  }
140 
141 
142  if($this->getContainerObject()->getType() == 'crs')
143  {
144  include_once('./Modules/Session/classes/class.ilSessionAppointment.php');
145  if($session = ilSessionAppointment::lookupNextSessionByCourse($this->getContainerObject()->getRefId()))
146  {
147  $this->force_details = $session;
148  }
149  elseif($session = ilSessionAppointment::lookupLastSessionByCourse($this->getContainerObject()->getRefId()))
150  {
151  $this->force_details = $session;
152  }
153  }
154  }
155 
163  public function getDetailsLevel($a_session_id)
164  {
165  if($this->getContainerGUI()->isActiveAdministrationPanel())
166  {
168  }
169  if(isset($_SESSION['sess']['expanded'][$a_session_id]))
170  {
171  return $_SESSION['sess']['expanded'][$a_session_id];
172  }
173  if($a_session_id == $this->force_details)
174  {
175  return self::DETAILS_ALL;
176  }
177  else
178  {
179  return self::DETAILS_TITLE;
180  }
181  }
182 
183 
184 
185 } // END class.ilContainerSimpleContentGUI
186 ?>