5include_once(
"./Services/Skill/classes/class.ilSkillTree.php");
 
   36        $this->db = 
$DIC->database();
 
   53        $this->title = $a_title;
 
  113        $this->self_eval = $a_val;
 
  123        return $this->self_eval;
 
  133        $this->order_nr = $a_val;
 
  143        return $this->order_nr;
 
  153        $this->import_id = $a_val;
 
  163        return $this->import_id;
 
  173        $this->creation_date = $a_val;
 
  183        return $this->creation_date;
 
  198            self::STATUS_DRAFT => 
$lng->txt(
"skmg_status_draft"),
 
  199            self::STATUS_PUBLISH => 
$lng->txt(
"skmg_status_publish"),
 
  200            self::STATUS_OUTDATED => 
$lng->txt(
"skmg_status_outdated")
 
  231        if (!isset($this->data_record)) {
 
  232            $query = 
"SELECT * FROM skl_tree_node WHERE obj_id = " .
 
  233                $ilDB->quote($this->
id, 
"integer");
 
  235            $this->data_record = 
$ilDB->fetchAssoc($obj_set);
 
  237        $this->
setType($this->data_record[
"type"]);
 
  238        $this->
setTitle($this->data_record[
"title"]);
 
  239        $this->
setOrderNr($this->data_record[
"order_nr"]);
 
  241        $this->
setStatus($this->data_record[
"status"]);
 
  242        $this->
setImportId($this->data_record[
"import_id"]);
 
  251        $this->data_record = $a_record;
 
  260    protected static function _lookup($a_obj_id, $a_field)
 
  266        $query = 
"SELECT $a_field FROM skl_tree_node WHERE obj_id = " .
 
  267            $ilDB->quote($a_obj_id, 
"integer");
 
  269        $obj_rec = 
$ilDB->fetchAssoc($obj_set);
 
  271        return $obj_rec[$a_field];
 
  286        include_once(
"./Services/Skill/classes/class.ilSkillTemplateReference.php");
 
  335        $query = 
"SELECT * FROM skl_tree_node WHERE obj_id = " .
 
  336            $ilDB->quote($a_obj_id, 
"integer");
 
  338        $obj_rec = 
$ilDB->fetchAssoc($obj_set);
 
  340        return $obj_rec[
"type"];
 
  350        $this->status = $a_val;
 
  360        return $this->status;
 
  375        $query = 
"UPDATE skl_tree_node SET " .
 
  376            " title = " . 
$ilDB->quote($a_title, 
"text") .
 
  377            " WHERE obj_id = " . 
$ilDB->quote($a_obj_id, 
"integer");
 
  394        $query = 
"UPDATE skl_tree_node SET " .
 
  395            " order_nr = " . 
$ilDB->quote($a_nr, 
"integer") .
 
  396            " WHERE obj_id = " . 
$ilDB->quote($a_obj_id, 
"integer");
 
  410        $id = 
$ilDB->nextId(
"skl_tree_node");
 
  411        $query = 
"INSERT INTO skl_tree_node (obj_id, title, type, create_date, self_eval, order_nr, status, creation_date, import_id) " .
 
  413            $ilDB->quote(
$id, 
"integer") . 
"," .
 
  416            $ilDB->now() . 
", " .
 
  420            $ilDB->now() . 
", " .
 
  434        $query = 
"UPDATE skl_tree_node SET " .
 
  438            " ,status = " . 
$ilDB->quote((
int) $this->
getStatus(), 
"integer") .
 
  440            " WHERE obj_id = " . 
$ilDB->quote($this->
getId(), 
"integer");
 
  448    public function delete()
 
  452        $query = 
"DELETE FROM skl_tree_node WHERE obj_id= " .
 
  460    public static function putInTree($a_obj, $a_parent_id = 
"", $a_target_node_id = 
"")
 
  465        $parent_id = ($a_parent_id != 
"")
 
  467            : $skill_tree->getRootId();
 
  472            "skrt" => array(
"skll", 
"scat", 
"sktr", 
"sktp", 
"sctp"),
 
  473            "scat" => array(
"skll", 
"scat", 
"sktr"),
 
  474            "sctp" => array(
"sktp", 
"sctp"));
 
  476        if (!is_array($allowed[$par_type]) ||
 
  477            !in_array($a_obj->getType(), $allowed[$par_type])) {
 
  482        if ($a_target_node_id != 
"") {
 
  486            $childs = $skill_tree->getChilds($parent_id);
 
  488            if (count($childs) == 0) {
 
  491                $target = $childs[count($childs) - 1][
"obj_id"];
 
  495        if ($skill_tree->isInTree($parent_id) && !$skill_tree->isInTree($a_obj->getId())) {
 
  496            $skill_tree->insertNode($a_obj->getId(), $parent_id, 
$target);
 
  520        if (is_array($a_items)) {
 
  521            foreach ($a_items as $item) {
 
  527        if (count($types) > 1) {
 
  539        include_once(
"./Services/Skill/classes/class.ilSkillTree.php");
 
  542        if (!is_array($a_ids)) {
 
  546            foreach ($a_ids as 
$id) {
 
  549                foreach (
$path as $path_id) {
 
  550                    if ($path_id != 
$id && in_array($path_id, $a_ids)) {
 
  565        foreach ($cut_ids as 
$id) {
 
  566            $curnode = $tree->getNodeData(
$id);
 
  567            if ($tree->isInTree(
$id)) {
 
  568                $tree->deleteTree($curnode);
 
  584        include_once(
"./Services/Skill/classes/class.ilSkillTree.php");
 
  589        foreach ($a_ids as 
$id) {
 
  591            if ($tree->isInTree(
$id)) {
 
  592                $curnode = $tree->getNodeData(
$id);
 
  593                $subnodes = $tree->getSubTree($curnode);
 
  594                foreach ($subnodes as $subnode) {
 
  595                    if ($subnode[
"child"] != 
$id) {
 
  607            $order = ($curnode[
"lft"] > 0)
 
  609                : (
int) ($order + 1);
 
  633        include_once(
"./Modules/LearningModule/classes/class.ilEditClipboard.php");
 
  635        include_once(
"./Services/Skill/classes/class.ilSkillTree.php");
 
  638        $parent_id = $a_obj_id;
 
  643        $copied_nodes = array();
 
  644        foreach ($skills as $skill) {
 
  646            if (!in_array($skill[
"id"], array_keys($copied_nodes))) {
 
  651                    $skill[
"insert_time"],
 
  668            in_array(
$a_type, array(
"sktp", 
"sctp"))
 
  671        return $copied_nodes;
 
  686        $ilUser->clipboardDeleteObjectsOfType(
"skll");
 
  687        $ilUser->clipboardDeleteObjectsOfType(
"scat");
 
  688        $ilUser->clipboardDeleteObjectsOfType(
"sktr");
 
  689        $ilUser->clipboardDeleteObjectsOfType(
"sktp");
 
  690        $ilUser->clipboardDeleteObjectsOfType(
"sctp");
 
  691        include_once(
"./Modules/LearningModule/classes/class.ilEditClipboard.php");
 
  706        $a_add_suffix = 
false 
  716        if ($item_type == 
"scat") {
 
  717            include_once(
"./Services/Skill/classes/class.ilSkillCategory.php");
 
  719        } elseif ($item_type == 
"skll") {
 
  720            include_once(
"./Services/Skill/classes/class.ilBasicSkill.php");
 
  722        } elseif ($item_type == 
"sktr") {
 
  723            include_once(
"./Services/Skill/classes/class.ilSkillTemplateReference.php");
 
  725        } elseif ($item_type == 
"sktp") {
 
  726            include_once(
"./Services/Skill/classes/class.ilBasicSkillTemplate.php");
 
  728        } elseif ($item_type == 
"sctp") {
 
  729            include_once(
"./Services/Skill/classes/class.ilSkillTemplateCategory.php");
 
  733        $ilLog->write(
"Getting from clipboard type " . $item_type . 
", " .
 
  734            "Item ID: " . $a_item_id);
 
  737            $target_item = $item->copy();
 
  739                $target_item->setTitle($target_item->getTitle() . 
" " . 
$lng->txt(
"copy_of_suffix"));
 
  740                $target_item->update();
 
  742            $a_copied_nodes[$item->getId()] = $target_item->getId();
 
  744            $target_item = $item;
 
  747        $ilLog->write(
"Putting into skill tree type " . $target_item->getType() .
 
  748            "Item ID: " . $target_item->getId() . 
", Parent: " . $a_parent_id . 
", " .
 
  749            "Target: " . $a_target);
 
  753        $childs = 
$ilUser->getClipboardChilds($item->getId(), $a_insert_time);
 
  755        foreach ($childs as $child) {
 
  758                $target_item->getId(),
 
  766        return $target_item->getId();
 
  778        if ($skill_tree->isInTree($a_id)) {
 
  797            "SELECT obj_id, title FROM skl_tree_node WHERE " .
 
  798            " self_eval = " . 
$ilDB->quote(
true, 
"integer") . 
" ORDER BY TITLE " 
  801        while ($rec = 
$ilDB->fetchAssoc($set)) {
 
  802            $nodes[$rec[
"obj_id"]] = $rec[
"title"];
 
  816        $childs = $tr->getChildsByTypeFilter($tr->getRootId(), array(
"sktp", 
"sctp"));
 
  834            "SELECT * FROM skl_tree_node " .
 
  835            " WHERE self_eval = " . 
$ilDB->quote(1, 
"integer")
 
  838        $sel_skills = array();
 
  839        while ($rec = 
$ilDB->fetchAssoc($set)) {
 
  840            $sel_skills[] = $rec;
 
  852    public static function saveChildsOrder($a_par_id, $a_childs_order, $a_templates = 
false)
 
  854        include_once(
"./Services/Skill/classes/class.ilSkillTree.php");
 
  857        if ($a_par_id != $skill_tree->readRootId()) {
 
  858            $childs = $skill_tree->getChilds($a_par_id);
 
  861                $childs = $skill_tree->getChildsByTypeFilter(
 
  863                    array(
"skrt", 
"sktp", 
"sctp")
 
  866                $childs = $skill_tree->getChildsByTypeFilter(
 
  868                    array(
"skrt", 
"skll", 
"scat", 
"sktr")
 
  873        foreach ($childs as $k => $c) {
 
  874            if (isset($a_childs_order[$c[
"child"]])) {
 
  875                $childs[$k][
"order_nr"] = (int) $a_childs_order[$c[
"child"]];
 
  882        foreach ($childs as $c) {
 
  899        if ($a_status == self::STATUS_DRAFT && 
$a_type == 
"sctp") {
 
  902        if ($a_status == self::STATUS_DRAFT && 
$a_type == 
"sktp") {
 
  910        $a_name = 
"icon_" . 
$a_type . $a_size . $off . 
".svg";
 
  912            include_once(
"./Services/Skill/classes/class.ilSkillTemplateReference.php");
 
  915            if (
$type == 
"sctp") {
 
  916                $a_name = 
"icon_sctr" . $a_size . $off . 
".svg";
 
  919        $vers = 
"vers=" . str_replace(array(
".", 
" "), 
"-", 
ILIAS_VERSION);
 
  936        $candidates = array();
 
  941            " FROM skl_tree_node" .
 
  942            " WHERE " . 
$ilDB->like(
"title", 
"text", 
"%" . $a_term . 
"%");
 
  943        $sql .= 
" ORDER BY title";
 
  944        $set = 
$ilDB->query($sql);
 
  945        include_once(
"./Services/Skill/classes/class.ilSkillTemplateReference.php");
 
  947            if (in_array(
$row[
"type"], array(
"sctp", 
"sktp"))) {
 
  949                $path = $skill_tree->getSkillTreePath(
$row[
"obj_id"]);
 
  950                if (
$path[1][
"child"] != 
$row[
"obj_id"]) {
 
  952                    foreach ($trefs as $tref) {
 
  953                        $candidates[] = array(
"tref_id" => $tref, 
"skill_id" => 
$row[
"obj_id"], 
"title" => 
$row[
"title"]);
 
  956            } elseif (
$row[
"type"] == 
"sktr") {
 
  961                $candidates[] = array(
"tref_id" => 0, 
"skill_id" => 
$row[
"obj_id"], 
"title" => 
$row[
"title"]);
 
  965        foreach ($candidates as $c) {
 
  967            $path = $skill_tree->getSkillTreePath($c[
"skill_id"], $c[
"tref_id"]);
 
  974            if (is_array(
$path)) {
 
  975                foreach (
$path as $p) {
 
  976                    if ($p[
"status"] > 0) {
 
  982                if (!in_array($c[
"title"], 
$res)) {
 
  983                    $res[] = $c[
"title"];
 
 1000        include_once(
"./Services/Skill/classes/class.ilSkillTemplateReference.php");
 
 1001        $cskill_ids = array();
 
 1002        foreach ($a_node_ids as 
$id) {
 
 1003            if (in_array(self::_lookupType(
$id), array(
"skll", 
"scat", 
"sktr"))) {
 
 1010                $cskill_ids[] = array(
"skill_id" => $skill_id, 
"tref_id" => $tref_id);
 
 1014                    $cskill_ids[] = array(
"skill_id" => 
$id, 
"tref_id" => $tref_id);
 
date( 'd-M-Y', $objPHPExcel->getProperties() ->getCreated())
An exception for terminatinating execution or to throw for unit testing.
Skill Template Reference.
static _lookupTrefIdsForTemplateId($a_tid)
Get all tref ids for a template id.
static _lookupTrefIdsForTopTemplateId($a_template_id)
Lookup tref ids for template id.
static _lookupTemplateId($a_obj_id)
Lookup template ID.
A node in the skill tree.
static isInTree($a_id)
Is id in tree?
static _writeTitle($a_obj_id, $a_title)
Write Title.
static getIconPath($a_obj_id, $a_type, $a_size="", $a_status=0)
Get icon path.
static putInTree($a_obj, $a_parent_id="", $a_target_node_id="")
Put this object into the skill tree.
static uniqueTypesCheck($a_items)
Check for unique types.
setTitle($a_title)
Set title.
static getStatusInfo($a_status)
Get status info.
static _lookupStatus($a_obj_id)
Lookup Status.
static saveChildsOrder($a_par_id, $a_childs_order, $a_templates=false)
Save childs order.
static insertItemsFromClip($a_type, $a_obj_id)
Insert basic skills from clipboard.
static getAllStatus()
Get all status.
static findSkills($a_term)
Find skills.
static getTopTemplates()
Get top skill templates and template categories.
static clipboardCopy($a_tree_id, $a_ids)
Copy a set of skills/skill categories into the clipboard.
setCreationDate($a_val)
Set creation date.
setOrderNr($a_val)
Set order nr.
static _lookupSelfEvaluation($a_obj_id)
Lookup self evaluation.
static _lookupTitle($a_obj_id, $a_tref_id=0)
Lookup Title.
static clearClipboard()
Remove all skill items from clipboard.
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.
setType($a_type)
Set type.
static _lookup($a_obj_id, $a_field)
Lookup Title.
static getTree($a_slm_obj_id)
Get scorm module editing tree.
static clipboardCut($a_tree_id, $a_ids)
Cut and copy a set of skills/skill categories into the clipboard.
static getAllSelfEvaluationNodes()
Get all self evaluation nodes.
getOrderNr()
Get order nr.
static getSelectableSkills()
Get selectable skills.
static _writeOrderNr($a_obj_id, $a_nr)
Write Order Nr.
setDataRecord($a_record)
this method should only be called by class ilSCORM2004NodeFactory
setStatus($a_val)
Set status.
setSelfEvaluation($a_val)
Set self evaluation.
getImportId()
Get import id.
static getAllCSkillIdsForNodeIds(array $a_node_ids)
Get all possible common skill IDs for node IDs.
static _lookupType($a_obj_id)
Lookup Type.
getSelfEvaluation()
Get self evaluation.
setImportId($a_val)
Set import id.
static sortArray( $array, $a_array_sortby, $a_array_sortorder=0, $a_numeric=false, $a_keep_keys=false)
sortArray
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)
foreach($_POST as $key=> $value) $res