ILIAS  release_8 Revision v8.19
All Data Structures Namespaces Files Functions Variables Modules Pages
SystemStylesGlobalScreenToolProvider.php
Go to the documentation of this file.
1 <?php
2 
19 declare(strict_types=1);
20 
25 use ILIAS\Data\URI;
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($this->dic->ui()->renderer()->render($this->getUITree())));
75  }
76 
77  protected function getUITree(): Tree
78  {
79  $entries = new Entries();
80  $entries->addEntriesFromArray(include ilSystemStyleDocumentationGUI::DATA_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 }
Tree Recursion, putting Entries into a Tree.
Class ChatMainBarProvider .
Container storing a list of UI Component Entries, can act as Iterator, countable and is serializable...
Provider for the Tree in the Main Bar Slate showing the UI Components.
getToolsForContextStack(\ILIAS\GlobalScreen\ScreenContext\Stack\CalledContexts $called_contexts)
The scope of this class is split ilias-conform URI&#39;s into components.
Definition: URI.php:34
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This describes a Tree Control.
Definition: Tree.php:28
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
Refinery Factory $refinery