24af3312c7f3d7bbf56972b569db824160ad5125
[Packages/TYPO3.CMS.git] / typo3 / sysext / backend / Classes / Controller / ContentElement / ElementInformationController.php
1 <?php
2 namespace TYPO3\CMS\Backend\Controller\ContentElement;
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 TYPO3\CMS\Backend\Utility\BackendUtility;
18 use TYPO3\CMS\Backend\Utility\IconUtility;
19 use TYPO3\CMS\Core\Resource\ProcessedFile;
20 use TYPO3\CMS\Core\Utility\GeneralUtility;
21
22 /**
23 * Script Class for showing information about an item.
24 *
25 * @author Kasper Skårhøj <kasperYYYY@typo3.com>
26 */
27 class ElementInformationController {
28
29 /**
30 * Record table name
31 *
32 * @var string
33 */
34 public $table;
35
36 /**
37 * Record uid
38 *
39 * @var int
40 */
41 public $uid;
42
43 /**
44 * @var string
45 */
46 protected $permsClause;
47
48 /**
49 * @var boolean
50 */
51 public $access = FALSE;
52
53 /**
54 * Which type of element:
55 * - "file"
56 * - "db"
57 *
58 * @var string
59 */
60 public $type = '';
61
62 /**
63 * @var \TYPO3\CMS\Backend\Template\DocumentTemplate
64 */
65 public $doc;
66
67 /**
68 * @var string
69 */
70 protected $content = '';
71
72 /**
73 * For type "db": Set to page record of the parent page of the item set
74 * (if type="db")
75 *
76 * @var array
77 * @todo Define visibility
78 */
79 public $pageinfo;
80
81 /**
82 * Database records identified by table/uid
83 *
84 * @var array
85 */
86 protected $row;
87
88 /**
89 * @var \TYPO3\CMS\Core\Resource\File
90 */
91 protected $fileObject;
92
93 /**
94 * @var \TYPO3\CMS\Core\Resource\Folder
95 */
96 protected $folderObject;
97
98 /**
99 * Constructor
100 */
101 public function __construct() {
102 $GLOBALS['BACK_PATH'] = '';
103 $GLOBALS['SOBE'] = $this;
104
105 $this->init();
106 }
107
108 /**
109 * Determines if table/uid point to database record or file and
110 * if user has access to view information
111 *
112 * @return void
113 */
114 public function init() {
115 $this->table = GeneralUtility::_GET('table');
116 $this->uid = GeneralUtility::_GET('uid');
117
118 $this->perms_clause = $GLOBALS['BE_USER']->getPagePermsClause(1);
119 $this->doc = GeneralUtility::makeInstance('TYPO3\\CMS\\Backend\\Template\\DocumentTemplate');
120
121 if (isset($GLOBALS['TCA'][$this->table])) {
122 $this->initDatabaseRecord();
123 } elseif ($this->table == '_FILE' || $this->table == '_FOLDER' || $this->table == 'sys_file') {
124 $this->initFileOrFolderRecord();
125 }
126 }
127
128 /**
129 * Init database records (table)
130 */
131 protected function initDatabaseRecord() {
132 $this->type = 'db';
133 $this->uid = (int)$this->uid;
134
135 // Check permissions and uid value:
136 if ($this->uid && $GLOBALS['BE_USER']->check('tables_select', $this->table)) {
137 if ((string) $this->table == 'pages') {
138 $this->pageinfo = BackendUtility::readPageAccess($this->uid, $this->perms_clause);
139 $this->access = is_array($this->pageinfo) ? 1 : 0;
140 $this->row = $this->pageinfo;
141 } else {
142 $this->row = BackendUtility::getRecordWSOL($this->table, $this->uid);
143 if ($this->row) {
144 $this->pageinfo = BackendUtility::readPageAccess($this->row['pid'], $this->perms_clause);
145 $this->access = is_array($this->pageinfo) ? 1 : 0;
146 }
147 }
148 /** @var $treatData \TYPO3\CMS\Backend\Form\DataPreprocessor */
149 $treatData = GeneralUtility::makeInstance('TYPO3\\CMS\\Backend\\Form\\DataPreprocessor');
150 $treatData->renderRecord($this->table, $this->uid, 0, $this->row);
151 }
152 }
153
154 /**
155 * Init file/folder parameters
156 */
157 protected function initFileOrFolderRecord() {
158 $fileOrFolderObject = \TYPO3\CMS\Core\Resource\ResourceFactory::getInstance()->
159 retrieveFileOrFolderObject($this->uid);
160
161 if ($fileOrFolderObject instanceof \TYPO3\CMS\Core\Resource\Folder) {
162 $this->folderObject = $fileOrFolderObject;
163 $this->access = $this->folderObject->checkActionPermission('read');
164 $this->type = 'folder';
165 } else {
166 $this->fileObject = $fileOrFolderObject;
167 $this->access = $this->fileObject->checkActionPermission('read');
168 $this->type = 'file';
169 $this->table = 'sys_file_metadata';
170
171 try {
172 $metaData = $fileOrFolderObject->_getMetaData();
173 $this->row = BackendUtility::getRecordWSOL($this->table, $metaData['uid']);
174 } catch (\Exception $e) {
175 $this->row = array();
176 }
177 }
178 }
179
180 /**
181 * @return void
182 */
183 public function main() {
184 if (!$this->access) {
185 return;
186 }
187
188 // render type by user func
189 $typeRendered = FALSE;
190 if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['typo3/show_item.php']['typeRendering'])) {
191 foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['typo3/show_item.php']['typeRendering'] as $classRef) {
192 $typeRenderObj = GeneralUtility::getUserObj($classRef);
193 // @TODO should have an interface
194 if (is_object($typeRenderObj) && method_exists($typeRenderObj, 'isValid') && method_exists($typeRenderObj, 'render')) {
195 if ($typeRenderObj->isValid($this->type, $this)) {
196 $this->content .= $typeRenderObj->render($this->type, $this);
197 $typeRendered = TRUE;
198 break;
199 }
200 }
201 }
202 }
203
204 if (!$typeRendered) {
205 $this->content .= $this->renderPageTitle();
206 $this->content .= $this->renderPreview();
207 $this->content .= $this->renderPropertiesAsTable();
208 $this->content .= $this->renderReferences();
209 }
210 }
211
212 /**
213 * Render page title with icon, table title and record title
214 *
215 * @return string
216 */
217 protected function renderPageTitle() {
218 if ($this->type === 'folder') {
219 $table = $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_common.xlf:folder');
220 $title = $this->doc->getResourceHeader($this->folderObject, array(' ', ''));
221 } elseif ($this->type === 'file') {
222 $table = $GLOBALS['LANG']->sL($GLOBALS['TCA'][$this->table]['ctrl']['title']);
223 $title = $this->doc->getResourceHeader($this->fileObject, array(' ', ''));
224 } else {
225 $table = $GLOBALS['LANG']->sL($GLOBALS['TCA'][$this->table]['ctrl']['title']);
226 $title = $this->doc->getHeader($this->table, $this->row, $this->pageinfo['_thePath'], 1, array(' ', ''));
227 }
228
229 return '<h1>' .
230 ($table ? '<small>' . $table . '</small><br />' : '') .
231 $title .
232 '</h1>';
233 }
234
235 /**
236 * Render preview for current record
237 *
238 * @return string
239 */
240 protected function renderPreview() {
241 // Perhaps @TODO in future: Also display preview for records - without fileObject
242 if (!$this->fileObject) {
243 return;
244 }
245 $imageTag = '';
246 $downloadLink = '';
247
248 // check if file is marked as missing
249 if ($this->fileObject->isMissing()) {
250 $flashMessage = \TYPO3\CMS\Core\Resource\Utility\BackendUtility::getFlashMessageForMissingFile($this->fileObject);
251 $imageTag .= $flashMessage->render();
252
253 } else {
254
255 $fileExtension = $this->fileObject->getExtension();
256 $thumbUrl = '';
257 if (GeneralUtility::inList($GLOBALS['TYPO3_CONF_VARS']['GFX']['imagefile_ext'], $fileExtension)) {
258 $thumbUrl = $this->fileObject->process(
259 ProcessedFile::CONTEXT_IMAGEPREVIEW,
260 array(
261 'width' => '400m',
262 'height' => '400m'
263 )
264 )->getPublicUrl(TRUE);
265 }
266
267 // Create thumbnail image?
268 if ($thumbUrl) {
269 $imageTag .= '<img src="' . $thumbUrl . '" ' .
270 'alt="' . htmlspecialchars(trim($this->fileObject->getName())) . '" ' .
271 'title="' . htmlspecialchars(trim($this->fileObject->getName())) . '" />';
272 }
273
274 // Display download link?
275 $url = $this->fileObject->getPublicUrl(TRUE);
276
277 if ($url) {
278 $downloadLink .= '<a href="' . htmlspecialchars($url) . '" target="_blank" class="t3-button">' .
279 IconUtility::getSpriteIcon('actions-edit-download') . ' ' .
280 $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_common.xlf:download', TRUE) .
281 '</a>';
282 }
283 }
284
285 return ($imageTag ? '<p>' . $imageTag . '</p>' : '') .
286 ($downloadLink ? '<p>' . $downloadLink . '</p>' : '');
287 }
288
289 /**
290 * Render property array as html table
291 *
292 * @return string
293 */
294 protected function renderPropertiesAsTable() {
295 $tableRows = array();
296 $extraFields = array();
297
298 if ($this->type !== 'folder') {
299 $extraFields = array(
300 'crdate' => $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_general.xlf:LGL.creationDate', TRUE),
301 'cruser_id' => $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_general.xlf:LGL.creationUserId', TRUE),
302 'tstamp' => $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_general.xlf:LGL.timestamp', TRUE)
303 );
304 }
305
306 if (in_array($this->type, array('folder', 'file'), TRUE)) {
307 $extraFields['storage'] = $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_tca.xlf:sys_file.storage', TRUE);
308 $extraFields['folder'] = $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_common.xlf:folder', TRUE);
309 }
310
311 foreach ($extraFields as $name => $value) {
312 $rowValue = BackendUtility::getProcessedValueExtra($this->table, $name, $this->row[$name]);
313 if ($name === 'cruser_id' && $rowValue) {
314 $userTemp = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows('username, realName', 'be_users', 'uid = ' . (int)$rowValue);
315 if ($userTemp[0]['username'] !== '') {
316 $rowValue = $userTemp[0]['username'];
317 if ($userTemp[0]['realName'] !== '') {
318 $rowValue .= ' - ' . $userTemp[0]['realName'];
319 }
320 }
321 } elseif ($rowValue === NULL) {
322 $resourceObject = $this->fileObject ?: $this->folderObject;
323 if ($name === 'storage') {
324 $rowValue = $resourceObject->getStorage()->getName();
325 } elseif ($name === 'folder') {
326 $rowValue = $resourceObject->getParentFolder()->getIdentifier();
327 }
328 }
329 $tableRows[] = '
330 <tr>
331 <td><strong>' . rtrim($value, ':') . '</strong></td>
332 <td>' . htmlspecialchars($rowValue) . '</td>
333 </tr>';
334 }
335
336 // Traverse the list of fields to display for the record:
337 $fieldList = GeneralUtility::trimExplode(',', $GLOBALS['TCA'][$this->table]['interface']['showRecordFieldList'], TRUE);
338 foreach ($fieldList as $name) {
339 $name = trim($name);
340 $uid = $this->row['uid'];
341
342 if (!isset($GLOBALS['TCA'][$this->table]['columns'][$name])) {
343 continue;
344 }
345
346 $isExcluded = !(!$GLOBALS['TCA'][$this->table]['columns'][$name]['exclude'] || $GLOBALS['BE_USER']->check('non_exclude_fields', $this->table . ':' . $name));
347 if ($isExcluded) {
348 continue;
349 }
350
351 $itemValue = BackendUtility::getProcessedValue($this->table, $name, $this->row[$name], 0, 0, FALSE, $uid);
352 $itemLabel = $GLOBALS['LANG']->sL(BackendUtility::getItemLabel($this->table, $name), TRUE);
353 $tableRows[] = '
354 <tr>
355 <td><strong>' . $itemLabel . '</strong></td>
356 <td>' . htmlspecialchars($itemValue) . '</td>
357 </tr>';
358 }
359
360 return '<table class="t3-table">' . implode('', $tableRows) . '</table>';
361 }
362
363 /*
364 * Render references section (references from and references to current record)
365 *
366 * @return string
367 */
368 protected function renderReferences() {
369 $content = '';
370
371 switch ($this->type) {
372 case 'db': {
373 $references = $this->makeRef($this->table, $this->row['uid']);
374 if (!empty($references)) {
375 $content .= $this->doc->section($GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:show_item.php.referencesToThisItem'), $references);
376 }
377
378 $referencesFrom = $this->makeRefFrom($this->table, $this->row['uid']);
379 if (!empty($referencesFrom)) {
380 $content .= $this->doc->section($GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:show_item.php.referencesFromThisItem'), $referencesFrom);
381 }
382 break;
383 }
384
385 case 'file': {
386 if ($this->fileObject && $this->fileObject->isIndexed()) {
387 $references = $this->makeRef('_FILE', $this->fileObject);
388
389 if (!empty($references)) {
390 $header = $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:show_item.php.referencesToThisItem');
391 $content .= $this->doc->section($header, $references);
392 }
393 }
394 break;
395 }
396 }
397
398 return $content;
399 }
400
401 /**
402 * Renders file properties as html table
403 *
404 * @param array $fieldList
405 * @return string
406 */
407 protected function renderFileInformationAsTable($fieldList) {
408 $tableRows = array();
409 foreach ($fieldList as $name) {
410 if (!isset($GLOBALS['TCA'][$this->table]['columns'][$name])) {
411 continue;
412 }
413 $isExcluded = !(!$GLOBALS['TCA'][$this->table]['columns'][$name]['exclude'] || $GLOBALS['BE_USER']->check('non_exclude_fields', $this->table . ':' . $name));
414 if ($isExcluded) {
415 continue;
416 }
417 $uid = $this->row['uid'];
418 $itemValue = BackendUtility::getProcessedValue($this->table, $name, $this->row[$name], 0, 0, FALSE, $uid);
419 $itemLabel = $GLOBALS['LANG']->sL(BackendUtility::getItemLabel($this->table, $name), TRUE);
420 $tableRows[] = '
421 <tr>
422 <td><strong>' . $itemLabel . '</strong></td>
423 <td>' . htmlspecialchars($itemValue) . '</td>
424 </tr>';
425 }
426
427 if (!$tableRows) {
428 return '';
429 }
430
431 return '<table id="typo3-showitem" class="t3-table-info">' .
432 implode('', $tableRows) .
433 '</table>';
434 }
435
436 /**
437 * End page and print content
438 *
439 * @return void
440 */
441 public function printContent() {
442 echo $this->doc->startPage('') .
443 $this->doc->insertStylesAndJS($this->content) .
444 $this->doc->endPage();
445 }
446
447 /**
448 * Get field name for specified table/column name
449 *
450 * @param string $tableName Table name
451 * @param string $fieldName Column name
452 * @return string label
453 */
454 public function getLabelForTableColumn($tableName, $fieldName) {
455 if ($GLOBALS['TCA'][$tableName]['columns'][$fieldName]['label'] !== NULL) {
456 $field = $GLOBALS['LANG']->sL($GLOBALS['TCA'][$tableName]['columns'][$fieldName]['label']);
457 if (trim($field) === '') {
458 $field = $fieldName;
459 }
460 } else {
461 $field = $fieldName;
462 }
463 return $field;
464 }
465
466 /**
467 * Returns the rendered record actions
468 *
469 * @param string $table
470 * @param integer $uid
471 * @return string
472 */
473 protected function getRecordActions($table, $uid) {
474 if ($table === '' || $uid < 0) {
475 return '';
476 }
477
478 $editOnClick = BackendUtility::editOnClick('&edit[' . $table . '][' . $uid . ']=edit', $GLOBALS['BACK_PATH']);
479 $icon = IconUtility::getSpriteIcon('actions-document-open');
480 $pageActionIcons = '<a href="#" onclick="' . htmlspecialchars($editOnClick) . '">' . $icon . '</a>';
481 $historyOnClick = 'window.location.href=' .
482 GeneralUtility::quoteJSvalue(
483 BackendUtility::getModuleUrl(
484 'record_history',
485 array(
486 'element' => $table . ':' . $uid,
487 'returnUrl' => GeneralUtility::getIndpEnv('REQUEST_URI')
488 )
489 )
490 ) . '; return false;';
491
492 $icon = IconUtility::getSpriteIcon('actions-document-history-open');
493 $pageActionIcons .= '<a href="#" onclick="' . htmlspecialchars($historyOnClick) . '">' . $icon . '</a>';
494 if ($table === 'pages') {
495 $pageActionIcons .= $this->doc->viewPageIcon($uid, '');
496 }
497 return $pageActionIcons;
498 }
499
500 /**
501 * Make reference display
502 *
503 * @param string $table Table name
504 * @param string|\TYPO3\CMS\Core\Resource\File $ref Filename or uid
505 * @return string HTML
506 */
507 protected function makeRef($table, $ref) {
508 // Files reside in sys_file table
509 if ($table === '_FILE') {
510 $selectTable = 'sys_file';
511 $selectUid = $ref->getUid();
512 } else {
513 $selectTable = $table;
514 $selectUid = $ref;
515 }
516 $rows = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows(
517 '*',
518 'sys_refindex',
519 'ref_table=' . $GLOBALS['TYPO3_DB']->fullQuoteStr($selectTable, 'sys_refindex') . ' AND ref_uid=' . (int)$selectUid . ' AND deleted=0'
520 );
521
522 // Compile information for title tag:
523 $infoData = array();
524 if (count($rows)) {
525 $infoDataHeader = '<tr>' . '<td>&nbsp;</td>' . '<td>' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:show_item.php.table') . '</td>' . '<td>' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:show_item.php.title') . '</td>' . '<td>[uid]</td>' . '<td>' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:show_item.php.field') . '</td>' . '<td>' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:show_item.php.flexpointer') . '</td>' . '<td>' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:show_item.php.softrefKey') . '</td>' . '<td>' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:show_item.php.sorting') . '</td>' . '</tr>';
526 }
527 foreach ($rows as $row) {
528 if ($row['tablename'] === 'sys_file_reference') {
529 $row = $this->transformFileReferenceToRecordReference($row);
530 }
531 $record = BackendUtility::getRecord($row['tablename'], $row['recuid']);
532 $parentRecord = BackendUtility::getRecord('pages', $record['pid']);
533 $actions = $this->getRecordActions($row['tablename'], $row['recuid']);
534 $infoData[] = '<tr class="db_list_normal">' .
535 '<td style="white-space:nowrap;">' . $actions . '</td>' .
536 '<td>' . $GLOBALS['LANG']->sL($GLOBALS['TCA'][$row['tablename']]['ctrl']['title'], TRUE) . '</td>' .
537 '<td>' . BackendUtility::getRecordTitle($row['tablename'], $record, TRUE) . '</td>' .
538 '<td><span title="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_common.xlf:page') . ': ' .
539 htmlspecialchars(BackendUtility::getRecordTitle('pages', $parentRecord)) . ' (uid=' . $record['pid'] . ')">' .
540 $record['uid'] . '</span></td>' .
541 '<td>' . htmlspecialchars($this->getLabelForTableColumn($row['tablename'], $row['field'])) . '</td>' .
542 '<td>' . htmlspecialchars($row['flexpointer']) . '</td>' . '<td>' . htmlspecialchars($row['softref_key']) . '</td>' .
543 '<td>' . htmlspecialchars($row['sorting']) . '</td>' .
544 '</tr>';
545 }
546 $referenceLine = '';
547 if (count($infoData)) {
548 $referenceLine = '<table class="t3-table">' .
549 '<thead>' . $infoDataHeader . '</thead>' .
550 '<tbody>' .
551 implode('', $infoData) .
552 '</tbody></table>';
553 }
554 return $referenceLine;
555 }
556
557 /**
558 * Make reference display (what this elements points to)
559 *
560 * @param string $table Table name
561 * @param string $ref Filename or uid
562 * @return string HTML
563 */
564 protected function makeRefFrom($table, $ref) {
565 $rows = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows(
566 '*',
567 'sys_refindex',
568 'tablename=' . $GLOBALS['TYPO3_DB']->fullQuoteStr($table, 'sys_refindex') . ' AND recuid=' . (int)$ref
569 );
570
571 // Compile information for title tag:
572 $infoData = array();
573 if (count($rows)) {
574 $infoDataHeader = '<tr class="t3-row-header">' .
575 '<td>&nbsp;</td>' .
576 '<td>' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:show_item.php.field') . '</td>' .
577 '<td>' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:show_item.php.flexpointer') . '</td>' .
578 '<td>' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:show_item.php.softrefKey') . '</td>' .
579 '<td>' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:show_item.php.sorting') . '</td>' .
580 '<td>' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:show_item.php.refTable') . '</td>' .
581 '<td>' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:show_item.php.refUid') . '</td>' .
582 '<td>' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:show_item.php.refString') . '</td>' .
583 '</tr>';
584 }
585 foreach ($rows as $row) {
586 $actions = $this->getRecordActions($row['ref_table'], $row['ref_uid']);
587 $infoData[] = '<tr class="db_list_normal">' .
588 '<td style="white-space:nowrap;">' . $actions . '</td>' .
589 '<td>' . htmlspecialchars($this->getLabelForTableColumn($table, $row['field'])) . '</td>' .
590 '<td>' . htmlspecialchars($row['flexpointer']) . '</td>' .
591 '<td>' . htmlspecialchars($row['softref_key']) . '</td>' .
592 '<td>' . htmlspecialchars($row['sorting']) . '</td>' .
593 '<td>' . $GLOBALS['LANG']->sL($GLOBALS['TCA'][$row['ref_table']]['ctrl']['title'], TRUE) . '</td>' .
594 '<td>' . htmlspecialchars($row['ref_uid']) . '</td>' .
595 '<td>' . htmlspecialchars($row['ref_string']) . '</td>' .
596 '</tr>';
597 }
598
599 if (empty($infoData)) {
600 return;
601 }
602
603 return '<table class="t3-table">' .
604 '<thead>' . $infoDataHeader . '</thead>' .
605 '<tbody>' .
606 implode('', $infoData) .
607 '</tbody></table>';
608 }
609
610 /**
611 * Convert FAL file reference (sys_file_reference) to reference index (sys_refindex) table format
612 *
613 * @param array $referenceRecord
614 * @return array
615 */
616 protected function transformFileReferenceToRecordReference(array $referenceRecord) {
617 $fileReference = $GLOBALS['TYPO3_DB']->exec_SELECTgetSingleRow(
618 '*',
619 'sys_file_reference',
620 'uid=' . (int)$referenceRecord['recuid']
621 );
622 return array(
623 'recuid' => $fileReference['uid_foreign'],
624 'tablename' => $fileReference['tablenames'],
625 'field' => $fileReference['fieldname'],
626 'flexpointer' => '',
627 'softref_key' => '',
628 'sorting' => $fileReference['sorting_foreign']
629 );
630 }
631
632 }