ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
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 ()
 
 __construct (int $user_id, ilLearningHistoryFactory $factory, ilLanguage $lng, ?ilTemplate $template=null)
 
 isActive ()
 
 getEntries (int $ts_start, int $ts_end)
 
 getName ()
 

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 32 of file class.ilSkillLearningHistoryProvider.php.

Constructor & Destructor Documentation

◆ __construct()

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

Reimplemented from ilAbstractLearningHistoryProvider.

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

45 {
46 global $DIC;
47
49 $this->ctrl = $DIC->ctrl();
50 $this->ui_fac = $DIC->ui()->factory();
51 $this->ui_ren = $DIC->ui()->renderer();
52 $this->profile_manager = $DIC->skills()->internal()->manager()->getProfileManager();
53 $this->profile_completion_manager = $DIC->skills()->internal()->manager()->getProfileCompletionManager();
54 }
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
global $DIC
Definition: shib_login.php:26

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

+ 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 71 of file class.ilSkillLearningHistoryProvider.php.

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

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

+ Here is the call graph for this function:

◆ getName()

ilSkillLearningHistoryProvider::getName ( )

Implements ilLearningHistoryProviderInterface.

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

141 : string
142 {
143 $lng = $this->getLanguage();
144 $lng->loadLanguageModule("skmg");
145
146 return $lng->txt("skills");
147 }

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

+ Here is the call graph for this function:

◆ isActive()

ilSkillLearningHistoryProvider::isActive ( )

Implements ilLearningHistoryProviderInterface.

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

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

Field Documentation

◆ $ctrl

ilCtrl ilSkillLearningHistoryProvider::$ctrl
protected

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

◆ $profile_completion_manager

SkillProfileCompletionManager ilSkillLearningHistoryProvider::$profile_completion_manager
protected

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

◆ $profile_manager

SkillProfileManager ilSkillLearningHistoryProvider::$profile_manager
protected

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

◆ $ui_fac

Factory ilSkillLearningHistoryProvider::$ui_fac
protected

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

◆ $ui_ren

Renderer ilSkillLearningHistoryProvider::$ui_ren
protected

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


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