19 declare(strict_types=1);
32 protected \ilDBInterface
$db;
43 $this->db = (
$db) ?: $DIC->database();
44 $this->factory_service = (
$factory_service) ?: $DIC->skills()->internal()->factory();
55 "SELECT * FROM skl_personal_skill " .
59 while ($rec =
$ilDB->fetchAssoc($set)) {
60 $skill_node_id = (
int) $rec[
"skill_node_id"];
61 if ($this->tree_repo->isInAnyTree($skill_node_id)) {
70 $skill_node_id = (
int) $rec[
"skill_node_id"];
72 return $this->factory_service->personal()->selectedUserSkill(
83 "SELECT * FROM skl_personal_skill " .
84 " WHERE user_id = " .
$ilDB->quote($user_id,
"integer") .
85 " AND skill_node_id = " .
$ilDB->quote($skill_node_id,
"integer")
87 if (!
$ilDB->fetchAssoc($set)) {
88 $ilDB->manipulate(
"INSERT INTO skl_personal_skill " .
89 "(user_id, skill_node_id) VALUES (" .
90 $ilDB->quote($user_id,
"integer") .
"," .
91 $ilDB->quote($skill_node_id,
"integer") .
96 public function remove(
int $user_id,
int $skill_node_id):
void 101 "DELETE FROM skl_personal_skill WHERE " .
102 " user_id = " .
$ilDB->quote($user_id,
"integer") .
103 " AND skill_node_id = " .
$ilDB->quote($skill_node_id,
"integer")
112 "DELETE FROM skl_personal_skill WHERE " .
113 " user_id = " .
$ilDB->quote($user_id,
"integer")
122 "DELETE FROM skl_personal_skill WHERE " .
123 " skill_node_id = " .
$ilDB->quote($skill_node_id,
"integer")
134 public function getUsages(array $usages, array $pskill_ids, array $tref_ids): array
139 "SELECT skill_node_id, user_id FROM skl_personal_skill " .
140 " WHERE " .
$ilDB->in(
"skill_node_id", $pskill_ids,
false,
"integer") .
141 " GROUP BY skill_node_id, user_id" 143 while ($rec =
$ilDB->fetchAssoc($set)) {
144 if (isset($tref_ids[(
int) $rec[
"skill_node_id"]])) {
146 array(
"key" => $rec[
"user_id"]);
149 array(
"key" => $rec[
"user_id"]);
__construct(\ilSkillTreeRepository $tree_repo, ?\ilDBInterface $db=null, ?Service\SkillInternalFactoryService $factory_service=null)
static _lookupTitle(int $a_obj_id, int $a_tref_id=0)
Service SkillInternalFactoryService $factory_service
removeAllForUser(int $user_id)
getUsages(array $usages, array $pskill_ids, array $tref_ids)
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
ilSkillTreeRepository $tree_repo
Skill internal factory service.
removeAllForSkill(int $skill_node_id)
add(int $user_id, int $skill_node_id)
getFromRecord(array $rec)