ILIAS  release_7 Revision v7.30-3-g800a261c036
class.ilTrackingLearningHistoryProvider.php
Go to the documentation of this file.
1<?php
2
3/* Copyright (c) 1998-2018 ILIAS open source, Extended GPL, see docs/LICENSE */
4
12{
13
17 public function isActive()
18 {
19 include_once("Services/Tracking/classes/class.ilObjUserTracking.php");
22 return true;
23 }
24 return false;
25 }
26
30 public function getEntries($ts_start, $ts_end)
31 {
32 $lng = $this->getLanguage();
33 $lng->loadLanguageModule("trac");
34 $from = new ilDateTime($ts_start, IL_CAL_UNIX);
35 $to = new ilDateTime($ts_end, IL_CAL_UNIX);
36 $completions = ilLPMarks::getCompletionsOfUser($this->getUserId(), $from->get(IL_CAL_DATETIME), $to->get(IL_CAL_DATETIME));
37 $entries = [];
38 foreach ($completions as $c) {
39 $ts = new ilDateTime($c["status_changed"], IL_CAL_DATETIME);
40 $entries[] = $this->getFactory()->entry(
41 $lng->txt("trac_lhist_obj_completed"),
42 $lng->txt("trac_lhist_obj_completed_in"),
43 ilObject::_getIcon($c["obj_id"]),
44 $ts->get(IL_CAL_UNIX),
45 $c["obj_id"]
46 );
47 }
48 return $entries;
49 }
50
54 public function getName() : string
55 {
56 $lng = $this->getLanguage();
57 $lng->loadLanguageModule("lp");
58
59 return $lng->txt("learning_progress");
60 }
61}
An exception for terminatinating execution or to throw for unit testing.
const IL_CAL_UNIX
const IL_CAL_DATETIME
@classDescription Date and time handling
static getCompletionsOfUser($user_id, $from, $to)
Get completions of user.
static _enabledLearningProgress()
check wether learing progress is enabled or not
static _getIcon( $a_obj_id="", $a_size="big", $a_type="", $a_offline=false)
Get icon for repository item.
Learning history provider: completed lp objects.
getEntries($ts_start, $ts_end)
Get entries.ilLearningHistoryEntry[]
getName()
Get name of provider (in user language)string
$c
Definition: cli.php:37