ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
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 }
const IL_CAL_DATETIME
$from
const IL_CAL_UNIX
getEntries($ts_start, $ts_end)
Get entries.ilLearningHistoryEntry[]
static _enabledLearningProgress()
check wether learing progress is enabled or not
getName()
Get name of provider (in user language)string
Date and time handling
static getCompletionsOfUser($user_id, $from, $to)
Get completions of user.
Learning history provider: completed lp objects.