ILIAS  release_8 Revision v8.24
ILIAS\Skill\Profile\SkillProfileDBRepository Class Reference
+ Collaboration diagram for ILIAS\Skill\Profile\SkillProfileDBRepository:

Public Member Functions

 __construct (\ilDBInterface $db=null, Service\SkillInternalFactoryService $factory_service=null)
 
 getById (int $profile_id)
 
 getNextId ()
 
 createProfile (SkillProfile $profile)
 
 updateProfile (SkillProfile $profile)
 
 deleteProfile (int $profile_id)
 
 deleteProfilesFromObject (int $ref_id)
 
 getProfilesForAllSkillTrees ()
 
 getProfilesForSkillTree (int $skill_tree_id)
 
 getAllGlobalProfiles ()
 
 getLocalProfilesForObject (int $ref_id)
 
 lookup (int $id, string $field)
 
 updateRefIdAfterImport (int $profile_id, int $new_ref_id)
 
 getTreeId (int $profile_id)
 

Protected Member Functions

 getProfileFromRecord (array $rec)
 

Protected Attributes

ilDBInterface $db
 
Service SkillInternalFactoryService $factory_service
 

Detailed Description

Definition at line 24 of file class.SkillProfileDBRepository.php.

Constructor & Destructor Documentation

◆ __construct()

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

Definition at line 29 of file class.SkillProfileDBRepository.php.

30 {
31 global $DIC;
32
33 $this->db = ($db) ?: $DIC->database();
34 $this->factory_service = ($factory_service) ?: $DIC->skills()->internal()->factory();
35 }
global $DIC
Definition: feed.php:28

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

Member Function Documentation

◆ createProfile()

ILIAS\Skill\Profile\SkillProfileDBRepository::createProfile ( SkillProfile  $profile)

Definition at line 79 of file class.SkillProfileDBRepository.php.

81 : SkillProfile {
83
84 $new_profile_id = $this->getNextId();
85 $ilDB->manipulate("INSERT INTO skl_profile " .
86 "(id, title, description, skill_tree_id, image_id, ref_id) VALUES (" .
87 $ilDB->quote($new_profile_id, "integer") . "," .
88 $ilDB->quote($profile->getTitle(), "text") . "," .
89 $ilDB->quote($profile->getDescription(), "text") . "," .
90 $ilDB->quote($profile->getSkillTreeId(), "integer") . "," .
91 $ilDB->quote($profile->getImageId(), "text") . "," .
92 $ilDB->quote($profile->getRefId(), "integer") .
93 ")");
94
95 return $this->getById($new_profile_id);
96 }

◆ deleteProfile()

ILIAS\Skill\Profile\SkillProfileDBRepository::deleteProfile ( int  $profile_id)

Definition at line 116 of file class.SkillProfileDBRepository.php.

116 : void
117 {
119
120 $ilDB->manipulate(
121 "DELETE FROM skl_profile WHERE " .
122 " id = " . $ilDB->quote($profile_id, "integer")
123 );
124 }

References $ilDB.

◆ deleteProfilesFromObject()

ILIAS\Skill\Profile\SkillProfileDBRepository::deleteProfilesFromObject ( int  $ref_id)

Definition at line 126 of file class.SkillProfileDBRepository.php.

126 : void
127 {
129
130 $ilDB->manipulate(
131 "DELETE FROM skl_profile WHERE " .
132 " ref_id = " . $ilDB->quote($ref_id, "integer")
133 );
134 }
$ref_id
Definition: ltiauth.php:67

References $ilDB, and $ref_id.

◆ getAllGlobalProfiles()

ILIAS\Skill\Profile\SkillProfileDBRepository::getAllGlobalProfiles ( )

Definition at line 169 of file class.SkillProfileDBRepository.php.

169 : array
170 {
172
173 $set = $ilDB->query(
174 "SELECT * FROM skl_profile " .
175 " WHERE ref_id = 0 " .
176 " ORDER BY title "
177 );
178 $profiles = [];
179 while ($rec = $ilDB->fetchAssoc($set)) {
180 $profiles[$rec["id"]] = $rec;
181 }
182
183 return $profiles;
184 }

References $ilDB.

◆ getById()

ILIAS\Skill\Profile\SkillProfileDBRepository::getById ( int  $profile_id)

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

37 : SkillProfile
38 {
40
41 $set = $ilDB->query(
42 "SELECT * FROM skl_profile " .
43 " WHERE id = " . $ilDB->quote($profile_id, "integer")
44 );
45
46 if ($rec = $ilDB->fetchAssoc($set)) {
47 return $this->getProfileFromRecord($rec);
48 }
49 throw new \ilSkillProfileNotFoundException("Profile with ID $profile_id not found.");
50 }

References ILIAS\Skill\Profile\SkillProfileDBRepository\$db, $ilDB, and ILIAS\Skill\Profile\SkillProfileDBRepository\getProfileFromRecord().

+ Here is the call graph for this function:

◆ getLocalProfilesForObject()

ILIAS\Skill\Profile\SkillProfileDBRepository::getLocalProfilesForObject ( int  $ref_id)

Definition at line 186 of file class.SkillProfileDBRepository.php.

186 : array
187 {
189
190 $set = $ilDB->query(
191 "SELECT * FROM skl_profile " .
192 " WHERE ref_id = " . $ref_id .
193 " ORDER BY title "
194 );
195 $profiles = [];
196 while ($rec = $ilDB->fetchAssoc($set)) {
197 $profiles[$rec["id"]] = $rec;
198 }
199
200 return $profiles;
201 }

References $ilDB, and $ref_id.

◆ getNextId()

ILIAS\Skill\Profile\SkillProfileDBRepository::getNextId ( )

Definition at line 71 of file class.SkillProfileDBRepository.php.

71 : int
72 {
74
75 $next_id = $ilDB->nextId("skl_profile");
76 return $next_id;
77 }

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

◆ getProfileFromRecord()

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

Definition at line 52 of file class.SkillProfileDBRepository.php.

52 : SkillProfile
53 {
54 $rec["id"] = (int) $rec["id"];
55 $rec["title"] = (string) $rec["title"];
56 $rec["description"] = (string) $rec["description"];
57 $rec["skill_tree_id"] = (int) $rec["skill_tree_id"];
58 $rec["image_id"] = (string) $rec["image_id"];
59 $rec["ref_id"] = (int) $rec["ref_id"];
60
61 return $this->factory_service->profile(
62 $rec["id"],
63 $rec["title"],
64 $rec["description"],
65 $rec["skill_tree_id"],
66 $rec["image_id"],
67 $rec["ref_id"]
68 );
69 }

References ILIAS\Repository\int().

Referenced by ILIAS\Skill\Profile\SkillProfileDBRepository\getById().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getProfilesForAllSkillTrees()

ILIAS\Skill\Profile\SkillProfileDBRepository::getProfilesForAllSkillTrees ( )

Definition at line 136 of file class.SkillProfileDBRepository.php.

136 : array
137 {
139
140 $set = $ilDB->query(
141 "SELECT * FROM skl_profile " .
142 " ORDER BY title "
143 );
144 $profiles = [];
145 while ($rec = $ilDB->fetchAssoc($set)) {
146 $profiles[$rec["id"]] = $rec;
147 }
148
149 return $profiles;
150 }

References $ilDB.

◆ getProfilesForSkillTree()

ILIAS\Skill\Profile\SkillProfileDBRepository::getProfilesForSkillTree ( int  $skill_tree_id)

Definition at line 152 of file class.SkillProfileDBRepository.php.

152 : array
153 {
155
156 $set = $ilDB->query(
157 "SELECT * FROM skl_profile " .
158 " WHERE skill_tree_id = " . $ilDB->quote($skill_tree_id, "integer") .
159 " ORDER BY title "
160 );
161 $profiles = [];
162 while ($rec = $ilDB->fetchAssoc($set)) {
163 $profiles[$rec["id"]] = $rec;
164 }
165
166 return $profiles;
167 }

References $ilDB.

◆ getTreeId()

ILIAS\Skill\Profile\SkillProfileDBRepository::getTreeId ( int  $profile_id)

Definition at line 231 of file class.SkillProfileDBRepository.php.

231 : int
232 {
233 $db = $this->db;
234
235 $set = $db->queryF(
236 "SELECT * FROM skl_profile " .
237 " WHERE id = %s ",
238 ["integer"],
239 [$profile_id]
240 );
241 $rec = $db->fetchAssoc($set);
242 return (int) ($rec["skill_tree_id"] ?? 0);
243 }
fetchAssoc(ilDBStatement $statement)
queryF(string $query, array $types, array $values)

◆ lookup()

ILIAS\Skill\Profile\SkillProfileDBRepository::lookup ( int  $id,
string  $field 
)

Definition at line 203 of file class.SkillProfileDBRepository.php.

203 : string
204 {
206
207 $set = $ilDB->query(
208 "SELECT " . $field . " FROM skl_profile " .
209 " WHERE id = " . $ilDB->quote($id, "integer")
210 );
211 $rec = $ilDB->fetchAssoc($set);
212
213 return (string) ($rec[$field] ?? "");
214 }
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23

References $id, and $ilDB.

◆ updateProfile()

ILIAS\Skill\Profile\SkillProfileDBRepository::updateProfile ( SkillProfile  $profile)

Definition at line 98 of file class.SkillProfileDBRepository.php.

100 : SkillProfile {
102
103 // profile
104 $ilDB->manipulate(
105 "UPDATE skl_profile SET " .
106 " title = " . $ilDB->quote($profile->getTitle(), "text") . "," .
107 " description = " . $ilDB->quote($profile->getDescription(), "text") . "," .
108 " image_id = " . $ilDB->quote($profile->getImageId(), "text") .
109 " WHERE id = " . $ilDB->quote($profile->getId(), "integer") .
110 " AND ref_id = " . $ilDB->quote($profile->getRefId(), "integer")
111 );
112
113 return $this->getById($profile->getId());
114 }

◆ updateRefIdAfterImport()

ILIAS\Skill\Profile\SkillProfileDBRepository::updateRefIdAfterImport ( int  $profile_id,
int  $new_ref_id 
)

Definition at line 216 of file class.SkillProfileDBRepository.php.

216 : void
217 {
219
220 $ilDB->update(
221 "skl_profile",
222 array(
223 "ref_id" => array("integer", $new_ref_id)
224 ),
225 array(
226 "id" => array("integer", $profile_id)
227 )
228 );
229 }

References $ilDB.

Field Documentation

◆ $db

◆ $factory_service

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

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