ILIAS  release_8 Revision v8.19
All Data Structures Namespaces Files Functions Variables Modules Pages
ilLearningProgressGUI Class Reference

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V. More...

+ Inheritance diagram for ilLearningProgressGUI:
+ Collaboration diagram for ilLearningProgressGUI:

Public Member Functions

 executeCommand ()
 execute command More...
 
 __setCmdClass (string $a_class)
 
 __getNextClass ()
 
- Public Member Functions inherited from ilLearningProgressBaseGUI
 __construct (int $a_mode, int $a_ref_id=0, int $a_usr_id=0)
 
 isAnonymized ()
 
 getMode ()
 
 getRefId ()
 
 getObjId ()
 
 getUserId ()
 
 __getDefaultCommand ()
 
 __setSubTabs (int $a_active)
 
 __buildFooter ()
 
 __buildHeader ()
 
 __showObjectDetails (ilInfoScreenGUI $info, int $item_id=0, bool $add_section=true)
 show details about current object. More...
 
 __appendLPDetails (ilInfoScreenGUI $info, int $item_id, int $user_id)
 
 __getLegendHTML (int $variant=ilLPStatusIcons::ICON_VARIANT_LONG)
 
 __showEditUser (int $a_user_id, int $a_ref_id, ?string $a_cancel=null, int $a_sub_id=0)
 
 __updateUser (int $user_id, int $obj_id)
 

Protected Member Functions

 editManual ()
 Show progress screen for "edit manual". More...
 
 initCollectionManualForm ()
 
 updateManual ()
 
 showtlt ()
 
- Protected Member Functions inherited from ilLearningProgressBaseGUI
 initUserIdFromQuery ()
 
 initEditUserForm (int $a_user_id, int $a_obj_id, ?string $a_cancel=null)
 

Additional Inherited Members

- Static Public Member Functions inherited from ilLearningProgressBaseGUI
static _getStatusText (int $a_status, ?ilLanguage $a_lng=null)
 Get status alt text. More...
 
static __readStatus (int $a_obj_id, int $user_id)
 PhpInconsistentReturnPointsInspection More...
 
static isObjectOffline (int $a_obj_id, string $a_type='')
 
- Data Fields inherited from ilLearningProgressBaseGUI
const LP_CONTEXT_PERSONAL_DESKTOP = 1
 
const LP_CONTEXT_ADMINISTRATION = 2
 
const LP_CONTEXT_REPOSITORY = 3
 
const LP_CONTEXT_USER_FOLDER = 4
 
const LP_CONTEXT_ORG_UNIT = 5
 
- Protected Attributes inherited from ilLearningProgressBaseGUI
RefineryFactory $refinery
 
HttpServices $http
 
ilGlobalTemplateInterface $tpl
 
ilHelpGUI $help
 
ilCtrlInterface $ctrl
 
ilLanguage $lng
 
ilLogger $logger
 
ilTabsGUI $tabs_gui
 
ilToolbarGUI $toolbar
 
ilObjectDataCache $ilObjectDataCache
 
ilObjUser $user
 
ilAccessHandler $access
 
ilRbacSystem $rbacsystem
 
ilRbacReview $rbacreview
 
ilTree $tree
 
bool $anonymized
 
int $usr_id = 0
 
int $ref_id = 0
 
int $obj_id = 0
 
string $obj_type = ''
 
int $mode = 0
 
const LP_ACTIVE_SETTINGS = 1
 
const LP_ACTIVE_OBJECTS = 2
 
const LP_ACTIVE_PROGRESS = 3
 
const LP_ACTIVE_USERS = 5
 
const LP_ACTIVE_SUMMARY = 6
 
const LP_ACTIVE_OBJSTATACCESS = 7
 
const LP_ACTIVE_OBJSTATTYPES = 8
 
const LP_ACTIVE_OBJSTATDAILY = 9
 
const LP_ACTIVE_OBJSTATADMIN = 10
 
const LP_ACTIVE_MATRIX = 11
 

Detailed Description

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V.

ILIAS is licensed with the GPL-3.0, see https://www.gnu.org/licenses/gpl-3.0.en.html You should have received a copy of said license along with the source code, too.

If this is not the case or you just want to try ILIAS, you'll find us at: https://www.ilias.de https://github.com/ILIAS-eLearning Class ilObjUserTrackingGUI

Author
Stefan Meyer meyer.nosp@m.@lei.nosp@m.fos.c.nosp@m.om ilLearningProgressGUI: ilLPListOfObjectsGUI, ilLPListOfSettingsGUI, ilLPListOfProgressGUI ilLearningProgressGUI: ilLPObjectStatisticsGUI

Definition at line 27 of file class.ilLearningProgressGUI.php.

Member Function Documentation

◆ __getNextClass()

ilLearningProgressGUI::__getNextClass ( )

Definition at line 138 of file class.ilLearningProgressGUI.php.

References ilObjUserTracking\_enabledLearningProgress(), ilObjUserTracking\_enabledUserRelatedData(), ilObjUserTracking\_hasLearningProgressLearner(), ilObjUserTracking\_hasLearningProgressOtherUsers(), ilObject\_lookupObjId(), ilLearningProgressAccess\checkPermission(), ilSession\clear(), ILIAS\Repository\ctrl(), ilSession\get(), ilObjectLP\getInstance(), ilLearningProgressBaseGUI\getMode(), ilLearningProgressBaseGUI\getRefId(), ilUtil\redirect(), and ilSession\set().

Referenced by executeCommand().

138  : string
139  {
140  // #9857
142  return '';
143  }
144 
145  if (strlen($next_class = $this->ctrl->getNextClass())) {
146  if ($this->getMode() == self::LP_CONTEXT_PERSONAL_DESKTOP) {
147  ilSession::set('il_lp_history', $next_class);
148  }
149  return $next_class;
150  }
151  switch ($this->getMode()) {
152  case self::LP_CONTEXT_ADMINISTRATION:
153  return 'illplistofobjectsgui';
154 
155  case self::LP_CONTEXT_REPOSITORY:
156  $cmd = $this->ctrl->getCmd();
157  if (in_array(
158  $cmd,
159  array("editManual", "updatemanual", "showtlt")
160  )) {
161  return "";
162  }
163 
164  // #12771
167  );
168  if (!$olp->isActive()) {
169  if (!($olp instanceof ilPluginLP) &&
171  'edit_learning_progress',
172  $this->getRefId()
173  )) {
174  return 'illplistofsettingsgui';
175  } else {
176  return '';
177  }
178  }
179 
180  if (!$this->anonymized &&
182  'read_learning_progress',
183  $this->getRefId()
184  )) {
185  return 'illplistofobjectsgui';
186  }
187  if (
189  'edit_learning_progress',
190  $this->getRefId()
191  )) {
192  return 'illplistofsettingsgui';
193  }
194  return 'illplistofprogressgui';
195 
196  case self::LP_CONTEXT_PERSONAL_DESKTOP:
197 
200  );
201 
202  if ($has_edit || $has_personal) {
203  // default (#10928)
204  $tgt = null;
205  if ($has_personal) {
206  $tgt = 'illplistofprogressgui';
207  } elseif ($has_edit) {
208  $tgt = 'illplistofobjectsgui';
209  }
210 
211  // validate session
212  switch (ilSession::get('il_lp_history')) {
213  case 'illplistofobjectsgui':
214  if (!$has_edit) {
215  ilSession::clear('il_lp_history');
216  }
217  break;
218 
219  case 'illplistofprogressgui':
220  if (!$has_personal) {
221  ilSession::clear('il_lp_history');
222  }
223  break;
224  }
225 
226  if (ilSession::get('il_lp_history')) {
227  return ilSession::get('il_lp_history');
228  } elseif ($tgt) {
229  return $tgt;
230  }
231  }
232 
233  // should not happen
234  ilUtil::redirect("ilias.php?baseClass=ilDashboardGUI");
235 
236  // no break
237  case self::LP_CONTEXT_USER_FOLDER:
238  case self::LP_CONTEXT_ORG_UNIT:
240  return 'illplistofprogressgui';
241  }
242  break;
243  }
244  return '';
245  }
static get(string $a_var)
static _lookupObjId(int $ref_id)
static redirect(string $a_script)
static checkPermission(string $a_permission, int $a_ref_id, ?int $a_user_id=null)
wrapper for rbac access checks
static getInstance(int $obj_id)
static clear(string $a_var)
static set(string $a_var, $a_val)
Set a value.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ __setCmdClass()

ilLearningProgressGUI::__setCmdClass ( string  $a_class)

Definition at line 130 of file class.ilLearningProgressGUI.php.

References ILIAS\Repository\ctrl().

Referenced by executeCommand().

130  : void
131  {
132  if (strcasecmp(ilLearningProgressGUI::class, $this->ctrl->getCmdClass()) === 0) {
133  $this->ctrl->setCmdClass($a_class);
134  }
135  //$this->ctrl->setCmdClass($a_class);
136  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ editManual()

ilLearningProgressGUI::editManual ( )
protected

Show progress screen for "edit manual".

Definition at line 250 of file class.ilLearningProgressGUI.php.

References ilObject\_lookupObjId(), ilLearningProgressAccess\checkAccess(), ilObjectLP\getInstance(), ilLearningProgressBaseGUI\getRefId(), initCollectionManualForm(), and ilLPObjSettings\LP_MODE_COLLECTION_MANUAL.

250  : void
251  {
255  );
256  if ($olp->getCurrentMode(
258  $form = $this->initCollectionManualForm();
259  $this->tpl->setContent($form->getHTML());
260  }
261  }
262  }
static checkAccess(int $a_ref_id, bool $a_allow_only_read=true)
check access to learning progress
static _lookupObjId(int $ref_id)
static getInstance(int $obj_id)
+ Here is the call graph for this function:

◆ executeCommand()

ilLearningProgressGUI::executeCommand ( )

execute command

Definition at line 32 of file class.ilLearningProgressGUI.php.

References ilLearningProgressBaseGUI\__buildFooter(), ilLearningProgressBaseGUI\__buildHeader(), __getNextClass(), __setCmdClass(), ilLearningProgressBaseGUI\__setSubTabs(), ilObject\_lookupType(), ilLearningProgressAccess\checkPermission(), ILIAS\Repository\ctrl(), ilLearningProgressBaseGUI\getMode(), ilLearningProgressBaseGUI\getRefId(), ilLearningProgressBaseGUI\getUserId(), and ILIAS\Repository\help().

33  {
34  $this->ctrl->setReturn($this, "");
35 
36  // E.g personal desktop mode needs locator header icon ...
37  $this->__buildHeader();
38  switch ($this->__getNextClass()) {
39  case 'illplistofprogressgui':
40 
41  $this->help->setScreenIdComponent(
42  "lp_" . ilObject::_lookupType($this->getRefId(), true)
43  );
44 
45  $this->__setSubTabs(self::LP_ACTIVE_PROGRESS);
46  $this->__setCmdClass(ilLPListOfProgressGUI::class);
47  $lop_gui = new ilLPListOfProgressGUI(
48  $this->getMode(),
49  $this->getRefId(),
50  $this->getUserId()
51  );
52  $this->ctrl->forwardCommand($lop_gui);
53  break;
54 
55  case 'illplistofobjectsgui':
56  if ($this->getRefId() &&
58  'read_learning_progress',
59  $this->getRefId()
60  )) {
61  return;
62  }
63 
64  if (stristr($this->ctrl->getCmd(), "matrix")) {
65  $this->__setSubTabs(self::LP_ACTIVE_MATRIX);
66  } elseif (stristr($this->ctrl->getCmd(), "summary")) {
67  $this->__setSubTabs(self::LP_ACTIVE_SUMMARY);
68  } else {
69  $this->__setSubTabs(self::LP_ACTIVE_OBJECTS);
70  }
71  $loo_gui = new ilLPListOfObjectsGUI(
72  $this->getMode(),
73  $this->getRefId()
74  );
75  $this->__setCmdClass(ilLPListOfObjectsGUI::class);
76  $this->ctrl->forwardCommand($loo_gui);
77  break;
78 
79  case 'illplistofsettingsgui':
80  if ($this->getRefId() &&
82  'edit_learning_progress',
83  $this->getRefId()
84  )) {
85  return;
86  }
87 
88  $this->__setSubTabs(self::LP_ACTIVE_SETTINGS);
89  $los_gui = new ilLPListOfSettingsGUI(
90  $this->getMode(),
91  $this->getRefId()
92  );
93  $this->__setCmdClass(ilLPListOfSettingsGUI::class);
94  $this->ctrl->forwardCommand($los_gui);
95  break;
96 
97  case 'illpobjectstatisticsgui':
98  if (stristr($this->ctrl->getCmd(), "access")) {
99  $this->__setSubTabs(self::LP_ACTIVE_OBJSTATACCESS);
100  } elseif (stristr($this->ctrl->getCmd(), "types")) {
101  $this->__setSubTabs(self::LP_ACTIVE_OBJSTATTYPES);
102  } elseif (stristr($this->ctrl->getCmd(), "daily")) {
103  $this->__setSubTabs(self::LP_ACTIVE_OBJSTATDAILY);
104  } else {
105  $this->__setSubTabs(self::LP_ACTIVE_OBJSTATADMIN);
106  }
107  $this->__setCmdClass(ilLPObjectStatisticsGUI::class);
108  $this->tabs_gui->activateTab('statistics');
109  $ost_gui = new ilLPObjectStatisticsGUI(
110  $this->getMode(),
111  $this->getRefId()
112  );
113  $this->ctrl->forwardCommand($ost_gui);
114  break;
115 
116  default:
117  $cmd = $this->ctrl->getCmd();
118  if (!$cmd) {
119  return;
120  }
121  $this->$cmd();
122  $this->tpl->printToStdout();
123  break;
124  }
125 
126  // E.G personal desktop mode needs $tpl->show();
127  $this->__buildFooter();
128  }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static checkPermission(string $a_permission, int $a_ref_id, ?int $a_user_id=null)
wrapper for rbac access checks
static _lookupType(int $id, bool $reference=false)
+ Here is the call graph for this function:

◆ initCollectionManualForm()

ilLearningProgressGUI::initCollectionManualForm ( )
protected

Definition at line 264 of file class.ilLearningProgressGUI.php.

References ilLPStatusFactory\_getClassById(), ilObject\_lookupType(), ILIAS\Repository\ctrl(), ilDatePresentation\formatDate(), ilLPStatusIcons\getInstance(), ilObjectLP\getInstance(), ilLearningProgressBaseGUI\getObjId(), ilLearningProgressBaseGUI\getRefId(), ilLPStatusIcons\ICON_VARIANT_LONG, IL_CAL_UNIX, ILIAS\Repository\lng(), ilLPObjSettings\LP_MODE_COLLECTION_MANUAL, ilLPStatus\LP_STATUS_COMPLETED_NUM, and ilLPStatus\LP_STATUS_NOT_ATTEMPTED_NUM.

Referenced by editManual(), and updateManual().

265  {
266  $form = new ilPropertyFormGUI();
267  $form->setFormAction($this->ctrl->getFormAction($this, "updatemanual"));
268  $form->setTitle($this->lng->txt("learning_progress"));
269  $form->setDescription(
270  $this->lng->txt("trac_collection_manual_learner_info")
271  );
272 
273  $coll_items = array();
274 
275  $olp = ilObjectLP::getInstance($this->getObjId());
276  $collection = $olp->getCollectionInstance();
277  $subitem_info = '';
278  $subitem_title = '';
279  $possible_items = [];
280  if ($collection) {
281  $coll_items = $collection->getItems();
282  $possible_items = $collection->getPossibleItems(
283  $this->getRefId()
284  ); // for titles
285 
286  switch (ilObject::_lookupType($this->getObjId())) {
287  case "lm":
288  $subitem_title = $this->lng->txt("objs_st");
289  $subitem_info = $this->lng->txt(
290  "trac_collection_manual_learner_lm_info"
291  );
292  break;
293  }
294  }
295 
297  $this->getObjId(),
299  );
300  $lp_data = $class::_getObjectStatus($this->getObjId(), $this->usr_id);
301 
303 
304  $grp = new ilCheckboxGroupInputGUI($subitem_title, "sids");
305  $grp->setInfo($subitem_info);
306  $form->addItem($grp);
307 
308  // #14994 - using possible items for proper sorting
309 
310  $completed = array();
311  foreach (array_keys($possible_items) as $item_id) {
312  if (!in_array($item_id, $coll_items)) {
313  continue;
314  }
315 
316  $info = null;
318 
319  if (isset($lp_data[$item_id])) {
320  $changed = new ilDateTime($lp_data[$item_id][1], IL_CAL_UNIX);
321  $info = $this->lng->txt(
322  "trac_collection_manual_learner_changed_ts"
323  ) . ": " .
325 
326  if ($lp_data[$item_id][0]) {
328  $completed[] = $item_id;
329  }
330  }
331 
332  $icon = $icons->renderIconForStatus($status);
333 
334  $opt = new ilCheckboxOption(
335  $icon . " " . $possible_items[$item_id]["title"],
336  $item_id
337  );
338  if ($info) {
339  $opt->setInfo($info);
340  }
341  $grp->addOption($opt);
342  }
343 
344  if ($completed) {
345  $grp->setValue($completed);
346  }
347 
348  $form->addCommandButton("updatemanual", $this->lng->txt("save"));
349 
350  return $form;
351  }
const LP_STATUS_COMPLETED_NUM
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static formatDate(ilDateTime $date, bool $a_skip_day=false, bool $a_include_wd=false, bool $include_seconds=false)
static getInstance(int $variant=ilLPStatusIcons::ICON_VARIANT_DEFAULT, ?\ILIAS\UI\Renderer $renderer=null, ?\ILIAS\UI\Factory $factory=null)
const IL_CAL_UNIX
static _getClassById(int $a_obj_id, ?int $a_mode=null)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
const LP_STATUS_NOT_ATTEMPTED_NUM
static _lookupType(int $id, bool $reference=false)
static getInstance(int $obj_id)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ showtlt()

ilLearningProgressGUI::showtlt ( )
protected

Definition at line 387 of file class.ilLearningProgressGUI.php.

References ilLPStatusFactory\_getClassById(), ILIAS\Repository\ctrl(), ilLPStatusIcons\getInstance(), ilObjectLP\getInstance(), ilLearningProgressBaseGUI\getObjId(), ilLearningProgressBaseGUI\getRefId(), ilLPStatusIcons\ICON_VARIANT_LONG, ILIAS\Repository\lng(), ilLPObjSettings\LP_MODE_COLLECTION_TLT, ilLPStatus\LP_STATUS_COMPLETED_NUM, ilLPStatus\LP_STATUS_IN_PROGRESS_NUM, ilLPStatus\LP_STATUS_NOT_ATTEMPTED_NUM, ilDatePresentation\secondsToString(), and ILIAS\Repository\user().

388  {
389  $form = new ilPropertyFormGUI();
390  $form->setFormAction($this->ctrl->getFormAction($this, "showtlt"));
391  $form->setTitle($this->lng->txt("learning_progress"));
392  $form->setDescription(
393  $this->lng->txt("trac_collection_tlt_learner_info")
394  );
395 
396  $coll_items = array();
397 
398  $olp = ilObjectLP::getInstance($this->getObjId());
399  $collection = $olp->getCollectionInstance();
400  $possible_items = [];
401  if ($collection) {
402  $coll_items = $collection->getItems();
403  $possible_items = $collection->getPossibleItems(
404  $this->getRefId()
405  ); // for titles
406  }
407 
409  $this->getObjId(),
411  );
412  $info = $class::_getStatusInfo($this->getObjId(), true);
413 
415 
416  foreach ($coll_items as $item_id) {
417  // #16599 - deleted items should not be displayed
418  if (!array_key_exists($item_id, $possible_items)) {
419  continue;
420  }
421 
422  $field = new ilCustomInputGUI($possible_items[$item_id]["title"]);
423 
424  // lp status
426  if (isset($info["completed"][$item_id]) &&
427  in_array($this->user->getId(), $info["completed"][$item_id])) {
429  } elseif (isset($info["in_progress"][$item_id]) &&
430  in_array(
431  $this->user->getId(),
432  $info["in_progress"][$item_id]
433  )) {
435  }
436  $field->setHtml($icons->renderIconForStatus($status));
437 
438  // stats
439  $spent = 0;
440  if (isset($info["tlt_users"][$item_id][$this->user->getId()])) {
441  $spent = $info["tlt_users"][$item_id][$this->user->getId()];
442  }
443  $needed = $info["tlt"][$item_id];
444  if ($needed) {
445  $field->setInfo(
446  sprintf(
447  $this->lng->txt("trac_collection_tlt_learner_subitem"),
450  min(100, round(abs($spent) / $needed * 100))
451  )
452  );
453  }
454 
455  $form->addItem($field);
456  }
457 
458  $this->tpl->setContent($form->getHTML());
459  }
const LP_STATUS_COMPLETED_NUM
const LP_STATUS_IN_PROGRESS_NUM
static getInstance(int $variant=ilLPStatusIcons::ICON_VARIANT_DEFAULT, ?\ILIAS\UI\Renderer $renderer=null, ?\ILIAS\UI\Factory $factory=null)
static secondsToString(int $seconds, bool $force_with_seconds=false, ?ilLanguage $a_lng=null)
converts seconds to string: Long: 7 days 4 hour(s) ...
static _getClassById(int $a_obj_id, ?int $a_mode=null)
const LP_STATUS_NOT_ATTEMPTED_NUM
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static getInstance(int $obj_id)
+ Here is the call graph for this function:

◆ updateManual()

ilLearningProgressGUI::updateManual ( )
protected

Definition at line 353 of file class.ilLearningProgressGUI.php.

References ilLPStatusFactory\_getClassById(), ilObject\_lookupObjId(), ilLearningProgressAccess\checkAccess(), ILIAS\Repository\ctrl(), ilObjectLP\getInstance(), ilLearningProgressBaseGUI\getObjId(), ilLearningProgressBaseGUI\getRefId(), initCollectionManualForm(), ILIAS\Repository\lng(), and ilLPObjSettings\LP_MODE_COLLECTION_MANUAL.

353  : void
354  {
358  );
359  if ($olp->getCurrentMode(
361  $form = $this->initCollectionManualForm();
362  if ($form->checkInput()) {
364  $this->getObjId(),
366  );
367  $class::_setObjectStatus(
368  $this->getObjId(),
369  $this->usr_id,
370  $form->getInput("sids")
371  );
372 
373  $this->tpl->setOnScreenMessage(
374  'success',
375  $this->lng->txt(
376  "settings_saved"
377  ),
378  true
379  );
380  }
381 
382  $this->ctrl->redirect($this, "editManual");
383  }
384  }
385  }
static checkAccess(int $a_ref_id, bool $a_allow_only_read=true)
check access to learning progress
static _lookupObjId(int $ref_id)
static _getClassById(int $a_obj_id, ?int $a_mode=null)
static getInstance(int $obj_id)
+ Here is the call graph for this function:

The documentation for this class was generated from the following file: