ILIAS  release_7 Revision v7.30-3-g800a261c036
ilBasicSkillTreeDBRepository Class Reference
+ Inheritance diagram for ilBasicSkillTreeDBRepository:
+ Collaboration diagram for ilBasicSkillTreeDBRepository:

Public Member Functions

 __construct (ilDBInterface $db=null)
 
 getCommonSkillIdForImportId (ilSkillTree $tree, int $a_source_inst_id, int $a_skill_import_id, int $a_tref_import_id=0)
 @inheritDoc More...
 
 getLevelIdForImportId (int $a_source_inst_id, int $a_level_import_id)
 @inheritDoc More...
 
 getCommonSkillIdForImportId (ilSkillTree $tree, int $a_source_inst_id, int $a_skill_import_id, int $a_tref_import_id=0)
 Get common skill ids for import IDs (newest first) More...
 
 getLevelIdForImportId (int $a_source_inst_id, int $a_level_import_id)
 Get level ids for import IDs (newest first) More...
 

Protected Attributes

 $db
 

Detailed Description

Definition at line 3 of file class.ilBasicSkillTreeDBRepository.php.

Constructor & Destructor Documentation

◆ __construct()

ilBasicSkillTreeDBRepository::__construct ( ilDBInterface  $db = null)

Definition at line 10 of file class.ilBasicSkillTreeDBRepository.php.

11 {
12 global $DIC;
13
14 $this->db = ($db)
15 ? $db
16 : $DIC->database();
17 }
global $DIC
Definition: goto.php:24

References $db, and $DIC.

Member Function Documentation

◆ getCommonSkillIdForImportId()

ilBasicSkillTreeDBRepository::getCommonSkillIdForImportId ( ilSkillTree  $tree,
int  $a_source_inst_id,
int  $a_skill_import_id,
int  $a_tref_import_id = 0 
)

@inheritDoc

Implements ilBasicSkillTreeRepository.

Definition at line 22 of file class.ilBasicSkillTreeDBRepository.php.

27 : array {
29
30 $template_ids = array();
31 if ($a_tref_import_id > 0) {
32 $skill_node_type = "sktp";
33
34 // get all matching tref nodes
35 $set = $ilDB->query("SELECT * FROM skl_tree_node n JOIN skl_tree t ON (n.obj_id = t.child) " .
36 " WHERE n.import_id = " . $ilDB->quote("il_" . ((int) $a_source_inst_id) . "_sktr_" . $a_tref_import_id,
37 "text") .
38 " ORDER BY n.creation_date DESC ");
39 while ($rec = $ilDB->fetchAssoc($set)) {
40 if (($t = ilSkillTemplateReference::_lookupTemplateId($rec["obj_id"])) > 0) {
41 $template_ids[$t] = $rec["obj_id"];
42 }
43 }
44 } else {
45 $skill_node_type = "skll";
46 }
47 $set = $ilDB->query("SELECT * FROM skl_tree_node n JOIN skl_tree t ON (n.obj_id = t.child) " .
48 " WHERE n.import_id = " . $ilDB->quote("il_" . ((int) $a_source_inst_id) . "_" . $skill_node_type . "_" . $a_skill_import_id,
49 "text") .
50 " ORDER BY n.creation_date DESC ");
51 $results = array();
52 while ($rec = $ilDB->fetchAssoc($set)) {
53 $matching_trefs = array();
54 if ($a_tref_import_id > 0) {
55 $skill_template_id = $tree->getTopParentNodeId($rec["obj_id"]);
56
57 // check of skill is in template
58 foreach ($template_ids as $templ => $tref) {
59 if ($skill_template_id == $templ) {
60 $matching_trefs[] = $tref;
61 }
62 }
63 } else {
64 $matching_trefs = array(0);
65 }
66
67 foreach ($matching_trefs as $t) {
68 $results[] = array("skill_id" => $rec["obj_id"],
69 "tref_id" => $t,
70 "creation_date" => $rec["creation_date"]
71 );
72 }
73 }
74 return $results;
75 }
static _lookupTemplateId($a_obj_id)
Lookup template ID.
getTopParentNodeId($a_node_id)
Get top parent node id for a node.
$results
global $ilDB

◆ getLevelIdForImportId()

ilBasicSkillTreeDBRepository::getLevelIdForImportId ( int  $a_source_inst_id,
int  $a_level_import_id 
)

@inheritDoc

Implements ilBasicSkillTreeRepository.

Definition at line 80 of file class.ilBasicSkillTreeDBRepository.php.

80 : array
81 {
83
84 $set = $ilDB->query("SELECT * FROM skl_level l JOIN skl_tree t ON (l.skill_id = t.child) " .
85 " WHERE l.import_id = " . $ilDB->quote("il_" . ((int) $a_source_inst_id) . "_sklv_" . $a_level_import_id,
86 "text") .
87 " ORDER BY l.creation_date DESC ");
88 $results = array();
89 while ($rec = $ilDB->fetchAssoc($set)) {
90 $results[] = array("level_id" => $rec["id"], "creation_date" => $rec["creation_date"]);
91 }
92 return $results;
93 }

References $ilDB, and $results.

Field Documentation

◆ $db

ilBasicSkillTreeDBRepository::$db
protected

Definition at line 8 of file class.ilBasicSkillTreeDBRepository.php.

Referenced by __construct().


The documentation for this class was generated from the following file: