ILIAS  release_7 Revision v7.30-3-g800a261c036
All Data Structures Namespaces Files Functions Variables Modules Pages
ForumGlobalScreenToolsProvider.php
Go to the documentation of this file.
1 <?php declare(strict_types=1);
2 
4 
11 {
12  const SHOW_FORUM_THREADS_TOOL = 'show_forum_threads_tool';
13  const REF_ID = 'ref_id';
14  const FORUM_THEAD = 'frm_thread';
15  const FORUM_THREAD_ROOT = 'frm_thread_root';
16  const FORUM_BASE_CONTROLLER = 'frm_base_controller';
17  const PAGE = 'frm_thread_page';
18 
22  public function isInterestedInContexts() : \ILIAS\GlobalScreen\ScreenContext\Stack\ContextCollection
23  {
24  return $this->context_collection->main()->repository()->administration();
25  }
26 
27 
31  public function getToolsForContextStack(\ILIAS\GlobalScreen\ScreenContext\Stack\CalledContexts $called_contexts) : array
32  {
33  $iff = function ($id) {
34  return $this->identification_provider->contextAwareIdentifier($id);
35  };
36  $l = function (string $content) {
37  return $this->dic->ui()->factory()->legacy($content);
38  };
39 
40  $tools = [];
41 
42  $additionalData = $called_contexts->getLast()->getAdditionalData();
43  if ($additionalData->exists(self::SHOW_FORUM_THREADS_TOOL) && $additionalData->get(self::SHOW_FORUM_THREADS_TOOL) === true) {
44  $thread = $additionalData->get(self::FORUM_THEAD);
45  $controller = $additionalData->get(self::FORUM_BASE_CONTROLLER);
46  $root = $additionalData->get(self::FORUM_THREAD_ROOT);
47 
48  if ($root instanceof ilForumPost) {
49  $title = $this->dic->language()->txt('forums_articles');
50  $icon = $this->dic->ui()->factory()->symbol()->icon()->standard('frm', $title)->withIsOutlined(true);
51 
52  $tools[] = $this->factory
53  ->tool($iff('Forum|Tree'))
54  ->withTitle($title)
55  ->withSymbol($icon)
56  ->withContentWrapper(static function () use ($l, $controller, $thread, $root, $additionalData) {
57  $exp = new ilForumExplorerGUI(
58  'frm_exp_' . $thread->getId(),
59  $controller,
60  'viewThread',
61  $thread,
62  $root
63  );
64 
65  $exp->setCurrentPage((int) $additionalData->get(self::PAGE));
66 
67  return $l($exp->getHTML(true));
68  });
69  }
70  }
71 
72  return $tools;
73  }
74 }
setCurrentPage(int $currentPage)
Class ilForumExplorerGUI.
getToolsForContextStack(\ILIAS\GlobalScreen\ScreenContext\Stack\CalledContexts $called_contexts)
Class ChatMainBarProvider .
Class ForumGlobalScreenToolsProvider.