ILIAS  trunk Revision v11.0_alpha-1866-gfa368f7776e
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
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)
 
 get (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

 getFromRecord (array $rec)
 

Protected Attributes

ilDBInterface $db
 
Service SkillInternalFactoryService $factory_service
 

Detailed Description

Definition at line 25 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 30 of file class.SkillProfileDBRepository.php.

References ILIAS\Skill\Profile\SkillProfileDBRepository\$db, $DIC, and ILIAS\Skill\Profile\SkillProfileDBRepository\$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

◆ createProfile()

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

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

References ILIAS\Skill\Profile\SkillProfileDBRepository\$db, $ilDB, ILIAS\Skill\Profile\SkillProfile\getDescription(), ILIAS\Skill\Profile\SkillProfile\getImageId(), ILIAS\Skill\Profile\SkillProfileDBRepository\getNextId(), ILIAS\Skill\Profile\SkillProfile\getRefId(), ILIAS\Skill\Profile\SkillProfile\getSkillTreeId(), and ILIAS\Skill\Profile\SkillProfile\getTitle().

84  : SkillProfile {
85  $ilDB = $this->db;
86 
87  $new_profile_id = $this->getNextId();
88  $ilDB->manipulate("INSERT INTO skl_profile " .
89  "(id, title, description, skill_tree_id, image_id, ref_id) VALUES (" .
90  $ilDB->quote($new_profile_id, "integer") . "," .
91  $ilDB->quote($profile->getTitle(), "text") . "," .
92  $ilDB->quote($profile->getDescription(), "text") . "," .
93  $ilDB->quote($profile->getSkillTreeId(), "integer") . "," .
94  $ilDB->quote($profile->getImageId(), "text") . "," .
95  $ilDB->quote($profile->getRefId(), "integer") .
96  ")");
97 
98  return $this->get($new_profile_id);
99  }
+ Here is the call graph for this function:

◆ deleteProfile()

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

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

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

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

◆ deleteProfilesFromObject()

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

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

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

129  : void
130  {
131  $ilDB = $this->db;
132 
133  $ilDB->manipulate(
134  "DELETE FROM skl_profile WHERE " .
135  " ref_id = " . $ilDB->quote($ref_id, "integer")
136  );
137  }
$ref_id
Definition: ltiauth.php:65

◆ get()

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

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

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

40  : SkillProfile
41  {
42  $ilDB = $this->db;
43 
44  $set = $ilDB->query(
45  "SELECT * FROM skl_profile " .
46  " WHERE id = " . $ilDB->quote($profile_id, "integer")
47  );
48 
49  if ($rec = $ilDB->fetchAssoc($set)) {
50  return $this->getFromRecord($rec);
51  }
52  throw new \ilSkillProfileNotFoundException("Profile with ID $profile_id not found.");
53  }
+ Here is the call graph for this function:

◆ getAllGlobalProfiles()

ILIAS\Skill\Profile\SkillProfileDBRepository::getAllGlobalProfiles ( )
Returns
SkillProfile[]

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

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

181  : array
182  {
183  $ilDB = $this->db;
184 
185  $set = $ilDB->query(
186  "SELECT * FROM skl_profile " .
187  " WHERE ref_id = 0 " .
188  " ORDER BY title "
189  );
190  $profiles = [];
191  while ($rec = $ilDB->fetchAssoc($set)) {
192  $profiles[] = $this->getFromRecord($rec);
193  }
194 
195  return $profiles;
196  }
+ Here is the call graph for this function:

◆ getFromRecord()

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

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

References ILIAS\Repository\int().

Referenced by ILIAS\Skill\Profile\SkillProfileDBRepository\get(), ILIAS\Skill\Profile\SkillProfileDBRepository\getAllGlobalProfiles(), ILIAS\Skill\Profile\SkillProfileDBRepository\getLocalProfilesForObject(), ILIAS\Skill\Profile\SkillProfileDBRepository\getProfilesForAllSkillTrees(), and ILIAS\Skill\Profile\SkillProfileDBRepository\getProfilesForSkillTree().

55  : SkillProfile
56  {
57  $rec["id"] = (int) $rec["id"];
58  $rec["title"] = (string) $rec["title"];
59  $rec["description"] = (string) $rec["description"];
60  $rec["skill_tree_id"] = (int) $rec["skill_tree_id"];
61  $rec["image_id"] = (string) $rec["image_id"];
62  $rec["ref_id"] = (int) $rec["ref_id"];
63 
64  return $this->factory_service->profile()->profile(
65  $rec["id"],
66  $rec["title"],
67  $rec["description"],
68  $rec["skill_tree_id"],
69  $rec["image_id"],
70  $rec["ref_id"]
71  );
72  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getLocalProfilesForObject()

ILIAS\Skill\Profile\SkillProfileDBRepository::getLocalProfilesForObject ( int  $ref_id)
Returns
SkillProfile[]

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

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

201  : array
202  {
203  $ilDB = $this->db;
204 
205  $set = $ilDB->query(
206  "SELECT * FROM skl_profile " .
207  " WHERE ref_id = " . $ref_id .
208  " ORDER BY title "
209  );
210  $profiles = [];
211  while ($rec = $ilDB->fetchAssoc($set)) {
212  $profiles[] = $this->getFromRecord($rec);
213  }
214 
215  return $profiles;
216  }
$ref_id
Definition: ltiauth.php:65
+ Here is the call graph for this function:

◆ getNextId()

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

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

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

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

74  : int
75  {
76  $ilDB = $this->db;
77 
78  $next_id = $ilDB->nextId("skl_profile");
79  return $next_id;
80  }
+ Here is the caller graph for this function:

◆ getProfilesForAllSkillTrees()

ILIAS\Skill\Profile\SkillProfileDBRepository::getProfilesForAllSkillTrees ( )
Returns
SkillProfile[]

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

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

142  : array
143  {
144  $ilDB = $this->db;
145 
146  $set = $ilDB->query(
147  "SELECT * FROM skl_profile " .
148  " ORDER BY title "
149  );
150  $profiles = [];
151  while ($rec = $ilDB->fetchAssoc($set)) {
152  $profiles[] = $this->getFromRecord($rec);
153  }
154 
155  return $profiles;
156  }
+ Here is the call graph for this function:

◆ getProfilesForSkillTree()

ILIAS\Skill\Profile\SkillProfileDBRepository::getProfilesForSkillTree ( int  $skill_tree_id)
Returns
SkillProfile[]

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

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

161  : array
162  {
163  $ilDB = $this->db;
164 
165  $set = $ilDB->query(
166  "SELECT * FROM skl_profile " .
167  " WHERE skill_tree_id = " . $ilDB->quote($skill_tree_id, "integer") .
168  " ORDER BY title "
169  );
170  $profiles = [];
171  while ($rec = $ilDB->fetchAssoc($set)) {
172  $profiles[] = $this->getFromRecord($rec);
173  }
174 
175  return $profiles;
176  }
+ Here is the call graph for this function:

◆ getTreeId()

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

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

References ILIAS\Skill\Profile\SkillProfileDBRepository\$db, and ilDBInterface\queryF().

246  : int
247  {
248  $db = $this->db;
249 
250  $set = $db->queryF(
251  "SELECT * FROM skl_profile " .
252  " WHERE id = %s ",
253  ["integer"],
254  [$profile_id]
255  );
256  $rec = $db->fetchAssoc($set);
257  return (int) ($rec["skill_tree_id"] ?? 0);
258  }
fetchAssoc(ilDBStatement $statement)
queryF(string $query, array $types, array $values)
+ Here is the call graph for this function:

◆ lookup()

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

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

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

218  : string
219  {
220  $ilDB = $this->db;
221 
222  $set = $ilDB->query(
223  "SELECT " . $field . " FROM skl_profile " .
224  " WHERE id = " . $ilDB->quote($id, "integer")
225  );
226  $rec = $ilDB->fetchAssoc($set);
227 
228  return (string) ($rec[$field] ?? "");
229  }
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23

◆ updateProfile()

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

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

References ILIAS\Skill\Profile\SkillProfileDBRepository\$db, $ilDB, ILIAS\Skill\Profile\SkillProfile\getDescription(), ILIAS\Skill\Profile\SkillProfile\getId(), ILIAS\Skill\Profile\SkillProfile\getImageId(), ILIAS\Skill\Profile\SkillProfile\getRefId(), and ILIAS\Skill\Profile\SkillProfile\getTitle().

103  : SkillProfile {
104  $ilDB = $this->db;
105 
106  // profile
107  $ilDB->manipulate(
108  "UPDATE skl_profile SET " .
109  " title = " . $ilDB->quote($profile->getTitle(), "text") . "," .
110  " description = " . $ilDB->quote($profile->getDescription(), "text") . "," .
111  " image_id = " . $ilDB->quote($profile->getImageId(), "text") .
112  " WHERE id = " . $ilDB->quote($profile->getId(), "integer") .
113  " AND ref_id = " . $ilDB->quote($profile->getRefId(), "integer")
114  );
115 
116  return $this->get($profile->getId());
117  }
+ Here is the call graph for this function:

◆ updateRefIdAfterImport()

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

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

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

231  : void
232  {
233  $ilDB = $this->db;
234 
235  $ilDB->update(
236  "skl_profile",
237  array(
238  "ref_id" => array("integer", $new_ref_id)
239  ),
240  array(
241  "id" => array("integer", $profile_id)
242  )
243  );
244  }

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: