ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
ilSkillTreeNode Class Reference

A node in the skill tree. More...

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

Public Member Functions

 ilSkillTreeNode ($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...
 
 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...
 
 clipboardCut ($a_tree_id, $a_ids)
 Cut and copy a set of skills/skill categories into the clipboard. 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 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...
 

Data Fields

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

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.

Member Function Documentation

◆ _lookup()

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

Lookup Title.

Parameters
intNode ID
Returns
string Title

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

210 {
211 global $ilDB;
212
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);
217
218 return $obj_rec[$a_field];
219 }
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 245 of file class.ilSkillTreeNode.php.

246 {
247 global $ilDB;
248
249 return self::_lookup($a_obj_id, "self_eval");
250 }
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 258 of file class.ilSkillTreeNode.php.

259 {
260 global $ilDB;
261
262 return self::_lookup($a_obj_id, "status");
263 }

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 227 of file class.ilSkillTreeNode.php.

228 {
229 global $ilDB;
230
231 include_once("./Services/Skill/classes/class.ilSkillTemplateReference.php");
232 if ($a_tref_id > 0 && ilSkillTemplateReference::_lookupTemplateId($a_tref_id) == $a_obj_id)
233 {
234 return self::_lookup($a_tref_id, "title");
235 }
236 return self::_lookup($a_obj_id, "title");
237 }
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(), ilPersonalSkillsGUI\getGapAnalysisHTML(), ilPersonalSkill\getSelectedUserSkills(), ilPersonalSkillsGUI\getSkillHTML(), ilSurveySkillTableGUI\getSkills(), ilObjPortfolioGUI\initCreatePortfolioFromTemplateForm(), ilAssQuestionSkillAssignment\loadAdditionalSkillData(), 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 326 of file class.ilSkillTreeNode.php.

327 {
328 global $ilDB;
329
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);
334 }

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 309 of file class.ilSkillTreeNode.php.

310 {
311 global $ilDB;
312
313 $query = "UPDATE skl_tree_node SET ".
314 " title = ".$ilDB->quote($a_title, "text").
315 " WHERE obj_id = ".$ilDB->quote($a_obj_id, "integer");
316
317 $ilDB->manipulate($query);
318 }

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 616 of file class.ilSkillTreeNode.php.

617 {
618 global $ilUser;
619
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");
627 }
global $ilUser
Definition: imgupload.php:15

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 531 of file class.ilSkillTreeNode.php.

532 {
533 global $ilUser;
534
536 include_once("./Services/Skill/classes/class.ilSkillTree.php");
537 $tree = new ilSkillTree();
538
539 // put them into the clipboard
540 $time = date("Y-m-d H:i:s", time());
541 foreach ($a_ids as $id)
542 {
543 $curnode = "";
544 if ($tree->isInTree($id))
545 {
546 $curnode = $tree->getNodeData($id);
547 $subnodes = $tree->getSubTree($curnode);
548 foreach($subnodes as $subnode)
549 {
550 if ($subnode["child"] != $id)
551 {
552 $ilUser->addObjectToClipboard($subnode["child"],
553 $subnode["type"], $subnode["title"],
554 $subnode["parent"], $time, $subnode["lft"]);
555 }
556 }
557 }
558 $order = ($curnode["lft"] > 0)
559 ? $curnode["lft"]
560 : (int) ($order + 1);
561 $ilUser->addObjectToClipboard($id,
563 $order);
564 }
565 }
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(), and clearClipboard().

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

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

◆ clipboardCut()

ilSkillTreeNode::clipboardCut (   $a_tree_id,
  $a_ids 
)

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

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

481 {
483 include_once("./Services/Skill/classes/class.ilSkillTree.php");
484 $tree = new ilSkillTree();
485
486 if (!is_array($a_ids))
487 {
488 return false;
489 }
490 else
491 {
492 // get all "top" ids, i.e. remove ids, that have a selected parent
493 foreach($a_ids as $id)
494 {
495 $path = $tree->getPathId($id);
496 $take = true;
497 foreach($path as $path_id)
498 {
499 if ($path_id != $id && in_array($path_id, $a_ids))
500 {
501 $take = false;
502 }
503 }
504 if ($take)
505 {
506 $cut_ids[] = $id;
507 }
508 }
509 }
510
511 ilSkillTreeNode::clipboardCopy($a_tree_id, $cut_ids);
512
513 // remove the objects from the tree
514 // note: we are getting skills/categories which are *not* in the tree
515 // we do not delete any pages/chapters here
516 foreach ($cut_ids as $id)
517 {
518 $curnode = $tree->getNodeData($id);
519 if ($tree->isInTree($id))
520 {
521 $tree->deleteTree($curnode);
522 }
523 }
524
525 }
static clipboardCopy($a_tree_id, $a_ids)
Copy a set of skills/skill categories into the clipboard.
$path
Definition: index.php:22

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 341 of file class.ilSkillTreeNode.php.

342 {
343 global $ilDB;
344
345 // insert object data
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) ".
348 "VALUES (".
349 $ilDB->quote($id, "integer").",".
350 $ilDB->quote($this->getTitle(), "text").",".
351 $ilDB->quote($this->getType(), "text").", ".
352 $ilDB->now().", ".
353 $ilDB->quote((int) $this->getSelfEvaluation(), "integer").", ".
354 $ilDB->quote((int) $this->getOrderNr(), "integer").", ".
355 $ilDB->quote((int) $this->getStatus(), "integer").
356 ")";
357 $ilDB->manipulate($query);
358 $this->setId($id);
359 }
setId($a_id)
Set Node ID.
getOrderNr()
Get order nr.
getSelfEvaluation()
Get self evaluation.

References $id, $ilDB, $query, 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 381 of file class.ilSkillTreeNode.php.

382 {
383 global $ilDB;
384
385 $query = "DELETE FROM skl_tree_node WHERE obj_id= ".
386 $ilDB->quote($this->getId(), "integer");
387 $ilDB->manipulate($query);
388 }

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 867 of file class.ilSkillTreeNode.php.

868 {
869 global $ilDB;
870
871 $res = array();
872 $candidates = array();
873
874 $skill_tree = new ilSkillTree();
875
876 $sql = "SELECT * ".
877 " FROM skl_tree_node".
878 " WHERE ".$ilDB->like("title", "text", "%".$a_term."%");
879 $sql .= " ORDER BY title";
880 $set = $ilDB->query($sql);
881 include_once("./Services/Skill/classes/class.ilSkillTemplateReference.php");
882 while($row = $ilDB->fetchAssoc($set))
883 {
884 if (in_array($row["type"], array("sctp", "sktp")))
885 {
886 // need to get "top template" first! (if it is already the top level, do not use it!)
887 $path = $skill_tree->getSkillTreePath($row["obj_id"]);
888 if ($path[1]["child"] != $row["obj_id"])
889 {
891 foreach ($trefs as $tref)
892 {
893 $candidates[] = array("tref_id" => $tref, "skill_id" => $row["obj_id"], "title" => $row["title"]);
894 }
895 }
896 }
897 else if ($row["type"] == "sktr")
898 {
899 // works
900 $candidates[] = array("tref_id" => $row["obj_id"], "skill_id" => ilSkillTemplateReference::_lookupTemplateId($row["obj_id"]), "title" => $row["title"]);
901 }
902 else
903 {
904 // works
905 $candidates[] = array("tref_id" => 0, "skill_id" => $row["obj_id"], "title" => $row["title"]);
906 }
907 }
908
909 foreach ($candidates as $c)
910 {
911 // if we get a path array, and the array has items try to use the data
912 $path = $skill_tree->getSkillTreePath($c["skill_id"], $c["tref_id"]);
913 $use = false;
914 if (is_array($path) && count($path) > 0)
915 {
916 $use = true;
917 }
918
919 // if any inactive/outdated -> do not use the data
920 if (is_array($path))
921 {
922 foreach ($path as $p)
923 {
924 if ($p["status"] > 0)
925 {
926 $use = false;
927 }
928 }
929 }
930 if ($use)
931 {
932 if (!in_array($c["title"], $res))
933 {
934 $res[] = $c["title"];
935 }
936 }
937 }
938
939
940 return $res;
941 }
_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:

◆ getAllSelfEvaluationNodes()

static ilSkillTreeNode::getAllSelfEvaluationNodes ( )
static

Get all self evaluation nodes.

Parameters

return

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

724 {
725 global $ilDB;
726
727 $set = $ilDB->query("SELECT obj_id, title FROM skl_tree_node WHERE ".
728 " self_eval = ".$ilDB->quote(true, "integer")." ORDER BY TITLE "
729 );
730 $nodes = array();
731 while ($rec = $ilDB->fetchAssoc($set))
732 {
733 $nodes[$rec["obj_id"]] = $rec["title"];
734 }
735 return $nodes;
736 }

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 144 of file class.ilSkillTreeNode.php.

145 {
146 global $lng;
147
148 return array(
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")
152 );
153 }
global $lng
Definition: privfeed.php:40

References $lng.

Referenced by ilSkillTreeNodeGUI\addStatusInput().

+ Here is the caller graph for this function:

◆ 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 831 of file class.ilSkillTreeNode.php.

832 {
833 if ($a_status == self::STATUS_DRAFT && $a_type == "sctp")
834 {
835 $a_type = "scat";
836 }
837 if ($a_status == self::STATUS_DRAFT && $a_type == "sktp")
838 {
839 $a_type = "skll";
840 }
841
842 $off = ($a_status == self::STATUS_DRAFT)
843 ? "_off"
844 : "";
845
846 $a_name = "icon_".$a_type.$a_size.$off.".svg";
847 if ($a_type == "sktr")
848 {
849 include_once("./Services/Skill/classes/class.ilSkillTemplateReference.php");
852 if ($type == "sctp")
853 {
854 $a_name = "icon_sctr".$a_size.$off.".svg";
855 }
856 }
857 $vers = "vers=".str_replace(array(".", " "), "-", ILIAS_VERSION);
858 return ilUtil::getImagePath($a_name)."?".$vers;
859 }
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)
const ILIAS_VERSION

References $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:

◆ 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 758 of file class.ilSkillTreeNode.php.

759 {
760 global $ilDB;
761
762 $set = $ilDB->query("SELECT * FROM skl_tree_node ".
763 " WHERE self_eval = ".$ilDB->quote(1, "integer")
764 );
765
766 $sel_skills = array();
767 while ($rec = $ilDB->fetchAssoc($set))
768 {
769 $sel_skills[] = $rec;
770 }
771
772 return $sel_skills;
773 }

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 298 of file class.ilSkillTreeNode.php.

299 {
300 return $this->status;
301 }

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 161 of file class.ilSkillTreeNode.php.

162 {
163 global $lng;
164
165 switch($a_status)
166 {
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");
170 }
171 return "";
172 }

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 744 of file class.ilSkillTreeNode.php.

745 {
746 $tr = new ilSkillTree();
747 $childs = $tr->getChildsByTypeFilter($tr->getRootId(), array("sktp", "sctp"));
748
749 return $childs;
750 }

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 448 of file class.ilSkillTreeNode.php.

449 {
450 $tree = new ilSkillTree();
451
452 return $tree;
453 }

◆ 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:

◆ ilSkillTreeNode()

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

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:

◆ insertItemsFromClip()

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

Insert basic skills from clipboard.

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

572 {
573 global $ilCtrl, $ilUser;
574
575 // @todo: move this to a service since it can be used here, too
576 include_once("./Modules/LearningModule/classes/class.ilEditClipboard.php");
577
578 include_once("./Services/Skill/classes/class.ilSkillTree.php");
579 $tree = new ilSkillTree();
580
581 $parent_id = $a_obj_id;
582 $target = IL_LAST_NODE;
583
584 // cut and paste
585 $skills = $ilUser->getClipboardObjects($a_type); // this will get all skills _regardless_ of level
586 $copied_nodes = array();
587 foreach ($skills as $skill)
588 {
589 // if skill was already copied as part of tree - do not copy it again
590 if(!in_array($skill["id"], array_keys($copied_nodes)))
591 {
592 $cid = ilSkillTreeNode::pasteTree($skill["id"], $parent_id, $target,
593 $skill["insert_time"], $copied_nodes,
594 (ilEditClipboard::getAction() == "copy"), true);
595// $target = $cid;
596 }
597 }
598
599// if (ilEditClipboard::getAction() == "cut")
600// {
602// }
603
604 ilSkillTreeNode::saveChildsOrder($a_obj_id, array(),
605 in_array($a_type, array("sktp", "sctp")));
606
607 return $copied_nodes;
608 }
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 $ilCtrl, $ilUser, 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 707 of file class.ilSkillTreeNode.php.

708 {
709 $skill_tree = new ilSkillTree();
710 if ($skill_tree->isInTree($a_id))
711 {
712 return true;
713 }
714 return false;
715 }

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 633 of file class.ilSkillTreeNode.php.

635 {
636 global $ilUser, $ilias, $ilLog, $lng;
637
638 $item_type = ilSkillTreeNode::_lookupType($a_item_id);
639
640 if ($item_type == "scat")
641 {
642 include_once("./Services/Skill/classes/class.ilSkillCategory.php");
643 $item = new ilSkillCategory($a_item_id);
644 }
645 else if ($item_type == "skll")
646 {
647 include_once("./Services/Skill/classes/class.ilBasicSkill.php");
648 $item = new ilBasicSkill($a_item_id);
649 }
650 else if ($item_type == "sktr")
651 {
652 include_once("./Services/Skill/classes/class.ilSkillTemplateReference.php");
653 $item = new ilSkillTemplateReference($a_item_id);
654 }
655 else if ($item_type == "sktp")
656 {
657 include_once("./Services/Skill/classes/class.ilBasicSkillTemplate.php");
658 $item = new ilBasicSkillTemplate($a_item_id);
659 }
660 else if ($item_type == "sctp")
661 {
662 include_once("./Services/Skill/classes/class.ilSkillTemplateCategory.php");
663 $item = new ilSkillTemplateCategory($a_item_id);
664 }
665
666 $ilLog->write("Getting from clipboard type ".$item_type.", ".
667 "Item ID: ".$a_item_id);
668
669 if ($a_as_copy)
670 {
671 $target_item = $item->copy();
672 if($a_add_suffix)
673 {
674 $target_item->setTitle($target_item->getTitle()." ".$lng->txt("copy_of_suffix"));
675 $target_item->update();
676 }
677 $a_copied_nodes[$item->getId()] = $target_item->getId();
678 }
679 else
680 {
681 $target_item = $item;
682 }
683
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);
687
688 ilSkillTreeNode::putInTree($target_item, $a_parent_id, $a_target);
689
690 $childs = $ilUser->getClipboardChilds($item->getId(), $a_insert_time);
691
692 foreach($childs as $child)
693 {
694 ilSkillTreeNode::pasteTree($child["id"], $target_item->getId(),
695 IL_LAST_NODE, $a_insert_time, $a_copied_nodes, $a_as_copy);
696 }
697
698 return $target_item->getId();
699 }
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 393 of file class.ilSkillTreeNode.php.

394 {
395 $skill_tree = new ilSkillTree();
396
397 // determine parent
398 $parent_id = ($a_parent_id != "")
399 ? $a_parent_id
400 : $skill_tree->getRootId();
401
402 // make a check, whether the type of object is allowed under
403 // the parent
404 $allowed = array(
405 "skrt" => array("skll", "scat", "sktr", "sktp", "sctp"),
406 "scat" => array("skll", "scat", "sktr"),
407 "sctp" => array("sktp", "sctp"));
408 $par_type = self::_lookupType($parent_id);
409 if (!is_array($allowed[$par_type]) ||
410 !in_array($a_obj->getType(), $allowed[$par_type]))
411 {
412 return;
413 }
414
415 // determine target
416 if ($a_target_node_id != "")
417 {
418 $target = $a_target_node_id;
419 }
420 else
421 {
422 // determine last child that serves as predecessor
423 $childs = $skill_tree->getChilds($parent_id);
424
425 if (count($childs) == 0)
426 {
427 $target = IL_FIRST_NODE;
428 }
429 else
430 {
431 $target = $childs[count($childs) - 1]["obj_id"];
432 }
433 }
434
435 if ($skill_tree->isInTree($parent_id) && !$skill_tree->isInTree($a_obj->getId()))
436 {
437 $skill_tree->insertNode($a_obj->getId(), $parent_id, $target);
438 }
439 }
const IL_FIRST_NODE
Definition: class.ilTree.php:5

References _lookupType(), and IL_FIRST_NODE.

Referenced by 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 177 of file class.ilSkillTreeNode.php.

178 {
179 global $ilBench, $ilDB;
180
181 if(!isset($this->data_record))
182 {
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);
187 }
188 $this->setType($this->data_record["type"]);
189 $this->setTitle($this->data_record["title"]);
190 $this->setOrderNr($this->data_record["order_nr"]);
191 $this->setSelfEvaluation($this->data_record["self_eval"]);
192 $this->setStatus($this->data_record["status"]);
193 }
setTitle($a_title)
Set title.
setOrderNr($a_val)
Set order nr.
setType($a_type)
Set type.
setStatus($a_val)
Set status.
setSelfEvaluation($a_val)
Set self evaluation.
global $ilBench
Definition: ilias.php:18

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

Referenced by ilSkillTreeNode().

+ 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 781 of file class.ilSkillTreeNode.php.

782 {
783 include_once("./Services/Skill/classes/class.ilSkillTree.php");
784 $skill_tree = new ilSkillTree();
785
786 if ($a_par_id != $skill_tree->readRootId())
787 {
788 $childs = $skill_tree->getChilds($a_par_id);
789 }
790 else
791 {
792 if ($a_templates)
793 {
794 $childs = $skill_tree->getChildsByTypeFilter($a_par_id,
795 array("skrt", "sktp", "sctp"));
796 }
797 else
798 {
799 $childs = $skill_tree->getChildsByTypeFilter($a_par_id,
800 array("skrt", "skll", "scat", "sktr"));
801 }
802 }
803
804 foreach ($childs as $k => $c)
805 {
806 if (isset($a_childs_order[$c["child"]]))
807 {
808 $childs[$k]["order_nr"] = (int) $a_childs_order[$c["child"]];
809 }
810 }
811
812 $childs = ilUtil::sortArray($childs, "order_nr", "asc", true);
813
814 $cnt = 10;
815 foreach ($childs as $c)
816 {
817 ilSkillTreeNode::_writeOrderNr($c["child"], $cnt);
818 $cnt += 10;
819 }
820 }
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:

◆ setDataRecord()

ilSkillTreeNode::setDataRecord (   $a_record)

this method should only be called by class ilSCORM2004NodeFactory

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

199 {
200 $this->data_record = $a_record;
201 }

◆ 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:

◆ 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 288 of file class.ilSkillTreeNode.php.

289 {
290 $this->status = $a_val;
291 }

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 }

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 458 of file class.ilSkillTreeNode.php.

459 {
460 $types = array();
461 if (is_array($a_items))
462 {
463 foreach($a_items as $item)
464 {
466 $types[$type] = $type;
467 }
468 }
469
470 if (count($types) > 1)
471 {
472 return false;
473 }
474 return true;
475 }

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 364 of file class.ilSkillTreeNode.php.

365 {
366 global $ilDB;
367
368 $query = "UPDATE skl_tree_node SET ".
369 " title = ".$ilDB->quote($this->getTitle(), "text").
370 " ,self_eval = ".$ilDB->quote((int) $this->getSelfEvaluation(), "integer").
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");
374
375 $ilDB->manipulate($query);
376 }

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

+ Here is the call graph for this function:

Field Documentation

◆ $id

ilSkillTreeNode::$id

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

Referenced by clipboardCopy(), clipboardCut(), create(), and getId().

◆ $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: