ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
ilLearningProgressGUI Class Reference

Class ilObjUserTrackingGUI. More...

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

Public Member Functions

 ilLearningProgressGUI ($a_mode, $a_ref_id=0, $a_user_id=0)
 
executeCommand ()
 execute command More...
 
 __setCmdClass ($a_class)
 
 __getNextClass ()
 
- Public Member Functions inherited from ilLearningProgressBaseGUI
 ilLearningProgressBaseGUI ($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="")
 
 _getImagePathForStatus ($a_status)
 Get image path for status. More...
 
 _getStatusText ($a_status, $a_lng=null)
 Get status alt text. More...
 
__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)
 
 __readStatus ($a_obj_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 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
 

Detailed Description

Member Function Documentation

◆ __getNextClass()

ilLearningProgressGUI::__getNextClass ( )

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

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

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

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

Referenced by executeCommand().

+ Here is the caller graph for this function:

◆ editManual()

ilLearningProgressGUI::editManual ( )
protected

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

264 {
265 global $tpl;
266
267 include_once './Services/Tracking/classes/class.ilLearningProgressAccess.php';
269 {
270 include_once './Services/Object/classes/class.ilObjectLP.php';
272 if($olp->getCurrentMode() == ilLPObjSettings::LP_MODE_COLLECTION_MANUAL)
273 {
274 $form = $this->initCollectionManualForm();
275 $tpl->setContent($form->getHTML());
276 }
277 }
278 }
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 27 of file class.ilLearningProgressGUI.php.

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

◆ ilLearningProgressGUI()

ilLearningProgressGUI::ilLearningProgressGUI (   $a_mode,
  $a_ref_id = 0,
  $a_user_id = 0 
)

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

20 {
21 parent::ilLearningProgressBaseGUI($a_mode,$a_ref_id,$a_user_id);
22 }

◆ initCollectionManualForm()

ilLearningProgressGUI::initCollectionManualForm ( )
protected

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

281 {
282 global $lng, $ilCtrl;
283
284 include_once "Services/Form/classes/class.ilPropertyFormGUI.php";
285 $form = new ilPropertyFormGUI();
286 $form->setFormAction($ilCtrl->getFormAction($this, "updatemanual"));
287 $form->setTitle($lng->txt("learning_progress"));
288 $form->setDescription($lng->txt("trac_collection_manual_learner_info"));
289
290 $coll_items = array();
291
292 include_once './Services/Object/classes/class.ilObjectLP.php';
293 $olp = ilObjectLP::getInstance($this->getObjId());
294 $collection = $olp->getCollectionInstance();
295 if($collection)
296 {
297 $coll_items = $collection->getItems();
298 $possible_items = $collection->getPossibleItems($this->getRefId()); // for titles
299
300 switch(ilObject::_lookupType($this->getObjId()))
301 {
302 case "lm":
303 $subitem_title = $lng->txt("objs_st");
304 $subitem_info = $lng->txt("trac_collection_manual_learner_lm_info");
305 break;
306 }
307 }
308
309 include_once "Services/Tracking/classes/class.ilLPStatusFactory.php";
311 $lp_data = $class::_getObjectStatus($this->getObjId(), $this->usr_id);
312
313 $grp = new ilCheckboxGroupInputGUI($subitem_title, "sids");
314 $grp->setInfo($subitem_info);
315 $form->addItem($grp);
316
317 // #14994 - using possible items for proper sorting
318
319 $completed = array();
320 foreach(array_keys($possible_items) as $item_id)
321 {
322 if(!in_array($item_id, $coll_items))
323 {
324 continue;
325 }
326
327 $info = null;
329
330 if(isset($lp_data[$item_id]))
331 {
332 $changed = new ilDateTime($lp_data[$item_id][1], IL_CAL_UNIX);
333 $info = $lng->txt("trac_collection_manual_learner_changed_ts").": ".
335
336 if($lp_data[$item_id][0])
337 {
339 $completed[] = $item_id;
340 }
341 }
342
345 $icon = ilUtil::img($path, $text);
346
347 $opt = new ilCheckboxOption($icon." ".$possible_items[$item_id]["title"], $item_id);
348 if($info)
349 {
350 $opt->setInfo($info);
351 }
352 $grp->addOption($opt);
353 }
354
355 if($completed)
356 {
357 $grp->setValue($completed);
358 }
359
360 $form->addCommandButton("updatemanual", $lng->txt("save"));
361
362 return $form;
363 }
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
_getClassById($a_obj_id, $a_mode=NULL)
const LP_STATUS_COMPLETED_NUM
const LP_STATUS_NOT_ATTEMPTED_NUM
_getImagePathForStatus($a_status)
Get image path for status.
_getStatusText($a_status, $a_lng=null)
Get status alt text.
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
$path
Definition: index.php:22

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

392 {
393 global $lng, $ilCtrl, $tpl, $ilUser;
394
395 include_once "Services/Form/classes/class.ilPropertyFormGUI.php";
396 $form = new ilPropertyFormGUI();
397 $form->setFormAction($ilCtrl->getFormAction($this, "showtlt"));
398 $form->setTitle($lng->txt("learning_progress"));
399 $form->setDescription($lng->txt("trac_collection_tlt_learner_info"));
400
401 $coll_items = array();
402
403 include_once './Services/Object/classes/class.ilObjectLP.php';
404 $olp = ilObjectLP::getInstance($this->getObjId());
405 $collection = $olp->getCollectionInstance();
406 if($collection)
407 {
408 $coll_items = $collection->getItems();
409 $possible_items = $collection->getPossibleItems($this->getRefId()); // for titles
410 }
411
412 include_once "Services/Tracking/classes/class.ilLPStatusFactory.php";
414 $info = $class::_getStatusInfo($this->getObjId(), true);
415
416 foreach($coll_items as $item_id)
417 {
418 // #16599 - deleted items should not be displayed
419 if(!array_key_exists($item_id, $possible_items))
420 {
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($ilUser->getId(), $info["completed"][$item_id]))
430 {
432 }
433 else if(isset($info["in_progress"][$item_id]) &&
434 in_array($ilUser->getId(), $info["in_progress"][$item_id]))
435 {
437 }
440 $field->setHtml(ilUtil::img($path, $text));
441
442 // stats
443 $spent = 0;
444 if(isset($info["tlt_users"][$item_id][$ilUser->getId()]))
445 {
446 $spent = $info["tlt_users"][$item_id][$ilUser->getId()];
447 }
448 $needed = $info["tlt"][$item_id];
449 if($needed)
450 {
451 $field->setInfo(sprintf($lng->txt("trac_collection_tlt_learner_subitem"),
454 min(100, round(abs($spent)/$needed*100))));
455 }
456
457 $form->addItem($field);
458 }
459
460 $tpl->setContent($form->getHTML());
461 }
This class represents a custom property in a property form.
_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(), ilFormat\_secondsToString(), ilObjectLP\getInstance(), ilLearningProgressBaseGUI\getObjId(), ilLearningProgressBaseGUI\getRefId(), ilUtil\img(), ilLPObjSettings\LP_MODE_COLLECTION_TLT, ilLPStatus\LP_STATUS_COMPLETED_NUM, ilLPStatus\LP_STATUS_IN_PROGRESS_NUM, and ilLPStatus\LP_STATUS_NOT_ATTEMPTED_NUM.

+ Here is the call graph for this function:

◆ updateManual()

ilLearningProgressGUI::updateManual ( )
protected

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

366 {
367 global $ilCtrl, $lng;
368
369 include_once './Services/Tracking/classes/class.ilLearningProgressAccess.php';
371 {
372 include_once './Services/Object/classes/class.ilObjectLP.php';
374 if($olp->getCurrentMode() == ilLPObjSettings::LP_MODE_COLLECTION_MANUAL)
375 {
376 $form = $this->initCollectionManualForm();
377 if($form->checkInput())
378 {
379 include_once "Services/Tracking/classes/class.ilLPStatusFactory.php";
381 $class::_setObjectStatus($this->getObjId(), $this->usr_id, $form->getInput("sids"));
382
383 ilUtil::sendSuccess($lng->txt("settings_saved"), true);
384 }
385
386 $ilCtrl->redirect($this, "editmanual");
387 }
388 }
389 }
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: