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