ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
ilLearningProgressGUI Class Reference

Class ilObjUserTrackingGUI. 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, string $item_type='', 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 ()
 
 readTypicalLearningTimeInSeconds (int $obj_id, int $sub_id, string $type)
 
 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)
 @noinspection 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
 
UIFactory $ui_factory
 
UIRenderer $ui_renderer
 
LOMServices $lom_services
 
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

Member Function Documentation

◆ __getNextClass()

ilLearningProgressGUI::__getNextClass ( )

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

143 : string
144 {
145 // #9857
147 return '';
148 }
149
150 if (strlen($next_class = $this->ctrl->getNextClass())) {
151 if ($this->getMode() == self::LP_CONTEXT_PERSONAL_DESKTOP) {
152 ilSession::set('il_lp_history', $next_class);
153 }
154 return $next_class;
155 }
156 switch ($this->getMode()) {
158 $cmd = $this->ctrl->getCmd();
159 if (in_array(
160 $cmd,
161 array("editManual", "updatemanual", "showtlt")
162 )) {
163 return "";
164 }
165
166 // #12771
169 );
170 if (!$olp->isActive()) {
171 if (!($olp instanceof ilPluginLP) &&
173 'edit_learning_progress',
174 $this->getRefId()
175 )) {
176 return 'illplistofsettingsgui';
177 } else {
178 return '';
179 }
180 }
181
182 if (!$this->anonymized &&
184 'read_learning_progress',
185 $this->getRefId()
186 )) {
187 return 'illplistofobjectsgui';
188 }
189 if (
191 'edit_learning_progress',
192 $this->getRefId()
193 )) {
194 return 'illplistofsettingsgui';
195 }
196 return 'illplistofprogressgui';
197
199
202 );
203
204 if ($has_edit || $has_personal) {
205 // default (#10928)
206 $tgt = null;
207 if ($has_personal) {
208 $tgt = 'illplistofprogressgui';
209 } elseif ($has_edit) {
210 $tgt = 'illplistofobjectsgui';
211 }
212
213 // validate session
214 switch (ilSession::get('il_lp_history')) {
215 case 'illplistofobjectsgui':
216 if (!$has_edit) {
217 ilSession::clear('il_lp_history');
218 }
219 break;
220
221 case 'illplistofprogressgui':
222 if (!$has_personal) {
223 ilSession::clear('il_lp_history');
224 }
225 break;
226 }
227
228 if (ilSession::get('il_lp_history')) {
229 return ilSession::get('il_lp_history');
230 } elseif ($tgt) {
231 return $tgt;
232 }
233 }
234
235 // should not happen
236 ilUtil::redirect("ilias.php?baseClass=ilDashboardGUI");
237
238 // no break
242 return 'illplistofprogressgui';
243 }
244 break;
245 }
246 return '';
247 }
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 _lookupObjId(int $ref_id)
static get(string $a_var)
static clear(string $a_var)
static set(string $a_var, $a_val)
Set a value.
static redirect(string $a_script)

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(), ilLearningProgressBaseGUI\LP_CONTEXT_ORG_UNIT, ilLearningProgressBaseGUI\LP_CONTEXT_PERSONAL_DESKTOP, ilLearningProgressBaseGUI\LP_CONTEXT_REPOSITORY, ilLearningProgressBaseGUI\LP_CONTEXT_USER_FOLDER, ilUtil\redirect(), and ilSession\set().

Referenced by executeCommand().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ __setCmdClass()

ilLearningProgressGUI::__setCmdClass ( string  $a_class)

TODO: maybe this can be replaced by nextClass === ''?

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

130 : void
131 {
135 if (
136 strtolower($this->ctrl->getCmdClass()) !== strtolower($a_class) &&
137 strtolower($this->ctrl->getNextClass()) !== strtolower($a_class)
138 ) {
139 $this->ctrl->redirectByClass($a_class);
140 }
141 }

References ILIAS\Repository\ctrl().

Referenced by executeCommand().

+ 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 252 of file class.ilLearningProgressGUI.php.

252 : void
253 {
257 );
258 if ($olp->getCurrentMode(
260 $form = $this->initCollectionManualForm();
261 $this->tpl->setContent($form->getHTML());
262 }
263 }
264 }
static checkAccess(int $a_ref_id, bool $a_allow_only_read=true)
check access to learning progress

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

+ Here is the call graph for this function:

◆ executeCommand()

ilLearningProgressGUI::executeCommand ( )

execute command

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

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 }
Class ilLPListOfSettingsGUI.
static _lookupType(int $id, bool $reference=false)

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().

+ Here is the call graph for this function:

◆ initCollectionManualForm()

ilLearningProgressGUI::initCollectionManualForm ( )
protected

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

267 {
268 $form = new ilPropertyFormGUI();
269 $form->setFormAction($this->ctrl->getFormAction($this, "updatemanual"));
270 $form->setTitle($this->lng->txt("learning_progress"));
271 $form->setDescription(
272 $this->lng->txt("trac_collection_manual_learner_info")
273 );
274
275 $coll_items = array();
276
277 $olp = ilObjectLP::getInstance($this->getObjId());
278 $collection = $olp->getCollectionInstance();
279 $subitem_info = '';
280 $subitem_title = '';
281 $possible_items = [];
282 if ($collection) {
283 $coll_items = $collection->getItems();
284 $possible_items = $collection->getPossibleItems(
285 $this->getRefId()
286 ); // for titles
287
288 switch (ilObject::_lookupType($this->getObjId())) {
289 case "lm":
290 $subitem_title = $this->lng->txt("objs_st");
291 $subitem_info = $this->lng->txt(
292 "trac_collection_manual_learner_lm_info"
293 );
294 break;
295 }
296 }
297
299 $this->getObjId(),
301 );
302 $lp_data = $class::_getObjectStatus($this->getObjId(), $this->usr_id);
303
305
306 $grp = new ilCheckboxGroupInputGUI($subitem_title, "sids");
307 $grp->setInfo($subitem_info);
308 $form->addItem($grp);
309
310 // #14994 - using possible items for proper sorting
311
312 $completed = array();
313 foreach (array_keys($possible_items) as $item_id) {
314 if (!in_array($item_id, $coll_items)) {
315 continue;
316 }
317
318 $info = null;
320
321 if (isset($lp_data[$item_id])) {
322 $changed = new ilDateTime($lp_data[$item_id][1], IL_CAL_UNIX);
323 $info = $this->lng->txt(
324 "trac_collection_manual_learner_changed_ts"
325 ) . ": " .
327
328 if ($lp_data[$item_id][0]) {
330 $completed[] = $item_id;
331 }
332 }
333
334 $icon = $icons->renderIconForStatus($status);
335
336 $opt = new ilCheckboxOption(
337 $icon . " " . $possible_items[$item_id]["title"],
338 $item_id
339 );
340 if ($info) {
341 $opt->setInfo($info);
342 }
343 $grp->addOption($opt);
344 }
345
346 if ($completed) {
347 $grp->setValue($completed);
348 }
349
350 $form->addCommandButton("updatemanual", $this->lng->txt("save"));
351
352 return $form;
353 }
const IL_CAL_UNIX
This class represents a property in a property form.
This class represents an option in a checkbox group.
static formatDate(ilDateTime $date, bool $a_skip_day=false, bool $a_include_wd=false, bool $include_seconds=false, ?ilObjUser $user=null,)
@classDescription Date and time handling
static _getClassById(int $a_obj_id, ?int $a_mode=null)
static getInstance(int $variant=ilLPStatusIcons::ICON_VARIANT_DEFAULT, ?\ILIAS\UI\Renderer $renderer=null, ?\ILIAS\UI\Factory $factory=null)
const LP_STATUS_COMPLETED_NUM
const LP_STATUS_NOT_ATTEMPTED_NUM
This class represents a property form user interface.
$info
Definition: entry_point.php:21

References $info, ilLPStatusFactory\_getClassById(), ilObject\_lookupType(), ILIAS\Repository\ctrl(), ilDatePresentation\formatDate(), ilObjectLP\getInstance(), ilLPStatusIcons\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().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ showtlt()

ilLearningProgressGUI::showtlt ( )
protected

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

390 {
391 $form = new ilPropertyFormGUI();
392 $form->setFormAction($this->ctrl->getFormAction($this, "showtlt"));
393 $form->setTitle($this->lng->txt("learning_progress"));
394 $form->setDescription(
395 $this->lng->txt("trac_collection_tlt_learner_info")
396 );
397
398 $coll_items = array();
399
400 $olp = ilObjectLP::getInstance($this->getObjId());
401 $collection = $olp->getCollectionInstance();
402 $possible_items = [];
403 if ($collection) {
404 $coll_items = $collection->getItems();
405 $possible_items = $collection->getPossibleItems(
406 $this->getRefId()
407 ); // for titles
408 }
409
411 $this->getObjId(),
413 );
414 $info = $class::_getStatusInfo($this->getObjId(), true);
415
417
418 foreach ($coll_items as $item_id) {
419 // #16599 - deleted items should not be displayed
420 if (!array_key_exists($item_id, $possible_items)) {
421 continue;
422 }
423
424 $field = new ilCustomInputGUI($possible_items[$item_id]["title"]);
425
426 // lp status
428 if (isset($info["completed"][$item_id]) &&
429 in_array($this->user->getId(), $info["completed"][$item_id])) {
431 } elseif (isset($info["in_progress"][$item_id]) &&
432 in_array(
433 $this->user->getId(),
434 $info["in_progress"][$item_id]
435 )) {
437 }
438 $field->setHtml($icons->renderIconForStatus($status));
439
440 // stats
441 $spent = 0;
442 if (isset($info["tlt_users"][$item_id][$this->user->getId()])) {
443 $spent = $info["tlt_users"][$item_id][$this->user->getId()];
444 }
445 $needed = $info["tlt"][$item_id];
446 if ($needed) {
447 $field->setInfo(
448 sprintf(
449 $this->lng->txt("trac_collection_tlt_learner_subitem"),
452 min(100, round(abs($spent) / $needed * 100))
453 )
454 );
455 }
456
457 $form->addItem($field);
458 }
459
460 $this->tpl->setContent($form->getHTML());
461 }
This class represents a custom property in a property form.
static secondsToString(int $seconds, bool $force_with_seconds=false, ?ilLanguage $a_lng=null)
converts seconds to string: Long: 7 days 4 hour(s) ...
const LP_STATUS_IN_PROGRESS_NUM

References $info, ilLPStatusFactory\_getClassById(), ILIAS\Repository\ctrl(), ilObjectLP\getInstance(), ilLPStatusIcons\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().

+ Here is the call graph for this function:

◆ updateManual()

ilLearningProgressGUI::updateManual ( )
protected

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

355 : void
356 {
360 );
361 if ($olp->getCurrentMode(
363 $form = $this->initCollectionManualForm();
364 if ($form->checkInput()) {
366 $this->getObjId(),
368 );
369 $class::_setObjectStatus(
370 $this->getObjId(),
371 $this->usr_id,
372 $form->getInput("sids")
373 );
374
375 $this->tpl->setOnScreenMessage(
376 'success',
377 $this->lng->txt(
378 "settings_saved"
379 ),
380 true
381 );
382 }
383
384 $this->ctrl->redirect($this, "editManual");
385 }
386 }
387 }

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.

+ Here is the call graph for this function:

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