ILIAS  release_5-0 Revision 5.0.0-1144-gc4397b1f870
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)
 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 142 of file class.ilLearningProgressGUI.php.

143 {
144 global $ilAccess, $ilUser;
145
146 // #9857
148 {
149 return;
150 }
151
152 if(strlen($next_class = $this->ctrl->getNextClass()))
153 {
154 if($this->getMode() == self::LP_CONTEXT_PERSONAL_DESKTOP)
155 {
156 $_SESSION['il_lp_history'] = $next_class;
157 }
158 return $next_class;
159 }
160 switch($this->getMode())
161 {
163 return 'illplistofobjectsgui';
164
166 $cmd = $this->ctrl->getCmd();
167 if(in_array($cmd, array("editmanual", "updatemanual", "showtlt")))
168 {
169 return "";
170 }
171
172 // #12771
173 include_once './Services/Object/classes/class.ilObjectLP.php';
175 if(!$olp->isActive())
176 {
177 if(!($olp instanceof ilPluginLP) &&
178 $ilAccess->checkAccess('edit_learning_progress','',$this->getRefId()))
179 {
180 return 'illplistofsettingsgui';
181 }
182 else
183 {
184 return '';
185 }
186 }
187
188 if(!$this->anonymized &&
189 $ilAccess->checkAccess('read_learning_progress','',$this->getRefId()))
190 {
191 return 'illplistofobjectsgui';
192 }
193 if($ilAccess->checkAccess('edit_learning_progress','',$this->getRefId()))
194 {
195 return 'illplistofsettingsgui';
196 }
197 return 'illplistofprogressgui';
198
200
201 include_once("Services/Tracking/classes/class.ilObjUserTracking.php");
204
205 if($has_edit || $has_personal)
206 {
207 // default (#10928)
208 $tgt = null;
209 if($has_personal)
210 {
211 $tgt = 'illplistofprogressgui';
212 }
213 else if($has_edit)
214 {
215 $tgt = 'illplistofobjectsgui';
216 }
217
218 // validate session
219 switch($_SESSION['il_lp_history'])
220 {
221 case 'illplistofobjectsgui':
222 if(!$has_edit)
223 {
224 $_SESSION['il_lp_history'] = null;
225 }
226 break;
227
228 case 'illplistofprogressgui':
229 if(!$has_personal)
230 {
231 $_SESSION['il_lp_history'] = null;
232 }
233 break;
234 }
235
236 if($_SESSION['il_lp_history'])
237 {
238 return $_SESSION['il_lp_history'];
239 }
240 else if($tgt)
241 {
242 return $tgt;
243 }
244 }
245
246 // should not happen
247 ilUtil::redirect("ilias.php?baseClass=ilPersonalDesktopGUI");
248
252 {
253 return 'illplistofprogressgui';
254 }
255 break;
256 }
257 }
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
< a tabindex="-1" style="border-style: none;" href="#" title="Refresh Image" onclick="document.getElementById('siimage').src = './securimage_show.php?sid=' + Math.random(); this.blur(); return false">< img src="./images/refresh.png" alt="Reload Image" height="32" width="32" onclick="this.blur()" align="bottom" border="0"/></a >< br/>< strong > Enter Code *if($_SERVER['REQUEST_METHOD']=='POST' &&@ $_POST['do']=='contact') $_SESSION['ctform']['success']
$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(), 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 130 of file class.ilLearningProgressGUI.php.

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

Referenced by executeCommand().

+ Here is the caller graph for this function:

◆ editManual()

ilLearningProgressGUI::editManual ( )
protected

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

260 {
261 global $tpl;
262
263 include_once './Services/Tracking/classes/class.ilLearningProgressAccess.php';
265 {
266 include_once './Services/Object/classes/class.ilObjectLP.php';
268 if($olp->getCurrentMode() == ilLPObjSettings::LP_MODE_COLLECTION_MANUAL)
269 {
270 $form = $this->initCollectionManualForm();
271 $tpl->setContent($form->getHTML());
272 }
273 }
274 }
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
34 $this->ctrl->setReturn($this, "");
35
36 // E.g personal desktop mode needs locator header icon ...
37 $this->__buildHeader();
38 switch($this->__getNextClass())
39 {
40 case 'illplistofprogressgui':
41 include_once 'Services/Tracking/classes/repository_statistics/class.ilLPListOfProgressGUI.php';
42
43 $ilHelp->setScreenIdComponent("lp");
44
45 $this->__setSubTabs(self::LP_ACTIVE_PROGRESS);
46 $this->__setCmdClass('illplistofprogressgui');
47 $lop_gui = new ilLPListOfProgressGUI($this->getMode(),$this->getRefId(),$this->getUserId());
48 $this->ctrl->forwardCommand($lop_gui);
49 break;
50
51 case 'illplistofobjectsgui':
52 if($this->getRefId() &&
53 !$ilAccess->checkAccess('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 if($this->getRefId() &&
78 !$ilAccess->checkAccess('edit_learning_progress', '', $this->getRefId()))
79 {
80 return;
81 }
82
83 include_once 'Services/Tracking/classes/repository_statistics/class.ilLPListOfSettingsGUI.php';
84
85 $this->__setSubTabs(self::LP_ACTIVE_SETTINGS);
86 $los_gui = new ilLPListOfSettingsGUI($this->getMode(),$this->getRefId());
87 $this->__setCmdClass('illplistofsettingsgui');
88 $this->ctrl->forwardCommand($los_gui);
89 break;
90
91 case 'illpobjectstatisticsgui':
92 include_once 'Services/Tracking/classes/object_statistics/class.ilLPObjectStatisticsGUI.php';
93 if(stristr($this->ctrl->getCmd(), "access"))
94 {
95 $this->__setSubTabs(self::LP_ACTIVE_OBJSTATACCESS);
96 }
97 else if(stristr($this->ctrl->getCmd(), "types"))
98 {
99 $this->__setSubTabs(self::LP_ACTIVE_OBJSTATTYPES);
100 }
101 else if(stristr($this->ctrl->getCmd(), "daily"))
102 {
103 $this->__setSubTabs(self::LP_ACTIVE_OBJSTATDAILY);
104 }
105 else
106 {
107 $this->__setSubTabs(self::LP_ACTIVE_OBJSTATADMIN);
108 }
109 $this->__setCmdClass('illpobjectstatisticsgui');
110 $ost_gui = new ilLPObjectStatisticsGUI($this->getMode(),$this->getRefId());
111 $this->ctrl->forwardCommand($ost_gui);
112 break;
113
114 default:
115 $cmd = $this->ctrl->getCmd();
116 $this->$cmd();
117 $this->tpl->show(true);
118 break;
119 }
120
121 // E.G personal desktop mode needs $tpl->show();
122 $this->__buildFooter();
123
124
125 $ilBench->stop('LearningProgress','0000_Start');
126
127 return true;
128 }
Class ilLPListOfSettingsGUI.
global $ilBench
Definition: ilias.php:18

References $cmd, $ilBench, ilLearningProgressBaseGUI\__buildFooter(), ilLearningProgressBaseGUI\__buildHeader(), __getNextClass(), __setCmdClass(), ilLearningProgressBaseGUI\__setSubTabs(), 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 276 of file class.ilLearningProgressGUI.php.

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

References $changed, $ilCtrl, ilLearningProgressBaseGUI\$lng, $path, 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 387 of file class.ilLearningProgressGUI.php.

388 {
389 global $lng, $ilCtrl, $tpl, $ilUser;
390
391 include_once "Services/Form/classes/class.ilPropertyFormGUI.php";
392 $form = new ilPropertyFormGUI();
393 $form->setFormAction($ilCtrl->getFormAction($this, "showtlt"));
394 $form->setTitle($lng->txt("learning_progress"));
395 $form->setDescription($lng->txt("trac_collection_tlt_learner_info"));
396
397 $coll_items = array();
398
399 include_once './Services/Object/classes/class.ilObjectLP.php';
400 $olp = ilObjectLP::getInstance($this->getObjId());
401 $collection = $olp->getCollectionInstance();
402 if($collection)
403 {
404 $coll_items = $collection->getItems();
405 $possible_items = $collection->getPossibleItems($this->getRefId()); // for titles
406 }
407
408 include_once "Services/Tracking/classes/class.ilLPStatusFactory.php";
410 $info = $class::_getStatusInfo($this->getObjId(), true);
411
412 foreach($coll_items as $item_id)
413 {
414 // #16599 - deleted items should not be displayed
415 if(!array_key_exists($item_id, $possible_items))
416 {
417 continue;
418 }
419
420 $field = new ilCustomInputGUI($possible_items[$item_id]["title"]);
421
422 // lp status
424 if(isset($info["completed"][$item_id]) &&
425 in_array($ilUser->getId(), $info["completed"][$item_id]))
426 {
428 }
429 else if(isset($info["in_progress"][$item_id]) &&
430 in_array($ilUser->getId(), $info["in_progress"][$item_id]))
431 {
433 }
436 $field->setHtml(ilUtil::img($path, $text));
437
438 // stats
439 $spent = 0;
440 if(isset($info["tlt_users"][$item_id][$ilUser->getId()]))
441 {
442 $spent = $info["tlt_users"][$item_id][$ilUser->getId()];
443 }
444 $needed = $info["tlt"][$item_id];
445 if($needed)
446 {
447 $field->setInfo(sprintf($lng->txt("trac_collection_tlt_learner_subitem"),
450 min(100, round(abs($spent)/$needed*100))));
451 }
452
453 $form->addItem($field);
454 }
455
456 $tpl->setContent($form->getHTML());
457 }
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, ilLearningProgressBaseGUI\$lng, $path, 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 361 of file class.ilLearningProgressGUI.php.

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