예제 #1
0
 /**
  * Create a new taxonomy
  */
 function doCreate()
 {
     global $ilDB;
     // create tax data record
     $ilDB->manipulate("INSERT INTO tax_data " . "(id, sorting_mode, item_sorting) VALUES (" . $ilDB->quote($this->getId(), "integer") . "," . $ilDB->quote((int) $this->getSortingMode(), "integer") . "," . $ilDB->quote((int) $this->getItemSorting(), "integer") . ")");
     // create the taxonomy tree
     include_once "./Services/Taxonomy/classes/class.ilTaxonomyNode.php";
     $node = new ilTaxonomyNode();
     $node->setType("");
     // empty type
     $node->setTitle("Root node for taxonomy " . $this->getId());
     $node->setTaxonomyId($this->getId());
     $node->create();
     include_once "./Services/Taxonomy/classes/class.ilTaxonomyTree.php";
     $tax_tree = new ilTaxonomyTree($this->getId());
     $tax_tree->addTree($this->getId(), $node->getId());
 }
 /**
  * Copy taxonomy node
  */
 function copy($a_tax_id = 0)
 {
     $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;
 }