ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
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 ()
 
 __showEditUser ($a_user_id, $a_ref_id, $a_cancel, $a_sub_id=false)
 
 __updateUser ($user_id, $obj_id)
 

Protected Member Functions

 editManual ()
 
 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="")
 
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
 

Detailed Description

Member Function Documentation

◆ __getNextClass()

ilLearningProgressGUI::__getNextClass ( )

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

142 {
143 global $ilAccess, $ilUser;
144
145 // #9857
147 {
148 return;
149 }
150
151 if(strlen($next_class = $this->ctrl->getNextClass()))
152 {
153 if($this->getMode() == self::LP_CONTEXT_PERSONAL_DESKTOP)
154 {
155 $_SESSION['il_lp_history'] = $next_class;
156 }
157 return $next_class;
158 }
159 switch($this->getMode())
160 {
162 return 'illplistofobjectsgui';
163
165 $cmd = $this->ctrl->getCmd();
166 if(in_array($cmd, array("editmanual", "updatemanual", "showtlt")))
167 {
168 return "";
169 }
170
171 // #12771
172 include_once './Services/Object/classes/class.ilObjectLP.php';
174 if(!$olp->isActive())
175 {
176 include_once './Services/Tracking/classes/class.ilLearningProgressAccess.php';
177 if(!($olp instanceof ilPluginLP) &&
178 ilLearningProgressAccess::checkPermission('edit_learning_progress', $this->getRefId()))
179 {
180 return 'illplistofsettingsgui';
181 }
182 else
183 {
184 return '';
185 }
186 }
187
188 include_once './Services/Tracking/classes/class.ilLearningProgressAccess.php';
189 if(!$this->anonymized &&
190 ilLearningProgressAccess::checkPermission('read_learning_progress', $this->getRefId()))
191 {
192 return 'illplistofobjectsgui';
193 }
194 if(
195 ilLearningProgressAccess::checkPermission('edit_learning_progress', $this->getRefId()))
196 {
197 return 'illplistofsettingsgui';
198 }
199 return 'illplistofprogressgui';
200
202
203 include_once("Services/Tracking/classes/class.ilObjUserTracking.php");
206
207 if($has_edit || $has_personal)
208 {
209 // default (#10928)
210 $tgt = null;
211 if($has_personal)
212 {
213 $tgt = 'illplistofprogressgui';
214 }
215 else if($has_edit)
216 {
217 $tgt = 'illplistofobjectsgui';
218 }
219
220 // validate session
221 switch($_SESSION['il_lp_history'])
222 {
223 case 'illplistofobjectsgui':
224 if(!$has_edit)
225 {
226 $_SESSION['il_lp_history'] = null;
227 }
228 break;
229
230 case 'illplistofprogressgui':
231 if(!$has_personal)
232 {
233 $_SESSION['il_lp_history'] = null;
234 }
235 break;
236 }
237
238 if($_SESSION['il_lp_history'])
239 {
240 return $_SESSION['il_lp_history'];
241 }
242 else if($tgt)
243 {
244 return $tgt;
245 }
246 }
247
248 // should not happen
249 ilUtil::redirect("ilias.php?baseClass=ilPersonalDesktopGUI");
250
254 {
255 return 'illplistofprogressgui';
256 }
257 break;
258 }
259 }
$_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)
http redirect to other script
$cmd
Definition: sahs_server.php:35
$ilUser
Definition: imgupload.php:18

References $_SESSION, $cmd, $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 129 of file class.ilLearningProgressGUI.php.

130 {
131 // If cmd class == 'illearningprogressgui' the cmd class is set to the the new forwarded class
132 // otherwise e.g illplistofprogressgui tries to forward (back) to illearningprogressgui.
133
134 if($this->ctrl->getCmdClass() == strtolower(get_class($this)))
135 {
136 $this->ctrl->setCmdClass(strtolower($a_class));
137 }
138 return true;
139 }

Referenced by executeCommand().

+ Here is the caller graph for this function:

◆ editManual()

ilLearningProgressGUI::editManual ( )
protected

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

262 {
263 global $tpl;
264
265 include_once './Services/Tracking/classes/class.ilLearningProgressAccess.php';
267 {
268 include_once './Services/Object/classes/class.ilObjectLP.php';
270 if($olp->getCurrentMode() == ilLPObjSettings::LP_MODE_COLLECTION_MANUAL)
271 {
272 $form = $this->initCollectionManualForm();
273 $tpl->setContent($form->getHTML());
274 }
275 }
276 }
static checkAccess($a_ref_id, $a_allow_only_read=true)
check access to learning progress

References 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 $ilBench, $ilHelp, $ilAccess;
25
26 $ilBench->start('LearningProgress','0000_Start');
27
28 $this->ctrl->setReturn($this, "");
29
30 // E.g personal desktop mode needs locator header icon ...
31 $this->__buildHeader();
32 switch($this->__getNextClass())
33 {
34 case 'illplistofprogressgui':
35 include_once 'Services/Tracking/classes/repository_statistics/class.ilLPListOfProgressGUI.php';
36
37 $ilHelp->setScreenIdComponent("lp");
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 {
50 return;
51 }
52
53 include_once 'Services/Tracking/classes/repository_statistics/class.ilLPListOfObjectsGUI.php';
54 if(stristr($this->ctrl->getCmd(), "matrix"))
55 {
56 $this->__setSubTabs(self::LP_ACTIVE_MATRIX);
57 }
58 else if(stristr($this->ctrl->getCmd(), "summary"))
59 {
60 $this->__setSubTabs(self::LP_ACTIVE_SUMMARY);
61 }
62 else
63 {
64 $this->__setSubTabs(self::LP_ACTIVE_OBJECTS);
65 }
66 $loo_gui = new ilLPListOfObjectsGUI($this->getMode(),$this->getRefId());
67 $this->__setCmdClass('illplistofobjectsgui');
68 $this->ctrl->forwardCommand($loo_gui);
69 break;
70
71 case 'illplistofsettingsgui':
72 include_once './Services/Tracking/classes/class.ilLearningProgressAccess.php';
73 if($this->getRefId() &&
74 !ilLearningProgressAccess::checkPermission('edit_learning_progress', $this->getRefId()))
75 {
76 return;
77 }
78
79 include_once 'Services/Tracking/classes/repository_statistics/class.ilLPListOfSettingsGUI.php';
80
81 $this->__setSubTabs(self::LP_ACTIVE_SETTINGS);
82 $los_gui = new ilLPListOfSettingsGUI($this->getMode(),$this->getRefId());
83 $this->__setCmdClass('illplistofsettingsgui');
84 $this->ctrl->forwardCommand($los_gui);
85 break;
86
87 case 'illpobjectstatisticsgui':
88 include_once 'Services/Tracking/classes/object_statistics/class.ilLPObjectStatisticsGUI.php';
89 if(stristr($this->ctrl->getCmd(), "access"))
90 {
91 $this->__setSubTabs(self::LP_ACTIVE_OBJSTATACCESS);
92 }
93 else if(stristr($this->ctrl->getCmd(), "types"))
94 {
95 $this->__setSubTabs(self::LP_ACTIVE_OBJSTATTYPES);
96 }
97 else if(stristr($this->ctrl->getCmd(), "daily"))
98 {
99 $this->__setSubTabs(self::LP_ACTIVE_OBJSTATDAILY);
100 }
101 else
102 {
103 $this->__setSubTabs(self::LP_ACTIVE_OBJSTATADMIN);
104 }
105 $this->__setCmdClass('illpobjectstatisticsgui');
106 $ost_gui = new ilLPObjectStatisticsGUI($this->getMode(),$this->getRefId());
107 $this->ctrl->forwardCommand($ost_gui);
108 break;
109
110 default:
111 $cmd = $this->ctrl->getCmd();
112 if(!$cmd)
113 {
114 return;
115 }
116 $this->tpl->show(true);
117 break;
118 }
119
120 // E.G personal desktop mode needs $tpl->show();
121 $this->__buildFooter();
122
123
124 $ilBench->stop('LearningProgress','0000_Start');
125
126 return true;
127 }
Class ilLPListOfSettingsGUI.
global $ilBench
Definition: ilias.php:18

References $cmd, $ilBench, ilLearningProgressBaseGUI\__buildFooter(), ilLearningProgressBaseGUI\__buildHeader(), __getNextClass(), __setCmdClass(), ilLearningProgressBaseGUI\__setSubTabs(), ilLearningProgressAccess\checkPermission(), ilLearningProgressBaseGUI\getMode(), ilLearningProgressBaseGUI\getRefId(), and ilLearningProgressBaseGUI\getUserId().

+ Here is the call graph for this function:

◆ initCollectionManualForm()

ilLearningProgressGUI::initCollectionManualForm ( )
protected

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

279 {
280 global $lng, $ilCtrl;
281
282 include_once "Services/Form/classes/class.ilPropertyFormGUI.php";
283 $form = new ilPropertyFormGUI();
284 $form->setFormAction($ilCtrl->getFormAction($this, "updatemanual"));
285 $form->setTitle($lng->txt("learning_progress"));
286 $form->setDescription($lng->txt("trac_collection_manual_learner_info"));
287
288 $coll_items = array();
289
290 include_once './Services/Object/classes/class.ilObjectLP.php';
291 $olp = ilObjectLP::getInstance($this->getObjId());
292 $collection = $olp->getCollectionInstance();
293 if($collection)
294 {
295 $coll_items = $collection->getItems();
296 $possible_items = $collection->getPossibleItems($this->getRefId()); // for titles
297
298 switch(ilObject::_lookupType($this->getObjId()))
299 {
300 case "lm":
301 $subitem_title = $lng->txt("objs_st");
302 $subitem_info = $lng->txt("trac_collection_manual_learner_lm_info");
303 break;
304 }
305 }
306
307 include_once "Services/Tracking/classes/class.ilLPStatusFactory.php";
309 $lp_data = $class::_getObjectStatus($this->getObjId(), $this->usr_id);
310
311 $grp = new ilCheckboxGroupInputGUI($subitem_title, "sids");
312 $grp->setInfo($subitem_info);
313 $form->addItem($grp);
314
315 // #14994 - using possible items for proper sorting
316
317 $completed = array();
318 foreach(array_keys($possible_items) as $item_id)
319 {
320 if(!in_array($item_id, $coll_items))
321 {
322 continue;
323 }
324
325 $info = null;
327
328 if(isset($lp_data[$item_id]))
329 {
330 $changed = new ilDateTime($lp_data[$item_id][1], IL_CAL_UNIX);
331 $info = $lng->txt("trac_collection_manual_learner_changed_ts").": ".
333
334 if($lp_data[$item_id][0])
335 {
337 $completed[] = $item_id;
338 }
339 }
340
343 $icon = ilUtil::img($path, $text);
344
345 $opt = new ilCheckboxOption($icon." ".$possible_items[$item_id]["title"], $item_id);
346 if($info)
347 {
348 $opt->setInfo($info);
349 }
350 $grp->addOption($opt);
351 }
352
353 if($completed)
354 {
355 $grp->setValue($completed);
356 }
357
358 $form->addCommandButton("updatemanual", $lng->txt("save"));
359
360 return $form;
361 }
$path
Definition: aliased.php:25
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)
Format a date @access public.
@classDescription Date and time handling
static _getClassById($a_obj_id, $a_mode=NULL)
const LP_STATUS_COMPLETED_NUM
const LP_STATUS_NOT_ATTEMPTED_NUM
static _getStatusText($a_status, $a_lng=null)
Get status alt text.
static _getImagePathForStatus($a_status)
Get image path for status.
static _lookupType($a_id, $a_reference=false)
lookup object type
This class represents a property form user interface.
static img($a_src, $a_alt="", $a_width="", $a_height="", $a_border=0, $a_id="", $a_class="")
Build img tag.
$text
$info
Definition: example_052.php:80
global $ilCtrl
Definition: ilias.php:18

References $changed, $ilCtrl, $info, ilLearningProgressBaseGUI\$lng, $path, $text, ilLPStatusFactory\_getClassById(), ilLearningProgressBaseGUI\_getImagePathForStatus(), ilLearningProgressBaseGUI\_getStatusText(), ilObject\_lookupType(), ilDatePresentation\formatDate(), ilObjectLP\getInstance(), ilLearningProgressBaseGUI\getObjId(), ilLearningProgressBaseGUI\getRefId(), IL_CAL_UNIX, ilUtil\img(), 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 global $lng, $ilCtrl, $tpl, $ilUser;
392
393 include_once "Services/Form/classes/class.ilPropertyFormGUI.php";
394 $form = new ilPropertyFormGUI();
395 $form->setFormAction($ilCtrl->getFormAction($this, "showtlt"));
396 $form->setTitle($lng->txt("learning_progress"));
397 $form->setDescription($lng->txt("trac_collection_tlt_learner_info"));
398
399 $coll_items = array();
400
401 include_once './Services/Object/classes/class.ilObjectLP.php';
402 $olp = ilObjectLP::getInstance($this->getObjId());
403 $collection = $olp->getCollectionInstance();
404 if($collection)
405 {
406 $coll_items = $collection->getItems();
407 $possible_items = $collection->getPossibleItems($this->getRefId()); // for titles
408 }
409
410 include_once "Services/Tracking/classes/class.ilLPStatusFactory.php";
412 $info = $class::_getStatusInfo($this->getObjId(), true);
413
414 foreach($coll_items as $item_id)
415 {
416 // #16599 - deleted items should not be displayed
417 if(!array_key_exists($item_id, $possible_items))
418 {
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($ilUser->getId(), $info["completed"][$item_id]))
428 {
430 }
431 else if(isset($info["in_progress"][$item_id]) &&
432 in_array($ilUser->getId(), $info["in_progress"][$item_id]))
433 {
435 }
438 $field->setHtml(ilUtil::img($path, $text));
439
440 // stats
441 $spent = 0;
442 if(isset($info["tlt_users"][$item_id][$ilUser->getId()]))
443 {
444 $spent = $info["tlt_users"][$item_id][$ilUser->getId()];
445 }
446 $needed = $info["tlt"][$item_id];
447 if($needed)
448 {
449 $field->setInfo(sprintf($lng->txt("trac_collection_tlt_learner_subitem"),
452 min(100, round(abs($spent)/$needed*100))));
453 }
454
455 $form->addItem($field);
456 }
457
458 $tpl->setContent($form->getHTML());
459 }
sprintf('%.4f', $callTime)
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 $ilCtrl, $ilUser, $info, ilLearningProgressBaseGUI\$lng, $path, $text, ilLearningProgressBaseGUI\$tpl, ilLPStatusFactory\_getClassById(), ilLearningProgressBaseGUI\_getImagePathForStatus(), ilLearningProgressBaseGUI\_getStatusText(), ilObjectLP\getInstance(), ilLearningProgressBaseGUI\getObjId(), ilLearningProgressBaseGUI\getRefId(), ilUtil\img(), 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 sprintf.

+ Here is the call graph for this function:

◆ updateManual()

ilLearningProgressGUI::updateManual ( )
protected

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

364 {
365 global $ilCtrl, $lng;
366
367 include_once './Services/Tracking/classes/class.ilLearningProgressAccess.php';
369 {
370 include_once './Services/Object/classes/class.ilObjectLP.php';
372 if($olp->getCurrentMode() == ilLPObjSettings::LP_MODE_COLLECTION_MANUAL)
373 {
374 $form = $this->initCollectionManualForm();
375 if($form->checkInput())
376 {
377 include_once "Services/Tracking/classes/class.ilLPStatusFactory.php";
379 $class::_setObjectStatus($this->getObjId(), $this->usr_id, $form->getInput("sids"));
380
381 ilUtil::sendSuccess($lng->txt("settings_saved"), true);
382 }
383
384 $ilCtrl->redirect($this, "editmanual");
385 }
386 }
387 }
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.

References $ilCtrl, ilLearningProgressBaseGUI\$lng, ilLPStatusFactory\_getClassById(), ilObject\_lookupObjId(), ilLearningProgressAccess\checkAccess(), ilObjectLP\getInstance(), ilLearningProgressBaseGUI\getObjId(), ilLearningProgressBaseGUI\getRefId(), initCollectionManualForm(), ilLPObjSettings\LP_MODE_COLLECTION_MANUAL, and ilUtil\sendSuccess().

+ Here is the call graph for this function:

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