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

Public Member Functions

 __construct (?\ilDBInterface $db=null, ?Service\SkillInternalFactoryService $factory_service=null)
 
 deleteProfileRoles (int $profile_id)
 
 get (int $profile_id)
 
 getRoleAssignmentFromRecord (array $rec)
 
 addRoleToProfile (int $profile_id, int $role_id)
 
 removeRoleFromProfile (int $profile_id, int $role_id)
 
 removeRoleFromAllProfiles (int $role_id)
 
 getAllProfilesOfRole (int $role_id)
 
 getGlobalProfilesOfRole (int $role_id)
 
 getLocalProfilesOfRole (int $role_id)
 
 countRoles (int $profile_id)
 

Protected Member Functions

 getProfileFromRecord (array $rec)
 
 getRoleProfileFromRecord (array $rec)
 

Protected Attributes

ilDBInterface $db
 
Service SkillInternalFactoryService $factory_service
 

Detailed Description

Definition at line 25 of file class.SkillProfileRoleDBRepository.php.

Constructor & Destructor Documentation

◆ __construct()

ILIAS\Skill\Profile\SkillProfileRoleDBRepository::__construct ( ?\ilDBInterface  $db = null,
?Service\SkillInternalFactoryService  $factory_service = null 
)

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

References ILIAS\Skill\Profile\SkillProfileRoleDBRepository\$db, $DIC, and ILIAS\Skill\Profile\SkillProfileRoleDBRepository\$factory_service.

33  {
34  global $DIC;
35 
36  $this->db = ($db) ?: $DIC->database();
37  $this->factory_service = ($factory_service) ?: $DIC->skills()->internal()->factory();
38  }
global $DIC
Definition: shib_login.php:22

Member Function Documentation

◆ addRoleToProfile()

ILIAS\Skill\Profile\SkillProfileRoleDBRepository::addRoleToProfile ( int  $profile_id,
int  $role_id 
)

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

References ILIAS\Skill\Profile\SkillProfileRoleDBRepository\$db, and $ilDB.

77  : void
78  {
79  $ilDB = $this->db;
80 
81  $ilDB->replace(
82  "skl_profile_role",
83  array("profile_id" => array("integer", $profile_id),
84  "role_id" => array("integer", $role_id),
85  ),
86  []
87  );
88  }

◆ countRoles()

ILIAS\Skill\Profile\SkillProfileRoleDBRepository::countRoles ( int  $profile_id)

Definition at line 214 of file class.SkillProfileRoleDBRepository.php.

References ILIAS\Skill\Profile\SkillProfileRoleDBRepository\$db, and $ilDB.

214  : int
215  {
216  $ilDB = $this->db;
217 
218  $set = $ilDB->query(
219  "SELECT count(*) rcnt FROM skl_profile_role " .
220  " WHERE profile_id = " . $ilDB->quote($profile_id, "integer")
221  );
222  $rec = $ilDB->fetchAssoc($set);
223  return (int) $rec["rcnt"];
224  }

◆ deleteProfileRoles()

ILIAS\Skill\Profile\SkillProfileRoleDBRepository::deleteProfileRoles ( int  $profile_id)

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

References ILIAS\Skill\Profile\SkillProfileRoleDBRepository\$db, and $ilDB.

40  : void
41  {
42  $ilDB = $this->db;
43 
44  $ilDB->manipulate(
45  "DELETE FROM skl_profile_role WHERE " .
46  " profile_id = " . $ilDB->quote($profile_id, "integer")
47  );
48  }

◆ get()

ILIAS\Skill\Profile\SkillProfileRoleDBRepository::get ( int  $profile_id)

Definition at line 50 of file class.SkillProfileRoleDBRepository.php.

References ILIAS\Skill\Profile\SkillProfileRoleDBRepository\$db, and $ilDB.

50  : array
51  {
52  $ilDB = $this->db;
53 
54  $set = $ilDB->query(
55  "SELECT * FROM skl_profile_role " .
56  " WHERE profile_id = " . $ilDB->quote($profile_id, "integer")
57  );
58  $roles = [];
59  while ($rec = $ilDB->fetchAssoc($set)) {
60  $roles[] = $rec;
61  }
62 
63  return $roles;
64  }

◆ getAllProfilesOfRole()

ILIAS\Skill\Profile\SkillProfileRoleDBRepository::getAllProfilesOfRole ( int  $role_id)
Returns
SkillRoleProfile[]

Definition at line 114 of file class.SkillProfileRoleDBRepository.php.

References ILIAS\Skill\Profile\SkillProfileRoleDBRepository\$db, $ilDB, ILIAS\Skill\Profile\SkillProfileRoleDBRepository\getRoleProfileFromRecord(), and ILIAS\Repository\int().

114  : array
115  {
116  $ilDB = $this->db;
117 
118  $profiles = [];
119  $set = $ilDB->query(
120  "SELECT spr.profile_id, spr.role_id, sp.title, sp.description, sp.ref_id, sp.skill_tree_id, sp.image_id " .
121  " FROM skl_profile_role spr INNER JOIN skl_profile sp ON (spr.profile_id = sp.id) " .
122  " WHERE spr.role_id = " . $ilDB->quote($role_id, "integer") .
123  " ORDER BY sp.title ASC"
124  );
125  while ($rec = $ilDB->fetchAssoc($set)) {
126  $profiles[(int) $rec["profile_id"]] = $this->getRoleProfileFromRecord($rec);
127  }
128  return $profiles;
129  }
+ Here is the call graph for this function:

◆ getGlobalProfilesOfRole()

ILIAS\Skill\Profile\SkillProfileRoleDBRepository::getGlobalProfilesOfRole ( int  $role_id)
Returns
SkillRoleProfile[]

Definition at line 134 of file class.SkillProfileRoleDBRepository.php.

References ILIAS\Skill\Profile\SkillProfileRoleDBRepository\$db, $ilDB, ILIAS\Skill\Profile\SkillProfileRoleDBRepository\getRoleProfileFromRecord(), and ILIAS\Repository\int().

134  : array
135  {
136  $ilDB = $this->db;
137 
138  $profiles = [];
139  $set = $ilDB->query(
140  "SELECT spr.profile_id, spr.role_id, sp.title, sp.description, sp.ref_id, sp.skill_tree_id, sp.image_id " .
141  " FROM skl_profile_role spr INNER JOIN skl_profile sp ON (spr.profile_id = sp.id) " .
142  " WHERE spr.role_id = " . $ilDB->quote($role_id, "integer") .
143  " AND sp.ref_id = 0" .
144  " ORDER BY sp.title ASC"
145  );
146  while ($rec = $ilDB->fetchAssoc($set)) {
147  $profiles[(int) $rec["profile_id"]] = $this->getRoleProfileFromRecord($rec);
148  }
149 
150  return $profiles;
151  }
+ Here is the call graph for this function:

◆ getLocalProfilesOfRole()

ILIAS\Skill\Profile\SkillProfileRoleDBRepository::getLocalProfilesOfRole ( int  $role_id)
Returns
SkillRoleProfile[]

Definition at line 156 of file class.SkillProfileRoleDBRepository.php.

References ILIAS\Skill\Profile\SkillProfileRoleDBRepository\$db, $ilDB, ILIAS\Skill\Profile\SkillProfileRoleDBRepository\getRoleProfileFromRecord(), and ILIAS\Repository\int().

156  : array
157  {
158  $ilDB = $this->db;
159 
160  $profiles = [];
161  $set = $ilDB->query(
162  "SELECT spr.profile_id, spr.role_id, sp.title, sp.description, sp.ref_id, sp.skill_tree_id, sp.image_id " .
163  " FROM skl_profile_role spr INNER JOIN skl_profile sp ON (spr.profile_id = sp.id) " .
164  " WHERE spr.role_id = " . $ilDB->quote($role_id, "integer") .
165  " AND sp.ref_id <> 0" .
166  " ORDER BY sp.title ASC"
167  );
168  while ($rec = $ilDB->fetchAssoc($set)) {
169  $profiles[(int) $rec["profile_id"]] = $this->getRoleProfileFromRecord($rec);
170  }
171  return $profiles;
172  }
+ Here is the call graph for this function:

◆ getProfileFromRecord()

ILIAS\Skill\Profile\SkillProfileRoleDBRepository::getProfileFromRecord ( array  $rec)
protected

Definition at line 174 of file class.SkillProfileRoleDBRepository.php.

References ILIAS\Repository\int().

174  : SkillProfile
175  {
176  $rec["id"] = (int) $rec["id"];
177  $rec["title"] = (string) $rec["title"];
178  $rec["description"] = (string) $rec["description"];
179  $rec["skill_tree_id"] = (int) $rec["skill_tree_id"];
180  $rec["image_id"] = (string) $rec["image_id"];
181  $rec["ref_id"] = (int) $rec["ref_id"];
182 
183  return $this->factory_service->profile()->profile(
184  $rec["id"],
185  $rec["title"],
186  $rec["description"],
187  $rec["skill_tree_id"],
188  $rec["image_id"],
189  $rec["ref_id"]
190  );
191  }
+ Here is the call graph for this function:

◆ getRoleAssignmentFromRecord()

ILIAS\Skill\Profile\SkillProfileRoleDBRepository::getRoleAssignmentFromRecord ( array  $rec)

Definition at line 66 of file class.SkillProfileRoleDBRepository.php.

66  : SkillProfileRoleAssignment
67  {
68  return $this->factory_service->profile()->profileRoleAssignment(
69  $rec["name"],
70  $rec["id"],
71  $rec["object_title"],
72  $rec["object_type"],
73  $rec["object_id"]
74  );
75  }

◆ getRoleProfileFromRecord()

ILIAS\Skill\Profile\SkillProfileRoleDBRepository::getRoleProfileFromRecord ( array  $rec)
protected

Definition at line 193 of file class.SkillProfileRoleDBRepository.php.

References ILIAS\Repository\int().

Referenced by ILIAS\Skill\Profile\SkillProfileRoleDBRepository\getAllProfilesOfRole(), ILIAS\Skill\Profile\SkillProfileRoleDBRepository\getGlobalProfilesOfRole(), and ILIAS\Skill\Profile\SkillProfileRoleDBRepository\getLocalProfilesOfRole().

193  : SkillRoleProfile
194  {
195  $rec["role_id"] = (int) $rec["role_id"];
196  $rec["profile_id"] = (int) $rec["profile_id"];
197  $rec["title"] = (string) $rec["title"];
198  $rec["description"] = (string) $rec["description"];
199  $rec["skill_tree_id"] = (int) $rec["skill_tree_id"];
200  $rec["image_id"] = (string) $rec["image_id"];
201  $rec["ref_id"] = (int) $rec["ref_id"];
202 
203  return $this->factory_service->profile()->roleProfile(
204  $rec["role_id"],
205  $rec["profile_id"],
206  $rec["title"],
207  $rec["description"],
208  $rec["skill_tree_id"],
209  $rec["image_id"],
210  $rec["ref_id"]
211  );
212  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ removeRoleFromAllProfiles()

ILIAS\Skill\Profile\SkillProfileRoleDBRepository::removeRoleFromAllProfiles ( int  $role_id)

Definition at line 101 of file class.SkillProfileRoleDBRepository.php.

References ILIAS\Skill\Profile\SkillProfileRoleDBRepository\$db, and $ilDB.

101  : void
102  {
103  $ilDB = $this->db;
104 
105  $ilDB->manipulate(
106  "DELETE FROM skl_profile_role WHERE " .
107  " role_id = " . $ilDB->quote($role_id, "integer")
108  );
109  }

◆ removeRoleFromProfile()

ILIAS\Skill\Profile\SkillProfileRoleDBRepository::removeRoleFromProfile ( int  $profile_id,
int  $role_id 
)

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

References ILIAS\Skill\Profile\SkillProfileRoleDBRepository\$db, and $ilDB.

90  : void
91  {
92  $ilDB = $this->db;
93 
94  $ilDB->manipulate(
95  "DELETE FROM skl_profile_role WHERE " .
96  " profile_id = " . $ilDB->quote($profile_id, "integer") .
97  " AND role_id = " . $ilDB->quote($role_id, "integer")
98  );
99  }

Field Documentation

◆ $db

◆ $factory_service

Service SkillInternalFactoryService ILIAS\Skill\Profile\SkillProfileRoleDBRepository::$factory_service
protected

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