ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
ilLMGSToolProvider Class Reference

Class ilLMGSToolProvider. More...

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

Public Member Functions

 isInterestedInContexts ()
 
 getToolsForContextStack (CalledContexts $called_contexts)
 
 getOfflineToolIds ()
 
 getTocTool ($additional_data)
 Get toc tool. More...
 
- 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 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 225 of file class.ilLMGSToolProvider.php.

Referenced by getToolsForContextStack().

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

◆ getOfflineToolIds()

ilLMGSToolProvider::getOfflineToolIds ( )
Parameters

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

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

◆ getToc()

ilLMGSToolProvider::getToc (   $additional_data)
private

toc

Parameters
int$ref_id
Returns
string

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

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

Referenced by getTocTool().

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

◆ getTocTool()

ilLMGSToolProvider::getTocTool (   $additional_data)

Get toc tool.

Parameters

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

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

Referenced by getToolsForContextStack().

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

◆ getToolsForContextStack()

ilLMGSToolProvider::getToolsForContextStack ( CalledContexts  $called_contexts)

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

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

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

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

const ilLMGSToolProvider::SHOW_TOC_TOOL = 'show_toc_tool'

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

Referenced by ilLMPresentationGUI\__construct().


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