ILIAS  release_8 Revision v8.19
All Data Structures Namespaces Files Functions Variables Modules Pages
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 31 of file class.ilSkillLearningHistoryProvider.php.

Constructor & Destructor Documentation

◆ __construct()

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

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

References $DIC, ilAbstractLearningHistoryProvider\$template, ILIAS\GlobalScreen\Provider\__construct(), and ILIAS\Repository\ctrl().

44  {
45  global $DIC;
46 
47  parent::__construct($user_id, $factory, $lng, $template);
48  $this->ctrl = $DIC->ctrl();
49  $this->ui_fac = $DIC->ui()->factory();
50  $this->ui_ren = $DIC->ui()->renderer();
51  $this->profile_manager = $DIC->skills()->internal()->manager()->getProfileManager();
52  $this->profile_completion_manager = $DIC->skills()->internal()->manager()->getProfileCompletionManager();
53  }
global $DIC
Definition: feed.php:28
__construct(Container $dic, ilPlugin $plugin)
+ 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 70 of file class.ilSkillLearningHistoryProvider.php.

References $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().

70  : array
71  {
72  $lng = $this->getLanguage();
73  $lng->loadLanguageModule("skll");
74  $from = new ilDateTime($ts_start, IL_CAL_UNIX);
75  $to = new ilDateTime($ts_end, IL_CAL_UNIX);
76 
77  // achievements
78  $completions = ilBasicSkill::getNewAchievementsPerUser($from->get(IL_CAL_DATETIME), $to->get(IL_CAL_DATETIME), $this->getUserId());
79 
80  $entries = [];
81  if (isset($completions[$this->getUserId()])) {
82  foreach ($completions[$this->getUserId()] as $c) {
83  $ts = new ilDateTime($c["status_date"], IL_CAL_DATETIME);
84  $text = str_replace("$3$", $this->getEmphasizedTitle(ilBasicSkill::_lookupTitle($c["skill_id"], $c["tref_id"])), $lng->txt("skll_lhist_skill_achieved"));
85  $text = str_replace("$4$", $this->getEmphasizedTitle(ilBasicSkill::lookupLevelTitle($c["level_id"])), $text);
86  $entries[] = $this->getFactory()->entry(
87  $text,
88  $text,
89  ilUtil::getImagePath("icon_skmg.svg"),
90  $ts->get(IL_CAL_UNIX),
91  $c["trigger_obj_id"]
92  );
93  }
94  }
95 
96  // self evaluations
97  $completions = ilBasicSkill::getNewAchievementsPerUser($from->get(IL_CAL_DATETIME), $to->get(IL_CAL_DATETIME), $this->getUserId(), 1);
98 
99  if (isset($completions[$this->getUserId()])) {
100  foreach ($completions[$this->getUserId()] as $c) {
101  $txt = ($c["trigger_obj_id"] > 0)
102  ? $lng->txt("skll_lhist_skill_self_eval_in")
103  : $lng->txt("skll_lhist_skill_self_eval");
104  $ts = new ilDateTime($c["status_date"], IL_CAL_DATETIME);
105  $text1 = str_replace("$3$", $this->getEmphasizedTitle(ilBasicSkill::_lookupTitle($c["skill_id"], $c["tref_id"])), $txt);
106  $text1 = str_replace("$4$", $this->getEmphasizedTitle(ilBasicSkill::lookupLevelTitle($c["level_id"])), $text1);
107  $entries[] = $this->getFactory()->entry(
108  $text1,
109  $text1,
110  ilUtil::getImagePath("icon_skmg.svg"),
111  $ts->get(IL_CAL_UNIX),
112  $c["trigger_obj_id"]
113  );
114  }
115  }
116 
117  // profiles
118  $completions = $this->profile_completion_manager->getFulfilledEntriesForUser($this->getUserId());
119 
120  foreach ($completions as $c) {
121  $this->ctrl->setParameterByClass("ilpersonalskillsgui", "profile_id", $c["profile_id"]);
122  $p_link = $this->ui_fac->link()->standard(
123  $this->profile_manager->lookupTitle($c["profile_id"]),
124  $this->ctrl->getLinkTargetByClass("ilpersonalskillsgui", "listassignedprofile")
125  );
126  $ts = new ilDateTime($c["date"], IL_CAL_DATETIME);
127  $text = str_replace(
128  "$3$",
129  $this->getEmphasizedTitle($this->ui_ren->render($p_link)),
130  $lng->txt("skll_lhist_skill_profile_fulfilled")
131  );
132  }
133 
134  return $entries;
135  }
const IL_CAL_DATETIME
$c
Definition: cli.php:38
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:13
+ Here is the call graph for this function:

◆ getName()

ilSkillLearningHistoryProvider::getName ( )

Implements ilLearningHistoryProviderInterface.

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

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

140  : string
141  {
142  $lng = $this->getLanguage();
143  $lng->loadLanguageModule("skmg");
144 
145  return $lng->txt("skills");
146  }
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 58 of file class.ilSkillLearningHistoryProvider.php.

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

Field Documentation

◆ $ctrl

ilCtrl ilSkillLearningHistoryProvider::$ctrl
protected

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

◆ $profile_completion_manager

SkillProfileCompletionManager ilSkillLearningHistoryProvider::$profile_completion_manager
protected

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

◆ $profile_manager

SkillProfileManager ilSkillLearningHistoryProvider::$profile_manager
protected

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

◆ $ui_fac

Factory ilSkillLearningHistoryProvider::$ui_fac
protected

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

◆ $ui_ren

Renderer ilSkillLearningHistoryProvider::$ui_ren
protected

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


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