5 include_once(
"./Services/Skill/classes/class.ilSkillTree.php");
46 $this->title = $a_title;
66 $this->type = $a_type;
106 $this->self_eval = $a_val;
116 return $this->self_eval;
126 $this->order_nr = $a_val;
136 return $this->order_nr;
149 self::STATUS_DRAFT => $lng->txt(
"skmg_status_draft"),
150 self::STATUS_PUBLISH => $lng->txt(
"skmg_status_publish"),
151 self::STATUS_OUTDATED => $lng->txt(
"skmg_status_outdated")
167 case self::STATUS_PUBLISH:
return $lng->txt(
"skmg_status_publish_info");
168 case self::STATUS_DRAFT:
return $lng->txt(
"skmg_status_draft_info");
169 case self::STATUS_OUTDATED:
return $lng->txt(
"skmg_status_outdated_info");
181 if(!isset($this->data_record))
183 $query =
"SELECT * FROM skl_tree_node WHERE obj_id = ".
184 $ilDB->quote($this->
id,
"integer");
185 $obj_set = $ilDB->query(
$query);
186 $this->data_record = $ilDB->fetchAssoc($obj_set);
188 $this->
setType($this->data_record[
"type"]);
189 $this->
setTitle($this->data_record[
"title"]);
190 $this->
setOrderNr($this->data_record[
"order_nr"]);
192 $this->
setStatus($this->data_record[
"status"]);
200 $this->data_record = $a_record;
209 protected static function _lookup($a_obj_id, $a_field)
213 $query =
"SELECT $a_field FROM skl_tree_node WHERE obj_id = ".
214 $ilDB->quote($a_obj_id,
"integer");
215 $obj_set = $ilDB->query(
$query);
216 $obj_rec = $ilDB->fetchAssoc($obj_set);
218 return $obj_rec[$a_field];
231 include_once(
"./Services/Skill/classes/class.ilSkillTemplateReference.php");
275 $query =
"SELECT * FROM skl_tree_node WHERE obj_id = ".
276 $ilDB->quote($a_obj_id,
"integer");
277 $obj_set = $ilDB->query(
$query);
278 $obj_rec = $ilDB->fetchAssoc($obj_set);
280 return $obj_rec[
"type"];
290 $this->status = $a_val;
300 return $this->status;
313 $query =
"UPDATE skl_tree_node SET ".
314 " title = ".$ilDB->quote($a_title,
"text").
315 " WHERE obj_id = ".$ilDB->quote($a_obj_id,
"integer");
317 $ilDB->manipulate(
$query);
330 $query =
"UPDATE skl_tree_node SET ".
331 " order_nr = ".$ilDB->quote($a_nr,
"integer").
332 " WHERE obj_id = ".$ilDB->quote($a_obj_id,
"integer");
333 $ilDB->manipulate(
$query);
346 $id = $ilDB->nextId(
"skl_tree_node");
347 $query =
"INSERT INTO skl_tree_node (obj_id, title, type, create_date, self_eval, order_nr, status) ".
349 $ilDB->quote(
$id,
"integer").
",".
350 $ilDB->quote($this->
getTitle(),
"text").
",".
351 $ilDB->quote($this->
getType(),
"text").
", ".
354 $ilDB->quote((
int) $this->
getOrderNr(),
"integer").
", ".
355 $ilDB->quote((
int) $this->
getStatus(),
"integer").
357 $ilDB->manipulate(
$query);
368 $query =
"UPDATE skl_tree_node SET ".
369 " title = ".$ilDB->quote($this->
getTitle(),
"text").
371 " ,order_nr = ".$ilDB->quote((
int) $this->
getOrderNr(),
"integer").
372 " ,status = ".$ilDB->quote((
int) $this->
getStatus(),
"integer").
373 " WHERE obj_id = ".$ilDB->quote($this->
getId(),
"integer");
375 $ilDB->manipulate(
$query);
385 $query =
"DELETE FROM skl_tree_node WHERE obj_id= ".
386 $ilDB->quote($this->
getId(),
"integer");
387 $ilDB->manipulate(
$query);
393 static function putInTree($a_obj, $a_parent_id =
"", $a_target_node_id =
"")
398 $parent_id = ($a_parent_id !=
"")
400 : $skill_tree->getRootId();
405 "skrt" => array(
"skll",
"scat",
"sktr",
"sktp",
"sctp"),
406 "scat" => array(
"skll",
"scat",
"sktr"),
407 "sctp" => array(
"sktp",
"sctp"));
409 if (!is_array($allowed[$par_type]) ||
410 !in_array($a_obj->getType(), $allowed[$par_type]))
416 if ($a_target_node_id !=
"")
418 $target = $a_target_node_id;
423 $childs = $skill_tree->getChilds($parent_id);
425 if (count($childs) == 0)
431 $target = $childs[count($childs) - 1][
"obj_id"];
435 if ($skill_tree->isInTree($parent_id) && !$skill_tree->isInTree($a_obj->getId()))
437 $skill_tree->insertNode($a_obj->getId(), $parent_id, $target);
461 if (is_array($a_items))
463 foreach($a_items as $item)
470 if (count($types) > 1)
483 include_once(
"./Services/Skill/classes/class.ilSkillTree.php");
486 if (!is_array($a_ids))
493 foreach($a_ids as
$id)
495 $path = $tree->getPathId($id);
497 foreach(
$path as $path_id)
499 if ($path_id != $id && in_array($path_id, $a_ids))
516 foreach ($cut_ids as
$id)
518 $curnode = $tree->getNodeData($id);
519 if ($tree->isInTree($id))
521 $tree->deleteTree($curnode);
536 include_once(
"./Services/Skill/classes/class.ilSkillTree.php");
540 $time = date(
"Y-m-d H:i:s", time());
541 foreach ($a_ids as
$id)
544 if ($tree->isInTree($id))
546 $curnode = $tree->getNodeData($id);
547 $subnodes = $tree->getSubTree($curnode);
548 foreach($subnodes as $subnode)
550 if ($subnode[
"child"] != $id)
552 $ilUser->addObjectToClipboard($subnode[
"child"],
553 $subnode[
"type"], $subnode[
"title"],
554 $subnode[
"parent"], $time, $subnode[
"lft"]);
558 $order = ($curnode[
"lft"] > 0)
560 : (
int) ($order + 1);
561 $ilUser->addObjectToClipboard($id,
576 include_once(
"./Modules/LearningModule/classes/class.ilEditClipboard.php");
578 include_once(
"./Services/Skill/classes/class.ilSkillTree.php");
581 $parent_id = $a_obj_id;
585 $skills = $ilUser->getClipboardObjects($a_type);
586 $copied_nodes = array();
587 foreach ($skills as $skill)
590 if(!in_array($skill[
"id"], array_keys($copied_nodes)))
593 $skill[
"insert_time"], $copied_nodes,
605 in_array($a_type, array(
"sktp",
"sctp")));
607 return $copied_nodes;
620 $ilUser->clipboardDeleteObjectsOfType(
"skll");
621 $ilUser->clipboardDeleteObjectsOfType(
"scat");
622 $ilUser->clipboardDeleteObjectsOfType(
"sktr");
623 $ilUser->clipboardDeleteObjectsOfType(
"sktp");
624 $ilUser->clipboardDeleteObjectsOfType(
"sctp");
625 include_once(
"./Modules/LearningModule/classes/class.ilEditClipboard.php");
633 static function pasteTree($a_item_id, $a_parent_id, $a_target, $a_insert_time,
634 &$a_copied_nodes, $a_as_copy =
false, $a_add_suffix =
false)
640 if ($item_type ==
"scat")
642 include_once(
"./Services/Skill/classes/class.ilSkillCategory.php");
645 else if ($item_type ==
"skll")
647 include_once(
"./Services/Skill/classes/class.ilBasicSkill.php");
650 else if ($item_type ==
"sktr")
652 include_once(
"./Services/Skill/classes/class.ilSkillTemplateReference.php");
655 else if ($item_type ==
"sktp")
657 include_once(
"./Services/Skill/classes/class.ilBasicSkillTemplate.php");
660 else if ($item_type ==
"sctp")
662 include_once(
"./Services/Skill/classes/class.ilSkillTemplateCategory.php");
666 $ilLog->write(
"Getting from clipboard type ".$item_type.
", ".
667 "Item ID: ".$a_item_id);
671 $target_item = $item->copy();
674 $target_item->setTitle($target_item->getTitle().
" ".$lng->txt(
"copy_of_suffix"));
675 $target_item->update();
677 $a_copied_nodes[$item->getId()] = $target_item->getId();
681 $target_item = $item;
684 $ilLog->write(
"Putting into skill tree type ".$target_item->getType().
685 "Item ID: ".$target_item->getId().
", Parent: ".$a_parent_id.
", ".
686 "Target: ".$a_target);
690 $childs = $ilUser->getClipboardChilds($item->getId(), $a_insert_time);
692 foreach($childs as $child)
695 IL_LAST_NODE, $a_insert_time, $a_copied_nodes, $a_as_copy);
698 return $target_item->getId();
710 if ($skill_tree->isInTree($a_id))
727 $set = $ilDB->query(
"SELECT obj_id, title FROM skl_tree_node WHERE ".
728 " self_eval = ".$ilDB->quote(
true,
"integer").
" ORDER BY TITLE "
731 while ($rec = $ilDB->fetchAssoc($set))
733 $nodes[$rec[
"obj_id"]] = $rec[
"title"];
747 $childs = $tr->getChildsByTypeFilter($tr->getRootId(), array(
"sktp",
"sctp"));
762 $set = $ilDB->query(
"SELECT * FROM skl_tree_node ".
763 " WHERE self_eval = ".$ilDB->quote(1,
"integer")
766 $sel_skills = array();
767 while ($rec = $ilDB->fetchAssoc($set))
769 $sel_skills[] = $rec;
783 include_once(
"./Services/Skill/classes/class.ilSkillTree.php");
786 if ($a_par_id != $skill_tree->readRootId())
788 $childs = $skill_tree->getChilds($a_par_id);
794 $childs = $skill_tree->getChildsByTypeFilter($a_par_id,
795 array(
"skrt",
"sktp",
"sctp"));
799 $childs = $skill_tree->getChildsByTypeFilter($a_par_id,
800 array(
"skrt",
"skll",
"scat",
"sktr"));
804 foreach ($childs as $k => $c)
806 if (isset($a_childs_order[$c[
"child"]]))
808 $childs[$k][
"order_nr"] = (int) $a_childs_order[$c[
"child"]];
815 foreach ($childs as $c)
831 static function getIconPath($a_obj_id, $a_type, $a_size =
"", $a_status = 0)
833 if ($a_status == self::STATUS_DRAFT && $a_type ==
"sctp")
837 if ($a_status == self::STATUS_DRAFT && $a_type ==
"sktp")
846 $a_name =
"icon_".$a_type.$a_size.$off.
".png";
847 if ($a_type ==
"sktr")
849 include_once(
"./Services/Skill/classes/class.ilSkillTemplateReference.php");
854 $a_name =
"icon_sctr".$a_size.$off.
".png";
857 $vers =
"vers=".str_replace(array(
".",
" "),
"-",
ILIAS_VERSION);