TYPO3 CMS  TYPO3_7-6
TypoScriptTemplateObjectBrowserModuleFunctionController.php
Go to the documentation of this file.
1 <?php
3 
4 /*
5  * This file is part of the TYPO3 CMS project.
6  *
7  * It is free software; you can redistribute it and/or modify it under
8  * the terms of the GNU General Public License, either version 2
9  * of the License, or any later version.
10  *
11  * For the full copyright and license information, please read the
12  * LICENSE.txt file that was distributed with this source code.
13  *
14  * The TYPO3 project - inspiring people to share!
15  */
16 
31 
36 {
40  public $pObj;
41 
49  public function init(&$pObj, $conf)
50  {
51  parent::init($pObj, $conf);
52  $this->pObj->modMenu_dontValidateList .= ',ts_browser_toplevel_setup,ts_browser_toplevel_const,ts_browser_TLKeys_setup,ts_browser_TLKeys_const';
53  $this->pObj->modMenu_setDefaultList .= ',ts_browser_fixedLgd,ts_browser_showComments';
54  }
55 
61  public function modMenu()
62  {
63  $lang = $this->getLanguageService();
64  $lang->includeLLFile('EXT:tstemplate/Resources/Private/Language/locallang_objbrowser.xlf');
65  $modMenu = [
66  'ts_browser_type' => [
67  'const' => $lang->getLL('constants'),
68  'setup' => $lang->getLL('setup')
69  ],
70  'ts_browser_toplevel_setup' => [
71  '0' => $lang->csConvObj->conv_case($lang->charSet, $lang->getLL('all'), 'toUpper')
72  ],
73  'ts_browser_toplevel_const' => [
74  '0' => $lang->csConvObj->conv_case($lang->charSet, $lang->getLL('all'), 'toUpper')
75  ],
76  'ts_browser_const' => [
77  '0' => $lang->getLL('plainSubstitution'),
78  'subst' => $lang->getLL('substitutedGreen'),
79  'const' => $lang->getLL('unsubstitutedGreen')
80  ],
81  'ts_browser_regexsearch' => '1',
82  'ts_browser_fixedLgd' => '1',
83  'ts_browser_showComments' => '1',
84  'ts_browser_alphaSort' => '1'
85  ];
86  foreach (['setup', 'const'] as $bType) {
87  $addKey = GeneralUtility::_GET('addKey');
88  // If any plus-signs were clicked, it's registered.
89  if (is_array($addKey)) {
90  reset($addKey);
91  if (current($addKey)) {
92  $this->pObj->MOD_SETTINGS['ts_browser_TLKeys_' . $bType][key($addKey)] = key($addKey);
93  } else {
94  unset($this->pObj->MOD_SETTINGS['ts_browser_TLKeys_' . $bType][key($addKey)]);
95  }
96  $this->getBackendUserAuthentication()->pushModuleData($this->pObj->MCONF['name'], $this->pObj->MOD_SETTINGS);
97  }
98  if (!empty($this->pObj->MOD_SETTINGS['ts_browser_TLKeys_' . $bType])) {
99  $modMenu['ts_browser_toplevel_' . $bType]['-'] = '---';
100  $modMenu['ts_browser_toplevel_' . $bType] = $modMenu['ts_browser_toplevel_' . $bType] + $this->pObj->MOD_SETTINGS['ts_browser_TLKeys_' . $bType];
101  }
102  }
103  return $modMenu;
104  }
105 
115  public function verify_TSobjects($propertyArray, $parentType, $parentValue)
116  {
118  $TSobjTable = [
119  'PAGE' => [
120  'prop' => [
121  'typeNum' => 'int',
122  '1,2,3' => 'COBJ',
123  'bodyTag' => 'string'
124  ]
125  ],
126  'TEXT' => [
127  'prop' => [
128  'value' => 'string'
129  ]
130  ],
131  'HTML' => [
132  'prop' => [
133  'value' => 'stdWrap'
134  ]
135  ],
136  'stdWrap' => [
137  'prop' => [
138  'field' => 'string',
139  'current' => 'boolean'
140  ]
141  ]
142  ];
143  $TSobjDataTypes = [
144  'COBJ' => 'TEXT,CONTENT',
145  'PAGE' => 'PAGE',
146  'stdWrap' => ''
147  ];
148  if ($parentType) {
149  if (isset($TSobjDataTypes[$parentType]) && (!$TSobjDataTypes[$parentType] || GeneralUtility::inlist($TSobjDataTypes[$parentType], $parentValue))) {
150  $ObjectKind = $parentValue;
151  } else {
152  // Object kind is "" if it should be known.
153  $ObjectKind = '';
154  }
155  } else {
156  // If parentType is not given, then it can be anything. Free.
157  $ObjectKind = $parentValue;
158  }
159  if ($ObjectKind && is_array($TSobjTable[$ObjectKind])) {
160  $result = [];
161  if (is_array($propertyArray)) {
162  foreach ($propertyArray as $key => $val) {
164  // If num-arrays
165  $result[$key] = $TSobjTable[$ObjectKind]['prop']['1,2,3'];
166  } else {
167  // standard
168  $result[$key] = $TSobjTable[$ObjectKind]['prop'][$key];
169  }
170  }
171  }
172  return $result;
173  }
174  return null;
175  }
176 
186  public function initialize_editor($pageId, $template_uid = 0)
187  {
188  // Defined global here!
189  $templateService = GeneralUtility::makeInstance(ExtendedTemplateService::class);
190  $GLOBALS['tmpl'] = $templateService;
191 
192  // Do not log time-performance information
193  $templateService->tt_track = false;
194  $templateService->init();
195 
196  // Gets the rootLine
197  $sys_page = GeneralUtility::makeInstance(PageRepository::class);
198  $rootLine = $sys_page->getRootLine($pageId);
199  // This generates the constants/config + hierarchy info for the template.
200  $templateService->runThroughTemplates($rootLine, $template_uid);
201 
202  // Get the row of the first VISIBLE template of the page. whereclause like the frontend.
203  $GLOBALS['tplRow'] = $templateService->ext_getFirstTemplate($pageId, $template_uid);
204  return is_array($GLOBALS['tplRow']);
205  }
206 
212  public function main()
213  {
214  $lang = $this->getLanguageService();
215  $POST = GeneralUtility::_POST();
216  $documentTemplate = $this->getDocumentTemplate();
217 
218  // Checking for more than one template an if, set a menu...
219  $manyTemplatesMenu = $this->pObj->templateMenu();
220  $template_uid = 0;
221  if ($manyTemplatesMenu) {
222  $template_uid = $this->pObj->MOD_SETTINGS['templatesOnPage'];
223  }
224  $bType = $this->pObj->MOD_SETTINGS['ts_browser_type'];
225  $existTemplate = $this->initialize_editor($this->pObj->id, $template_uid);
226  $tplRow = $this->getTemplateRow();
227  // initialize
228  $theOutput = '';
229  if ($existTemplate) {
230  $iconFactory = GeneralUtility::makeInstance(IconFactory::class);
231  $content = ' ' . $iconFactory->getIconForRecord('sys_template', $tplRow, Icon::SIZE_SMALL)->render() . ' <strong>'
232  . $this->pObj->linkWrapTemplateTitle($tplRow['title'], ($bType == 'setup' ? 'config' : 'constants')) . '</strong>'
233  . (trim($tplRow['sitetitle']) ? htmlspecialchars(' (' . $tplRow['sitetitle'] . ')') : '');
234  $theOutput .= '<h3>' . $lang->getLL('currentTemplate', true) . '</h3>';
235  $theOutput .= '<div>';
236  $theOutput .= $content;
237  $theOutput .= '</div>';
238 
239  if ($manyTemplatesMenu) {
240  $theOutput .= $manyTemplatesMenu;
241  }
242  $theOutput .= '<div style="padding-top: 10px;"></div>';
243  if ($POST['add_property'] || $POST['update_value'] || $POST['clear_object']) {
244  // add property
245  $line = '';
246  if (is_array($POST['data'])) {
247  $name = key($POST['data']);
248  if ($POST['data'][$name]['name'] !== '') {
249  // Workaround for this special case: User adds a key and submits by pressing the return key. The form however will use "add_property" which is the name of the first submit button in this form.
250  unset($POST['update_value']);
251  $POST['add_property'] = 'Add';
252  }
253  if ($POST['add_property']) {
254  $property = trim($POST['data'][$name]['name']);
255  if (preg_replace('/[^a-zA-Z0-9_\\.]*/', '', $property) != $property) {
256  $badPropertyMessage = GeneralUtility::makeInstance(FlashMessage::class, $lang->getLL('noSpaces') . $lang->getLL('nothingUpdated'), $lang->getLL('badProperty'), FlashMessage::ERROR);
257  $this->addFlashMessage($badPropertyMessage);
258  } else {
259  $pline = $name . '.' . $property . ' = ' . trim($POST['data'][$name]['propertyValue']);
260  $propertyAddedMessage = GeneralUtility::makeInstance(FlashMessage::class, $pline, $lang->getLL('propertyAdded'));
261  $this->addFlashMessage($propertyAddedMessage);
262  $line .= LF . $pline;
263  }
264  } elseif ($POST['update_value']) {
265  $pline = $name . ' = ' . trim($POST['data'][$name]['value']);
266  $updatedMessage = GeneralUtility::makeInstance(FlashMessage::class, $pline, $lang->getLL('valueUpdated'));
267  $this->addFlashMessage($updatedMessage);
268  $line .= LF . $pline;
269  } elseif ($POST['clear_object']) {
270  if ($POST['data'][$name]['clearValue']) {
271  $pline = $name . ' >';
272  $objectClearedMessage = GeneralUtility::makeInstance(FlashMessage::class, $pline, $lang->getLL('objectCleared'));
273  $this->addFlashMessage($objectClearedMessage);
274  $line .= LF . $pline;
275  }
276  }
277  }
278  if ($line) {
279  $saveId = $tplRow['_ORIG_uid'] ? $tplRow['_ORIG_uid'] : $tplRow['uid'];
280  // Set the data to be saved
281  $recData = [];
282  $field = $bType == 'setup' ? 'config' : 'constants';
283  $recData['sys_template'][$saveId][$field] = $tplRow[$field] . $line;
284  // Create new tce-object
285  $tce = GeneralUtility::makeInstance(DataHandler::class);
286  $tce->stripslashes_values = false;
287  // Initialize
288  $tce->start($recData, []);
289  // Saved the stuff
290  $tce->process_datamap();
291  // Clear the cache (note: currently only admin-users can clear the cache in tce_main.php)
292  $tce->clear_cacheCmd('all');
293  // re-read the template ...
294  $this->initialize_editor($this->pObj->id, $template_uid);
295  }
296  }
297  }
298  $tsbr = GeneralUtility::_GET('tsbr');
299  $templateService = $this->getExtendedTemplateService();
300  $update = 0;
301  if (is_array($tsbr)) {
302  // If any plus-signs were clicked, it's registred.
303  $this->pObj->MOD_SETTINGS['tsbrowser_depthKeys_' . $bType] = $templateService->ext_depthKeys($tsbr, $this->pObj->MOD_SETTINGS['tsbrowser_depthKeys_' . $bType]);
304  $update = 1;
305  }
306  if ($POST['Submit']) {
307  // If any POST-vars are send, update the condition array
308  $this->pObj->MOD_SETTINGS['tsbrowser_conditions'] = $POST['conditions'];
309  $update = 1;
310  }
311  if ($update) {
312  $this->getBackendUserAuthentication()->pushModuleData($this->pObj->MCONF['name'], $this->pObj->MOD_SETTINGS);
313  }
314  $templateService->matchAlternative = $this->pObj->MOD_SETTINGS['tsbrowser_conditions'];
315  $templateService->matchAlternative[] = 'dummydummydummydummydummydummydummydummydummydummydummy';
316  // This is just here to make sure that at least one element is in the array so that the tsparser actually uses this array to match.
317  $templateService->constantMode = $this->pObj->MOD_SETTINGS['ts_browser_const'];
318  if ($this->pObj->sObj && $templateService->constantMode) {
319  $templateService->constantMode = 'untouched';
320  }
321  $templateService->regexMode = $this->pObj->MOD_SETTINGS['ts_browser_regexsearch'];
322  $templateService->fixedLgd = $this->pObj->MOD_SETTINGS['ts_browser_fixedLgd'];
323  $templateService->linkObjects = true;
324  $templateService->ext_regLinenumbers = true;
325  $templateService->ext_regComments = $this->pObj->MOD_SETTINGS['ts_browser_showComments'];
326  $templateService->bType = $bType;
327  if ($this->pObj->MOD_SETTINGS['ts_browser_type'] == 'const') {
328  $templateService->ext_constants_BRP = (int)GeneralUtility::_GP('breakPointLN');
329  } else {
330  $templateService->ext_config_BRP = (int)GeneralUtility::_GP('breakPointLN');
331  }
332  $templateService->generateConfig();
333  if ($bType == 'setup') {
334  $theSetup = $templateService->setup;
335  } else {
336  $theSetup = $templateService->setup_constants;
337  }
338  // EDIT A VALUE:
339  if ($this->pObj->sObj) {
340  list($theSetup, $theSetupValue) = $templateService->ext_getSetup($theSetup, $this->pObj->sObj ? $this->pObj->sObj : '');
341  if ($existTemplate) {
342  // Inline Form Area Begin
343  $theOutput .= '<div class="form-inline form-inline-spaced">';
344  // Value
345  $out = '';
346  $out .= '<div class="form-group">';
347  $out .= ' <label>' . htmlspecialchars($this->pObj->sObj) . ' =' . '</label>';
348  $out .= ' <input class="form-control" type="text" name="data[' . htmlspecialchars($this->pObj->sObj) . '][value]" value="' . htmlspecialchars($theSetupValue) . '"' . $documentTemplate->formWidth(40) . ' />';
349  $out .= ' <input class="btn btn-default" type="submit" name="update_value" value="' . $lang->getLL('updateButton') . '" />';
350  $out .= '</div>';
351  $theOutput .= '<h3>' . $lang->getLL('editProperty', true) . '</h3>';
352  $theOutput .= $out;
353  // Property
354  $out = '<div class="form-group">';
355  $out .= ' <label>' . htmlspecialchars($this->pObj->sObj) . '.';
356  $out .= ' <input class="form-control" type="text" name="data[' . htmlspecialchars($this->pObj->sObj) . '][name]"' . $documentTemplate->formWidth(20) . ' /> = ';
357  $out .= ' </label>';
358  $out .= ' <input class="form-control" type="text" name="data[' . htmlspecialchars($this->pObj->sObj) . '][propertyValue]"' . $documentTemplate->formWidth(40) . ' />';
359  $out .= ' <input class="btn btn-default" type="submit" name="add_property" value="' . $lang->getLL('addButton') . '" />';
360  $out .= '</div>';
361  $theOutput .= '<div style="padding-top: 20px;"></div>';
362  $theOutput .= '<h3>' . $lang->getLL('addProperty', true) . '</h3>';
363  $theOutput .= $out;
364  // clear
365  $out = '<div class="form-group">';
366  $out .= ' <div class="checkbox">';
367  $out .= ' <label>';
368  $out .= ' ' . htmlspecialchars($this->pObj->sObj) . ' ' . $lang->csConvObj->conv_case($lang->charSet, $lang->getLL('clear'), 'toUpper');
369  $out .= ' <input type="checkbox" name="data[' . htmlspecialchars($this->pObj->sObj) . '][clearValue]" value="1" />';
370  $out .= ' </label>';
371  $out .= ' <input class="btn btn-default" type="submit" name="clear_object" value="' . $lang->getLL('clearButton') . '" />';
372  $out .= ' </div>';
373  $out .= '</div>';
374  $theOutput .='<div style="padding-top: 20px;"></div>';
375  $theOutput .= '<h3>' . $lang->getLL('clearObject', true) . '</h3>';
376  $theOutput .= $out;
377  $theOutput .= '<div style="padding-top: 10px;"></div>';
378  // Inline Form Area End
379  $theOutput .= '</div>';
380  } else {
381  $noTemplateMessage = GeneralUtility::makeInstance(FlashMessage::class, $lang->getLL('noCurrentTemplate'), $lang->getLL('edit'), FlashMessage::ERROR);
382  $this->addFlashMessage($noTemplateMessage);
383  $theOutput .= htmlspecialchars($this->pObj->sObj) . ' = <strong>' . htmlspecialchars($theSetupValue) . '</strong>';
384  $theOutput .= '<div style="padding-top: 10px;"></div>';
385  }
386  // Links:
387  $out = '';
388  $urlParameters = [
389  'id' => $this->pObj->id
390  ];
391  $aHref = BackendUtility::getModuleUrl('web_ts', $urlParameters);
392  if (!$this->pObj->MOD_SETTINGS['ts_browser_TLKeys_' . $bType][$this->pObj->sObj]) {
393  if (!empty($theSetup)) {
394  $out = '<a href="' . htmlspecialchars(($aHref . '&addKey[' . rawurlencode($this->pObj->sObj) . ']=1&SET[ts_browser_toplevel_' . $bType . ']=' . rawurlencode($this->pObj->sObj))) . '">';
395  $out .= sprintf($lang->getLL('addKey'), htmlspecialchars($this->pObj->sObj));
396  }
397  } else {
398  $out = '<a href="' . htmlspecialchars(($aHref . '&addKey[' . rawurlencode($this->pObj->sObj) . ']=0&SET[ts_browser_toplevel_' . $bType . ']=0')) . '">';
399  $out .= sprintf($lang->getLL('removeKey'), htmlspecialchars($this->pObj->sObj));
400  }
401  if ($out) {
402  $theOutput .= '<div><hr style="margin-top: 5px; margin-bottom: 5px;" />' . $out . '</div>';
403  }
404  // back
405  $out = $lang->getLL('back');
406  $out = '<a href="' . htmlspecialchars($aHref) . '" class="btn btn-default"><strong><i class="fa fa-chevron-left"></i>&nbsp;' . $out . '</strong></a>';
407  $theOutput .= '<div><hr style="margin-top: 5px; margin-bottom: 5px;" />' . $out . '</div>';
408  } else {
409  $templateService->tsbrowser_depthKeys = $this->pObj->MOD_SETTINGS['tsbrowser_depthKeys_' . $bType];
410  if (GeneralUtility::_POST('search') && GeneralUtility::_POST('search_field')) {
411  // If any POST-vars are send, update the condition array
412  $searchString = GeneralUtility::_POST('search_field');
413  try {
414  $templateService->tsbrowser_depthKeys =
415  $templateService->ext_getSearchKeys(
416  $theSetup,
417  '',
418  $searchString,
419  []
420  );
421  } catch (Exception $e) {
422  $this->addFlashMessage(
423  GeneralUtility::makeInstance(FlashMessage::class, sprintf($lang->getLL('error.' . $e->getCode()), $searchString), '', FlashMessage::ERROR)
424  );
425  }
426  }
427  $theOutput .= '
428  <div class="tsob-menu">
429  <div class="form-inline">';
430  if (is_array($this->pObj->MOD_MENU['ts_browser_type']) && count($this->pObj->MOD_MENU['ts_browser_type']) > 1) {
431  $theOutput .= '
432  <div class="form-group">
433  <label class="control-label">' . $lang->getLL('browse') . '</label>'
434  . BackendUtility::getDropdownMenu($this->pObj->id, 'SET[ts_browser_type]', $bType, $this->pObj->MOD_MENU['ts_browser_type']) . '
435  </div>';
436  }
437  if (is_array($this->pObj->MOD_MENU['ts_browser_toplevel_' . $bType]) && count($this->pObj->MOD_MENU['ts_browser_toplevel_' . $bType]) > 1) {
438  $theOutput .= '
439  <div class="form-group">
440  <label class="control-label" for="ts_browser_toplevel_' . $bType . '">' . $lang->getLL('objectList') . '</label> '
441  . BackendUtility::getDropdownMenu($this->pObj->id, 'SET[ts_browser_toplevel_' . $bType . ']', $this->pObj->MOD_SETTINGS['ts_browser_toplevel_' . $bType], $this->pObj->MOD_MENU['ts_browser_toplevel_' . $bType]) . '
442  </div>';
443  }
444 
445  $this->getPageRenderer()->loadRequireJsModule('TYPO3/CMS/Tstemplate/TypoScriptObjectBrowser');
446 
447  $theOutput .= '
448  <div class="form-group">
449  <label class="control-label" for="search_field">' . $lang->getLL('search') . '</label>
450  <div class="form-group"><input class="form-control" type="search" name="search_field" id="search_field" value="' . htmlspecialchars($POST['search_field']) . '" /></div>
451  </div>
452  <input class="btn btn-default tsob-search-submit" type="submit" name="search" value="' . $lang->sL('LLL:EXT:lang/locallang_common.xlf:search') . '" />
453  </div>
454  <div class="checkbox">
455  <label for="checkTs_browser_regexsearch">
456  ' . BackendUtility::getFuncCheck($this->pObj->id, 'SET[ts_browser_regexsearch]', $this->pObj->MOD_SETTINGS['ts_browser_regexsearch'], '', '', 'id="checkTs_browser_regexsearch"') . $lang->getLL('regExp') . '
457  </label>
458  </div>
459  </div>';
460  $theKey = $this->pObj->MOD_SETTINGS['ts_browser_toplevel_' . $bType];
461  if (!$theKey || !str_replace('-', '', $theKey)) {
462  $theKey = '';
463  }
464  list($theSetup, $theSetupValue) = $templateService->ext_getSetup($theSetup, $this->pObj->MOD_SETTINGS['ts_browser_toplevel_' . $bType] ? $this->pObj->MOD_SETTINGS['ts_browser_toplevel_' . $bType] : '');
465  $tree = $templateService->ext_getObjTree($theSetup, $theKey, '', '', $theSetupValue, $this->pObj->MOD_SETTINGS['ts_browser_alphaSort']);
466  $tree = $templateService->substituteCMarkers($tree);
467  $urlParameters = [
468  'id' => $this->pObj->id
469  ];
470  $aHref = BackendUtility::getModuleUrl('web_ts', $urlParameters);
471  // Parser Errors:
472  $pEkey = $bType == 'setup' ? 'config' : 'constants';
473  if (!empty($templateService->parserErrors[$pEkey])) {
474  $errMsg = [];
475  foreach ($templateService->parserErrors[$pEkey] as $inf) {
476  $errorLink = ' <a href="' . htmlspecialchars(($aHref . '&SET[function]=TYPO3\\CMS\\Tstemplate\\Controller\\TemplateAnalyzerModuleFunctionController&template=all&SET[ts_analyzer_checkLinenum]=1#line-' . $inf[2])) . '" class="text-warning">' . $lang->getLL('errorShowDetails') . '</a>';
477  $errMsg[] = $lang->getLL('severity.' . $inf[1]) . ':&nbsp;' . $inf[0] . $errorLink;
478  }
479  $theOutput .= '<div style="padding-top: 10px;"></div>';
480 
481  $title = $lang->getLL('errorsWarnings');
482  $message = '<p>' . implode($errMsg, '<br />') . '</p>';
483  $view = GeneralUtility::makeInstance(StandaloneView::class);
484  $view->setTemplatePathAndFilename(GeneralUtility::getFileAbsFileName('EXT:tstemplate/Resources/Private/Templates/InfoBox.html'));
485  $view->assignMultiple([
486  'title' => $title,
487  'message' => $message,
489  ]);
490  $theOutput .= $view->render();
491  }
492 
493  if (isset($this->pObj->MOD_SETTINGS['ts_browser_TLKeys_' . $bType][$theKey])) {
494  $remove = '<a href="' . htmlspecialchars(($aHref . '&addKey[' . $theKey . ']=0&SET[ts_browser_toplevel_' . $bType . ']=0')) . '">' . $lang->getLL('removeKey') . '</a>';
495  } else {
496  $remove = '';
497  }
498 
499  $label = $theKey ? $theKey : ($bType == 'setup' ? $lang->csConvObj->conv_case($lang->charSet, $lang->getLL('setupRoot'), 'toUpper') : $lang->csConvObj->conv_case($lang->charSet, $lang->getLL('constantRoot'), 'toUpper'));
500 
501  $theOutput .= '<div class="panel panel-space panel-default">';
502  $theOutput .= '<div class="panel-heading">';
503  $theOutput .= '<strong>' . $label . ' ' . $remove . '</strong>';
504  $theOutput .= '</div>';
505  $theOutput .= '<div class="panel-body">' . $tree . '</div>';
506  $theOutput .= '</div>';
507 
508  // second row options
509  $menu = '<div class="typo3-listOptions">';
510  $menu .= '<div class="checkbox"><label for="checkTs_browser_showComments">' . BackendUtility::getFuncCheck($this->pObj->id, 'SET[ts_browser_showComments]', $this->pObj->MOD_SETTINGS['ts_browser_showComments'], '', '', 'id="checkTs_browser_showComments"');
511  $menu .= $lang->getLL('displayComments') . '</label></div>';
512  $menu .= '<div class="checkbox"><label for="checkTs_browser_alphaSort">' . BackendUtility::getFuncCheck($this->pObj->id, 'SET[ts_browser_alphaSort]', $this->pObj->MOD_SETTINGS['ts_browser_alphaSort'], '', '', 'id="checkTs_browser_alphaSort"');
513  $menu .= $lang->getLL('sortAlphabetically') . '</label></div>';
514  $menu .= '<div class="checkbox"><label for="checkTs_browser_fixedLgd">' . BackendUtility::getFuncCheck($this->pObj->id, 'SET[ts_browser_fixedLgd]', $this->pObj->MOD_SETTINGS['ts_browser_fixedLgd'], '', '', 'id="checkTs_browser_fixedLgd"');
515  $menu .= $lang->getLL('cropLines') . '</label></div>';
516  if ($bType == 'setup' && !$this->pObj->MOD_SETTINGS['ts_browser_fixedLgd']) {
517  $menu .= '<div class="form"><label>' . $lang->getLL('displayConstants') . '</label>';
518  $menu .= BackendUtility::getDropdownMenu($this->pObj->id, 'SET[ts_browser_const]', $this->pObj->MOD_SETTINGS['ts_browser_const'], $this->pObj->MOD_MENU['ts_browser_const']);
519  $menu .= '</div>';
520  }
521  $menu .= '</div>';
522 
523  //start section displayoptions
524  $theOutput .= '<div>';
525  $theOutput .= '<h2>' . $lang->getLL('displayOptions', true) . '</h2>';
526  $theOutput .= $menu;
527  // Conditions:
528  if (is_array($templateService->sections) && !empty($templateService->sections)) {
529  $theOutput .= '<h2>' . $lang->getLL('conditions', true) . '</h2>';
530  $out = '';
531  foreach ($templateService->sections as $key => $val) {
532  $out .= '<div class="checkbox"><label for="check' . $key . '">';
533  $out .= '<input class="checkbox" type="checkbox" name="conditions[' . $key . ']" id="check' . $key . '" value="' . htmlspecialchars($val) . '"' . ($this->pObj->MOD_SETTINGS['tsbrowser_conditions'][$key] ? ' checked' : '') . ' />' . $templateService->substituteCMarkers(htmlspecialchars($val));
534  $out .= '</label></div>';
535  }
536  $theOutput .= '<div class="typo3-listOptions">' . $out . '</div><input class="btn btn-default" type="submit" name="Submit" value="' . $lang->getLL('setConditions') . '" />';
537  }
538  // Ending section displayoptions
539  $theOutput .= '</div>';
540  }
541  return $theOutput;
542  }
543 
550  protected function addFlashMessage(FlashMessage $flashMessage)
551  {
553  $flashMessageService = GeneralUtility::makeInstance(FlashMessageService::class);
555  $defaultFlashMessageQueue = $flashMessageService->getMessageQueueByIdentifier();
556  $defaultFlashMessageQueue->enqueue($flashMessage);
557  }
558 
562  protected function getExtendedTemplateService()
563  {
564  return $GLOBALS['tmpl'];
565  }
566 
570  protected function getTemplateRow()
571  {
572  return $GLOBALS['tplRow'];
573  }
574 }
static getFuncCheck($mainParams, $elementName, $currentValue, $script='', $addParams='', $tagParams='')
static getFileAbsFileName($filename, $onlyRelative=true, $relToTYPO3_mainDir=false)
if(TYPO3_MODE==='BE') $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_tsfebeuserauth.php']['frontendEditingController']['default']
static getDropdownMenu($mainParams, $elementName, $currentValue, $menuItems, $script='', $addParams='')