ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
class.ilTaxonomyGSToolProvider.php
Go to the documentation of this file.
1<?php
2
22
28{
29 public const SHOW_TAX_TREE = 'show_tax_tree';
30 public const TAX_TREE_GUI_PATH = 'tax_tree_gui_path';
31 public const TAX_ID = 'tax_id';
32 public const TAX_TREE_CMD = 'tax_tree_cmd';
33 public const TAX_TREE_PARENT_CMD = 'tax_tree_parent_cmd';
34
39 {
40 return $this->context_collection->main()->main();
41 }
42
46 public function getToolsForContextStack(CalledContexts $called_contexts): array
47 {
48 global $DIC;
49
50 $lng = $DIC->language();
51 $lng->loadLanguageModule("tax");
52
53 $title = $lng->txt("tax_taxonomy");
54 $icon = $DIC->ui()->factory()->symbol()->icon()->custom(\ilUtil::getImagePath("standard/icon_tax.svg"), $title);
55
56 $tools = [];
57 $additional_data = $called_contexts->current()->getAdditionalData();
58 if ($additional_data->is(self::SHOW_TAX_TREE, true)) {
59 $iff = fn(
60 $id
61 ): \ILIAS\GlobalScreen\Identification\IdentificationInterface => $this->identification_provider->contextAwareIdentifier($id);
62 $l = fn(
63 string $content
64 ): \ILIAS\UI\Component\Legacy\Content => $this->dic->ui()->factory()->legacy()->content($content);
65 $tools[] = $this->factory->tool($iff("tree"))
66 ->withTitle($title)
67 ->withSymbol($icon)
68 ->withContentWrapper(fn(
69 ): \ILIAS\UI\Component\Legacy\Content => $l($this->getEditTree(
70 $additional_data->get(self::TAX_TREE_GUI_PATH),
71 $additional_data->get(self::TAX_ID),
72 $additional_data->get(self::TAX_TREE_CMD),
73 $additional_data->get(self::TAX_TREE_PARENT_CMD)
74 )));
75 }
76
77 return $tools;
78 }
79
80 private function getEditTree(array $gui_path, int $tax_id, string $cmd, string $parent_cmd): string
81 {
82 $target_gui = $gui_path[count($gui_path) - 1];
83 $tax_exp = new ilTaxonomyExplorerGUI(
84 $gui_path,
85 $parent_cmd,
86 $tax_id,
87 $target_gui,
88 $cmd
89 );
90
91 return $tax_exp->getHTML();
92 }
93}
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
factory()
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
getEditTree(array $gui_path, int $tax_id, string $cmd, string $parent_cmd)
getToolsForContextStack(CalledContexts $called_contexts)
@inheritDoc
static getImagePath(string $image_name, string $module_path="", string $mode="output", bool $offline=false)
get image path (for images located in a template directory)
Interface Observer \BackgroundTasks Contains several chained tasks and infos about them.
global $lng
Definition: privfeed.php:31
global $DIC
Definition: shib_login.php:26