ILIAS  release_8 Revision v8.19-1-g4e8f2f9140c
All Data Structures Namespaces Files Functions Variables Modules Pages
ilLMGSToolProvider Class Reference
+ Inheritance diagram for ilLMGSToolProvider:
+ Collaboration diagram for ilLMGSToolProvider:

Public Member Functions

 isInterestedInContexts ()
 
 getToolsForContextStack (CalledContexts $called_contexts)
 
 getOfflineToolIds ()
 
 getTocTool (Collection $additional_data)
 
- Public Member Functions inherited from ILIAS\GlobalScreen\Scope\Tool\Provider\AbstractDynamicToolProvider
 __construct (Container $dic)
 
- Public Member Functions inherited from ILIAS\GlobalScreen\Provider\AbstractProvider
 __construct (Container $dic)
 
 getFullyQualifiedClassName ()
 
 getProviderNameForPresentation ()
 

Data Fields

const SHOW_TOC_TOOL = 'show_toc_tool'
 
const SHOW_LINK_SLATES = 'show_link_slates'
 
const LM_QUERY_PARAMS = 'lm_query_params'
 
const LM_OFFLINE = 'lm_offline'
 

Protected Member Functions

 getLinkSlateContent (string $type)
 
- Protected Member Functions inherited from ILIAS\GlobalScreen\Provider\AbstractProvider
 globalScreen ()
 

Private Member Functions

 getToc (Collection $additional_data)
 

Additional Inherited Members

- Protected Attributes inherited from ILIAS\GlobalScreen\Scope\Tool\Provider\AbstractDynamicToolProvider
ToolIdentificationProviderInterface $identification_provider
 
ContextCollection $context_collection
 
ToolFactory $factory
 
- Protected Attributes inherited from ILIAS\GlobalScreen\Provider\AbstractProvider
Container $dic
 

Detailed Description

Author
Alexander Killing killi.nosp@m.ng@l.nosp@m.eifos.nosp@m..de

Definition at line 29 of file class.ilLMGSToolProvider.php.

Member Function Documentation

◆ getLinkSlateContent()

ilLMGSToolProvider::getLinkSlateContent ( string  $type)
protected

Definition at line 213 of file class.ilLMGSToolProvider.php.

Referenced by getToolsForContextStack().

213  : string
214  {
215  return "<div style='height:100%; overflow:hidden;' id='" . $type . "_area'><iframe style='border:0; padding:0; height:100%; width:100%'></iframe></div>";
216  }
$type
+ Here is the caller graph for this function:

◆ getOfflineToolIds()

ilLMGSToolProvider::getOfflineToolIds ( )

Definition at line 150 of file class.ilLMGSToolProvider.php.

References $id.

150  : array
151  {
152  $iff = function ($id) {
153  return $this->identification_provider->contextAwareIdentifier($id);
154  };
155  return [
156  $this->hash($iff("lm_pres_toc")->serialize()),
157  $this->hash($iff("lm_glossary")->serialize()),
158  $this->hash($iff("lm_media")->serialize()),
159  $this->hash($iff("lm_faq")->serialize())
160  ];
161  }
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23

◆ getToc()

ilLMGSToolProvider::getToc ( Collection  $additional_data)
private

Definition at line 189 of file class.ilLMGSToolProvider.php.

References $DIC, $params, $service, ILIAS\GlobalScreen\ScreenContext\AdditionalData\Collection\exists(), ILIAS\GlobalScreen\ScreenContext\AdditionalData\Collection\get(), and ILIAS\GlobalScreen\ScreenContext\AdditionalData\Collection\is().

Referenced by getTocTool().

189  : string
190  {
191  global $DIC;
192 
193  // get params via additional_data, set query params
194  $params = null;
195  if ($additional_data->exists(self::LM_QUERY_PARAMS)) {
196  $params = $additional_data->get(self::LM_QUERY_PARAMS);
197  }
198  $offline = $additional_data->is(self::LM_OFFLINE, true);
199 
200  if (!is_array($params)) {
201  $params = null;
202  }
203  //try {
204  $service = new ilLMPresentationService($DIC->user(), $params, $offline);
205  $renderer = new ilLMSlateTocRendererGUI($service);
206 
207  return $renderer->render();
208  //} catch (Exception $e) {
209  // return $e->getMessage();
210  //}
211  }
if(! $DIC->user() ->getId()||!ilLTIConsumerAccess::hasCustomProviderCreationAccess()) $params
Definition: ltiregstart.php:33
global $DIC
Definition: feed.php:28
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
$service
Definition: ltiservices.php:43
Main service init and factory.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getTocTool()

ilLMGSToolProvider::getTocTool ( Collection  $additional_data)

Definition at line 163 of file class.ilLMGSToolProvider.php.

References $DIC, $id, $lng, ilUtil\getImagePath(), getToc(), and ILIAS\GlobalScreen\Scope\MainMenu\Factory\withSymbol().

Referenced by getToolsForContextStack().

165  : Tool {
166  global $DIC;
167 
168  $lng = $DIC->language();
169 
170  $iff = function ($id) {
171  return $this->identification_provider->contextAwareIdentifier($id);
172  };
173  $l = function (string $content) {
174  return $this->dic->ui()->factory()->legacy($content);
175  };
176 
177  $title = $lng->txt("cont_toc");
178  $icon = $DIC->ui()->factory()->symbol()->icon()->custom(\ilUtil::getImagePath("icon_chp.svg"), $title);
179  return $this->factory->tool($iff("lm_pres_toc"))
180  ->withTitle($title)
181  ->withContentWrapper(function () use ($l, $additional_data) {
182  return $l($this->getToc($additional_data));
183  })
184  ->withSymbol($icon)
185  ->withPosition(10);
186  }
$lng
static getImagePath(string $img, string $module_path="", string $mode="output", bool $offline=false)
get image path (for images located in a template directory)
getToc(Collection $additional_data)
global $DIC
Definition: feed.php:28
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getToolsForContextStack()

ilLMGSToolProvider::getToolsForContextStack ( CalledContexts  $called_contexts)
Parameters
CalledContexts$called_contexts
Returns
Tool[] These Slates can be passed to the MainMenu dynamic for a specific location/context.
See also
DynamicProvider

Implements ILIAS\GlobalScreen\Scope\Tool\Provider\DynamicToolProvider.

Definition at line 43 of file class.ilLMGSToolProvider.php.

References $c, $DIC, $id, $lng, $ref_id, ILIAS\GlobalScreen\ScreenContext\Stack\CalledContexts\current(), ilUtil\getImagePath(), getLinkSlateContent(), getTocTool(), and ILIAS\GlobalScreen\Scope\MainMenu\Factory\withSymbol().

45  : array {
46  global $DIC;
47  $lng = $DIC->language();
48  $access = $DIC->access();
49 
50  $lng->loadLanguageModule("content");
51 
52  $tools = [];
53  $additional_data = $called_contexts->current()->getAdditionalData();
54  $iff = function ($id) {
55  return $this->identification_provider->contextAwareIdentifier($id);
56  };
57  $l = function (string $content) {
58  return $this->dic->ui()->factory()->legacy($content);
59  };
60 
61  if ($additional_data->is(self::SHOW_TOC_TOOL, true)) {
62  $ref_id = $called_contexts->current()->getReferenceId()->toInt();
63 
64  if (!$access->checkAccess("read", "", $ref_id)) {
65  return $tools;
66  }
67 
68  $tools[] = $this->getTocTool($additional_data);
69  }
70 
71  if ($additional_data->is(self::SHOW_LINK_SLATES, true)) {
72  $title = $lng->txt("obj_glo");
73  $icon = $DIC->ui()->factory()->symbol()->icon()->custom(\ilUtil::getImagePath("icon_glo.svg"), $title);
74  $identification = $iff("lm_glossary");
75  $hashed = $this->hash($identification->serialize());
76  $tools[] = $this->factory->tool($identification)
77  ->addComponentDecorator(static function (ILIAS\UI\Component\Component $c) use ($hashed): ILIAS\UI\Component\Component {
78  if ($c instanceof LegacySlate) {
79  $signal_id = $c->getToggleSignal()->getId();
80  return $c->withAdditionalOnLoadCode(static function ($id) use ($hashed) {
81  return "
82  $('body').on('il-lm-show-glossary-slate', function(){
83  il.UI.maincontrols.mainbar.engageTool('$hashed');
84  });";
85  });
86  }
87  return $c;
88  })
89  ->withInitiallyHidden(true)
90  ->withTitle($title)
91  ->withContentWrapper(function () use ($l) {
92  return $l($this->getLinkSlateContent("glossary"));
93  })
94  ->withSymbol($icon)
95  ->withPosition(11);
96 
97  $title = $lng->txt("cont_tool_media");
98  $icon = $DIC->ui()->factory()->symbol()->icon()->custom(\ilUtil::getImagePath("icon_mdia.svg"), $title);
99  $identification = $iff("lm_media");
100  $hashed = $this->hash($identification->serialize());
101  $tools[] = $this->factory->tool($identification)
102  ->addComponentDecorator(static function (ILIAS\UI\Component\Component $c) use ($hashed): ILIAS\UI\Component\Component {
103  if ($c instanceof LegacySlate) {
104  $signal_id = $c->getToggleSignal()->getId();
105  return $c->withAdditionalOnLoadCode(static function ($id) use ($hashed) {
106  return "
107  $('body').on('il-lm-show-media-slate', function(){
108  il.UI.maincontrols.mainbar.engageTool('$hashed');
109  });";
110  });
111  }
112  return $c;
113  })
114  ->withInitiallyHidden(true)
115  ->withTitle($title)
116  ->withContentWrapper(function () use ($l) {
117  return $l($this->getLinkSlateContent("media"));
118  })
119  ->withSymbol($icon)
120  ->withPosition(12);
121 
122  $title = $lng->txt("cont_tool_faq");
123  $icon = $DIC->ui()->factory()->symbol()->icon()->custom(\ilUtil::getImagePath("icon_faq.svg"), $title);
124  $identification = $iff("lm_faq");
125  $hashed = $this->hash($identification->serialize());
126  $tools[] = $this->factory->tool($identification)
127  ->addComponentDecorator(static function (ILIAS\UI\Component\Component $c) use ($hashed): ILIAS\UI\Component\Component {
128  if ($c instanceof LegacySlate) {
129  $signal_id = $c->getToggleSignal()->getId();
130  return $c->withAdditionalOnLoadCode(static function ($id) use ($hashed) {
131  return "
132  $('body').on('il-lm-show-faq-slate', function(){
133  il.UI.maincontrols.mainbar.engageTool('$hashed');
134  });";
135  });
136  }
137  return $c;
138  })
139  ->withInitiallyHidden(true)
140  ->withTitle($title)
141  ->withContentWrapper(function () use ($l) {
142  return $l($this->getLinkSlateContent("faq"));
143  })
144  ->withSymbol($icon)
145  ->withPosition(13);
146  }
147  return $tools;
148  }
Class Factory.
$c
Definition: cli.php:38
$lng
Class ChatMainBarProvider .
static getImagePath(string $img, string $module_path="", string $mode="output", bool $offline=false)
get image path (for images located in a template directory)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
global $DIC
Definition: feed.php:28
$ref_id
Definition: ltiauth.php:67
getTocTool(Collection $additional_data)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
+ Here is the call graph for this function:

◆ isInterestedInContexts()

ilLMGSToolProvider::isInterestedInContexts ( )
Returns
ContextCollection

Implements ILIAS\GlobalScreen\ScreenContext\ScreenContextAwareProvider.

Definition at line 38 of file class.ilLMGSToolProvider.php.

References ILIAS\GlobalScreen\ScreenContext\Stack\ContextCollection\main().

+ Here is the call graph for this function:

Field Documentation

◆ LM_OFFLINE

const ilLMGSToolProvider::LM_OFFLINE = 'lm_offline'

◆ LM_QUERY_PARAMS

const ilLMGSToolProvider::LM_QUERY_PARAMS = 'lm_query_params'

◆ SHOW_LINK_SLATES

const ilLMGSToolProvider::SHOW_LINK_SLATES = 'show_link_slates'

Definition at line 34 of file class.ilLMGSToolProvider.php.

Referenced by ilLMPresentationGUI\__construct().

◆ SHOW_TOC_TOOL

const ilLMGSToolProvider::SHOW_TOC_TOOL = 'show_toc_tool'

Definition at line 33 of file class.ilLMGSToolProvider.php.

Referenced by ilLMPresentationGUI\__construct().


The documentation for this class was generated from the following file: