ILIAS  Release_5_0_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
ilTaxonomyNode Class Reference

Taxonomy node. More...

+ Collaboration diagram for ilTaxonomyNode:

Public Member Functions

 __construct ($a_id=0)
 Constructor public.
 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.
 setOrderNr ($a_val)
 Set order nr.
 getOrderNr ()
 Get order nr.
 setTaxonomyId ($a_val)
 Set taxonomy id.
 getTaxonomyId ()
 Get taxonomy id.
 read ()
 Read data from database.
 create ()
 Create taxonomy node.
 update ()
 Update Node.
 delete ()
 Delete taxonomy node.
 copy ($a_tax_id=0)
 Copy taxonomy node.

Static Public Member Functions

static _lookupTitle ($a_obj_id)
 Lookup Title.
static putInTree ($a_tax_id, $a_node, $a_parent_id="", $a_target_node_id="", $a_order_nr=0)
 Put this node into the taxonomy tree.
static writeOrderNr ($a_node_id, $a_order_nr)
 Write order nr.
static writeTitle ($a_node_id, $a_title)
 Write title.
static getNextOrderNr ($a_tax_id, $a_parent_id)
 Put this node into the taxonomy tree.
static fixOrderNumbers ($a_tax_id, $a_parent_id)
 Fix order numbers.

Data Fields

 $type
 $id
 $title

Static Protected Member Functions

static _lookup ($a_obj_id, $a_field)
 Lookup.

Detailed Description

Taxonomy node.

Author
Alex Killing alex..nosp@m.kill.nosp@m.ing@g.nosp@m.mx.d.nosp@m.e
Version
$Id$

Definition at line 14 of file class.ilTaxonomyNode.php.

Constructor & Destructor Documentation

ilTaxonomyNode::__construct (   $a_id = 0)

Constructor public.

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

References read(), and setType().

{
$this->id = $a_id;
// include_once("./Services/Taxonomy/classes/class.ilTaxonomyTree.php");
// $this->taxonomy_tree = new ilTaxonomyTree();
if($a_id != 0)
{
$this->read();
}
$this->setType("taxn");
}

+ Here is the call graph for this function:

Member Function Documentation

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

Lookup.

Parameters
intNode ID

Definition at line 246 of file class.ilTaxonomyNode.php.

References $ilDB, and $query.

Referenced by _lookupTitle().

{
global $ilDB;
$query = "SELECT $a_field FROM tax_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 ilTaxonomyNode::_lookupTitle (   $a_obj_id)
static

Lookup Title.

Parameters
intnode ID
Returns
string title

Definition at line 264 of file class.ilTaxonomyNode.php.

References $ilDB, and _lookup().

Referenced by ilObjTaxonomyGUI\deleteItems(), and ilTaxSelectInputGUI\getTitleForNodeId().

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

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilTaxonomyNode::copy (   $a_tax_id = 0)

Copy taxonomy node.

Definition at line 221 of file class.ilTaxonomyNode.php.

References getOrderNr(), getTaxonomyId(), getTitle(), and getType().

{
$taxn = new ilTaxonomyNode();
$taxn->setTitle($this->getTitle());
$taxn->setType($this->getType());
$taxn->setOrderNr($this->getOrderNr());
if ($a_tax_id == 0)
{
$taxn->setTaxonomyId($this->getTaxonomyId());
}
else
{
$taxn->setTaxonomyId($a_tax_id);
}
$taxn->create();
return $taxn;
}

+ Here is the call graph for this function:

ilTaxonomyNode::create ( )

Create taxonomy node.

Definition at line 162 of file class.ilTaxonomyNode.php.

References $id, $ilDB, $query, getOrderNr(), getTaxonomyId(), getTitle(), getType(), and setId().

{
global $ilDB;
if ($this->getTaxonomyId() <= 0)
{
die("ilTaxonomyNode->create: No taxonomy ID given");
}
// insert object data
$id = $ilDB->nextId("tax_node");
$query = "INSERT INTO tax_node (obj_id, title, type, create_date, order_nr, tax_id) ".
"VALUES (".
$ilDB->quote($id, "integer").",".
$ilDB->quote($this->getTitle(), "text").",".
$ilDB->quote($this->getType(), "text").", ".
$ilDB->now().", ".
$ilDB->quote((int) $this->getOrderNr(), "integer").", ".
$ilDB->quote((int) $this->getTaxonomyId(), "integer").
")";
$ilDB->manipulate($query);
$this->setId($id);
}

+ Here is the call graph for this function:

ilTaxonomyNode::delete ( )

Delete taxonomy node.

Definition at line 205 of file class.ilTaxonomyNode.php.

References $ilDB, $query, ilTaxNodeAssignment\deleteAllAssignmentsOfNode(), and getId().

{
global $ilDB;
// delete all assignments of the node
include_once("./Services/Taxonomy/classes/class.ilTaxNodeAssignment.php");
$query = "DELETE FROM tax_node WHERE obj_id= ".
$ilDB->quote($this->getId(), "integer");
$ilDB->manipulate($query);
}

+ Here is the call graph for this function:

static ilTaxonomyNode::fixOrderNumbers (   $a_tax_id,
  $a_parent_id 
)
static

Fix order numbers.

Parameters
@return

Definition at line 374 of file class.ilTaxonomyNode.php.

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

Referenced by ilObjTaxonomyGUI\confirmedDelete(), ilObjTaxonomyGUI\pasteItems(), ilObjTaxonomyGUI\saveSorting(), and ilObjTaxonomyGUI\saveTaxNode().

{
include_once("./Services/Taxonomy/classes/class.ilTaxonomyTree.php");
$tax_tree = new ilTaxonomyTree($a_tax_id);
if ($a_parent_id == 0)
{
$a_parent_id = $tax_tree->readRootId();
}
$childs = $tax_tree->getChilds($a_parent_id);
$childs = ilUtil::sortArray($childs, "order_nr", "asc", true);
$cnt = 10;
foreach ($childs as $c)
{
self::writeOrderNr($c["child"], $cnt);
$cnt += 10;
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilTaxonomyNode::getId ( )

Get Node ID.

Parameters
intNode ID

Definition at line 94 of file class.ilTaxonomyNode.php.

References $id.

Referenced by delete(), and update().

{
return $this->id;
}

+ Here is the caller graph for this function:

static ilTaxonomyNode::getNextOrderNr (   $a_tax_id,
  $a_parent_id 
)
static

Put this node into the taxonomy tree.

Definition at line 346 of file class.ilTaxonomyNode.php.

Referenced by ilObjTaxonomyGUI\saveTaxNode().

{
include_once("./Services/Taxonomy/classes/class.ilTaxonomyTree.php");
$tax_tree = new ilTaxonomyTree($a_tax_id);
if ($a_parent_id == 0)
{
$a_parent_id = $tax_tree->readRootId();
}
$childs = $tax_tree->getChilds($a_parent_id);
$max = 0;
foreach ($childs as $c)
{
if ($c["order_nr"] > $max)
{
$max = $c["order_nr"] + 10;
}
}
return $max;
}

+ Here is the caller graph for this function:

ilTaxonomyNode::getOrderNr ( )

Get order nr.

Returns
int order nr

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

Referenced by copy(), create(), and update().

{
return $this->order_nr;
}

+ Here is the caller graph for this function:

ilTaxonomyNode::getTaxonomyId ( )

Get taxonomy id.

Returns
int taxonomy id

Definition at line 134 of file class.ilTaxonomyNode.php.

Referenced by copy(), and create().

{
return $this->taxonomy_id;
}

+ Here is the caller graph for this function:

ilTaxonomyNode::getTitle ( )

Get title.

Returns
string title

Definition at line 54 of file class.ilTaxonomyNode.php.

References $title.

Referenced by copy(), create(), and update().

{
return $this->title;
}

+ Here is the caller graph for this function:

ilTaxonomyNode::getType ( )

Get type.

Returns
string Type

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

References $type.

Referenced by copy(), and create().

{
return $this->type;
}

+ Here is the caller graph for this function:

static ilTaxonomyNode::putInTree (   $a_tax_id,
  $a_node,
  $a_parent_id = "",
  $a_target_node_id = "",
  $a_order_nr = 0 
)
static

Put this node into the taxonomy tree.

Definition at line 274 of file class.ilTaxonomyNode.php.

References IL_FIRST_NODE.

Referenced by ilTaxonomyDataSet\importRecord(), and ilObjTaxonomyGUI\saveTaxNode().

{
include_once("./Services/Taxonomy/classes/class.ilTaxonomyTree.php");
$tax_tree = new ilTaxonomyTree($a_tax_id);
// determine parent
$parent_id = ($a_parent_id != "")
? $a_parent_id
: $tax_tree->readRootId();
// determine target
if ($a_target_node_id != "")
{
$target = $a_target_node_id;
}
else
{
// determine last child that serves as predecessor
$childs = $tax_tree->getChilds($parent_id);
if (count($childs) == 0)
{
$target = IL_FIRST_NODE;
}
else
{
$target = $childs[count($childs) - 1]["obj_id"];
}
}
if ($tax_tree->isInTree($parent_id) && !$tax_tree->isInTree($a_node->getId()))
{
$tax_tree->insertNode($a_node->getId(), $parent_id, $target);
}
}

+ Here is the caller graph for this function:

ilTaxonomyNode::read ( )

Read data from database.

Definition at line 142 of file class.ilTaxonomyNode.php.

References $ilDB, $query, setOrderNr(), setTaxonomyId(), setTitle(), and setType().

Referenced by __construct().

{
global $ilDB;
if(!isset($this->data_record))
{
$query = "SELECT * FROM tax_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->setTaxonomyId($this->data_record["tax_id"]);
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilTaxonomyNode::setId (   $a_id)

Set Node ID.

Parameters
intNode ID

Definition at line 84 of file class.ilTaxonomyNode.php.

Referenced by create().

{
$this->id = $a_id;
}

+ Here is the caller graph for this function:

ilTaxonomyNode::setOrderNr (   $a_val)

Set order nr.

Parameters
int$a_valorder nr

Definition at line 104 of file class.ilTaxonomyNode.php.

Referenced by read().

{
$this->order_nr = $a_val;
}

+ Here is the caller graph for this function:

ilTaxonomyNode::setTaxonomyId (   $a_val)

Set taxonomy id.

Parameters
int$a_valtaxonomy id

Definition at line 124 of file class.ilTaxonomyNode.php.

Referenced by read().

{
$this->taxonomy_id = $a_val;
}

+ Here is the caller graph for this function:

ilTaxonomyNode::setTitle (   $a_title)

Set title.

Parameters
string$a_titletitle

Definition at line 44 of file class.ilTaxonomyNode.php.

Referenced by read().

{
$this->title = $a_title;
}

+ Here is the caller graph for this function:

ilTaxonomyNode::setType (   $a_type)

Set type.

Parameters
stringType

Definition at line 64 of file class.ilTaxonomyNode.php.

Referenced by __construct(), and read().

{
$this->type = $a_type;
}

+ Here is the caller graph for this function:

ilTaxonomyNode::update ( )

Update Node.

Definition at line 190 of file class.ilTaxonomyNode.php.

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

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

+ Here is the call graph for this function:

static ilTaxonomyNode::writeOrderNr (   $a_node_id,
  $a_order_nr 
)
static

Write order nr.

Parameters
@return

Definition at line 317 of file class.ilTaxonomyNode.php.

References $ilDB.

Referenced by fixOrderNumbers(), and ilObjTaxonomyGUI\saveSorting().

{
global $ilDB;
$ilDB->manipulate("UPDATE tax_node SET ".
" order_nr = ".$ilDB->quote($a_order_nr, "integer").
" WHERE obj_id = ".$ilDB->quote($a_node_id, "integer")
);
}

+ Here is the caller graph for this function:

static ilTaxonomyNode::writeTitle (   $a_node_id,
  $a_title 
)
static

Write title.

Parameters
@return

Definition at line 333 of file class.ilTaxonomyNode.php.

References $ilDB.

Referenced by ilObjTaxonomyGUI\saveSorting().

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

+ Here is the caller graph for this function:

Field Documentation

ilTaxonomyNode::$id

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

Referenced by create(), and getId().

ilTaxonomyNode::$title

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

Referenced by getTitle().

ilTaxonomyNode::$type

Definition at line 16 of file class.ilTaxonomyNode.php.

Referenced by getType().


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