27 protected \ILIAS\DI\UIServices
$ui;
28 protected \ILIAS\Taxonomy\InternalGUIService
$gui;
29 protected \ILIAS\Taxonomy\InternalDomainService
$domain;
55 $this->
ctrl = $gui->ctrl();
56 $this->
tabs = $gui->tabs();
57 $this->
toolbar = $gui->toolbar();
58 $this->tpl =
$gui->ui()->mainTemplate();
59 $this->
help = $gui->help();
61 $this->request =
$gui->http()->request();
63 $this->
lng = $domain->lng();
64 $this->
user = $domain->user();
65 $this->
ui = $gui->ui();
70 $this->
ctrl->saveParameter($this,
"tax_node");
71 $this->
ctrl->saveParameter($this,
"tax_id");
73 $this->
lng->loadLanguageModule(
"tax");
76 $params = $this->request->getQueryParams();
77 $this->current_tax_node = (
int) (
$params[
"tax_node"] ??
null);
78 $this->requested_tax_id = (
int) (
$params[
"tax_id"] ??
null);
79 $this->requested_move_ids = (string) (
$params[
"move_ids"] ??
"");
92 $this->assigned_object_id = $a_val;
121 $this->list_info = trim($a_val);
134 string $a_component_id,
138 $this->assigned_item_sorting =
true;
139 $this->assigned_item_info_obj = $a_item_info_obj;
140 $this->assigned_item_comp_id = $a_component_id;
141 $this->assigned_item_obj_id = $a_obj_id;
142 $this->assigned_item_type = $a_item_type;
150 $ilCtrl = $this->ctrl;
151 $this->
tabs->activateSubTab(
"tax_settings");
153 $cmd = $ilCtrl->getCmd(
"listTaxonomies");
163 $this->listTaxonomies();
169 $tax_id = $this->requested_tax_id;
170 if (in_array($tax_id, $tax_ids)) {
178 $tax_id = $this->getCurrentTaxonomyId();
191 $ilToolbar = $this->toolbar;
193 $ilCtrl = $this->ctrl;
195 $tax = $this->getCurrentTaxonomy();
197 $this->setTabs(
"list_items");
200 $ilToolbar->setFormAction($ilCtrl->getFormAction($this));
201 $ilToolbar->addFormButton(
$lng->txt(
"tax_create_node"),
"createTaxNode");
203 $ilToolbar->setCloseFormTag(
false);
208 $tax_node = $this->current_tax_node;
209 if ($tax_node === 0) {
210 $tax = $this->getCurrentTaxonomy();
212 $tree = $tax->getTree();
213 $tax_node = $tree->readRootId();
223 $this->getCurrentTaxonomy()
225 $table->setOpenFormTag(
false);
227 $tpl->setContent($table->getHTML());
244 if ($this->getAssignedObject() > 0) {
247 return parent::checkPermissionBool($perm, $cmd, $type, $node_id);
256 $ilCtrl = $this->ctrl;
257 if ($this->getAssignedObject() > 0) {
258 $ilCtrl->redirectToURL($this->getSettingsBackUrl());
265 if ($this->getAssignedObject() > 0) {
266 $this->requested_new_type =
"tax";
268 parent::saveObject();
276 $ilCtrl = $this->ctrl;
279 if ($this->getAssignedObject() > 0) {
281 $a_new_object->
getId(),
282 $this->getAssignedObject()
284 $ilCtrl->setParameter($this,
"tax_id", $a_new_object->
getId());
285 $this->tpl->setOnScreenMessage(
'success',
$lng->txt(
"tax_added"),
true);
286 $ilCtrl->redirect($this,
"editSettings");
290 public function showTree(
bool $a_ass_items =
false): void
294 $tax = $this->getCurrentTaxonomy();
298 ?
"listAssignedItems"
301 $DIC->globalScreen()->tool()->context()->current()
306 $DIC->globalScreen()->tool()->context()->current()
309 $ctrl->getCurrentClassPath()
311 $DIC->globalScreen()->tool()->context()->current()
316 $DIC->globalScreen()->tool()->context()->current()
321 $DIC->globalScreen()->tool()->context()->current()
334 $tax_exp->handleCommand();
343 $ilHelp = $this->help;
345 $this->setTabs(
"list_items");
346 $ilHelp->setSubScreenId(
"create_node");
348 $form = $this->initTaxNodeForm(
"create");
349 $tpl->setContent($form->getHTML());
356 $ilCtrl = $this->ctrl;
365 $tax = $this->getCurrentTaxonomy();
369 $or->setMaxLength(5);
374 if ($a_mode ==
"edit") {
376 $ti->setValue($node->getTitle());
377 if (is_object($or)) {
378 $or->setValue($node->getOrderNr());
383 if ($a_mode ==
"create") {
384 $form->addCommandButton(
"saveTaxNode",
$lng->txt(
"save"));
385 $form->addCommandButton(
"listNodes",
$lng->txt(
"cancel"));
386 $form->setTitle(
$lng->txt(
"tax_new_tax_node"));
388 $form->addCommandButton(
"updateTaxNode",
$lng->txt(
"save"));
389 $form->addCommandButton(
"listNodes",
$lng->txt(
"cancel"));
390 $form->setTitle(
$lng->txt(
"tax_edit_tax_node"));
393 $form->setFormAction($ilCtrl->getFormAction($this));
405 $ilCtrl = $this->ctrl;
407 $form = $this->initTaxNodeForm(
"create");
408 if ($form->checkInput()) {
411 $node->setTitle($form->getInput(
"title"));
413 $tax = $this->getCurrentTaxonomy();
416 $order_nr = $form->getInput(
"order_nr");
418 if ($order_nr ===
"") {
422 $node->setOrderNr($order_nr);
423 $node->setTaxonomyId($tax->getId());
431 $this->tpl->setOnScreenMessage(
'success',
$lng->txt(
"msg_obj_modified"),
true);
432 $ilCtrl->redirect($this,
"listNodes");
434 $form->setValuesByPost();
435 $tpl->setContent($form->getHTML());
445 $ilCtrl = $this->ctrl;
448 $form = $this->initTaxNodeForm(
"edit");
449 if ($form->checkInput()) {
452 $node->setTitle($form->getInput(
"title"));
454 $tax = $this->getCurrentTaxonomy();
456 $node->setOrderNr($form->getInput(
"order_nr"));
461 $this->tpl->setOnScreenMessage(
'info',
$lng->txt(
"msg_obj_modified"),
true);
462 $ilCtrl->redirect($this,
"");
464 $form->setValuesByPost();
465 $tpl->setContent($form->getHTML());
476 $ilCtrl = $this->ctrl;
477 $ilHelp = $this->help;
478 $body = $this->request->getParsedBody();
480 if (!isset($body[
"id"])) {
481 $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
"no_checkbox"),
true);
482 $ilCtrl->redirect($this,
"listNodes");
485 $this->setTabs(
"list_items");
486 $ilHelp->setSubScreenId(
"del_items");
492 $confirmation_gui->setFormAction($ilCtrl->getFormAction($this));
493 $confirmation_gui->setHeaderText($this->
lng->txt(
"info_delete_sure"));
496 foreach ($body[
"id"] as
$id) {
497 $confirmation_gui->addItem(
504 $confirmation_gui->setCancel(
$lng->txt(
"cancel"),
"listNodes");
505 $confirmation_gui->setConfirm(
$lng->txt(
"confirm"),
"confirmedDelete");
507 $tpl->setContent($confirmation_gui->getHTML());
515 $ilCtrl = $this->ctrl;
516 $body = $this->request->getParsedBody();
519 foreach ($body[
"id"] as
$id) {
522 $tax_tree = $tax->getTree();
523 $node_data = $tax_tree->getNodeData(
$id);
524 if (is_object($node)) {
527 if ($tax_tree->isInTree(
$id)) {
528 $tax_tree->deleteTree($node_data);
534 $this->tpl->setOnScreenMessage(
'info', $this->
lng->txt(
"info_deleted"),
true);
536 $ilCtrl->redirect($this,
"listNodes");
544 $ilCtrl = $this->ctrl;
546 $body = $this->request->getParsedBody();
549 if (is_array($body[
"order"] ??
false)) {
550 foreach ($body[
"order"] as $k => $v) {
557 if (is_array($body[
"title"] ??
false)) {
558 foreach ($body[
"title"] as $k => $v) {
565 $this->tpl->setOnScreenMessage(
'success',
$lng->txt(
"msg_obj_modified"));
566 $ilCtrl->redirect($this,
"listNodes");
574 $ilCtrl = $this->ctrl;
576 $ilToolbar = $this->toolbar;
577 $ilHelp = $this->help;
578 $body = $this->request->getParsedBody();
580 if (!isset($body[
"id"])) {
581 $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
"no_checkbox"),
true);
582 $ilCtrl->redirect($this,
"listNodes");
585 $this->setTabs(
"list_items");
586 $ilHelp->setSubScreenId(
"move_items");
588 $ilToolbar->addButton(
590 $ilCtrl->getLinkTarget($this,
"listNodes")
593 $this->tpl->setOnScreenMessage(
'info',
$lng->txt(
"tax_please_select_target"));
595 if (is_array($body[
"id"])) {
596 $ilCtrl->setParameter($this,
"move_ids", implode(
",", $body[
"id"]));
603 $this->getCurrentTaxonomy()->
getId(),
607 if (!$tax_exp->handleCommand()) {
609 $tpl->setContent($tax_exp->getHTML(
true) .
" ");
620 $ilCtrl = $this->ctrl;
621 if ($this->requested_move_ids !=
"") {
622 $move_ids = explode(
",", $this->requested_move_ids);
623 $tax = $this->getCurrentTaxonomy();
624 $tree = $tax->getTree();
627 foreach ($move_ids as $m_id) {
630 if ($node->getTaxonomyId() == $tax->getId() &&
631 ($target_node->getTaxonomyId() == $tax->getId() ||
632 $target_node->getId() == $tree->readRootId())) {
634 if ($tree->isGrandChild((
int) $m_id, $target_node->getId()) ||
635 $m_id == $target_node->getId()) {
636 $this->tpl->setOnScreenMessage(
'failure',
$lng->txt(
"tax_target_within_nodes"),
true);
637 $this->
ctrl->redirect($this,
"listNodes");
641 $parent_id = $tree->getParentId((
int) $m_id);
642 if ($parent_id != $target_node->getId()) {
643 $tree->moveTree((
int) $m_id, $target_node->getId());
651 $this->tpl->setOnScreenMessage(
'success',
$lng->txt(
"msg_obj_modified"),
true);
652 $ilCtrl->redirect($this,
"listNodes");
660 $ilCtrl = $this->ctrl;
664 $tax = $this->getCurrentTaxonomy();
667 $cgui->setFormAction($ilCtrl->getFormAction($this));
668 $cgui->setHeaderText(
$lng->txt(
"tax_confirm_deletion"));
669 $cgui->setCancel(
$lng->txt(
"cancel"),
"returnToSettingsParent");
670 $cgui->setConfirm(
$lng->txt(
"delete"),
"deleteTaxonomy");
672 $cgui->addItem(
"id[]", 0, $tax->getTitle());
674 $tpl->setContent($cgui->getHTML());
682 $ilCtrl = $this->ctrl;
685 $tax = $this->getCurrentTaxonomy();
688 $this->tpl->setOnScreenMessage(
'success',
$lng->txt(
"tax_tax_deleted"),
true);
689 $this->returnToSettingsParent();
698 $ilToolbar = $this->toolbar;
700 $ilCtrl = $this->ctrl;
703 if (count($tax_ids) == 0 || $this->getMultiple()) {
704 $ilToolbar->addButton(
705 $lng->txt(
"tax_add_taxonomy"),
706 $ilCtrl->getLinkTarget($this,
"createAssignedTaxonomy")
709 $this->tpl->setOnScreenMessage(
'info',
$lng->txt(
"tax_max_one_tax"));
715 $this->getAssignedObject(),
719 $tpl->setContent($tab->getHTML());
724 return $this->
ctrl->getParentReturn($this);
729 $this->
ctrl->redirectToURL($this->getSettingsBackUrl());
737 $ilTabs = $this->tabs;
738 $ilCtrl = $this->ctrl;
741 $ilHelp = $this->help;
743 $ilTabs->clearTargets();
745 $ilHelp->setScreenIdComponent(
"tax");
751 $ilTabs->setBackTarget(
753 $this->getSettingsBackUrl()
758 $lng->txt(
"tax_nodes"),
759 $ilCtrl->getLinkTarget($this,
"listNodes")
761 if ($this->assigned_item_sorting) {
764 $lng->txt(
"tax_assigned_items"),
765 $ilCtrl->getLinkTarget($this,
"listAssignedItems")
770 $lng->txt(
"settings"),
771 $ilCtrl->getLinkTarget($this,
"editSettings")
774 $ilTabs->activateTab($a_id);
784 $this->setTabs(
"settings");
786 $form = $this->initSettingsForm();
787 $tpl->setContent($form->getHTML());
793 $ilCtrl = $this->ctrl;
795 $tax = $this->getCurrentTaxonomy();
801 $ti->setMaxLength(200);
804 $ti->setValue($tax->getTitle());
811 $ta->setValue($tax->getDescription());
820 $si->setOptions($options);
822 $si->setValue($tax->getSortingMode());
825 if ($this->assigned_item_sorting) {
827 $cb->setChecked($tax->getItemSorting());
831 $form->addCommandButton(
"updateSettings",
$lng->txt(
"save"));
833 $form->setTitle(
$lng->txt(
"settings"));
834 $form->setFormAction($ilCtrl->getFormAction($this));
846 $ilCtrl = $this->ctrl;
848 $form = $this->initSettingsForm();
849 if ($form->checkInput()) {
850 $tax = $this->getCurrentTaxonomy();
851 $tax->setTitle($form->getInput(
"title"));
852 $tax->setDescription($form->getInput(
"description"));
853 $tax->setSortingMode((
int) $form->getInput(
"sorting"));
854 $tax->setItemSorting((
bool) $form->getInput(
"item_sorting"));
857 $this->tpl->setOnScreenMessage(
'success',
$lng->txt(
"msg_obj_modified"),
true);
858 $ilCtrl->redirect($this,
"editSettings");
860 $form->setValuesByPost();
861 $tpl->setContent($form->getHTML());
872 $this->setTabs(
"ass_items");
875 $this->showTree(
true);
881 $this->current_tax_node,
882 $this->getCurrentTaxonomy(),
883 $this->assigned_item_comp_id,
884 $this->assigned_item_obj_id,
885 $this->assigned_item_type,
886 $this->assigned_item_info_obj
889 $tpl->setContent($table->getHTML());
898 $ilCtrl = $this->ctrl;
899 $body = $this->request->getParsedBody();
901 if (is_array($body[
"order"])) {
902 $order = $body[
"order"];
903 $tax_node = $this->current_tax_node;
904 foreach ($order as $a_item_id => $ord_nr) {
906 $this->assigned_item_comp_id,
907 $this->assigned_item_obj_id,
908 $this->assigned_item_type,
909 (
int) $this->getCurrentTaxonomyId()
911 $tax_ass->setOrderNr($tax_node, $a_item_id, $ord_nr);
914 $this->assigned_item_comp_id,
915 $this->assigned_item_obj_id,
916 $this->assigned_item_type,
917 $this->getCurrentTaxonomyId()
919 $tax_ass->fixOrderNr($tax_node);
920 $this->tpl->setOnScreenMessage(
'success',
$lng->txt(
"msg_obj_modified"),
true);
922 $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,.
setModifier(?\ILIAS\Taxonomy\TaxonomyModifierGUI $modifier)
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
ILIAS Taxonomy Settings ModifierGUIInterface $modifier
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
Interface Observer \BackgroundTasks Contains several chained tasks and infos about them.
if(!file_exists('../ilias.ini.php'))