3 declare(strict_types=1);
42 int $a_source_inst_id,
43 int $a_skill_import_id,
44 int $a_tref_import_id = 0
49 if ($a_tref_import_id > 0) {
50 $skill_node_type =
"sktp";
53 $set =
$ilDB->query(
"SELECT * FROM skl_tree_node n JOIN skl_tree t ON (n.obj_id = t.child) " .
54 " WHERE n.import_id = " .
$ilDB->quote(
55 "il_" . ($a_source_inst_id) .
"_sktr_" . $a_tref_import_id,
58 " ORDER BY n.creation_date DESC ");
59 while ($rec =
$ilDB->fetchAssoc($set)) {
61 $template_ids[$t] = (
int) $rec[
"obj_id"];
65 $skill_node_type =
"skll";
67 $set =
$ilDB->query(
"SELECT * FROM skl_tree_node n JOIN skl_tree t ON (n.obj_id = t.child) " .
68 " WHERE n.import_id = " .
$ilDB->quote(
69 "il_" . ($a_source_inst_id) .
"_" . $skill_node_type .
"_" . $a_skill_import_id,
72 " ORDER BY n.creation_date DESC ");
74 while ($rec =
$ilDB->fetchAssoc($set)) {
76 if ($a_tref_import_id > 0) {
77 $tree = $this->tree_factory->getTreeById((
int) $rec[
"skl_tree_id"]);
78 $skill_template_id = $tree->getTopParentNodeId((
int) $rec[
"obj_id"]);
81 foreach ($template_ids as $templ => $tref) {
82 if ($skill_template_id == $templ) {
83 $matching_trefs[] = $tref;
87 $matching_trefs = array(0);
90 foreach ($matching_trefs as $t) {
91 $results[] = array(
"skill_id" => (
int) $rec[
"obj_id"],
93 "creation_date" => $rec[
"creation_date"]
107 $set =
$ilDB->query(
"SELECT * FROM skl_level l JOIN skl_tree t ON (l.skill_id = t.child) " .
108 " WHERE l.import_id = " .
$ilDB->quote(
109 "il_" . $a_source_inst_id .
"_sklv_" . $a_level_import_id,
112 " ORDER BY l.creation_date DESC ");
114 while ($rec =
$ilDB->fetchAssoc($set)) {
115 $results[] = array(
"level_id" => (
int) $rec[
"id"],
"creation_date" => $rec[
"creation_date"]);
134 "SELECT * FROM skl_tree " .
135 " WHERE child = %s ",
140 return (
int) ($rec[
"skl_tree_id"] ?? 0);
146 return $this->tree_factory->getTreeById($tree_id);
152 return $this->tree_factory->getVirtualTreeById($tree_id);
160 "SELECT * FROM skl_tree " .
161 " WHERE child = %s ",
166 return (
int) ($rec[
"parent"] ?? 0);
Tree SkillTreeFactory $tree_factory
static _lookupTemplateId(int $a_obj_id)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
fetchAssoc(ilDBStatement $statement)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
getLevelIdForImportId(int $a_source_inst_id, int $a_level_import_id)
getTreeForNodeId(int $node_id)
__construct(Tree\SkillTreeFactory $tree_factory, ilDBInterface $db=null)
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)