ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
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
 

Detailed Description

Member Function Documentation

◆ __getNextClass()

ilLearningProgressGUI::__getNextClass ( )

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

126 {
127 global $ilAccess, $ilUser;
128
129 // #9857
131 return;
132 }
133
134 if (strlen($next_class = $this->ctrl->getNextClass())) {
135 if ($this->getMode() == self::LP_CONTEXT_PERSONAL_DESKTOP) {
136 $_SESSION['il_lp_history'] = $next_class;
137 }
138 return $next_class;
139 }
140 switch ($this->getMode()) {
142 return 'illplistofobjectsgui';
143
145 $cmd = $this->ctrl->getCmd();
146 if (in_array($cmd, array("editManual", "updatemanual", "showtlt"))) {
147 return "";
148 }
149
150 // #12771
151 include_once './Services/Object/classes/class.ilObjectLP.php';
153 if (!$olp->isActive()) {
154 include_once './Services/Tracking/classes/class.ilLearningProgressAccess.php';
155 if (!($olp instanceof ilPluginLP) &&
156 ilLearningProgressAccess::checkPermission('edit_learning_progress', $this->getRefId())) {
157 return 'illplistofsettingsgui';
158 } else {
159 return '';
160 }
161 }
162
163 include_once './Services/Tracking/classes/class.ilLearningProgressAccess.php';
164 if (!$this->anonymized &&
165 ilLearningProgressAccess::checkPermission('read_learning_progress', $this->getRefId())) {
166 return 'illplistofobjectsgui';
167 }
168 if (
169 ilLearningProgressAccess::checkPermission('edit_learning_progress', $this->getRefId())) {
170 return 'illplistofsettingsgui';
171 }
172 return 'illplistofprogressgui';
173
175
176 include_once("Services/Tracking/classes/class.ilObjUserTracking.php");
179
180 if ($has_edit || $has_personal) {
181 // default (#10928)
182 $tgt = null;
183 if ($has_personal) {
184 $tgt = 'illplistofprogressgui';
185 } elseif ($has_edit) {
186 $tgt = 'illplistofobjectsgui';
187 }
188
189 // validate session
190 switch ($_SESSION['il_lp_history']) {
191 case 'illplistofobjectsgui':
192 if (!$has_edit) {
193 $_SESSION['il_lp_history'] = null;
194 }
195 break;
196
197 case 'illplistofprogressgui':
198 if (!$has_personal) {
199 $_SESSION['il_lp_history'] = null;
200 }
201 break;
202 }
203
204 if ($_SESSION['il_lp_history']) {
205 return $_SESSION['il_lp_history'];
206 } elseif ($tgt) {
207 return $tgt;
208 }
209 }
210
211 // should not happen
212 ilUtil::redirect("ilias.php?baseClass=ilPersonalDesktopGUI");
213
214 // no break
218 return 'illplistofprogressgui';
219 }
220 break;
221 }
222 }
$_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)
$ilUser
Definition: imgupload.php:18

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

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

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

229 {
230 global $tpl;
231
234 if ($olp->getCurrentMode() == ilLPObjSettings::LP_MODE_COLLECTION_MANUAL) {
236 $tpl->setContent($form->getHTML());
237 }
238 }
239 }
static checkAccess($a_ref_id, $a_allow_only_read=true)
check access to learning progress
if(isset($_POST['submit'])) $form

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

References $ilBench, 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 241 of file class.ilLearningProgressGUI.php.

242 {
243 global $lng, $ilCtrl;
244
245 include_once "Services/Form/classes/class.ilPropertyFormGUI.php";
246 $form = new ilPropertyFormGUI();
247 $form->setFormAction($ilCtrl->getFormAction($this, "updatemanual"));
248 $form->setTitle($lng->txt("learning_progress"));
249 $form->setDescription($lng->txt("trac_collection_manual_learner_info"));
250
251 $coll_items = array();
252
253 include_once './Services/Object/classes/class.ilObjectLP.php';
254 $olp = ilObjectLP::getInstance($this->getObjId());
255 $collection = $olp->getCollectionInstance();
256 if ($collection) {
257 $coll_items = $collection->getItems();
258 $possible_items = $collection->getPossibleItems($this->getRefId()); // for titles
259
260 switch (ilObject::_lookupType($this->getObjId())) {
261 case "lm":
262 $subitem_title = $lng->txt("objs_st");
263 $subitem_info = $lng->txt("trac_collection_manual_learner_lm_info");
264 break;
265 }
266 }
267
268 include_once "Services/Tracking/classes/class.ilLPStatusFactory.php";
270 $lp_data = $class::_getObjectStatus($this->getObjId(), $this->usr_id);
271
272 $grp = new ilCheckboxGroupInputGUI($subitem_title, "sids");
273 $grp->setInfo($subitem_info);
274 $form->addItem($grp);
275
276 // #14994 - using possible items for proper sorting
277
278 $completed = array();
279 foreach (array_keys($possible_items) as $item_id) {
280 if (!in_array($item_id, $coll_items)) {
281 continue;
282 }
283
284 $info = null;
286
287 if (isset($lp_data[$item_id])) {
288 $changed = new ilDateTime($lp_data[$item_id][1], IL_CAL_UNIX);
289 $info = $lng->txt("trac_collection_manual_learner_changed_ts") . ": " .
291
292 if ($lp_data[$item_id][0]) {
294 $completed[] = $item_id;
295 }
296 }
297
300 $icon = ilUtil::img($path, $text);
301
302 $opt = new ilCheckboxOption($icon . " " . $possible_items[$item_id]["title"], $item_id);
303 if ($info) {
304 $opt->setInfo($info);
305 }
306 $grp->addOption($opt);
307 }
308
309 if ($completed) {
310 $grp->setValue($completed);
311 }
312
313 $form->addCommandButton("updatemanual", $lng->txt("save"));
314
315 return $form;
316 }
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)
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="", $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, $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 341 of file class.ilLearningProgressGUI.php.

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

+ Here is the call graph for this function:

◆ updateManual()

ilLearningProgressGUI::updateManual ( )
protected

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

319 {
320 global $ilCtrl, $lng;
321
322 include_once './Services/Tracking/classes/class.ilLearningProgressAccess.php';
324 include_once './Services/Object/classes/class.ilObjectLP.php';
326 if ($olp->getCurrentMode() == ilLPObjSettings::LP_MODE_COLLECTION_MANUAL) {
328 if ($form->checkInput()) {
329 include_once "Services/Tracking/classes/class.ilLPStatusFactory.php";
331 $class::_setObjectStatus($this->getObjId(), $this->usr_id, $form->getInput("sids"));
332
333 ilUtil::sendSuccess($lng->txt("settings_saved"), true);
334 }
335
336 $ilCtrl->redirect($this, "editManual");
337 }
338 }
339 }
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.

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