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