4 require_once
"./Services/Object/classes/class.ilObject2GUI.php";
5 require_once
"./Services/Taxonomy/classes/class.ilObjTaxonomy.php";
6 include_once(
"./Services/Taxonomy/interfaces/interface.ilTaxAssignedItemInfo.php");
32 $ilCtrl->saveParameter($this,
"tax_node");
33 $ilCtrl->saveParameter($this,
"tax_id");
53 $this->assigned_object_id = $a_val;
63 return $this->assigned_object_id;
73 $this->multiple = $a_val;
93 $this->assigned_item_sorting =
true;
94 $this->assigned_item_info_obj = $a_item_info_obj;
95 $this->assigned_item_comp_id = $a_component_id;
96 $this->assigned_item_obj_id = $a_obj_id;
97 $this->assigned_item_type = $a_item_type;
108 $next_class = $ilCtrl->getNextClass();
113 $cmd = $ilCtrl->getCmd(
"listTaxonomies");
172 $tax_id = (int)
$_GET[
"tax_id"];
173 if (in_array($tax_id, $tax_ids))
215 $ilToolbar->setFormAction($ilCtrl->getFormAction($this));
216 $ilToolbar->addFormButton($lng->txt(
"tax_create_node"),
"createTaxNode");
218 $ilToolbar->setCloseFormTag(
false);
225 include_once(
"./Services/Taxonomy/classes/class.ilTaxonomyTableGUI.php");
230 $tpl->setContent($table->getHTML());
274 $ilCtrl->redirect($this,
"listTaxonomies");
312 $ilCtrl->setParameter($this,
"tax_id", $a_new_object->
getId());
314 $ilCtrl->redirect($this,
"editSettings");
327 include_once(
"./Services/Taxonomy/classes/class.ilTaxonomyExplorerGUI.php");
329 ?
"listAssignedItems"
332 "ilobjtaxonomygui",
$cmd);
333 if (!$tax_exp->handleCommand())
336 $tpl->setLeftContent($tax_exp->getHTML().
" ");
348 $a_target_class, $a_target_cmd, $a_root_node_title =
"")
350 die(
"ilObjTaxonomyGUI::getTreeHTML is deprecated.");
351 include_once(
"./Services/Taxonomy/classes/class.ilTaxonomyExplorerGUI.php");
353 $a_target_class, $a_target_cmd);
354 if (!$tax_exp->handleCommand())
356 return $tax_exp->getHTML().
" ";
370 global
$tpl, $ilHelp;
373 $ilHelp->setSubScreenId(
"create_node");
376 $tpl->setContent($this->form->getHTML());
389 include_once(
"Services/Form/classes/class.ilPropertyFormGUI.php");
394 $this->form->addItem($ti);
400 $or =
new ilTextInputGUI($this->lng->txt(
"tax_order_nr"),
"order_nr");
403 $this->form->addItem($or);
406 if ($a_mode ==
"edit")
409 $ti->setValue($node->getTitle());
410 $or->setValue($node->getOrderNr());
414 if ($a_mode ==
"create")
416 $this->form->addCommandButton(
"saveTaxNode", $lng->txt(
"save"));
417 $this->form->addCommandButton(
"listNodes", $lng->txt(
"cancel"));
418 $this->form->setTitle($lng->txt(
"tax_new_tax_node"));
422 $this->form->addCommandButton(
"updateTaxNode", $lng->txt(
"save"));
423 $this->form->addCommandButton(
"listNodes", $lng->txt(
"cancel"));
424 $this->form->setTitle($lng->txt(
"tax_edit_tax_node"));
427 $this->form->setFormAction($ilCtrl->getFormAction($this));
440 if ($this->form->checkInput())
445 include_once(
"./Services/Taxonomy/classes/class.ilTaxonomyNode.php");
447 $node->setTitle($this->form->getInput(
"title"));
452 $order_nr = $this->form->getInput(
"order_nr");
454 if ($order_nr ===
"")
459 $node->setOrderNr($order_nr);
460 $node->setTaxonomyId($tax->getId());
469 $ilCtrl->redirect($this,
"listNodes");
473 $this->form->setValuesByPost();
474 $tpl->setContent($this->form->getHtml());
487 if ($this->form->checkInput())
491 $node->setTitle($this->form->getInput(
"title"));
496 $node->setOrderNr($this->form->getInput(
"order_nr"));
502 $ilCtrl->redirect($this,
"");
506 $this->form->setValuesByPost();
507 $tpl->setContent($this->form->getHtml());
520 $this->ilias->raiseError($this->lng->txt(
"no_checkbox"),$this->ilias->error_obj->MESSAGE);
524 $ilHelp->setSubScreenId(
"del_items");
528 include_once(
"./Services/Utilities/classes/class.ilConfirmationGUI.php");
531 $confirmation_gui->setFormAction($ilCtrl->getFormAction($this));
532 $confirmation_gui->setHeaderText($this->lng->txt(
"info_delete_sure"));
535 include_once(
"./Services/Taxonomy/classes/class.ilTaxonomyNode.php");
536 foreach(
$_POST[
"id"] as $id)
538 $confirmation_gui->addItem(
"id[]", $id,
542 $confirmation_gui->setCancel($lng->txt(
"cancel"),
"listNodes");
543 $confirmation_gui->setConfirm($lng->txt(
"confirm"),
"confirmedDelete");
545 $tpl->setContent($confirmation_gui->getHTML());
555 include_once(
"./Services/Taxonomy/classes/class.ilTaxonomyNode.php");
558 foreach (
$_POST[
"id"] as $id)
563 $node_data = $tax_tree->getNodeData($id);
564 if (is_object($node))
568 if($tax_tree->isInTree($id))
570 $tax_tree->deleteTree($node_data);
578 $ilCtrl->redirect($this,
"listNodes");
592 include_once(
"./Services/Taxonomy/classes/class.ilTaxonomyNode.php");
593 if (is_array(
$_POST[
"order"]))
597 foreach (
$_POST[
"order"] as $k => $v)
606 if (is_array(
$_POST[
"title"]))
608 foreach (
$_POST[
"title"] as $k => $v)
617 $ilCtrl->redirect($this,
"listNodes");
628 $ilHelp->setSubScreenId(
"move_items");
630 $ilToolbar->addButton($lng->txt(
"cancel"),
631 $ilCtrl->getLinkTarget($this,
"listNodes"));
635 if (is_array(
$_POST[
"id"]))
637 $ilCtrl->setParameter($this,
"move_ids", implode(
$_POST[
"id"],
","));
641 include_once(
"./Services/Taxonomy/classes/class.ilTaxonomyExplorerGUI.php");
643 "ilobjtaxonomygui",
"pasteItems");
644 if (!$tax_exp->handleCommand())
647 $tpl->setContent($tax_exp->getHTML().
" ");
660 if (
$_GET[
"move_ids"] !=
"")
662 $move_ids = explode(
",",
$_GET[
"move_ids"]);
664 $tree = $tax->getTree();
666 include_once(
"./Services/Taxonomy/classes/class.ilTaxonomyNode.php");
668 foreach ($move_ids as $m_id)
672 if ($node->getTaxonomyId() == $tax->getId() &&
673 ($target_node->getTaxonomyId() == $tax->getId() ||
674 $target_node->getId() ==
$tree->readRootId()))
677 if(
$tree->isGrandChild((
int) $m_id, $target_node->getId()))
680 $this->ctrl->redirect($this,
"listNodes");
687 $tree->moveTree((
int) $m_id, $target_node->getId());
696 $ilCtrl->redirect($this,
"listNodes");
708 include_once(
"./Services/Utilities/classes/class.ilConfirmationGUI.php");
710 $cgui->setFormAction($ilCtrl->getFormAction($this));
711 $cgui->setHeaderText($lng->txt(
"tax_confirm_deletion"));
712 $cgui->setCancel($lng->txt(
"cancel"),
"listTaxonomies");
713 $cgui->setConfirm($lng->txt(
"delete"),
"deleteTaxonomy");
715 $cgui->addItem(
"id[]", $i, $tax->getTitle());
717 $tpl->setContent($cgui->getHTML());
734 $ilCtrl->redirect($this,
"listTaxonomies");
750 $ilToolbar->addButton($lng->txt(
"tax_add_taxonomy"),
751 $ilCtrl->getLinkTarget($this,
"createAssignedTaxonomy"));
758 include_once(
"./Services/Taxonomy/classes/class.ilTaxonomyListTableGUI.php");
762 $tpl->setContent(
$tab->getHTML());
774 $ilTabs->clearTargets();
776 $ilHelp->setScreenIdComponent(
"tax");
781 $ilTabs->setBackTarget($lng->txt(
"back"),
782 $ilCtrl->getLinkTarget($this,
"listTaxonomies"));
784 $ilTabs->addTab(
"list_items", $lng->txt(
"tax_nodes"),
785 $ilCtrl->getLinkTarget($this,
"listNodes"));
786 if ($this->assigned_item_sorting)
788 $ilTabs->addTab(
"ass_items", $lng->txt(
"tax_assigned_items"),
789 $ilCtrl->getLinkTarget($this,
"listAssignedItems"));
791 $ilTabs->addTab(
"settings", $lng->txt(
"settings"),
792 $ilCtrl->getLinkTarget($this,
"editSettings"));
794 $ilTabs->activateTab($a_id);
810 $tpl->setContent($form->getHTML());
822 include_once(
"Services/Form/classes/class.ilPropertyFormGUI.php");
829 $ti->setValue($tax->getTitle());
836 $ta->
setValue($tax->getDescription());
846 $si->setValue($tax->getSortingMode());
849 if ($this->assigned_item_sorting)
856 $form->addCommandButton(
"updateSettings", $lng->txt(
"save"));
858 $form->setTitle($lng->txt(
"settings"));
859 $form->setFormAction($ilCtrl->getFormAction($this));
872 if ($form->checkInput())
875 $tax->setTitle($form->getInput(
"title"));
876 $tax->setDescription($form->getInput(
"description"));
877 $tax->setSortingMode($form->getInput(
"sorting"));
878 $tax->setItemSorting($form->getInput(
"item_sorting"));
882 $ilCtrl->redirect($this,
"editSettings");
886 $form->setValuesByPost();
887 $tpl->setContent($form->getHtml());
909 include_once(
"./Services/Taxonomy/classes/class.ilTaxAssignedItemsTableGUI.php");
912 $this->assigned_item_obj_id, $this->assigned_item_type, $this->assigned_item_info_obj);
914 $tpl->setContent($table->getHTML());
927 include_once(
"./Services/Taxonomy/classes/class.ilTaxNodeAssignment.php");
928 if (is_array(
$_POST[
"order"]))
933 $tax_node = (int)
$_GET[
"tax_node"];
934 foreach ($order as $a_item_id => $ord_nr)
937 $this->assigned_item_obj_id,
939 $tax_ass->setOrderNr($tax_node, $a_item_id, $ord_nr);
943 $this->assigned_item_obj_id,
945 $tax_ass->fixOrderNr($tax_node);
948 $ilCtrl->redirect($this,
"listAssignedItems");