33 $this->lng = $DIC->language();
34 include_once(
"./Services/Skill/classes/class.ilSkillTree.php");
45 $root_id = $this->tree->readRootId();
46 $root_node = $this->tree->getNodeData($root_id);
47 unset($root_node[
"child"]);
48 $root_node[
"id"] = $root_id .
":0";
49 $root_node[
"cskill_id"] = $root_id .
":0";
61 $this->include_drafts = $a_val;
81 $this->include_outdated = $a_val;
102 $id_parts = explode(
":", $a_id);
103 $skl_tree_id = $id_parts[0];
104 $skl_template_tree_id = $id_parts[1];
107 == $skl_template_tree_id)) {
108 $node_data = $this->tree->getNodeData($skl_tree_id);
109 $node_data[
"parent"] = $node_data[
"parent"] .
":0";
111 $node_data = $this->tree->getNodeData($skl_template_tree_id);
112 $node_data[
"parent"] = $skl_tree_id .
":" . $node_data[
"parent"];
115 unset($node_data[
"child"]);
116 unset($node_data[
"skl_tree_id"]);
117 unset($node_data[
"lft"]);
118 unset($node_data[
"rgt"]);
119 unset($node_data[
"depth"]);
121 $node_data[
"id"] = $a_id;
123 $cid_parts = explode(
":", $cid);
124 $node_data[
"skill_id"] = $cid_parts[0];
125 $node_data[
"tref_id"] = $cid_parts[1];
126 $node_data[
"cskill_id"] = $cid;
141 $a_parent_id_parts = explode(
":", $a_parent_id);
142 $a_parent_skl_tree_id = $a_parent_id_parts[0];
143 $a_parent_skl_template_tree_id = $a_parent_id_parts[1];
145 if ($a_parent_skl_template_tree_id == 0) {
146 $childs = $this->tree->getChildsByTypeFilter($a_parent_skl_tree_id,
array(
"scat",
"skll",
"sktr"),
"order_nr");
148 $childs = $this->tree->getChildsByTypeFilter($a_parent_skl_template_tree_id,
array(
"sktp",
"sctp"),
"order_nr");
151 include_once(
"./Services/Skill/classes/class.ilSkillTreeNode.php");
154 foreach ($childs as $k => $c) {
155 if ($a_parent_skl_template_tree_id > 0) {
157 $child_id = $a_parent_skl_tree_id .
":" . $c[
"child"];
158 } elseif (!in_array($c[
"type"],
array(
"sktr",
"sctr"))) {
160 $child_id = $c[
"child"] .
":0";
163 include_once(
"./Services/Skill/classes/class.ilSkillTemplateReference.php");
166 unset($childs[$k][
"child"]);
167 unset($childs[$k][
"skl_tree_id"]);
168 unset($childs[$k][
"lft"]);
169 unset($childs[$k][
"rgt"]);
170 unset($childs[$k][
"depth"]);
171 $childs[$k][
"id"] = $child_id;
175 $cid_parts = explode(
":", $cid);
176 $childs[$k][
"skill_id"] = $cid_parts[0];
177 $childs[$k][
"tref_id"] = $cid_parts[1];
178 $childs[$k][
"cskill_id"] = $cid;
179 $childs[$k][
"parent"] = $a_parent_id;
181 $this->parent[$c[
"id"]] = $a_parent_id;
185 in_array($a_parent_id, $this->drafts)) {
186 $this->drafts[] = $child_id;
190 in_array($a_parent_id, $this->outdated)) {
191 $this->outdated[] = $child_id;
217 $id_parts = explode(
":", $a_cskill_id);
218 if ($id_parts[1] == 0) {
219 $id = $id_parts[0] .
":0";
221 $id = $id_parts[1] .
":" . $id_parts[0];
234 $id_parts = explode(
":", $a_vtree_id);
235 if ($id_parts[1] == 0) {
237 $skill_id = $id_parts[0];
241 $tref_id = $id_parts[0];
242 $skill_id = $id_parts[1];
244 return $skill_id .
":" . $tref_id;
255 $id_parts = explode(
":", $a_cskill_id);
256 if ($id_parts[1] == 0) {
257 $id = $id_parts[0] .
":0";
259 $id = $id_parts[1] .
":" . $id_parts[0];
276 $a_parent_id_parts = explode(
":", $a_node[
"id"]);
277 $a_parent_skl_tree_id = $a_parent_id_parts[0];
278 $a_parent_skl_template_tree_id = $a_parent_id_parts[1];
281 $title = $a_node[
"title"];
284 if ($a_node[
"type"] ==
"skrt") {
285 $lng->txt(
"skmg_skills");
287 if ($a_node[
"type"] ==
"sktr") {
305 $id_parts = explode(
":", $a_cskill_id);
306 if ($id_parts[1] == 0) {
307 $id = $id_parts[0] .
":0";
309 $id = $id_parts[1] .
":" . $id_parts[0];
315 if (!$a_only_basic || in_array($node[
"type"],
array(
"skll",
"sktp")) ||
334 foreach ($childs as $c) {
335 if (!$a_only_basic || in_array($c[
"type"],
array(
"skll",
"sktp")) ||
351 return in_array($a_node_id, $this->drafts);
362 return in_array($a_node_id, $this->outdated);
377 $db = $DIC->database();
379 if (self::$order_node_data == null) {
380 $node_data =
array();
381 $set = $db->query(
"SELECT t.child, t.parent, t.lft, n.order_nr FROM skl_tree t JOIN skl_tree_node n ON (t.child = n.obj_id)");
382 while ($rec = $db->fetchAssoc($set)) {
383 $node_data[$rec[
"child"]] =
array(
384 "parent" => $rec[
"parent"],
385 "lft" => $rec[
"lft"],
386 "order_nr" => $rec[
"order_nr"],
389 self::$order_node_data = $node_data;
391 $node_data = self::$order_node_data;
394 uasort($c_skill_ids,
function ($a, $b) use ($node_data, $a_skill_id_key, $a_tref_id_key) {
398 $cskilla = $a[$a_skill_id_key] .
":" . $a[$a_tref_id_key];
399 $cskillb = $b[$a_skill_id_key] .
":" . $b[$a_tref_id_key];
411 return ($node_data[$ua[0]][
"order_nr"] - $node_data[$ua[1]][
"order_nr"]);
415 if ($vida[1] > 0 && $vidb[1] > 0) {
418 return ($node_data[$ua[0]][
"order_nr"] - $node_data[$ua[1]][
"order_nr"]);
432 while ($node_data[$a][
"parent"] != 0) {
433 $a = $node_data[$a][
"parent"];
436 return array_reverse(
$path);
442 $path_a = $this->
getPath($a, $node_data);
443 $path_b = $this->
getPath($b, $node_data);
444 foreach ($path_a as $k => $v) {
445 if ($v != $path_b[$k]) {
446 return array($v, $path_b[$k]);
isOutdated($a_node_id)
Is outdated.
getChildsOfNodeForCSkillId($a_cskill_id)
Get childs of node for cskill id.
getVTreeIdForCSkillId($a_cskill_id)
Get tree id for common skill id.
if(!array_key_exists('StateId', $_REQUEST)) $id
getChildsOfNode($a_parent_id)
Get childs of node.
static _lookupType($a_obj_id)
Lookup Type.
getOrderedNodeset($c_skill_ids, $a_skill_id_key="", $a_tref_id_key="")
Get ordererd nodeset for common skill ids.
getNodeTitle($a_node)
Get node content.
setIncludeDrafts($a_val)
Set include drafts.
__construct()
Constructor.
isDraft($a_node_id)
Is draft.
getRootNode()
Get root node.
static _lookupTemplateId($a_obj_id)
Lookup template ID.
Create styles array
The data for the language used.
getIncludeOutdated()
Get include outdated.
getCSkillIdForVTreeId($a_vtree_id)
Get common skill id for tree id.
getFirstUncommonAncestors($a, $b, $node_data)
getIncludeDrafts()
Get include drafts.
static _lookupStatus($a_obj_id)
Lookup Status.
getSubTreeForCSkillId($a_cskill_id, $a_only_basic=false)
Get sub tree.
for($i=6; $i< 13; $i++) for($i=1; $i< 13; $i++) $d
__getSubTreeRec($id, &$result, $a_only_basic)
Get subtree, internal.
setIncludeOutdated($a_val)
Set include outdated.