ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
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
24include_once("./Services/Container/classes/class.ilContainerContentGUI.php");
25
34{
35 protected $force_details = array();
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(in_array($a_session_id,$this->force_details))
69 {
70 return self::DETAILS_ALL;
71 }
72 else
73 {
75 }
76 }
77
78
82 function getMainContent()
83 {
84 global $lng,$ilTabs;
85
86 // see bug #7452
87// $ilTabs->setSubTabActive($this->getContainerObject()->getType().'_content');
88
89
90 include_once 'Services/Object/classes/class.ilObjectListGUIFactory.php';
91
92 $tpl = new ilTemplate("tpl.container_page.html", true, true,
93 "Services/Container");
94
95 // Feedback
96 // @todo
97// $this->__showFeedBack();
98
99 $this->__showMaterials($tpl);
100
101 // @todo: Move this completely to GUI class?
102/* $this->getContainerGUI()->adminCommands = $this->adminCommands;
103 $this->getContainerGUI()->showAdministrationPanel($tpl);
104 $this->getContainerGUI()->showPossibleSubObjects();
105 $this->getContainerGUI()->showPermanentLink($tpl);*/
106
107 return $tpl->get();
108 }
109
113 function __showMaterials($a_tpl)
114 {
115 global $lng;
116
117 $this->items = $this->getContainerObject()->getSubItems($this->getContainerGUI()->isActiveAdministrationPanel());
119
120 $this->initRenderer();
121
122 $output_html = $this->getContainerGUI()->getContainerPageHTML();
123
124 // get embedded blocks
125 if ($output_html != "")
126 {
127 $output_html = $this->insertPageEmbeddedBlocks($output_html);
128 }
129
130 if (is_array($this->items["sess"]) ||
131 $this->items['sess_link']['prev']['value'] ||
132 $this->items['sess_link']['next']['value'])
133 {
134 $this->items['sess'] = ilUtil::sortArray($this->items['sess'],'start','asc',true,false);
135
136 if($this->items['sess_link']['prev']['value'])
137 {
138 $prefix = $this->renderSessionLimitLink(true);
139 }
140 if($this->items['sess_link']['next']['value'])
141 {
142 $postfix = $this->renderSessionLimitLink(false);
143 }
144
145 $this->renderer->addTypeBlock("sess", $prefix, $postfix);
146 $this->renderer->setBlockPosition("sess", 1);
147
148 $position = 1;
149
150 foreach($this->items["sess"] as $item_data)
151 {
152 if (!$this->renderer->hasItem($item_data["child"]))
153 {
154 $html = $this->renderItem($item_data, $position++, true);
155 if ($html != "")
156 {
157 $this->renderer->addItemToBlock("sess", $item_data["type"], $item_data["child"], $html);
158 }
159 }
160 }
161 }
162
163 $pos = $this->getItemGroupsHTML(1);
164
165 if (is_array($this->items["_all"]))
166 {
167 $this->renderer->addCustomBlock("_all", $lng->txt("content"));
168 $this->renderer->setBlockPosition("_all", ++$pos);
169
170 $position = 1;
171
172 foreach($this->items["_all"] as $item_data)
173 {
174 // #14599
175 if ($item_data["type"] == "sess" || $item_data["type"] == "itgr")
176 {
177 continue;
178 }
179
180 if (!$this->renderer->hasItem($item_data["child"]))
181 {
182 $html = $this->renderItem($item_data, $position++, true);
183 if ($html != "")
184 {
185 $this->renderer->addItemToBlock("_all", $item_data["type"], $item_data["child"], $html);
186 }
187 }
188 }
189 }
190
191 $output_html .= $this->renderer->getHTML();
192
193 $a_tpl->setVariable("CONTAINER_PAGE_CONTENT", $output_html);
194 }
195
200 protected function renderSessionLimitLink($a_previous = true)
201 {
202 global $lng, $ilUser, $ilCtrl;
203
204 $lng->loadLanguageModule('crs');
205
206 $tpl = new ilTemplate('tpl.container_list_item.html',true,true,
207 "Services/Container");
208 $tpl->setVariable('DIV_CLASS','ilContainerListItemOuter');
209 $tpl->setCurrentBlock('item_title_linked');
210
211 if($a_previous)
212 {
213 $prefp = $ilUser->getPref('crs_sess_show_prev_'.$this->getContainerObject()->getId());
214
215 if($prefp)
216 {
217 $tpl->setVariable('TXT_TITLE_LINKED',$lng->txt('crs_link_hide_prev_sessions'));
218 $ilCtrl->setParameterByClass(get_class($this->getContainerGUI()),'crs_prev_sess',(int) !$prefp);
219 $tpl->setVariable('HREF_TITLE_LINKED',$ilCtrl->getLinkTargetByClass(get_class($this->getContainerGUI())));
220 $ilCtrl->clearParametersByClass(get_class($this->getContainerGUI()));
221 }
222 else
223 {
224 $tpl->setVariable('TXT_TITLE_LINKED',$lng->txt('crs_link_show_all_prev_sessions'));
225 $ilCtrl->setParameterByClass(get_class($this->getContainerGUI()),'crs_prev_sess',(int) !$prefp);
226 $tpl->setVariable('HREF_TITLE_LINKED',$ilCtrl->getLinkTargetByClass(get_class($this->getContainerGUI())));
227 $ilCtrl->clearParametersByClass(get_class($this->getContainerGUI()));
228 }
229 }
230 else
231 {
232 $prefn = $ilUser->getPref('crs_sess_show_next_'.$this->getContainerObject()->getId());
233
234 if($prefn)
235 {
236 $tpl->setVariable('TXT_TITLE_LINKED',$lng->txt('crs_link_hide_next_sessions'));
237 $ilCtrl->setParameterByClass(get_class($this->getContainerGUI()),'crs_next_sess',(int) !$prefn);
238 $tpl->setVariable('HREF_TITLE_LINKED',$ilCtrl->getLinkTargetByClass(get_class($this->getContainerGUI())));
239 $ilCtrl->clearParametersByClass(get_class($this->getContainerGUI()));
240 }
241 else
242 {
243 $tpl->setVariable('TXT_TITLE_LINKED',$lng->txt('crs_link_show_all_next_sessions'));
244 $ilCtrl->setParameterByClass(get_class($this->getContainerGUI()),'crs_next_sess',(int) !$prefn);
245 $tpl->setVariable('HREF_TITLE_LINKED',$ilCtrl->getLinkTargetByClass(get_class($this->getContainerGUI())));
246 $ilCtrl->clearParametersByClass(get_class($this->getContainerGUI()));
247 }
248 }
249 $tpl->parseCurrentBlock();
250
251 return $tpl->get();
252 }
253
254
262 public function addFooterRow($tpl)
263 {
264 global $ilCtrl;
265
266 $ilCtrl->setParameterByClass("ilrepositorygui", "ref_id", $_GET["ref_id"]);
267
268 $tpl->setCurrentBlock('container_details_row');
269 $tpl->setVariable('TXT_DETAILS',$this->lng->txt('details'));
270 $tpl->parseCurrentBlock();
271 }
272
280 protected function initDetails()
281 {
282 global $ilUser;
283
284 if($_GET['expand'])
285 {
286 if($_GET['expand'] > 0)
287 {
288 $_SESSION['sess']['expanded'][abs((int) $_GET['expand'])] = self::DETAILS_ALL;
289 }
290 else
291 {
292 $_SESSION['sess']['expanded'][abs((int) $_GET['expand'])] = self::DETAILS_TITLE;
293 }
294 }
295
296 include_once('./Modules/Session/classes/class.ilSessionAppointment.php');
298 {
299 $this->force_details = $session;
300 }
301 elseif($session = ilSessionAppointment::lookupLastSessionByCourse($this->getContainerObject()->getRefId()))
302 {
303 $this->force_details = array($session);
304 }
305 }
306
307
308
309} // END class.ilContainerSessionsContentGUI
310?>
global $tpl
Definition: ilias.php:8
$_GET["client_id"]
$_SESSION["AccountId"]
Parent class of all container content GUIs.
initRenderer()
Init container renderer.
getContainerObject()
Get container object.
getContainerGUI()
Get container GUI object.
renderItem($a_item_data, $a_position=0, $a_force_icon=false, $a_pos_prefix="")
Render an item.
insertPageEmbeddedBlocks($a_output_html)
Insert blocks into container page.
getItemGroupsHTML($a_pos=0)
Get item groups HTML.
clearAdminCommandsDetermination()
cleaer administration commands determination
renderSessionLimitLink($a_previous=true)
Show link to show/hide all previous/next sessions.
getMainContent()
Get content HTML for main column.
getDetailsLevel($a_session_id)
get details level
static lookupLastSessionByCourse($a_ref_id)
@access public
static lookupNextSessionByCourse($a_ref_id)
@access public
special template class to simplify handling of ITX/PEAR
static sortArray($array, $a_array_sortby, $a_array_sortorder=0, $a_numeric=false, $a_keep_keys=false)
sortArray
$html
Definition: example_001.php:87
global $ilCtrl
Definition: ilias.php:18
global $lng
Definition: privfeed.php:40
global $ilUser
Definition: imgupload.php:15