ILIAS  trunk Revision v11.0_alpha-2638-g80c1d007f79
ForumGlobalScreenToolsProvider.php
Go to the documentation of this file.
1 <?php
2 
19 declare(strict_types=1);
20 
24 
30 {
31  public const SHOW_FORUM_THREADS_TOOL = 'show_forum_threads_tool';
32  public const REF_ID = 'ref_id';
33  public const FORUM_THEAD = 'frm_thread';
34  public const FORUM_THREAD_ROOT = 'frm_thread_root';
35  public const FORUM_BASE_CONTROLLER = 'frm_base_controller';
36  public const PAGE = 'frm_thread_page';
37 
38  public function isInterestedInContexts(): \ILIAS\GlobalScreen\ScreenContext\Stack\ContextCollection
39  {
40  return $this->context_collection->main()->repository()->administration();
41  }
42 
43  public function getToolsForContextStack(
44  \ILIAS\GlobalScreen\ScreenContext\Stack\CalledContexts $called_contexts
45  ): array {
46  $iff = (fn(string $id): IdentificationInterface => $this->identification_provider->contextAwareIdentifier($id));
47  $l = (fn(string $content): Component => $this->dic->ui()->factory()->legacy()->content($content));
48 
49  $tools = [];
50 
51  $additionalData = $called_contexts->getLast()->getAdditionalData();
52  if ($additionalData->exists(self::SHOW_FORUM_THREADS_TOOL) && $additionalData->get(self::SHOW_FORUM_THREADS_TOOL) === true) {
53  $thread = $additionalData->get(self::FORUM_THEAD);
54  $controller = $additionalData->get(self::FORUM_BASE_CONTROLLER);
55  $root = $additionalData->get(self::FORUM_THREAD_ROOT);
56 
57  if ($root instanceof ilForumPost) {
58  $title = $this->dic->language()->txt('forums_articles');
59  $icon = $this->dic->ui()->factory()->symbol()->icon()->standard('frm', $title);
60 
61  $tools[] = $this->factory
62  ->tool($iff('Forum|Tree'))
63  ->withTitle($title)
64  ->withSymbol($icon)
65  ->withContentWrapper(static function () use ($l, $controller, $thread, $root): Component {
66  $exp = new ilForumExplorerGUI(
67  'frm_exp_' . $thread->getId(),
68  $controller,
69  'viewThread',
70  $thread,
71  $root
72  );
73 
74  return $l($exp->getHTML(true));
75  });
76  }
77  }
78 
79  return $tools;
80  }
81 }
Class ilForumExplorerGUI.
getToolsForContextStack(\ILIAS\GlobalScreen\ScreenContext\Stack\CalledContexts $called_contexts)
Interface Observer Contains several chained tasks and infos about them.
factory()
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Class ForumGlobalScreenToolsProvider.
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...