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(),
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());
162 foreach ($subtree as $node_id) {
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);
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")
207 $lng = $DIC->language();
212 public static function saveUsage(
int $a_tax_id,
int $a_obj_id): void
216 $ilDB = $DIC->database();
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);
246 $ilDB = $DIC->database();
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
286 $ilDB = $DIC->database();
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...
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...
getNodeData(int $a_node_id, ?int $a_tree_pk=null)
get all information of a node.
setItemSorting(bool $a_val)
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 lookup(string $a_field, int $a_id)
doCreate(bool $clone_mode=false)
getSubTreeIds(int $a_ref_id)
Get all ids of subnodes.
static getUsageOfObject(int $a_obj_id, bool $a_include_titles=false)
deleteTree(array $a_node)
delete node and the whole subtree under this node
loadLanguageModule(string $a_module)
Load language module.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
setSortingMode(int $a_val)
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
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)
static lookupSortingMode(int $a_id)
static saveUsage(int $a_tax_id, int $a_obj_id)
static deleteUsagesOfTaxonomy(int $a_id)
__construct($a_id=0)
ilObjTaxonomy constructor.
cloneNodes(ilObjTaxonomy $a_new_obj, int $a_target_parent, int $a_source_parent)
__construct(Container $dic, ilPlugin $plugin)
setDescription(string $description)
doCloneObject(ilObject2 $new_obj, int $a_target_id, ?int $a_copy_id=null)
static loadLanguageModule()