ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
ilSkillTreeNode Class Reference

A node in the skill tree. More...

+ Inheritance diagram for ilSkillTreeNode:
+ Collaboration diagram for ilSkillTreeNode:

Public Member Functions

 __construct ($a_id=0)
 
 setTitle ($a_title)
 Set title. More...
 
 getTitle ()
 Get title. More...
 
 setType ($a_type)
 Set type. More...
 
 getType ()
 Get type. More...
 
 setId ($a_id)
 Set Node ID. More...
 
 getId ()
 Get Node ID. More...
 
 setSelfEvaluation ($a_val)
 Set self evaluation. More...
 
 getSelfEvaluation ()
 Get self evaluation. More...
 
 setOrderNr ($a_val)
 Set order nr. More...
 
 getOrderNr ()
 Get order nr. More...
 
 setImportId ($a_val)
 Set import id. More...
 
 getImportId ()
 Get import id. More...
 
 getCreationDate ()
 Get creation date. More...
 
 read ()
 Read Data of Node. More...
 
 setDataRecord ($a_record)
 this method should only be called by class ilSCORM2004NodeFactory More...
 
 setStatus ($a_val)
 Set status. More...
 
 getStatus ()
 Get status. More...
 
 create ()
 Create Node. More...
 
 update ()
 Update Node. More...
 
 delete ()
 Delete Node. More...
 

Static Public Member Functions

static getAllStatus ()
 Get all status. More...
 
static getStatusInfo ($a_status)
 Get status info. More...
 
static _lookupTitle ($a_obj_id, $a_tref_id=0)
 Lookup Title. More...
 
static _lookupSelfEvaluation ($a_obj_id)
 Lookup self evaluation. More...
 
static _lookupStatus ($a_obj_id)
 Lookup Status. More...
 
static _lookupType ($a_obj_id)
 Lookup Type. More...
 
static _writeTitle ($a_obj_id, $a_title)
 Write Title. More...
 
static _writeOrderNr ($a_obj_id, $a_nr)
 Write Order Nr. More...
 
static putInTree ($a_obj, $a_parent_id="", $a_target_node_id="")
 Put this object into the skill tree. More...
 
static getTree ($a_slm_obj_id)
 Get scorm module editing tree. More...
 
static uniqueTypesCheck ($a_items)
 Check for unique types. More...
 
static clipboardCut ($a_tree_id, $a_ids)
 Cut and copy a set of skills/skill categories into the clipboard. More...
 
static clipboardCopy ($a_tree_id, $a_ids)
 Copy a set of skills/skill categories into the clipboard. More...
 
static insertItemsFromClip ($a_type, $a_obj_id)
 Insert basic skills from clipboard. More...
 
static clearClipboard ()
 Remove all skill items from clipboard. More...
 
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. More...
 
static isInTree ($a_id)
 Is id in tree? More...
 
static getAllSelfEvaluationNodes ()
 Get all self evaluation nodes. More...
 
static getTopTemplates ()
 Get top skill templates and template categories. More...
 
static getSelectableSkills ()
 Get selectable skills. More...
 
static saveChildsOrder ($a_par_id, $a_childs_order, $a_templates=false)
 Save childs order. More...
 
static getIconPath ($a_obj_id, $a_type, $a_size="", $a_status=0)
 Get icon path. More...
 
static findSkills ($a_term)
 Find skills. More...
 
static getAllCSkillIdsForNodeIds (array $a_node_ids)
 Get all possible common skill IDs for node IDs. More...
 

Data Fields

const STATUS_PUBLISH = 0
 
const STATUS_DRAFT = 1
 
const STATUS_OUTDATED = 2
 
 $type
 
 $id
 
 $title
 

Protected Member Functions

 setCreationDate ($a_val)
 Set creation date. More...
 

Static Protected Member Functions

static _lookup ($a_obj_id, $a_field)
 Lookup Title. More...
 

Detailed Description

A node in the 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 15 of file class.ilSkillTreeNode.php.

Constructor & Destructor Documentation

◆ __construct()

ilSkillTreeNode::__construct (   $a_id = 0)
Parameters
intnode id

Reimplemented in ilBasicSkill, ilBasicSkillTemplate, ilSkillCategory, ilSkillRoot, ilSkillTemplateCategory, and ilSkillTemplateReference.

Definition at line 27 of file class.ilSkillTreeNode.php.

28 {
29 $this->id = $a_id;
30
31 $this->skill_tree = new ilSkillTree();
32
33 if($a_id != 0)
34 {
35 $this->read();
36 }
37 }
read()
Read Data of Node.

References read().

+ Here is the call graph for this function:

Member Function Documentation

◆ _lookup()

static ilSkillTreeNode::_lookup (   $a_obj_id,
  $a_field 
)
staticprotected

Lookup Title.

Parameters
intNode ID
Returns
string Title

Definition at line 251 of file class.ilSkillTreeNode.php.

252 {
253 global $ilDB;
254
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);
259
260 return $obj_rec[$a_field];
261 }
global $ilDB

References $ilDB, and $query.

Referenced by _lookupSelfEvaluation(), _lookupStatus(), and _lookupTitle().

+ Here is the caller graph for this function:

◆ _lookupSelfEvaluation()

static ilSkillTreeNode::_lookupSelfEvaluation (   $a_obj_id)
static

Lookup self evaluation.

Parameters
intnode ID
Returns
boolean selectable? (self evaluation=

Definition at line 287 of file class.ilSkillTreeNode.php.

288 {
289 global $ilDB;
290
291 return self::_lookup($a_obj_id, "self_eval");
292 }
static _lookup($a_obj_id, $a_field)
Lookup Title.

References $ilDB, and _lookup().

Referenced by ilPersonalSkillExplorerGUI\buildSelectableTree(), ilSkillTemplateTreeExplorerGUI\getNodeContent(), ilSkillTreeExplorerGUI\getNodeContent(), and ilPersonalSkillExplorerGUI\isNodeClickable().

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

◆ _lookupStatus()

static ilSkillTreeNode::_lookupStatus (   $a_obj_id)
static

Lookup Status.

Parameters
int$a_obj_idnode ID
Returns
int status

Definition at line 300 of file class.ilSkillTreeNode.php.

301 {
302 global $ilDB;
303
304 return self::_lookup($a_obj_id, "status");
305 }

References $ilDB, and _lookup().

Referenced by ilPersonalSkillExplorerGUI\buildSelectableTree(), ilSkillCatTableGUI\fillRow(), ilSkillTemplateTreeExplorerGUI\getChildsOfNode(), ilVirtualSkillTree\getChildsOfNode(), and ilSkillTreeNodeGUI\setTitleIcon().

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

◆ _lookupTitle()

static ilSkillTreeNode::_lookupTitle (   $a_obj_id,
  $a_tref_id = 0 
)
static

Lookup Title.

Parameters
intnode ID
Returns
string title

Definition at line 269 of file class.ilSkillTreeNode.php.

270 {
271 global $ilDB;
272
273 include_once("./Services/Skill/classes/class.ilSkillTemplateReference.php");
274 if ($a_tref_id > 0 && ilSkillTemplateReference::_lookupTemplateId($a_tref_id) == $a_obj_id)
275 {
276 return self::_lookup($a_tref_id, "title");
277 }
278 return self::_lookup($a_obj_id, "title");
279 }
static _lookupTemplateId($a_obj_id)
Lookup template ID.

References $ilDB, _lookup(), and ilSkillTemplateReference\_lookupTemplateId().

Referenced by ilSkillUsageTableGUI\__construct(), ilSurveySkillThresholdsTableGUI\__construct(), ilPersonalSkillsGUI\assignMaterials(), clipboardCopy(), ilTestSkillLevelThresholdsTableGUI\completeCompetenceTitles(), ilSkillProfileGUI\confirmLevelAssignmentRemoval(), ilSkillSelfEvaluationGUI\confirmSelfEvaluationDeletion(), ilPersonalSkillsGUI\confirmSkillRemove(), ilSurveySkillAssignmentTableGUI\fillRow(), ilSurveySkillTableGUI\fillRow(), ilSelfEvaluationTableGUI\fillRow(), ilSurveySkill\getAllAssignedSkillsAsOptions(), ilTestSkillLevelThresholdImportFails\getFailedImportsMessage(), ilPersonalSkillsGUI\getGapAnalysisHTML(), ilPersonalSkill\getSelectedUserSkills(), ilSurveySkillTableGUI\getSkills(), ilObjPortfolioGUI\initCreatePortfolioFromTemplateForm(), ilAssQuestionSkillAssignment\loadAdditionalSkillData(), ilPersonalSkillsGUI\renderSkillHTML(), ilPortfolioPageGUI\renderSkillsTeaser(), and ilPersonalSkillsGUI\selfEvaluation().

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

◆ _lookupType()

◆ _writeOrderNr()

static ilSkillTreeNode::_writeOrderNr (   $a_obj_id,
  $a_nr 
)
static

Write Order Nr.

Parameters
intNode ID
stringOrder Nr

Definition at line 368 of file class.ilSkillTreeNode.php.

369 {
370 global $ilDB;
371
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);
376 }

References $ilDB, and $query.

Referenced by saveChildsOrder().

+ Here is the caller graph for this function:

◆ _writeTitle()

static ilSkillTreeNode::_writeTitle (   $a_obj_id,
  $a_title 
)
static

Write Title.

Parameters
intNode ID
stringTitle

Definition at line 351 of file class.ilSkillTreeNode.php.

352 {
353 global $ilDB;
354
355 $query = "UPDATE skl_tree_node SET ".
356 " title = ".$ilDB->quote($a_title, "text").
357 " WHERE obj_id = ".$ilDB->quote($a_obj_id, "integer");
358
359 $ilDB->manipulate($query);
360 }

References $ilDB, and $query.

Referenced by ilObjSkillManagementGUI\saveAllTemplateTitles(), and ilObjSkillManagementGUI\saveAllTitles().

+ Here is the caller graph for this function:

◆ clearClipboard()

static ilSkillTreeNode::clearClipboard ( )
static

Remove all skill items from clipboard.

Parameters

return

Definition at line 661 of file class.ilSkillTreeNode.php.

662 {
663 global $ilUser;
664
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");
672 }
$ilUser
Definition: imgupload.php:18

References $ilUser, and ilEditClipboard\clear().

Referenced by clipboardCopy(), clipboardCut(), and insertItemsFromClip().

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

◆ clipboardCopy()

static ilSkillTreeNode::clipboardCopy (   $a_tree_id,
  $a_ids 
)
static

Copy a set of skills/skill categories into the clipboard.

Definition at line 576 of file class.ilSkillTreeNode.php.

577 {
578 global $ilUser;
579
581 include_once("./Services/Skill/classes/class.ilSkillTree.php");
582 $tree = new ilSkillTree();
583
584 // put them into the clipboard
585 $time = date("Y-m-d H:i:s", time());
586 foreach ($a_ids as $id)
587 {
588 $curnode = "";
589 if ($tree->isInTree($id))
590 {
591 $curnode = $tree->getNodeData($id);
592 $subnodes = $tree->getSubTree($curnode);
593 foreach($subnodes as $subnode)
594 {
595 if ($subnode["child"] != $id)
596 {
597 $ilUser->addObjectToClipboard($subnode["child"],
598 $subnode["type"], $subnode["title"],
599 $subnode["parent"], $time, $subnode["lft"]);
600 }
601 }
602 }
603 $order = ($curnode["lft"] > 0)
604 ? $curnode["lft"]
605 : (int) ($order + 1);
606 $ilUser->addObjectToClipboard($id,
608 $order);
609 }
610 }
date( 'd-M-Y', $objPHPExcel->getProperties() ->getCreated())
static _lookupTitle($a_obj_id, $a_tref_id=0)
Lookup Title.
static clearClipboard()
Remove all skill items from clipboard.
static _lookupType($a_obj_id)
Lookup Type.

References $id, $ilUser, _lookupTitle(), _lookupType(), clearClipboard(), and date.

Referenced by clipboardCut(), and ilSkillTreeNodeGUI\copyItems().

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

◆ clipboardCut()

static ilSkillTreeNode::clipboardCut (   $a_tree_id,
  $a_ids 
)
static

Cut and copy a set of skills/skill categories into the clipboard.

Definition at line 525 of file class.ilSkillTreeNode.php.

526 {
528 include_once("./Services/Skill/classes/class.ilSkillTree.php");
529 $tree = new ilSkillTree();
530
531 if (!is_array($a_ids))
532 {
533 return false;
534 }
535 else
536 {
537 // get all "top" ids, i.e. remove ids, that have a selected parent
538 foreach($a_ids as $id)
539 {
540 $path = $tree->getPathId($id);
541 $take = true;
542 foreach($path as $path_id)
543 {
544 if ($path_id != $id && in_array($path_id, $a_ids))
545 {
546 $take = false;
547 }
548 }
549 if ($take)
550 {
551 $cut_ids[] = $id;
552 }
553 }
554 }
555
556 ilSkillTreeNode::clipboardCopy($a_tree_id, $cut_ids);
557
558 // remove the objects from the tree
559 // note: we are getting skills/categories which are *not* in the tree
560 // we do not delete any pages/chapters here
561 foreach ($cut_ids as $id)
562 {
563 $curnode = $tree->getNodeData($id);
564 if ($tree->isInTree($id))
565 {
566 $tree->deleteTree($curnode);
567 }
568 }
569
570 }
$path
Definition: aliased.php:25
static clipboardCopy($a_tree_id, $a_ids)
Copy a set of skills/skill categories into the clipboard.

References $id, $path, clearClipboard(), and clipboardCopy().

Referenced by ilSkillTreeNodeGUI\cutItems().

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

◆ create()

ilSkillTreeNode::create ( )

Create Node.

Parameters
booleanUpload Mode

Reimplemented in ilBasicSkill, ilSkillCategory, ilSkillRoot, and ilSkillTemplateReference.

Definition at line 383 of file class.ilSkillTreeNode.php.

384 {
385 global $ilDB;
386
387 // insert object data
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) ".
390 "VALUES (".
391 $ilDB->quote($id, "integer").",".
392 $ilDB->quote($this->getTitle(), "text").",".
393 $ilDB->quote($this->getType(), "text").", ".
394 $ilDB->now().", ".
395 $ilDB->quote((int) $this->getSelfEvaluation(), "integer").", ".
396 $ilDB->quote((int) $this->getOrderNr(), "integer").", ".
397 $ilDB->quote((int) $this->getStatus(), "integer").", ".
398 $ilDB->now().", ".
399 $ilDB->quote($this->getImportId(), "text").
400 ")";
401 $ilDB->manipulate($query);
402 $this->setId($id);
403 }
setId($a_id)
Set Node ID.
getOrderNr()
Get order nr.
getImportId()
Get import id.
getSelfEvaluation()
Get self evaluation.

References $id, $ilDB, $query, getImportId(), getOrderNr(), getSelfEvaluation(), getStatus(), getTitle(), getType(), and setId().

+ Here is the call graph for this function:

◆ delete()

ilSkillTreeNode::delete ( )

Delete Node.

Reimplemented in ilBasicSkill, ilSkillCategory, ilSkillRoot, and ilSkillTemplateReference.

Definition at line 426 of file class.ilSkillTreeNode.php.

427 {
428 global $ilDB;
429
430 $query = "DELETE FROM skl_tree_node WHERE obj_id= ".
431 $ilDB->quote($this->getId(), "integer");
432 $ilDB->manipulate($query);
433 }

References $ilDB, $query, and getId().

+ Here is the call graph for this function:

◆ findSkills()

static ilSkillTreeNode::findSkills (   $a_term)
static

Find skills.

Parameters

return

Definition at line 912 of file class.ilSkillTreeNode.php.

913 {
914 global $ilDB;
915
916 $res = array();
917 $candidates = array();
918
919 $skill_tree = new ilSkillTree();
920
921 $sql = "SELECT * ".
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))
928 {
929 if (in_array($row["type"], array("sctp", "sktp")))
930 {
931 // need to get "top template" first! (if it is already the top level, do not use it!)
932 $path = $skill_tree->getSkillTreePath($row["obj_id"]);
933 if ($path[1]["child"] != $row["obj_id"])
934 {
936 foreach ($trefs as $tref)
937 {
938 $candidates[] = array("tref_id" => $tref, "skill_id" => $row["obj_id"], "title" => $row["title"]);
939 }
940 }
941 }
942 else if ($row["type"] == "sktr")
943 {
944 // works
945 $candidates[] = array("tref_id" => $row["obj_id"], "skill_id" => ilSkillTemplateReference::_lookupTemplateId($row["obj_id"]), "title" => $row["title"]);
946 }
947 else
948 {
949 // works
950 $candidates[] = array("tref_id" => 0, "skill_id" => $row["obj_id"], "title" => $row["title"]);
951 }
952 }
953
954 foreach ($candidates as $c)
955 {
956 // if we get a path array, and the array has items try to use the data
957 $path = $skill_tree->getSkillTreePath($c["skill_id"], $c["tref_id"]);
958 $use = false;
959 if (is_array($path) && count($path) > 0)
960 {
961 $use = true;
962 }
963
964 // if any inactive/outdated -> do not use the data
965 if (is_array($path))
966 {
967 foreach ($path as $p)
968 {
969 if ($p["status"] > 0)
970 {
971 $use = false;
972 }
973 }
974 }
975 if ($use)
976 {
977 if (!in_array($c["title"], $res))
978 {
979 $res[] = $c["title"];
980 }
981 }
982 }
983
984
985 return $res;
986 }
static _lookupTrefIdsForTopTemplateId($a_template_id)
Lookup tref ids for template id.

References $ilDB, $path, $res, $row, ilSkillTemplateReference\_lookupTemplateId(), and ilSkillTemplateReference\_lookupTrefIdsForTopTemplateId().

Referenced by ilPublicUserProfileGUI\getAutocompleteResult().

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

◆ getAllCSkillIdsForNodeIds()

static ilSkillTreeNode::getAllCSkillIdsForNodeIds ( array  $a_node_ids)
static

Get all possible common skill IDs for node IDs.

Parameters
array$a_node_idsarray of node ids
Returns
array array of skill ids

Definition at line 994 of file class.ilSkillTreeNode.php.

995 {
996 include_once("./Services/Skill/classes/class.ilSkillTemplateReference.php");
997 $cskill_ids = array();
998 foreach($a_node_ids as $id)
999 {
1000 if (in_array(self::_lookupType($id), array("skll", "scat", "sktr")))
1001 {
1002 $skill_id = $id;
1003 $tref_id = 0;
1004 if (ilSkillTreeNode::_lookupType($id) == "sktr")
1005 {
1007 $tref_id = $id;
1008 }
1009 $cskill_ids[] = array("skill_id" => $skill_id, "tref_id" => $tref_id);
1010 }
1011 if (in_array(ilSkillTreeNode::_lookupType($id), array("sktp", "sctp")))
1012 {
1014 {
1015 $cskill_ids[] = array("skill_id" => $id, "tref_id" => $tref_id);
1016 }
1017 }
1018 // for cats, skills and template references, get "real" usages
1019 // for skill and category templates check usage in references
1020 }
1021 return $cskill_ids;
1022 }
static _lookupTrefIdsForTemplateId($a_tid)
Get all tref ids for a template id.

References $id, ilSkillTemplateReference\_lookupTemplateId(), ilSkillTemplateReference\_lookupTrefIdsForTemplateId(), and _lookupType().

Referenced by ilSkillTreeNodeGUI\isInUse().

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

◆ getAllSelfEvaluationNodes()

static ilSkillTreeNode::getAllSelfEvaluationNodes ( )
static

Get all self evaluation nodes.

Parameters

return

Definition at line 768 of file class.ilSkillTreeNode.php.

769 {
770 global $ilDB;
771
772 $set = $ilDB->query("SELECT obj_id, title FROM skl_tree_node WHERE ".
773 " self_eval = ".$ilDB->quote(true, "integer")." ORDER BY TITLE "
774 );
775 $nodes = array();
776 while ($rec = $ilDB->fetchAssoc($set))
777 {
778 $nodes[$rec["obj_id"]] = $rec["title"];
779 }
780 return $nodes;
781 }

References $ilDB.

Referenced by ilSkillSelfEvaluationGUI\listSelfEvaluations().

+ Here is the caller graph for this function:

◆ getAllStatus()

static ilSkillTreeNode::getAllStatus ( )
static

Get all status.

Returns
array array of status, key is value, value is lang text

Definition at line 184 of file class.ilSkillTreeNode.php.

185 {
186 global $lng;
187
188 return array(
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")
192 );
193 }
global $lng
Definition: privfeed.php:17

References $lng.

Referenced by ilSkillTreeNodeGUI\addStatusInput().

+ Here is the caller graph for this function:

◆ getCreationDate()

ilSkillTreeNode::getCreationDate ( )

Get creation date.

Returns
string creation date

Definition at line 174 of file class.ilSkillTreeNode.php.

175 {
176 return $this->creation_date;
177 }

◆ getIconPath()

static ilSkillTreeNode::getIconPath (   $a_obj_id,
  $a_type,
  $a_size = "",
  $a_status = 0 
)
static

Get icon path.

Parameters
int$a_obj_idnode id
string$a_typenode type
string$a_sizesize
int$a_statusstatus
Returns
string icon path

Definition at line 876 of file class.ilSkillTreeNode.php.

877 {
878 if ($a_status == self::STATUS_DRAFT && $a_type == "sctp")
879 {
880 $a_type = "scat";
881 }
882 if ($a_status == self::STATUS_DRAFT && $a_type == "sktp")
883 {
884 $a_type = "skll";
885 }
886
887 $off = ($a_status == self::STATUS_DRAFT)
888 ? "_off"
889 : "";
890
891 $a_name = "icon_".$a_type.$a_size.$off.".svg";
892 if ($a_type == "sktr")
893 {
894 include_once("./Services/Skill/classes/class.ilSkillTemplateReference.php");
897 if ($type == "sctp")
898 {
899 $a_name = "icon_sctr".$a_size.$off.".svg";
900 }
901 }
902 $vers = "vers=".str_replace(array(".", " "), "-", ILIAS_VERSION);
903 return ilUtil::getImagePath($a_name)."?".$vers;
904 }
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)
const ILIAS_VERSION
$a_type
Definition: workflow.php:93

References $a_type, $type, ilSkillTemplateReference\_lookupTemplateId(), _lookupType(), ilUtil\getImagePath(), ILIAS_VERSION, and STATUS_DRAFT.

Referenced by ilSkillCatTableGUI\fillRow(), ilSkillTemplateTreeExplorerGUI\getNodeIcon(), ilSkillTreeExplorerGUI\getNodeIcon(), ilBasicSkillTemplateGUI\setLevelHead(), and ilSkillTreeNodeGUI\setTitleIcon().

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

◆ getId()

ilSkillTreeNode::getId ( )

Get Node ID.

Parameters
intNode ID

Definition at line 94 of file class.ilSkillTreeNode.php.

95 {
96 return $this->id;
97 }

References $id.

Referenced by ilBasicSkill\addLevel(), delete(), and update().

+ Here is the caller graph for this function:

◆ getImportId()

ilSkillTreeNode::getImportId ( )

Get import id.

Returns
string import id

Definition at line 154 of file class.ilSkillTreeNode.php.

155 {
156 return $this->import_id;
157 }

Referenced by create(), and update().

+ Here is the caller graph for this function:

◆ getOrderNr()

ilSkillTreeNode::getOrderNr ( )

Get order nr.

Returns
int order nr

Definition at line 134 of file class.ilSkillTreeNode.php.

135 {
136 return $this->order_nr;
137 }

Referenced by ilBasicSkill\copy(), ilBasicSkillTemplate\copy(), ilSkillCategory\copy(), ilSkillTemplateCategory\copy(), ilSkillTemplateReference\copy(), create(), and update().

+ Here is the caller graph for this function:

◆ getSelectableSkills()

static ilSkillTreeNode::getSelectableSkills ( )
static

Get selectable skills.

Parameters

return

Definition at line 803 of file class.ilSkillTreeNode.php.

804 {
805 global $ilDB;
806
807 $set = $ilDB->query("SELECT * FROM skl_tree_node ".
808 " WHERE self_eval = ".$ilDB->quote(1, "integer")
809 );
810
811 $sel_skills = array();
812 while ($rec = $ilDB->fetchAssoc($set))
813 {
814 $sel_skills[] = $rec;
815 }
816
817 return $sel_skills;
818 }

References $ilDB.

◆ getSelfEvaluation()

ilSkillTreeNode::getSelfEvaluation ( )

Get self evaluation.

Returns
boolean self evaluation

Definition at line 114 of file class.ilSkillTreeNode.php.

115 {
116 return $this->self_eval;
117 }

Referenced by ilBasicSkill\copy(), ilSkillCategory\copy(), ilSkillTemplateReference\copy(), create(), and update().

+ Here is the caller graph for this function:

◆ getStatus()

ilSkillTreeNode::getStatus ( )

Get status.

Returns
int status

Definition at line 340 of file class.ilSkillTreeNode.php.

341 {
342 return $this->status;
343 }

Referenced by create(), and update().

+ Here is the caller graph for this function:

◆ getStatusInfo()

static ilSkillTreeNode::getStatusInfo (   $a_status)
static

Get status info.

Parameters
int$a_statusstatus
Returns
string info text

Definition at line 201 of file class.ilSkillTreeNode.php.

202 {
203 global $lng;
204
205 switch($a_status)
206 {
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");
210 }
211 return "";
212 }

References $lng, STATUS_DRAFT, STATUS_OUTDATED, and STATUS_PUBLISH.

Referenced by ilSkillTreeNodeGUI\addStatusInput().

+ Here is the caller graph for this function:

◆ getTitle()

ilSkillTreeNode::getTitle ( )

Get title.

Returns
string title

Definition at line 54 of file class.ilSkillTreeNode.php.

55 {
56 return $this->title;
57 }

References $title.

Referenced by ilBasicSkill\copy(), ilBasicSkillTemplate\copy(), ilSkillCategory\copy(), ilSkillTemplateCategory\copy(), ilSkillTemplateReference\copy(), create(), ilBasicSkill\getTitleForCertificate(), and update().

+ Here is the caller graph for this function:

◆ getTopTemplates()

static ilSkillTreeNode::getTopTemplates ( )
static

Get top skill templates and template categories.

Parameters

return

Definition at line 789 of file class.ilSkillTreeNode.php.

790 {
791 $tr = new ilSkillTree();
792 $childs = $tr->getChildsByTypeFilter($tr->getRootId(), array("sktp", "sctp"));
793
794 return $childs;
795 }

Referenced by ilSkillTemplateReferenceGUI\initForm().

+ Here is the caller graph for this function:

◆ getTree()

static ilSkillTreeNode::getTree (   $a_slm_obj_id)
static

Get scorm module editing tree.

Parameters
intscorm module object id
Returns
object tree object

Definition at line 493 of file class.ilSkillTreeNode.php.

494 {
495 $tree = new ilSkillTree();
496
497 return $tree;
498 }

◆ getType()

ilSkillTreeNode::getType ( )

Get type.

Returns
string Type

Definition at line 74 of file class.ilSkillTreeNode.php.

75 {
76 return $this->type;
77 }

References $type.

Referenced by ilBasicSkill\copy(), ilBasicSkillTemplate\copy(), ilSkillCategory\copy(), ilSkillTemplateCategory\copy(), ilSkillTemplateReference\copy(), and create().

+ Here is the caller graph for this function:

◆ insertItemsFromClip()

static ilSkillTreeNode::insertItemsFromClip (   $a_type,
  $a_obj_id 
)
static

Insert basic skills from clipboard.

Definition at line 616 of file class.ilSkillTreeNode.php.

617 {
618 global $ilCtrl, $ilUser;
619
620 // @todo: move this to a service since it can be used here, too
621 include_once("./Modules/LearningModule/classes/class.ilEditClipboard.php");
622
623 include_once("./Services/Skill/classes/class.ilSkillTree.php");
624 $tree = new ilSkillTree();
625
626 $parent_id = $a_obj_id;
628
629 // cut and paste
630 $skills = $ilUser->getClipboardObjects($a_type); // this will get all skills _regardless_ of level
631 $copied_nodes = array();
632 foreach ($skills as $skill)
633 {
634 // if skill was already copied as part of tree - do not copy it again
635 if(!in_array($skill["id"], array_keys($copied_nodes)))
636 {
637 $cid = ilSkillTreeNode::pasteTree($skill["id"], $parent_id, $target,
638 $skill["insert_time"], $copied_nodes,
639 (ilEditClipboard::getAction() == "copy"), true);
640// $target = $cid;
641 }
642 }
643
644// if (ilEditClipboard::getAction() == "cut")
645// {
647// }
648
649 ilSkillTreeNode::saveChildsOrder($a_obj_id, array(),
650 in_array($a_type, array("sktp", "sctp")));
651
652 return $copied_nodes;
653 }
const IL_LAST_NODE
Definition: class.ilTree.php:4
static saveChildsOrder($a_par_id, $a_childs_order, $a_templates=false)
Save childs order.
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.
global $ilCtrl
Definition: ilias.php:18

References $a_type, $ilCtrl, $ilUser, $target, clearClipboard(), ilEditClipboard\getAction(), IL_LAST_NODE, pasteTree(), and saveChildsOrder().

Referenced by ilSkillTreeNodeGUI\insertBasicSkillClip(), ilSkillTreeNodeGUI\insertSkillCategoryClip(), ilSkillTreeNodeGUI\insertSkillTemplateClip(), ilSkillTreeNodeGUI\insertTemplateCategoryClip(), and ilSkillTreeNodeGUI\insertTemplateReferenceClip().

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

◆ isInTree()

static ilSkillTreeNode::isInTree (   $a_id)
static

Is id in tree?

Parameters

return

Definition at line 752 of file class.ilSkillTreeNode.php.

753 {
754 $skill_tree = new ilSkillTree();
755 if ($skill_tree->isInTree($a_id))
756 {
757 return true;
758 }
759 return false;
760 }

Referenced by ilBasicSkill\getSkillForLevelId().

+ Here is the caller graph for this function:

◆ pasteTree()

static ilSkillTreeNode::pasteTree (   $a_item_id,
  $a_parent_id,
  $a_target,
  $a_insert_time,
$a_copied_nodes,
  $a_as_copy = false,
  $a_add_suffix = false 
)
static

Paste item (tree) from clipboard to skill tree.

Definition at line 678 of file class.ilSkillTreeNode.php.

680 {
681 global $ilUser, $ilias, $ilLog, $lng;
682
683 $item_type = ilSkillTreeNode::_lookupType($a_item_id);
684
685 if ($item_type == "scat")
686 {
687 include_once("./Services/Skill/classes/class.ilSkillCategory.php");
688 $item = new ilSkillCategory($a_item_id);
689 }
690 else if ($item_type == "skll")
691 {
692 include_once("./Services/Skill/classes/class.ilBasicSkill.php");
693 $item = new ilBasicSkill($a_item_id);
694 }
695 else if ($item_type == "sktr")
696 {
697 include_once("./Services/Skill/classes/class.ilSkillTemplateReference.php");
698 $item = new ilSkillTemplateReference($a_item_id);
699 }
700 else if ($item_type == "sktp")
701 {
702 include_once("./Services/Skill/classes/class.ilBasicSkillTemplate.php");
703 $item = new ilBasicSkillTemplate($a_item_id);
704 }
705 else if ($item_type == "sctp")
706 {
707 include_once("./Services/Skill/classes/class.ilSkillTemplateCategory.php");
708 $item = new ilSkillTemplateCategory($a_item_id);
709 }
710
711 $ilLog->write("Getting from clipboard type ".$item_type.", ".
712 "Item ID: ".$a_item_id);
713
714 if ($a_as_copy)
715 {
716 $target_item = $item->copy();
717 if($a_add_suffix)
718 {
719 $target_item->setTitle($target_item->getTitle()." ".$lng->txt("copy_of_suffix"));
720 $target_item->update();
721 }
722 $a_copied_nodes[$item->getId()] = $target_item->getId();
723 }
724 else
725 {
726 $target_item = $item;
727 }
728
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);
732
733 ilSkillTreeNode::putInTree($target_item, $a_parent_id, $a_target);
734
735 $childs = $ilUser->getClipboardChilds($item->getId(), $a_insert_time);
736
737 foreach($childs as $child)
738 {
739 ilSkillTreeNode::pasteTree($child["id"], $target_item->getId(),
740 IL_LAST_NODE, $a_insert_time, $a_copied_nodes, $a_as_copy);
741 }
742
743 return $target_item->getId();
744 }
static putInTree($a_obj, $a_parent_id="", $a_target_node_id="")
Put this object into the skill tree.

References $ilLog, $ilUser, $lng, _lookupType(), IL_LAST_NODE, pasteTree(), and putInTree().

Referenced by insertItemsFromClip(), and pasteTree().

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

◆ putInTree()

static ilSkillTreeNode::putInTree (   $a_obj,
  $a_parent_id = "",
  $a_target_node_id = "" 
)
static

Put this object into the skill tree.

Definition at line 438 of file class.ilSkillTreeNode.php.

439 {
440 $skill_tree = new ilSkillTree();
441
442 // determine parent
443 $parent_id = ($a_parent_id != "")
444 ? $a_parent_id
445 : $skill_tree->getRootId();
446
447 // make a check, whether the type of object is allowed under
448 // the parent
449 $allowed = array(
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]))
456 {
457 return;
458 }
459
460 // determine target
461 if ($a_target_node_id != "")
462 {
463 $target = $a_target_node_id;
464 }
465 else
466 {
467 // determine last child that serves as predecessor
468 $childs = $skill_tree->getChilds($parent_id);
469
470 if (count($childs) == 0)
471 {
473 }
474 else
475 {
476 $target = $childs[count($childs) - 1]["obj_id"];
477 }
478 }
479
480 if ($skill_tree->isInTree($parent_id) && !$skill_tree->isInTree($a_obj->getId()))
481 {
482 $skill_tree->insertNode($a_obj->getId(), $parent_id, $target);
483 }
484 }
const IL_FIRST_NODE
Definition: class.ilTree.php:5

References $target, _lookupType(), and IL_FIRST_NODE.

Referenced by ilSkillDataSet\importRecord(), pasteTree(), ilBasicSkillGUI\saveItem(), ilBasicSkillTemplateGUI\saveItem(), ilSkillCategoryGUI\saveItem(), ilSkillTemplateCategoryGUI\saveItem(), and ilSkillTemplateReferenceGUI\saveItem().

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

◆ read()

ilSkillTreeNode::read ( )

Read Data of Node.

Reimplemented in ilBasicSkill, ilSkillCategory, ilSkillRoot, and ilSkillTemplateReference.

Definition at line 217 of file class.ilSkillTreeNode.php.

218 {
219 global $ilBench, $ilDB;
220
221 if(!isset($this->data_record))
222 {
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);
227 }
228 $this->setType($this->data_record["type"]);
229 $this->setTitle($this->data_record["title"]);
230 $this->setOrderNr($this->data_record["order_nr"]);
231 $this->setSelfEvaluation($this->data_record["self_eval"]);
232 $this->setStatus($this->data_record["status"]);
233 $this->setImportId($this->data_record["import_id"]);
234 $this->setCreationDate($this->data_record["creation_date"]);
235 }
setTitle($a_title)
Set title.
setCreationDate($a_val)
Set creation date.
setOrderNr($a_val)
Set order nr.
setType($a_type)
Set type.
setStatus($a_val)
Set status.
setSelfEvaluation($a_val)
Set self evaluation.
setImportId($a_val)
Set import id.
global $ilBench
Definition: ilias.php:18

References $ilBench, $ilDB, $query, setCreationDate(), setImportId(), setOrderNr(), setSelfEvaluation(), setStatus(), setTitle(), and setType().

Referenced by __construct().

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

◆ saveChildsOrder()

static ilSkillTreeNode::saveChildsOrder (   $a_par_id,
  $a_childs_order,
  $a_templates = false 
)
static

Save childs order.

Parameters

return

Definition at line 826 of file class.ilSkillTreeNode.php.

827 {
828 include_once("./Services/Skill/classes/class.ilSkillTree.php");
829 $skill_tree = new ilSkillTree();
830
831 if ($a_par_id != $skill_tree->readRootId())
832 {
833 $childs = $skill_tree->getChilds($a_par_id);
834 }
835 else
836 {
837 if ($a_templates)
838 {
839 $childs = $skill_tree->getChildsByTypeFilter($a_par_id,
840 array("skrt", "sktp", "sctp"));
841 }
842 else
843 {
844 $childs = $skill_tree->getChildsByTypeFilter($a_par_id,
845 array("skrt", "skll", "scat", "sktr"));
846 }
847 }
848
849 foreach ($childs as $k => $c)
850 {
851 if (isset($a_childs_order[$c["child"]]))
852 {
853 $childs[$k]["order_nr"] = (int) $a_childs_order[$c["child"]];
854 }
855 }
856
857 $childs = ilUtil::sortArray($childs, "order_nr", "asc", true);
858
859 $cnt = 10;
860 foreach ($childs as $c)
861 {
862 ilSkillTreeNode::_writeOrderNr($c["child"], $cnt);
863 $cnt += 10;
864 }
865 }
static _writeOrderNr($a_obj_id, $a_nr)
Write Order Nr.
static sortArray($array, $a_array_sortby, $a_array_sortorder=0, $a_numeric=false, $a_keep_keys=false)
sortArray

References _writeOrderNr(), and ilUtil\sortArray().

Referenced by ilSkillTreeNodeGUI\confirmedDelete(), ilSkillTreeNodeGUI\cutItems(), insertItemsFromClip(), ilSkillTreeNodeGUI\save(), and ilSkillTreeNodeGUI\saveOrder().

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

◆ setCreationDate()

ilSkillTreeNode::setCreationDate (   $a_val)
protected

Set creation date.

Parameters
string$a_valcreation date

Definition at line 164 of file class.ilSkillTreeNode.php.

165 {
166 $this->creation_date = $a_val;
167 }

Referenced by read().

+ Here is the caller graph for this function:

◆ setDataRecord()

ilSkillTreeNode::setDataRecord (   $a_record)

this method should only be called by class ilSCORM2004NodeFactory

Definition at line 240 of file class.ilSkillTreeNode.php.

241 {
242 $this->data_record = $a_record;
243 }

◆ setId()

ilSkillTreeNode::setId (   $a_id)

Set Node ID.

Parameters
intNode ID

Definition at line 84 of file class.ilSkillTreeNode.php.

85 {
86 $this->id = $a_id;
87 }

Referenced by create().

+ Here is the caller graph for this function:

◆ setImportId()

ilSkillTreeNode::setImportId (   $a_val)

Set import id.

Parameters
string$a_valimport id

Definition at line 144 of file class.ilSkillTreeNode.php.

145 {
146 $this->import_id = $a_val;
147 }

Referenced by read().

+ Here is the caller graph for this function:

◆ setOrderNr()

ilSkillTreeNode::setOrderNr (   $a_val)

Set order nr.

Parameters
int$a_valorder nr

Definition at line 124 of file class.ilSkillTreeNode.php.

125 {
126 $this->order_nr = $a_val;
127 }

Referenced by read().

+ Here is the caller graph for this function:

◆ setSelfEvaluation()

ilSkillTreeNode::setSelfEvaluation (   $a_val)

Set self evaluation.

Parameters
booleanself evaluation

Definition at line 104 of file class.ilSkillTreeNode.php.

105 {
106 $this->self_eval = $a_val;
107 }

Referenced by read().

+ Here is the caller graph for this function:

◆ setStatus()

ilSkillTreeNode::setStatus (   $a_val)

Set status.

Parameters
boolean$a_valstatus

Definition at line 330 of file class.ilSkillTreeNode.php.

331 {
332 $this->status = $a_val;
333 }

Referenced by read().

+ Here is the caller graph for this function:

◆ setTitle()

ilSkillTreeNode::setTitle (   $a_title)

Set title.

Parameters
string$a_titletitle

Definition at line 44 of file class.ilSkillTreeNode.php.

45 {
46 $this->title = $a_title;
47 }

Referenced by read().

+ Here is the caller graph for this function:

◆ setType()

ilSkillTreeNode::setType (   $a_type)

Set type.

Parameters
stringType

Definition at line 64 of file class.ilSkillTreeNode.php.

65 {
66 $this->type = $a_type;
67 }

References $a_type.

Referenced by ilBasicSkill\__construct(), ilBasicSkillTemplate\__construct(), ilSkillCategory\__construct(), ilSkillRoot\__construct(), ilSkillTemplateCategory\__construct(), ilSkillTemplateReference\__construct(), and read().

+ Here is the caller graph for this function:

◆ uniqueTypesCheck()

static ilSkillTreeNode::uniqueTypesCheck (   $a_items)
static

Check for unique types.

Definition at line 503 of file class.ilSkillTreeNode.php.

504 {
505 $types = array();
506 if (is_array($a_items))
507 {
508 foreach($a_items as $item)
509 {
511 $types[$type] = $type;
512 }
513 }
514
515 if (count($types) > 1)
516 {
517 return false;
518 }
519 return true;
520 }

References $type, and _lookupType().

Referenced by ilSkillTreeNodeGUI\copyItems(), and ilSkillTreeNodeGUI\cutItems().

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

◆ update()

ilSkillTreeNode::update ( )

Update Node.

Reimplemented in ilSkillTemplateReference.

Definition at line 408 of file class.ilSkillTreeNode.php.

409 {
410 global $ilDB;
411
412 $query = "UPDATE skl_tree_node SET ".
413 " title = ".$ilDB->quote($this->getTitle(), "text").
414 " ,self_eval = ".$ilDB->quote((int) $this->getSelfEvaluation(), "integer").
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");
419
420 $ilDB->manipulate($query);
421 }

References $ilDB, $query, getId(), getImportId(), getOrderNr(), getSelfEvaluation(), getStatus(), and getTitle().

+ Here is the call graph for this function:

Field Documentation

◆ $id

ilSkillTreeNode::$id

◆ $title

ilSkillTreeNode::$title

Definition at line 22 of file class.ilSkillTreeNode.php.

Referenced by getTitle().

◆ $type

ilSkillTreeNode::$type

Definition at line 20 of file class.ilSkillTreeNode.php.

Referenced by getIconPath(), getType(), and uniqueTypesCheck().

◆ STATUS_DRAFT

◆ STATUS_OUTDATED

const ilSkillTreeNode::STATUS_OUTDATED = 2

◆ STATUS_PUBLISH

const ilSkillTreeNode::STATUS_PUBLISH = 0

Definition at line 17 of file class.ilSkillTreeNode.php.

Referenced by getStatusInfo().


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