40 $this->db =
$DIC->database();
52 $this->sorting_mode = $a_val;
62 $this->item_sorting = $a_val;
72 if ($this->
getId() > 0) {
84 protected function doCreate(
bool $clone_mode =
false): void
89 $ilDB->manipulate(
"INSERT INTO tax_data " .
90 "(id, sorting_mode, item_sorting) VALUES (" .
91 $ilDB->quote($this->getId(),
"integer") .
"," .
92 $ilDB->quote($this->getSortingMode(),
"integer") .
"," .
93 $ilDB->quote((
int) $this->getItemSorting(),
"integer") .
97 $node->setTitle(
"Root node for taxonomy " . $this->
getId());
98 $node->setTaxonomyId($this->
getId());
101 $tax_tree->addTree($this->
getId(), $node->getId());
111 $this->node_mapping = array();
115 $new_obj->getTree()->readRootId(),
116 $this->getTree()->readRootId()
123 int $a_target_parent,
127 $nodes = $this->
getTree()->getChilds($a_source_parent);
128 foreach ($nodes as $node) {
129 if ($node[
"type"] ===
"taxn") {
131 $new_node = $tax_node->copy($a_new_obj->
getId());
139 $this->node_mapping[$node[
"child"]] = $new_node->getId();
152 self::deleteUsagesOfTaxonomy($this->
getId());
155 $tree = $this->getTree();
156 $subtree = $tree->getSubTreeIds($tree->readRootId());
157 $subtree[] = $tree->readRootId();
161 $root_node_data = $tree->getNodeData($tree->readRootId());
162 foreach ($subtree as $node_id) {
169 $tree->deleteTree($root_node_data);
173 "DELETE FROM tax_data WHERE " .
174 " id = " .
$ilDB->quote($this->getId(),
"integer")
183 "SELECT * FROM tax_data " .
184 " WHERE id = " .
$ilDB->quote($this->getId(),
"integer")
186 $rec =
$ilDB->fetchAssoc($set);
187 $this->setSortingMode((
int) $rec[
"sorting_mode"]);
188 $this->setItemSorting((
bool) $rec[
"item_sorting"]);
196 $t =
"UPDATE tax_data SET " .
197 " sorting_mode = " .
$ilDB->quote($this->getSortingMode(),
"integer") .
", " .
198 " item_sorting = " .
$ilDB->quote((
int) $this->getItemSorting(),
"integer") .
199 " WHERE id = " .
$ilDB->quote($this->getId(),
"integer")
209 $lng->loadLanguageModule(
"tax");
212 public static function saveUsage(
int $a_tax_id,
int $a_obj_id): void
218 if ($a_tax_id > 0 && $a_obj_id > 0) {
221 array(
"tax_id" => array(
"integer", $a_tax_id),
222 "obj_id" => array(
"integer", $a_obj_id)
235 public static function getUsageOfObject(
int $a_obj_id,
bool $a_include_titles =
false): array
238 return $DIC->taxonomy()->internal()->domain()->usage()->getUsageOfObject($a_obj_id, $a_include_titles);
249 "DELETE FROM tax_usage WHERE " .
250 " tax_id = " .
$ilDB->quote($a_id,
"integer")
274 $sub_nodes[] = $a_node;
278 return $tn_ass->getAssignmentsOfNode($sub_nodes);
282 protected static function lookup(
string $a_field,
int $a_id): string
289 "SELECT " . $a_field .
" FROM tax_data " .
290 " WHERE id = " .
$ilDB->quote($a_id,
"integer")
292 $rec =
$ilDB->fetchAssoc($set);
294 return $rec[$a_field];
299 return (
int) self::lookup(
"sorting_mode", $a_id);
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static lookup(string $a_field, int $a_id)
setSortingMode(int $a_val)
static lookupSortingMode(int $a_id)
static getUsageOfObject(int $a_obj_id, bool $a_include_titles=false)
static deleteUsagesOfTaxonomy(int $a_id)
doCreate(bool $clone_mode=false)
static getSubTreeItems(string $a_comp, int $a_obj_id, string $a_item_type, int $a_tax_id, $a_node)
Get all assigned items under a node.
static saveUsage(int $a_tax_id, int $a_obj_id)
static loadLanguageModule()
__construct($a_id=0)
ilObjTaxonomy constructor.
doCloneObject(ilObject2 $new_obj, int $a_target_id, ?int $a_copy_id=null)
setItemSorting(bool $a_val)
cloneNodes(ilObjTaxonomy $a_new_obj, int $a_target_parent, int $a_source_parent)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
setDescription(string $description)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static putInTree(int $a_tax_id, ilTaxonomyNode $a_node, int $a_parent_id=0, int $a_target_node_id=0, int $a_order_nr=0)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
getSubTreeIds(int $a_ref_id)
Get all ids of subnodes.
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc