19 declare(strict_types=1);
27 protected \ilDBInterface
$db;
36 $this->db = (
$db) ?: $DIC->database();
37 $this->factory_service = (
$factory_service) ?: $DIC->skills()->internal()->factory();
45 "SELECT * FROM skl_profile " .
46 " WHERE id = " .
$ilDB->quote($profile_id,
"integer")
49 if ($rec =
$ilDB->fetchAssoc($set)) {
52 throw new \ilSkillProfileNotFoundException(
"Profile with ID $profile_id not found.");
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"];
64 return $this->factory_service->profile()->profile(
68 $rec[
"skill_tree_id"],
78 $next_id =
$ilDB->nextId(
"skl_profile");
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") .
"," .
98 return $this->
get($new_profile_id);
108 "UPDATE skl_profile SET " .
109 " title = " .
$ilDB->quote($profile->
getTitle(),
"text") .
"," .
112 " WHERE id = " .
$ilDB->quote($profile->
getId(),
"integer") .
113 " AND ref_id = " .
$ilDB->quote($profile->
getRefId(),
"integer")
116 return $this->
get($profile->
getId());
124 "DELETE FROM skl_profile WHERE " .
125 " id = " .
$ilDB->quote($profile_id,
"integer")
134 "DELETE FROM skl_profile WHERE " .
135 " ref_id = " .
$ilDB->quote($ref_id,
"integer")
147 "SELECT * FROM skl_profile " .
151 while ($rec =
$ilDB->fetchAssoc($set)) {
166 "SELECT * FROM skl_profile " .
167 " WHERE skill_tree_id = " .
$ilDB->quote($skill_tree_id,
"integer") .
171 while ($rec =
$ilDB->fetchAssoc($set)) {
186 "SELECT * FROM skl_profile " .
187 " WHERE ref_id = 0 " .
191 while ($rec =
$ilDB->fetchAssoc($set)) {
206 "SELECT * FROM skl_profile " .
207 " WHERE ref_id = " . $ref_id .
211 while ($rec =
$ilDB->fetchAssoc($set)) {
223 "SELECT " . $field .
" FROM skl_profile " .
224 " WHERE id = " .
$ilDB->quote($id,
"integer")
226 $rec =
$ilDB->fetchAssoc($set);
228 return (
string) ($rec[$field] ??
"");
238 "ref_id" => array(
"integer", $new_ref_id)
241 "id" => array(
"integer", $profile_id)
251 "SELECT * FROM skl_profile " .
256 $rec = $db->fetchAssoc($set);
257 return (
int) ($rec[
"skill_tree_id"] ?? 0);
updateRefIdAfterImport(int $profile_id, int $new_ref_id)
getProfilesForAllSkillTrees()
deleteProfile(int $profile_id)
getLocalProfilesForObject(int $ref_id)
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
getTreeId(int $profile_id)
Skill internal factory service.
queryF(string $query, array $types, array $values)
__construct(?\ilDBInterface $db=null, ?Service\SkillInternalFactoryService $factory_service=null)
Service SkillInternalFactoryService $factory_service
getProfilesForSkillTree(int $skill_tree_id)
deleteProfilesFromObject(int $ref_id)
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
getFromRecord(array $rec)
createProfile(SkillProfile $profile)
updateProfile(SkillProfile $profile)
lookup(int $id, string $field)