ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
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 ()
 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="")
 
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=ilPersonalDesktopGUI");
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: saml.php:7
$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) {
240 $tpl->setContent($form->getHTML());
241 }
242 }
243 }
static checkAccess($a_ref_id, $a_allow_only_read=true)
check access to learning progress
if(isset($_POST['submit'])) $form

References $DIC, $form, 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->show(true);
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
279 $grp = new ilCheckboxGroupInputGUI($subitem_title, "sids");
280 $grp->setInfo($subitem_info);
281 $form->addItem($grp);
282
283 // #14994 - using possible items for proper sorting
284
285 $completed = array();
286 foreach (array_keys($possible_items) as $item_id) {
287 if (!in_array($item_id, $coll_items)) {
288 continue;
289 }
290
291 $info = null;
293
294 if (isset($lp_data[$item_id])) {
295 $changed = new ilDateTime($lp_data[$item_id][1], IL_CAL_UNIX);
296 $info = $lng->txt("trac_collection_manual_learner_changed_ts") . ": " .
298
299 if ($lp_data[$item_id][0]) {
301 $completed[] = $item_id;
302 }
303 }
304
307 $icon = ilUtil::img($path, $text);
308
309 $opt = new ilCheckboxOption($icon . " " . $possible_items[$item_id]["title"], $item_id);
310 if ($info) {
311 $opt->setInfo($info);
312 }
313 $grp->addOption($opt);
314 }
315
316 if ($completed) {
317 $grp->setValue($completed);
318 }
319
320 $form->addCommandButton("updatemanual", $lng->txt("save"));
321
322 return $form;
323 }
$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, $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)
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.
This class represents a property form user interface.
static img($a_src, $a_alt=null, $a_width="", $a_height="", $a_border=0, $a_id="", $a_class="")
Build img tag.
global $ilCtrl
Definition: ilias.php:18
$info
Definition: index.php:5
$text
Definition: errorreport.php:18

References $changed, $DIC, $form, $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 351 of file class.ilLearningProgressGUI.php.

352 {
353 global $DIC;
354
355 $lng = $DIC['lng'];
356 $ilCtrl = $DIC['ilCtrl'];
357 $tpl = $DIC['tpl'];
358 $ilUser = $DIC['ilUser'];
359
360 include_once "Services/Form/classes/class.ilPropertyFormGUI.php";
361 $form = new ilPropertyFormGUI();
362 $form->setFormAction($ilCtrl->getFormAction($this, "showtlt"));
363 $form->setTitle($lng->txt("learning_progress"));
364 $form->setDescription($lng->txt("trac_collection_tlt_learner_info"));
365
366 $coll_items = array();
367
368 include_once './Services/Object/classes/class.ilObjectLP.php';
369 $olp = ilObjectLP::getInstance($this->getObjId());
370 $collection = $olp->getCollectionInstance();
371 if ($collection) {
372 $coll_items = $collection->getItems();
373 $possible_items = $collection->getPossibleItems($this->getRefId()); // for titles
374 }
375
376 include_once "Services/Tracking/classes/class.ilLPStatusFactory.php";
378 $info = $class::_getStatusInfo($this->getObjId(), true);
379
380 foreach ($coll_items as $item_id) {
381 // #16599 - deleted items should not be displayed
382 if (!array_key_exists($item_id, $possible_items)) {
383 continue;
384 }
385
386 $field = new ilCustomInputGUI($possible_items[$item_id]["title"]);
387
388 // lp status
390 if (isset($info["completed"][$item_id]) &&
391 in_array($ilUser->getId(), $info["completed"][$item_id])) {
393 } elseif (isset($info["in_progress"][$item_id]) &&
394 in_array($ilUser->getId(), $info["in_progress"][$item_id])) {
396 }
399 $field->setHtml(ilUtil::img($path, $text));
400
401 // stats
402 $spent = 0;
403 if (isset($info["tlt_users"][$item_id][$ilUser->getId()])) {
404 $spent = $info["tlt_users"][$item_id][$ilUser->getId()];
405 }
406 $needed = $info["tlt"][$item_id];
407 if ($needed) {
408 $field->setInfo(sprintf(
409 $lng->txt("trac_collection_tlt_learner_subitem"),
412 min(100, round(abs($spent) / $needed * 100))
413 ));
414 }
415
416 $form->addItem($field);
417 }
418
419 $tpl->setContent($form->getHTML());
420 }
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, $form, $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, and ilDatePresentation\secondsToString().

+ Here is the call graph for this function:

◆ updateManual()

ilLearningProgressGUI::updateManual ( )
protected

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

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

References $DIC, $form, $ilCtrl, 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: