ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
class.ilRTEGlobalTemplate.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
27{
28 protected string $tree_flat_link = '';
29 protected string $page_form_action = '';
30 protected bool $permanent_link = false;
31 protected bool $standard_template_loaded = false;
33 protected string $body_class = '';
38 protected array $js_files = [0 => 'assets/js/Basic.js'];
39
44 protected array $js_files_vp = ['assets/js/Basic.js' => true];
45
50 protected array $js_files_batch = ['assets/js/Basic.js' => 1];
51
52 public function __construct(
53 string $file,
54 bool $flag1,
55 bool $flag2,
56 string $in_module = '',
57 string $vars = 'DEFAULT',
58 bool $plugin = false,
59 bool $a_use_cache = true
60 ) {
61 $this->setBodyClass('std');
62 $this->template = new ilTemplate($file, $flag1, $flag2, $in_module, $vars, $plugin, $a_use_cache);
63 }
64
65 public function printToString(): string
66 {
67 throw new ilException('not implemented');
68 }
69
70 public function hideFooter(): void
71 {
72 }
73
74 public function setOnScreenMessage(string $type, string $a_txt, bool $a_keep = false): void
75 {
76 }
77
78 public function addJavaScript(string $a_js_file, bool $a_add_version_parameter = true, int $a_batch = 2): void
79 {
80 // three batches currently
81 if ($a_batch < 1 || $a_batch > 3) {
82 $a_batch = 2;
83 }
84
85 // ensure jquery files being loaded first
86 if (
87 is_int(strpos($a_js_file, 'components/ILIAS/jQuery')) ||
88 is_int(strpos($a_js_file, '/jquery.js')) ||
89 is_int(strpos($a_js_file, '/jquery-min.js'))
90 ) {
91 $a_batch = 0;
92 }
93
94 if (!in_array($a_js_file, $this->js_files, true)) {
95 $this->js_files[] = $a_js_file;
96 $this->js_files_vp[$a_js_file] = $a_add_version_parameter;
97 $this->js_files_batch[$a_js_file] = $a_batch;
98 }
99 }
100
101 public function addOnLoadCode(string $a_code, int $a_batch = 2): void
102 {
103 }
104
105
106 public function getOnLoadCodeForAsynch(): string
107 {
108 return '';
109 }
110
111 public function resetJavascript(): void
112 {
113 $this->js_files = [];
114 $this->js_files_vp = [];
115 $this->js_files_batch = [];
116 }
117
118 public function fillJavaScriptFiles(bool $a_force = false): void
119 {
120 global $DIC;
121
122 $ilSetting = $DIC->settings();
123
124 $vers = '';
125 if (is_object($ilSetting)) {
126 $vers = 'vers=' . str_replace(['.', ' '], '-', ILIAS_VERSION);
127
128 if (defined('DEVMODE') && DEVMODE) {
129 $vers .= '-' . time();
130 }
131 }
132
133 if ($this->blockExists('js_file')) {
134 for ($i = 0; $i <= 3; $i++) {
135 reset($this->js_files);
136 foreach ($this->js_files as $file) {
137 if ($this->js_files_batch[$file] === $i) {
138 if ($a_force || is_file($file) || strpos($file, 'http') === 0 || strpos($file, '//') === 0) {
139 $this->fillJavascriptFile($file, $vers);
140 } elseif (strpos($file, './') === 0) { // #13962
141 $url_parts = parse_url($file);
142 if (is_file($url_parts['path'])) {
143 $this->fillJavascriptFile($file, $vers);
144 }
145 }
146 }
147 }
148 }
149 }
150 }
151
152 protected function fillJavascriptFile(string $file, string $vers): void
153 {
154 $this->setCurrentBlock('js_file');
155 if ($this->js_files_vp[$file]) {
156 $this->setVariable('JS_FILE', ilUtil::appendUrlParameterString($file, $vers));
157 } else {
158 $this->setVariable('JS_FILE', $file);
159 }
160 $this->parseCurrentBlock();
161 }
162
163 public function addCss(string $a_css_file, string $media = "screen"): void
164 {
165 }
166
167 public function addInlineCss(string $a_css, string $media = "screen"): void
168 {
169 }
170
171 public function setBodyClass(string $a_class = ''): void
172 {
173 $this->body_class = $a_class;
174 }
175
176 private function fillBodyClass(): void
177 {
178 if ($this->body_class !== '' && $this->blockExists('body_class')) {
179 $this->setCurrentBlock('body_class');
180 $this->setVariable('BODY_CLASS', $this->body_class);
181 $this->parseCurrentBlock();
182 }
183 }
184
185 public function loadStandardTemplate(): void
186 {
187 if ($this->standard_template_loaded) {
188 return;
189 }
190
193
194 $this->addBlockFile('CONTENT', 'content', 'tpl.adm_content.html');
195 $this->addBlockFile('STATUSLINE', 'statusline', 'tpl.statusline.html');
196
197 $this->standard_template_loaded = true;
198 }
199
200 public function setTitle(string $a_title, bool $hidden = false): void
201 {
202 }
203
204 public function setDescription(string $a_descr): void
205 {
206 }
207
208 public function setTitleIcon(string $a_icon_path, string $a_icon_desc = ""): void
209 {
210 }
211
212 public function setAlertProperties(array $alerts): void
213 {
214 }
215
216 public function clearHeader(): void
217 {
218 }
219
220 public function setHeaderActionMenu(string $a_header): void
221 {
222 }
223
224 public function setHeaderPageTitle(string $a_title): void
225 {
226 }
227
228 public function setLocator(): void
229 {
230 }
231
232 public function setTabs(string $a_tabs_html): void
233 {
234 }
235
236
237 public function setSubTabs(string $a_tabs_html): void
238 {
239 }
240
241 public function setContent(string $a_html): void
242 {
243 }
244
245 public function setLeftContent(string $a_html): void
246 {
247 }
248
249 public function setLeftNavContent(string $a_content): void
250 {
251 }
252
253 public function setRightContent(string $a_html): void
254 {
255 }
256
257 public function setPageFormAction(string $a_action): void
258 {
259 }
260
261 public function setLoginTargetPar(string $a_val): void
262 {
263 }
264
265 public function getSpecial(
266 string $part = self::DEFAULT_BLOCK,
267 bool $add_error_mess = false,
268 bool $handle_referer = false,
269 bool $add_ilias_footer = false,
270 bool $add_standard_elements = false,
271 bool $a_main_menu = true,
272 bool $a_tabs = true
273 ): string {
274 return '';
275 }
276
277 public function printToStdout(
278 string $part = self::DEFAULT_BLOCK,
279 bool $has_tabs = true,
280 bool $skip_main_menu = false
281 ): void {
282 global $DIC;
283
284 $http = $DIC->http();
285 switch ($http->request()->getHeaderLine('Accept')) {
286 default:
288
289 header('P3P: CP="CURa ADMa DEVa TAIa PSAa PSDa IVAa IVDa OUR BUS IND UNI COM NAV INT CNT STA PRE"');
290 header('Content-type: text/html; charset=UTF-8');
291
292 $this->fillBodyClass();
293 if ($has_tabs) {
294 $this->setCurrentBlock(self::DEFAULT_BLOCK);
295 $this->fillJavaScriptFiles();
296 }
297
298 if ($part === self::DEFAULT_BLOCK) {
299 $html = $this->template->getUnmodified();
300 } else {
301 $html = $this->template->getUnmodified($part);
302 }
303
304 print $html;
305
306 break;
307 }
308 }
309
310 public function setTreeFlatIcon(string $a_link, string $a_mode): void
311 {
312 }
313
314 public function addAdminPanelToolbar(
315 ilToolbarGUI $toolbar,
316 bool $is_bottom_panel = true,
317 bool $has_arrow = false
318 ): void {
319 }
320
321 public function setPermanentLink(
322 string $a_type,
323 ?int $a_id,
324 string $a_append = "",
325 string $a_target = "",
326 string $a_title = ""
327 ): void {
328 }
329
330 public function resetHeaderBlock(bool $a_reset_header_action = true): void
331 {
332 }
333
334 public function setFileUploadRefId(int $a_ref_id): void
335 {
336 }
337
338 public function get(string $part = self::DEFAULT_BLOCK): string
339 {
340 return $this->template->get($part);
341 }
342
343 public function setVariable(string $variable, $value = ''): void
344 {
345 $this->template->setVariable($variable, $value);
346 }
347
348 public function setCurrentBlock(string $part = self::DEFAULT_BLOCK): bool
349 {
350 return $this->template->setCurrentBlock($part);
351 }
352
353 public function touchBlock(string $block): bool
354 {
355 return $this->template->touchBlock($block);
356 }
357
358 public function parseCurrentBlock(string $block_name = self::DEFAULT_BLOCK): bool
359 {
360 return $this->template->parseCurrentBlock($block_name);
361 }
362
363 public function addBlockFile(string $var, string $block, string $template_name, ?string $in_module = null): bool
364 {
365 return $this->template->addBlockFile($var, $block, $template_name, $in_module);
366 }
367
368 public function blockExists(string $block_name): bool
369 {
370 return $this->template->blockExists($block_name);
371 }
372}
return true
Base class for ILIAS Exception handling.
Special template class to simplify handling of ITX/PEAR.
setLoginTargetPar(string $a_val)
Set target parameter for login (public sector).
addJavaScript(string $a_js_file, bool $a_add_version_parameter=true, int $a_batch=2)
Add a javascript file that should be included in the header.
addAdminPanelToolbar(ilToolbarGUI $toolbar, bool $is_bottom_panel=true, bool $has_arrow=false)
fillJavaScriptFiles(bool $a_force=false)
Probably adds javascript files.
addCss(string $a_css_file, string $media="screen")
Add a css file that should be included in the header.
setAlertProperties(array $alerts)
Set alert properties.
setFileUploadRefId(int $a_ref_id)
Enables the file upload into this object by dropping a file.
setBodyClass(string $a_class='')
Sets the body-tags class.
blockExists(string $block_name)
check if block exists in actual template
printToString()
Use this method to get the finally rendered page as string.
setLeftNavContent(string $a_content)
Sets content of left navigation column.
setCurrentBlock(string $part=self::DEFAULT_BLOCK)
Sets the template to the given block.
getSpecial(string $part=self::DEFAULT_BLOCK, bool $add_error_mess=false, bool $handle_referer=false, bool $add_ilias_footer=false, bool $add_standard_elements=false, bool $a_main_menu=true, bool $a_tabs=true)
Renders the page with specific elements enabled.
parseCurrentBlock(string $block_name=self::DEFAULT_BLOCK)
Parses the given block.
addInlineCss(string $a_css, string $media="screen")
Add a css file that should be included in the header.
addBlockFile(string $var, string $block, string $template_name, ?string $in_module=null)
overwrites ITX::addBlockFile
setRightContent(string $a_html)
Sets content of right column.
setContent(string $a_html)
Sets content for standard template.
setTreeFlatIcon(string $a_link, string $a_mode)
Sets a tree or flat icon.
touchBlock(string $block)
overwrites ITX::touchBlock.
setTitle(string $a_title, bool $hidden=false)
Sets title in standard template.
setTabs(string $a_tabs_html)
sets tabs in standard template
setTitleIcon(string $a_icon_path, string $a_icon_desc="")
set title icon
setHeaderPageTitle(string $a_title)
Sets the title of the page (for browser window).
__construct(string $file, bool $flag1, bool $flag2, string $in_module='', string $vars='DEFAULT', bool $plugin=false, bool $a_use_cache=true)
loadStandardTemplate()
This loads the standard template "tpl.adm_content.html" and "tpl.statusline.html" the CONTENT and STA...
addOnLoadCode(string $a_code, int $a_batch=2)
Add on load code.
setPageFormAction(string $a_action)
Sets the pages form action.
setLeftContent(string $a_html)
Sets content of left column.
setOnScreenMessage(string $type, string $a_txt, bool $a_keep=false)
Set a message to be displayed to the user.
fillJavascriptFile(string $file, string $vers)
resetJavascript()
Reset javascript files.
setVariable(string $variable, $value='')
Sets the given variable to the given value.
setHeaderActionMenu(string $a_header)
Set header action menu.
setSubTabs(string $a_tabs_html)
sets subtabs in standard template
hideFooter()
Make the template hide the footer.
printToStdout(string $part=self::DEFAULT_BLOCK, bool $has_tabs=true, bool $skip_main_menu=false)
getOnLoadCodeForAsynch()
Get js onload code for ajax calls.
setDescription(string $a_descr)
Sets description below title in standard template.
special template class to simplify handling of ITX/PEAR
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static appendUrlParameterString(string $a_url, string $a_par, bool $xml_style=false)
static initDom(?ilGlobalTemplateInterface $a_main_tpl=null)
Init YUI Dom.
static initjQueryUI(?ilGlobalTemplateInterface $a_tpl=null)
inits and adds the jQuery-UI JS-File to the global template (see included_components....
static initjQuery(?ilGlobalTemplateInterface $a_tpl=null)
inits and adds the jQuery JS-File to the global or a passed template
$http
Definition: deliver.php:30
return['delivery_method'=> 'php',]
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
const ILIAS_VERSION
global $ilSetting
Definition: privfeed.php:31
global $DIC
Definition: shib_login.php:26