5 include_once(
"./Services/Taxonomy/exceptions/class.ilTaxonomyException.php");
26 function __construct($a_component_id, $a_item_type, $a_tax_id)
28 if ($a_component_id ==
"")
33 if ($a_item_type ==
"")
38 if ((
int) $a_tax_id == 0)
55 $this->component_id = $a_val;
65 return $this->component_id;
75 $this->item_type = $a_val;
85 return $this->item_type;
95 $this->taxonomy_id = $a_val;
105 return $this->taxonomy_id;
118 if (is_array($a_node_id))
120 $set = $ilDB->query(
"SELECT * FROM tax_node_assignment ".
121 " WHERE ".$ilDB->in(
"node_id", $a_node_id,
false,
"integer")
126 $set = $ilDB->query(
"SELECT * FROM tax_node_assignment ".
127 " WHERE node_id = ".$ilDB->quote($a_node_id,
"integer")
131 while ($rec = $ilDB->fetchAssoc($set))
149 $set = $ilDB->query(
"SELECT * FROM tax_node_assignment ".
150 " WHERE component = ".$ilDB->quote($this->getComponentId(),
"text").
151 " AND item_type = ".$ilDB->quote($this->getItemType(),
"text").
152 " AND item_id = ".$ilDB->quote($a_item_id,
"integer")
155 while ($rec = $ilDB->fetchAssoc($set))
173 if ((
int) $a_node_id == 0 || (
int) $a_item_id == 0)
179 $set = $ilDB->query(
"SELECT tax_tree_id FROM tax_tree ".
180 " WHERE child = ".$ilDB->quote($a_node_id,
"integer")
182 $rec = $ilDB->fetchAssoc($set);
185 throw new ilTaxonomyException(
'addAssignment: Node ID does not belong to current taxonomy.');
188 $ilDB->replace(
"tax_node_assignment",
190 "node_id" => array(
"integer", $a_node_id),
192 "item_type" => array(
"text", $this->
getItemType()),
193 "item_id" => array(
"integer", $a_item_id)
208 $ilDB->manipulate(
"DELETE FROM tax_node_assignment WHERE ".
209 " component = ".$ilDB->quote($this->getComponentId(),
"text").
210 " AND item_type = ".$ilDB->quote($this->getItemType(),
"text").
211 " AND item_id = ".$ilDB->quote($a_item_id,
"integer")
224 $ilDB->manipulate(
"DELETE FROM tax_node_assignment WHERE ".
225 " node_id = ".$ilDB->quote($a_node_id,
"integer"));