ILIAS  release_9 Revision v9.13-25-g2c18ec4c24f
ILIAS\Skill\Level\SkillUserLevelManager Class Reference

Skill user level manager. More...

+ Collaboration diagram for ILIAS\Skill\Level\SkillUserLevelManager:

Public Member Functions

 __construct (\ilSkillLevelRepository $a_level_repo=null, \ilSkillUserLevelRepository $a_user_level_repo=null, \ilSkillObjectAdapterInterface $a_obj_adapter=null)
 
 writeSkillLevel (int $user_id, int $a_level_id, int $a_trigger_ref_id, int $a_tref_id, bool $a_self_eval, string $a_unique_identifier, float $a_next_level_fulfilment)
 

Protected Attributes

ilSkillLevelRepository $level_repo
 
ilSkillUserLevelRepository $user_level_repo
 
ilSkillObjectAdapterInterface $obj_adapter
 

Detailed Description

Skill user level manager.

Author
famul.nosp@m.a@le.nosp@m.ifos..nosp@m.de

Definition at line 28 of file class.SkillUserLevelManager.php.

Constructor & Destructor Documentation

◆ __construct()

ILIAS\Skill\Level\SkillUserLevelManager::__construct ( \ilSkillLevelRepository  $a_level_repo = null,
\ilSkillUserLevelRepository  $a_user_level_repo = null,
\ilSkillObjectAdapterInterface  $a_obj_adapter = null 
)

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

References $DIC.

38  {
39  global $DIC;
40 
41  $this->level_repo = ($a_level_repo) ?: $DIC->skills()->internal()->repo()->getLevelRepo();
42  $this->user_level_repo = ($a_user_level_repo) ?: $DIC->skills()->internal()->repo()->getUserLevelRepo();
43  $this->obj_adapter = ($a_obj_adapter) ?: new \ilSkillObjectAdapter();
44  }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
global $DIC
Definition: feed.php:28

Member Function Documentation

◆ writeSkillLevel()

ILIAS\Skill\Level\SkillUserLevelManager::writeSkillLevel ( int  $user_id,
int  $a_level_id,
int  $a_trigger_ref_id,
int  $a_tref_id,
bool  $a_self_eval,
string  $a_unique_identifier,
float  $a_next_level_fulfilment 
)

Definition at line 46 of file class.SkillUserLevelManager.php.

54  : void {
55  $skill_id = $this->level_repo->lookupLevelSkillId($a_level_id);
56  $trigger_ref_id = $a_trigger_ref_id;
57  $trigger_obj_id = $this->obj_adapter->getObjIdForRefId($trigger_ref_id);
58  $trigger_title = $this->obj_adapter->getTitleForObjId($trigger_obj_id);
59  $trigger_type = $this->obj_adapter->getTypeForObjId($trigger_obj_id);
60 
61  //next level percentage fulfilment value must be >=0 and <1
62  if (!($a_next_level_fulfilment >= 0) || !($a_next_level_fulfilment < 1)) {
63  throw new \UnexpectedValueException(
64  "Next level fulfilment must be equal to or greater than 0 and less than 1, '" .
65  $a_next_level_fulfilment . "' given."
66  );
67  }
68 
69  $status_date = "";
70  $update = false;
71 
72  // self evaluations will update, if the last self evaluation is on the same day
73  if ($a_self_eval && $this->user_level_repo->hasRecentSelfEvaluation(
74  $trigger_obj_id,
75  $user_id,
76  $skill_id,
77  $a_tref_id,
78  $trigger_ref_id
79  )) {
80  $status_date = $this->user_level_repo->hasRecentSelfEvaluation(
81  $trigger_obj_id,
82  $user_id,
83  $skill_id,
84  $a_tref_id,
85  $trigger_ref_id
86  );
87  if ($status_date != "") {
88  $update = true;
89  }
90  }
91 
92  $this->user_level_repo->writeUserSkillLevelStatus(
93  $skill_id,
94  $trigger_ref_id,
95  $trigger_obj_id,
96  $trigger_title,
97  $trigger_type,
98  $update,
99  $status_date,
100  $a_level_id,
101  $user_id,
102  $a_tref_id,
103  $a_self_eval,
104  $a_unique_identifier,
105  $a_next_level_fulfilment
106  );
107  }

Field Documentation

◆ $level_repo

ilSkillLevelRepository ILIAS\Skill\Level\SkillUserLevelManager::$level_repo
protected

Definition at line 30 of file class.SkillUserLevelManager.php.

◆ $obj_adapter

ilSkillObjectAdapterInterface ILIAS\Skill\Level\SkillUserLevelManager::$obj_adapter
protected

Definition at line 32 of file class.SkillUserLevelManager.php.

◆ $user_level_repo

ilSkillUserLevelRepository ILIAS\Skill\Level\SkillUserLevelManager::$user_level_repo
protected

Definition at line 31 of file class.SkillUserLevelManager.php.


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