ffb81b498ff500fcd939fded986240ca569a61d1
[Packages/TYPO3.CMS.git] / typo3 / sysext / tstemplate / Classes / Controller / TypoScriptTemplateModuleController.php
1 <?php
2 namespace TYPO3\CMS\Tstemplate\Controller;
3
4 /***************************************************************
5 * Copyright notice
6 *
7 * (c) 1999-2013 Kasper Skårhøj (kasperYYYY@typo3.com)
8 * All rights reserved
9 *
10 * This script is part of the TYPO3 project. The TYPO3 project is
11 * free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published by
13 * the Free Software Foundation; either version 2 of the License, or
14 * (at your option) any later version.
15 *
16 * The GNU General Public License can be found at
17 * http://www.gnu.org/copyleft/gpl.html.
18 * A copy is found in the text file GPL.txt and important notices to the license
19 * from the author is found in LICENSE.txt distributed with these scripts.
20 *
21 *
22 * This script is distributed in the hope that it will be useful,
23 * but WITHOUT ANY WARRANTY; without even the implied warranty of
24 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
25 * GNU General Public License for more details.
26 *
27 * This copyright notice MUST APPEAR in all copies of the script!
28 ***************************************************************/
29
30 use TYPO3\CMS\Core\Utility\GeneralUtility;
31 use TYPO3\CMS\Backend\Utility\BackendUtility;
32 use TYPO3\CMS\Backend\Utility\IconUtility;
33
34 /**
35 * Module: TypoScript Tools
36 *
37 * $TYPO3_CONF_VARS["MODS"]["web_ts"]["onlineResourceDir"] = Directory of default resources. Eg. "fileadmin/res/" or so.
38 *
39 * @author Kasper Skårhøj <kasperYYYY@typo3.com>
40 */
41 class TypoScriptTemplateModuleController extends \TYPO3\CMS\Backend\Module\BaseScriptClass {
42
43 /**
44 * @todo Define visibility
45 */
46 public $perms_clause;
47
48 /**
49 * @todo Define visibility
50 */
51 public $e;
52
53 /**
54 * @todo Define visibility
55 */
56 public $sObj;
57
58 /**
59 * @todo Define visibility
60 */
61 public $edit;
62
63 /**
64 * @todo Define visibility
65 */
66 public $textExtensions = 'html,htm,txt,css,tmpl,inc,js';
67
68 /**
69 * @todo Define visibility
70 */
71 public $modMenu_type = '';
72
73 /**
74 * @todo Define visibility
75 */
76 public $modMenu_dontValidateList = '';
77
78 /**
79 * @todo Define visibility
80 */
81 public $modMenu_setDefaultList = '';
82
83 /**
84 * Constructor
85 */
86 public function __construct() {
87 $GLOBALS['LANG']->includeLLFile('EXT:tstemplate/ts/locallang.xlf');
88 $GLOBALS['BE_USER']->modAccess($GLOBALS['MCONF'], TRUE);
89 }
90
91 /**
92 * Init
93 *
94 * @return void
95 * @todo Define visibility
96 */
97 public function init() {
98 parent::init();
99 $this->id = (int)GeneralUtility::_GP('id');
100 $this->e = GeneralUtility::_GP('e');
101 $this->sObj = GeneralUtility::_GP('sObj');
102 $this->edit = GeneralUtility::_GP('edit');
103 $this->perms_clause = $GLOBALS['BE_USER']->getPagePermsClause(1);
104 }
105
106 /**
107 * Clear cache
108 *
109 * @return void
110 * @todo Define visibility
111 */
112 public function clearCache() {
113 if (GeneralUtility::_GP('clear_all_cache')) {
114 $tce = GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\DataHandling\\DataHandler');
115 /** @var $tce \TYPO3\CMS\Core\DataHandling\DataHandler */
116 $tce->stripslashes_values = 0;
117 $tce->start(array(), array());
118 $tce->clear_cacheCmd('all');
119 }
120 }
121
122 /**
123 * Main
124 *
125 * @return void
126 * @todo Define visibility
127 */
128 public function main() {
129 // Template markers
130 $markers = array(
131 'CSH' => '',
132 'FUNC_MENU' => '',
133 'CONTENT' => ''
134 );
135
136 // Access check...
137 // The page will show only if there is a valid page and if this page may be viewed by the user
138 $this->pageinfo = BackendUtility::readPageAccess($this->id, $this->perms_clause);
139 $this->access = is_array($this->pageinfo) ? 1 : 0;
140 $this->doc = GeneralUtility::makeInstance('TYPO3\\CMS\\Backend\\Template\\DocumentTemplate');
141 $this->doc->backPath = $GLOBALS['BACK_PATH'];
142 $this->doc->setModuleTemplate('EXT:tstemplate/Resources/Private/Templates/tstemplate.html');
143
144 if ($this->id && $this->access) {
145 $urlParameters = array(
146 'id' => $this->id,
147 'template' => 'all'
148 );
149 $aHref = BackendUtility::getModuleUrl('web_ts', $urlParameters);
150 $this->doc->form = '<form action="' . htmlspecialchars($aHref) . '" method="post" enctype="' . $GLOBALS['TYPO3_CONF_VARS']['SYS']['form_enctype'] . '" name="editForm">';
151
152 // JavaScript
153 $this->doc->JScode = '
154 <script language="javascript" type="text/javascript">
155 script_ended = 0;
156 function jumpToUrl(URL) {
157 window.location.href = URL;
158 }
159 function uFormUrl(aname) {
160 document.forms[0].action = ' . GeneralUtility::quoteJSvalue(($aHref . '#'), TRUE) . '+aname;
161 }
162 function brPoint(lnumber,t) {
163 window.location.href = ' . GeneralUtility::quoteJSvalue(($aHref . '&SET[function]=TYPO3\\CMS\\Tstemplate\\Controller\\TypoScriptTemplateObjectBrowserModuleFunctionController&SET[ts_browser_type]='), TRUE) . '+(t?"setup":"const")+"&breakPointLN="+lnumber;
164 return false;
165 }
166 </script>
167 ';
168 $this->doc->postCode = '
169 <script language="javascript" type="text/javascript">
170 script_ended = 1;
171 if (top.fsMod) top.fsMod.recentIds["web"] = ' . $this->id . ';
172 </script>
173 ';
174 $this->doc->inDocStylesArray[] = '
175 TABLE#typo3-objectBrowser { width: 100%; margin-bottom: 24px; }
176 TABLE#typo3-objectBrowser A { text-decoration: none; }
177 TABLE#typo3-objectBrowser .comment { color: maroon; font-weight: bold; }
178 .ts-typoscript { width: 100%; }
179 .tsob-menu label, .tsob-menu-row2 label, .tsob-conditions label { padding: 0 5px 0 0; vertical-align: text-top;}
180 .tsob-menu-row2 {margin-top: 10px;}
181 .tsob-conditions {padding: 1px 2px;}
182 .tsob-search-submit {margin-left: 3px; margin-right: 3px;}
183 .tst-analyzer-options { margin:5px 0; }
184 .tst-analyzer-options label {padding-left:5px; vertical-align:text-top; }
185 ';
186 // Setting up the context sensitive menu:
187 $this->doc->getContextMenuCode();
188 // Build the modulle content
189 $this->content = $this->doc->header($GLOBALS['LANG']->getLL('moduleTitle'));
190 $this->extObjContent();
191 // Setting up the buttons and markers for docheader
192 $docHeaderButtons = $this->getButtons();
193 $markers['FUNC_MENU'] = BackendUtility::getFuncMenu($this->id, 'SET[function]', $this->MOD_SETTINGS['function'], $this->MOD_MENU['function']);
194 $markers['CONTENT'] = $this->content;
195 } else {
196 // Template pages:
197 $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('pages.uid, count(*) AS count, max(sys_template.root) AS root_max_val, min(sys_template.root) AS root_min_val', 'pages,sys_template', 'pages.uid=sys_template.pid' . BackendUtility::deleteClause('pages') . BackendUtility::versioningPlaceholderClause('pages') . BackendUtility::deleteClause('sys_template') . BackendUtility::versioningPlaceholderClause('sys_template'), 'pages.uid');
198 $templateArray = array();
199 $pArray = array();
200 while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
201 $this->setInPageArray($pArray, BackendUtility::BEgetRootLine($row['uid'], 'AND 1=1'), $row);
202 }
203 $GLOBALS['TYPO3_DB']->sql_free_result($res);
204
205 $table = '<table class="t3-table" id="ts-overview">' .
206 '<thead>' .
207 '<tr>' .
208 '<th>' . $GLOBALS['LANG']->getLL('pageName') . '</th>' .
209 '<th>' . $GLOBALS['LANG']->getLL('templates') . '</th>' .
210 '<th>' . $GLOBALS['LANG']->getLL('isRoot') . '</th>' .
211 '<th>' . $GLOBALS['LANG']->getLL('isExt') . '</th>' .
212 '</tr>' .
213 '</thead>' .
214 '<tbody>' . implode('', $this->renderList($pArray)) . '</tbody>' .
215 '</table>';
216
217 $this->content = $this->doc->header($GLOBALS['LANG']->getLL('moduleTitle'));
218 $this->content .= $this->doc->section('', '<p class="lead">' . $GLOBALS['LANG']->getLL('overview') . '</p>' . $table);
219
220 // RENDER LIST of pages with templates, END
221 // Setting up the buttons and markers for docheader
222 $docHeaderButtons = $this->getButtons();
223 $markers['CONTENT'] = $this->content;
224 }
225
226 // Build the <body> for the module
227 $this->content = $this->doc->moduleBody($this->pageinfo, $docHeaderButtons, $markers);
228 // Renders the module page
229 $this->content = $this->doc->render('Template Tools', $this->content);
230 }
231
232 /**
233 * Print content
234 *
235 * @return void
236 * @todo Define visibility
237 */
238 public function printContent() {
239 echo $this->content;
240 }
241
242 /**
243 * Create the panel of buttons for submitting the form or otherwise perform operations.
244 *
245 * @return array All available buttons as an assoc. array
246 */
247 protected function getButtons() {
248 $buttons = array(
249 'back' => '',
250 'close' => '',
251 'new' => '',
252 'save' => '',
253 'save_close' => '',
254 'view' => '',
255 'shortcut' => ''
256 );
257
258 if ($this->id && $this->access) {
259 // View page
260 $buttons['view'] = '<a href="#" onclick="' . htmlspecialchars(BackendUtility::viewOnClick($this->pageinfo['uid'], $GLOBALS['BACK_PATH'], BackendUtility::BEgetRootLine($this->pageinfo['uid']))) . '" title="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:labels.showPage', TRUE) . '">' . IconUtility::getSpriteIcon('actions-document-view') . '</a>';
261 if ($this->extClassConf['name'] == 'TYPO3\CMS\Tstemplate\Controller\TypoScriptTemplateInformationModuleFunctionController') {
262 // NEW button
263 $buttons['new'] = '<input type="image" class="c-inputButton" name="createExtension" value="New"' . IconUtility::skinImg($GLOBALS['BACK_PATH'], 'gfx/new_el.gif', '') . ' title="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:db_new.php.pagetitle', TRUE) . '" />';
264 if (!empty($this->e) && !GeneralUtility::_POST('abort') && !GeneralUtility::_POST('saveclose')) {
265 // no NEW-button while edit
266 $buttons['new'] = '';
267 // SAVE button
268 $buttons['save'] = IconUtility::getSpriteIcon('actions-document-save', array(
269 'html' => '<input type="image" class="c-inputButton" name="submit" src="clear.gif" ' . 'title="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:rm.saveDoc', TRUE) . '" ' . 'value="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:rm.saveDoc', TRUE) . '" ' . '/>'
270 ));
271 // SAVE AND CLOSE button
272 $buttons['save_close'] = IconUtility::getSpriteIcon('actions-document-save-close', array(
273 'html' => '<input type="image" class="c-inputButton" name="saveclose" src="clear.gif" ' . 'title="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:rm.saveCloseDoc', TRUE) . '" ' . 'value="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:rm.saveCloseDoc', TRUE) . '" ' . '/>'
274 ));
275 // CLOSE button
276 $buttons['close'] = IconUtility::getSpriteIcon('actions-document-close', array(
277 'html' => '<input type="image" class="c-inputButton" name="abort" src="clear.gif" ' . 'title="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:rm.closeDoc', TRUE) . '" ' . 'value="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:rm.closeDoc', TRUE) . '" ' . '/>'
278 ));
279 }
280 } elseif ($this->extClassConf['name'] == 'TYPO3\CMS\Tstemplate\Controller\TypoScriptTemplateConstantEditorModuleFunctionController' && count($this->MOD_MENU['constant_editor_cat'])) {
281 // SAVE button
282 $buttons['save'] = IconUtility::getSpriteIcon('actions-document-save', array('html' => '<input type="image" class="c-inputButton" name="submit" src="clear.gif" ' . 'title="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:rm.saveDoc', TRUE) . '" ' . 'value="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:rm.saveDoc', TRUE) . '" ' . '/>'));
283 } elseif ($this->extClassConf['name'] == 'TYPO3\CMS\Tstemplate\Controller\TypoScriptTemplateObjectBrowserModuleFunctionController') {
284 if (!empty($this->sObj)) {
285 // BACK
286 $urlParameters = array(
287 'id' => $this->id
288 );
289 $aHref = BackendUtility::getModuleUrl('web_ts', $urlParameters);
290 $buttons['back'] = '<a href="' . htmlspecialchars($aHref) . '" class="typo3-goBack" title="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:labels.goBack', TRUE) . '">' . IconUtility::getSpriteIcon('actions-view-go-back') . '</a>';
291 }
292 }
293 // Shortcut
294 if ($GLOBALS['BE_USER']->mayMakeShortcut()) {
295 $buttons['shortcut'] = $this->doc->makeShortcutIcon('id, edit_record, pointer, new_unique_uid, search_field, search_levels, showLimit', implode(',', array_keys($this->MOD_MENU)), $this->MCONF['name']);
296 }
297 } else {
298 // Shortcut
299 if ($GLOBALS['BE_USER']->mayMakeShortcut()) {
300 $buttons['shortcut'] = $this->doc->makeShortcutIcon('id', '', $this->MCONF['name']);
301 }
302 }
303 return $buttons;
304 }
305
306 // OTHER FUNCTIONS:
307 /**
308 * Wrap title for link in template
309 *
310 * @param string $title
311 * @param string $onlyKey
312 * @return string
313 * @todo Define visibility
314 */
315 public function linkWrapTemplateTitle($title, $onlyKey = '') {
316 $urlParameters = array(
317 'id' => $this->id
318 );
319 $aHref = BackendUtility::getModuleUrl('web_ts', $urlParameters);
320 if ($onlyKey) {
321 $title = '<a href="' . htmlspecialchars(($aHref . '&e[' . $onlyKey . ']=1&SET[function]=TYPO3\\CMS\\Tstemplate\\Controller\\TypoScriptTemplateInformationModuleFunctionController')) . '">' . htmlspecialchars($title) . '</a>';
322 } else {
323 $title = '<a href="' . htmlspecialchars(($aHref . '&e[constants]=1&e[config]=1&SET[function]=TYPO3\\CMS\\Tstemplate\\Controller\\TypoScriptTemplateInformationModuleFunctionController')) . '">' . htmlspecialchars($title) . '</a>';
324 }
325 return $title;
326 }
327
328 /**
329 * No template
330 *
331 * @param integer $newStandardTemplate
332 * @return string
333 * @todo Define visibility
334 */
335 public function noTemplate($newStandardTemplate = 0) {
336 // Defined global here!
337 $tmpl = GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\TypoScript\\ExtendedTemplateService');
338 /** @var $tmpl \TYPO3\CMS\Core\TypoScript\ExtendedTemplateService */
339 // Do not log time-performance information
340 $tmpl->tt_track = FALSE;
341 $tmpl->init();
342 $theOutput = '';
343 $flashMessage = GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Messaging\\FlashMessage', $GLOBALS['LANG']->getLL('noTemplateDescription') . '<br />' . $GLOBALS['LANG']->getLL('createTemplateToEditConfiguration'), $GLOBALS['LANG']->getLL('noTemplate'), \TYPO3\CMS\Core\Messaging\FlashMessage::INFO);
344 $theOutput .= $flashMessage->render();
345 // New standard?
346 if ($newStandardTemplate) {
347 // Hook to change output, implemented for statictemplates
348 if (isset(
349 $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['TYPO3\\CMS\\Tstemplate\\Controller\\TypoScriptTemplateModuleController']['newStandardTemplateView']
350 )) {
351 $selector = '';
352 $staticsText = '';
353 $reference = array(
354 'selectorHtml' => &$selector,
355 'staticsText' => &$staticsText
356 );
357 GeneralUtility::callUserFunction(
358 $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['TYPO3\\CMS\\Tstemplate\\Controller\\TypoScriptTemplateModuleController']['newStandardTemplateView'],
359 $reference,
360 $this
361 );
362 $selector = $reference['selectorHtml'];
363 $staticsText = $reference['staticsText'];
364 } else {
365 $selector = '<input type="hidden" name="createStandard" value="" />';
366 $staticsText = '';
367 }
368 // Extension?
369 $theOutput .= $this->doc->section($GLOBALS['LANG']->getLL('newWebsite') . $staticsText, $GLOBALS['LANG']->getLL('newWebsiteDescription') . '<br /><br />' . $selector . '<input type="Submit" name="newWebsite" value="' . $GLOBALS['LANG']->getLL('newWebsiteAction') . '" />', 0, 1);
370 }
371 // Extension?
372 $theOutput .= $this->doc->spacer(10);
373 $theOutput .= $this->doc->section($GLOBALS['LANG']->getLL('extTemplate'), $GLOBALS['LANG']->getLL('extTemplateDescription') . '<br /><br />' . '<input type="submit" name="createExtension" value="' . $GLOBALS['LANG']->getLL('extTemplateAction') . '" />', 0, 1);
374 // Go to first appearing...
375 $first = $tmpl->ext_prevPageWithTemplate($this->id, $this->perms_clause);
376 if ($first) {
377 $theOutput .= $this->doc->spacer(10);
378 $urlParameters = array(
379 'id' => $first['uid']
380 );
381 $aHref = BackendUtility::getModuleUrl('web_ts', $urlParameters);
382 $theOutput .= $this->doc->section($GLOBALS['LANG']->getLL('goToClosest'), sprintf($GLOBALS['LANG']->getLL('goToClosestDescription') . '<br /><br />%s<strong>' . $GLOBALS['LANG']->getLL('goToClosestAction') . '</strong>%s', htmlspecialchars($first['title']), $first['uid'], '<a href="' . htmlspecialchars($aHref) . '">', '</a>'), 0, 1);
383 }
384 return $theOutput;
385 }
386
387 /**
388 * @todo Define visibility
389 */
390 public function templateMenu() {
391 // Defined global here!
392 $tmpl = GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\TypoScript\\ExtendedTemplateService');
393 /** @var $tmpl \TYPO3\CMS\Core\TypoScript\ExtendedTemplateService */
394 // Do not log time-performance information
395 $tmpl->tt_track = FALSE;
396 $tmpl->init();
397 $all = $tmpl->ext_getAllTemplates($this->id, $this->perms_clause);
398 $menu = '';
399 if (count($all) > 1) {
400 $this->MOD_MENU['templatesOnPage'] = array();
401 foreach ($all as $d) {
402 $this->MOD_MENU['templatesOnPage'][$d['uid']] = $d['title'];
403 }
404 }
405 $this->MOD_SETTINGS = BackendUtility::getModuleData($this->MOD_MENU, GeneralUtility::_GP('SET'), $this->MCONF['name'], $this->modMenu_type, $this->modMenu_dontValidateList, $this->modMenu_setDefaultList);
406 $menu = BackendUtility::getFuncMenu($this->id, 'SET[templatesOnPage]', $this->MOD_SETTINGS['templatesOnPage'], $this->MOD_MENU['templatesOnPage']);
407 return $menu;
408 }
409
410 /**
411 * Create template
412 *
413 * @param integer $id
414 * @param integer $actTemplateId
415 * @return string
416 * @todo Define visibility
417 */
418 public function createTemplate($id, $actTemplateId = 0) {
419 if (GeneralUtility::_GP('createExtension') || GeneralUtility::_GP('createExtension_x')) {
420 $tce = GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\DataHandling\\DataHandler');
421 /** @var $tce \TYPO3\CMS\Core\DataHandling\DataHandler */
422 $tce->stripslashes_values = 0;
423 $recData = array();
424 $recData['sys_template']['NEW'] = array(
425 'pid' => $actTemplateId ? -1 * $actTemplateId : $id,
426 'title' => '+ext'
427 );
428 $tce->start($recData, array());
429 $tce->process_datamap();
430 return $tce->substNEWwithIDs['NEW'];
431 } elseif (GeneralUtility::_GP('newWebsite')) {
432 $tce = GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\DataHandling\\DataHandler');
433 /** @var $tce \TYPO3\CMS\Core\DataHandling\DataHandler */
434 $tce->stripslashes_values = 0;
435 $recData = array();
436 // Hook to handle row data, implemented for statictemplates
437 if (isset(
438 $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['TYPO3\\CMS\\Tstemplate\\Controller\\TypoScriptTemplateModuleController']['newStandardTemplateHandler']
439 )) {
440 $reference = array(
441 'recData' => &$recData,
442 'id' => $id,
443 );
444 GeneralUtility::callUserFunction(
445 $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['TYPO3\\CMS\\Tstemplate\\Controller\\TypoScriptTemplateModuleController']['newStandardTemplateHandler'],
446 $reference,
447 $this
448 );
449 $recData = $reference['recData'];
450 } else {
451 $recData['sys_template']['NEW'] = array(
452 'pid' => $id,
453 'title' => $GLOBALS['LANG']->getLL('titleNewSite'),
454 'sorting' => 0,
455 'root' => 1,
456 'clear' => 3,
457 'config' => '
458 # Default PAGE object:
459 page = PAGE
460 page.10 = TEXT
461 page.10.value = HELLO WORLD!
462 '
463 );
464 }
465 $tce->start($recData, array());
466 $tce->process_datamap();
467 $tce->clear_cacheCmd('all');
468 }
469 }
470
471 // RENDER LIST of pages with templates, BEGIN
472 /**
473 * Set page in array
474 *
475 * @param array $pArray
476 * @param array $rlArr
477 * @param array $row
478 * @return void
479 * @todo Define visibility
480 */
481 public function setInPageArray(&$pArray, $rlArr, $row) {
482 ksort($rlArr);
483 reset($rlArr);
484 if (!$rlArr[0]['uid']) {
485 array_shift($rlArr);
486 }
487 $cEl = current($rlArr);
488 $pArray[$cEl['uid']] = htmlspecialchars($cEl['title']);
489 array_shift($rlArr);
490 if (count($rlArr)) {
491 if (!isset($pArray[($cEl['uid'] . '.')])) {
492 $pArray[$cEl['uid'] . '.'] = array();
493 }
494 $this->setInPageArray($pArray[$cEl['uid'] . '.'], $rlArr, $row);
495 } else {
496 $pArray[$cEl['uid'] . '_'] = $row;
497 }
498 }
499
500 /**
501 * Render the list
502 *
503 * @param array $pArray
504 * @param array $lines
505 * @param integer $c
506 * @return array
507 * @todo Define visibility
508 */
509 public function renderList($pArray, $lines = array(), $c = 0) {
510 if (is_array($pArray)) {
511 reset($pArray);
512 static $i;
513 foreach ($pArray as $k => $v) {
514 if (\TYPO3\CMS\Core\Utility\MathUtility::canBeInterpretedAsInteger($k)) {
515 if (isset($pArray[$k . '_'])) {
516 $lines[] = '<tr class="' . ($i++ % 2 == 0 ? 'bgColor4' : 'bgColor6') . '">
517 <td nowrap><img src="clear.gif" width="1" height="1" hspace=' . $c * 10 . ' align="top">' . '<a href="' . GeneralUtility::linkThisScript(array('id' => $k)) . '">' . IconUtility::getSpriteIconForRecord('pages', BackendUtility::getRecordWSOL('pages', $k), array('title' => ('ID: ' . $k))) . GeneralUtility::fixed_lgd_cs($pArray[$k], 30) . '</a></td>
518 <td>' . $pArray[($k . '_')]['count'] . '</td>
519 <td>' . ($pArray[$k . '_']['root_max_val'] > 0 ? IconUtility::getSpriteIcon('status-status-checked') : '&nbsp;') . '</td>
520 <td>' . ($pArray[$k . '_']['root_min_val'] == 0 ? IconUtility::getSpriteIcon('status-status-checked') : '&nbsp;') . '</td>
521 </tr>';
522 } else {
523 $lines[] = '<tr class="' . ($i++ % 2 == 0 ? 'bgColor4' : 'bgColor6') . '">
524 <td nowrap ><img src="clear.gif" width="1" height="1" hspace=' . $c * 10 . ' align=top>' . IconUtility::getSpriteIconForRecord('pages', BackendUtility::getRecordWSOL('pages', $k)) . GeneralUtility::fixed_lgd_cs($pArray[$k], 30) . '</td>
525 <td></td>
526 <td></td>
527 <td></td>
528 </tr>';
529 }
530 $lines = $this->renderList($pArray[$k . '.'], $lines, $c + 1);
531 }
532 }
533 }
534 return $lines;
535 }
536
537 }