ILIAS  release_9 Revision v9.13-25-g2c18ec4c24f
ilSkillLearningHistoryProvider Class Reference

Learning history provider: Skills. More...

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

Public Member Functions

 __construct (int $user_id, ilLearningHistoryFactory $factory, ilLanguage $lng, ?ilTemplate $template=null)
 
 isActive ()
 
 getEntries (int $ts_start, int $ts_end)
 
 getName ()
 
- Public Member Functions inherited from ilAbstractLearningHistoryProvider
 __construct (int $user_id, ilLearningHistoryFactory $factory, ilLanguage $lng, ilTemplate $template=null)
 

Protected Attributes

ilCtrl $ctrl
 
Factory $ui_fac
 
Renderer $ui_ren
 
SkillProfileManager $profile_manager
 
SkillProfileCompletionManager $profile_completion_manager
 
- Protected Attributes inherited from ilAbstractLearningHistoryProvider
int $user_id
 
ilLearningHistoryFactory $factory
 
ilLanguage $lng
 

Additional Inherited Members

- Protected Member Functions inherited from ilAbstractLearningHistoryProvider
 getUserId ()
 
 getFactory ()
 
 getLanguage ()
 
 getEmphasizedTitle (string $title)
 

Detailed Description

Learning history provider: Skills.

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

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

Constructor & Destructor Documentation

◆ __construct()

ilSkillLearningHistoryProvider::__construct ( int  $user_id,
ilLearningHistoryFactory  $factory,
ilLanguage  $lng,
?ilTemplate  $template = null 
)

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

References $DIC, ilAbstractLearningHistoryProvider\$template, ILIAS\MetaData\Repository\Validation\Data\__construct(), and ILIAS\Repository\ctrl().

46  {
47  global $DIC;
48 
49  parent::__construct($user_id, $factory, $lng, $template);
50  $this->ctrl = $DIC->ctrl();
51  $this->ui_fac = $DIC->ui()->factory();
52  $this->ui_ren = $DIC->ui()->renderer();
53  $this->profile_manager = $DIC->skills()->internal()->manager()->getProfileManager();
54  $this->profile_completion_manager = $DIC->skills()->internal()->manager()->getProfileCompletionManager();
55  }
global $DIC
Definition: feed.php:28
__construct(VocabulariesInterface $vocabularies)
+ Here is the call graph for this function:

Member Function Documentation

◆ getEntries()

ilSkillLearningHistoryProvider::getEntries ( int  $ts_start,
int  $ts_end 
)

Implements ilLearningHistoryProviderInterface.

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

References Vendor\Package\$c, ilAbstractLearningHistoryProvider\$lng, $txt, ilSkillTreeNode\_lookupTitle(), ILIAS\Repository\ctrl(), ilAbstractLearningHistoryProvider\getEmphasizedTitle(), ilAbstractLearningHistoryProvider\getFactory(), ilUtil\getImagePath(), ilAbstractLearningHistoryProvider\getLanguage(), ilBasicSkill\getNewAchievementsPerUser(), ilAbstractLearningHistoryProvider\getUserId(), IL_CAL_DATETIME, IL_CAL_UNIX, ilLanguage\loadLanguageModule(), ilBasicSkill\lookupLevelTitle(), and ilLanguage\txt().

72  : array
73  {
74  $lng = $this->getLanguage();
75  $lng->loadLanguageModule("skll");
76  $from = new ilDateTime($ts_start, IL_CAL_UNIX);
77  $to = new ilDateTime($ts_end, IL_CAL_UNIX);
78 
79  // achievements
80  $completions = ilBasicSkill::getNewAchievementsPerUser($from->get(IL_CAL_DATETIME), $to->get(IL_CAL_DATETIME), $this->getUserId());
81 
82  $entries = [];
83  if (isset($completions[$this->getUserId()])) {
84  foreach ($completions[$this->getUserId()] as $c) {
85  $ts = new ilDateTime($c["status_date"], IL_CAL_DATETIME);
86  $text = str_replace("$3$", $this->getEmphasizedTitle(ilBasicSkill::_lookupTitle($c["skill_id"], $c["tref_id"])), $lng->txt("skll_lhist_skill_achieved"));
87  $text = str_replace("$4$", $this->getEmphasizedTitle(ilBasicSkill::lookupLevelTitle($c["level_id"])), $text);
88  $entries[] = $this->getFactory()->entry(
89  $text,
90  $text,
91  ilUtil::getImagePath("standard/icon_skmg.svg"),
92  $ts->get(IL_CAL_UNIX),
93  $c["trigger_obj_id"]
94  );
95  }
96  }
97 
98  // self evaluations
99  $completions = ilBasicSkill::getNewAchievementsPerUser($from->get(IL_CAL_DATETIME), $to->get(IL_CAL_DATETIME), $this->getUserId(), 1);
100 
101  if (isset($completions[$this->getUserId()])) {
102  foreach ($completions[$this->getUserId()] as $c) {
103  $txt = ($c["trigger_obj_id"] > 0)
104  ? $lng->txt("skll_lhist_skill_self_eval_in")
105  : $lng->txt("skll_lhist_skill_self_eval");
106  $ts = new ilDateTime($c["status_date"], IL_CAL_DATETIME);
107  $text1 = str_replace("$3$", $this->getEmphasizedTitle(ilBasicSkill::_lookupTitle($c["skill_id"], $c["tref_id"])), $txt);
108  $text1 = str_replace("$4$", $this->getEmphasizedTitle(ilBasicSkill::lookupLevelTitle($c["level_id"])), $text1);
109  $entries[] = $this->getFactory()->entry(
110  $text1,
111  $text1,
112  ilUtil::getImagePath("standard/icon_skmg.svg"),
113  $ts->get(IL_CAL_UNIX),
114  $c["trigger_obj_id"]
115  );
116  }
117  }
118 
119  // profiles
120  $completions = $this->profile_completion_manager->getFulfilledEntriesForUser($this->getUserId());
121 
122  foreach ($completions as $c) {
123  $this->ctrl->setParameterByClass("ilpersonalskillsgui", "profile_id", $c->getProfileId());
124  $p_link = $this->ui_fac->link()->standard(
125  $this->profile_manager->lookupTitle($c->getProfileId()),
126  $this->ctrl->getLinkTargetByClass("ilpersonalskillsgui", "listassignedprofile")
127  );
128  $ts = new ilDateTime($c->getDate(), IL_CAL_DATETIME);
129  $text = str_replace(
130  "$3$",
131  $this->getEmphasizedTitle($this->ui_ren->render($p_link)),
132  $lng->txt("skll_lhist_skill_profile_fulfilled")
133  );
134  }
135 
136  return $entries;
137  }
const IL_CAL_DATETIME
txt(string $a_topic, string $a_default_lang_fallback_mod="")
gets the text for a given topic if the topic is not in the list, the topic itself with "-" will be re...
static getImagePath(string $img, string $module_path="", string $mode="output", bool $offline=false)
get image path (for images located in a template directory)
static _lookupTitle(int $a_obj_id, int $a_tref_id=0)
loadLanguageModule(string $a_module)
Load language module.
static lookupLevelTitle(int $a_id)
const IL_CAL_UNIX
static getNewAchievementsPerUser(string $a_timestamp, string $a_timestamp_to=null, int $a_user_id=0, int $a_self_eval=0)
$txt
Definition: error.php:14
+ Here is the call graph for this function:

◆ getName()

ilSkillLearningHistoryProvider::getName ( )

Implements ilLearningHistoryProviderInterface.

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

References ilAbstractLearningHistoryProvider\$lng, ilAbstractLearningHistoryProvider\getLanguage(), ilLanguage\loadLanguageModule(), and ilLanguage\txt().

142  : string
143  {
144  $lng = $this->getLanguage();
145  $lng->loadLanguageModule("skmg");
146 
147  return $lng->txt("skills");
148  }
txt(string $a_topic, string $a_default_lang_fallback_mod="")
gets the text for a given topic if the topic is not in the list, the topic itself with "-" will be re...
loadLanguageModule(string $a_module)
Load language module.
+ Here is the call graph for this function:

◆ isActive()

ilSkillLearningHistoryProvider::isActive ( )

Implements ilLearningHistoryProviderInterface.

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

60  : bool
61  {
62  $skmg_set = new ilSetting("skmg");
63  if ($skmg_set->get("enable_skmg")) {
64  return true;
65  }
66  return false;
67  }

Field Documentation

◆ $ctrl

ilCtrl ilSkillLearningHistoryProvider::$ctrl
protected

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

◆ $profile_completion_manager

SkillProfileCompletionManager ilSkillLearningHistoryProvider::$profile_completion_manager
protected

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

◆ $profile_manager

SkillProfileManager ilSkillLearningHistoryProvider::$profile_manager
protected

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

◆ $ui_fac

Factory ilSkillLearningHistoryProvider::$ui_fac
protected

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

◆ $ui_ren

Renderer ilSkillLearningHistoryProvider::$ui_ren
protected

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


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