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");
35 $lng->loadLanguageModule(
"tax");
55 $this->assigned_object_id = $a_val;
65 return $this->assigned_object_id;
75 $this->multiple = $a_val;
95 $this->list_info = trim($a_val);
105 return $this->list_info;
115 $this->assigned_item_sorting =
true;
116 $this->assigned_item_info_obj = $a_item_info_obj;
117 $this->assigned_item_comp_id = $a_component_id;
118 $this->assigned_item_obj_id = $a_obj_id;
119 $this->assigned_item_type = $a_item_type;
130 $next_class = $ilCtrl->getNextClass();
135 $cmd = $ilCtrl->getCmd(
"listTaxonomies");
194 $tax_id = (int)
$_GET[
"tax_id"];
195 if (in_array($tax_id, $tax_ids))
237 $ilToolbar->setFormAction($ilCtrl->getFormAction($this));
238 $ilToolbar->addFormButton($lng->txt(
"tax_create_node"),
"createTaxNode");
240 $ilToolbar->setCloseFormTag(
false);
247 include_once(
"./Services/Taxonomy/classes/class.ilTaxonomyTableGUI.php");
252 $tpl->setContent($table->getHTML());
296 $ilCtrl->redirect($this,
"listTaxonomies");
334 $ilCtrl->setParameter($this,
"tax_id", $a_new_object->
getId());
336 $ilCtrl->redirect($this,
"editSettings");
349 include_once(
"./Services/Taxonomy/classes/class.ilTaxonomyExplorerGUI.php");
351 ?
"listAssignedItems"
354 "ilobjtaxonomygui",
$cmd);
355 if (!$tax_exp->handleCommand())
358 $tpl->setLeftContent($tax_exp->getHTML().
" ");
370 $a_target_class, $a_target_cmd, $a_root_node_title =
"")
372 die(
"ilObjTaxonomyGUI::getTreeHTML is deprecated.");
373 include_once(
"./Services/Taxonomy/classes/class.ilTaxonomyExplorerGUI.php");
375 $a_target_class, $a_target_cmd);
376 if (!$tax_exp->handleCommand())
378 return $tax_exp->getHTML().
" ";
392 global
$tpl, $ilHelp;
395 $ilHelp->setSubScreenId(
"create_node");
398 $tpl->setContent($this->form->getHTML());
411 include_once(
"Services/Form/classes/class.ilPropertyFormGUI.php");
416 $this->form->addItem($ti);
422 $or =
new ilTextInputGUI($this->lng->txt(
"tax_order_nr"),
"order_nr");
425 $this->form->addItem($or);
428 if ($a_mode ==
"edit")
431 $ti->setValue($node->getTitle());
432 $or->setValue($node->getOrderNr());
436 if ($a_mode ==
"create")
438 $this->form->addCommandButton(
"saveTaxNode", $lng->txt(
"save"));
439 $this->form->addCommandButton(
"listNodes", $lng->txt(
"cancel"));
440 $this->form->setTitle($lng->txt(
"tax_new_tax_node"));
444 $this->form->addCommandButton(
"updateTaxNode", $lng->txt(
"save"));
445 $this->form->addCommandButton(
"listNodes", $lng->txt(
"cancel"));
446 $this->form->setTitle($lng->txt(
"tax_edit_tax_node"));
449 $this->form->setFormAction($ilCtrl->getFormAction($this));
462 if ($this->form->checkInput())
467 include_once(
"./Services/Taxonomy/classes/class.ilTaxonomyNode.php");
469 $node->setTitle($this->form->getInput(
"title"));
474 $order_nr = $this->form->getInput(
"order_nr");
476 if ($order_nr ===
"")
481 $node->setOrderNr($order_nr);
482 $node->setTaxonomyId($tax->getId());
491 $ilCtrl->redirect($this,
"listNodes");
495 $this->form->setValuesByPost();
496 $tpl->setContent($this->form->getHtml());
509 if ($this->form->checkInput())
513 $node->setTitle($this->form->getInput(
"title"));
518 $node->setOrderNr($this->form->getInput(
"order_nr"));
524 $ilCtrl->redirect($this,
"");
528 $this->form->setValuesByPost();
529 $tpl->setContent($this->form->getHtml());
543 $ilCtrl->redirect($this,
"listNodes");
547 $ilHelp->setSubScreenId(
"del_items");
551 include_once(
"./Services/Utilities/classes/class.ilConfirmationGUI.php");
554 $confirmation_gui->setFormAction($ilCtrl->getFormAction($this));
555 $confirmation_gui->setHeaderText($this->lng->txt(
"info_delete_sure"));
558 include_once(
"./Services/Taxonomy/classes/class.ilTaxonomyNode.php");
559 foreach(
$_POST[
"id"] as $id)
561 $confirmation_gui->addItem(
"id[]", $id,
565 $confirmation_gui->setCancel($lng->txt(
"cancel"),
"listNodes");
566 $confirmation_gui->setConfirm($lng->txt(
"confirm"),
"confirmedDelete");
568 $tpl->setContent($confirmation_gui->getHTML());
578 include_once(
"./Services/Taxonomy/classes/class.ilTaxonomyNode.php");
581 foreach (
$_POST[
"id"] as $id)
586 $node_data = $tax_tree->getNodeData($id);
587 if (is_object($node))
591 if($tax_tree->isInTree($id))
593 $tax_tree->deleteTree($node_data);
601 $ilCtrl->redirect($this,
"listNodes");
615 include_once(
"./Services/Taxonomy/classes/class.ilTaxonomyNode.php");
616 if (is_array(
$_POST[
"order"]))
620 foreach (
$_POST[
"order"] as $k => $v)
629 if (is_array(
$_POST[
"title"]))
631 foreach (
$_POST[
"title"] as $k => $v)
640 $ilCtrl->redirect($this,
"listNodes");
653 $ilCtrl->redirect($this,
"listNodes");
657 $ilHelp->setSubScreenId(
"move_items");
659 $ilToolbar->addButton($lng->txt(
"cancel"),
660 $ilCtrl->getLinkTarget($this,
"listNodes"));
664 if (is_array(
$_POST[
"id"]))
666 $ilCtrl->setParameter($this,
"move_ids", implode(
$_POST[
"id"],
","));
670 include_once(
"./Services/Taxonomy/classes/class.ilTaxonomyExplorerGUI.php");
672 "ilobjtaxonomygui",
"pasteItems");
673 if (!$tax_exp->handleCommand())
676 $tpl->setContent($tax_exp->getHTML().
" ");
689 if (
$_GET[
"move_ids"] !=
"")
691 $move_ids = explode(
",",
$_GET[
"move_ids"]);
693 $tree = $tax->getTree();
695 include_once(
"./Services/Taxonomy/classes/class.ilTaxonomyNode.php");
697 foreach ($move_ids as $m_id)
701 if ($node->getTaxonomyId() == $tax->getId() &&
702 ($target_node->getTaxonomyId() == $tax->getId() ||
703 $target_node->getId() ==
$tree->readRootId()))
706 if(
$tree->isGrandChild((
int) $m_id, $target_node->getId()))
709 $this->ctrl->redirect($this,
"listNodes");
716 $tree->moveTree((
int) $m_id, $target_node->getId());
725 $ilCtrl->redirect($this,
"listNodes");
737 include_once(
"./Services/Utilities/classes/class.ilConfirmationGUI.php");
739 $cgui->setFormAction($ilCtrl->getFormAction($this));
740 $cgui->setHeaderText($lng->txt(
"tax_confirm_deletion"));
741 $cgui->setCancel($lng->txt(
"cancel"),
"listTaxonomies");
742 $cgui->setConfirm($lng->txt(
"delete"),
"deleteTaxonomy");
744 $cgui->addItem(
"id[]", $i, $tax->getTitle());
746 $tpl->setContent($cgui->getHTML());
763 $ilCtrl->redirect($this,
"listTaxonomies");
779 $ilToolbar->addButton($lng->txt(
"tax_add_taxonomy"),
780 $ilCtrl->getLinkTarget($this,
"createAssignedTaxonomy"));
787 include_once(
"./Services/Taxonomy/classes/class.ilTaxonomyListTableGUI.php");
792 $tpl->setContent(
$tab->getHTML());
804 $ilTabs->clearTargets();
806 $ilHelp->setScreenIdComponent(
"tax");
812 $ilTabs->setBackTarget($lng->txt(
"back"),
813 $ilCtrl->getLinkTarget($this,
"listTaxonomies"));
815 $ilTabs->addTab(
"list_items", $lng->txt(
"tax_nodes"),
816 $ilCtrl->getLinkTarget($this,
"listNodes"));
817 if ($this->assigned_item_sorting)
819 $ilTabs->addTab(
"ass_items", $lng->txt(
"tax_assigned_items"),
820 $ilCtrl->getLinkTarget($this,
"listAssignedItems"));
822 $ilTabs->addTab(
"settings", $lng->txt(
"settings"),
823 $ilCtrl->getLinkTarget($this,
"editSettings"));
825 $ilTabs->activateTab($a_id);
841 $tpl->setContent($form->getHTML());
853 include_once(
"Services/Form/classes/class.ilPropertyFormGUI.php");
860 $ti->setValue($tax->getTitle());
867 $ta->
setValue($tax->getDescription());
877 $si->setValue($tax->getSortingMode());
880 if ($this->assigned_item_sorting)
887 $form->addCommandButton(
"updateSettings", $lng->txt(
"save"));
889 $form->setTitle($lng->txt(
"settings"));
890 $form->setFormAction($ilCtrl->getFormAction($this));
903 if ($form->checkInput())
906 $tax->setTitle($form->getInput(
"title"));
907 $tax->setDescription($form->getInput(
"description"));
908 $tax->setSortingMode($form->getInput(
"sorting"));
909 $tax->setItemSorting($form->getInput(
"item_sorting"));
913 $ilCtrl->redirect($this,
"editSettings");
917 $form->setValuesByPost();
918 $tpl->setContent($form->getHtml());
940 include_once(
"./Services/Taxonomy/classes/class.ilTaxAssignedItemsTableGUI.php");
943 $this->assigned_item_obj_id, $this->assigned_item_type, $this->assigned_item_info_obj);
945 $tpl->setContent($table->getHTML());
958 include_once(
"./Services/Taxonomy/classes/class.ilTaxNodeAssignment.php");
959 if (is_array(
$_POST[
"order"]))
964 $tax_node = (int)
$_GET[
"tax_node"];
965 foreach ($order as $a_item_id => $ord_nr)
968 $this->assigned_item_obj_id,
970 $tax_ass->setOrderNr($tax_node, $a_item_id, $ord_nr);
974 $this->assigned_item_obj_id,
976 $tax_ass->fixOrderNr($tax_node);
979 $ilCtrl->redirect($this,
"listAssignedItems");