26 protected \ILIAS\DI\UIServices
$ui;
27 protected \ILIAS\Taxonomy\InternalGUIService
$gui;
28 protected \ILIAS\Taxonomy\InternalDomainService
$domain;
54 $this->
ctrl = $gui->ctrl();
55 $this->
tabs = $gui->tabs();
56 $this->
toolbar = $gui->toolbar();
57 $this->tpl =
$gui->ui()->mainTemplate();
58 $this->
help = $gui->help();
60 $this->request =
$gui->http()->request();
62 $this->
lng = $domain->lng();
63 $this->
user = $domain->user();
64 $this->
ui = $gui->ui();
69 $this->
ctrl->saveParameter($this,
"tax_node");
70 $this->
ctrl->saveParameter($this,
"tax_id");
72 $this->
lng->loadLanguageModule(
"tax");
75 $params = $this->request->getQueryParams();
76 $this->current_tax_node = (
int) (
$params[
"tax_node"] ??
null);
77 $this->requested_tax_id = (
int) (
$params[
"tax_id"] ??
null);
78 $this->requested_move_ids = (string) (
$params[
"move_ids"] ??
"");
91 $this->assigned_object_id = $a_val;
115 $this->list_info = trim($a_val);
128 string $a_component_id,
132 $this->assigned_item_sorting =
true;
133 $this->assigned_item_info_obj = $a_item_info_obj;
134 $this->assigned_item_comp_id = $a_component_id;
135 $this->assigned_item_obj_id = $a_obj_id;
136 $this->assigned_item_type = $a_item_type;
144 $ilCtrl = $this->ctrl;
145 $this->
tabs->activateSubTab(
"tax_settings");
147 $cmd = $ilCtrl->getCmd(
"listTaxonomies");
157 $this->listTaxonomies();
163 $tax_id = $this->requested_tax_id;
164 if (in_array($tax_id, $tax_ids)) {
172 $tax_id = $this->getCurrentTaxonomyId();
185 $ilToolbar = $this->toolbar;
187 $ilCtrl = $this->ctrl;
189 $tax = $this->getCurrentTaxonomy();
191 $this->setTabs(
"list_items");
194 $ilToolbar->setFormAction($ilCtrl->getFormAction($this));
195 $ilToolbar->addFormButton(
$lng->txt(
"tax_create_node"),
"createTaxNode");
197 $ilToolbar->setCloseFormTag(
false);
202 $tax_node = $this->current_tax_node;
203 if ($tax_node === 0) {
204 $tax = $this->getCurrentTaxonomy();
206 $tree = $tax->getTree();
207 $tax_node = $tree->readRootId();
217 $this->getCurrentTaxonomy()
219 $table->setOpenFormTag(
false);
221 $tpl->setContent($table->getHTML());
238 if ($this->getAssignedObject() > 0) {
241 return parent::checkPermissionBool($perm, $cmd, $type, $node_id);
250 $ilCtrl = $this->ctrl;
251 if ($this->getAssignedObject() > 0) {
252 $ilCtrl->redirectToURL($this->getSettingsBackUrl());
259 if ($this->getAssignedObject() > 0) {
260 $this->requested_new_type =
"tax";
262 parent::saveObject();
270 $ilCtrl = $this->ctrl;
273 if ($this->getAssignedObject() > 0) {
275 $a_new_object->
getId(),
276 $this->getAssignedObject()
278 $ilCtrl->setParameter($this,
"tax_id", $a_new_object->
getId());
279 $this->tpl->setOnScreenMessage(
'success',
$lng->txt(
"tax_added"),
true);
280 $ilCtrl->redirect($this,
"editSettings");
284 public function showTree(
bool $a_ass_items =
false): void
288 $tax = $this->getCurrentTaxonomy();
292 ?
"listAssignedItems"
295 $DIC->globalScreen()->tool()->context()->current()
300 $DIC->globalScreen()->tool()->context()->current()
303 $ctrl->getCurrentClassPath()
305 $DIC->globalScreen()->tool()->context()->current()
310 $DIC->globalScreen()->tool()->context()->current()
315 $DIC->globalScreen()->tool()->context()->current()
328 $tax_exp->handleCommand();
337 $ilHelp = $this->help;
339 $this->setTabs(
"list_items");
340 $ilHelp->setSubScreenId(
"create_node");
342 $form = $this->initTaxNodeForm(
"create");
343 $tpl->setContent($form->getHTML());
350 $ilCtrl = $this->ctrl;
359 $tax = $this->getCurrentTaxonomy();
363 $or->setMaxLength(5);
368 if ($a_mode ==
"edit") {
370 $ti->setValue($node->getTitle());
371 if (is_object($or)) {
372 $or->setValue($node->getOrderNr());
377 if ($a_mode ==
"create") {
378 $form->addCommandButton(
"saveTaxNode",
$lng->txt(
"save"));
379 $form->addCommandButton(
"listNodes",
$lng->txt(
"cancel"));
380 $form->setTitle(
$lng->txt(
"tax_new_tax_node"));
382 $form->addCommandButton(
"updateTaxNode",
$lng->txt(
"save"));
383 $form->addCommandButton(
"listNodes",
$lng->txt(
"cancel"));
384 $form->setTitle(
$lng->txt(
"tax_edit_tax_node"));
387 $form->setFormAction($ilCtrl->getFormAction($this));
399 $ilCtrl = $this->ctrl;
401 $form = $this->initTaxNodeForm(
"create");
402 if ($form->checkInput()) {
405 $node->setTitle($form->getInput(
"title"));
407 $tax = $this->getCurrentTaxonomy();
410 $order_nr = $form->getInput(
"order_nr");
412 if ($order_nr ===
"") {
416 $node->setOrderNr($order_nr);
417 $node->setTaxonomyId($tax->getId());
425 $this->tpl->setOnScreenMessage(
'success',
$lng->txt(
"msg_obj_modified"),
true);
426 $ilCtrl->redirect($this,
"listNodes");
428 $form->setValuesByPost();
429 $tpl->setContent($form->getHTML());
439 $ilCtrl = $this->ctrl;
442 $form = $this->initTaxNodeForm(
"edit");
443 if ($form->checkInput()) {
446 $node->setTitle($form->getInput(
"title"));
448 $tax = $this->getCurrentTaxonomy();
450 $node->setOrderNr($form->getInput(
"order_nr"));
455 $this->tpl->setOnScreenMessage(
'info',
$lng->txt(
"msg_obj_modified"),
true);
456 $ilCtrl->redirect($this,
"");
458 $form->setValuesByPost();
459 $tpl->setContent($form->getHTML());
470 $ilCtrl = $this->ctrl;
471 $ilHelp = $this->help;
472 $body = $this->request->getParsedBody();
474 if (!isset($body[
"id"])) {
475 $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
"no_checkbox"),
true);
476 $ilCtrl->redirect($this,
"listNodes");
479 $this->setTabs(
"list_items");
480 $ilHelp->setSubScreenId(
"del_items");
486 $confirmation_gui->setFormAction($ilCtrl->getFormAction($this));
487 $confirmation_gui->setHeaderText($this->
lng->txt(
"info_delete_sure"));
490 foreach ($body[
"id"] as
$id) {
491 $confirmation_gui->addItem(
498 $confirmation_gui->setCancel(
$lng->txt(
"cancel"),
"listNodes");
499 $confirmation_gui->setConfirm(
$lng->txt(
"confirm"),
"confirmedDelete");
501 $tpl->setContent($confirmation_gui->getHTML());
509 $ilCtrl = $this->ctrl;
510 $body = $this->request->getParsedBody();
513 foreach ($body[
"id"] as
$id) {
516 $tax_tree = $tax->getTree();
517 $node_data = $tax_tree->getNodeData(
$id);
518 if (is_object($node)) {
521 if ($tax_tree->isInTree(
$id)) {
522 $tax_tree->deleteTree($node_data);
528 $this->tpl->setOnScreenMessage(
'info', $this->
lng->txt(
"info_deleted"),
true);
530 $ilCtrl->redirect($this,
"listNodes");
538 $ilCtrl = $this->ctrl;
540 $body = $this->request->getParsedBody();
543 if (is_array($body[
"order"] ??
false)) {
544 foreach ($body[
"order"] as $k => $v) {
551 if (is_array($body[
"title"] ??
false)) {
552 foreach ($body[
"title"] as $k => $v) {
559 $this->tpl->setOnScreenMessage(
'success',
$lng->txt(
"msg_obj_modified"));
560 $ilCtrl->redirect($this,
"listNodes");
568 $ilCtrl = $this->ctrl;
570 $ilToolbar = $this->toolbar;
571 $ilHelp = $this->help;
572 $body = $this->request->getParsedBody();
574 if (!isset($body[
"id"])) {
575 $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
"no_checkbox"),
true);
576 $ilCtrl->redirect($this,
"listNodes");
579 $this->setTabs(
"list_items");
580 $ilHelp->setSubScreenId(
"move_items");
582 $ilToolbar->addButton(
584 $ilCtrl->getLinkTarget($this,
"listNodes")
587 $this->tpl->setOnScreenMessage(
'info',
$lng->txt(
"tax_please_select_target"));
589 if (is_array($body[
"id"])) {
590 $ilCtrl->setParameter($this,
"move_ids", implode(
",", $body[
"id"]));
597 $this->getCurrentTaxonomy()->
getId(),
601 if (!$tax_exp->handleCommand()) {
603 $tpl->setContent($tax_exp->getHTML(
true) .
" ");
614 $ilCtrl = $this->ctrl;
615 if ($this->requested_move_ids !=
"") {
616 $move_ids = explode(
",", $this->requested_move_ids);
617 $tax = $this->getCurrentTaxonomy();
618 $tree = $tax->getTree();
621 foreach ($move_ids as $m_id) {
624 if ($node->getTaxonomyId() == $tax->getId() &&
625 ($target_node->getTaxonomyId() == $tax->getId() ||
626 $target_node->getId() == $tree->readRootId())) {
628 if ($tree->isGrandChild((
int) $m_id, $target_node->getId()) ||
629 $m_id == $target_node->getId()) {
630 $this->tpl->setOnScreenMessage(
'failure',
$lng->txt(
"tax_target_within_nodes"),
true);
631 $this->
ctrl->redirect($this,
"listNodes");
635 $parent_id = $tree->getParentId((
int) $m_id);
636 if ($parent_id != $target_node->getId()) {
637 $tree->moveTree((
int) $m_id, $target_node->getId());
645 $this->tpl->setOnScreenMessage(
'success',
$lng->txt(
"msg_obj_modified"),
true);
646 $ilCtrl->redirect($this,
"listNodes");
654 $ilCtrl = $this->ctrl;
658 $tax = $this->getCurrentTaxonomy();
661 $cgui->setFormAction($ilCtrl->getFormAction($this));
662 $cgui->setHeaderText(
$lng->txt(
"tax_confirm_deletion"));
663 $cgui->setCancel(
$lng->txt(
"cancel"),
"returnToSettingsParent");
664 $cgui->setConfirm(
$lng->txt(
"delete"),
"deleteTaxonomy");
666 $cgui->addItem(
"id[]", 0, $tax->getTitle());
668 $tpl->setContent($cgui->getHTML());
676 $ilCtrl = $this->ctrl;
679 $tax = $this->getCurrentTaxonomy();
682 $this->tpl->setOnScreenMessage(
'success',
$lng->txt(
"tax_tax_deleted"),
true);
683 $this->returnToSettingsParent();
692 $ilToolbar = $this->toolbar;
694 $ilCtrl = $this->ctrl;
697 if (count($tax_ids) == 0 || $this->getMultiple()) {
698 $ilToolbar->addButton(
699 $lng->txt(
"tax_add_taxonomy"),
700 $ilCtrl->getLinkTarget($this,
"createAssignedTaxonomy")
703 $this->tpl->setOnScreenMessage(
'info',
$lng->txt(
"tax_max_one_tax"));
709 $this->getAssignedObject(),
713 $tpl->setContent($tab->getHTML());
718 return $this->
ctrl->getParentReturn($this);
723 $this->
ctrl->redirectToURL($this->getSettingsBackUrl());
731 $ilTabs = $this->tabs;
732 $ilCtrl = $this->ctrl;
735 $ilHelp = $this->help;
737 $ilTabs->clearTargets();
739 $ilHelp->setScreenIdComponent(
"tax");
745 $ilTabs->setBackTarget(
747 $this->getSettingsBackUrl()
752 $lng->txt(
"tax_nodes"),
753 $ilCtrl->getLinkTarget($this,
"listNodes")
755 if ($this->assigned_item_sorting) {
758 $lng->txt(
"tax_assigned_items"),
759 $ilCtrl->getLinkTarget($this,
"listAssignedItems")
764 $lng->txt(
"settings"),
765 $ilCtrl->getLinkTarget($this,
"editSettings")
768 $ilTabs->activateTab($a_id);
778 $this->setTabs(
"settings");
780 $form = $this->initSettingsForm();
781 $tpl->setContent($form->getHTML());
787 $ilCtrl = $this->ctrl;
789 $tax = $this->getCurrentTaxonomy();
795 $ti->setMaxLength(200);
798 $ti->setValue($tax->getTitle());
805 $ta->setValue($tax->getDescription());
816 $si->setValue($tax->getSortingMode());
819 if ($this->assigned_item_sorting) {
821 $cb->setChecked($tax->getItemSorting());
825 $form->addCommandButton(
"updateSettings",
$lng->txt(
"save"));
827 $form->setTitle(
$lng->txt(
"settings"));
828 $form->setFormAction($ilCtrl->getFormAction($this));
840 $ilCtrl = $this->ctrl;
842 $form = $this->initSettingsForm();
843 if ($form->checkInput()) {
844 $tax = $this->getCurrentTaxonomy();
845 $tax->setTitle($form->getInput(
"title"));
846 $tax->setDescription($form->getInput(
"description"));
847 $tax->setSortingMode((
int) $form->getInput(
"sorting"));
848 $tax->setItemSorting((
bool) $form->getInput(
"item_sorting"));
851 $this->tpl->setOnScreenMessage(
'success',
$lng->txt(
"msg_obj_modified"),
true);
852 $ilCtrl->redirect($this,
"editSettings");
854 $form->setValuesByPost();
855 $tpl->setContent($form->getHTML());
866 $this->setTabs(
"ass_items");
869 $this->showTree(
true);
875 $this->current_tax_node,
876 $this->getCurrentTaxonomy(),
877 $this->assigned_item_comp_id,
878 $this->assigned_item_obj_id,
879 $this->assigned_item_type,
880 $this->assigned_item_info_obj
883 $tpl->setContent($table->getHTML());
892 $ilCtrl = $this->ctrl;
893 $body = $this->request->getParsedBody();
895 if (is_array($body[
"order"])) {
896 $order = $body[
"order"];
897 $tax_node = $this->current_tax_node;
898 foreach ($order as $a_item_id => $ord_nr) {
900 $this->assigned_item_comp_id,
901 $this->assigned_item_obj_id,
902 $this->assigned_item_type,
903 (
int) $this->getCurrentTaxonomyId()
905 $tax_ass->setOrderNr($tax_node, $a_item_id, $ord_nr);
908 $this->assigned_item_comp_id,
909 $this->assigned_item_obj_id,
910 $this->assigned_item_type,
911 $this->getCurrentTaxonomyId()
913 $tax_ass->fixOrderNr($tax_node);
914 $this->tpl->setOnScreenMessage(
'success',
$lng->txt(
"msg_obj_modified"),
true);
916 $ilCtrl->redirect($this,
"listAssignedItems");
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
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...
pasteItems()
Paste items (move operation)
createTaxNode()
Create tax node.
confirmDeleteTaxonomy()
Confirm taxonomy deletion.
saveSorting()
Save settings and sorting.
ILIAS Taxonomy InternalDomainService $domain
deleteItems()
Confirm deletion screen for items.
ilTaxAssignedItemInfo $assigned_item_info_obj
afterSave(ilObject $a_new_object)
After saving,.
listTaxonomies()
List taxonomies.
editSettings()
Edit settings.
executeCommand()
Execute command.
confirmedDelete()
Delete taxonomy nodes.
string $assigned_item_type
createAssignedTaxonomy()
Create assigned taxonomy.
getType()
Functions that must be overwritten.
setTabs($a_id="")
@inheritDoc
int $assigned_item_obj_id
updateTaxNode()
Update tax node.
string $assigned_item_comp_id
string $requested_move_ids
checkPermissionBool(string $perm, string $cmd="", string $type="", ?int $node_id=null)
deleteTaxonomy()
Delete taxonomy.
updateSettings()
Update taxonomy settings.
saveAssignedItemsSorting()
Save assigned items sorting.
initTaxNodeForm(string $a_mode="edit")
setAssignedObject(int $a_val)
activateAssignedItemSorting(ilTaxAssignedItemInfo $a_item_info_obj, string $a_component_id, int $a_obj_id, string $a_item_type)
Activate sorting mode of assigned objects.
bool $assigned_item_sorting
setMultiple(bool $a_val)
Set multiple.
listAssignedItems()
List assigned items.
showTree(bool $a_ass_items=false)
setListInfo(string $a_val)
ILIAS Taxonomy InternalGUIService $gui
saveTaxNode()
Save tax node form.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static getUsageOfObject(int $a_obj_id, bool $a_include_titles=false)
static saveUsage(int $a_tax_id, int $a_obj_id)
New implementation of ilObjectGUI.
Class ilObject Basic functions for all objects.
static _lookupTitle(int $obj_id)
static _lookupDescription(int $obj_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...
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...
static getNextOrderNr(int $a_tax_id, int $a_parent_id)
Put this node into the taxonomy tree.
static writeTitle(int $a_node_id, string $a_title)
Write title.
static writeOrderNr(int $a_node_id, int $a_order_nr)
static _lookupTitle(int $a_obj_id)
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 fixOrderNumbers(int $a_tax_id, int $a_parent_id)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This class represents a text area property in a property form.
This class represents a text property in a property form.
static getImagePath(string $image_name, string $module_path="", string $mode="output", bool $offline=false)
get image path (for images located in a template directory)
static stripSlashes(string $a_str, bool $a_strip_html=true, string $a_allow="")
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
if(! $DIC->user() ->getId()||!ilLTIConsumerAccess::hasCustomProviderCreationAccess()) $params
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
if(!file_exists('../ilias.ini.php'))