[TASK] In a ModuleController use iconFactory from moduleTemplate
[Packages/TYPO3.CMS.git] / typo3 / sysext / tstemplate / Classes / Controller / TypoScriptTemplateModuleController.php
1 <?php
2 namespace TYPO3\CMS\Tstemplate\Controller;
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
17 use Psr\Http\Message\ResponseInterface;
18 use Psr\Http\Message\ServerRequestInterface;
19 use TYPO3\CMS\Backend\Module\BaseScriptClass;
20 use TYPO3\CMS\Backend\Template\Components\ButtonBar;
21 use TYPO3\CMS\Backend\Template\DocumentTemplate;
22 use TYPO3\CMS\Backend\Template\ModuleTemplate;
23 use TYPO3\CMS\Core\DataHandling\DataHandler;
24 use TYPO3\CMS\Core\Imaging\Icon;
25 use TYPO3\CMS\Core\TypoScript\ExtendedTemplateService;
26 use TYPO3\CMS\Core\Utility\ExtensionManagementUtility;
27 use TYPO3\CMS\Core\Utility\GeneralUtility;
28 use TYPO3\CMS\Backend\Utility\BackendUtility;
29 use TYPO3\CMS\Core\Utility\MathUtility;
30 use TYPO3\CMS\Fluid\View\StandaloneView;
31 use TYPO3\CMS\Fluid\ViewHelpers\Be\InfoboxViewHelper;
32
33 /**
34 * Module: TypoScript Tools
35 *
36 * $TYPO3_CONF_VARS["MODS"]["web_ts"]["onlineResourceDir"] = Directory of default resources. Eg. "fileadmin/res/" or so.
37 */
38 class TypoScriptTemplateModuleController extends BaseScriptClass
39 {
40 /**
41 * @var string
42 */
43 public $perms_clause;
44
45 /**
46 * @var string
47 */
48 public $e;
49
50 /**
51 * @var string
52 */
53 public $sObj;
54
55 /**
56 * @var string
57 */
58 public $edit;
59
60 /**
61 * @var string
62 */
63 public $textExtensions = 'html,htm,txt,css,tmpl,inc,js';
64
65 /**
66 * @var string
67 */
68 public $modMenu_type = '';
69
70 /**
71 * @var string
72 */
73 public $modMenu_dontValidateList = '';
74
75 /**
76 * @var string
77 */
78 public $modMenu_setDefaultList = '';
79
80 /**
81 * @var array
82 */
83 public $pageinfo = array();
84
85 /**
86 * @var bool
87 */
88 public $access = false;
89
90 /**
91 * The name of the module
92 *
93 * @var string
94 */
95 protected $moduleName = 'web_ts';
96
97 /**
98 * ModuleTemplate Container
99 *
100 * @var ModuleTemplate
101 */
102 protected $moduleTemplate;
103
104 /**
105 * Constructor
106 */
107 public function __construct()
108 {
109 $this->moduleTemplate = GeneralUtility::makeInstance(ModuleTemplate::class);
110 $this->getLanguageService()->includeLLFile('EXT:tstemplate/Resources/Private/Language/locallang.xlf');
111
112 $this->MCONF = array(
113 'name' => $this->moduleName
114 );
115 $this->moduleTemplate->addJavaScriptCode(
116 'jumpToUrl',
117 '
118 function jumpToUrl(URL) {
119 window.location.href = URL;
120 return false;
121 }
122 '
123 );
124 }
125
126 /**
127 * Init
128 *
129 * @return void
130 */
131 public function init()
132 {
133 parent::init();
134 $this->id = (int)GeneralUtility::_GP('id');
135 $this->e = GeneralUtility::_GP('e');
136 $this->sObj = GeneralUtility::_GP('sObj');
137 $this->edit = GeneralUtility::_GP('edit');
138 $this->perms_clause = $this->getBackendUser()->getPagePermsClause(1);
139 }
140
141 /**
142 * Clear cache
143 *
144 * @return void
145 */
146 public function clearCache()
147 {
148 if (GeneralUtility::_GP('clear_all_cache')) {
149 /** @var DataHandler $tce */
150 $tce = GeneralUtility::makeInstance(DataHandler::class);
151 $tce->stripslashes_values = false;
152 $tce->start(array(), array());
153 $tce->clear_cacheCmd('all');
154 }
155 }
156
157 /**
158 * Main
159 *
160 * @return void
161 */
162 public function main()
163 {
164 // Template markers
165 $markers = array(
166 'CSH' => '',
167 'FUNC_MENU' => '',
168 'CONTENT' => ''
169 );
170
171 // Access check...
172 // The page will show only if there is a valid page and if this page may be viewed by the user
173 $this->pageinfo = BackendUtility::readPageAccess($this->id, $this->perms_clause);
174 $this->access = is_array($this->pageinfo);
175
176 /** @var DocumentTemplate doc */
177 $this->doc = GeneralUtility::makeInstance(DocumentTemplate::class);
178 $this->moduleTemplate->getPageRenderer()->addCssFile(ExtensionManagementUtility::extRelPath('tstemplate') . 'Resources/Public/Css/styles.css');
179
180 $lang = $this->getLanguageService();
181
182 if ($this->id && $this->access) {
183 $urlParameters = array(
184 'id' => $this->id,
185 'template' => 'all'
186 );
187 $aHref = BackendUtility::getModuleUrl('web_ts', $urlParameters);
188 $this->moduleTemplate->setForm('<form action="' . htmlspecialchars($aHref) . '" method="post" enctype="multipart/form-data" name="editForm" class="form">');
189
190 // JavaScript
191 $this->moduleTemplate->addJavaScriptCode(
192 'TSTemplateInlineJS', '
193 function uFormUrl(aname) {
194 document.forms[0].action = ' . GeneralUtility::quoteJSvalue(($aHref . '#')) . '+aname;
195 }
196 function brPoint(lnumber,t) {
197 window.location.href = ' . GeneralUtility::quoteJSvalue(($aHref . '&SET[function]=TYPO3\\CMS\\Tstemplate\\Controller\\TypoScriptTemplateObjectBrowserModuleFunctionController&SET[ts_browser_type]=')) . '+(t?"setup":"const")+"&breakPointLN="+lnumber;
198 return false;
199 }
200 if (top.fsMod) top.fsMod.recentIds["web"] = ' . $this->id . ';
201 ');
202 $this->moduleTemplate->getPageRenderer()->addCssInlineBlock(
203 'TSTemplateInlineStyle', '
204 TABLE#typo3-objectBrowser { width: 100%; margin-bottom: 24px; }
205 TABLE#typo3-objectBrowser A { text-decoration: none; }
206 TABLE#typo3-objectBrowser .comment { color: maroon; font-weight: bold; }
207 .ts-typoscript { width: 100%; }
208 .tsob-search-submit {margin-left: 3px; margin-right: 3px;}
209 .tst-analyzer-options { margin:5px 0; }
210 ');
211 // Setting up the context sensitive menu:
212 $this->moduleTemplate->getPageRenderer()->loadRequireJsModule('TYPO3/CMS/Backend/ClickMenu');
213 // Build the module content
214 $this->content = $this->doc->header($lang->getLL('moduleTitle'));
215 $this->extObjContent();
216 // Setting up the buttons and markers for docheader
217 $this->getButtons();
218 $this->generateMenu();
219 } else {
220 // Template pages:
221 $records = $this->getDatabaseConnection()->exec_SELECTgetRows(
222 'pages.uid, count(*) AS count, max(sys_template.root) AS root_max_val, min(sys_template.root) AS root_min_val',
223 'pages,sys_template',
224 'pages.uid=sys_template.pid'
225 . BackendUtility::deleteClause('pages')
226 . BackendUtility::versioningPlaceholderClause('pages')
227 . BackendUtility::deleteClause('sys_template')
228 . BackendUtility::versioningPlaceholderClause('sys_template'),
229 'pages.uid',
230 'pages.pid, pages.sorting'
231 );
232 $pArray = array();
233 foreach ($records as $record) {
234 $this->setInPageArray($pArray, BackendUtility::BEgetRootLine($record['uid'], 'AND 1=1'), $record);
235 }
236
237 $table = '<div class="table-fit"><table class="table table-striped table-hover" id="ts-overview">' .
238 '<thead>' .
239 '<tr>' .
240 '<th>' . $lang->getLL('pageName') . '</th>' .
241 '<th>' . $lang->getLL('templates') . '</th>' .
242 '<th>' . $lang->getLL('isRoot') . '</th>' .
243 '<th>' . $lang->getLL('isExt') . '</th>' .
244 '</tr>' .
245 '</thead>' .
246 '<tbody>' . implode('', $this->renderList($pArray)) . '</tbody>' .
247 '</table></div>';
248
249 $this->content = $this->doc->header($lang->getLL('moduleTitle'));
250 $this->content .= $this->moduleTemplate->section('', '<p class="lead">' . $lang->getLL('overview') . '</p>' . $table);
251
252 // RENDER LIST of pages with templates, END
253 // Setting up the buttons and markers for docheader
254 $this->getButtons();
255 }
256 }
257
258 /**
259 * Generates the menu based on $this->MOD_MENU
260 *
261 * @return void
262 * @throws \InvalidArgumentException
263 */
264 protected function generateMenu()
265 {
266 $menu = $this->moduleTemplate->getDocHeaderComponent()->getMenuRegistry()->makeMenu();
267 $menu->setIdentifier('WebFuncJumpMenu');
268 foreach ($this->MOD_MENU['function'] as $controller => $title) {
269 $item = $menu
270 ->makeMenuItem()
271 ->setHref(
272 BackendUtility::getModuleUrl(
273 $this->moduleName,
274 [
275 'id' => $this->id,
276 'SET' => [
277 'function' => $controller
278 ]
279 ]
280 )
281 )
282 ->setTitle($title);
283 if ($controller === $this->MOD_SETTINGS['function']) {
284 $item->setActive(true);
285 }
286 $menu->addMenuItem($item);
287 }
288 $this->moduleTemplate->getDocHeaderComponent()->getMenuRegistry()->addMenu($menu);
289 }
290
291 /**
292 * Injects the request object for the current request or subrequest
293 * Then checks for module functions that have hooked in, and renders menu etc.
294 *
295 * @param ServerRequestInterface $request the current request
296 * @param ResponseInterface $response
297 * @return ResponseInterface the response with the content
298 */
299 public function mainAction(ServerRequestInterface $request, ResponseInterface $response)
300 {
301 $GLOBALS['SOBE'] = $this;
302 $this->init();
303
304 // Checking for first level external objects
305 $this->checkExtObj();
306
307 $this->clearCache();
308 $this->main();
309
310 $this->moduleTemplate->setContent($this->content);
311 $response->getBody()->write($this->moduleTemplate->renderContent());
312 return $response;
313 }
314
315 /**
316 * Print content
317 *
318 * @return void
319 * @deprecated since TYPO3 CMS 7, will be removed in TYPO3 CMS 8
320 */
321 public function printContent()
322 {
323 GeneralUtility::logDeprecatedFunction();
324 echo $this->content;
325 }
326
327 /**
328 * Create the panel of buttons for submitting the form or otherwise perform operations.
329 *
330 * @return array All available buttons as an assoc. array
331 */
332 protected function getButtons()
333 {
334 $buttonBar = $this->moduleTemplate->getDocHeaderComponent()->getButtonBar();
335 $lang = $this->getLanguageService();
336
337 if ($this->id && $this->access) {
338 // View page
339 $viewButton = $buttonBar->makeLinkButton()
340 ->setHref('#')
341 ->setOnClick(BackendUtility::viewOnClick($this->pageinfo['uid'], '', BackendUtility::BEgetRootLine($this->pageinfo['uid'])))
342 ->setTitle($lang->sL('LLL:EXT:lang/locallang_core.xlf:labels.showPage', true))
343 ->setIcon($this->moduleTemplate->getIconFactory()->getIcon('actions-document-view', Icon::SIZE_SMALL));
344 $buttonBar->addButton($viewButton, ButtonBar::BUTTON_POSITION_LEFT, 99);
345 if ($this->extClassConf['name'] === TypoScriptTemplateInformationModuleFunctionController::class) {
346 // NEW button
347 $urlParameters = array(
348 'id' => $this->id,
349 'template' => 'all',
350 'createExtension' => 'new'
351 );
352
353 if (!empty($this->e) && !GeneralUtility::_POST('_saveandclosedok')) {
354 $saveButton = $buttonBar->makeInputButton()
355 ->setName('_savedok')
356 ->setValue('1')
357 ->setIcon($this->moduleTemplate->getIconFactory()->getIcon('actions-document-save', Icon::SIZE_SMALL))
358 ->setTitle($lang->sL('LLL:EXT:lang/locallang_core.xlf:rm.saveDoc', true));
359
360 $saveAndCloseButton = $buttonBar->makeInputButton()
361 ->setName('_saveandclosedok')
362 ->setValue('1')
363 ->setTitle($lang->sL('LLL:EXT:lang/locallang_core.xlf:rm.saveCloseDoc', true))
364 ->setIcon($this->moduleTemplate->getIconFactory()->getIcon('actions-document-save-close', Icon::SIZE_SMALL));
365
366 $splitButtonElement = $buttonBar->makeSplitButton()
367 ->addItem($saveButton)
368 ->addItem($saveAndCloseButton);
369
370 $buttonBar->addButton($splitButtonElement, ButtonBar::BUTTON_POSITION_LEFT, 3);
371
372 // CLOSE button
373 $closeButton = $buttonBar->makeLinkButton()
374 ->setHref(BackendUtility::getModuleUrl('web_ts', array('id' => $this->id)))
375 ->setTitle($lang->sL('LLL:EXT:lang/locallang_core.xlf:rm.closeDoc', true))
376 ->setIcon($this->moduleTemplate->getIconFactory()->getIcon('actions-document-close', Icon::SIZE_SMALL));
377 $buttonBar->addButton($closeButton);
378 } else {
379 $newButton = $buttonBar->makeLinkButton()
380 ->setHref(BackendUtility::getModuleUrl('web_ts', $urlParameters))
381 ->setTitle($lang->sL('LLL:EXT:lang/locallang_core.xlf:db_new.php.pagetitle', true))
382 ->setIcon($this->moduleTemplate->getIconFactory()->getIcon('actions-document-new', Icon::SIZE_SMALL));
383 $buttonBar->addButton($newButton);
384 }
385 } elseif ($this->extClassConf['name'] === TypoScriptTemplateConstantEditorModuleFunctionController::class && !empty($this->MOD_MENU['constant_editor_cat'])) {
386 // SAVE button
387 $saveButton = $buttonBar->makeInputButton()
388 ->setName('_savedok')
389 ->setValue('1')
390 ->setTitle($lang->sL('LLL:EXT:lang/locallang_core.xlf:rm.saveDoc', true))
391 ->setIcon($this->moduleTemplate->getIconFactory()->getIcon('actions-document-save', Icon::SIZE_SMALL))
392 ->setShowLabelText(true);
393 $buttonBar->addButton($saveButton);
394 } elseif ($this->extClassConf['name'] === TypoScriptTemplateObjectBrowserModuleFunctionController::class) {
395 if (!empty($this->sObj)) {
396 // BACK
397 $urlParameters = array(
398 'id' => $this->id
399 );
400 $backButton = $buttonBar->makeLinkButton()
401 ->setHref(BackendUtility::getModuleUrl('web_ts', $urlParameters))
402 ->setClasses('typo3-goBack')
403 ->setTitle($lang->sL('LLL:EXT:lang/locallang_core.xlf:labels.goBack', true))
404 ->setIcon($this->moduleTemplate->getIconFactory()->getIcon('actions-view-go-back', Icon::SIZE_SMALL));
405 $buttonBar->addButton($backButton);
406 }
407 }
408 }
409 // Shortcut
410 $shortcutButton = $buttonBar->makeShortcutButton()
411 ->setModuleName($this->MCONF['name'])
412 ->setGetVariables(['id']);
413 $buttonBar->addButton($shortcutButton);
414 }
415
416 // OTHER FUNCTIONS:
417 /**
418 * Wrap title for link in template
419 *
420 * @param string $title
421 * @param string $onlyKey
422 * @return string
423 */
424 public function linkWrapTemplateTitle($title, $onlyKey = '')
425 {
426 $urlParameters = array(
427 'id' => $this->id
428 );
429 $aHref = BackendUtility::getModuleUrl('web_ts', $urlParameters);
430 if ($onlyKey) {
431 $title = '<a href="' . htmlspecialchars(($aHref . '&e[' . $onlyKey . ']=1&SET[function]=TYPO3\\CMS\\Tstemplate\\Controller\\TypoScriptTemplateInformationModuleFunctionController')) . '">' . htmlspecialchars($title) . '</a>';
432 } else {
433 $title = '<a href="' . htmlspecialchars(($aHref . '&e[constants]=1&e[config]=1&SET[function]=TYPO3\\CMS\\Tstemplate\\Controller\\TypoScriptTemplateInformationModuleFunctionController')) . '">' . htmlspecialchars($title) . '</a>';
434 }
435 return $title;
436 }
437
438 /**
439 * No template
440 *
441 * @param int $newStandardTemplate
442 * @return string
443 */
444 public function noTemplate($newStandardTemplate = 0)
445 {
446 // Defined global here!
447 /** @var ExtendedTemplateService $tmpl */
448 $tmpl = GeneralUtility::makeInstance(ExtendedTemplateService::class);
449 $GLOBALS['tmpl'] = $tmpl;
450
451 // Do not log time-performance information
452 $tmpl->tt_track = false;
453 $tmpl->init();
454
455 $lang = $this->getLanguageService();
456
457 $title = $lang->getLL('noTemplate');
458 $message = '<p>' . $lang->getLL('noTemplateDescription') . '<br />' . $lang->getLL('createTemplateToEditConfiguration') . '</p>';
459
460 $view = GeneralUtility::makeInstance(StandaloneView::class);
461 $view->setTemplatePathAndFilename(GeneralUtility::getFileAbsFileName('EXT:tstemplate/Resources/Private/Templates/InfoBox.html'));
462 $view->assignMultiple(array(
463 'title' => $title,
464 'message' => $message,
465 'state' => InfoboxViewHelper::STATE_INFO
466 ));
467 $theOutput = $view->render();
468
469 // New standard?
470 if ($newStandardTemplate) {
471 // Hook to change output, implemented for statictemplates
472 if (isset(
473 $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS'][TypoScriptTemplateModuleController::class]['newStandardTemplateView']
474 )) {
475 $selector = '';
476 $staticsText = '';
477 $reference = array(
478 'selectorHtml' => &$selector,
479 'staticsText' => &$staticsText
480 );
481 GeneralUtility::callUserFunction(
482 $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS'][TypoScriptTemplateModuleController::class]['newStandardTemplateView'],
483 $reference,
484 $this
485 );
486 $selector = $reference['selectorHtml'];
487 $staticsText = $reference['staticsText'];
488 } else {
489 $selector = '<input type="hidden" name="createStandard" value="" />';
490 $staticsText = '';
491 }
492 // Extension?
493 $theOutput .= $this->moduleTemplate->section(
494 $lang->getLL('newWebsite') . $staticsText,
495 '<p>' . $lang->getLL('newWebsiteDescription') . '</p>' . $selector . '<input class="btn btn-primary" type="submit" name="newWebsite" value="' . $lang->getLL('newWebsiteAction') . '" />',
496 0, 1);
497 }
498 // Extension?
499 $theOutput .= $this->moduleTemplate->section(
500 $lang->getLL('extTemplate'),
501 '<p>' . $lang->getLL('extTemplateDescription') . '</p>' . '<input class="btn btn-default" type="submit" name="createExtension" value="' . $lang->getLL('extTemplateAction') . '" />',
502 0, 1);
503 // Go to first appearing...
504 $first = $tmpl->ext_prevPageWithTemplate($this->id, $this->perms_clause);
505 if ($first) {
506 $urlParameters = array(
507 'id' => $first['uid']
508 );
509 $aHref = BackendUtility::getModuleUrl('web_ts', $urlParameters);
510 $theOutput .= $this->moduleTemplate->section(
511 $lang->getLL('goToClosest'),
512 sprintf('<p>' . $lang->getLL('goToClosestDescription') . '</p>%s' . $lang->getLL('goToClosestAction') . '%s', htmlspecialchars($first['title']), $first['uid'], '<a class="btn btn-default" href="' . htmlspecialchars($aHref) . '">', '</a>'),
513 0, 1);
514 }
515 return $theOutput;
516 }
517
518 /**
519 * Render template menu
520 *
521 * @return string
522 */
523 public function templateMenu()
524 {
525 /** @var ExtendedTemplateService $tmpl */
526 $tmpl = GeneralUtility::makeInstance(ExtendedTemplateService::class);
527 $GLOBALS['tmpl'] = $tmpl;
528
529 // Do not log time-performance information
530 $tmpl->tt_track = false;
531 $tmpl->init();
532
533 $all = $tmpl->ext_getAllTemplates($this->id, $this->perms_clause);
534 if (count($all) > 1) {
535 $this->MOD_MENU['templatesOnPage'] = array();
536 foreach ($all as $d) {
537 $this->MOD_MENU['templatesOnPage'][$d['uid']] = $d['title'];
538 }
539 }
540 $this->MOD_SETTINGS = BackendUtility::getModuleData($this->MOD_MENU, GeneralUtility::_GP('SET'), $this->MCONF['name'], $this->modMenu_type, $this->modMenu_dontValidateList, $this->modMenu_setDefaultList);
541 return BackendUtility::getFuncMenu($this->id, 'SET[templatesOnPage]', $this->MOD_SETTINGS['templatesOnPage'], $this->MOD_MENU['templatesOnPage']);
542 }
543
544 /**
545 * Create template
546 *
547 * @param int $id
548 * @param int $actTemplateId
549 * @return string
550 */
551 public function createTemplate($id, $actTemplateId = 0)
552 {
553 $recData = array();
554 /** @var DataHandler $tce */
555 $tce = GeneralUtility::makeInstance(DataHandler::class);
556 $tce->stripslashes_values = false;
557
558 if (GeneralUtility::_GP('createExtension')) {
559 $recData['sys_template']['NEW'] = array(
560 'pid' => $actTemplateId ? -1 * $actTemplateId : $id,
561 'title' => '+ext'
562 );
563 $tce->start($recData, array());
564 $tce->process_datamap();
565 } elseif (GeneralUtility::_GP('newWebsite')) {
566 // Hook to handle row data, implemented for statictemplates
567 if (isset(
568 $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS'][TypoScriptTemplateModuleController::class]['newStandardTemplateHandler']
569 )) {
570 $reference = array(
571 'recData' => &$recData,
572 'id' => $id,
573 );
574 GeneralUtility::callUserFunction(
575 $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS'][TypoScriptTemplateModuleController::class]['newStandardTemplateHandler'],
576 $reference,
577 $this
578 );
579 $recData = $reference['recData'];
580 } else {
581 $recData['sys_template']['NEW'] = array(
582 'pid' => $id,
583 'title' => $this->getLanguageService()->getLL('titleNewSite'),
584 'sorting' => 0,
585 'root' => 1,
586 'clear' => 3,
587 'config' => '
588 # Default PAGE object:
589 page = PAGE
590 page.10 = TEXT
591 page.10.value = HELLO WORLD!
592 '
593 );
594 }
595 $tce->start($recData, array());
596 $tce->process_datamap();
597 $tce->clear_cacheCmd('all');
598 }
599 return $tce->substNEWwithIDs['NEW'];
600 }
601
602 // RENDER LIST of pages with templates, BEGIN
603 /**
604 * Set page in array
605 *
606 * @param array $pArray
607 * @param array $rlArr
608 * @param array $row
609 * @return void
610 */
611 public function setInPageArray(&$pArray, $rlArr, $row)
612 {
613 ksort($rlArr);
614 reset($rlArr);
615 if (!$rlArr[0]['uid']) {
616 array_shift($rlArr);
617 }
618 $cEl = current($rlArr);
619 $pArray[$cEl['uid']] = htmlspecialchars($cEl['title']);
620 array_shift($rlArr);
621 if (!empty($rlArr)) {
622 if (!isset($pArray[($cEl['uid'] . '.')])) {
623 $pArray[$cEl['uid'] . '.'] = array();
624 }
625 $this->setInPageArray($pArray[$cEl['uid'] . '.'], $rlArr, $row);
626 } else {
627 $pArray[$cEl['uid'] . '_'] = $row;
628 }
629 }
630
631 /**
632 * Render the list
633 *
634 * @param array $pArray
635 * @param array $lines
636 * @param int $c
637 * @return array
638 */
639 public function renderList($pArray, $lines = array(), $c = 0)
640 {
641 static $i;
642
643 if (!is_array($pArray)) {
644 return $lines;
645 }
646
647 $statusCheckedIcon = $this->moduleTemplate->getIconFactory()->getIcon('status-status-checked', Icon::SIZE_SMALL)->render();
648 foreach ($pArray as $k => $v) {
649 if (MathUtility::canBeInterpretedAsInteger($k)) {
650 if (isset($pArray[$k . '_'])) {
651 $lines[] = '<tr class="' . ($i++ % 2 == 0 ? 'bgColor4' : 'bgColor6') . '">
652 <td nowrap><span style="width: 1px; height: 1px; display:inline-block; margin-left: ' . $c * 20 . 'px"></span>' . '<a href="' . htmlspecialchars(GeneralUtility::linkThisScript(array('id' => $k))) . '" title="' . htmlspecialchars('ID: ' . $k) . '">' . $this->moduleTemplate->getIconFactory()->getIconForRecord('pages', BackendUtility::getRecordWSOL('pages', $k), Icon::SIZE_SMALL)->render() . GeneralUtility::fixed_lgd_cs($pArray[$k], 30) . '</a></td>
653 <td>' . $pArray[($k . '_')]['count'] . '</td>
654 <td>' . ($pArray[$k . '_']['root_max_val'] > 0 ? $statusCheckedIcon : '&nbsp;') . '</td>
655 <td>' . ($pArray[$k . '_']['root_min_val'] == 0 ? $statusCheckedIcon : '&nbsp;') . '</td>
656 </tr>';
657 } else {
658 $lines[] = '<tr class="' . ($i++ % 2 == 0 ? 'bgColor4' : 'bgColor6') . '">
659 <td nowrap><span style="width: 1px; height: 1px; display:inline-block; margin-left: ' . $c * 20 . 'px"></span>' . $this->moduleTemplate->getIconFactory()->getIconForRecord('pages', BackendUtility::getRecordWSOL('pages', $k), Icon::SIZE_SMALL)->render() . GeneralUtility::fixed_lgd_cs($pArray[$k], 30) . '</td>
660 <td></td>
661 <td></td>
662 <td></td>
663 </tr>';
664 }
665 $lines = $this->renderList($pArray[$k . '.'], $lines, $c + 1);
666 }
667 }
668 return $lines;
669 }
670 }