4 require_once
"./Services/Object/classes/class.ilObject2GUI.php";
5 require_once
"./Services/Taxonomy/classes/class.ilObjTaxonomy.php";
29 $ilCtrl->saveParameter($this,
"tax_node");
49 $this->assigned_object_id = $a_val;
59 return $this->assigned_object_id;
70 $next_class = $ilCtrl->getNextClass();
71 $cmd = $ilCtrl->getCmd();
111 if (count($tax_ids) == 0)
113 $ilToolbar->addButton($lng->txt(
"tax_add_taxonomy"),
114 $ilCtrl->getLinkTarget($this,
"createAssignedTaxonomy"));
154 $ilToolbar->setFormAction($ilCtrl->getFormAction($this));
155 $ilToolbar->addFormButton($lng->txt(
"tax_create_node"),
"createTaxNode");
158 $ilToolbar->addSeparator();
159 include_once(
"./Services/Form/classes/class.ilSelectInputGUI.php");
166 $si->setOptions($options);
167 $ilToolbar->addInputItem($si,
true);
169 $ilToolbar->addFormButton($lng->txt(
"save"),
"saveSettingsAndSorting");
171 $ilToolbar->addSeparator();
172 $ilToolbar->addFormButton($lng->txt(
"tax_delete_taxonomy"),
"confirmDeleteTaxonomy");
174 $ilToolbar->setCloseFormTag(
false);
181 include_once(
"./Services/Taxonomy/classes/class.ilTaxonomyTableGUI.php");
186 $tpl->setContent($table->getHTML());
230 $ilCtrl->redirect($this,
"editAOTaxonomySettings");
268 $ilCtrl->redirect($this,
"editAOTaxonomySettings");
279 require_once (
"./Services/Taxonomy/classes/class.ilTaxonomyExplorer.php");
281 $exp =
new ilTaxonomyExplorer($ilCtrl->getLinkTarget($this,
"listItems"), $a_tax_tree);
284 $exp->setExpandTarget($ilCtrl->getLinkTarget($this,
"listItems"));
286 if (
$_GET[
"txexpand"] ==
"")
288 $expanded = $a_tax_tree->readRootId();
292 $expanded =
$_GET[
"txexpand"];
295 if (
$_GET[
"tax_node"] > 0)
297 $path = $a_tax_tree->getPathId(
$_GET[
"tax_node"]);
298 $exp->setForceOpenPath(
$path);
299 $exp->highlightNode(
$_GET[
"tax_node"]);
303 $exp->highlightNode($a_tax_tree->readRootId());
305 $exp->setExpand($expanded);
308 $output = $exp->getOutput();
311 if ($ilCtrl->isAsynch())
316 $tpl->setLeftContent($output);
325 static function getTreeHTML($a_tax_id, $a_class, $a_cmd, $a_root_node_title =
"")
329 $lng->loadLanguageModule(
"tax");
331 include_once(
"./Services/Taxonomy/classes/class.ilTaxonomyTree.php");
332 require_once (
"./Services/Taxonomy/classes/class.ilTaxonomyExplorer.php");
335 $exp =
new ilTaxonomyExplorer($ilCtrl->getLinkTargetByClass($a_class, $a_cmd), $a_tax_tree,
339 if ($a_root_node_title !=
"")
341 $exp->setRootNodeTitle($a_root_node_title);
344 $exp->setExpandTarget($ilCtrl->getLinkTargetByClass($a_class, $a_cmd));
346 if (
$_GET[
"txexpand"] ==
"")
348 $expanded = $a_tax_tree->readRootId();
352 $expanded =
$_GET[
"txexpand"];
355 if (
$_GET[
"tax_node"] > 0)
357 $path = $a_tax_tree->getPathId(
$_GET[
"tax_node"]);
358 $exp->setForceOpenPath(
$path);
359 $exp->highlightNode(
$_GET[
"tax_node"]);
363 $exp->highlightNode($a_tax_tree->readRootId());
365 $exp->setExpand($expanded);
368 $output = $exp->getOutput();
385 $tpl->setContent($this->form->getHTML());
398 include_once(
"Services/Form/classes/class.ilPropertyFormGUI.php");
403 $this->form->addItem($ti);
409 $or =
new ilTextInputGUI($this->lng->txt(
"tax_order_nr"),
"order_nr");
412 $this->form->addItem($or);
415 if ($a_mode ==
"edit")
418 $ti->setValue($node->getTitle());
419 $or->setValue($node->getOrderNr());
423 if ($a_mode ==
"create")
425 $this->form->addCommandButton(
"saveTaxNode", $lng->txt(
"save"));
426 $this->form->addCommandButton(
"listItems", $lng->txt(
"cancel"));
427 $this->form->setTitle($lng->txt(
"tax_new_tax_node"));
431 $this->form->addCommandButton(
"updateTaxNode", $lng->txt(
"save"));
432 $this->form->addCommandButton(
"listItems", $lng->txt(
"cancel"));
433 $this->form->setTitle($lng->txt(
"tax_edit_tax_node"));
436 $this->form->setFormAction($ilCtrl->getFormAction($this));
449 if ($this->form->checkInput())
454 include_once(
"./Services/Taxonomy/classes/class.ilTaxonomyNode.php");
456 $node->setTitle($this->form->getInput(
"title"));
461 $order_nr = $this->form->getInput(
"order_nr");
463 if ($order_nr ===
"")
467 $node->setOrderNr($order_nr);
468 $node->setTaxonomyId($tax->getId());
477 $ilCtrl->redirect($this,
"listItems");
481 $this->form->setValuesByPost();
482 $tpl->setContent($this->form->getHtml());
495 if ($this->form->checkInput())
499 $node->setTitle($this->form->getInput(
"title"));
504 $node->setOrderNr($this->form->getInput(
"order_nr"));
510 $ilCtrl->redirect($this,
"");
514 $this->form->setValuesByPost();
515 $tpl->setContent($this->form->getHtml());
528 $this->ilias->raiseError($this->lng->txt(
"no_checkbox"),$this->ilias->error_obj->MESSAGE);
533 include_once(
"./Services/Utilities/classes/class.ilConfirmationGUI.php");
536 $confirmation_gui->setFormAction($ilCtrl->getFormAction($this));
537 $confirmation_gui->setHeaderText($this->lng->txt(
"info_delete_sure"));
540 include_once(
"./Services/Taxonomy/classes/class.ilTaxonomyNode.php");
541 foreach(
$_POST[
"id"] as $id)
543 $confirmation_gui->addItem(
"id[]", $id,
547 $confirmation_gui->setCancel($lng->txt(
"cancel"),
"listItems");
548 $confirmation_gui->setConfirm($lng->txt(
"confirm"),
"confirmedDelete");
550 $tpl->setContent($confirmation_gui->getHTML());
560 include_once(
"./Services/Taxonomy/classes/class.ilTaxonomyNode.php");
563 foreach (
$_POST[
"id"] as $id)
568 $node_data = $tax_tree->getNodeData($id);
569 if (is_object($node))
573 if($tax_tree->isInTree($id))
575 $tax_tree->deleteTree($node_data);
583 $ilCtrl->redirect($this,
"listItems");
602 include_once(
"./Services/Taxonomy/classes/class.ilTaxonomyNode.php");
603 if (is_array(
$_POST[
"order"]))
607 foreach (
$_POST[
"order"] as $k => $v)
615 if (is_array(
$_POST[
"title"]))
617 foreach (
$_POST[
"title"] as $k => $v)
626 $ilCtrl->redirect($this,
"listItems");
636 $ilToolbar->addButton($lng->txt(
"cancel"),
637 $ilCtrl->getLinkTarget($this,
"listItems"));
641 if (is_array(
$_POST[
"id"]))
643 $ilCtrl->setParameter($this,
"move_ids", implode(
$_POST[
"id"],
","));
647 require_once (
"./Services/Taxonomy/classes/class.ilTaxonomyExplorer.php");
651 "ilobjtaxonomygui",
"pasteItems");
653 $exp->setTargetGet(
"tax_node");
655 $exp->setExpandTarget($ilCtrl->getLinkTarget($this,
"pasteItems"));
659 $output = $exp->getOutput();
661 $tpl->setContent($output);
673 if (
$_GET[
"move_ids"] !=
"")
675 $move_ids = explode(
",",
$_GET[
"move_ids"]);
677 $tree = $tax->getTree();
679 include_once(
"./Services/Taxonomy/classes/class.ilTaxonomyNode.php");
681 foreach ($move_ids as $m_id)
685 if ($node->getTaxonomyId() == $tax->getId() &&
686 ($target_node->getTaxonomyId() == $tax->getId() ||
687 $target_node->getId() ==
$tree->readRootId()))
690 if(
$tree->isGrandChild((
int) $m_id, $target_node->getId()))
693 $this->ctrl->redirect($this,
"listItems");
700 $tree->moveTree((
int) $m_id, $target_node->getId());
709 $ilCtrl->redirect($this,
"listItems");
721 include_once(
"./Services/Utilities/classes/class.ilConfirmationGUI.php");
723 $cgui->setFormAction($ilCtrl->getFormAction($this));
724 $cgui->setHeaderText($lng->txt(
"tax_confirm_deletion"));
725 $cgui->setCancel($lng->txt(
"cancel"),
"listItems");
726 $cgui->setConfirm($lng->txt(
"delete"),
"deleteTaxonomy");
728 $cgui->addItem(
"id[]", $i, $tax->getTitle());
730 $tpl->setContent($cgui->getHTML());
747 $ilCtrl->redirect($this,
"editAOTaxonomySettings");