ILIAS  trunk Revision v11.0_alpha-1831-g8615d53dadb
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
ILIAS\Skill\Personal\AssignedMaterialManager Class Reference
+ Inheritance diagram for ILIAS\Skill\Personal\AssignedMaterialManager:
+ Collaboration diagram for ILIAS\Skill\Personal\AssignedMaterialManager:

Public Member Functions

 __construct (?AssignedMaterialDBRepository $ass_mat_repo=null, ?PersonalSkillDBRepository $personal_repo=null)
 
 assignMaterial (int $user_id, int $top_skill_id, int $tref_id, int $basic_skill_id, int $level_id, int $wsp_id)
 Assign material to skill level. More...
 
 getAssignedMaterials (int $user_id, int $tref_id, int $level_id)
 Get assigned materials (for a skill level and user) More...
 
 getAllAssignedMaterialsForSkill (int $user_id, int $skill_id, int $tref_id)
 Get all assigned materials (for a skill and user) More...
 
 countAssignedMaterials (int $user_id, int $tref_id, int $level_id)
 Count assigned materials (for a skill level and user) More...
 
 removeAssignedMaterial (int $user_id, int $tref_id, int $level_id, int $wsp_id)
 
 removeAssignedMaterialsForUser (int $user_id)
 
 removeAssignedMaterialsForSkill (int $skill_node_id, bool $is_reference=false)
 

Static Public Member Functions

static getUsageInfo (array $a_cskill_ids)
 Get title of an assigned item.
Parameters
array{skill_idint, tref_id: int}[] $a_cskill_ids array of common skill ids
Returns
array<string, array<string, array{key: string}[]>>
More...
 

Protected Attributes

AssignedMaterialDBRepository $ass_mat_repo
 
PersonalSkillDBRepository $personal_repo
 

Detailed Description

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

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

Constructor & Destructor Documentation

◆ __construct()

ILIAS\Skill\Personal\AssignedMaterialManager::__construct ( ?AssignedMaterialDBRepository  $ass_mat_repo = null,
?PersonalSkillDBRepository  $personal_repo = null 
)

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

References ILIAS\Skill\Personal\AssignedMaterialManager\$ass_mat_repo, $DIC, and ILIAS\Skill\Personal\AssignedMaterialManager\$personal_repo.

36  {
37  global $DIC;
38 
39  $this->ass_mat_repo = ($ass_mat_repo) ?: $DIC->skills()->internal()->repo()->getAssignedMaterialRepo();
40  $this->personal_repo = ($personal_repo) ?: $DIC->skills()->internal()->repo()->getPersonalSkillRepo();
41  }
global $DIC
Definition: shib_login.php:22

Member Function Documentation

◆ assignMaterial()

ILIAS\Skill\Personal\AssignedMaterialManager::assignMaterial ( int  $user_id,
int  $top_skill_id,
int  $tref_id,
int  $basic_skill_id,
int  $level_id,
int  $wsp_id 
)

Assign material to skill level.

Parameters
int$user_iduser id
int$top_skill_idthe "selectable" top skill
int$tref_idtemplate reference id
int$basic_skill_idthe basic skill the level belongs to
int$level_idlevel id
int$wsp_idworkspace object

Definition at line 53 of file class.AssignedMaterialManager.php.

60  : void {
61  $this->ass_mat_repo->assign($user_id, $top_skill_id, $tref_id, $basic_skill_id, $level_id, $wsp_id);
62  }

◆ countAssignedMaterials()

ILIAS\Skill\Personal\AssignedMaterialManager::countAssignedMaterials ( int  $user_id,
int  $tref_id,
int  $level_id 
)

Count assigned materials (for a skill level and user)

Definition at line 85 of file class.AssignedMaterialManager.php.

85  : int
86  {
87  return $this->ass_mat_repo->count($user_id, $tref_id, $level_id);
88  }

◆ getAllAssignedMaterialsForSkill()

ILIAS\Skill\Personal\AssignedMaterialManager::getAllAssignedMaterialsForSkill ( int  $user_id,
int  $skill_id,
int  $tref_id 
)

Get all assigned materials (for a skill and user)

Returns
AssignedMaterial[]

Definition at line 77 of file class.AssignedMaterialManager.php.

77  : array
78  {
79  return $this->ass_mat_repo->getAll($user_id, $skill_id, $tref_id);
80  }

◆ getAssignedMaterials()

ILIAS\Skill\Personal\AssignedMaterialManager::getAssignedMaterials ( int  $user_id,
int  $tref_id,
int  $level_id 
)

Get assigned materials (for a skill level and user)

Returns
AssignedMaterial[]

Definition at line 68 of file class.AssignedMaterialManager.php.

68  : array
69  {
70  return $this->ass_mat_repo->get($user_id, $tref_id, $level_id);
71  }

◆ getUsageInfo()

static ILIAS\Skill\Personal\AssignedMaterialManager::getUsageInfo ( array  $a_cskill_ids)
static

Get title of an assigned item.

Parameters
array{skill_idint, tref_id: int}[] $a_cskill_ids array of common skill ids
Returns
array<string, array<string, array{key: string}[]>>

Implements ILIAS\Skill\Usage\SkillUsageInfo.

Definition at line 108 of file class.AssignedMaterialManager.php.

References $DIC, ilSkillTemplateReference\_lookupTemplateId(), ILIAS\Skill\Personal\PersonalSkillDBRepository\getUsages(), ILIAS\Repository\int(), and ILIAS\Skill\Usage\SkillUsageManager\USER_MATERIAL.

108  : array
109  {
110  global $DIC;
111 
112  $personal_repo = $DIC->skills()->internal()->repo()->getPersonalSkillRepo();
113  $usage_manager = $DIC->skills()->internal()->manager()->getUsageManager();
114 
115  // material
116  $usages = $usage_manager->getUsageInfoGeneric(
117  $a_cskill_ids,
119  "skl_assigned_material",
120  "user_id"
121  );
122 
123  // users that use the skills as personal skills
124  $pskill_ids = [];
125  $tref_ids = [];
126  foreach ($a_cskill_ids as $cs) {
127  $cs["tref_id"] = (int) $cs["tref_id"];
128  $cs["skill_id"] = (int) $cs["skill_id"];
129  if ($cs["tref_id"] > 0) {
130  if (\ilSkillTemplateReference::_lookupTemplateId($cs["tref_id"]) === $cs["skill_id"]) {
131  $pskill_ids[$cs["tref_id"]] = $cs["tref_id"];
132  $tref_ids[$cs["tref_id"]] = $cs["skill_id"];
133  }
134  } else {
135  $pskill_ids[$cs["skill_id"]] = $cs["skill_id"];
136  }
137  }
138  $usages = $personal_repo->getUsages($usages, $pskill_ids, $tref_ids);
139 
140  return $usages;
141  }
getUsages(array $usages, array $pskill_ids, array $tref_ids)
global $DIC
Definition: shib_login.php:22
+ Here is the call graph for this function:

◆ removeAssignedMaterial()

ILIAS\Skill\Personal\AssignedMaterialManager::removeAssignedMaterial ( int  $user_id,
int  $tref_id,
int  $level_id,
int  $wsp_id 
)

Definition at line 90 of file class.AssignedMaterialManager.php.

90  : void
91  {
92  $this->ass_mat_repo->remove($user_id, $tref_id, $level_id, $wsp_id);
93  }

◆ removeAssignedMaterialsForSkill()

ILIAS\Skill\Personal\AssignedMaterialManager::removeAssignedMaterialsForSkill ( int  $skill_node_id,
bool  $is_reference = false 
)

Definition at line 100 of file class.AssignedMaterialManager.php.

100  : void
101  {
102  $this->ass_mat_repo->removeAllForSkill($skill_node_id, $is_reference);
103  }

◆ removeAssignedMaterialsForUser()

ILIAS\Skill\Personal\AssignedMaterialManager::removeAssignedMaterialsForUser ( int  $user_id)

Definition at line 95 of file class.AssignedMaterialManager.php.

95  : void
96  {
97  $this->ass_mat_repo->removeAllForUser($user_id);
98  }

Field Documentation

◆ $ass_mat_repo

AssignedMaterialDBRepository ILIAS\Skill\Personal\AssignedMaterialManager::$ass_mat_repo
protected

◆ $personal_repo

PersonalSkillDBRepository ILIAS\Skill\Personal\AssignedMaterialManager::$personal_repo
protected

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