ILIAS  release_7 Revision v7.30-3-g800a261c036
ilLearningProgressGUI Class Reference

Class ilObjUserTrackingGUI. More...

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

Public Member Functions

 executeCommand ()
 execute command More...
 
 __setCmdClass ($a_class)
 
 __getNextClass ()
 
- Public Member Functions inherited from ilLearningProgressBaseGUI
 __construct ($a_mode, $a_ref_id=0, $a_usr_id=0)
 
 isAnonymized ()
 
 getMode ()
 
 getRefId ()
 
 getObjId ()
 
 getUserId ()
 
 __getDefaultCommand ()
 
 __setSubTabs ($a_active)
 
 __buildFooter ()
 
 __buildHeader ()
 
 __insertPath (&$a_tpl, $a_ref_id)
 insert path More...
 
 __showImageByStatus (&$tpl, $a_status, $tpl_prefix="")
 
__initTableGUI ()
 
 __showObjectDetails (&$info, $item_id=0, $add_section=true)
 show details about current object. More...
 
 __appendUserInfo (&$info, $a_user)
 
 __appendLPDetails (&$info, $item_id, $user_id)
 
 __sort ($a_ids, $a_table, $a_field, $a_id_name)
 Function that sorts ids by a given table field using WHERE IN E.g: __sort(array(6,7),'usr_data','lastname','usr_id') => sorts by lastname. More...
 
 __getPercent ($max, $reached)
 
 __readItemStatusInfo ($a_items)
 
 __getLegendHTML (int $variant=ilLPStatusIcons::ICON_VARIANT_LONG)
 
 __showEditUser ($a_user_id, $a_ref_id, $a_cancel, $a_sub_id=false)
 
 __updateUser ($user_id, $obj_id)
 

Protected Member Functions

 editManual ()
 Show progress screen for "edit manual" @global type $tpl. More...
 
 initCollectionManualForm ()
 
 updateManual ()
 
 showtlt ()
 
- Protected Member Functions inherited from ilLearningProgressBaseGUI
 initEditUserForm ($a_user_id, $a_obj_id, $a_cancel=null)
 

Additional Inherited Members

- Static Public Member Functions inherited from ilLearningProgressBaseGUI
static _showImageByStatus (&$tpl, $a_status, $tpl_prefix="")
 we need this public in table classes More...
 
static _getImagePathForStatus ($a_status)
 Get image path for status. More...
 
static _getStatusText ($a_status, $a_lng=null)
 Get status alt text. More...
 
static __readStatus ($a_obj_id, $user_id)
 
static isObjectOffline ($a_obj_id, $a_type=null)
 
- Data Fields inherited from ilLearningProgressBaseGUI
 $tpl = null
 
 $ctrl = null
 
 $lng = null
 
 $ref_id = 0
 
 $mode = 0
 
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
 
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
 
- Protected Attributes inherited from ilLearningProgressBaseGUI
 $anonymized
 
 $logger
 
 $tabs_gui
 

Detailed Description

Member Function Documentation

◆ __getNextClass()

ilLearningProgressGUI::__getNextClass ( )

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

125 {
126 global $DIC;
127
128 $ilAccess = $DIC['ilAccess'];
129 $ilUser = $DIC['ilUser'];
130
131 // #9857
133 return;
134 }
135
136 if (strlen($next_class = $this->ctrl->getNextClass())) {
137 if ($this->getMode() == self::LP_CONTEXT_PERSONAL_DESKTOP) {
138 $_SESSION['il_lp_history'] = $next_class;
139 }
140 return $next_class;
141 }
142 switch ($this->getMode()) {
144 return 'illplistofobjectsgui';
145
147 $cmd = $this->ctrl->getCmd();
148 if (in_array($cmd, array("editManual", "updatemanual", "showtlt"))) {
149 return "";
150 }
151
152 // #12771
153 include_once './Services/Object/classes/class.ilObjectLP.php';
155 if (!$olp->isActive()) {
156 include_once './Services/Tracking/classes/class.ilLearningProgressAccess.php';
157 if (!($olp instanceof ilPluginLP) &&
158 ilLearningProgressAccess::checkPermission('edit_learning_progress', $this->getRefId())) {
159 return 'illplistofsettingsgui';
160 } else {
161 return '';
162 }
163 }
164
165 include_once './Services/Tracking/classes/class.ilLearningProgressAccess.php';
166 if (!$this->anonymized &&
167 ilLearningProgressAccess::checkPermission('read_learning_progress', $this->getRefId())) {
168 return 'illplistofobjectsgui';
169 }
170 if (
171 ilLearningProgressAccess::checkPermission('edit_learning_progress', $this->getRefId())) {
172 return 'illplistofsettingsgui';
173 }
174 return 'illplistofprogressgui';
175
177
178 include_once("Services/Tracking/classes/class.ilObjUserTracking.php");
181
182 if ($has_edit || $has_personal) {
183 // default (#10928)
184 $tgt = null;
185 if ($has_personal) {
186 $tgt = 'illplistofprogressgui';
187 } elseif ($has_edit) {
188 $tgt = 'illplistofobjectsgui';
189 }
190
191 // validate session
192 switch ($_SESSION['il_lp_history']) {
193 case 'illplistofobjectsgui':
194 if (!$has_edit) {
195 $_SESSION['il_lp_history'] = null;
196 }
197 break;
198
199 case 'illplistofprogressgui':
200 if (!$has_personal) {
201 $_SESSION['il_lp_history'] = null;
202 }
203 break;
204 }
205
206 if ($_SESSION['il_lp_history']) {
207 return $_SESSION['il_lp_history'];
208 } elseif ($tgt) {
209 return $tgt;
210 }
211 }
212
213 // should not happen
214 ilUtil::redirect("ilias.php?baseClass=ilDashboardGUI");
215
216 // no break
220 return 'illplistofprogressgui';
221 }
222 break;
223 }
224 }
$_SESSION["AccountId"]
static checkPermission($a_permission, $a_ref_id, $a_user_id=null)
wrapper for rbac access checks
static _enabledLearningProgress()
check wether learing progress is enabled or not
static _enabledUserRelatedData()
check wether user related tracking is enabled or not
static getInstance($a_obj_id)
static _lookupObjId($a_id)
static redirect($a_script)
global $DIC
Definition: goto.php:24
$ilUser
Definition: imgupload.php:18

References $_SESSION, $DIC, $ilUser, ilObjUserTracking\_enabledLearningProgress(), ilObjUserTracking\_enabledUserRelatedData(), ilObjUserTracking\_hasLearningProgressLearner(), ilObjUserTracking\_hasLearningProgressOtherUsers(), ilObject\_lookupObjId(), ilLearningProgressAccess\checkPermission(), ilObjectLP\getInstance(), ilLearningProgressBaseGUI\getMode(), ilLearningProgressBaseGUI\getRefId(), ilLearningProgressBaseGUI\LP_CONTEXT_ADMINISTRATION, ilLearningProgressBaseGUI\LP_CONTEXT_ORG_UNIT, ilLearningProgressBaseGUI\LP_CONTEXT_PERSONAL_DESKTOP, ilLearningProgressBaseGUI\LP_CONTEXT_REPOSITORY, ilLearningProgressBaseGUI\LP_CONTEXT_USER_FOLDER, and ilUtil\redirect().

Referenced by executeCommand().

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

◆ __setCmdClass()

ilLearningProgressGUI::__setCmdClass (   $a_class)

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

114 {
115 // If cmd class == 'illearningprogressgui' the cmd class is set to the the new forwarded class
116 // otherwise e.g illplistofprogressgui tries to forward (back) to illearningprogressgui.
117
118 if ($this->ctrl->getCmdClass() == strtolower(get_class($this))) {
119 $this->ctrl->setCmdClass(strtolower($a_class));
120 }
121 return true;
122 }

Referenced by executeCommand().

+ Here is the caller graph for this function:

◆ editManual()

ilLearningProgressGUI::editManual ( )
protected

Show progress screen for "edit manual" @global type $tpl.

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

231 {
232 global $DIC;
233
234 $tpl = $DIC['tpl'];
235
238 if ($olp->getCurrentMode() == ilLPObjSettings::LP_MODE_COLLECTION_MANUAL) {
239 $form = $this->initCollectionManualForm();
240 $tpl->setContent($form->getHTML());
241 }
242 }
243 }
static checkAccess($a_ref_id, $a_allow_only_read=true)
check access to learning progress

References $DIC, ilLearningProgressBaseGUI\$tpl, 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 22 of file class.ilLearningProgressGUI.php.

23 {
24 global $DIC;
25
26 $ilHelp = $DIC['ilHelp'];
27 $ilAccess = $DIC['ilAccess'];
28
29 $this->ctrl->setReturn($this, "");
30
31 // E.g personal desktop mode needs locator header icon ...
32 $this->__buildHeader();
33 switch ($this->__getNextClass()) {
34 case 'illplistofprogressgui':
35 include_once 'Services/Tracking/classes/repository_statistics/class.ilLPListOfProgressGUI.php';
36
37 $ilHelp->setScreenIdComponent("lp_" . ilObject::_lookupType($this->getRefId(), true));
38
39 $this->__setSubTabs(self::LP_ACTIVE_PROGRESS);
40 $this->__setCmdClass('illplistofprogressgui');
41 $lop_gui = new ilLPListOfProgressGUI($this->getMode(), $this->getRefId(), $this->getUserId());
42 $this->ctrl->forwardCommand($lop_gui);
43 break;
44
45 case 'illplistofobjectsgui':
46 include_once './Services/Tracking/classes/class.ilLearningProgressAccess.php';
47 if ($this->getRefId() &&
48 !ilLearningProgressAccess::checkPermission('read_learning_progress', $this->getRefId())) {
49 return;
50 }
51
52 include_once 'Services/Tracking/classes/repository_statistics/class.ilLPListOfObjectsGUI.php';
53 if (stristr($this->ctrl->getCmd(), "matrix")) {
54 $this->__setSubTabs(self::LP_ACTIVE_MATRIX);
55 } elseif (stristr($this->ctrl->getCmd(), "summary")) {
56 $this->__setSubTabs(self::LP_ACTIVE_SUMMARY);
57 } else {
58 $this->__setSubTabs(self::LP_ACTIVE_OBJECTS);
59 }
60 $loo_gui = new ilLPListOfObjectsGUI($this->getMode(), $this->getRefId());
61 $this->__setCmdClass('illplistofobjectsgui');
62 $this->ctrl->forwardCommand($loo_gui);
63 break;
64
65 case 'illplistofsettingsgui':
66 include_once './Services/Tracking/classes/class.ilLearningProgressAccess.php';
67 if ($this->getRefId() &&
68 !ilLearningProgressAccess::checkPermission('edit_learning_progress', $this->getRefId())) {
69 return;
70 }
71
72 include_once 'Services/Tracking/classes/repository_statistics/class.ilLPListOfSettingsGUI.php';
73
74 $this->__setSubTabs(self::LP_ACTIVE_SETTINGS);
75 $los_gui = new ilLPListOfSettingsGUI($this->getMode(), $this->getRefId());
76 $this->__setCmdClass('illplistofsettingsgui');
77 $this->ctrl->forwardCommand($los_gui);
78 break;
79
80 case 'illpobjectstatisticsgui':
81 include_once 'Services/Tracking/classes/object_statistics/class.ilLPObjectStatisticsGUI.php';
82 if (stristr($this->ctrl->getCmd(), "access")) {
83 $this->__setSubTabs(self::LP_ACTIVE_OBJSTATACCESS);
84 } elseif (stristr($this->ctrl->getCmd(), "types")) {
85 $this->__setSubTabs(self::LP_ACTIVE_OBJSTATTYPES);
86 } elseif (stristr($this->ctrl->getCmd(), "daily")) {
87 $this->__setSubTabs(self::LP_ACTIVE_OBJSTATDAILY);
88 } else {
89 $this->__setSubTabs(self::LP_ACTIVE_OBJSTATADMIN);
90 }
91 $this->__setCmdClass('illpobjectstatisticsgui');
92 $ost_gui = new ilLPObjectStatisticsGUI($this->getMode(), $this->getRefId());
93 $this->ctrl->forwardCommand($ost_gui);
94 break;
95
96 default:
97 $cmd = $this->ctrl->getCmd();
98 if (!$cmd) {
99 return;
100 }
101 $this->$cmd();
102 $this->tpl->printToStdout();
103 break;
104 }
105
106 // E.G personal desktop mode needs $tpl->show();
107 $this->__buildFooter();
108
109
110 return true;
111 }
Class ilLPListOfSettingsGUI.
static _lookupType($a_id, $a_reference=false)
lookup object type

References $DIC, ilLearningProgressBaseGUI\__buildFooter(), ilLearningProgressBaseGUI\__buildHeader(), __getNextClass(), __setCmdClass(), ilLearningProgressBaseGUI\__setSubTabs(), ilObject\_lookupType(), ilLearningProgressAccess\checkPermission(), ilLearningProgressBaseGUI\getMode(), ilLearningProgressBaseGUI\getRefId(), and ilLearningProgressBaseGUI\getUserId().

+ Here is the call graph for this function:

◆ initCollectionManualForm()

ilLearningProgressGUI::initCollectionManualForm ( )
protected

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

246 {
247 global $DIC;
248
249 $lng = $DIC['lng'];
250 $ilCtrl = $DIC['ilCtrl'];
251
252 include_once "Services/Form/classes/class.ilPropertyFormGUI.php";
253 $form = new ilPropertyFormGUI();
254 $form->setFormAction($ilCtrl->getFormAction($this, "updatemanual"));
255 $form->setTitle($lng->txt("learning_progress"));
256 $form->setDescription($lng->txt("trac_collection_manual_learner_info"));
257
258 $coll_items = array();
259
260 include_once './Services/Object/classes/class.ilObjectLP.php';
261 $olp = ilObjectLP::getInstance($this->getObjId());
262 $collection = $olp->getCollectionInstance();
263 if ($collection) {
264 $coll_items = $collection->getItems();
265 $possible_items = $collection->getPossibleItems($this->getRefId()); // for titles
266
267 switch (ilObject::_lookupType($this->getObjId())) {
268 case "lm":
269 $subitem_title = $lng->txt("objs_st");
270 $subitem_info = $lng->txt("trac_collection_manual_learner_lm_info");
271 break;
272 }
273 }
274
275 include_once "Services/Tracking/classes/class.ilLPStatusFactory.php";
277 $lp_data = $class::_getObjectStatus($this->getObjId(), $this->usr_id);
278
280
281 $grp = new ilCheckboxGroupInputGUI($subitem_title, "sids");
282 $grp->setInfo($subitem_info);
283 $form->addItem($grp);
284
285 // #14994 - using possible items for proper sorting
286
287 $completed = array();
288 foreach (array_keys($possible_items) as $item_id) {
289 if (!in_array($item_id, $coll_items)) {
290 continue;
291 }
292
293 $info = null;
295
296 if (isset($lp_data[$item_id])) {
297 $changed = new ilDateTime($lp_data[$item_id][1], IL_CAL_UNIX);
298 $info = $lng->txt("trac_collection_manual_learner_changed_ts") . ": " .
300
301 if ($lp_data[$item_id][0]) {
303 $completed[] = $item_id;
304 }
305 }
306
307 $icon = $icons->renderIconForStatus($status);
308
309 $opt = new ilCheckboxOption(
310 $icon . " " . $possible_items[$item_id]["title"],
311 $item_id
312 );
313
314 if ($info) {
315 $opt->setInfo($info);
316 }
317 $grp->addOption($opt);
318 }
319
320 if ($completed) {
321 $grp->setValue($completed);
322 }
323
324 $form->addCommandButton("updatemanual", $lng->txt("save"));
325
326 return $form;
327 }
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, $a_skip_day=false, $a_include_wd=false, $include_seconds=false)
Format a date @access public.
@classDescription Date and time handling
static _getClassById($a_obj_id, $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.

References $changed, $DIC, ilLearningProgressBaseGUI\$lng, ilLPStatusFactory\_getClassById(), ilObject\_lookupType(), ilDatePresentation\formatDate(), ilObjectLP\getInstance(), ilLPStatusIcons\getInstance(), ilLearningProgressBaseGUI\getObjId(), ilLearningProgressBaseGUI\getRefId(), ilLPStatusIcons\ICON_VARIANT_LONG, IL_CAL_UNIX, 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 355 of file class.ilLearningProgressGUI.php.

356 {
357 global $DIC;
358
359 $lng = $DIC['lng'];
360 $ilCtrl = $DIC['ilCtrl'];
361 $tpl = $DIC['tpl'];
362 $ilUser = $DIC['ilUser'];
363
364 include_once "Services/Form/classes/class.ilPropertyFormGUI.php";
365 $form = new ilPropertyFormGUI();
366 $form->setFormAction($ilCtrl->getFormAction($this, "showtlt"));
367 $form->setTitle($lng->txt("learning_progress"));
368 $form->setDescription($lng->txt("trac_collection_tlt_learner_info"));
369
370 $coll_items = array();
371
372 include_once './Services/Object/classes/class.ilObjectLP.php';
373 $olp = ilObjectLP::getInstance($this->getObjId());
374 $collection = $olp->getCollectionInstance();
375 if ($collection) {
376 $coll_items = $collection->getItems();
377 $possible_items = $collection->getPossibleItems($this->getRefId()); // for titles
378 }
379
380 include_once "Services/Tracking/classes/class.ilLPStatusFactory.php";
382 $info = $class::_getStatusInfo($this->getObjId(), true);
383
385
386 foreach ($coll_items as $item_id) {
387 // #16599 - deleted items should not be displayed
388 if (!array_key_exists($item_id, $possible_items)) {
389 continue;
390 }
391
392 $field = new ilCustomInputGUI($possible_items[$item_id]["title"]);
393
394 // lp status
396 if (isset($info["completed"][$item_id]) &&
397 in_array($ilUser->getId(), $info["completed"][$item_id])) {
399 } elseif (isset($info["in_progress"][$item_id]) &&
400 in_array($ilUser->getId(), $info["in_progress"][$item_id])) {
402 }
403
404 $field->setHtml($icons->renderIconForStatus($status));
405
406 // stats
407 $spent = 0;
408 if (isset($info["tlt_users"][$item_id][$ilUser->getId()])) {
409 $spent = $info["tlt_users"][$item_id][$ilUser->getId()];
410 }
411 $needed = $info["tlt"][$item_id];
412 if ($needed) {
413 $field->setInfo(sprintf(
414 $lng->txt("trac_collection_tlt_learner_subitem"),
417 min(100, round(abs($spent) / $needed * 100))
418 ));
419 }
420
421 $form->addItem($field);
422 }
423
424 $tpl->setContent($form->getHTML());
425 }
This class represents a custom property in a property form.
static secondsToString($seconds, $force_with_seconds=false, $a_lng=null)
converts seconds to string: Long: 7 days 4 hour(s) ...
const LP_STATUS_IN_PROGRESS_NUM

References $DIC, $ilUser, ilLearningProgressBaseGUI\$lng, ilLearningProgressBaseGUI\$tpl, ilLPStatusFactory\_getClassById(), ilObjectLP\getInstance(), ilLPStatusIcons\getInstance(), ilLearningProgressBaseGUI\getObjId(), ilLearningProgressBaseGUI\getRefId(), ilLPStatusIcons\ICON_VARIANT_LONG, ilLPObjSettings\LP_MODE_COLLECTION_TLT, ilLPStatus\LP_STATUS_COMPLETED_NUM, ilLPStatus\LP_STATUS_IN_PROGRESS_NUM, ilLPStatus\LP_STATUS_NOT_ATTEMPTED_NUM, and ilDatePresentation\secondsToString().

+ Here is the call graph for this function:

◆ updateManual()

ilLearningProgressGUI::updateManual ( )
protected

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

330 {
331 global $DIC;
332
333 $ilCtrl = $DIC['ilCtrl'];
334 $lng = $DIC['lng'];
335
336 include_once './Services/Tracking/classes/class.ilLearningProgressAccess.php';
338 include_once './Services/Object/classes/class.ilObjectLP.php';
340 if ($olp->getCurrentMode() == ilLPObjSettings::LP_MODE_COLLECTION_MANUAL) {
341 $form = $this->initCollectionManualForm();
342 if ($form->checkInput()) {
343 include_once "Services/Tracking/classes/class.ilLPStatusFactory.php";
345 $class::_setObjectStatus($this->getObjId(), $this->usr_id, $form->getInput("sids"));
346
347 ilUtil::sendSuccess($lng->txt("settings_saved"), true);
348 }
349
350 $ilCtrl->redirect($this, "editManual");
351 }
352 }
353 }

References $DIC, ilLearningProgressBaseGUI\$lng, ilLPStatusFactory\_getClassById(), ilObject\_lookupObjId(), ilLearningProgressAccess\checkAccess(), ilObjectLP\getInstance(), ilLearningProgressBaseGUI\getObjId(), ilLearningProgressBaseGUI\getRefId(), initCollectionManualForm(), 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: