5 include_once(
"./Services/Form/classes/class.ilSelectInputGUI.php");
6 include_once(
"./Services/Taxonomy/exceptions/class.ilTaxonomyException.php");
24 function __construct($a_taxonomy_id, $a_multi =
true, $a_title =
"", $a_postvar =
"",
25 $a_include_please_select =
true)
29 $lng->loadLanguageModule(
"tax");
31 $this->include_please_select = $a_include_please_select;
35 $a_title = $lng->txt(
"tax_taxonomy");
40 $a_postvar =
"tax_node_assign";
46 if ((
int) $a_taxonomy_id == 0)
48 throw new ilTaxonomyExceptions(
"No taxonomy ID passed to ilTaxAssignInputGUI.");
61 $this->taxononmy_id = $a_val;
71 return $this->taxononmy_id;
81 throw new ilTaxonomyExceptions(
"setOptions: Not supported for ilTaxAssignInputGUI.");
93 if ($this->include_please_select)
95 $options = array(
"" => $lng->txt(
"please_select"));
98 include_once(
"./Services/Taxonomy/classes/class.ilTaxonomyTree.php");
101 $nodes = $tax_tree->getSubtree($tax_tree->getNodeData($tax_tree->readRootId()));
102 foreach ($nodes as
$n)
104 if ($n[
"type"] ==
"taxn")
106 $options[$n[
"child"]] = str_repeat(
" ", ($n[
"depth"] - 2) * 2).$n[
"title"];
119 function saveInput($a_component_id, $a_obj_id, $a_item_type, $a_item_id)
121 include_once(
"./Services/Taxonomy/classes/class.ilTaxNodeAssignment.php");
128 $post = array($post);
131 $current_ass = $tax_node_ass->getAssignmentsOfItem($a_item_id);
133 foreach ($current_ass as $ca)
135 if (!in_array($ca[
"node_id"], $post))
137 $tax_node_ass->deleteAssignment($ca[
"node_id"], $a_item_id);
141 $exising[] = $ca[
"node_id"];
145 foreach ($post as $p)
147 if (!in_array($p, $exising))
162 include_once(
"./Services/Taxonomy/classes/class.ilTaxNodeAssignment.php");
164 $ass = $tax_node_ass->getAssignmentsOfItem($a_item_id);
169 $nodes[] = $a[
"node_id"];