ILIAS  Release_4_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  $ilTabs->setSubTabActive($this->getContainerObject()->getType().'_content');
56 
57  include_once './classes/class.ilObjectListGUIFactory.php';
58 
59  $tpl = new ilTemplate ("tpl.container_page.html", true, true,
60  "Services/Container");
61 
62  // Feedback
63  // @todo
64 // $this->__showFeedBack();
65 
66  $this->__showMaterials($tpl);
67 
68  // @todo: Move this completely to GUI class?
69 /* $this->getContainerGUI()->adminCommands = $this->adminCommands;
70  $this->getContainerGUI()->showAdministrationPanel($tpl);
71  $this->getContainerGUI()->showPossibleSubObjects();
72  $this->getContainerGUI()->showPermanentLink($tpl);*/
73 
74  return $tpl->get();
75  }
76 
80  function __showMaterials($a_tpl)
81  {
82  global $ilAccess, $lng;
83 
84  $this->items = $this->getContainerObject()->getSubItems($this->getContainerGUI()->isActiveAdministrationPanel());
86 
87  $output_html = $this->getContainerGUI()->getContainerPageHTML();
88 
89  // get embedded blocks
90  if ($output_html != "")
91  {
92  $output_html = $this->insertPageEmbeddedBlocks($output_html);
93  }
94 
95 
96  $tpl = $this->newBlockTemplate();
97  if (is_array($this->items["_all"]))
98  {
99  // all rows
100  $item_html = array();
101  $position = 1;
102  foreach($this->items["_all"] as $k => $item_data)
103  {
104  if ($this->rendered_items[$item_data["child"]] !== true)
105  {
106  $html = $this->renderItem($item_data,$position++,true);
107  if ($html != "")
108  {
109  $item_html[] = $html;
110  }
111  }
112  }
113 
114  // if we have at least one item, output the block
115  if (count($item_html) > 0)
116  {
117  $this->addHeaderRow($tpl, "", $lng->txt("content"));
118  foreach($item_html as $h)
119  {
120  $this->addStandardRow($tpl, $h);
121  }
122  }
123  }
124 
125  $output_html .= $tpl->get();
126  $a_tpl->setVariable("CONTAINER_PAGE_CONTENT", $output_html);
127  }
128 
136  protected function initDetails()
137  {
138  global $ilUser;
139 
140  if($_GET['expand'])
141  {
142  if($_GET['expand'] > 0)
143  {
144  $_SESSION['sess']['expanded'][abs((int) $_GET['expand'])] = self::DETAILS_ALL;
145  }
146  else
147  {
148  $_SESSION['sess']['expanded'][abs((int) $_GET['expand'])] = self::DETAILS_TITLE;
149  }
150  }
151 
152 
153  if($this->getContainerObject()->getType() == 'crs')
154  {
155  include_once('./Modules/Session/classes/class.ilSessionAppointment.php');
156  if($session = ilSessionAppointment::lookupNextSessionByCourse($this->getContainerObject()->getRefId()))
157  {
158  $this->force_details = $session;
159  }
161  {
162  $this->force_details = $session;
163  }
164  }
165  }
166 
174  public function getDetailsLevel($a_session_id)
175  {
176  if($this->getContainerGUI()->isActiveAdministrationPanel())
177  {
179  }
180  if(isset($_SESSION['sess']['expanded'][$a_session_id]))
181  {
182  return $_SESSION['sess']['expanded'][$a_session_id];
183  }
184  if($a_session_id == $this->force_details)
185  {
186  return self::DETAILS_ALL;
187  }
188  else
189  {
190  return self::DETAILS_TITLE;
191  }
192  }
193 
194 
195 
196 } // END class.ilContainerSimpleContentGUI
197 ?>