ILIAS  release_4-3 Revision
 All Data Structures Namespaces Files Functions Variables Groups Pages
class.ilLPListOfObjectsGUI.php
Go to the documentation of this file.
1 <?php
2 
3 /* Copyright (c) 1998-2010 ILIAS open source, Extended GPL, see docs/LICENSE */
4 
5 
6 include_once './Services/Tracking/classes/class.ilLearningProgressBaseGUI.php';
7 include_once './Services/Tracking/classes/class.ilLPStatusWrapper.php';
8 include_once 'Services/Tracking/classes/class.ilLPObjSettings.php';
9 include_once 'Services/Search/classes/class.ilUserFilterGUI.php';
10 
24 {
25  var $details_id = 0;
26  var $details_type = '';
27  var $details_mode = 0;
28 
29  function ilLPListOfObjectsGUI($a_mode,$a_ref_id)
30  {
31  global $ilUser,$ilObjDataCache;
32 
33  parent::ilLearningProgressBaseGUI($a_mode,$a_ref_id);
34 
35  // Set item id for details
36  $this->__initDetails((int) $_REQUEST['details_id']);
37  }
41  function &executeCommand()
42  {
43  global $ilUser;
44 
45  $this->ctrl->setReturn($this, "");
46 
47  switch($this->ctrl->getNextClass())
48  {
49  case 'iltruserobjectspropstablegui':
50  $user_id = (int)$_GET["user_id"];
51  $this->ctrl->setParameter($this, "user_id", $user_id);
52 
53  $this->ctrl->setParameter($this, "details_id", $this->details_id);
54 
55  include_once("./Services/Tracking/classes/class.ilTrUserObjectsPropsTableGUI.php");
56  $table_gui = new ilTrUserObjectsPropsTableGUI($this, "userDetails",
57  $user_id, $this->details_obj_id, $this->details_id);
58  $this->ctrl->forwardCommand($table_gui);
59  break;
60 
61  case 'iltrsummarytablegui':
62  $cmd = "showObjectSummary";
63  if(!$this->details_id)
64  {
65  $this->details_id = ROOT_FOLDER_ID;
66  $cmd = "show";
67  }
68  include_once './Services/Tracking/classes/class.ilTrSummaryTableGUI.php';
69  $table_gui = new ilTrSummaryTableGUI($this, $cmd, $this->details_id);
70  $this->ctrl->forwardCommand($table_gui);
71  break;
72 
73  case 'iltrmatrixtablegui':
74  include_once './Services/Tracking/classes/class.ilTrMatrixTableGUI.php';
75  $table_gui = new ilTrMatrixTableGUI($this, "showUserObjectMatrix", $this->details_id);
76  $this->ctrl->forwardCommand($table_gui);
77  break;
78 
79  case 'iltrobjectuserspropstablegui':
80  $this->ctrl->setParameter($this, "details_id", $this->details_id);
81 
82  include_once './Services/Tracking/classes/class.ilTrObjectUsersPropsTableGUI.php';
83  $table_gui = new ilTrObjectUsersPropsTableGUI($this, "details", $this->details_obj_id, $this->details_id);
84  $this->ctrl->forwardCommand($table_gui);
85  break;
86 
87  default:
88  $cmd = $this->__getDefaultCommand();
89  $this->$cmd();
90  }
91 
92  return true;
93  }
94 
95  function updateUser()
96  {
97  if(isset($_GET["userdetails_id"]))
98  {
99  $parent = $this->details_id;
100  $this->__initDetails((int)$_GET["userdetails_id"]);
101  }
102 
103  $this->__updateUser($_REQUEST['user_id'], $this->details_obj_id);
104  ilUtil::sendSuccess($this->lng->txt('trac_update_edit_user'));
105 
106  if(!isset($_GET["userdetails_id"]))
107  {
108  $this->details();
109  }
110  else
111  {
112  $this->__initDetails($parent);
113  $this->userDetails();
114  }
115  }
116 
117  function editUser()
118  {
119  global $ilObjDataCache;
120 
121  $parent_id = $this->details_id;
122  if(isset($_GET["userdetails_id"]))
123  {
124  $this->__initDetails((int)$_GET["userdetails_id"]);
125  $sub_id = $this->details_id;
126  $cancel = "userdetails";
127  }
128  else
129  {
130  $sub_id = NULL;
131  $cancel = "details";
132  }
133 
134  include_once("./Services/InfoScreen/classes/class.ilInfoScreenGUI.php");
135  $info = new ilInfoScreenGUI($this);
136  $info->setFormAction($this->ctrl->getFormAction($this));
137  $this->__showObjectDetails($info, $this->details_obj_id);
138  $this->__appendUserInfo($info, (int)$_GET['user_id']);
139  // $this->__appendLPDetails($info,$this->details_obj_id,(int)$_GET['user_id']);
140 
141  $this->tpl->setVariable("ADM_CONTENT", $this->__showEditUser((int)$_GET['user_id'], $parent_id, $cancel, $sub_id)."<br />".$info->getHTML());
142  }
143 
144  function details()
145  {
146  global $ilToolbar;
147 
148  $this->tpl->addBlockFile('ADM_CONTENT','adm_content','tpl.lp_loo.html','Services/Tracking');
149 
150  // Show back button
151  if($this->getMode() == LP_MODE_PERSONAL_DESKTOP or
152  $this->getMode() == LP_MODE_ADMINISTRATION)
153  {
154  $print_view = false;
155  $this->__showButton($this->ctrl->getLinkTarget($this,'show'),$this->lng->txt('trac_view_list'));
156  }
157  else
158  {
159  $print_view = (bool)$_GET['prt'];
160  if(!$print_view)
161  {
162  $ilToolbar->setFormAction($this->ctrl->getFormAction($this));
163  $this->ctrl->setParameter($this, 'prt', 1);
164  $ilToolbar->addButton($this->lng->txt('print_view'),$this->ctrl->getLinkTarget($this,'details'), '_blank');
165  $this->ctrl->setParameter($this, 'prt', '');
166  }
167  }
168 
169  include_once("./Services/InfoScreen/classes/class.ilInfoScreenGUI.php");
170  $info = new ilInfoScreenGUI($this);
171  $info->setFormAction($this->ctrl->getFormAction($this));
172  if($this->__showObjectDetails($info, $this->details_obj_id))
173  {
174  $this->tpl->setCurrentBlock("info");
175  $this->tpl->setVariable("INFO_TABLE",$info->getHTML());
176  $this->tpl->parseCurrentBlock();
177  }
178 
179  $this->__showUsersList($print_view);
180  }
181 
182  function __showUsersList($a_print_view = false)
183  {
184  if($this->isAnonymized())
185  {
186  ilUtil::sendFailure($this->lng->txt('permission_denied'));
187  return;
188  }
189 
190  $this->ctrl->setParameter($this, "details_id", $this->details_id);
191 
192  include_once "Services/Tracking/classes/class.ilTrObjectUsersPropsTableGUI.php";
193  $gui = new ilTrObjectUsersPropsTableGUI($this, "details", $this->details_obj_id, $this->details_id, $a_print_view);
194 
195  $this->tpl->setVariable("LP_OBJECTS", $gui->getHTML());
196  $this->tpl->setVariable("LEGEND", $this->__getLegendHTML());
197 
198  if($a_print_view)
199  {
200  echo $this->tpl->get("DEFAULT", false, false, false, false, false, false);
201  exit();
202  }
203  }
204 
205  function userDetails()
206  {
207  global $ilObjDataCache, $ilToolbar;
208 
209  if($this->isAnonymized())
210  {
211  ilUtil::sendFailure($this->lng->txt('permission_denied'));
212  return;
213  }
214 
215  $this->ctrl->setParameter($this, "details_id", $this->details_id);
216 
217  $print_view = (bool)$_GET['prt'];
218  if(!$print_view)
219  {
220  // Show back button
221  $ilToolbar->addButton($this->lng->txt('trac_view_list'), $this->ctrl->getLinkTarget($this,'details'));
222  }
223 
224  $user_id = (int)$_GET["user_id"];
225  $this->ctrl->setParameter($this, "user_id", $user_id);
226 
227  if(!$print_view)
228  {
229  $this->ctrl->setParameter($this, 'prt', 1);
230  $ilToolbar->addButton($this->lng->txt('print_view'),$this->ctrl->getLinkTarget($this,'userDetails'), '_blank');
231  $this->ctrl->setParameter($this, 'prt', '');
232  };
233 
234  $this->tpl->addBlockFile('ADM_CONTENT','adm_content','tpl.lp_loo.html','Services/Tracking');
235 
236  include_once("./Services/InfoScreen/classes/class.ilInfoScreenGUI.php");
237  $info = new ilInfoScreenGUI($this);
238  $info->setFormAction($this->ctrl->getFormAction($this));
239  $this->__showObjectDetails($info, $this->details_obj_id);
240  $this->__appendUserInfo($info, $user_id);
241  // $this->__appendLPDetails($info,$this->details_obj_id,$user_id);
242  $this->tpl->setVariable("INFO_TABLE",$info->getHTML());
243 
244  include_once("./Services/Tracking/classes/class.ilTrUserObjectsPropsTableGUI.php");
245  $table = new ilTrUserObjectsPropsTableGUI($this, "userDetails", $user_id,
246  $this->details_obj_id, $this->details_id, $print_view);
247  $this->tpl->setVariable('LP_OBJECTS', $table->getHTML());
248  $this->tpl->setVariable('LEGEND', $this->__getLegendHTML());
249 
250  if($print_view)
251  {
252  echo $this->tpl->get("DEFAULT", false, false, false, false, false, false);
253  exit();
254  }
255  }
256 
257  function show()
258  {
259  // Clear table offset
260  $this->ctrl->saveParameter($this,'offset',0);
261 
262  // Show only detail of current repository item if called from repository
263  switch($this->getMode())
264  {
265  case LP_MODE_REPOSITORY:
266  $this->__initDetails($this->getRefId());
267  $this->details();
268  return true;
269  }
270 
271  $this->__listObjects();
272  }
273 
274  function __listObjects()
275  {
276  global $ilUser,$ilObjDataCache;
277 
278  $this->tpl->addBlockFile('ADM_CONTENT','adm_content','tpl.lp_list_objects.html','Services/Tracking');
279 
280  include_once("./Services/Tracking/classes/class.ilTrSummaryTableGUI.php");
281  $lp_table = new ilTrSummaryTableGUI($this, "", ROOT_FOLDER_ID);
282 
283  $this->tpl->setVariable("LP_OBJECTS", $lp_table->getHTML());
284  $this->tpl->setVariable('LEGEND', $this->__getLegendHTML());
285  }
286 
287  function __initDetails($a_details_id)
288  {
289  global $ilObjDataCache;
290 
291  if(!$a_details_id)
292  {
293  $a_details_id = $this->getRefId();
294  }
295  if($a_details_id)
296  {
297  $_GET['details_id'] = $a_details_id;
298  $this->details_id = $a_details_id;
299  $this->details_obj_id = $ilObjDataCache->lookupObjId($this->details_id);
300  $this->details_type = $ilObjDataCache->lookupType($this->details_obj_id);
301  $this->details_mode = ilLPObjSettings::_lookupMode($this->details_obj_id);
302  }
303  }
304 
308  function showObjectSummary()
309  {
310  global $tpl, $ilToolbar;
311 
312  $print_view = (bool)$_GET['prt'];
313  if(!$print_view)
314  {
315  $ilToolbar->setFormAction($this->ctrl->getFormAction($this));
316  $this->ctrl->setParameter($this, 'prt', 1);
317  $ilToolbar->addButton($this->lng->txt('print_view'),$this->ctrl->getLinkTarget($this,'showObjectSummary'), '_blank');
318  $this->ctrl->setParameter($this, 'prt', '');
319  }
320 
321  include_once("./Services/Tracking/classes/class.ilTrSummaryTableGUI.php");
322  $table = new ilTrSummaryTableGUI($this, "showObjectSummary", $this->getRefId(), $print_view);
323  if(!$print_view)
324  {
325  $tpl->setContent($table->getHTML());
326  }
327  else
328  {
329  $tpl->setVariable("ADM_CONTENT", $table->getHTML());
330  echo $tpl->get("DEFAULT", false, false, false, false, false, false);
331  exit();
332  }
333  }
334 
339  {
340  global $tpl;
341 
342  if($this->isAnonymized())
343  {
344  ilUtil::sendFailure($this->lng->txt('permission_denied'));
345  return;
346  }
347 
348 
349  $this->tpl->addBlockFile('ADM_CONTENT','adm_content','tpl.lp_loo.html','Services/Tracking');
350 
351  include_once("./Services/InfoScreen/classes/class.ilInfoScreenGUI.php");
352  $info = new ilInfoScreenGUI($this);
353  $info->setFormAction($this->ctrl->getFormAction($this));
354  if($this->__showObjectDetails($info, $this->details_obj_id))
355  {
356  $this->tpl->setCurrentBlock("info");
357  $this->tpl->setVariable("INFO_TABLE",$info->getHTML());
358  $this->tpl->parseCurrentBlock();
359  }
360 
361  include_once("./Services/Tracking/classes/class.ilTrMatrixTableGUI.php");
362  $table = new ilTrMatrixTableGUI($this, "showUserObjectMatrix", $this->getRefId());
363  $this->tpl->setVariable('LP_OBJECTS', $table->getHTML());
364  $this->tpl->setVariable('LEGEND', $this->__getLegendHTML());
365  }
366 }
367 ?>