ILIAS  release_5-0 Revision 5.0.0-1144-gc4397b1f870
All Data Structures Namespaces Files Functions Variables Modules Pages
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.

References $ilDB, and $query.

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

◆ _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.

References $ilDB.

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

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

References $ilDB.

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

259  {
260  global $ilDB;
261 
262  return self::_lookup($a_obj_id, "status");
263  }
global $ilDB
+ 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.

References $ilDB, and ilSkillTemplateReference\_lookupTemplateId().

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

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.
global $ilDB
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _lookupType()

static ilSkillTreeNode::_lookupType (   $a_obj_id)
static

◆ _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.

References $ilDB, and $query.

Referenced by saveChildsOrder().

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  }
global $ilDB
+ 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.

References $ilDB, and $query.

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

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  }
global $ilDB
+ Here is the caller graph for this function:

◆ clearClipboard()

static ilSkillTreeNode::clearClipboard ( )
static

Remove all skill items from clipboard.

Parameters

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

References $ilUser, and ilEditClipboard\clear().

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
+ Here is the call 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.

References $ilUser, _lookupTitle(), and _lookupType().

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

532  {
533  global $ilUser;
534 
535  self::clearClipboard();
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  }
Skill tree.
static _lookupType($a_obj_id)
Lookup Type.
static _lookupTitle($a_obj_id, $a_tref_id=0)
Lookup Title.
global $ilUser
Definition: imgupload.php:15
+ 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.

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

Referenced by ilSkillTreeNodeGUI\cutItems().

481  {
482  self::clearClipboard();
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  }
Skill tree.
static clipboardCopy($a_tree_id, $a_ids)
Copy a set of skills/skill categories into the clipboard.
$path
Definition: index.php:22
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ create()

ilSkillTreeNode::create ( )

Create Node.

Parameters
booleanUpload Mode

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

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

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.
getSelfEvaluation()
Get self evaluation.
getOrderNr()
Get order nr.
global $ilDB
+ Here is the call graph for this function:

◆ delete()

ilSkillTreeNode::delete ( )

Delete Node.

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

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

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  }
global $ilDB
+ Here is the call graph for this function:

◆ findSkills()

static ilSkillTreeNode::findSkills (   $a_term)
static

Find skills.

Parameters

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

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

Referenced by ilPublicUserProfileGUI\getAutocompleteResult().

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  }
Skill tree.
static _lookupTemplateId($a_obj_id)
Lookup template ID.
_lookupTrefIdsForTopTemplateId($a_template_id)
Lookup tref ids for template id.
$path
Definition: index.php:22
global $ilDB
+ 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

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

References $ilDB.

Referenced by ilSkillSelfEvaluationGUI\listSelfEvaluations().

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  }
global $ilDB
+ 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.

References $lng.

Referenced by ilSkillTreeNodeGUI\addStatusInput().

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
+ 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.

References ilSkillTemplateReference\_lookupTemplateId(), _lookupType(), ilUtil\getImagePath(), and ILIAS_VERSION.

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

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  }
const ILIAS_VERSION
static _lookupType($a_obj_id)
Lookup Type.
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)
static _lookupTemplateId($a_obj_id)
Lookup template ID.
+ 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.

References $id.

Referenced by ilBasicSkill\addLevel(), delete(), ilBasicSkill\getLastLevelPerObject(), ilBasicSkill\getLastUpdatePerObject(), ilBasicSkill\getMaxLevelPerObject(), ilBasicSkill\getMaxLevelPerType(), and update().

95  {
96  return $this->id;
97  }
+ 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.

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

135  {
136  return $this->order_nr;
137  }
+ Here is the caller graph for this function:

◆ getSelectableSkills()

static ilSkillTreeNode::getSelectableSkills ( )
static

Get selectable skills.

Parameters

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

References $ilDB.

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  }
global $ilDB

◆ getSelfEvaluation()

ilSkillTreeNode::getSelfEvaluation ( )

Get self evaluation.

Returns
boolean self evaluation

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

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

115  {
116  return $this->self_eval;
117  }
+ 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.

Referenced by create(), and update().

299  {
300  return $this->status;
301  }
+ 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.

References $lng.

Referenced by ilSkillTreeNodeGUI\addStatusInput().

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  }
global $lng
Definition: privfeed.php:40
+ 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.

References $title.

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

55  {
56  return $this->title;
57  }
+ Here is the caller graph for this function:

◆ getTopTemplates()

static ilSkillTreeNode::getTopTemplates ( )
static

Get top skill templates and template categories.

Parameters

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

Referenced by ilSkillTemplateReferenceGUI\initForm().

745  {
746  $tr = new ilSkillTree();
747  $childs = $tr->getChildsByTypeFilter($tr->getRootId(), array("sktp", "sctp"));
748 
749  return $childs;
750  }
Skill tree.
+ 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  }
Skill tree.

◆ getType()

ilSkillTreeNode::getType ( )

Get type.

Returns
string Type

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

References $type.

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

75  {
76  return $this->type;
77  }
+ 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.

References read().

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  }
Skill tree.
read()
Read Data of Node.
+ 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.

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

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

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 // {
601  self::clearClipboard();
602 // }
603 
604  ilSkillTreeNode::saveChildsOrder($a_obj_id, array(),
605  in_array($a_type, array("sktp", "sctp")));
606 
607  return $copied_nodes;
608  }
Skill tree.
global $ilCtrl
Definition: ilias.php:18
static saveChildsOrder($a_par_id, $a_childs_order, $a_templates=false)
Save childs order.
const IL_LAST_NODE
Definition: class.ilTree.php:4
global $ilUser
Definition: imgupload.php:15
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.
+ 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

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

Referenced by ilBasicSkill\getSkillForLevelId().

708  {
709  $skill_tree = new ilSkillTree();
710  if ($skill_tree->isInTree($a_id))
711  {
712  return true;
713  }
714  return false;
715  }
Skill tree.
+ 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.

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

Referenced by insertItemsFromClip().

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.
static _lookupType($a_obj_id)
Lookup Type.
const IL_LAST_NODE
Definition: class.ilTree.php:4
global $ilUser
Definition: imgupload.php:15
global $lng
Definition: privfeed.php:40
Basic Skill.
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.
+ 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.

References IL_FIRST_NODE.

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

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  }
Skill tree.
const IL_FIRST_NODE
Definition: class.ilTree.php:5
+ Here is the caller graph for this function:

◆ read()

ilSkillTreeNode::read ( )

Read Data of Node.

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

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

Referenced by ilSkillTreeNode().

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  }
setType($a_type)
Set type.
setTitle($a_title)
Set title.
setSelfEvaluation($a_val)
Set self evaluation.
setOrderNr($a_val)
Set order nr.
global $ilBench
Definition: ilias.php:18
global $ilDB
setStatus($a_val)
Set status.
+ 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

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

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

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

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  }
Skill tree.
static sortArray($array, $a_array_sortby, $a_array_sortorder=0, $a_numeric=false, $a_keep_keys=false)
sortArray
static _writeOrderNr($a_obj_id, $a_nr)
Write Order Nr.
+ 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.

Referenced by create().

85  {
86  $this->id = $a_id;
87  }
+ 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.

Referenced by read().

125  {
126  $this->order_nr = $a_val;
127  }
+ 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.

Referenced by read().

105  {
106  $this->self_eval = $a_val;
107  }
+ 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.

Referenced by read().

289  {
290  $this->status = $a_val;
291  }
+ 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.

Referenced by read().

45  {
46  $this->title = $a_title;
47  }
+ 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.

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

65  {
66  $this->type = $a_type;
67  }
+ 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.

References $type, and _lookupType().

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

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  }
static _lookupType($a_obj_id)
Lookup Type.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ update()

ilSkillTreeNode::update ( )

Update Node.

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

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

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  }
getSelfEvaluation()
Get self evaluation.
getOrderNr()
Get order nr.
global $ilDB
+ Here is the call graph for this function:

Field Documentation

◆ $id

ilSkillTreeNode::$id

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

Referenced by clipboardCut(), 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 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.


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