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());
229 $this->requested_new_type =
"tax";
239 if ($this->getAssignedObject() > 0) {
242 return parent::checkPermissionBool($perm, $cmd, $type, $node_id);
251 $ilCtrl = $this->ctrl;
252 if ($this->getAssignedObject() > 0) {
253 $ilCtrl->redirectToURL($this->getSettingsBackUrl());
260 if ($this->getAssignedObject() > 0) {
261 $this->requested_new_type =
"tax";
263 parent::saveObject();
271 $ilCtrl = $this->ctrl;
274 if ($this->getAssignedObject() > 0) {
276 $a_new_object->
getId(),
277 $this->getAssignedObject()
279 $ilCtrl->setParameter($this,
"tax_id", $a_new_object->
getId());
280 $this->tpl->setOnScreenMessage(
'success',
$lng->txt(
"tax_added"),
true);
281 $ilCtrl->redirect($this,
"editSettings");
285 public function showTree(
bool $a_ass_items =
false): void
289 $tax = $this->getCurrentTaxonomy();
293 ?
"listAssignedItems"
296 $DIC->globalScreen()->tool()->context()->current()
301 $DIC->globalScreen()->tool()->context()->current()
304 $ctrl->getCurrentClassPath()
306 $DIC->globalScreen()->tool()->context()->current()
311 $DIC->globalScreen()->tool()->context()->current()
316 $DIC->globalScreen()->tool()->context()->current()
329 $tax_exp->handleCommand();
338 $ilHelp = $this->help;
341 $this->setTabs(
"list_items");
342 $ilHelp->setSubScreenId(
"create_node");
344 $form = $this->initTaxNodeForm(
"create");
345 $tpl->setContent($form->getHTML());
352 $ilCtrl = $this->ctrl;
361 $tax = $this->getCurrentTaxonomy();
365 $or->setMaxLength(5);
370 if ($a_mode ==
"edit") {
372 $ti->setValue($node->getTitle());
373 if (is_object($or)) {
374 $or->setValue($node->getOrderNr());
379 if ($a_mode ==
"create") {
380 $form->addCommandButton(
"saveTaxNode",
$lng->txt(
"save"));
381 $form->addCommandButton(
"listNodes",
$lng->txt(
"cancel"));
382 $form->setTitle(
$lng->txt(
"tax_new_tax_node"));
384 $form->addCommandButton(
"updateTaxNode",
$lng->txt(
"save"));
385 $form->addCommandButton(
"listNodes",
$lng->txt(
"cancel"));
386 $form->setTitle(
$lng->txt(
"tax_edit_tax_node"));
389 $form->setFormAction($ilCtrl->getFormAction($this));
401 $ilCtrl = $this->ctrl;
403 $form = $this->initTaxNodeForm(
"create");
404 if ($form->checkInput()) {
407 $node->setTitle($form->getInput(
"title"));
409 $tax = $this->getCurrentTaxonomy();
412 $order_nr = $form->getInput(
"order_nr");
414 if ($order_nr ===
"") {
418 $node->setOrderNr($order_nr);
419 $node->setTaxonomyId($tax->getId());
427 $this->tpl->setOnScreenMessage(
'success',
$lng->txt(
"msg_obj_modified"),
true);
428 $ilCtrl->redirect($this,
"listNodes");
430 $form->setValuesByPost();
431 $tpl->setContent($form->getHTML());
441 $ilCtrl = $this->ctrl;
444 $form = $this->initTaxNodeForm(
"edit");
445 if ($form->checkInput()) {
448 $node->setTitle($form->getInput(
"title"));
450 $tax = $this->getCurrentTaxonomy();
452 $node->setOrderNr($form->getInput(
"order_nr"));
457 $this->tpl->setOnScreenMessage(
'info',
$lng->txt(
"msg_obj_modified"),
true);
458 $ilCtrl->redirect($this,
"");
460 $form->setValuesByPost();
461 $tpl->setContent($form->getHTML());
472 $ilCtrl = $this->ctrl;
473 $ilHelp = $this->help;
474 $body = $this->request->getParsedBody();
477 if (!isset($body[
"id"])) {
478 $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
"no_checkbox"),
true);
479 $ilCtrl->redirect($this,
"listNodes");
482 $this->setTabs(
"list_items");
483 $ilHelp->setSubScreenId(
"del_items");
489 $confirmation_gui->setFormAction($ilCtrl->getFormAction($this));
490 $confirmation_gui->setHeaderText($this->
lng->txt(
"info_delete_sure"));
493 foreach ($body[
"id"] as
$id) {
494 $confirmation_gui->addItem(
501 $confirmation_gui->setCancel(
$lng->txt(
"cancel"),
"listNodes");
502 $confirmation_gui->setConfirm(
$lng->txt(
"confirm"),
"confirmedDelete");
504 $tpl->setContent($confirmation_gui->getHTML());
512 $ilCtrl = $this->ctrl;
513 $body = $this->request->getParsedBody();
516 foreach ($body[
"id"] as
$id) {
519 $tax_tree = $tax->getTree();
520 $node_data = $tax_tree->getNodeData(
$id);
521 if (is_object($node)) {
524 if ($tax_tree->isInTree(
$id)) {
525 $tax_tree->deleteTree($node_data);
531 $this->tpl->setOnScreenMessage(
'info', $this->
lng->txt(
"info_deleted"),
true);
533 $ilCtrl->redirect($this,
"listNodes");
541 $ilCtrl = $this->ctrl;
543 $body = $this->request->getParsedBody();
546 if (is_array($body[
"order"] ??
false)) {
547 foreach ($body[
"order"] as $k => $v) {
554 if (is_array($body[
"title"] ??
false)) {
555 foreach ($body[
"title"] as $k => $v) {
562 $this->tpl->setOnScreenMessage(
'success',
$lng->txt(
"msg_obj_modified"));
563 $ilCtrl->redirect($this,
"listNodes");
571 $ilCtrl = $this->ctrl;
573 $ilToolbar = $this->toolbar;
574 $ilHelp = $this->help;
575 $body = $this->request->getParsedBody();
577 if (!isset($body[
"id"])) {
578 $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
"no_checkbox"),
true);
579 $ilCtrl->redirect($this,
"listNodes");
582 $this->setTabs(
"list_items");
583 $ilHelp->setSubScreenId(
"move_items");
585 $ilToolbar->addButton(
587 $ilCtrl->getLinkTarget($this,
"listNodes")
590 $this->tpl->setOnScreenMessage(
'info',
$lng->txt(
"tax_please_select_target"));
592 if (is_array($body[
"id"])) {
593 $ilCtrl->setParameter($this,
"move_ids", implode(
",", $body[
"id"]));
600 $this->getCurrentTaxonomy()->
getId(),
604 if (!$tax_exp->handleCommand()) {
606 $tpl->setContent($tax_exp->getHTML(
true) .
" ");
617 $ilCtrl = $this->ctrl;
618 if ($this->requested_move_ids !=
"") {
619 $move_ids = explode(
",", $this->requested_move_ids);
620 $tax = $this->getCurrentTaxonomy();
621 $tree = $tax->getTree();
624 foreach ($move_ids as $m_id) {
627 if ($node->getTaxonomyId() == $tax->getId() &&
628 ($target_node->getTaxonomyId() == $tax->getId() ||
629 $target_node->getId() == $tree->readRootId())) {
631 if ($tree->isGrandChild((
int) $m_id, $target_node->getId()) ||
632 $m_id == $target_node->getId()) {
633 $this->tpl->setOnScreenMessage(
'failure',
$lng->txt(
"tax_target_within_nodes"),
true);
634 $this->
ctrl->redirect($this,
"listNodes");
638 $parent_id = $tree->getParentId((
int) $m_id);
639 if ($parent_id != $target_node->getId()) {
640 $tree->moveTree((
int) $m_id, $target_node->getId());
648 $this->tpl->setOnScreenMessage(
'success',
$lng->txt(
"msg_obj_modified"),
true);
649 $ilCtrl->redirect($this,
"listNodes");
657 $ilCtrl = $this->ctrl;
661 $tax = $this->getCurrentTaxonomy();
664 $cgui->setFormAction($ilCtrl->getFormAction($this));
665 $cgui->setHeaderText(
$lng->txt(
"tax_confirm_deletion"));
666 $cgui->setCancel(
$lng->txt(
"cancel"),
"returnToSettingsParent");
667 $cgui->setConfirm(
$lng->txt(
"delete"),
"deleteTaxonomy");
669 $cgui->addItem(
"id[]", 0, $tax->getTitle());
671 $tpl->setContent($cgui->getHTML());
679 $ilCtrl = $this->ctrl;
682 $tax = $this->getCurrentTaxonomy();
685 $this->tpl->setOnScreenMessage(
'success',
$lng->txt(
"tax_tax_deleted"),
true);
686 $this->returnToSettingsParent();
695 $ilToolbar = $this->toolbar;
697 $ilCtrl = $this->ctrl;
700 if (count($tax_ids) == 0 || $this->getMultiple()) {
701 $ilToolbar->addButton(
702 $lng->txt(
"tax_add_taxonomy"),
703 $ilCtrl->getLinkTarget($this,
"createAssignedTaxonomy")
706 $this->tpl->setOnScreenMessage(
'info',
$lng->txt(
"tax_max_one_tax"));
712 $this->getAssignedObject(),
716 $tpl->setContent($tab->getHTML());
721 return $this->
ctrl->getParentReturn($this);
726 $this->
ctrl->redirectToURL($this->getSettingsBackUrl());
734 $ilTabs = $this->tabs;
735 $ilCtrl = $this->ctrl;
738 $ilHelp = $this->help;
740 $ilTabs->clearTargets();
742 $ilHelp->setScreenIdComponent(
"tax");
748 $ilTabs->setBackTarget(
750 $this->getSettingsBackUrl()
755 $lng->txt(
"tax_nodes"),
756 $ilCtrl->getLinkTarget($this,
"listNodes")
758 if ($this->assigned_item_sorting) {
761 $lng->txt(
"tax_assigned_items"),
762 $ilCtrl->getLinkTarget($this,
"listAssignedItems")
767 $lng->txt(
"settings"),
768 $ilCtrl->getLinkTarget($this,
"editSettings")
771 $ilTabs->activateTab($a_id);
782 $this->setTabs(
"settings");
784 $form = $this->initSettingsForm();
785 $tpl->setContent($form->getHTML());
791 $ilCtrl = $this->ctrl;
793 $tax = $this->getCurrentTaxonomy();
799 $ti->setMaxLength(200);
802 $ti->setValue($tax->getTitle());
809 $ta->setValue($tax->getDescription());
820 $si->setValue($tax->getSortingMode());
823 if ($this->assigned_item_sorting) {
825 $cb->setChecked($tax->getItemSorting());
829 $form->addCommandButton(
"updateSettings",
$lng->txt(
"save"));
831 $form->setTitle(
$lng->txt(
"settings"));
832 $form->setFormAction($ilCtrl->getFormAction($this));
844 $ilCtrl = $this->ctrl;
846 $form = $this->initSettingsForm();
847 if ($form->checkInput()) {
848 $tax = $this->getCurrentTaxonomy();
849 $tax->setTitle($form->getInput(
"title"));
850 $tax->setDescription($form->getInput(
"description"));
851 $tax->setSortingMode((
int) $form->getInput(
"sorting"));
852 $tax->setItemSorting((
bool) $form->getInput(
"item_sorting"));
855 $this->tpl->setOnScreenMessage(
'success',
$lng->txt(
"msg_obj_modified"),
true);
856 $ilCtrl->redirect($this,
"editSettings");
858 $form->setValuesByPost();
859 $tpl->setContent($form->getHTML());
870 $this->setTabs(
"ass_items");
873 $this->showTree(
true);
879 $this->current_tax_node,
880 $this->getCurrentTaxonomy(),
881 $this->assigned_item_comp_id,
882 $this->assigned_item_obj_id,
883 $this->assigned_item_type,
884 $this->assigned_item_info_obj
887 $tpl->setContent($table->getHTML());
896 $ilCtrl = $this->ctrl;
897 $body = $this->request->getParsedBody();
899 if (is_array($body[
"order"])) {
900 $order = $body[
"order"];
901 $tax_node = $this->current_tax_node;
902 foreach ($order as $a_item_id => $ord_nr) {
904 $this->assigned_item_comp_id,
905 $this->assigned_item_obj_id,
906 $this->assigned_item_type,
907 (
int) $this->getCurrentTaxonomyId()
909 $tax_ass->setOrderNr($tax_node, $a_item_id, $ord_nr);
912 $this->assigned_item_comp_id,
913 $this->assigned_item_obj_id,
914 $this->assigned_item_type,
915 $this->getCurrentTaxonomyId()
917 $tax_ass->fixOrderNr($tax_node);
918 $this->tpl->setOnScreenMessage(
'success',
$lng->txt(
"msg_obj_modified"),
true);
920 $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'))