33 $this->db = $DIC->database();
53 $this->title = $a_title;
113 $this->order_nr = $a_val;
123 return $this->order_nr;
133 $this->taxonomy_id = $a_val;
143 return $this->taxonomy_id;
153 if (!isset($this->data_record)) {
154 $query =
"SELECT * FROM tax_node WHERE obj_id = " .
155 $ilDB->quote($this->
id,
"integer");
157 $this->data_record =
$ilDB->fetchAssoc($obj_set);
159 $this->
setType($this->data_record[
"type"]);
160 $this->
setTitle($this->data_record[
"title"]);
161 $this->
setOrderNr($this->data_record[
"order_nr"]);
173 die(
"ilTaxonomyNode->create: No taxonomy ID given");
178 $query =
"INSERT INTO tax_node (obj_id, title, type, create_date, order_nr, tax_id) " .
180 $ilDB->quote(
$id,
"integer") .
"," .
183 $ilDB->now() .
", " .
198 $query =
"UPDATE tax_node SET " .
201 " WHERE obj_id = " .
$ilDB->quote($this->
getId(),
"integer");
209 public function delete()
214 include_once(
"./Services/Taxonomy/classes/class.ilTaxNodeAssignment.php");
217 $query =
"DELETE FROM tax_node WHERE obj_id= " .
225 public function copy($a_tax_id = 0)
229 $taxn->setType($this->
getType());
231 if ($a_tax_id == 0) {
234 $taxn->setTaxonomyId($a_tax_id);
247 protected static function _lookup($a_obj_id, $a_field)
251 $ilDB = $DIC->database();
253 $query =
"SELECT $a_field FROM tax_node WHERE obj_id = " .
254 $ilDB->quote($a_obj_id,
"integer");
256 $obj_rec =
$ilDB->fetchAssoc($obj_set);
258 return $obj_rec[$a_field];
271 $ilDB = $DIC->database();
273 return self::_lookup($a_obj_id,
"title");
283 $a_target_node_id =
"",
286 include_once(
"./Services/Taxonomy/classes/class.ilTaxonomyTree.php");
290 $parent_id = ($a_parent_id !=
"")
292 : $tax_tree->readRootId();
295 if ($a_target_node_id !=
"") {
299 $childs = $tax_tree->getChilds($parent_id);
301 if (count($childs) == 0) {
304 $target = $childs[count($childs) - 1][
"obj_id"];
308 if ($tax_tree->isInTree($parent_id) && !$tax_tree->isInTree($a_node->getId())) {
309 $tax_tree->insertNode($a_node->getId(), $parent_id,
$target);
323 $ilDB = $DIC->database();
326 "UPDATE tax_node SET " .
327 " order_nr = " .
$ilDB->quote($a_order_nr,
"integer") .
328 " WHERE obj_id = " .
$ilDB->quote($a_node_id,
"integer")
342 $ilDB = $DIC->database();
345 "UPDATE tax_node SET " .
346 " title = " .
$ilDB->quote($a_title,
"text") .
347 " WHERE obj_id = " .
$ilDB->quote($a_node_id,
"integer")
356 include_once(
"./Services/Taxonomy/classes/class.ilTaxonomyTree.php");
358 if ($a_parent_id == 0) {
359 $a_parent_id = $tax_tree->readRootId();
361 $childs = $tax_tree->getChilds($a_parent_id);
364 foreach ($childs as
$c) {
365 if ($c[
"order_nr"] > $max) {
366 $max = $c[
"order_nr"] + 10;
381 include_once(
"./Services/Taxonomy/classes/class.ilTaxonomyTree.php");
383 if ($a_parent_id == 0) {
384 $a_parent_id = $tax_tree->readRootId();
386 $childs = $tax_tree->getChilds($a_parent_id);
390 foreach ($childs as
$c) {
391 self::writeOrderNr($c[
"child"], $cnt);
static sortArray( $array, $a_array_sortby, $a_array_sortorder=0, $a_numeric=false, $a_keep_keys=false)
sortArray
static getNextOrderNr($a_tax_id, $a_parent_id)
Put this node into the taxonomy tree.
static writeTitle($a_node_id, $a_title)
Write title.
setTitle($a_title)
Set title.
getTaxonomyId()
Get taxonomy id.
__construct($a_id=0)
Constructor public.
static _lookupTitle($a_obj_id)
Lookup Title.
setTaxonomyId($a_val)
Set taxonomy id.
static writeOrderNr($a_node_id, $a_order_nr)
Write order nr.
copy($a_tax_id=0)
Copy taxonomy node.
read()
Read data from database.
getOrderNr()
Get order nr.
setType($a_type)
Set type.
static _lookup($a_obj_id, $a_field)
Lookup.
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.
setOrderNr($a_val)
Set order nr.
create()
Create taxonomy node.
static deleteAllAssignmentsOfNode($a_node_id)
Delete assignments of node.
static fixOrderNumbers($a_tax_id, $a_parent_id)
Fix order numbers.