ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
ilSkillTree Class Reference

Skill tree. More...

+ Inheritance diagram for ilSkillTree:
+ Collaboration diagram for ilSkillTree:

Public Member Functions

 __construct ()
 
 getSkillTreePath ($a_base_skill_id, $a_tref_id=0)
 Get skill tree path. More...
 
 getSkillTreePathAsString ($a_base_skill_id, $a_tref_id=0)
 Get skill tree path as string. More...
 
 getTopParentNodeId ($a_node_id)
 Get top parent node id for a node. More...
 
 getMaxOrderNr ($a_par_id, $a_templates=false)
 Get max order nr. More...
 
- Public Member Functions inherited from ilTree
 __construct ($a_tree_id, $a_root_id=0)
 Constructor @access public. More...
 
 initTreeImplementation ()
 Init tree implementation. More...
 
 getTreeImplementation ()
 Get tree implementation. More...
 
 useCache ($a_use=true)
 Use Cache (usually activated) More...
 
 isCacheUsed ()
 Check if cache is active. More...
 
 getDepthCache ()
 Get depth cache. More...
 
 getParentCache ()
 Get parent cache. More...
 
 initLangCode ()
 Store user language. More...
 
 getTreeTable ()
 Get tree table name. More...
 
 getObjectDataTable ()
 Get object data table. More...
 
 getTreePk ()
 Get tree primary key. More...
 
 getTableReference ()
 Get reference table if available. More...
 
 getGap ()
 Get default gap *. More...
 
 resetInTreeCache ()
 
 setTableNames ($a_table_tree, $a_table_obj_data, $a_table_obj_reference="")
 set table names The primary key of the table containing your object_data must be 'obj_id' You may use a reference table. More...
 
 setReferenceTablePK ($a_column_name)
 set column containing primary key in reference table @access public More...
 
 setObjectTablePK ($a_column_name)
 set column containing primary key in object table @access public More...
 
 setTreeTablePK ($a_column_name)
 set column containing primary key in tree table @access public More...
 
 buildJoin ()
 build join depending on table settings @access private More...
 
 getRelation ($a_node_a, $a_node_b)
 Get relation of two nodes. More...
 
 getRelationOfNodes ($a_node_a_arr, $a_node_b_arr)
 get relation of two nodes by node data More...
 
 getChildIds ($a_node)
 Get node child ids @global type $ilDB. More...
 
 getChilds ($a_node_id, $a_order="", $a_direction="ASC")
 get child nodes of given node @access public More...
 
 getFilteredChilds ($a_filter, $a_node, $a_order="", $a_direction="ASC")
 get child nodes of given node (exclude filtered obj_types) @access public More...
 
 getChildsByType ($a_node_id, $a_type)
 get child nodes of given node by object type @access public More...
 
 getChildsByTypeFilter ($a_node_id, $a_types, $a_order="", $a_direction="ASC")
 get child nodes of given node by object type @access public More...
 
 insertNodeFromTrash ($a_source_id, $a_target_id, $a_tree_id, $a_pos=IL_LAST_NODE, $a_reset_deleted_date=false)
 Insert node from trash deletes trash entry. More...
 
 insertNode ($a_node_id, $a_parent_id, $a_pos=IL_LAST_NODE, $a_reset_deletion_date=false)
 insert new node with node_id under parent node with parent_id @access public More...
 
 getFilteredSubTree ($a_node_id, $a_filter=array())
 get filtered subtree More...
 
 getSubTreeIds ($a_ref_id)
 Get all ids of subnodes. More...
 
 getSubTree ($a_node, $a_with_data=true, $a_type="")
 get all nodes in the subtree under specified node More...
 
 getSubTreeTypes ($a_node, $a_filter=0)
 get types of nodes in the subtree under specified node More...
 
 deleteTree ($a_node)
 delete node and the whole subtree under this node @access public More...
 
 validateParentRelations ()
 Validate parent relations of tree. More...
 
 getPathFull ($a_endnode_id, $a_startnode_id=0)
 get path from a given startnode to a given endnode if startnode is not given the rootnode is startnode. More...
 
 preloadDepthParent ($a_node_ids)
 Preload depth/parent. More...
 
 getPathId ($a_endnode_id, $a_startnode_id=0)
 get path from a given startnode to a given endnode if startnode is not given the rootnode is startnode @access public More...
 
 getNodePathForTitlePath ($titlePath, $a_startnode_id=null)
 Converts a path consisting of object titles into a path consisting of tree nodes. More...
 
 getNodePath ($a_endnode_id, $a_startnode_id=0)
 Returns the node path for the specified object reference. More...
 
 checkTree ()
 check consistence of tree all left & right values are checked if they are exists only once @access public More...
 
 checkTreeChilds ($a_no_zero_child=true)
 check, if all childs of tree nodes exist in object table More...
 
 getMaximumDepth ()
 Return the current maximum depth in the tree @access public. More...
 
 getDepth ($a_node_id)
 return depth of a node in tree @access private More...
 
 getNodeTreeData ($a_node_id)
 return all columns of tabel tree More...
 
 getNodeData ($a_node_id, $a_tree_pk=null)
 get all information of a node. More...
 
 fetchNodeData ($a_row)
 get data of parent node from tree and object_data @access private More...
 
 isInTree ($a_node_id)
 get all information of a node. More...
 
 getParentNodeData ($a_node_id)
 get data of parent node from tree and object_data @access public More...
 
 isGrandChild ($a_startnode_id, $a_querynode_id)
 checks if a node is in the path of an other node @access public More...
 
 addTree ($a_tree_id, $a_node_id=-1)
 create a new tree to do: ??? More...
 
 getNodeDataByType ($a_type)
 get nodes by type More...
 
 removeTree ($a_tree_id)
 remove an existing tree More...
 
 moveToTrash ($a_node_id, $a_set_deleted=false)
 Wrapper for saveSubTree. More...
 
 saveSubTree ($a_node_id, $a_set_deleted=false)
 Use the wrapper moveToTrash save subtree: delete a subtree (defined by node_id) to a new tree with $this->tree_id -node_id. More...
 
 isDeleted ($a_node_id)
 This is a wrapper for isSaved() with a more useful name. More...
 
 isSaved ($a_node_id)
 Use method isDeleted check if node is saved. More...
 
 preloadDeleted ($a_node_ids)
 Preload deleted information. More...
 
 getSavedNodeData ($a_parent_id)
 get data saved/deleted nodes More...
 
 getSavedNodeObjIds (array $a_obj_ids)
 get object id of saved/deleted nodes More...
 
 getParentId ($a_node_id)
 get parent id of given node @access public More...
 
 getLeftValue ($a_node_id)
 get left value of given node @access public More...
 
 getChildSequenceNumber ($a_node, $type="")
 get sequence number of node in sibling sequence @access public More...
 
 readRootId ()
 read root id from database More...
 
 getRootId ()
 get the root id of tree @access public More...
 
 setRootId ($a_root_id)
 
 getTreeId ()
 get tree id @access public More...
 
 setTreeId ($a_tree_id)
 set tree id @access public More...
 
 fetchSuccessorNode ($a_node_id, $a_type="")
 get node data of successor node More...
 
 fetchPredecessorNode ($a_node_id, $a_type="")
 get node data of predecessor node More...
 
 renumber ($node_id=1, $i=1)
 Wrapper for renumber. More...
 
 __renumber ($node_id=1, $i=1)
 This method is private. More...
 
 checkForParentType ($a_ref_id, $a_type, $a_exclude_source_check=false)
 Check for parent type e.g check if a folder (ref_id 3) is in a parent course obj => checkForParentType(3,'crs');. More...
 
 __isMainTree ()
 Check if operations are done on main tree. More...
 
 __checkDelete ($a_node)
 Check for deleteTree() compares a subtree of a given node by checking lft, rgt against parent relation. More...
 
 __getSubTreeByParentRelation ($a_node_id, &$parent_childs)
 @global type $ilDB More...
 
 __validateSubtrees (&$lft_childs, $parent_childs)
 
 moveTree ($a_source_id, $a_target_id, $a_location=self::POS_LAST_NODE)
 Move Tree Implementation. More...
 
 getRbacSubtreeInfo ($a_endnode_id)
 This method is used for change existing objects and returns all necessary information for this action. More...
 
 getSubTreeQuery ($a_node_id, $a_fields=array(), $a_types='', $a_force_join_reference=false)
 Get tree subtree query. More...
 
 getSubTreeFilteredByObjIds ($a_node_id, array $a_obj_ids, array $a_fields=array())
 get all node ids in the subtree under specified node id, filter by object ids More...
 
 deleteNode ($a_tree_id, $a_node_id)
 
 lookupTrashedObjectTypes ()
 Lookup object types in trash @global type $ilDB. More...
 

Additional Inherited Members

- Static Public Member Functions inherited from ilTree
static _removeEntry ($a_tree, $a_child, $a_db_table="tree")
 STATIC METHOD Removes a single entry from a tree. More...
 
- Data Fields inherited from ilTree
const POS_LAST_NODE = -2
 
const POS_FIRST_NODE = -1
 
const RELATION_CHILD = 1
 
const RELATION_PARENT = 2
 
const RELATION_SIBLING = 3
 
const RELATION_EQUALS = 4
 
const RELATION_NONE = 5
 
 $ilias
 
 $log
 
 $root_id
 
 $tree_id
 
 $table_tree
 
 $table_obj_data
 
 $table_obj_reference
 
 $ref_pk
 
 $obj_pk
 
 $tree_pk
 
 $gap
 
- Protected Member Functions inherited from ilTree
 fetchTranslationFromObjectDataCache ($a_obj_ids)
 Get translation data from object cache (trigger in object cache on preload) More...
 
- Protected Attributes inherited from ilTree
 $depth_cache = array()
 
 $parent_cache = array()
 
 $in_tree_cache = array()
 

Detailed Description

Skill tree.

Author
Alex Killing alex..nosp@m.kill.nosp@m.ing@g.nosp@m.mx.d.nosp@m.e
Version
$Id$

Definition at line 14 of file class.ilSkillTree.php.

Constructor & Destructor Documentation

◆ __construct()

ilSkillTree::__construct ( )

Definition at line 16 of file class.ilSkillTree.php.

17 {
18 parent::__construct(1); // only one skill tree, with ID 1
19 $this->setTreeTablePK("skl_tree_id");
20 $this->setTableNames('skl_tree', 'skl_tree_node');
21 }
setTreeTablePK($a_column_name)
set column containing primary key in tree table @access public
setTableNames($a_table_tree, $a_table_obj_data, $a_table_obj_reference="")
set table names The primary key of the table containing your object_data must be 'obj_id' You may use...

References ilTree\setTableNames(), and ilTree\setTreeTablePK().

+ Here is the call graph for this function:

Member Function Documentation

◆ getMaxOrderNr()

ilSkillTree::getMaxOrderNr (   $a_par_id,
  $a_templates = false 
)

Get max order nr.

Parameters
int$a_par_idparent id
bool$a_templatestemplates? true/false
Returns
int max order nr

Definition at line 116 of file class.ilSkillTree.php.

117 {
118 if ($a_par_id != $this->readRootId()) {
119 $childs = $this->getChilds($a_par_id);
120 } else {
121 if ($a_templates) {
122 $childs = $this->getChildsByTypeFilter(
123 $a_par_id,
124 array("skrt", "sktp", "sctp")
125 );
126 } else {
127 $childs = $this->getChildsByTypeFilter(
128 $a_par_id,
129 array("skrt", "skll", "scat", "sktr")
130 );
131 }
132 }
133
134 $max = 0;
135 foreach ($childs as $k => $c) {
136 $max = max(array($c["order_nr"], $max));
137 }
138
139 return $max;
140 }
readRootId()
read root id from database
getChildsByTypeFilter($a_node_id, $a_types, $a_order="", $a_direction="ASC")
get child nodes of given node by object type @access public
getChilds($a_node_id, $a_order="", $a_direction="ASC")
get child nodes of given node @access public

References $c, ilTree\getChilds(), ilTree\getChildsByTypeFilter(), and ilTree\readRootId().

+ Here is the call graph for this function:

◆ getSkillTreePath()

ilSkillTree::getSkillTreePath (   $a_base_skill_id,
  $a_tref_id = 0 
)

Get skill tree path.

Parameters
int$a_base_skill_idbase skill id
int$a_tref_idtemplate reference id
Returns
array path

Definition at line 30 of file class.ilSkillTree.php.

31 {
32 if ($a_tref_id > 0) {
33 include_once("./Services/Skill/classes/class.ilSkillTemplateReference.php");
34 $path = $this->getPathFull($a_tref_id);
35 $sub_path = $this->getPathFull($a_base_skill_id);
36 if (is_array($path)) {
37 foreach ($path as $k => $v) {
38 if ($v["child"] != $a_tref_id) {
39 $path[$k]["skill_id"] = $v["child"];
40 $path[$k]["tref_id"] = 0;
41 } else {
42 $path[$k]["skill_id"] = ilSkillTemplateReference::_lookupTemplateId($a_tref_id);
43 $path[$k]["tref_id"] = $a_tref_id;
44 }
45 }
46 }
47 $found = false;
48 if (is_array($sub_path)) {
49 foreach ($sub_path as $s) {
50 if ($found) {
51 $s["skill_id"] = $s["child"];
52 $s["tref_id"] = $a_tref_id;
53 $path[] = $s;
54 }
55 if ($s["child"] == ilSkillTemplateReference::_lookupTemplateId($a_tref_id)) {
56 $found = true;
57 }
58 }
59 }
60 } else {
61 $path = $this->getPathFull($a_base_skill_id);
62 if (is_array($path)) {
63 foreach ($path as $k => $v) {
64 $path[$k]["skill_id"] = $v["child"];
65 $path[$k]["tref_id"] = 0;
66 }
67 }
68 }
69
70 if (is_array($path)) {
71 return $path;
72 }
73 return array();
74 }
$path
Definition: aliased.php:25
static _lookupTemplateId($a_obj_id)
Lookup template ID.
getPathFull($a_endnode_id, $a_startnode_id=0)
get path from a given startnode to a given endnode if startnode is not given the rootnode is startnod...
$s
Definition: pwgen.php:45

References $path, $s, ilSkillTemplateReference\_lookupTemplateId(), and ilTree\getPathFull().

Referenced by getSkillTreePathAsString().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getSkillTreePathAsString()

ilSkillTree::getSkillTreePathAsString (   $a_base_skill_id,
  $a_tref_id = 0 
)

Get skill tree path as string.

Parameters
int$a_base_skill_idbase skill id
int$a_tref_idtemplate reference id
Returns
string path

Definition at line 83 of file class.ilSkillTree.php.

84 {
85 $path = $this->getSkillTreePath($a_base_skill_id, $a_tref_id);
86 $str = "";
87 $sep = "";
88 foreach ($path as $p) {
89 if ($p["type"] != "skrt" && $p["child"] != $a_base_skill_id) {
90 $str .= $sep . $p["title"];
91 $sep = " > ";
92 }
93 }
94 return $str;
95 }
getSkillTreePath($a_base_skill_id, $a_tref_id=0)
Get skill tree path.

References $path, and getSkillTreePath().

+ Here is the call graph for this function:

◆ getTopParentNodeId()

ilSkillTree::getTopParentNodeId (   $a_node_id)

Get top parent node id for a node.

Parameters
int$a_node_id
Returns
int top parent node id

Definition at line 103 of file class.ilSkillTree.php.

104 {
105 $path = $this->getPathId($a_node_id);
106 return (int) $path[1];
107 }
getPathId($a_endnode_id, $a_startnode_id=0)
get path from a given startnode to a given endnode if startnode is not given the rootnode is startnod...

References $path, and ilTree\getPathId().

+ Here is the call graph for this function:

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