ILIAS  release_7 Revision v7.30-3-g800a261c036
ilLMGSToolProvider Class Reference

Class ilLMGSToolProvider. More...

+ Inheritance diagram for ilLMGSToolProvider:
+ Collaboration diagram for ilLMGSToolProvider:

Public Member Functions

 isInterestedInContexts ()
 @inheritDoc More...
 
 getToolsForContextStack (CalledContexts $called_contexts)
 @inheritDoc More...
 
 getOfflineToolIds ()
 
 getTocTool ($additional_data)
 Get toc tool. More...
 
- Public Member Functions inherited from ILIAS\GlobalScreen\Scope\Tool\Provider\AbstractDynamicToolProvider
 __construct (Container $dic)
 @inheritDoc More...
 
- Public Member Functions inherited from ILIAS\GlobalScreen\Provider\AbstractProvider
 __construct (Container $dic)
 @inheritDoc More...
 
 getFullyQualifiedClassName ()
 @inheritDoc More...
 
 getProviderNameForPresentation ()
 
 getFullyQualifiedClassName ()
 
 getProviderNameForPresentation ()
 
 getToolsForContextStack (CalledContexts $called_contexts)
 
 isInterestedInContexts ()
 

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 ($additional_data)
 toc More...
 

Additional Inherited Members

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

Detailed Description

Member Function Documentation

◆ getLinkSlateContent()

ilLMGSToolProvider::getLinkSlateContent ( string  $type)
protected
Parameters
string
Returns
string

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

226 : string
227 {
228 return "<div style='height:100%; overflow:hidden;' id='" . $type . "_area'><iframe style='border:0; padding:0; height:100%; width:100%'></iframe></div>";
229 }
$type

References $type.

Referenced by getToolsForContextStack().

+ Here is the caller graph for this function:

◆ getOfflineToolIds()

ilLMGSToolProvider::getOfflineToolIds ( )
Parameters

return

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

149 {
150 $iff = function ($id) {
151 return $this->identification_provider->contextAwareIdentifier($id);
152 };
153 return [
154 $this->hash($iff("lm_pres_toc")->serialize()),
155 $this->hash($iff("lm_glossary")->serialize()),
156 $this->hash($iff("lm_media")->serialize()),
157 $this->hash($iff("lm_faq")->serialize())
158 ];
159 }

◆ getToc()

ilLMGSToolProvider::getToc (   $additional_data)
private

toc

Parameters
int$ref_id
Returns
string

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

200 : string
201 {
202 global $DIC;
203 // get params via additional_data, set query params
204 $params = $additional_data->get(self::LM_QUERY_PARAMS);
205 $offline = $additional_data->is(self::LM_OFFLINE, true);
206
207 if (!is_array($params)) {
208 $params = $_GET;
209 }
210 try {
211 $service = new ilLMPresentationService($DIC->user(), $params, $offline);
212 $renderer = new ilLMSlateTocRendererGUI($service);
213
214 return $renderer->render();
215 } catch (Exception $e) {
216 return "";
217 }
218 }
$_GET["client_id"]
Main service init and factory.
global $DIC
Definition: goto.php:24
$service
Definition: result.php:17

References $_GET, $DIC, Vendor\Package\$e, and $service.

Referenced by getTocTool().

+ Here is the caller graph for this function:

◆ getTocTool()

ilLMGSToolProvider::getTocTool (   $additional_data)

Get toc tool.

Parameters

return

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

169 {
170 global $DIC;
171
172 $lng = $DIC->language();
173
174 $iff = function ($id) {
175 return $this->identification_provider->contextAwareIdentifier($id);
176 };
177 $l = function (string $content) {
178 return $this->dic->ui()->factory()->legacy($content);
179 };
180
181 $title = $lng->txt("cont_toc");
182 $icon = $DIC->ui()->factory()->symbol()->icon()->custom(\ilUtil::getImagePath("outlined/icon_chp.svg"), $title);
183 return $this->factory->tool($iff("lm_pres_toc"))
184 ->withTitle($title)
185 ->withContentWrapper(function () use ($l, $additional_data) {
186 return $l($this->getToc($additional_data));
187 })
188 ->withSymbol($icon)
189 ->withPosition(10);
190 }
getToc($additional_data)
toc
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)
withSymbol(Symbol $symbol)
@inheritDoc
$lng

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

Referenced by getToolsForContextStack().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getToolsForContextStack()

ilLMGSToolProvider::getToolsForContextStack ( CalledContexts  $called_contexts)

@inheritDoc

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

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

35 : array
36 {
37 global $DIC;
38 $lng = $DIC->language();
39 $access = $DIC->access();
40
41 $lng->loadLanguageModule("content");
42
43 $tools = [];
44 $additional_data = $called_contexts->current()->getAdditionalData();
45 $iff = function ($id) {
46 return $this->identification_provider->contextAwareIdentifier($id);
47 };
48 $l = function (string $content) {
49 return $this->dic->ui()->factory()->legacy($content);
50 };
51
52 if ($additional_data->is(self::SHOW_TOC_TOOL, true)) {
53 $ref_id = $called_contexts->current()->getReferenceId()->toInt();
54
55 if (!$access->checkAccess("read", "", $ref_id)) {
56 return $tools;
57 }
58
59
60 $tools[] = $this->getTocTool($additional_data);
61 }
62
63 if ($additional_data->is(self::SHOW_LINK_SLATES, true)) {
64 $title = $lng->txt("obj_glo");
65 $icon = $DIC->ui()->factory()->symbol()->icon()->custom(\ilUtil::getImagePath("outlined/icon_glo.svg"), $title);
66 $identification = $iff("lm_glossary");
67 $hashed = $this->hash($identification->serialize());
68 $tools[] = $this->factory->tool($identification)
69 ->addComponentDecorator(static function (ILIAS\UI\Component\Component $c) use ($hashed) : ILIAS\UI\Component\Component {
70 if ($c instanceof LegacySlate) {
71 $signal_id = $c->getToggleSignal()->getId();
72 return $c->withAdditionalOnLoadCode(static function ($id) use ($hashed) {
73 return "
74 $('body').on('il-lm-show-glossary-slate', function(){
75 il.UI.maincontrols.mainbar.engageTool('$hashed');
76 });";
77 });
78 }
79 return $c;
80 })
81 ->withInitiallyHidden(true)
82 ->withTitle($title)
83 ->withContentWrapper(function () use ($l) {
84 return $l($this->getLinkSlateContent("glossary"));
85 })
86 ->withSymbol($icon)
87 ->withPosition(11);
88
89 $title = $lng->txt("cont_tool_media");
90 $icon = $DIC->ui()->factory()->symbol()->icon()->custom(\ilUtil::getImagePath("outlined/icon_mdia.svg"), $title);
91 $identification = $iff("lm_media");
92 $hashed = $this->hash($identification->serialize());
93 $tools[] = $this->factory->tool($identification)
94 ->addComponentDecorator(static function (ILIAS\UI\Component\Component $c) use ($hashed) : ILIAS\UI\Component\Component {
95 if ($c instanceof LegacySlate) {
96 $signal_id = $c->getToggleSignal()->getId();
97 return $c->withAdditionalOnLoadCode(static function ($id) use ($hashed) {
98 return "
99 $('body').on('il-lm-show-media-slate', function(){
100 il.UI.maincontrols.mainbar.engageTool('$hashed');
101 });";
102 });
103 }
104 return $c;
105 })
106 ->withInitiallyHidden(true)
107 ->withTitle($title)
108 ->withContentWrapper(function () use ($l) {
109 return $l($this->getLinkSlateContent("media"));
110 })
111 ->withSymbol($icon)
112 ->withPosition(12);
113
114 $title = $lng->txt("cont_tool_faq");
115 $icon = $DIC->ui()->factory()->symbol()->icon()->custom(\ilUtil::getImagePath("outlined/icon_faq.svg"), $title);
116 $identification = $iff("lm_faq");
117 $hashed = $this->hash($identification->serialize());
118 $tools[] = $this->factory->tool($identification)
119 ->addComponentDecorator(static function (ILIAS\UI\Component\Component $c) use ($hashed) : ILIAS\UI\Component\Component {
120 if ($c instanceof LegacySlate) {
121 $signal_id = $c->getToggleSignal()->getId();
122 return $c->withAdditionalOnLoadCode(static function ($id) use ($hashed) {
123 return "
124 $('body').on('il-lm-show-faq-slate', function(){
125 il.UI.maincontrols.mainbar.engageTool('$hashed');
126 });";
127 });
128 }
129 return $c;
130 })
131 ->withInitiallyHidden(true)
132 ->withTitle($title)
133 ->withContentWrapper(function () use ($l) {
134 return $l($this->getLinkSlateContent("faq"));
135 })
136 ->withSymbol($icon)
137 ->withPosition(13);
138 }
139 return $tools;
140 }
getTocTool($additional_data)
Get toc tool.
$c
Definition: cli.php:37
Class ChatMainBarProvider \MainMenu\Provider.
Class Factory.

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

+ Here is the call graph for this function:

◆ isInterestedInContexts()

ilLMGSToolProvider::isInterestedInContexts ( )

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 18 of file class.ilLMGSToolProvider.php.

◆ SHOW_TOC_TOOL

const ilLMGSToolProvider::SHOW_TOC_TOOL = 'show_toc_tool'

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


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