5 include_once(
"./Services/Skill/classes/class.ilSkillTree.php");
46 $this->title = $a_title;
106 $this->self_eval = $a_val;
116 return $this->self_eval;
126 $this->order_nr = $a_val;
136 return $this->order_nr;
146 $this->import_id = $a_val;
156 return $this->import_id;
166 $this->creation_date = $a_val;
176 return $this->creation_date;
189 self::STATUS_DRAFT => $lng->txt(
"skmg_status_draft"),
190 self::STATUS_PUBLISH => $lng->txt(
"skmg_status_publish"),
191 self::STATUS_OUTDATED => $lng->txt(
"skmg_status_outdated")
207 case self::STATUS_PUBLISH:
return $lng->txt(
"skmg_status_publish_info");
208 case self::STATUS_DRAFT:
return $lng->txt(
"skmg_status_draft_info");
209 case self::STATUS_OUTDATED:
return $lng->txt(
"skmg_status_outdated_info");
221 if(!isset($this->data_record))
223 $query =
"SELECT * FROM skl_tree_node WHERE obj_id = ".
224 $ilDB->quote($this->
id,
"integer");
225 $obj_set = $ilDB->query(
$query);
226 $this->data_record = $ilDB->fetchAssoc($obj_set);
228 $this->
setType($this->data_record[
"type"]);
229 $this->
setTitle($this->data_record[
"title"]);
230 $this->
setOrderNr($this->data_record[
"order_nr"]);
232 $this->
setStatus($this->data_record[
"status"]);
233 $this->
setImportId($this->data_record[
"import_id"]);
242 $this->data_record = $a_record;
251 protected static function _lookup($a_obj_id, $a_field)
255 $query =
"SELECT $a_field FROM skl_tree_node WHERE obj_id = ".
256 $ilDB->quote($a_obj_id,
"integer");
257 $obj_set = $ilDB->query(
$query);
258 $obj_rec = $ilDB->fetchAssoc($obj_set);
260 return $obj_rec[$a_field];
273 include_once(
"./Services/Skill/classes/class.ilSkillTemplateReference.php");
276 return self::_lookup($a_tref_id,
"title");
278 return self::_lookup($a_obj_id,
"title");
291 return self::_lookup($a_obj_id,
"self_eval");
304 return self::_lookup($a_obj_id,
"status");
317 $query =
"SELECT * FROM skl_tree_node WHERE obj_id = ".
318 $ilDB->quote($a_obj_id,
"integer");
319 $obj_set = $ilDB->query(
$query);
320 $obj_rec = $ilDB->fetchAssoc($obj_set);
322 return $obj_rec[
"type"];
332 $this->status = $a_val;
342 return $this->status;
355 $query =
"UPDATE skl_tree_node SET ".
356 " title = ".$ilDB->quote($a_title,
"text").
357 " WHERE obj_id = ".$ilDB->quote($a_obj_id,
"integer");
359 $ilDB->manipulate(
$query);
372 $query =
"UPDATE skl_tree_node SET ".
373 " order_nr = ".$ilDB->quote($a_nr,
"integer").
374 " WHERE obj_id = ".$ilDB->quote($a_obj_id,
"integer");
375 $ilDB->manipulate(
$query);
388 $id = $ilDB->nextId(
"skl_tree_node");
389 $query =
"INSERT INTO skl_tree_node (obj_id, title, type, create_date, self_eval, order_nr, status, creation_date, import_id) ".
391 $ilDB->quote($id,
"integer").
",".
392 $ilDB->quote($this->
getTitle(),
"text").
",".
393 $ilDB->quote($this->
getType(),
"text").
", ".
396 $ilDB->quote((
int) $this->
getOrderNr(),
"integer").
", ".
397 $ilDB->quote((
int) $this->
getStatus(),
"integer").
", ".
401 $ilDB->manipulate(
$query);
412 $query =
"UPDATE skl_tree_node SET ".
413 " title = ".$ilDB->quote($this->
getTitle(),
"text").
415 " ,order_nr = ".$ilDB->quote((
int) $this->
getOrderNr(),
"integer").
416 " ,status = ".$ilDB->quote((
int) $this->
getStatus(),
"integer").
417 " ,import_id = ".$ilDB->quote($this->
getImportId(),
"text").
418 " WHERE obj_id = ".$ilDB->quote($this->
getId(),
"integer");
420 $ilDB->manipulate(
$query);
430 $query =
"DELETE FROM skl_tree_node WHERE obj_id= ".
431 $ilDB->quote($this->
getId(),
"integer");
432 $ilDB->manipulate(
$query);
438 static function putInTree($a_obj, $a_parent_id =
"", $a_target_node_id =
"")
443 $parent_id = ($a_parent_id !=
"")
445 : $skill_tree->getRootId();
450 "skrt" =>
array(
"skll",
"scat",
"sktr",
"sktp",
"sctp"),
451 "scat" =>
array(
"skll",
"scat",
"sktr"),
452 "sctp" =>
array(
"sktp",
"sctp"));
453 $par_type = self::_lookupType($parent_id);
454 if (!is_array($allowed[$par_type]) ||
455 !in_array($a_obj->getType(), $allowed[$par_type]))
461 if ($a_target_node_id !=
"")
468 $childs = $skill_tree->getChilds($parent_id);
470 if (count($childs) == 0)
476 $target = $childs[count($childs) - 1][
"obj_id"];
480 if ($skill_tree->isInTree($parent_id) && !$skill_tree->isInTree($a_obj->getId()))
482 $skill_tree->insertNode($a_obj->getId(), $parent_id,
$target);
506 if (is_array($a_items))
508 foreach($a_items as $item)
515 if (count($types) > 1)
527 self::clearClipboard();
528 include_once(
"./Services/Skill/classes/class.ilSkillTree.php");
531 if (!is_array($a_ids))
538 foreach($a_ids as $id)
540 $path = $tree->getPathId($id);
542 foreach(
$path as $path_id)
544 if ($path_id != $id && in_array($path_id, $a_ids))
561 foreach ($cut_ids as $id)
563 $curnode = $tree->getNodeData($id);
564 if ($tree->isInTree($id))
566 $tree->deleteTree($curnode);
580 self::clearClipboard();
581 include_once(
"./Services/Skill/classes/class.ilSkillTree.php");
585 $time =
date(
"Y-m-d H:i:s",
time());
586 foreach ($a_ids as $id)
589 if ($tree->isInTree($id))
591 $curnode = $tree->getNodeData($id);
592 $subnodes = $tree->getSubTree($curnode);
593 foreach($subnodes as $subnode)
595 if ($subnode[
"child"] != $id)
597 $ilUser->addObjectToClipboard($subnode[
"child"],
598 $subnode[
"type"], $subnode[
"title"],
599 $subnode[
"parent"], $time, $subnode[
"lft"]);
603 $order = ($curnode[
"lft"] > 0)
605 : (
int) ($order + 1);
606 $ilUser->addObjectToClipboard($id,
621 include_once(
"./Modules/LearningModule/classes/class.ilEditClipboard.php");
623 include_once(
"./Services/Skill/classes/class.ilSkillTree.php");
626 $parent_id = $a_obj_id;
630 $skills = $ilUser->getClipboardObjects(
$a_type);
631 $copied_nodes =
array();
632 foreach ($skills as $skill)
635 if(!in_array($skill[
"id"], array_keys($copied_nodes)))
638 $skill[
"insert_time"], $copied_nodes,
646 self::clearClipboard();
652 return $copied_nodes;
665 $ilUser->clipboardDeleteObjectsOfType(
"skll");
666 $ilUser->clipboardDeleteObjectsOfType(
"scat");
667 $ilUser->clipboardDeleteObjectsOfType(
"sktr");
668 $ilUser->clipboardDeleteObjectsOfType(
"sktp");
669 $ilUser->clipboardDeleteObjectsOfType(
"sctp");
670 include_once(
"./Modules/LearningModule/classes/class.ilEditClipboard.php");
678 static function pasteTree($a_item_id, $a_parent_id, $a_target, $a_insert_time,
679 &$a_copied_nodes, $a_as_copy =
false, $a_add_suffix =
false)
685 if ($item_type ==
"scat")
687 include_once(
"./Services/Skill/classes/class.ilSkillCategory.php");
690 else if ($item_type ==
"skll")
692 include_once(
"./Services/Skill/classes/class.ilBasicSkill.php");
695 else if ($item_type ==
"sktr")
697 include_once(
"./Services/Skill/classes/class.ilSkillTemplateReference.php");
700 else if ($item_type ==
"sktp")
702 include_once(
"./Services/Skill/classes/class.ilBasicSkillTemplate.php");
705 else if ($item_type ==
"sctp")
707 include_once(
"./Services/Skill/classes/class.ilSkillTemplateCategory.php");
711 $ilLog->write(
"Getting from clipboard type ".$item_type.
", ".
712 "Item ID: ".$a_item_id);
716 $target_item = $item->copy();
719 $target_item->setTitle($target_item->getTitle().
" ".$lng->txt(
"copy_of_suffix"));
720 $target_item->update();
722 $a_copied_nodes[$item->getId()] = $target_item->getId();
726 $target_item = $item;
729 $ilLog->write(
"Putting into skill tree type ".$target_item->getType().
730 "Item ID: ".$target_item->getId().
", Parent: ".$a_parent_id.
", ".
731 "Target: ".$a_target);
735 $childs = $ilUser->getClipboardChilds($item->getId(), $a_insert_time);
737 foreach($childs as $child)
740 IL_LAST_NODE, $a_insert_time, $a_copied_nodes, $a_as_copy);
743 return $target_item->getId();
755 if ($skill_tree->isInTree($a_id))
772 $set = $ilDB->query(
"SELECT obj_id, title FROM skl_tree_node WHERE ".
773 " self_eval = ".$ilDB->quote(
true,
"integer").
" ORDER BY TITLE " 776 while ($rec = $ilDB->fetchAssoc($set))
778 $nodes[$rec[
"obj_id"]] = $rec[
"title"];
792 $childs = $tr->getChildsByTypeFilter($tr->getRootId(),
array(
"sktp",
"sctp"));
807 $set = $ilDB->query(
"SELECT * FROM skl_tree_node ".
808 " WHERE self_eval = ".$ilDB->quote(1,
"integer")
811 $sel_skills =
array();
812 while ($rec = $ilDB->fetchAssoc($set))
814 $sel_skills[] = $rec;
828 include_once(
"./Services/Skill/classes/class.ilSkillTree.php");
831 if ($a_par_id != $skill_tree->readRootId())
833 $childs = $skill_tree->getChilds($a_par_id);
839 $childs = $skill_tree->getChildsByTypeFilter($a_par_id,
840 array(
"skrt",
"sktp",
"sctp"));
844 $childs = $skill_tree->getChildsByTypeFilter($a_par_id,
845 array(
"skrt",
"skll",
"scat",
"sktr"));
849 foreach ($childs as $k => $c)
851 if (isset($a_childs_order[$c[
"child"]]))
853 $childs[$k][
"order_nr"] = (int) $a_childs_order[$c[
"child"]];
860 foreach ($childs as $c)
878 if ($a_status == self::STATUS_DRAFT &&
$a_type ==
"sctp")
882 if ($a_status == self::STATUS_DRAFT &&
$a_type ==
"sktp")
887 $off = ($a_status == self::STATUS_DRAFT)
891 $a_name =
"icon_".$a_type.$a_size.$off.
".svg";
894 include_once(
"./Services/Skill/classes/class.ilSkillTemplateReference.php");
899 $a_name =
"icon_sctr".$a_size.$off.
".svg";
917 $candidates =
array();
922 " FROM skl_tree_node".
923 " WHERE ".$ilDB->like(
"title",
"text",
"%".$a_term.
"%");
924 $sql .=
" ORDER BY title";
925 $set = $ilDB->query($sql);
926 include_once(
"./Services/Skill/classes/class.ilSkillTemplateReference.php");
927 while(
$row = $ilDB->fetchAssoc($set))
929 if (in_array(
$row[
"type"],
array(
"sctp",
"sktp")))
932 $path = $skill_tree->getSkillTreePath(
$row[
"obj_id"]);
936 foreach ($trefs as $tref)
938 $candidates[] =
array(
"tref_id" => $tref,
"skill_id" =>
$row[
"obj_id"],
"title" =>
$row[
"title"]);
942 else if (
$row[
"type"] ==
"sktr")
950 $candidates[] =
array(
"tref_id" => 0,
"skill_id" =>
$row[
"obj_id"],
"title" =>
$row[
"title"]);
954 foreach ($candidates as $c)
957 $path = $skill_tree->getSkillTreePath($c[
"skill_id"], $c[
"tref_id"]);
967 foreach (
$path as $p)
969 if ($p[
"status"] > 0)
977 if (!in_array($c[
"title"],
$res))
979 $res[] = $c[
"title"];
996 include_once(
"./Services/Skill/classes/class.ilSkillTemplateReference.php");
997 $cskill_ids =
array();
998 foreach($a_node_ids as $id)
1000 if (in_array(self::_lookupType($id),
array(
"skll",
"scat",
"sktr")))
1009 $cskill_ids[] =
array(
"skill_id" => $skill_id,
"tref_id" => $tref_id);
1015 $cskill_ids[] =
array(
"skill_id" => $id,
"tref_id" => $tref_id);
static getAllCSkillIdsForNodeIds(array $a_node_ids)
Get all possible common skill IDs for node IDs.
static clearClipboard()
Remove all skill items from clipboard.
setType($a_type)
Set type.
static clipboardCut($a_tree_id, $a_ids)
Cut and copy a set of skills/skill categories into the clipboard.
static _writeTitle($a_obj_id, $a_title)
Write Title.
static getAllStatus()
Get all status.
Skill Template Reference.
setTitle($a_title)
Set title.
static _lookupSelfEvaluation($a_obj_id)
Lookup self evaluation.
static getIconPath($a_obj_id, $a_type, $a_size="", $a_status=0)
Get icon path.
static _lookupTrefIdsForTemplateId($a_tid)
Get all tref ids for a template id.
static putInTree($a_obj, $a_parent_id="", $a_target_node_id="")
Put this object into the skill tree.
setDataRecord($a_record)
this method should only be called by class ilSCORM2004NodeFactory
static getAllSelfEvaluationNodes()
Get all self evaluation nodes.
setImportId($a_val)
Set import id.
static _lookup($a_obj_id, $a_field)
Lookup Title.
static getSelectableSkills()
Get selectable skills.
static getTree($a_slm_obj_id)
Get scorm module editing tree.
static insertItemsFromClip($a_type, $a_obj_id)
Insert basic skills from clipboard.
getSelfEvaluation()
Get self evaluation.
setSelfEvaluation($a_val)
Set self evaluation.
static sortArray($array, $a_array_sortby, $a_array_sortorder=0, $a_numeric=false, $a_keep_keys=false)
sortArray
getImportId()
Get import id.
static _lookupType($a_obj_id)
Lookup Type.
getOrderNr()
Get order nr.
static uniqueTypesCheck($a_items)
Check for unique types.
static findSkills($a_term)
Find skills.
static isInTree($a_id)
Is id in tree?
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)
date( 'd-M-Y', $objPHPExcel->getProperties() ->getCreated())
static _lookupTemplateId($a_obj_id)
Lookup template ID.
static clipboardCopy($a_tree_id, $a_ids)
Copy a set of skills/skill categories into the clipboard.
setCreationDate($a_val)
Set creation date.
Create styles array
The data for the language used.
static saveChildsOrder($a_par_id, $a_childs_order, $a_templates=false)
Save childs order.
static _lookupTitle($a_obj_id, $a_tref_id=0)
Lookup Title.
static getStatusInfo($a_status)
Get status info.
setOrderNr($a_val)
Set order nr.
static _lookupTrefIdsForTopTemplateId($a_template_id)
Lookup tref ids for template id.
A node in the skill tree.
Add data(end) time
Method that wraps PHPs time in order to allow simulations with the workflow.
setStatus($a_val)
Set status.
static _lookupStatus($a_obj_id)
Lookup Status.
static _writeOrderNr($a_obj_id, $a_nr)
Write Order Nr.
static pasteTree($a_item_id, $a_parent_id, $a_target, $a_insert_time, &$a_copied_nodes, $a_as_copy=false, $a_add_suffix=false)
Paste item (tree) from clipboard to skill tree.
getCreationDate()
Get creation date.
static getTopTemplates()
Get top skill templates and template categories.