ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
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...
 

Protected Attributes

 $db
 

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

33 {
34 global $DIC;
35
36 $this->db = $DIC->database();
37 $this->id = $a_id;
38
39 $this->skill_tree = new ilSkillTree();
40
41 if ($a_id != 0) {
42 $this->read();
43 }
44 }
read()
Read Data of Node.
global $DIC
Definition: saml.php:7

References $DIC, and 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 260 of file class.ilSkillTreeNode.php.

261 {
262 global $DIC;
263
264 $ilDB = $DIC->database();
265
266 $query = "SELECT $a_field FROM skl_tree_node WHERE obj_id = " .
267 $ilDB->quote($a_obj_id, "integer");
268 $obj_set = $ilDB->query($query);
269 $obj_rec = $ilDB->fetchAssoc($obj_set);
270
271 return $obj_rec[$a_field];
272 }
$query
global $ilDB

References $DIC, $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 299 of file class.ilSkillTreeNode.php.

300 {
301 global $DIC;
302
303 $ilDB = $DIC->database();
304
305 return self::_lookup($a_obj_id, "self_eval");
306 }
static _lookup($a_obj_id, $a_field)
Lookup Title.

References $DIC, $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 314 of file class.ilSkillTreeNode.php.

315 {
316 global $DIC;
317
318 $ilDB = $DIC->database();
319
320 return self::_lookup($a_obj_id, "status");
321 }

References $DIC, $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 280 of file class.ilSkillTreeNode.php.

281 {
282 global $DIC;
283
284 $ilDB = $DIC->database();
285
286 include_once("./Services/Skill/classes/class.ilSkillTemplateReference.php");
287 if ($a_tref_id > 0 && ilSkillTemplateReference::_lookupTemplateId($a_tref_id) == $a_obj_id) {
288 return self::_lookup($a_tref_id, "title");
289 }
290 return self::_lookup($a_obj_id, "title");
291 }
static _lookupTemplateId($a_obj_id)
Lookup template ID.

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

Referenced by ilSurveySkillThresholdsTableGUI\__construct(), ilSkillUsageTableGUI\__construct(), ilPersonalSkillsGUI\assignMaterials(), clipboardCopy(), ilTestSkillLevelThresholdsTableGUI\completeCompetenceTitles(), ilSkillProfileGUI\confirmLevelAssignmentRemoval(), ilContSkillAdminGUI\confirmRemoveSelectedSkill(), ilSkillSelfEvaluationGUI\confirmSelfEvaluationDeletion(), ilPersonalSkillsGUI\confirmSkillRemove(), ilSurveySkillAssignmentTableGUI\fillRow(), ilSurveySkillTableGUI\fillRow(), ilContSkillMemberTableGUI\fillRow(), ilSelfEvaluationTableGUI\fillRow(), ilSurveySkill\getAllAssignedSkillsAsOptions(), ilTestSkillLevelThresholdImportFails\getFailedImportsMessage(), ilPersonalSkillsGUI\getGapAnalysisHTML(), ilSkillTemplateTreeExplorerGUI\getNodeContent(), ilSkillTreeExplorerGUI\getNodeContent(), ilPersonalSkill\getSelectedUserSkills(), ilSurveySkillTableGUI\getSkills(), ilContSkillTableGUI\getSkills(), ilContSkillAdminGUI\initCompetenceAssignmentForm(), ilObjPortfolioGUI\initCreatePortfolioFromTemplateForm(), ilAssQuestionSkillAssignment\loadAdditionalSkillData(), ilPersonalSkillsGUI\renderSkillHTML(), ilPortfolioPageGUI\renderSkillsTeaser(), ilPersonalSkillsGUI\selfEvaluation(), ilSkillNotifications\sendMail(), and ilSkillTemplateReferenceGUI\setTabs().

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

389 {
390 global $DIC;
391
392 $ilDB = $DIC->database();
393
394 $query = "UPDATE skl_tree_node SET " .
395 " order_nr = " . $ilDB->quote($a_nr, "integer") .
396 " WHERE obj_id = " . $ilDB->quote($a_obj_id, "integer");
397 $ilDB->manipulate($query);
398 }

References $DIC, $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 369 of file class.ilSkillTreeNode.php.

370 {
371 global $DIC;
372
373 $ilDB = $DIC->database();
374
375 $query = "UPDATE skl_tree_node SET " .
376 " title = " . $ilDB->quote($a_title, "text") .
377 " WHERE obj_id = " . $ilDB->quote($a_obj_id, "integer");
378
379 $ilDB->manipulate($query);
380 }

References $DIC, $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 680 of file class.ilSkillTreeNode.php.

681 {
682 global $DIC;
683
684 $ilUser = $DIC->user();
685
686 $ilUser->clipboardDeleteObjectsOfType("skll");
687 $ilUser->clipboardDeleteObjectsOfType("scat");
688 $ilUser->clipboardDeleteObjectsOfType("sktr");
689 $ilUser->clipboardDeleteObjectsOfType("sktp");
690 $ilUser->clipboardDeleteObjectsOfType("sctp");
691 include_once("./Modules/LearningModule/classes/class.ilEditClipboard.php");
693 }
$ilUser
Definition: imgupload.php:18

References $DIC, $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 577 of file class.ilSkillTreeNode.php.

578 {
579 global $DIC;
580
581 $ilUser = $DIC->user();
582
584 include_once("./Services/Skill/classes/class.ilSkillTree.php");
585 $tree = new ilSkillTree();
586
587 // put them into the clipboard
588 $time = date("Y-m-d H:i:s", time());
589 foreach ($a_ids as $id) {
590 $curnode = "";
591 if ($tree->isInTree($id)) {
592 $curnode = $tree->getNodeData($id);
593 $subnodes = $tree->getSubTree($curnode);
594 foreach ($subnodes as $subnode) {
595 if ($subnode["child"] != $id) {
596 $ilUser->addObjectToClipboard(
597 $subnode["child"],
598 $subnode["type"],
599 $subnode["title"],
600 $subnode["parent"],
601 $time,
602 $subnode["lft"]
603 );
604 }
605 }
606 }
607 $order = ($curnode["lft"] > 0)
608 ? $curnode["lft"]
609 : (int) ($order + 1);
610 $ilUser->addObjectToClipboard(
611 $id,
614 0,
615 $time,
616 $order
617 );
618 }
619 }
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.
$time
Definition: cron.php:21

References $DIC, $id, $ilUser, $time, _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 536 of file class.ilSkillTreeNode.php.

537 {
539 include_once("./Services/Skill/classes/class.ilSkillTree.php");
540 $tree = new ilSkillTree();
541
542 if (!is_array($a_ids)) {
543 return false;
544 } else {
545 // get all "top" ids, i.e. remove ids, that have a selected parent
546 foreach ($a_ids as $id) {
547 $path = $tree->getPathId($id);
548 $take = true;
549 foreach ($path as $path_id) {
550 if ($path_id != $id && in_array($path_id, $a_ids)) {
551 $take = false;
552 }
553 }
554 if ($take) {
555 $cut_ids[] = $id;
556 }
557 }
558 }
559
560 ilSkillTreeNode::clipboardCopy($a_tree_id, $cut_ids);
561
562 // remove the objects from the tree
563 // note: we are getting skills/categories which are *not* in the tree
564 // we do not delete any pages/chapters here
565 foreach ($cut_ids as $id) {
566 $curnode = $tree->getNodeData($id);
567 if ($tree->isInTree($id)) {
568 $tree->deleteTree($curnode);
569 }
570 }
571 }
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 405 of file class.ilSkillTreeNode.php.

406 {
408
409 // insert object data
410 $id = $ilDB->nextId("skl_tree_node");
411 $query = "INSERT INTO skl_tree_node (obj_id, title, type, create_date, self_eval, order_nr, status, creation_date, import_id) " .
412 "VALUES (" .
413 $ilDB->quote($id, "integer") . "," .
414 $ilDB->quote($this->getTitle(), "text") . "," .
415 $ilDB->quote($this->getType(), "text") . ", " .
416 $ilDB->now() . ", " .
417 $ilDB->quote((int) $this->getSelfEvaluation(), "integer") . ", " .
418 $ilDB->quote((int) $this->getOrderNr(), "integer") . ", " .
419 $ilDB->quote((int) $this->getStatus(), "integer") . ", " .
420 $ilDB->now() . ", " .
421 $ilDB->quote($this->getImportId(), "text") .
422 ")";
423 $ilDB->manipulate($query);
424 $this->setId($id);
425 }
setId($a_id)
Set Node ID.
getOrderNr()
Get order nr.
getImportId()
Get import id.
getSelfEvaluation()
Get self evaluation.

References $db, $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 448 of file class.ilSkillTreeNode.php.

449 {
451
452 $query = "DELETE FROM skl_tree_node WHERE obj_id= " .
453 $ilDB->quote($this->getId(), "integer");
454 $ilDB->manipulate($query);
455 }

References $db, $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 929 of file class.ilSkillTreeNode.php.

930 {
931 global $DIC;
932
933 $ilDB = $DIC->database();
934
935 $res = array();
936 $candidates = array();
937
938 $skill_tree = new ilSkillTree();
939
940 $sql = "SELECT * " .
941 " FROM skl_tree_node" .
942 " WHERE " . $ilDB->like("title", "text", "%" . $a_term . "%");
943 $sql .= " ORDER BY title";
944 $set = $ilDB->query($sql);
945 include_once("./Services/Skill/classes/class.ilSkillTemplateReference.php");
946 while ($row = $ilDB->fetchAssoc($set)) {
947 if (in_array($row["type"], array("sctp", "sktp"))) {
948 // need to get "top template" first! (if it is already the top level, do not use it!)
949 $path = $skill_tree->getSkillTreePath($row["obj_id"]);
950 if ($path[1]["child"] != $row["obj_id"]) {
952 foreach ($trefs as $tref) {
953 $candidates[] = array("tref_id" => $tref, "skill_id" => $row["obj_id"], "title" => $row["title"]);
954 }
955 }
956 } elseif ($row["type"] == "sktr") {
957 // works
958 $candidates[] = array("tref_id" => $row["obj_id"], "skill_id" => ilSkillTemplateReference::_lookupTemplateId($row["obj_id"]), "title" => $row["title"]);
959 } else {
960 // works
961 $candidates[] = array("tref_id" => 0, "skill_id" => $row["obj_id"], "title" => $row["title"]);
962 }
963 }
964
965 foreach ($candidates as $c) {
966 // if we get a path array, and the array has items try to use the data
967 $path = $skill_tree->getSkillTreePath($c["skill_id"], $c["tref_id"]);
968 $use = false;
969 if (is_array($path) && count($path) > 0) {
970 $use = true;
971 }
972
973 // if any inactive/outdated -> do not use the data
974 if (is_array($path)) {
975 foreach ($path as $p) {
976 if ($p["status"] > 0) {
977 $use = false;
978 }
979 }
980 }
981 if ($use) {
982 if (!in_array($c["title"], $res)) {
983 $res[] = $c["title"];
984 }
985 }
986 }
987
988
989 return $res;
990 }
static _lookupTrefIdsForTopTemplateId($a_template_id)
Lookup tref ids for template id.
foreach($_POST as $key=> $value) $res

References $DIC, $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 998 of file class.ilSkillTreeNode.php.

999 {
1000 include_once("./Services/Skill/classes/class.ilSkillTemplateReference.php");
1001 $cskill_ids = array();
1002 foreach ($a_node_ids as $id) {
1003 if (in_array(self::_lookupType($id), array("skll", "scat", "sktr"))) {
1004 $skill_id = $id;
1005 $tref_id = 0;
1006 if (ilSkillTreeNode::_lookupType($id) == "sktr") {
1008 $tref_id = $id;
1009 }
1010 $cskill_ids[] = array("skill_id" => $skill_id, "tref_id" => $tref_id);
1011 }
1012 if (in_array(ilSkillTreeNode::_lookupType($id), array("sktp", "sctp"))) {
1014 $cskill_ids[] = array("skill_id" => $id, "tref_id" => $tref_id);
1015 }
1016 }
1017 // for cats, skills and template references, get "real" usages
1018 // for skill and category templates check usage in references
1019 }
1020 return $cskill_ids;
1021 }
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 790 of file class.ilSkillTreeNode.php.

791 {
792 global $DIC;
793
794 $ilDB = $DIC->database();
795
796 $set = $ilDB->query(
797 "SELECT obj_id, title FROM skl_tree_node WHERE " .
798 " self_eval = " . $ilDB->quote(true, "integer") . " ORDER BY TITLE "
799 );
800 $nodes = array();
801 while ($rec = $ilDB->fetchAssoc($set)) {
802 $nodes[$rec["obj_id"]] = $rec["title"];
803 }
804 return $nodes;
805 }

References $DIC, and $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 191 of file class.ilSkillTreeNode.php.

192 {
193 global $DIC;
194
195 $lng = $DIC->language();
196
197 return array(
198 self::STATUS_DRAFT => $lng->txt("skmg_status_draft"),
199 self::STATUS_PUBLISH => $lng->txt("skmg_status_publish"),
200 self::STATUS_OUTDATED => $lng->txt("skmg_status_outdated")
201 );
202 }
global $lng
Definition: privfeed.php:17

References $DIC, and $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 181 of file class.ilSkillTreeNode.php.

182 {
183 return $this->creation_date;
184 }

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

898 {
899 if ($a_status == self::STATUS_DRAFT && $a_type == "sctp") {
900 $a_type = "scat";
901 }
902 if ($a_status == self::STATUS_DRAFT && $a_type == "sktp") {
903 $a_type = "skll";
904 }
905
906 $off = ($a_status == self::STATUS_DRAFT)
907 ? "_off"
908 : "";
909
910 $a_name = "icon_" . $a_type . $a_size . $off . ".svg";
911 if ($a_type == "sktr") {
912 include_once("./Services/Skill/classes/class.ilSkillTemplateReference.php");
915 if ($type == "sctp") {
916 $a_name = "icon_sctr" . $a_size . $off . ".svg";
917 }
918 }
919 $vers = "vers=" . str_replace(array(".", " "), "-", ILIAS_VERSION);
920 return ilUtil::getImagePath($a_name) . "?" . $vers;
921 }
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:92

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

102 {
103 return $this->id;
104 }

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

162 {
163 return $this->import_id;
164 }

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

142 {
143 return $this->order_nr;
144 }

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

828 {
829 global $DIC;
830
831 $ilDB = $DIC->database();
832
833 $set = $ilDB->query(
834 "SELECT * FROM skl_tree_node " .
835 " WHERE self_eval = " . $ilDB->quote(1, "integer")
836 );
837
838 $sel_skills = array();
839 while ($rec = $ilDB->fetchAssoc($set)) {
840 $sel_skills[] = $rec;
841 }
842
843 return $sel_skills;
844 }

References $DIC, and $ilDB.

◆ getSelfEvaluation()

ilSkillTreeNode::getSelfEvaluation ( )

Get self evaluation.

Returns
boolean self evaluation

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

122 {
123 return $this->self_eval;
124 }

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

359 {
360 return $this->status;
361 }

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

211 {
212 global $DIC;
213
214 $lng = $DIC->language();
215
216 switch ($a_status) {
217 case self::STATUS_PUBLISH: return $lng->txt("skmg_status_publish_info");
218 case self::STATUS_DRAFT: return $lng->txt("skmg_status_draft_info");
219 case self::STATUS_OUTDATED: return $lng->txt("skmg_status_outdated_info");
220 }
221 return "";
222 }

References $DIC, $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 61 of file class.ilSkillTreeNode.php.

62 {
63 return $this->title;
64 }

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

814 {
815 $tr = new ilSkillTree();
816 $childs = $tr->getChildsByTypeFilter($tr->getRootId(), array("sktp", "sctp"));
817
818 return $childs;
819 }

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

508 {
509 $tree = new ilSkillTree();
510
511 return $tree;
512 }

◆ getType()

ilSkillTreeNode::getType ( )

Get type.

Returns
string Type

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

82 {
83 return $this->type;
84 }

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

626 {
627 global $DIC;
628
629 $ilCtrl = $DIC->ctrl();
630 $ilUser = $DIC->user();
631
632 // @todo: move this to a service since it can be used here, too
633 include_once("./Modules/LearningModule/classes/class.ilEditClipboard.php");
634
635 include_once("./Services/Skill/classes/class.ilSkillTree.php");
636 $tree = new ilSkillTree();
637
638 $parent_id = $a_obj_id;
640
641 // cut and paste
642 $skills = $ilUser->getClipboardObjects($a_type); // this will get all skills _regardless_ of level
643 $copied_nodes = array();
644 foreach ($skills as $skill) {
645 // if skill was already copied as part of tree - do not copy it again
646 if (!in_array($skill["id"], array_keys($copied_nodes))) {
648 $skill["id"],
649 $parent_id,
650 $target,
651 $skill["insert_time"],
652 $copied_nodes,
653 (ilEditClipboard::getAction() == "copy"),
654 true
655 );
656 // $target = $cid;
657 }
658 }
659
660 // if (ilEditClipboard::getAction() == "cut")
661 // {
663 // }
664
666 $a_obj_id,
667 array(),
668 in_array($a_type, array("sktp", "sctp"))
669 );
670
671 return $copied_nodes;
672 }
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, $DIC, $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 775 of file class.ilSkillTreeNode.php.

776 {
777 $skill_tree = new ilSkillTree();
778 if ($skill_tree->isInTree($a_id)) {
779 return true;
780 }
781 return false;
782 }

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

707 {
708 global $DIC;
709
710 $ilUser = $DIC->user();
711 $ilLog = $DIC["ilLog"];
712 $lng = $DIC->language();
713
714 $item_type = ilSkillTreeNode::_lookupType($a_item_id);
715
716 if ($item_type == "scat") {
717 include_once("./Services/Skill/classes/class.ilSkillCategory.php");
718 $item = new ilSkillCategory($a_item_id);
719 } elseif ($item_type == "skll") {
720 include_once("./Services/Skill/classes/class.ilBasicSkill.php");
721 $item = new ilBasicSkill($a_item_id);
722 } elseif ($item_type == "sktr") {
723 include_once("./Services/Skill/classes/class.ilSkillTemplateReference.php");
724 $item = new ilSkillTemplateReference($a_item_id);
725 } elseif ($item_type == "sktp") {
726 include_once("./Services/Skill/classes/class.ilBasicSkillTemplate.php");
727 $item = new ilBasicSkillTemplate($a_item_id);
728 } elseif ($item_type == "sctp") {
729 include_once("./Services/Skill/classes/class.ilSkillTemplateCategory.php");
730 $item = new ilSkillTemplateCategory($a_item_id);
731 }
732
733 $ilLog->write("Getting from clipboard type " . $item_type . ", " .
734 "Item ID: " . $a_item_id);
735
736 if ($a_as_copy) {
737 $target_item = $item->copy();
738 if ($a_add_suffix) {
739 $target_item->setTitle($target_item->getTitle() . " " . $lng->txt("copy_of_suffix"));
740 $target_item->update();
741 }
742 $a_copied_nodes[$item->getId()] = $target_item->getId();
743 } else {
744 $target_item = $item;
745 }
746
747 $ilLog->write("Putting into skill tree type " . $target_item->getType() .
748 "Item ID: " . $target_item->getId() . ", Parent: " . $a_parent_id . ", " .
749 "Target: " . $a_target);
750
751 ilSkillTreeNode::putInTree($target_item, $a_parent_id, $a_target);
752
753 $childs = $ilUser->getClipboardChilds($item->getId(), $a_insert_time);
754
755 foreach ($childs as $child) {
757 $child["id"],
758 $target_item->getId(),
760 $a_insert_time,
761 $a_copied_nodes,
762 $a_as_copy
763 );
764 }
765
766 return $target_item->getId();
767 }
static putInTree($a_obj, $a_parent_id="", $a_target_node_id="")
Put this object into the skill tree.

References $DIC, $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 460 of file class.ilSkillTreeNode.php.

461 {
462 $skill_tree = new ilSkillTree();
463
464 // determine parent
465 $parent_id = ($a_parent_id != "")
466 ? $a_parent_id
467 : $skill_tree->getRootId();
468
469 // make a check, whether the type of object is allowed under
470 // the parent
471 $allowed = array(
472 "skrt" => array("skll", "scat", "sktr", "sktp", "sctp"),
473 "scat" => array("skll", "scat", "sktr"),
474 "sctp" => array("sktp", "sctp"));
475 $par_type = self::_lookupType($parent_id);
476 if (!is_array($allowed[$par_type]) ||
477 !in_array($a_obj->getType(), $allowed[$par_type])) {
478 return;
479 }
480
481 // determine target
482 if ($a_target_node_id != "") {
483 $target = $a_target_node_id;
484 } else {
485 // determine last child that serves as predecessor
486 $childs = $skill_tree->getChilds($parent_id);
487
488 if (count($childs) == 0) {
490 } else {
491 $target = $childs[count($childs) - 1]["obj_id"];
492 }
493 }
494
495 if ($skill_tree->isInTree($parent_id) && !$skill_tree->isInTree($a_obj->getId())) {
496 $skill_tree->insertNode($a_obj->getId(), $parent_id, $target);
497 }
498 }
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 227 of file class.ilSkillTreeNode.php.

228 {
230
231 if (!isset($this->data_record)) {
232 $query = "SELECT * FROM skl_tree_node WHERE obj_id = " .
233 $ilDB->quote($this->id, "integer");
234 $obj_set = $ilDB->query($query);
235 $this->data_record = $ilDB->fetchAssoc($obj_set);
236 }
237 $this->setType($this->data_record["type"]);
238 $this->setTitle($this->data_record["title"]);
239 $this->setOrderNr($this->data_record["order_nr"]);
240 $this->setSelfEvaluation($this->data_record["self_eval"]);
241 $this->setStatus($this->data_record["status"]);
242 $this->setImportId($this->data_record["import_id"]);
243 $this->setCreationDate($this->data_record["creation_date"]);
244 }
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.

References $db, $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 852 of file class.ilSkillTreeNode.php.

853 {
854 include_once("./Services/Skill/classes/class.ilSkillTree.php");
855 $skill_tree = new ilSkillTree();
856
857 if ($a_par_id != $skill_tree->readRootId()) {
858 $childs = $skill_tree->getChilds($a_par_id);
859 } else {
860 if ($a_templates) {
861 $childs = $skill_tree->getChildsByTypeFilter(
862 $a_par_id,
863 array("skrt", "sktp", "sctp")
864 );
865 } else {
866 $childs = $skill_tree->getChildsByTypeFilter(
867 $a_par_id,
868 array("skrt", "skll", "scat", "sktr")
869 );
870 }
871 }
872
873 foreach ($childs as $k => $c) {
874 if (isset($a_childs_order[$c["child"]])) {
875 $childs[$k]["order_nr"] = (int) $a_childs_order[$c["child"]];
876 }
877 }
878
879 $childs = ilUtil::sortArray($childs, "order_nr", "asc", true);
880
881 $cnt = 10;
882 foreach ($childs as $c) {
883 ilSkillTreeNode::_writeOrderNr($c["child"], $cnt);
884 $cnt += 10;
885 }
886 }
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 171 of file class.ilSkillTreeNode.php.

172 {
173 $this->creation_date = $a_val;
174 }

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

250 {
251 $this->data_record = $a_record;
252 }

◆ setId()

ilSkillTreeNode::setId (   $a_id)

Set Node ID.

Parameters
intNode ID

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

92 {
93 $this->id = $a_id;
94 }

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

152 {
153 $this->import_id = $a_val;
154 }

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

132 {
133 $this->order_nr = $a_val;
134 }

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

112 {
113 $this->self_eval = $a_val;
114 }

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

349 {
350 $this->status = $a_val;
351 }

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

52 {
53 $this->title = $a_title;
54 }

Referenced by read().

+ Here is the caller graph for this function:

◆ setType()

ilSkillTreeNode::setType (   $a_type)

Set type.

Parameters
stringType

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

72 {
73 $this->type = $a_type;
74 }

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

518 {
519 $types = array();
520 if (is_array($a_items)) {
521 foreach ($a_items as $item) {
523 $types[$type] = $type;
524 }
525 }
526
527 if (count($types) > 1) {
528 return false;
529 }
530 return true;
531 }

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

431 {
433
434 $query = "UPDATE skl_tree_node SET " .
435 " title = " . $ilDB->quote($this->getTitle(), "text") .
436 " ,self_eval = " . $ilDB->quote((int) $this->getSelfEvaluation(), "integer") .
437 " ,order_nr = " . $ilDB->quote((int) $this->getOrderNr(), "integer") .
438 " ,status = " . $ilDB->quote((int) $this->getStatus(), "integer") .
439 " ,import_id = " . $ilDB->quote($this->getImportId(), "text") .
440 " WHERE obj_id = " . $ilDB->quote($this->getId(), "integer");
441
442 $ilDB->manipulate($query);
443 }

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

+ Here is the call graph for this function:

Field Documentation

◆ $db

ilSkillTreeNode::$db
protected

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

Referenced by create(), delete(), read(), and update().

◆ $id

ilSkillTreeNode::$id

◆ $title

ilSkillTreeNode::$title

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

Referenced by getTitle().

◆ $type

ilSkillTreeNode::$type

Definition at line 25 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 22 of file class.ilSkillTreeNode.php.

Referenced by getStatusInfo().


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