ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
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/Search/classes/class.ilUserFilterGUI.php';
9 
23 {
24  public $details_id = 0;
25  public $details_type = '';
26  public $details_mode = 0;
27 
28  public function __construct($a_mode, $a_ref_id)
29  {
30  parent::__construct($a_mode, $a_ref_id);
31 
32  // Set item id for details
33  $this->__initDetails((int) $_REQUEST['details_id']);
34  }
38  public function executeCommand()
39  {
40  global $ilUser;
41 
42  $this->ctrl->setReturn($this, "");
43 
44  switch ($this->ctrl->getNextClass()) {
45  case 'iltruserobjectspropstablegui':
46  $user_id = (int) $_GET["user_id"];
47  $this->ctrl->setParameter($this, "user_id", $user_id);
48 
49  $this->ctrl->setParameter($this, "details_id", $this->details_id);
50 
51  include_once("./Services/Tracking/classes/repository_statistics/class.ilTrUserObjectsPropsTableGUI.php");
52  $table_gui = new ilTrUserObjectsPropsTableGUI(
53  $this,
54  "userDetails",
55  $user_id,
56  $this->details_obj_id,
57  $this->details_id
58  );
59  $this->ctrl->forwardCommand($table_gui);
60  break;
61 
62  case 'iltrsummarytablegui':
63  $cmd = "showObjectSummary";
64  if (!$this->details_id) {
65  $this->details_id = ROOT_FOLDER_ID;
66  $cmd = "show";
67  }
68  include_once './Services/Tracking/classes/repository_statistics/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/repository_statistics/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/repository_statistics/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  public function updateUser()
96  {
97  global $rbacsystem;
98 
99  if (isset($_GET["userdetails_id"])) {
100  $parent = $this->details_id;
101  $this->__initDetails((int) $_GET["userdetails_id"]);
102  }
103 
104  include_once './Services/Tracking/classes/class.ilLearningProgressAccess.php';
105  if (!ilLearningProgressAccess::checkPermission('edit_learning_progress', $this->details_id)) {
106  ilUtil::sendFailure($this->lng->txt("permission_denied"), true);
107  $this->ctrl->returnToParent($this);
108  }
109 
110  $this->__updateUser($_REQUEST['user_id'], $this->details_obj_id);
111  ilUtil::sendSuccess($this->lng->txt('trac_update_edit_user'), true);
112 
113  $this->ctrl->setParameter($this, "details_id", $this->details_id); // #15043
114 
115  // #14993
116  if (!isset($_GET["userdetails_id"])) {
117  $this->ctrl->redirect($this, "details");
118  } else {
119  $this->ctrl->setParameter($this, "userdetails_id", (int) $_GET["userdetails_id"]);
120  $this->ctrl->redirect($this, "userdetails");
121  }
122  }
123 
124  public function editUser()
125  {
126  global $ilObjDataCache, $rbacsystem;
127 
128  $parent_id = $this->details_id;
129  if (isset($_GET["userdetails_id"])) {
130  $this->__initDetails((int) $_GET["userdetails_id"]);
131  $sub_id = $this->details_id;
132  $cancel = "userdetails";
133  } else {
134  $sub_id = null;
135  $cancel = "details";
136  }
137 
138  include_once './Services/Tracking/classes/class.ilLearningProgressAccess.php';
139  if (!ilLearningProgressAccess::checkPermission('edit_learning_progress', $this->details_id)) {
140  ilUtil::sendFailure($this->lng->txt("permission_denied"), true);
141  $this->ctrl->returnToParent($this);
142  }
143 
144  include_once("./Services/InfoScreen/classes/class.ilInfoScreenGUI.php");
145  $info = new ilInfoScreenGUI($this);
146  $info->setFormAction($this->ctrl->getFormAction($this));
147  $this->__showObjectDetails($info, $this->details_obj_id);
148  $this->__appendUserInfo($info, (int) $_GET['user_id']);
149  // $this->__appendLPDetails($info,$this->details_obj_id,(int)$_GET['user_id']);
150 
151  $this->tpl->setVariable("ADM_CONTENT", $this->__showEditUser((int) $_GET['user_id'], $parent_id, $cancel, $sub_id) . "<br />" . $info->getHTML());
152  }
153 
154  public function details()
155  {
156  global $ilToolbar;
157 
158  $this->tpl->addBlockFile('ADM_CONTENT', 'adm_content', 'tpl.lp_loo.html', 'Services/Tracking');
159 
160  // Show back button
161  if ($this->getMode() == self::LP_CONTEXT_PERSONAL_DESKTOP or
162  $this->getMode() == self::LP_CONTEXT_ADMINISTRATION) {
163  $print_view = false;
164 
165  $ilToolbar->addButton(
166  $this->lng->txt('trac_view_list'),
167  $this->ctrl->getLinkTarget($this, 'show')
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  include_once("./Services/InfoScreen/classes/class.ilInfoScreenGUI.php");
183  $info = new ilInfoScreenGUI($this);
184  $info->setFormAction($this->ctrl->getFormAction($this));
185  if ($this->__showObjectDetails($info, $this->details_obj_id)) {
186  $this->tpl->setCurrentBlock("info");
187  $this->tpl->setVariable("INFO_TABLE", $info->getHTML());
188  $this->tpl->parseCurrentBlock();
189  }
190 
191  $this->__showUsersList($print_view);
192  }
193 
194  public function __showUsersList($a_print_view = false)
195  {
196  if ($this->isAnonymized()) {
197  ilUtil::sendFailure($this->lng->txt('permission_denied'));
198  return;
199  }
200 
201  $this->ctrl->setParameter($this, "details_id", $this->details_id);
202 
203  include_once "Services/Tracking/classes/repository_statistics/class.ilTrObjectUsersPropsTableGUI.php";
204  $gui = new ilTrObjectUsersPropsTableGUI($this, "details", $this->details_obj_id, $this->details_id, $a_print_view);
205 
206  $this->tpl->setVariable("LP_OBJECTS", $gui->getHTML());
207  $this->tpl->setVariable("LEGEND", $this->__getLegendHTML());
208 
209  /*
210  if($a_print_view)
211  {
212  echo $this->tpl->get("DEFAULT", false, false, false, false, false, false);
213  exit();
214  }
215  */
216  }
217 
218  public function userDetails()
219  {
220  global $ilObjDataCache, $ilToolbar;
221 
222  if ($this->isAnonymized()) {
223  ilUtil::sendFailure($this->lng->txt('permission_denied'));
224  return;
225  }
226 
227  $this->ctrl->setParameter($this, "details_id", $this->details_id);
228 
229  $print_view = (bool) $_GET['prt'];
230  if (!$print_view) {
231  // Show back button
232  $ilToolbar->addButton($this->lng->txt('trac_view_list'), $this->ctrl->getLinkTarget($this, 'details'));
233  }
234 
235  $user_id = (int) $_GET["user_id"];
236  $this->ctrl->setParameter($this, "user_id", $user_id);
237 
238  /*
239  if(!$print_view)
240  {
241  $this->ctrl->setParameter($this, 'prt', 1);
242  $ilToolbar->addButton($this->lng->txt('print_view'),$this->ctrl->getLinkTarget($this,'userDetails'), '_blank');
243  $this->ctrl->setParameter($this, 'prt', '');
244  };
245  */
246 
247  $this->tpl->addBlockFile('ADM_CONTENT', 'adm_content', 'tpl.lp_loo.html', 'Services/Tracking');
248 
249  include_once("./Services/InfoScreen/classes/class.ilInfoScreenGUI.php");
250  $info = new ilInfoScreenGUI($this);
251  $info->setFormAction($this->ctrl->getFormAction($this));
252  $this->__showObjectDetails($info, $this->details_obj_id);
253  $this->__appendUserInfo($info, $user_id);
254  // $this->__appendLPDetails($info,$this->details_obj_id,$user_id);
255  $this->tpl->setVariable("INFO_TABLE", $info->getHTML());
256 
257  include_once("./Services/Tracking/classes/repository_statistics/class.ilTrUserObjectsPropsTableGUI.php");
259  $this,
260  "userDetails",
261  $user_id,
262  $this->details_obj_id,
263  $this->details_id,
264  $print_view
265  );
266  $this->tpl->setVariable('LP_OBJECTS', $table->getHTML());
267  $this->tpl->setVariable('LEGEND', $this->__getLegendHTML());
268 
269  /*
270  if($print_view)
271  {
272  echo $this->tpl->get("DEFAULT", false, false, false, false, false, false);
273  exit();
274  }
275  */
276  }
277 
278  public function show()
279  {
280  // Clear table offset
281  $this->ctrl->saveParameter($this, 'offset', 0);
282 
283  // Show only detail of current repository item if called from repository
284  switch ($this->getMode()) {
285  case self::LP_CONTEXT_REPOSITORY:
286  $this->__initDetails($this->getRefId());
287  $this->details();
288  return true;
289  }
290 
291  $this->__listObjects();
292  }
293 
294  public function __listObjects()
295  {
296  global $ilUser,$ilObjDataCache;
297 
298  $this->tpl->addBlockFile('ADM_CONTENT', 'adm_content', 'tpl.lp_list_objects.html', 'Services/Tracking');
299 
300  include_once("./Services/Tracking/classes/repository_statistics/class.ilTrSummaryTableGUI.php");
301  $lp_table = new ilTrSummaryTableGUI($this, "", ROOT_FOLDER_ID);
302 
303  $this->tpl->setVariable("LP_OBJECTS", $lp_table->getHTML());
304  $this->tpl->setVariable('LEGEND', $this->__getLegendHTML());
305  }
306 
307  public function __initDetails($a_details_id)
308  {
309  global $ilObjDataCache;
310 
311  if (!$a_details_id) {
312  $a_details_id = $this->getRefId();
313  }
314  if ($a_details_id) {
315  $_GET['details_id'] = $a_details_id;
316  $this->details_id = $a_details_id;
317  $this->details_obj_id = $ilObjDataCache->lookupObjId($this->details_id);
318  $this->details_type = $ilObjDataCache->lookupType($this->details_obj_id);
319 
320  include_once 'Services/Object/classes/class.ilObjectLP.php';
321  $olp = ilObjectLP::getInstance($this->details_obj_id);
322  $this->details_mode = $olp->getCurrentMode();
323  }
324  }
325 
329  public function showObjectSummary()
330  {
331  global $tpl, $ilToolbar;
332 
333  /*
334  $print_view = (bool)$_GET['prt'];
335  if(!$print_view)
336  {
337  $ilToolbar->setFormAction($this->ctrl->getFormAction($this));
338  $this->ctrl->setParameter($this, 'prt', 1);
339  $ilToolbar->addButton($this->lng->txt('print_view'),$this->ctrl->getLinkTarget($this,'showObjectSummary'), '_blank');
340  $this->ctrl->setParameter($this, 'prt', '');
341  }
342  */
343 
344  include_once("./Services/Tracking/classes/repository_statistics/class.ilTrSummaryTableGUI.php");
345  $table = new ilTrSummaryTableGUI($this, "showObjectSummary", $this->getRefId(), $print_view);
346  if (!$print_view) {
347  $tpl->setContent($table->getHTML());
348  } else {
349  $tpl->setVariable("ADM_CONTENT", $table->getHTML());
350  echo $tpl->get("DEFAULT", false, false, false, false, false, false);
351  exit();
352  }
353  }
354 
358  public function showUserObjectMatrix()
359  {
360  global $tpl;
361 
362  if ($this->isAnonymized()) {
363  ilUtil::sendFailure($this->lng->txt('permission_denied'));
364  return;
365  }
366 
367 
368  $this->tpl->addBlockFile('ADM_CONTENT', 'adm_content', 'tpl.lp_loo.html', 'Services/Tracking');
369 
370  include_once("./Services/InfoScreen/classes/class.ilInfoScreenGUI.php");
371  $info = new ilInfoScreenGUI($this);
372  $info->setFormAction($this->ctrl->getFormAction($this));
373  if ($this->__showObjectDetails($info, $this->details_obj_id)) {
374  $this->tpl->setCurrentBlock("info");
375  $this->tpl->setVariable("INFO_TABLE", $info->getHTML());
376  $this->tpl->parseCurrentBlock();
377  }
378 
379  include_once("./Services/Tracking/classes/repository_statistics/class.ilTrMatrixTableGUI.php");
380  $table = new ilTrMatrixTableGUI($this, "showUserObjectMatrix", $this->getRefId());
381  $this->tpl->setVariable('LP_OBJECTS', $table->getHTML());
382  $this->tpl->setVariable('LEGEND', $this->__getLegendHTML());
383  }
384 }
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
__showEditUser($a_user_id, $a_ref_id, $a_cancel, $a_sub_id=false)
Class ilInfoScreenGUI.
$_GET["client_id"]
showUserObjectMatrix()
Show object user matrix.
static checkPermission($a_permission, $a_ref_id, $a_user_id=null)
wrapper for rbac access checks
__showObjectDetails(&$info, $item_id=0, $add_section=true)
show details about current object.
showObjectSummary()
Show object-based summarized tracking data.
Learning progress table: One object, rows: users, columns: properties Example: A course, rows: members, columns: name, status, mark, ...
$ilUser
Definition: imgupload.php:18
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
Build table list for objects of given user.
__showUsersList($a_print_view=false)
if(empty($password)) $table
Definition: pwgen.php:24
$info
Definition: index.php:5
static getInstance($a_obj_id)