47 $this->
ctrl = $DIC->ctrl();
48 $this->
lng = $DIC->language();
49 $this->
user = $DIC->user();
50 $this->
tabs = $DIC->tabs();
51 $this->
toolbar = $DIC->toolbar();
52 $this->tpl =
$DIC[
"tpl"];
53 $this->
help = $DIC[ilHelp::class];
54 $ilCtrl =
$DIC->ctrl();
59 $ilCtrl->saveParameter($this,
"tax_node");
60 $ilCtrl->saveParameter($this,
"tax_id");
65 $this->request =
$DIC->http()->request();
66 $params =
$DIC->http()->request()->getQueryParams();
67 $this->current_tax_node = (
int) (
$params[
"tax_node"] ??
null);
68 $this->requested_tax_id = (
int) (
$params[
"tax_id"] ??
null);
69 $this->requested_move_ids = (string) (
$params[
"move_ids"] ??
"");
82 $this->assigned_object_id = $a_val;
106 $this->list_info = trim($a_val);
119 string $a_component_id,
123 $this->assigned_item_sorting =
true;
124 $this->assigned_item_info_obj = $a_item_info_obj;
125 $this->assigned_item_comp_id = $a_component_id;
126 $this->assigned_item_obj_id = $a_obj_id;
127 $this->assigned_item_type = $a_item_type;
135 $ilCtrl = $this->ctrl;
137 $cmd = $ilCtrl->getCmd(
"listTaxonomies");
147 self::CFORM_NEW => $this->initCreateForm(
"tax")
158 $this->listTaxonomies();
164 $tax_id = $this->requested_tax_id;
165 if (in_array($tax_id, $tax_ids)) {
173 $tax_id = $this->getCurrentTaxonomyId();
186 $ilToolbar = $this->toolbar;
188 $ilCtrl = $this->ctrl;
190 $tax = $this->getCurrentTaxonomy();
192 $this->setTabs(
"list_items");
195 $ilToolbar->setFormAction($ilCtrl->getFormAction($this));
196 $ilToolbar->addFormButton(
$lng->txt(
"tax_create_node"),
"createTaxNode");
198 $ilToolbar->setCloseFormTag(
false);
203 $tax_node = $this->current_tax_node;
204 if ($tax_node === 0) {
205 $tax = $this->getCurrentTaxonomy();
207 $tree = $tax->getTree();
208 $tax_node = $tree->readRootId();
218 $this->getCurrentTaxonomy()
220 $table->setOpenFormTag(
false);
222 $tpl->setContent($table->getHTML());
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->redirect($this,
"listTaxonomies");
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;
340 $this->setTabs(
"list_items");
341 $ilHelp->setSubScreenId(
"create_node");
343 $form = $this->initTaxNodeForm(
"create");
344 $tpl->setContent($form->getHTML());
351 $ilCtrl = $this->ctrl;
360 $tax = $this->getCurrentTaxonomy();
364 $or->setMaxLength(5);
369 if ($a_mode ==
"edit") {
371 $ti->setValue($node->getTitle());
372 if (is_object($or)) {
373 $or->setValue($node->getOrderNr());
378 if ($a_mode ==
"create") {
379 $form->addCommandButton(
"saveTaxNode",
$lng->txt(
"save"));
380 $form->addCommandButton(
"listNodes",
$lng->txt(
"cancel"));
381 $form->setTitle(
$lng->txt(
"tax_new_tax_node"));
383 $form->addCommandButton(
"updateTaxNode",
$lng->txt(
"save"));
384 $form->addCommandButton(
"listNodes",
$lng->txt(
"cancel"));
385 $form->setTitle(
$lng->txt(
"tax_edit_tax_node"));
388 $form->setFormAction($ilCtrl->getFormAction($this));
400 $ilCtrl = $this->ctrl;
402 $form = $this->initTaxNodeForm(
"create");
403 if ($form->checkInput()) {
406 $node->setTitle($form->getInput(
"title"));
408 $tax = $this->getCurrentTaxonomy();
411 $order_nr = $form->getInput(
"order_nr");
413 if ($order_nr ===
"") {
417 $node->setOrderNr($order_nr);
418 $node->setTaxonomyId($tax->getId());
426 $this->tpl->setOnScreenMessage(
'success',
$lng->txt(
"msg_obj_modified"),
true);
427 $ilCtrl->redirect($this,
"listNodes");
429 $form->setValuesByPost();
430 $tpl->setContent($form->getHTML());
440 $ilCtrl = $this->ctrl;
443 $form = $this->initTaxNodeForm(
"edit");
444 if ($form->checkInput()) {
447 $node->setTitle($form->getInput(
"title"));
449 $tax = $this->getCurrentTaxonomy();
451 $node->setOrderNr($form->getInput(
"order_nr"));
456 $this->tpl->setOnScreenMessage(
'info',
$lng->txt(
"msg_obj_modified"),
true);
457 $ilCtrl->redirect($this,
"");
459 $form->setValuesByPost();
460 $tpl->setContent($form->getHTML());
471 $ilCtrl = $this->ctrl;
472 $ilHelp = $this->help;
473 $body = $this->request->getParsedBody();
475 if (!isset($body[
"id"])) {
476 $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
"no_checkbox"),
true);
477 $ilCtrl->redirect($this,
"listNodes");
480 $this->setTabs(
"list_items");
481 $ilHelp->setSubScreenId(
"del_items");
487 $confirmation_gui->setFormAction($ilCtrl->getFormAction($this));
488 $confirmation_gui->setHeaderText($this->
lng->txt(
"info_delete_sure"));
491 foreach ($body[
"id"] as
$id) {
492 $confirmation_gui->addItem(
499 $confirmation_gui->setCancel(
$lng->txt(
"cancel"),
"listNodes");
500 $confirmation_gui->setConfirm(
$lng->txt(
"confirm"),
"confirmedDelete");
502 $tpl->setContent($confirmation_gui->getHTML());
510 $ilCtrl = $this->ctrl;
511 $body = $this->request->getParsedBody();
514 foreach ($body[
"id"] as
$id) {
517 $tax_tree = $tax->getTree();
518 $node_data = $tax_tree->getNodeData(
$id);
519 if (is_object($node)) {
522 if ($tax_tree->isInTree(
$id)) {
523 $tax_tree->deleteTree($node_data);
529 $this->tpl->setOnScreenMessage(
'info', $this->
lng->txt(
"info_deleted"),
true);
531 $ilCtrl->redirect($this,
"listNodes");
539 $ilCtrl = $this->ctrl;
541 $body = $this->request->getParsedBody();
544 if (is_array($body[
"order"] ??
null)) {
545 foreach ($body[
"order"] as $k => $v) {
552 if (is_array($body[
"title"] ??
null)) {
553 foreach ($body[
"title"] as $k => $v) {
560 $this->tpl->setOnScreenMessage(
'success',
$lng->txt(
"msg_obj_modified"));
561 $ilCtrl->redirect($this,
"listNodes");
569 $ilCtrl = $this->ctrl;
571 $ilToolbar = $this->toolbar;
572 $ilHelp = $this->help;
573 $body = $this->request->getParsedBody();
575 if (!isset($body[
"id"])) {
576 $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
"no_checkbox"),
true);
577 $ilCtrl->redirect($this,
"listNodes");
580 $this->setTabs(
"list_items");
581 $ilHelp->setSubScreenId(
"move_items");
583 $ilToolbar->addButton(
585 $ilCtrl->getLinkTarget($this,
"listNodes")
588 $this->tpl->setOnScreenMessage(
'info',
$lng->txt(
"tax_please_select_target"));
590 if (is_array($body[
"id"])) {
591 $ilCtrl->setParameter($this,
"move_ids", implode(
",", $body[
"id"]));
598 $this->getCurrentTaxonomy()->
getId(),
602 if (!$tax_exp->handleCommand()) {
604 $tpl->setContent($tax_exp->getHTML() .
" ");
615 $ilCtrl = $this->ctrl;
616 if ($this->requested_move_ids !=
"") {
617 $move_ids = explode(
",", $this->requested_move_ids);
618 $tax = $this->getCurrentTaxonomy();
619 $tree = $tax->getTree();
622 foreach ($move_ids as $m_id) {
625 if ($node->getTaxonomyId() == $tax->getId() &&
626 ($target_node->getTaxonomyId() == $tax->getId() ||
627 $target_node->getId() == $tree->readRootId())) {
629 if ($tree->isGrandChild((
int) $m_id, $target_node->getId()) ||
630 $m_id == $target_node->getId()) {
631 $this->tpl->setOnScreenMessage(
'failure',
$lng->txt(
"tax_target_within_nodes"),
true);
632 $this->
ctrl->redirect($this,
"listNodes");
636 $parent_id = $tree->getParentId((
int) $m_id);
637 if ($parent_id != $target_node->getId()) {
638 $tree->moveTree((
int) $m_id, $target_node->getId());
646 $this->tpl->setOnScreenMessage(
'success',
$lng->txt(
"msg_obj_modified"),
true);
647 $ilCtrl->redirect($this,
"listNodes");
655 $ilCtrl = $this->ctrl;
659 $tax = $this->getCurrentTaxonomy();
662 $cgui->setFormAction($ilCtrl->getFormAction($this));
663 $cgui->setHeaderText(
$lng->txt(
"tax_confirm_deletion"));
664 $cgui->setCancel(
$lng->txt(
"cancel"),
"listTaxonomies");
665 $cgui->setConfirm(
$lng->txt(
"delete"),
"deleteTaxonomy");
667 $cgui->addItem(
"id[]", 0, $tax->getTitle());
669 $tpl->setContent($cgui->getHTML());
677 $ilCtrl = $this->ctrl;
680 $tax = $this->getCurrentTaxonomy();
683 $this->tpl->setOnScreenMessage(
'success',
$lng->txt(
"tax_tax_deleted"),
true);
684 $ilCtrl->redirect($this,
"listTaxonomies");
693 $ilToolbar = $this->toolbar;
695 $ilCtrl = $this->ctrl;
698 if (count($tax_ids) == 0 || $this->getMultiple()) {
699 $ilToolbar->addButton(
700 $lng->txt(
"tax_add_taxonomy"),
701 $ilCtrl->getLinkTarget($this,
"createAssignedTaxonomy")
704 $this->tpl->setOnScreenMessage(
'info',
$lng->txt(
"tax_max_one_tax"));
710 $this->getAssignedObject(),
714 $tpl->setContent($tab->getHTML());
722 $ilTabs = $this->tabs;
723 $ilCtrl = $this->ctrl;
726 $ilHelp = $this->help;
728 $ilTabs->clearTargets();
730 $ilHelp->setScreenIdComponent(
"tax");
736 $ilTabs->setBackTarget(
738 $ilCtrl->getLinkTarget($this,
"listTaxonomies")
743 $lng->txt(
"tax_nodes"),
744 $ilCtrl->getLinkTarget($this,
"listNodes")
746 if ($this->assigned_item_sorting) {
749 $lng->txt(
"tax_assigned_items"),
750 $ilCtrl->getLinkTarget($this,
"listAssignedItems")
755 $lng->txt(
"settings"),
756 $ilCtrl->getLinkTarget($this,
"editSettings")
759 $ilTabs->activateTab($a_id);
769 $this->setTabs(
"settings");
771 $form = $this->initSettingsForm();
772 $tpl->setContent($form->getHTML());
778 $ilCtrl = $this->ctrl;
780 $tax = $this->getCurrentTaxonomy();
786 $ti->setMaxLength(200);
789 $ti->setValue($tax->getTitle());
796 $ta->setValue($tax->getDescription());
805 $si->setOptions($options);
807 $si->setValue($tax->getSortingMode());
810 if ($this->assigned_item_sorting) {
812 $cb->setChecked($tax->getItemSorting());
816 $form->addCommandButton(
"updateSettings",
$lng->txt(
"save"));
818 $form->setTitle(
$lng->txt(
"settings"));
819 $form->setFormAction($ilCtrl->getFormAction($this));
831 $ilCtrl = $this->ctrl;
833 $form = $this->initSettingsForm();
834 if ($form->checkInput()) {
835 $tax = $this->getCurrentTaxonomy();
836 $tax->setTitle($form->getInput(
"title"));
837 $tax->setDescription($form->getInput(
"description"));
838 $tax->setSortingMode((
int) $form->getInput(
"sorting"));
839 $tax->setItemSorting((
bool) $form->getInput(
"item_sorting"));
842 $this->tpl->setOnScreenMessage(
'success',
$lng->txt(
"msg_obj_modified"),
true);
843 $ilCtrl->redirect($this,
"editSettings");
845 $form->setValuesByPost();
846 $tpl->setContent($form->getHTML());
857 $this->setTabs(
"ass_items");
860 $this->showTree(
true);
866 $this->current_tax_node,
867 $this->getCurrentTaxonomy(),
868 $this->assigned_item_comp_id,
869 $this->assigned_item_obj_id,
870 $this->assigned_item_type,
871 $this->assigned_item_info_obj
874 $tpl->setContent($table->getHTML());
883 $ilCtrl = $this->ctrl;
884 $body = $this->request->getParsedBody();
886 if (is_array($body[
"order"])) {
887 $order = $body[
"order"];
888 $tax_node = $this->current_tax_node;
889 foreach ($order as $a_item_id => $ord_nr) {
891 $this->assigned_item_comp_id,
892 $this->assigned_item_obj_id,
893 $this->assigned_item_type,
894 (
int) $this->getCurrentTaxonomyId()
896 $tax_ass->setOrderNr($tax_node, $a_item_id, $ord_nr);
899 $this->assigned_item_comp_id,
900 $this->assigned_item_obj_id,
901 $this->assigned_item_type,
902 $this->getCurrentTaxonomyId()
904 $tax_ass->fixOrderNr($tax_node);
905 $this->tpl->setOnScreenMessage(
'success',
$lng->txt(
"msg_obj_modified"),
true);
907 $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...
loadLanguageModule(string $a_module)
Load language module.
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.
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.
__construct($a_id=0)
@inheritDoc
initCreationForms(string $a_new_type)
Init creation forms.
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)
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.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
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 $img, 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="")
if(!file_exists(getcwd() . '/ilias.ini.php'))
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...
if($DIC->http() ->request() ->getMethod()=="GET" &&isset($DIC->http() ->request() ->getQueryParams()['tex'])) $tpl
if(! $DIC->user() ->getId()||!ilLTIConsumerAccess::hasCustomProviderCreationAccess()) $params
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc