ILIAS  release_4-3 Revision
 All Data Structures Namespaces Files Functions Variables Groups 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.
 getTitle ()
 Get title.
 setType ($a_type)
 Set type.
 getType ()
 Get type.
 setId ($a_id)
 Set Node ID.
 getId ()
 Get Node ID.
 setSelfEvaluation ($a_val)
 Set self evaluation.
 getSelfEvaluation ()
 Get self evaluation.
 setOrderNr ($a_val)
 Set order nr.
 getOrderNr ()
 Get order nr.
 read ()
 Read Data of Node.
 setDataRecord ($a_record)
 this method should only be called by class ilSCORM2004NodeFactory
 setDraft ($a_val)
 Set draft.
 getDraft ()
 Get draft.
 create ()
 Create Node.
 update ()
 Update Node.
 delete ()
 Delete Node.
 clipboardCut ($a_tree_id, $a_ids)
 Cut and copy a set of skills/skill categories into the clipboard.
 getIconPath ($a_obj_id, $a_type, $a_size="", $a_draft=false)
 Get icon path.

Static Public Member Functions

static _lookupTitle ($a_obj_id)
 Lookup Title.
static _lookupSelfEvaluation ($a_obj_id)
 Lookup self evaluation.
static _lookupDraft ($a_obj_id)
 Lookup Draft.
static _lookupType ($a_obj_id)
 Lookup Type.
static _writeTitle ($a_obj_id, $a_title)
 Write Title.
static _writeOrderNr ($a_obj_id, $a_nr)
 Write Order Nr.
static putInTree ($a_obj, $a_parent_id="", $a_target_node_id="")
 Put this object into the skill tree.
static getTree ($a_slm_obj_id)
 Get scorm module editing tree.
static uniqueTypesCheck ($a_items)
 Check for unique types.
static clipboardCopy ($a_tree_id, $a_ids)
 Copy a set of skills/skill categories into the clipboard.
static insertItemsFromClip ($a_type, $a_obj_id)
 Insert basic skills from clipboard.
static clearClipboard ()
 Remove all skill items from clipboard.
static pasteTree ($a_item_id, $a_parent_id, $a_target, $a_insert_time, &$a_copied_nodes, $a_as_copy=false, $a_add_suffix=false)
 Paste item (tree) from clipboard to skill tree.
static isInTree ($a_id)
 Is id in tree?
static getAllSelfEvaluationNodes ()
 Get all self evaluation nodes.
static getTopTemplates ()
 Get top skill templates and template categories.
static getSelectableSkills ()
 Get selectable skills.
static getSkillTreeNodes ($a_node_id, $a_only_basic=false)
 Get basic skills under node.
static saveChildsOrder ($a_par_id, $a_childs_order, $a_templates=false)
 Save childs order.

Data Fields

 $type
 $id
 $title

Static Protected Member Functions

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

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

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

Lookup Title.

Parameters
intNode ID
Returns
string Title

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

References $query.

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

{
global $ilDB;
$query = "SELECT $a_field FROM skl_tree_node WHERE obj_id = ".
$ilDB->quote($a_obj_id, "integer");
$obj_set = $ilDB->query($query);
$obj_rec = $ilDB->fetchAssoc($obj_set);
return $obj_rec[$a_field];
}

+ Here is the caller graph for this function:

static ilSkillTreeNode::_lookupDraft (   $a_obj_id)
static

Lookup Draft.

Parameters
intnode ID
Returns
boolean draft

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

References _lookup().

Referenced by ilPersonalSkillExplorer\buildSelectableTree(), ilSkillCatTableGUI\fillRow(), ilSkillExplorer\getChildsOfNode(), and ilSkillTreeNodeGUI\setTitleIcon().

{
global $ilDB;
return self::_lookup($a_obj_id, "draft");
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static ilSkillTreeNode::_lookupSelfEvaluation (   $a_obj_id)
static

Lookup self evaluation.

Parameters
intnode ID
Returns
boolean selectable? (self evaluation=

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

References _lookup().

Referenced by ilPersonalSkillExplorer\buildSelectableTree(), ilSkillExplorer\buildTitle(), and ilPersonalSkillExplorer\isClickable().

{
global $ilDB;
return self::_lookup($a_obj_id, "self_eval");
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static ilSkillTreeNode::_lookupType (   $a_obj_id)
static

Lookup Type.

Parameters
intNode ID
Returns
string Type

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

References $query.

Referenced by ilPersonalSkillsGUI\assignMaterials(), clipboardCopy(), getIconPath(), ilSkillTreeNodeGUI\ilSkillTreeNodeGUI(), pasteTree(), putInTree(), ilSkillCategoryGUI\redirectToParent(), ilSkillTreeNodeGUI\redirectToParent(), ilBasicSkillGUI\redirectToParent(), ilPersonalSkillsGUI\selfEvaluation(), and uniqueTypesCheck().

{
global $ilDB;
$query = "SELECT * FROM skl_tree_node WHERE obj_id = ".
$ilDB->quote($a_obj_id, "integer");
$obj_set = $ilDB->query($query);
$obj_rec = $ilDB->fetchAssoc($obj_set);
return $obj_rec["type"];
}

+ Here is the caller graph for this function:

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

Write Order Nr.

Parameters
intNode ID
stringOrder Nr

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

References $query.

Referenced by saveChildsOrder().

{
global $ilDB;
$query = "UPDATE skl_tree_node SET ".
" order_nr = ".$ilDB->quote($a_nr, "integer").
" WHERE obj_id = ".$ilDB->quote($a_obj_id, "integer");
$ilDB->manipulate($query);
}

+ Here is the caller graph for this function:

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

Write Title.

Parameters
intNode ID
stringTitle

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

References $query.

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

{
global $ilDB;
$query = "UPDATE skl_tree_node SET ".
" title = ".$ilDB->quote($a_title, "text").
" WHERE obj_id = ".$ilDB->quote($a_obj_id, "integer");
$ilDB->manipulate($query);
}

+ Here is the caller graph for this function:

static ilSkillTreeNode::clearClipboard ( )
static

Remove all skill items from clipboard.

Parameters
@return

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

References $ilUser, and ilEditClipboard\clear().

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

{
global $ilUser;
$ilUser->clipboardDeleteObjectsOfType("skll");
$ilUser->clipboardDeleteObjectsOfType("scat");
$ilUser->clipboardDeleteObjectsOfType("sktr");
$ilUser->clipboardDeleteObjectsOfType("sktp");
$ilUser->clipboardDeleteObjectsOfType("sctp");
include_once("./Modules/LearningModule/classes/class.ilEditClipboard.php");
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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

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

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

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

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

{
global $ilUser;
include_once("./Services/Skill/classes/class.ilSkillTree.php");
$tree = new ilSkillTree();
// put them into the clipboard
$time = date("Y-m-d H:i:s", time());
foreach ($a_ids as $id)
{
$curnode = "";
if ($tree->isInTree($id))
{
$curnode = $tree->getNodeData($id);
$subnodes = $tree->getSubTree($curnode);
foreach($subnodes as $subnode)
{
if ($subnode["child"] != $id)
{
$ilUser->addObjectToClipboard($subnode["child"],
$subnode["type"], $subnode["title"],
$subnode["parent"], $time, $subnode["lft"]);
}
}
}
$order = ($curnode["lft"] > 0)
? $curnode["lft"]
: (int) ($order + 1);
$ilUser->addObjectToClipboard($id,
$order);
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilSkillTreeNode::clipboardCut (   $a_tree_id,
  $a_ids 
)

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

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

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

Referenced by ilSkillTreeNodeGUI\cutItems().

{
include_once("./Services/Skill/classes/class.ilSkillTree.php");
$tree = new ilSkillTree();
if (!is_array($a_ids))
{
return false;
}
else
{
// get all "top" ids, i.e. remove ids, that have a selected parent
foreach($a_ids as $id)
{
$path = $tree->getPathId($id);
$take = true;
foreach($path as $path_id)
{
if ($path_id != $id && in_array($path_id, $a_ids))
{
$take = false;
}
}
if ($take)
{
$cut_ids[] = $id;
}
}
}
ilSkillTreeNode::clipboardCopy($a_tree_id, $cut_ids);
// remove the objects from the tree
// note: we are getting skills/categories which are *not* in the tree
// we do not delete any pages/chapters here
foreach ($cut_ids as $id)
{
$curnode = $tree->getNodeData($id);
if ($tree->isInTree($id))
{
$tree->deleteTree($curnode);
}
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilSkillTreeNode::create ( )

Create Node.

Parameters
booleanUpload Mode

Reimplemented in ilSkillTemplateReference, ilBasicSkill, ilSkillCategory, and ilSkillRoot.

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

References $id, $query, getDraft(), getOrderNr(), getSelfEvaluation(), getTitle(), getType(), and setId().

{
global $ilDB;
// insert object data
$id = $ilDB->nextId("skl_tree_node");
$query = "INSERT INTO skl_tree_node (obj_id, title, type, create_date, self_eval, order_nr, draft) ".
"VALUES (".
$ilDB->quote($id, "integer").",".
$ilDB->quote($this->getTitle(), "text").",".
$ilDB->quote($this->getType(), "text").", ".
$ilDB->now().", ".
$ilDB->quote((int) $this->getSelfEvaluation(), "integer").", ".
$ilDB->quote((int) $this->getOrderNr(), "integer").", ".
$ilDB->quote((int) $this->getDraft(), "integer").
")";
$ilDB->manipulate($query);
$this->setId($id);
}

+ Here is the call graph for this function:

ilSkillTreeNode::delete ( )

Delete Node.

Reimplemented in ilSkillTemplateReference, ilBasicSkill, ilSkillCategory, and ilSkillRoot.

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

References $query, and getId().

{
global $ilDB;
$query = "DELETE FROM skl_tree_node WHERE obj_id= ".
$ilDB->quote($this->getId(), "integer");
$ilDB->manipulate($query);
}

+ Here is the call graph for this function:

static ilSkillTreeNode::getAllSelfEvaluationNodes ( )
static

Get all self evaluation nodes.

Parameters
@return

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

Referenced by ilSkillSelfEvaluationGUI\listSelfEvaluations().

{
global $ilDB;
$set = $ilDB->query("SELECT obj_id, title FROM skl_tree_node WHERE ".
" self_eval = ".$ilDB->quote(true, "integer")." ORDER BY TITLE "
);
$nodes = array();
while ($rec = $ilDB->fetchAssoc($set))
{
$nodes[$rec["obj_id"]] = $rec["title"];
}
return $nodes;
}

+ Here is the caller graph for this function:

ilSkillTreeNode::getDraft ( )

Get draft.

Returns
boolean draft

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

Referenced by create(), and update().

{
return $this->draft;
}

+ Here is the caller graph for this function:

ilSkillTreeNode::getIconPath (   $a_obj_id,
  $a_type,
  $a_size = "",
  $a_draft = false 
)

Get icon path.

Parameters
@return

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

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

Referenced by ilSkillCatTableGUI\fillRow(), ilSkillExplorer\getImage(), and ilSkillTreeNodeGUI\setTitleIcon().

{
$off = ($a_draft)
? "_off"
: "";
$a_name = "icon_".$a_type.$a_size.$off.".png";
if ($a_type == "sktr")
{
include_once("./Services/Skill/classes/class.ilSkillTemplateReference.php");
if ($type == "sctp")
{
$a_name = "icon_sctr".$a_size.$off.".png";
}
}
$vers = "vers=".str_replace(array(".", " "), "-", ILIAS_VERSION);
return ilUtil::getImagePath($a_name)."?".$vers;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilSkillTreeNode::getId ( )

Get Node ID.

Parameters
intNode ID

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

References $id.

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

{
return $this->id;
}

+ Here is the caller graph for this function:

ilSkillTreeNode::getOrderNr ( )

Get order nr.

Returns
int order nr

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

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

{
return $this->order_nr;
}

+ Here is the caller graph for this function:

static ilSkillTreeNode::getSelectableSkills ( )
static

Get selectable skills.

Parameters
@return

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

{
global $ilDB;
$set = $ilDB->query("SELECT * FROM skl_tree_node ".
" WHERE self_eval = ".$ilDB->quote(1, "integer")
);
$sel_skills = array();
while ($rec = $ilDB->fetchAssoc($set))
{
$sel_skills[] = $rec;
}
return $sel_skills;
}
ilSkillTreeNode::getSelfEvaluation ( )

Get self evaluation.

Returns
boolean self evaluation

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

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

{
return $this->self_eval;
}

+ Here is the caller graph for this function:

static ilSkillTreeNode::getSkillTreeNodes (   $a_node_id,
  $a_only_basic = false 
)
static

Get basic skills under node.

Parameters
@return

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

Referenced by ilPersonalSkillsGUI\assignMaterials(), ilCOPageHTMLExport\collectPageElements(), ilPersonalSkillsGUI\getSkillHTML(), ilSkillTemplateReferenceGUI\listItems(), and ilPersonalSkillsGUI\selfEvaluation().

{
$skills = array();
if ($a_node_id > 0)
{
include_once("./Services/Skill/classes/class.ilSkillTemplateReference.php");
include_once("./Services/Skill/classes/class.ilSkillTree.php");
$stree = new ilSkillTree();
if ($stree->isInTree($a_node_id))
{
$cnode = $stree->getNodeData($a_node_id);
// is node basic skill?
if ($cnode["type"] == "skll" || !$a_only_basic)
{
$skills[] = array("id" => $a_node_id,
"type" => $cnode["type"], "parent" => $cnode["parent"],
"tref" => 0);
}
// is node skill template reference?
if ($cnode["type"] == "sktr")
{
$tr_ref = new ilSkillTemplateReference($cnode["child"]);
if ($tr_ref->getSkillTemplateId() > 0)
{
$cnode2 = $stree->getNodeData($tr_ref->getSkillTemplateId());
if ($cnode2["child"] > 0)
{
$childs2 = $stree->getSubTree($cnode2);
foreach ($childs2 as $child2)
{
// find basic skills templates
if ($child2["type"] == "sktp" || !$a_only_basic)
{
$par = ($tr_ref->getSkillTemplateId() == $child2["child"])
? $cnode["child"]
: $child2["parent"];
$skills[] = array("id" => $child2["child"],
"type" => $child2["type"], "parent" => $par,
"tref" => $cnode["child"]);
}
}
}
}
}
else
{
$childs = $stree->getSubTree($cnode);
foreach ($childs as $child)
{
// getSubTree($cnode) will also return $cnode
if($child["child"] == $cnode["child"])
{
continue;
}
// find basic skills
if ($child["type"] == "skll" || !$a_only_basic)
{
$skills[] = array("id" => $child["child"],
"type" => $child["type"], "parent" => $child["parent"],
"tref" => 0);
}
// handle template references
if ($child["type"] == "sktr")
{
$tr_ref = new ilSkillTemplateReference($child["child"]);
$cnode2 = $stree->getNodeData($tr_ref->getSkillTemplateId());
if ($tr_ref->getSkillTemplateId() > 0)
{
if ($cnode2["child"] > 0)
{
$childs2 = $stree->getSubTree($cnode2);
foreach ($childs2 as $child2)
{
$par = ($tr_ref->getSkillTemplateId() == $child2["child"])
? $cnode2["child"]
: $child2["parent"];
// find basic skills templates
if ($child2["type"] == "sktp" || !$a_only_basic)
{
$skills[] = array("id" => $child2["child"],
"type" => $child2["type"], "parent" => $par,
"tref" => $child["child"]);
}
}
}
}
}
}
}
}
}
//var_dump($skills);
return $skills;
}

+ Here is the caller graph for this function:

ilSkillTreeNode::getTitle ( )

Get title.

Returns
string title

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

References $title.

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

{
return $this->title;
}

+ Here is the caller graph for this function:

static ilSkillTreeNode::getTopTemplates ( )
static

Get top skill templates and template categories.

Parameters
@return

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

Referenced by ilSkillTemplateReferenceGUI\initForm().

{
$tr = new ilSkillTree();
$childs = $tr->getChildsByTypeFilter($tr->getRootId(), array("sktp", "sctp"));
return $childs;
}

+ Here is the caller graph for this function:

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

{
$tree = new ilSkillTree();
return $tree;
}
ilSkillTreeNode::getType ( )

Get type.

Returns
string Type

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

References $type.

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

{
return $this->type;
}

+ Here is the caller graph for this function:

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

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

References read().

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

{
$this->id = $a_id;
$this->skill_tree = new ilSkillTree();
if($a_id != 0)
{
$this->read();
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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

Insert basic skills from clipboard.

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

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().

{
global $ilCtrl, $ilUser;
// @todo: move this to a service since it can be used here, too
include_once("./Modules/LearningModule/classes/class.ilEditClipboard.php");
include_once("./Services/Skill/classes/class.ilSkillTree.php");
$tree = new ilSkillTree();
$parent_id = $a_obj_id;
$target = IL_LAST_NODE;
// cut and paste
$skills = $ilUser->getClipboardObjects($a_type); // this will get all skills _regardless_ of level
$copied_nodes = array();
foreach ($skills as $skill)
{
// if skill was already copied as part of tree - do not copy it again
if(!in_array($skill["id"], array_keys($copied_nodes)))
{
$cid = ilSkillTreeNode::pasteTree($skill["id"], $parent_id, $target,
$skill["insert_time"], $copied_nodes,
(ilEditClipboard::getAction() == "copy"), true);
// $target = $cid;
}
}
// if (ilEditClipboard::getAction() == "cut")
// {
// }
in_array($a_type, array("sktp", "sctp")));
return $copied_nodes;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static ilSkillTreeNode::isInTree (   $a_id)
static

Is id in tree?

Parameters
@return

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

Referenced by ilBasicSkill\getSkillForLevelId().

{
$skill_tree = new ilSkillTree();
if ($skill_tree->isInTree($a_id))
{
return true;
}
return false;
}

+ Here is the caller graph for this function:

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

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

Referenced by insertItemsFromClip().

{
global $ilUser, $ilias, $ilLog, $lng;
$item_type = ilSkillTreeNode::_lookupType($a_item_id);
if ($item_type == "scat")
{
include_once("./Services/Skill/classes/class.ilSkillCategory.php");
$item = new ilSkillCategory($a_item_id);
}
else if ($item_type == "skll")
{
include_once("./Services/Skill/classes/class.ilBasicSkill.php");
$item = new ilBasicSkill($a_item_id);
}
else if ($item_type == "sktr")
{
include_once("./Services/Skill/classes/class.ilSkillTemplateReference.php");
$item = new ilSkillTemplateReference($a_item_id);
}
else if ($item_type == "sktp")
{
include_once("./Services/Skill/classes/class.ilBasicSkillTemplate.php");
$item = new ilBasicSkillTemplate($a_item_id);
}
else if ($item_type == "sctp")
{
include_once("./Services/Skill/classes/class.ilSkillTemplateCategory.php");
$item = new ilSkillTemplateCategory($a_item_id);
}
$ilLog->write("Getting from clipboard type ".$item_type.", ".
"Item ID: ".$a_item_id);
if ($a_as_copy)
{
$target_item = $item->copy();
if($a_add_suffix)
{
$target_item->setTitle($target_item->getTitle()." ".$lng->txt("copy_of_suffix"));
$target_item->update();
}
$a_copied_nodes[$item->getId()] = $target_item->getId();
}
else
{
$target_item = $item;
}
$ilLog->write("Putting into skill tree type ".$target_item->getType().
"Item ID: ".$target_item->getId().", Parent: ".$a_parent_id.", ".
"Target: ".$a_target);
ilSkillTreeNode::putInTree($target_item, $a_parent_id, $a_target);
$childs = $ilUser->getClipboardChilds($item->getId(), $a_insert_time);
foreach($childs as $child)
{
ilSkillTreeNode::pasteTree($child["id"], $target_item->getId(),
IL_LAST_NODE, $a_insert_time, $a_copied_nodes, $a_as_copy);
}
return $target_item->getId();
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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

Put this object into the skill tree.

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

References _lookupType(), and IL_FIRST_NODE.

Referenced by ilObjSkillManagementGUI\insertBasicSkill(), ilObjSkillManagementGUI\insertBasicSkillTemplate(), ilObjSkillManagementGUI\insertSkillCategory(), ilObjSkillManagementGUI\insertSkillTemplateCategory(), pasteTree(), ilBasicSkillGUI\saveItem(), ilSkillTemplateCategoryGUI\saveItem(), ilSkillCategoryGUI\saveItem(), ilBasicSkillTemplateGUI\saveItem(), and ilSkillTemplateReferenceGUI\saveItem().

{
$skill_tree = new ilSkillTree();
// determine parent
$parent_id = ($a_parent_id != "")
? $a_parent_id
: $skill_tree->getRootId();
// make a check, whether the type of object is allowed under
// the parent
$allowed = array(
"skrt" => array("skll", "scat", "sktr", "sktp", "sctp"),
"scat" => array("skll", "scat", "sktr"),
"sctp" => array("sktp", "sctp"));
$par_type = self::_lookupType($parent_id);
if (!is_array($allowed[$par_type]) ||
!in_array($a_obj->getType(), $allowed[$par_type]))
{
return;
}
// determine target
if ($a_target_node_id != "")
{
$target = $a_target_node_id;
}
else
{
// determine last child that serves as predecessor
$childs = $skill_tree->getChilds($parent_id);
if (count($childs) == 0)
{
$target = IL_FIRST_NODE;
}
else
{
$target = $childs[count($childs) - 1]["obj_id"];
}
}
if ($skill_tree->isInTree($parent_id) && !$skill_tree->isInTree($a_obj->getId()))
{
$skill_tree->insertNode($a_obj->getId(), $parent_id, $target);
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilSkillTreeNode::read ( )

Read Data of Node.

Reimplemented in ilSkillTemplateReference, ilBasicSkill, ilSkillCategory, and ilSkillRoot.

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

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

Referenced by ilSkillTreeNode().

{
global $ilBench, $ilDB;
if(!isset($this->data_record))
{
$query = "SELECT * FROM skl_tree_node WHERE obj_id = ".
$ilDB->quote($this->id, "integer");
$obj_set = $ilDB->query($query);
$this->data_record = $ilDB->fetchAssoc($obj_set);
}
$this->setType($this->data_record["type"]);
$this->setTitle($this->data_record["title"]);
$this->setOrderNr($this->data_record["order_nr"]);
$this->setSelfEvaluation($this->data_record["self_eval"]);
$this->setDraft($this->data_record["draft"]);
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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

Save childs order.

Parameters
@return

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

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

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

{
include_once("./Services/Skill/classes/class.ilSkillTree.php");
$skill_tree = new ilSkillTree();
if ($a_par_id != $skill_tree->readRootId())
{
$childs = $skill_tree->getChilds($a_par_id);
}
else
{
if ($a_templates)
{
$childs = $skill_tree->getChildsByTypeFilter($a_par_id,
array("skrt", "sktp", "sctp"));
}
else
{
$childs = $skill_tree->getChildsByTypeFilter($a_par_id,
array("skrt", "skll", "scat", "sktr"));
}
}
foreach ($childs as $k => $c)
{
if (isset($a_childs_order[$c["child"]]))
{
$childs[$k]["order_nr"] = (int) $a_childs_order[$c["child"]];
}
}
$childs = ilUtil::sortArray($childs, "order_nr", "asc", true);
$cnt = 10;
foreach ($childs as $c)
{
ilSkillTreeNode::_writeOrderNr($c["child"], $cnt);
$cnt += 10;
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilSkillTreeNode::setDataRecord (   $a_record)

this method should only be called by class ilSCORM2004NodeFactory

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

{
$this->data_record = $a_record;
}
ilSkillTreeNode::setDraft (   $a_val)

Set draft.

Parameters
boolean$a_valdraft

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

Referenced by read().

{
$this->draft = $a_val;
}

+ Here is the caller graph for this function:

ilSkillTreeNode::setId (   $a_id)

Set Node ID.

Parameters
intNode ID

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

Referenced by create().

{
$this->id = $a_id;
}

+ Here is the caller graph for this function:

ilSkillTreeNode::setOrderNr (   $a_val)

Set order nr.

Parameters
int$a_valorder nr

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

Referenced by read().

{
$this->order_nr = $a_val;
}

+ Here is the caller graph for this function:

ilSkillTreeNode::setSelfEvaluation (   $a_val)

Set self evaluation.

Parameters
booleanself evaluation

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

Referenced by read().

{
$this->self_eval = $a_val;
}

+ Here is the caller graph for this function:

ilSkillTreeNode::setTitle (   $a_title)

Set title.

Parameters
string$a_titletitle

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

Referenced by read().

{
$this->title = $a_title;
}

+ Here is the caller graph for this function:

ilSkillTreeNode::setType (   $a_type)

Set type.

Parameters
stringType

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

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

{
$this->type = $a_type;
}

+ Here is the caller graph for this function:

static ilSkillTreeNode::uniqueTypesCheck (   $a_items)
static

Check for unique types.

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

References $type, and _lookupType().

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

{
$types = array();
if (is_array($a_items))
{
foreach($a_items as $item)
{
$types[$type] = $type;
}
}
if (count($types) > 1)
{
return false;
}
return true;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilSkillTreeNode::update ( )

Update Node.

Reimplemented in ilSkillTemplateReference.

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

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

{
global $ilDB;
$query = "UPDATE skl_tree_node SET ".
" title = ".$ilDB->quote($this->getTitle(), "text").
" ,self_eval = ".$ilDB->quote((int) $this->getSelfEvaluation(), "integer").
" ,order_nr = ".$ilDB->quote((int) $this->getOrderNr(), "integer").
" ,draft = ".$ilDB->quote((int) $this->getDraft(), "integer").
" WHERE obj_id = ".$ilDB->quote($this->getId(), "integer");
$ilDB->manipulate($query);
}

+ Here is the call graph for this function:

Field Documentation

ilSkillTreeNode::$id

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

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

ilSkillTreeNode::$title

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

Referenced by getTitle().

ilSkillTreeNode::$type

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

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


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