ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
ilSkillLearningHistoryProvider Class Reference

Learning history provider: Skills. More...

+ Inheritance diagram for ilSkillLearningHistoryProvider:
+ Collaboration diagram for ilSkillLearningHistoryProvider:

Public Member Functions

 isActive ()
 Is active?
Returns
bool
More...
 
 getEntries ($ts_start, $ts_end)
 Get entries.
Parameters
int$ts_start
int$ts_end
Returns
ilLearningHistoryEntry[]
More...
 
 getName ()
 Get name of provider (in user language)
Returns
string
More...
 
- Public Member Functions inherited from ilAbstractLearningHistoryProvider
 __construct ( $user_id, ilLearningHistoryFactory $factory, ilLanguage $lng, ilTemplate $template=null)
 Constructor. More...
 

Additional Inherited Members

- Protected Member Functions inherited from ilAbstractLearningHistoryProvider
 getUserId ()
 Get user id. More...
 
 getFactory ()
 Get factory. More...
 
 getLanguage ()
 Get language object. More...
 
 getEmphasizedTitle ($title)
 Get emphasized title. More...
 
- Protected Attributes inherited from ilAbstractLearningHistoryProvider
 $user_id
 
 $factory
 
 $lng
 

Detailed Description

Learning history provider: Skills.

Author
killi.nosp@m.ng@l.nosp@m.eifos.nosp@m..de

Definition at line 11 of file class.ilSkillLearningHistoryProvider.php.

Member Function Documentation

◆ getEntries()

ilSkillLearningHistoryProvider::getEntries (   $ts_start,
  $ts_end 
)

Get entries.

Parameters
int$ts_start
int$ts_end
Returns
ilLearningHistoryEntry[]

Implements ilLearningHistoryProviderInterface.

Definition at line 29 of file class.ilSkillLearningHistoryProvider.php.

References $c, $from, ilAbstractLearningHistoryProvider\$lng, $text, $txt, ilSkillTreeNode\_lookupTitle(), ilAbstractLearningHistoryProvider\getEmphasizedTitle(), ilAbstractLearningHistoryProvider\getFactory(), ilUtil\getImagePath(), ilAbstractLearningHistoryProvider\getLanguage(), ilBasicSkill\getNewAchievementsPerUser(), ilAbstractLearningHistoryProvider\getUserId(), IL_CAL_DATETIME, IL_CAL_UNIX, and ilBasicSkill\lookupLevelTitle().

30  {
31  $lng = $this->getLanguage();
32  $lng->loadLanguageModule("skll");
33  $from = new ilDateTime($ts_start, IL_CAL_UNIX);
34  $to = new ilDateTime($ts_end, IL_CAL_UNIX);
35 
36  // achievements
38 
39  $entries = [];
40  if (is_array($completions[$this->getUserId()])) {
41  foreach ($completions[$this->getUserId()] as $c) {
42  $ts = new ilDateTime($c["status_date"], IL_CAL_DATETIME);
43  $text = str_replace("$3$", $this->getEmphasizedTitle(ilBasicSkill::_lookupTitle($c["skill_id"], $c["tref_id"])), $lng->txt("skll_lhist_skill_achieved"));
44  $text = str_replace("$4$", $this->getEmphasizedTitle(ilBasicSkill::lookupLevelTitle($c["level_id"])), $text);
45  $entries[] = $this->getFactory()->entry(
46  $text,
47  $text,
48  ilUtil::getImagePath("icon_skmg.svg"),
49  $ts->get(IL_CAL_UNIX),
50  $c["trigger_obj_id"]
51  );
52  }
53  }
54 
55  // self evaluations
56  $completions = ilBasicSkill::getNewAchievementsPerUser($from->get(IL_CAL_DATETIME), $to->get(IL_CAL_DATETIME), $this->getUserId(), 1);
57 
58  if (is_array($completions[$this->getUserId()])) {
59  foreach ($completions[$this->getUserId()] as $c) {
60  $txt = ($c["trigger_obj_id"] > 0)
61  ? $lng->txt("skll_lhist_skill_self_eval_in")
62  : $lng->txt("skll_lhist_skill_self_eval");
63  $ts = new ilDateTime($c["status_date"], IL_CAL_DATETIME);
64  $text1 = str_replace("$3$", $this->getEmphasizedTitle(ilBasicSkill::_lookupTitle($c["skill_id"], $c["tref_id"])), $txt);
65  $text1 = str_replace("$4$", $this->getEmphasizedTitle(ilBasicSkill::lookupLevelTitle($c["level_id"])), $text1);
66  $entries[] = $this->getFactory()->entry(
67  $text1,
68  $text1,
69  ilUtil::getImagePath("icon_skmg.svg"),
70  $ts->get(IL_CAL_UNIX),
71  $c["trigger_obj_id"]
72  );
73  }
74  }
75  return $entries;
76  }
const IL_CAL_DATETIME
static lookupLevelTitle($a_id)
Lookup level title.
static getNewAchievementsPerUser($a_timestamp, $a_timestamp_to=null, $a_user_id=0, $a_self_eval=0)
Get new achievements.
$from
const IL_CAL_UNIX
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)
$text
Definition: errorreport.php:18
Date and time handling
$txt
Definition: error.php:11
static _lookupTitle($a_obj_id, $a_tref_id=0)
Lookup Title.
+ Here is the call graph for this function:

◆ getName()

ilSkillLearningHistoryProvider::getName ( )

Get name of provider (in user language)

Returns
string

Implements ilLearningHistoryProviderInterface.

Definition at line 81 of file class.ilSkillLearningHistoryProvider.php.

References ilAbstractLearningHistoryProvider\$lng, and ilAbstractLearningHistoryProvider\getLanguage().

81  : string
82  {
83  $lng = $this->getLanguage();
84  $lng->loadLanguageModule("skmg");
85 
86  return $lng->txt("skills");
87  }
+ Here is the call graph for this function:

◆ isActive()

ilSkillLearningHistoryProvider::isActive ( )

Is active?

Returns
bool

Implements ilLearningHistoryProviderInterface.

Definition at line 17 of file class.ilSkillLearningHistoryProvider.php.

18  {
19  $skmg_set = new ilSetting("skmg");
20  if ($skmg_set->get("enable_skmg")) {
21  return true;
22  }
23  return false;
24  }

The documentation for this class was generated from the following file: