ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
SystemStylesGlobalScreenToolProvider.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
26
31{
35 public function isInterestedInContexts(): \ILIAS\GlobalScreen\ScreenContext\Stack\ContextCollection
36 {
37 return $this->context_collection->administration();
38 }
39
43 public function getToolsForContextStack(
44 \ILIAS\GlobalScreen\ScreenContext\Stack\CalledContexts $called_contexts
45 ): array {
46 $last_context = $called_contexts->getLast();
47
48 if ($last_context) {
49 $additional_data = $last_context->getAdditionalData();
50 if ($additional_data->is(ilSystemStyleDocumentationGUI::SHOW_TREE, true)) {
51 return [$this->buildTreeAsTool()];
52 }
53 }
54
55 return [];
56 }
57
58 protected function buildTreeAsTool(): Tool
59 {
60 $id_generator = function ($id) {
61 return $this->identification_provider->contextAwareIdentifier($id);
62 };
63
64 $title = $this->dic->language()->txt('documentation');
65 $icon = $this->dic->ui()->factory()->symbol()->icon()->standard('stys', $title);
66
70 return $this->factory
71 ->tool($id_generator('system_styles_tree'))
72 ->withTitle($title)
73 ->withSymbol($icon)
74 ->withContent($this->dic->ui()->factory()->legacy()->content($this->dic->ui()->renderer()->render($this->getUITree())));
75 }
76
77 protected function getUITree(): Tree
78 {
79 $entries = new Entries();
80 $entries->addEntriesFromArray(require ilKitchenSinkDataCollectedObjective::PATH());
81
82 $parent_class_hierarchy = ['ilAdministrationGUI',
83 'ilObjStyleSettingsGUI',
84 'ilSystemStyleMainGUI',
85 'ilSystemStyleDocumentationGUI'
86 ];
87
88 $parent_link = $this->dic->ctrl()->getLinkTargetByClass($parent_class_hierarchy, 'entries');
89 $parent_uri = new URI(ILIAS_HTTP_PATH . '/' . $parent_link);
90
91 $refinery = $this->dic->refinery();
92 $request_wrapper = $this->dic->http()->wrapper()->query();
93 $current_opened_node_id = '';
94 if ($request_wrapper->has('node_id')) {
95 $current_opened_node_id = $request_wrapper->retrieve('node_id', $refinery->kindlyTo()->string());
96 }
97
98 $recursion = new KSDocumentationTreeRecursion($entries, $parent_uri, $current_opened_node_id);
99 $f = $this->dic->ui()->factory();
100
101 return $f->tree()->expandable('Label', $recursion)
102 ->withData([$entries->getRootEntry()])
103 ->withHighlightOnNodeClick(true);
104 }
105}
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
factory()
The scope of this class is split ilias-conform URI's into components.
Definition: URI.php:35
Container storing a list of UI Component Entries, can act as Iterator, countable and is serializable.
Tree Recursion, putting Entries into a Tree.
Provider for the Tree in the Main Bar Slate showing the UI Components.
getToolsForContextStack(\ILIAS\GlobalScreen\ScreenContext\Stack\CalledContexts $called_contexts)
@inheritDoc
This describes a Tree Control.
Definition: Tree.php:29
Interface Observer \BackgroundTasks Contains several chained tasks and infos about them.