ILIAS  Release_4_4_x_branch Revision 61816
 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
 setStatus ($a_val)
 Set status.
 getStatus ()
 Get status.
 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.

Static Public Member Functions

static getAllStatus ()
 Get all status.
static getStatusInfo ($a_status)
 Get status info.
static _lookupTitle ($a_obj_id, $a_tref_id=0)
 Lookup Title.
static _lookupSelfEvaluation ($a_obj_id)
 Lookup self evaluation.
static _lookupStatus ($a_obj_id)
 Lookup Status.
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 saveChildsOrder ($a_par_id, $a_childs_order, $a_templates=false)
 Save childs order.
static getIconPath ($a_obj_id, $a_type, $a_size="", $a_status=0)
 Get icon path.

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.

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

References $query.

Referenced by _lookupSelfEvaluation(), _lookupStatus(), 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::_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 _lookup().

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

{
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::_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 _lookup().

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

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

+ Here is the call graph for this function:

+ 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 326 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 309 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 616 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 531 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 480 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 341 of file class.ilSkillTreeNode.php.

References $id, $query, getOrderNr(), getSelfEvaluation(), getStatus(), 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, status) ".
"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->getStatus(), "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 381 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 723 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:

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

{
global $lng;
return array(
self::STATUS_DRAFT => $lng->txt("skmg_status_draft"),
self::STATUS_PUBLISH => $lng->txt("skmg_status_publish"),
self::STATUS_OUTDATED => $lng->txt("skmg_status_outdated")
);
}

+ Here is the caller graph for this function:

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 $type, ilSkillTemplateReference\_lookupTemplateId(), _lookupType(), ilUtil\getImagePath(), ILIAS_VERSION, and STATUS_DRAFT.

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

{
if ($a_status == self::STATUS_DRAFT && $a_type == "sctp")
{
$a_type = "scat";
}
if ($a_status == self::STATUS_DRAFT && $a_type == "sktp")
{
$a_type = "skll";
}
$off = ($a_status == self::STATUS_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 94 of file class.ilSkillTreeNode.php.

References $id.

Referenced by ilBasicSkill\addLevel(), delete(), ilBasicSkill\getMaxLevelPerObject(), ilBasicSkill\getMaxLevelPerType(), 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 134 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 758 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 114 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:

ilSkillTreeNode::getStatus ( )

Get status.

Returns
int status

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

Referenced by create(), and update().

{
return $this->status;
}

+ Here is the caller graph for this function:

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

{
global $lng;
switch($a_status)
{
case self::STATUS_PUBLISH: return $lng->txt("skmg_status_publish_info");
case self::STATUS_DRAFT: return $lng->txt("skmg_status_draft_info");
case self::STATUS_OUTDATED: return $lng->txt("skmg_status_outdated_info");
}
return "";
}

+ Here is the caller graph for this function:

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

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

{
$tree = new ilSkillTree();
return $tree;
}
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().

{
return $this->type;
}

+ Here is the caller graph for this function:

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

Definition at line 27 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 571 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 707 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 633 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 393 of file class.ilSkillTreeNode.php.

References _lookupType(), and IL_FIRST_NODE.

Referenced by pasteTree(), ilBasicSkillGUI\saveItem(), ilSkillCategoryGUI\saveItem(), ilSkillTemplateCategoryGUI\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 177 of file class.ilSkillTreeNode.php.

References $ilBench, $query, setOrderNr(), setSelfEvaluation(), setStatus(), 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->setStatus($this->data_record["status"]);
}

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

{
$this->data_record = $a_record;
}
ilSkillTreeNode::setId (   $a_id)

Set Node ID.

Parameters
intNode ID

Definition at line 84 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 124 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 104 of file class.ilSkillTreeNode.php.

Referenced by read().

{
$this->self_eval = $a_val;
}

+ Here is the caller graph for this function:

ilSkillTreeNode::setStatus (   $a_val)

Set status.

Parameters
boolean$a_valstatus

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

Referenced by read().

{
$this->status = $a_val;
}

+ Here is the caller graph for this function:

ilSkillTreeNode::setTitle (   $a_title)

Set title.

Parameters
string$a_titletitle

Definition at line 44 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 64 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 458 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 364 of file class.ilSkillTreeNode.php.

References $query, getId(), getOrderNr(), getSelfEvaluation(), getStatus(), 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").
" ,status = ".$ilDB->quote((int) $this->getStatus(), "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 21 of file class.ilSkillTreeNode.php.

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

ilSkillTreeNode::$title

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

Referenced by getTitle().

ilSkillTreeNode::$type

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

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

const ilSkillTreeNode::STATUS_OUTDATED = 2
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: