19 declare(strict_types=1);
41 int $a_source_inst_id,
42 int $a_skill_import_id,
43 int $a_tref_import_id = 0
48 if ($a_tref_import_id > 0) {
49 $skill_node_type =
"sktp";
52 $set =
$ilDB->query(
"SELECT * FROM skl_tree_node n JOIN skl_tree t ON (n.obj_id = t.child) " .
53 " WHERE n.import_id = " .
$ilDB->quote(
54 "il_" . ($a_source_inst_id) .
"_sktr_" . $a_tref_import_id,
57 " ORDER BY n.creation_date DESC ");
58 while ($rec =
$ilDB->fetchAssoc($set)) {
60 $template_ids[$t] = (
int) $rec[
"obj_id"];
64 $skill_node_type =
"skll";
66 $set =
$ilDB->query(
"SELECT * FROM skl_tree_node n JOIN skl_tree t ON (n.obj_id = t.child) " .
67 " WHERE n.import_id = " .
$ilDB->quote(
68 "il_" . ($a_source_inst_id) .
"_" . $skill_node_type .
"_" . $a_skill_import_id,
71 " ORDER BY n.creation_date DESC ");
73 while ($rec =
$ilDB->fetchAssoc($set)) {
75 if ($a_tref_import_id > 0) {
76 $tree = $this->tree_factory->getTreeById((
int) $rec[
"skl_tree_id"]);
77 $skill_template_id = $tree->getTopParentNodeId((
int) $rec[
"obj_id"]);
80 foreach ($template_ids as $templ => $tref) {
81 if ($skill_template_id == $templ) {
82 $matching_trefs[] = $tref;
86 $matching_trefs = array(0);
89 foreach ($matching_trefs as $t) {
90 $results[] = array(
"skill_id" => (
int) $rec[
"obj_id"],
92 "creation_date" => $rec[
"creation_date"]
106 $set =
$ilDB->query(
"SELECT * FROM skl_level l JOIN skl_tree t ON (l.skill_id = t.child) " .
107 " WHERE l.import_id = " .
$ilDB->quote(
108 "il_" . $a_source_inst_id .
"_sklv_" . $a_level_import_id,
111 " ORDER BY l.creation_date DESC ");
113 while ($rec =
$ilDB->fetchAssoc($set)) {
114 $results[] = array(
"level_id" => (
int) $rec[
"id"],
"creation_date" => $rec[
"creation_date"]);
133 "SELECT * FROM skl_tree " .
134 " WHERE child = %s ",
139 return (
int) ($rec[
"skl_tree_id"] ?? 0);
145 return $this->tree_factory->getTreeById($tree_id);
151 return $this->tree_factory->getVirtualTreeById($tree_id);
159 "SELECT * FROM skl_tree " .
160 " WHERE child = %s ",
165 return (
int) ($rec[
"parent"] ?? 0);
Tree SkillTreeFactory $tree_factory
static _lookupTemplateId(int $a_obj_id)
fetchAssoc(ilDBStatement $statement)
__construct(Tree\SkillTreeFactory $tree_factory, ?ilDBInterface $db=null)
getLevelIdForImportId(int $a_source_inst_id, int $a_level_import_id)
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
getTreeForNodeId(int $node_id)
getParentNodeIdForNodeId(int $node_id)
queryF(string $query, array $types, array $values)
getVirtualTreeForNodeId(int $node_id)
getTreeIdForNodeId(int $node_id)
getCommonSkillIdForImportId(int $a_source_inst_id, int $a_skill_import_id, int $a_tref_import_id=0)
isInAnyTree(int $node_id)