3 declare(strict_types=1);
33 protected \ilDBInterface
$db;
42 $this->db = (
$db) ?: $DIC->database();
43 $this->factory_service = (
$factory_service) ?: $DIC->skills()->internal()->factory();
50 public function getEntries(
int $user_id,
int $profile_id): array
55 "SELECT * FROM skl_profile_completion " .
56 " WHERE profile_id = " .
$ilDB->quote($profile_id,
"integer") .
57 " AND user_id = " .
$ilDB->quote($user_id,
"integer")
60 while ($rec =
$ilDB->fetchAssoc($set)) {
69 $rec[
"profile_id"] = (
int) $rec[
"profile_id"];
70 $rec[
"user_id"] = (
int) $rec[
"user_id"];
71 $rec[
"fulfilled"] = (bool) $rec[
"fulfilled"];
73 return $this->factory_service->profile()->profileCompletion(
89 "SELECT * FROM skl_profile_completion " .
90 " WHERE profile_id = " .
$ilDB->quote($profile_id,
"integer") .
91 " AND user_id = " .
$ilDB->quote($user_id,
"integer") .
92 " ORDER BY date DESC" .
97 while ($rec =
$ilDB->fetchAssoc($set)) {
98 $entry = $rec[
"fulfilled"];
103 $ilDB->manipulate(
"INSERT INTO skl_profile_completion " .
104 "(profile_id, user_id, date, fulfilled) VALUES (" .
105 $ilDB->quote($profile_id,
"integer") .
"," .
106 $ilDB->quote($user_id,
"integer") .
"," .
107 $ilDB->quote($now,
"timestamp") .
"," .
108 $ilDB->quote(1,
"integer") .
121 "SELECT * FROM skl_profile_completion " .
122 " WHERE profile_id = " .
$ilDB->quote($profile_id,
"integer") .
123 " AND user_id = " .
$ilDB->quote($user_id,
"integer") .
124 " ORDER BY date DESC" .
129 while ($rec =
$ilDB->fetchAssoc($set)) {
130 $entry = $rec[
"fulfilled"];
133 if (is_null($entry) || $entry == 1) {
135 $ilDB->manipulate(
"INSERT INTO skl_profile_completion " .
136 "(profile_id, user_id, date, fulfilled) VALUES (" .
137 $ilDB->quote($profile_id,
"integer") .
"," .
138 $ilDB->quote($user_id,
"integer") .
"," .
139 $ilDB->quote($now,
"timestamp") .
"," .
140 $ilDB->quote(0,
"integer") .
154 "SELECT * FROM skl_profile_completion " .
155 " WHERE user_id = " .
$ilDB->quote($user_id,
"integer") .
159 while ($rec =
$ilDB->fetchAssoc($set)) {
175 "SELECT * FROM skl_profile_completion " .
176 " WHERE user_id = " .
$ilDB->quote($user_id,
"integer")
179 while ($rec =
$ilDB->fetchAssoc($set)) {
195 "SELECT * FROM skl_profile_completion " .
196 " WHERE profile_id = " .
$ilDB->quote($profile_id,
"integer")
199 while ($rec =
$ilDB->fetchAssoc($set)) {
214 "DELETE FROM skl_profile_completion WHERE " 215 .
" profile_id = " .
$ilDB->quote($profile_id,
"integer")
227 "DELETE FROM skl_profile_completion WHERE " 228 .
" user_id = " .
$ilDB->quote($user_id,
"integer")
getFromRecord(array $rec)
getFulfilledEntriesForUser(int $user_id)
Get all fulfilled profile completion entries for a user.
deleteEntriesForProfile(int $profile_id)
Delete all profile completion entries for a profile.
getAllEntriesForProfile(int $profile_id)
Get all completion entries for a single profile.
getAllEntriesForUser(int $user_id)
Get all profile completion entries for a user.
static now()
Return current timestamp in Y-m-d H:i:s format.
deleteEntriesForUser(int $user_id)
Delete all profile completion entries for a user.
Service SkillInternalFactoryService $factory_service
__construct(\ilDBInterface $db=null, Service\SkillInternalFactoryService $factory_service=null)
getEntries(int $user_id, int $profile_id)
Get profile completion entries for given user-profile-combination.
Repository for skill profile completion.
Skill internal factory service.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
addNonFulfilmentEntry(int $user_id, int $profile_id)
Add profile non-fulfilment entry to given user-profile-combination.
addFulfilmentEntry(int $user_id, int $profile_id)
Add profile fulfilment entry to given user-profile-combination.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...