5require_once 
"./Services/Object/classes/class.ilObject2.php";
 
   30        $this->db = 
$DIC->database();
 
   32        parent::__construct($a_id, 
false);
 
   53        $this->sorting_mode = $a_val;
 
   63        return $this->sorting_mode;
 
   73        $this->item_sorting = $a_val;
 
   94        if ($this->
getId() > 0) {
 
   95            include_once(
"./Services/Taxonomy/classes/class.ilTaxonomyTree.php");
 
  122        $ilDB->manipulate(
"INSERT INTO tax_data " .
 
  123            "(id, sorting_mode, item_sorting) VALUES (" .
 
  124            $ilDB->quote($this->getId(), 
"integer") . 
"," .
 
  125            $ilDB->quote((
int) $this->getSortingMode(), 
"integer") . 
"," .
 
  126            $ilDB->quote((
int) $this->getItemSorting(), 
"integer") .
 
  130        include_once(
"./Services/Taxonomy/classes/class.ilTaxonomyNode.php");
 
  133        $node->setTitle(
"Root node for taxonomy " . $this->
getId());
 
  134        $node->setTaxonomyId($this->
getId());
 
  136        include_once(
"./Services/Taxonomy/classes/class.ilTaxonomyTree.php");
 
  138        $tax_tree->addTree($this->
getId(), $node->getId());
 
  149        $a_new_obj->setTitle($this->
getTitle());
 
  153        $this->node_mapping = array();
 
  157            $a_new_obj->getTree()->readRootId(),
 
  158            $this->getTree()->readRootId()
 
  168    public function cloneNodes($a_new_obj, $a_target_parent, $a_source_parent)
 
  170        include_once(
"./Services/Taxonomy/classes/class.ilTaxonomyNode.php");
 
  173        $nodes = $this->
getTree()->getChilds($a_source_parent);
 
  174        foreach ($nodes as $node) {
 
  175            switch ($node[
"type"]) {
 
  178                    $new_node = $tax_node->copy($a_new_obj->getId());
 
  188            $this->node_mapping[$node[
"child"]] = $new_node->getId();
 
  191            $this->
cloneNodes($a_new_obj, $new_node->getId(), $node[
"child"]);
 
  208        $subtree = 
$tree->getSubTreeIds(
$tree->readRootId());
 
  209        $subtree[] = 
$tree->readRootId();
 
  213        $root_node_data = 
$tree->getNodeData(
$tree->readRootId());
 
  216        include_once(
"./Services/Taxonomy/classes/class.ilTaxonomyNode.php");
 
  217        foreach ($subtree as $node_id) {
 
  224        $tree->deleteTree($root_node_data);
 
  228            "DELETE FROM tax_data WHERE " .
 
  229            " id = " . 
$ilDB->quote($this->getId(), 
"integer")
 
  242            "SELECT * FROM tax_data " .
 
  243            " WHERE id = " . 
$ilDB->quote($this->getId(), 
"integer")
 
  245        $rec  = 
$ilDB->fetchAssoc($set);
 
  258            $t = 
"UPDATE tax_data SET " .
 
  259            " sorting_mode = " . 
$ilDB->quote((
int) $this->getSortingMode(), 
"integer") . 
", " .
 
  260            " item_sorting = " . 
$ilDB->quote((
int) $this->getItemSorting(), 
"integer") .
 
  261            " WHERE id = " . 
$ilDB->quote($this->getId(), 
"integer")
 
  277        $lng->loadLanguageModule(
"tax");
 
  293        if ($a_tax_id > 0 &&  $a_obj_id > 0) {
 
  296                array(
"tax_id" => array(
"integer", $a_tax_id),
 
  297                    "obj_id" => array(
"integer", $a_obj_id)
 
  317            "SELECT tax_id FROM tax_usage " .
 
  318            " WHERE obj_id = " . 
$ilDB->quote($a_obj_id, 
"integer")
 
  321        while ($rec = 
$ilDB->fetchAssoc($set)) {
 
  322            if (!$a_include_titles) {
 
  323                $tax[] = $rec[
"tax_id"];
 
  325                $tax[] = array(
"tax_id" => $rec[
"tax_id"],
 
  346            "DELETE FROM tax_usage WHERE " .
 
  347            " tax_id = " . 
$ilDB->quote($a_id, 
"integer")
 
  358    public static function getSubTreeItems($a_comp, $a_obj_id, $a_item_type, $a_tax_id, $a_node)
 
  360        include_once(
"./Services/Taxonomy/classes/class.ilTaxonomyTree.php");
 
  363        $sub_nodes = 
$tree->getSubTreeIds($a_node);
 
  364        $sub_nodes[] = $a_node;
 
  365        include_once(
"./Services/Taxonomy/classes/class.ilTaxNodeAssignment.php");
 
  368        $items = $tn_ass->getAssignmentsOfNode($sub_nodes);
 
  379    protected static function lookup($a_field, $a_id)
 
  386            "SELECT " . $a_field . 
" FROM tax_data " .
 
  387            " WHERE id = " . 
$ilDB->quote($a_id, 
"integer")
 
  389        $rec = 
$ilDB->fetchAssoc($set);
 
  391        return $rec[$a_field];
 
An exception for terminatinating execution or to throw for unit testing.
static getUsageOfObject($a_obj_id, $a_include_titles=false)
Get usage of object.
static deleteUsagesOfTaxonomy($a_id)
Delete all usages of a taxonomy.
cloneNodes($a_new_obj, $a_target_parent, $a_source_parent)
Clone nodes.
static lookupSortingMode($a_id)
Lookup sorting mode.
doCreate()
Create a new taxonomy.
getSortingMode()
Get sorting mode.
getNodeMapping()
Get node mapping (used after cloning)
setItemSorting($a_val)
Set item sorting.
getItemSorting()
Get item sorting.
static lookup($a_field, $a_id)
Lookup.
doCloneObject($a_new_obj, $a_target_id, $a_copy_id=null)
clone taxonomy sheet (note: taxonomies have no ref ids and return an object id)
doUpdate()
Upate taxonomy properties.
static getSubTreeItems($a_comp, $a_obj_id, $a_item_type, $a_tax_id, $a_node)
Get all assigned items under a node.
doDelete()
Delete taxonomy object.
doRead()
Read taxonomy properties.
static saveUsage($a_tax_id, $a_obj_id)
Save Usage.
static loadLanguageModule()
Load language module.
__construct($a_id=0)
Constructor.
setSortingMode($a_val)
Set sorting mode.
Class ilObject2 This is an intermediate progress of ilObject class.
getDescription()
get object description
getId()
get object id @access public
getTitle()
get object title @access public
static _lookupTitle($a_id)
lookup object title
Taxonomy node <-> item assignment.
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.