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();
40 public function get(
int $profile_id): array
45 "SELECT * FROM skl_profile_user " .
46 " WHERE profile_id = " .
$ilDB->quote($profile_id,
"integer")
49 while ($rec =
$ilDB->fetchAssoc($set)) {
58 return $this->factory_service->profile()->profileUserAssignment(
70 array(
"profile_id" => array(
"integer", $profile_id),
71 "user_id" => array(
"integer", $user_id),
82 "DELETE FROM skl_profile_user WHERE " .
83 " profile_id = " .
$ilDB->quote($profile_id,
"integer") .
84 " AND user_id = " .
$ilDB->quote($user_id,
"integer")
93 "DELETE FROM skl_profile_user WHERE " .
94 " user_id = " .
$ilDB->quote($user_id,
"integer")
103 "DELETE FROM skl_profile_user WHERE " .
104 " profile_id = " .
$ilDB->quote($profile_id,
"integer")
117 "SELECT p.id, p.title, p.description, p.ref_id, p.skill_tree_id, p.image_id " .
118 " FROM skl_profile_user u JOIN skl_profile p ON (u.profile_id = p.id) " .
119 " WHERE u.user_id = " .
$ilDB->quote($user_id,
"integer") .
120 " ORDER BY p.title ASC" 122 while ($rec =
$ilDB->fetchAssoc($set)) {
126 return $user_profiles;
131 $rec[
"id"] = (
int) $rec[
"id"];
132 $rec[
"title"] = (string) $rec[
"title"];
133 $rec[
"description"] = (string) $rec[
"description"];
134 $rec[
"skill_tree_id"] = (
int) $rec[
"skill_tree_id"];
135 $rec[
"image_id"] = (string) $rec[
"image_id"];
136 $rec[
"ref_id"] = (
int) $rec[
"ref_id"];
138 return $this->factory_service->profile()->profile(
142 $rec[
"skill_tree_id"],
153 "SELECT count(*) ucnt FROM skl_profile_user " .
154 " WHERE profile_id = " .
$ilDB->quote($profile_id,
"integer")
156 $rec =
$ilDB->fetchAssoc($set);
157 return (
int) $rec[
"ucnt"];
removeUserFromAllProfiles(int $user_id)
addUserToProfile(int $profile_id, int $user_id)
getProfilesOfUser(int $user_id)
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
__construct(?\ilDBInterface $db=null, ?Service\SkillInternalFactoryService $factory_service=null)
Service SkillInternalFactoryService $factory_service
Skill internal factory service.
getProfileFromRecord(array $rec)
getFromRecord(array $rec)
deleteProfileUsers(int $profile_id)
countUsers(int $profile_id)
removeUserFromProfile(int $profile_id, int $user_id)