TYPO3 CMS  TYPO3_6-2
DatabaseRecordList.php
Go to the documentation of this file.
1 <?php
3 
21 
27 class DatabaseRecordList extends \TYPO3\CMS\Recordlist\RecordList\AbstractDatabaseRecordList {
28 
29  // External:
30  // If TRUE, table rows in the list will alternate in background colors (and have background colors at all!)
34  public $alternateBgColors = FALSE;
35 
36  // Used to indicate which tables (values in the array) that can have a create-new-record link. If the array is empty, all tables are allowed.
40  public $allowedNewTables = array();
41 
42  // Used to indicate which tables (values in the array) that cannot have a create-new-record link. If the array is empty, all tables are allowed.
46  public $deniedNewTables = array();
47 
48  // If TRUE, the control panel will contain links to the create-new wizards for pages and tt_content elements (normally, the link goes to just creating a new element without the wizards!).
52  public $newWizards = FALSE;
53 
54  // If TRUE, will disable the rendering of clipboard + control panels.
59 
60  // If TRUE, will show the clipboard in the field list.
64  public $showClipboard = FALSE;
65 
66  // If TRUE, will DISABLE all control panels in lists. (Takes precedence)
70  public $noControlPanels = FALSE;
71 
72  // If TRUE, clickmenus will be rendered
76  public $clickMenuEnabled = TRUE;
77 
78  // Count of record rows in view
83 
84  // Space icon used for alignment
88  public $spaceIcon;
89 
90  // Internal:
91  // Set to the page record (see writeTop())
95  public $pageRow = array();
96 
97  // Used to accumulate CSV lines for CSV export.
98  protected $csvLines = array();
99 
100  // If set, the listing is returned as CSV instead.
104  public $csvOutput = FALSE;
105 
112  public $clipObj;
113 
114  // Tracking names of elements (for clipboard use)
118  public $CBnames = array();
119 
120  // Used to track which elements has duplicates and how many
124  public $duplicateStack = array();
125 
131  protected $referenceCount = array();
132 
133  // Translations of the current record
138 
139  // select fields for the query which fetches the translations of the current record
144 
145  public $disableSingleTableView = FALSE;
146 
152  public function getButtons() {
153  $buttons = array(
154  'csh' => '',
155  'view' => '',
156  'edit' => '',
157  'hide_unhide' => '',
158  'move' => '',
159  'new_record' => '',
160  'paste' => '',
161  'level_up' => '',
162  'cache' => '',
163  'reload' => '',
164  'shortcut' => '',
165  'back' => '',
166  'csv' => '',
167  'export' => ''
168  );
169  // Get users permissions for this page record:
170  $localCalcPerms = $GLOBALS['BE_USER']->calcPerms($this->pageRow);
171  // CSH
172  if (!strlen($this->id)) {
173  $buttons['csh'] = BackendUtility::cshItem('xMOD_csh_corebe', 'list_module_noId', $GLOBALS['BACK_PATH'], '', TRUE);
174  } elseif (!$this->id) {
175  $buttons['csh'] = BackendUtility::cshItem('xMOD_csh_corebe', 'list_module_root', $GLOBALS['BACK_PATH'], '', TRUE);
176  } else {
177  $buttons['csh'] = BackendUtility::cshItem('xMOD_csh_corebe', 'list_module', $GLOBALS['BACK_PATH'], '', TRUE);
178  }
179  if (isset($this->id)) {
180  // View Exclude doktypes 254,255 Configuration: mod.web_list.noViewWithDokTypes = 254,255
181  if (isset($GLOBALS['SOBE']->modTSconfig['properties']['noViewWithDokTypes'])) {
182  $noViewDokTypes = GeneralUtility::trimExplode(',', $GLOBALS['SOBE']->modTSconfig['properties']['noViewWithDokTypes'], TRUE);
183  } else {
184  //default exclusion: doktype 254 (folder), 255 (recycler)
185  $noViewDokTypes = array(\TYPO3\CMS\Frontend\Page\PageRepository::DOKTYPE_SYSFOLDER, \TYPO3\CMS\Frontend\Page\PageRepository::DOKTYPE_RECYCLER);
186  }
187  if (!in_array($this->pageRow['doktype'], $noViewDokTypes)) {
188  $buttons['view'] = '<a href="#" onclick="' . htmlspecialchars(BackendUtility::viewOnClick($this->id, $this->backPath, BackendUtility::BEgetRootLine($this->id))) . '" title="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:labels.showPage', TRUE) . '">' . IconUtility::getSpriteIcon('actions-document-view') . '</a>';
189  }
190  // New record
191  if (!$GLOBALS['SOBE']->modTSconfig['properties']['noCreateRecordsLink']) {
192  $buttons['new_record'] = '<a href="#" onclick="' . htmlspecialchars(('return jumpExt(\'' . $this->backPath . 'db_new.php?id=' . $this->id . '\');')) . '" title="' . $GLOBALS['LANG']->getLL('newRecordGeneral', TRUE) . '">' . IconUtility::getSpriteIcon('actions-document-new') . '</a>';
193  }
194  // If edit permissions are set, see \TYPO3\CMS\Core\Authentication\BackendUserAuthentication
195  if ($localCalcPerms & 2 && !empty($this->id)) {
196  // Edit
197  $params = '&edit[pages][' . $this->pageRow['uid'] . ']=edit';
198  $buttons['edit'] = '<a href="#" onclick="' . htmlspecialchars(BackendUtility::editOnClick($params, $this->backPath, -1)) . '" title="' . $GLOBALS['LANG']->getLL('editPage', TRUE) . '">' . IconUtility::getSpriteIcon('actions-page-open') . '</a>';
199  }
200  // Paste
201  if ($localCalcPerms & 8 || $localCalcPerms & 16) {
202  $elFromTable = $this->clipObj->elFromTable('');
203  if (count($elFromTable)) {
204  $buttons['paste'] = '<a href="' . htmlspecialchars($this->clipObj->pasteUrl('', $this->id)) . '" onclick="' . htmlspecialchars(('return ' . $this->clipObj->confirmMsg('pages', $this->pageRow, 'into', $elFromTable))) . '" title="' . $GLOBALS['LANG']->getLL('clip_paste', TRUE) . '">' . IconUtility::getSpriteIcon('actions-document-paste-after') . '</a>';
205  }
206  }
207  // Cache
208  $buttons['cache'] = '<a href="' . htmlspecialchars(($this->listURL() . '&clear_cache=1')) . '" title="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:labels.clear_cache', TRUE) . '">' . IconUtility::getSpriteIcon('actions-system-cache-clear') . '</a>';
209  if ($this->table && (!isset($GLOBALS['SOBE']->modTSconfig['properties']['noExportRecordsLinks'])
210  || (isset($GLOBALS['SOBE']->modTSconfig['properties']['noExportRecordsLinks']) && !$GLOBALS['SOBE']->modTSconfig['properties']['noExportRecordsLinks']))
211  ) {
212  // CSV
213  $buttons['csv'] = '<a href="' . htmlspecialchars(($this->listURL() . '&csv=1')) . '" title="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:labels.csv', TRUE) . '">' . IconUtility::getSpriteIcon('mimetypes-text-csv') . '</a>';
214  // Export
215  if (ExtensionManagementUtility::isLoaded('impexp')) {
216  $url = BackendUtility::getModuleUrl('xMOD_tximpexp', array('tx_impexp[action]' => 'export'));
217  $buttons['export'] = '<a href="' . htmlspecialchars(($url . '&tx_impexp[list][]=' . rawurlencode(($this->table . ':' . $this->id)))) . '" title="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:rm.export', TRUE) . '">' . IconUtility::getSpriteIcon('actions-document-export-t3d') . '</a>';
218  }
219  }
220  // Reload
221  $buttons['reload'] = '<a href="' . htmlspecialchars($this->listURL()) . '" title="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:labels.reload', TRUE) . '">' . IconUtility::getSpriteIcon('actions-system-refresh') . '</a>';
222  // Shortcut
223  if ($GLOBALS['BE_USER']->mayMakeShortcut()) {
224  $buttons['shortcut'] = $GLOBALS['TBE_TEMPLATE']->makeShortcutIcon('id, imagemode, pointer, table, search_field, search_levels, showLimit, sortField, sortRev', implode(',', array_keys($this->MOD_MENU)), 'web_list');
225  }
226  // Back
227  if ($this->returnUrl) {
228  $buttons['back'] = '<a href="' . htmlspecialchars(GeneralUtility::linkThisUrl($this->returnUrl, array('id' => $this->id))) . '" class="typo3-goBack" title="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:labels.goBack', TRUE) . '">' . IconUtility::getSpriteIcon('actions-view-go-back') . '</a>';
229  }
230  }
231  return $buttons;
232  }
233 
243  public function getTable($table, $id, $rowlist) {
244  // Init
245  $addWhere = '';
246  $titleCol = $GLOBALS['TCA'][$table]['ctrl']['label'];
247  $thumbsCol = $GLOBALS['TCA'][$table]['ctrl']['thumbnail'];
248  $l10nEnabled = $GLOBALS['TCA'][$table]['ctrl']['languageField'] && $GLOBALS['TCA'][$table]['ctrl']['transOrigPointerField'] && !$GLOBALS['TCA'][$table]['ctrl']['transOrigPointerTable'];
249  $tableCollapsed = (boolean)$this->tablesCollapsed[$table];
250  // prepare space icon
251  $this->spaceIcon = IconUtility::getSpriteIcon('empty-empty', array('style' => 'background-position: 0 10px;'));
252  // Cleaning rowlist for duplicates and place the $titleCol as the first column always!
253  $this->fieldArray = array();
254  // title Column
255  // Add title column
256  $this->fieldArray[] = $titleCol;
257  // Control-Panel
258  if (!GeneralUtility::inList($rowlist, '_CONTROL_')) {
259  $this->fieldArray[] = '_CONTROL_';
260  $this->fieldArray[] = '_AFTERCONTROL_';
261  }
262  // Clipboard
263  if ($this->showClipboard) {
264  $this->fieldArray[] = '_CLIPBOARD_';
265  }
266  // Ref
267  if (!$this->dontShowClipControlPanels) {
268  $this->fieldArray[] = '_REF_';
269  $this->fieldArray[] = '_AFTERREF_';
270  }
271  // Path
272  if ($this->searchLevels) {
273  $this->fieldArray[] = '_PATH_';
274  }
275  // Localization
276  if ($this->localizationView && $l10nEnabled) {
277  $this->fieldArray[] = '_LOCALIZATION_';
278  $this->fieldArray[] = '_LOCALIZATION_b';
279  $addWhere .= ' AND (
280  ' . $GLOBALS['TCA'][$table]['ctrl']['languageField'] . '<=0
281  OR
282  ' . $GLOBALS['TCA'][$table]['ctrl']['transOrigPointerField'] . ' = 0
283  )';
284  }
285  // Cleaning up:
286  $this->fieldArray = array_unique(array_merge($this->fieldArray, GeneralUtility::trimExplode(',', $rowlist, TRUE)));
287  if ($this->noControlPanels) {
288  $tempArray = array_flip($this->fieldArray);
289  unset($tempArray['_CONTROL_']);
290  unset($tempArray['_CLIPBOARD_']);
291  $this->fieldArray = array_keys($tempArray);
292  }
293  // Creating the list of fields to include in the SQL query:
294  $selectFields = $this->fieldArray;
295  $selectFields[] = 'uid';
296  $selectFields[] = 'pid';
297  // adding column for thumbnails
298  if ($thumbsCol) {
299  $selectFields[] = $thumbsCol;
300  }
301  if ($table == 'pages') {
302  $selectFields[] = 'module';
303  $selectFields[] = 'extendToSubpages';
304  $selectFields[] = 'nav_hide';
305  $selectFields[] = 'doktype';
306  $selectFields[] = 'shortcut';
307  $selectFields[] = 'shortcut_mode';
308  $selectFields[] = 'mount_pid';
309  }
310  if (is_array($GLOBALS['TCA'][$table]['ctrl']['enablecolumns'])) {
311  $selectFields = array_merge($selectFields, $GLOBALS['TCA'][$table]['ctrl']['enablecolumns']);
312  }
313  if ($GLOBALS['TCA'][$table]['ctrl']['type']) {
314  $selectFields[] = $GLOBALS['TCA'][$table]['ctrl']['type'];
315  }
316  if ($GLOBALS['TCA'][$table]['ctrl']['typeicon_column']) {
317  $selectFields[] = $GLOBALS['TCA'][$table]['ctrl']['typeicon_column'];
318  }
319  if ($GLOBALS['TCA'][$table]['ctrl']['versioningWS']) {
320  $selectFields[] = 't3ver_id';
321  $selectFields[] = 't3ver_state';
322  $selectFields[] = 't3ver_wsid';
323  }
324  if ($l10nEnabled) {
325  $selectFields[] = $GLOBALS['TCA'][$table]['ctrl']['languageField'];
326  $selectFields[] = $GLOBALS['TCA'][$table]['ctrl']['transOrigPointerField'];
327  }
328  if ($GLOBALS['TCA'][$table]['ctrl']['label_alt']) {
329  $selectFields = array_merge($selectFields, GeneralUtility::trimExplode(',', $GLOBALS['TCA'][$table]['ctrl']['label_alt'], TRUE));
330  }
331  // Unique list!
332  $selectFields = array_unique($selectFields);
333  $fieldListFields = $this->makeFieldList($table, 1);
334  if (empty($fieldListFields) && $GLOBALS['TYPO3_CONF_VARS']['BE']['debug']) {
335  $message = sprintf($GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_mod_web_list.xlf:missingTcaColumnsMessage', TRUE), $table, $table);
336  $messageTitle = $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_mod_web_list.xlf:missingTcaColumnsMessageTitle', TRUE);
337  $flashMessage = GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Messaging\\FlashMessage', $message, $messageTitle, \TYPO3\CMS\Core\Messaging\FlashMessage::WARNING, TRUE);
339  $flashMessageService = GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Messaging\\FlashMessageService');
341  $defaultFlashMessageQueue = $flashMessageService->getMessageQueueByIdentifier();
342  $defaultFlashMessageQueue->enqueue($flashMessage);
343  }
344  // Making sure that the fields in the field-list ARE in the field-list from TCA!
345  $selectFields = array_intersect($selectFields, $fieldListFields);
346  // Implode it into a list of fields for the SQL-statement.
347  $selFieldList = implode(',', $selectFields);
348  $this->selFieldList = $selFieldList;
354  if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['typo3/class.db_list_extra.inc']['getTable'])) {
355  foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['typo3/class.db_list_extra.inc']['getTable'] as $classData) {
356  $hookObject = GeneralUtility::getUserObj($classData);
357  if (!$hookObject instanceof \TYPO3\CMS\Backend\RecordList\RecordListGetTableHookInterface) {
358  throw new \UnexpectedValueException('$hookObject must implement interface TYPO3\\CMS\\Backend\\RecordList\\RecordListGetTableHookInterface', 1195114460);
359  }
360  $hookObject->getDBlistQuery($table, $id, $addWhere, $selFieldList, $this);
361  }
362  }
363  // Create the SQL query for selecting the elements in the listing:
364  // do not do paging when outputting as CSV
365  if ($this->csvOutput) {
366  $this->iLimit = 0;
367  }
368  if ($this->firstElementNumber > 2 && $this->iLimit > 0) {
369  // Get the two previous rows for sorting if displaying page > 1
370  $this->firstElementNumber = $this->firstElementNumber - 2;
371  $this->iLimit = $this->iLimit + 2;
372  // (API function from TYPO3\CMS\Recordlist\RecordList\AbstractDatabaseRecordList)
373  $queryParts = $this->makeQueryArray($table, $id, $addWhere, $selFieldList);
374  $this->firstElementNumber = $this->firstElementNumber + 2;
375  $this->iLimit = $this->iLimit - 2;
376  } else {
377  // (API function from TYPO3\CMS\Recordlist\RecordList\AbstractDatabaseRecordList)
378  $queryParts = $this->makeQueryArray($table, $id, $addWhere, $selFieldList);
379  }
380 
381  // Finding the total amount of records on the page
382  // (API function from TYPO3\CMS\Recordlist\RecordList\AbstractDatabaseRecordList)
383  $this->setTotalItems($queryParts);
384 
385  // Init:
386  $dbCount = 0;
387  $out = '';
388  $listOnlyInSingleTableMode = $this->listOnlyInSingleTableMode && !$this->table;
389  // If the count query returned any number of records, we perform the real query, selecting records.
390  if ($this->totalItems) {
391  // Fetch records only if not in single table mode or if in multi table mode and not collapsed
392  if ($listOnlyInSingleTableMode || !$this->table && $tableCollapsed) {
393  $dbCount = $this->totalItems;
394  } else {
395  // Set the showLimit to the number of records when outputting as CSV
396  if ($this->csvOutput) {
397  $this->showLimit = $this->totalItems;
398  $this->iLimit = $this->totalItems;
399  }
400  $result = $GLOBALS['TYPO3_DB']->exec_SELECT_queryArray($queryParts);
401  $dbCount = $GLOBALS['TYPO3_DB']->sql_num_rows($result);
402  }
403  }
404  // If any records was selected, render the list:
405  if ($dbCount) {
406  // Half line is drawn between tables:
407  if (!$listOnlyInSingleTableMode) {
408  $theData = array();
409  if (!$this->table && !$rowlist) {
410  $theData[$titleCol] = '<img src="clear.gif" width="' . ($GLOBALS['SOBE']->MOD_SETTINGS['bigControlPanel'] ? '230' : '350') . '" height="1" alt="" />';
411  if (in_array('_CONTROL_', $this->fieldArray)) {
412  $theData['_CONTROL_'] = '';
413  }
414  if (in_array('_CLIPBOARD_', $this->fieldArray)) {
415  $theData['_CLIPBOARD_'] = '';
416  }
417  }
418  $out .= $this->addelement(0, '', $theData, 'class="c-table-row-spacer"', $this->leftMargin);
419  }
420  $tableTitle = $GLOBALS['LANG']->sL($GLOBALS['TCA'][$table]['ctrl']['title'], TRUE);
421  if ($tableTitle === '') {
422  $tableTitle = $table;
423  }
424  // Header line is drawn
425  $theData = array();
426  if ($this->disableSingleTableView) {
427  $theData[$titleCol] = '<span class="c-table">' . BackendUtility::wrapInHelp($table, '', $tableTitle) . '</span> (' . $this->totalItems . ')';
428  } else {
429  $theData[$titleCol] = $this->linkWrapTable($table, '<span class="c-table">' . $tableTitle . '</span> (' . $this->totalItems . ') ' . ($this->table ? IconUtility::getSpriteIcon('actions-view-table-collapse', array('title' => $GLOBALS['LANG']->getLL('contractView', TRUE))) : IconUtility::getSpriteIcon('actions-view-table-expand', array('title' => $GLOBALS['LANG']->getLL('expandView', TRUE)))));
430  }
431  if ($listOnlyInSingleTableMode) {
432  $out .= '
433  <tr>
434  <td class="t3-row-header" style="width:95%;">' . BackendUtility::wrapInHelp($table, '', $theData[$titleCol]) . '</td>
435  </tr>';
436  } else {
437  // Render collapse button if in multi table mode
438  $collapseIcon = '';
439  if (!$this->table) {
440  $collapseIcon = '<a href="' . htmlspecialchars(($this->listURL() . '&collapse[' . $table . ']=' . ($tableCollapsed ? '0' : '1'))) . '" title="' . ($tableCollapsed ? $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:labels.expandTable', TRUE) : $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:labels.collapseTable', TRUE)) . '">' . ($tableCollapsed ? IconUtility::getSpriteIcon('actions-view-list-expand', array('class' => 'collapseIcon')) : IconUtility::getSpriteIcon('actions-view-list-collapse', array('class' => 'collapseIcon'))) . '</a>';
441  }
442  $out .= $this->addElement(1, $collapseIcon, $theData, ' class="t3-row-header"', '');
443  }
444  // Render table rows only if in multi table view and not collapsed or if in single table view
445  if (!$listOnlyInSingleTableMode && (!$tableCollapsed || $this->table)) {
446  // Fixing a order table for sortby tables
447  $this->currentTable = array();
448  $currentIdList = array();
449  $doSort = $GLOBALS['TCA'][$table]['ctrl']['sortby'] && !$this->sortField;
450  $prevUid = 0;
451  $prevPrevUid = 0;
452  // Get first two rows and initialize prevPrevUid and prevUid if on page > 1
453  if ($this->firstElementNumber > 2 && $this->iLimit > 0) {
454  $row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($result);
455  $prevPrevUid = -((int)$row['uid']);
456  $row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($result);
457  $prevUid = $row['uid'];
458  }
459  $accRows = array();
460  // Accumulate rows here
461  while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($result)) {
462  if (!$this->isRowListingConditionFulfilled($table, $row)) {
463  continue;
464  }
465  // In offline workspace, look for alternative record:
466  BackendUtility::workspaceOL($table, $row, $GLOBALS['BE_USER']->workspace, TRUE);
467  if (is_array($row)) {
468  $accRows[] = $row;
469  $currentIdList[] = $row['uid'];
470  if ($doSort) {
471  if ($prevUid) {
472  $this->currentTable['prev'][$row['uid']] = $prevPrevUid;
473  $this->currentTable['next'][$prevUid] = '-' . $row['uid'];
474  $this->currentTable['prevUid'][$row['uid']] = $prevUid;
475  }
476  $prevPrevUid = isset($this->currentTable['prev'][$row['uid']]) ? -$prevUid : $row['pid'];
477  $prevUid = $row['uid'];
478  }
479  }
480  }
481  $GLOBALS['TYPO3_DB']->sql_free_result($result);
482  $this->totalRowCount = count($accRows);
483  // CSV initiated
484  if ($this->csvOutput) {
485  $this->initCSV();
486  }
487  // Render items:
488  $this->CBnames = array();
489  $this->duplicateStack = array();
490  $this->eCounter = $this->firstElementNumber;
491  $iOut = '';
492  $cc = 0;
493  foreach ($accRows as $row) {
494  // Render item row if counter < limit
495  if ($cc < $this->iLimit) {
496  $cc++;
497  $this->translations = FALSE;
498  $iOut .= $this->renderListRow($table, $row, $cc, $titleCol, $thumbsCol);
499  // If localization view is enabled it means that the selected records are
500  // either default or All language and here we will not select translations
501  // which point to the main record:
502  if ($this->localizationView && $l10nEnabled) {
503  // For each available translation, render the record:
504  if (is_array($this->translations)) {
505  foreach ($this->translations as $lRow) {
506  // $lRow isn't always what we want - if record was moved we've to work with the
507  // placeholder records otherwise the list is messed up a bit
508  if ($row['_MOVE_PLH_uid'] && $row['_MOVE_PLH_pid']) {
509  $tmpRow = BackendUtility::getRecordRaw($table, 't3ver_move_id="' . (int)$lRow['uid'] . '" AND pid="' . $row['_MOVE_PLH_pid'] . '" AND t3ver_wsid=' . $row['t3ver_wsid'] . BackendUtility::deleteClause($table), $selFieldList);
510  $lRow = is_array($tmpRow) ? $tmpRow : $lRow;
511  }
512  // In offline workspace, look for alternative record:
513  BackendUtility::workspaceOL($table, $lRow, $GLOBALS['BE_USER']->workspace, TRUE);
514  if (is_array($lRow) && $GLOBALS['BE_USER']->checkLanguageAccess($lRow[$GLOBALS['TCA'][$table]['ctrl']['languageField']])) {
515  $currentIdList[] = $lRow['uid'];
516  $iOut .= $this->renderListRow($table, $lRow, $cc, $titleCol, $thumbsCol, 18);
517  }
518  }
519  }
520  }
521  }
522  // Counter of total rows incremented:
523  $this->eCounter++;
524  }
525  // Record navigation is added to the beginning and end of the table if in single table mode
526  if ($this->table) {
527  $iOut = $this->renderListNavigation('top') . $iOut . $this->renderListNavigation('bottom');
528  } else {
529  // Show that there are more records than shown
530  if ($this->totalItems > $this->itemsLimitPerTable) {
531  $countOnFirstPage = $this->totalItems > $this->itemsLimitSingleTable ? $this->itemsLimitSingleTable : $this->totalItems;
532  $hasMore = $this->totalItems > $this->itemsLimitSingleTable;
533  $colspan = $this->showIcon ? count($this->fieldArray) + 1 : count($this->fieldArray);
534  $iOut .= '<tr><td colspan="' . $colspan . '" style="padding:5px;">
535  <a href="' . htmlspecialchars(($this->listURL() . '&table=' . rawurlencode($table))) . '">' . '<img' . IconUtility::skinImg($this->backPath, 'gfx/pildown.gif', 'width="14" height="14"') . ' alt="" />' . ' <i>[1 - ' . $countOnFirstPage . ($hasMore ? '+' : '') . ']</i></a>
536  </td></tr>';
537  }
538  }
539  // The header row for the table is now created:
540  $out .= $this->renderListHeader($table, $currentIdList);
541  }
542  // The list of records is added after the header:
543  $out .= $iOut;
544  unset($iOut);
545  // ... and it is all wrapped in a table:
546  $out = '
547 
548 
549 
550  <!--
551  DB listing of elements: "' . htmlspecialchars($table) . '"
552  -->
553  <table border="0" cellpadding="0" cellspacing="0" class="typo3-dblist' . ($listOnlyInSingleTableMode ? ' typo3-dblist-overview' : '') . '">
554  ' . $out . '
555  </table>';
556  // Output csv if...
557  // This ends the page with exit.
558  if ($this->csvOutput) {
559  $this->outputCSV($table);
560  }
561  }
562  // Return content:
563  return $out;
564  }
565 
575  protected function isRowListingConditionFulfilled($table, $row) {
576  return TRUE;
577  }
578 
593  public function renderListRow($table, $row, $cc, $titleCol, $thumbsCol, $indent = 0) {
594  $iOut = '';
595  // If in search mode, make sure the preview will show the correct page
596  if (strlen($this->searchString)) {
597  $id_orig = $this->id;
598  $this->id = $row['pid'];
599  }
600  if (is_array($row)) {
601  // Add special classes for first and last row
602  $rowSpecial = '';
603  if ($cc == 1 && $indent == 0) {
604  $rowSpecial .= ' firstcol';
605  }
606  if ($cc == $this->totalRowCount || $cc == $this->iLimit) {
607  $rowSpecial .= ' lastcol';
608  }
609  // Background color, if any:
610  if ($this->alternateBgColors) {
611  $row_bgColor = $cc % 2 ? ' class="db_list_normal' . $rowSpecial . '"' : ' class="db_list_alt' . $rowSpecial . '"';
612  } else {
613  $row_bgColor = ' class="db_list_normal' . $rowSpecial . '"';
614  }
615  // Overriding with versions background color if any:
616  $row_bgColor = $row['_CSSCLASS'] ? ' class="' . $row['_CSSCLASS'] . '"' : $row_bgColor;
617  // Incr. counter.
618  $this->counter++;
619  // The icon with link
620  $alttext = BackendUtility::getRecordIconAltText($row, $table);
621  $iconImg = IconUtility::getSpriteIconForRecord($table, $row, array('title' => htmlspecialchars($alttext), 'style' => $indent ? ' margin-left: ' . $indent . 'px;' : ''));
622  $theIcon = $this->clickMenuEnabled ? $GLOBALS['SOBE']->doc->wrapClickMenuOnIcon($iconImg, $table, $row['uid']) : $iconImg;
623  // Preparing and getting the data-array
624  $theData = array();
625  foreach ($this->fieldArray as $fCol) {
626  if ($fCol == $titleCol) {
627  $recTitle = BackendUtility::getRecordTitle($table, $row, FALSE, TRUE);
628  // If the record is edit-locked by another user, we will show a little warning sign:
629  if ($lockInfo = BackendUtility::isRecordLocked($table, $row['uid'])) {
630  $warning = '<a href="#" onclick="alert(' . GeneralUtility::quoteJSvalue($lockInfo['msg']) . '); return false;" title="' . htmlspecialchars($lockInfo['msg']) . '">' . IconUtility::getSpriteIcon('status-warning-in-use') . '</a>';
631  }
632  $theData[$fCol] = $warning . $this->linkWrapItems($table, $row['uid'], $recTitle, $row);
633  // Render thumbnails, if:
634  // - a thumbnail column exists
635  // - there is content in it
636  // - the thumbnail column is visible for the current type
637  $type = 0;
638  if (isset($GLOBALS['TCA'][$table]['ctrl']['type'])) {
639  $typeColumn = $GLOBALS['TCA'][$table]['ctrl']['type'];
640  $type = $row[$typeColumn];
641  }
642  // If current type doesn't exist, set it to 0 (or to 1 for historical reasons, if 0 doesn't exist)
643  if (!isset($GLOBALS['TCA'][$table]['types'][$type])) {
644  $type = isset($GLOBALS['TCA'][$table]['types'][0]) ? 0 : 1;
645  }
646  $visibleColumns = $GLOBALS['TCA'][$table]['types'][$type]['showitem'];
647 
648  if ($this->thumbs &&
649  trim($row[$thumbsCol]) &&
650  preg_match('/(^|(.*(;|,)?))' . $thumbsCol . '(((;|,).*)|$)/', $visibleColumns) === 1
651  ) {
652  $theData[$fCol] .= '<br />' . $this->thumbCode($row, $table, $thumbsCol);
653  }
654  $localizationMarkerClass = '';
655  if (isset($GLOBALS['TCA'][$table]['ctrl']['languageField']) && $row[$GLOBALS['TCA'][$table]['ctrl']['languageField']] != 0 && $row[$GLOBALS['TCA'][$table]['ctrl']['transOrigPointerField']] != 0) {
656  // It's a translated record with a language parent
657  $localizationMarkerClass = ' localization';
658  }
659  } elseif ($fCol == 'pid') {
660  $theData[$fCol] = $row[$fCol];
661  } elseif ($fCol == '_PATH_') {
662  $theData[$fCol] = $this->recPath($row['pid']);
663  } elseif ($fCol == '_REF_') {
664  $theData[$fCol] = $this->createReferenceHtml($table, $row['uid']);
665  } elseif ($fCol == '_CONTROL_') {
666  $theData[$fCol] = $this->makeControl($table, $row);
667  } elseif ($fCol == '_AFTERCONTROL_' || $fCol == '_AFTERREF_') {
668  $theData[$fCol] = '&nbsp;';
669  } elseif ($fCol == '_CLIPBOARD_') {
670  $theData[$fCol] = $this->makeClip($table, $row);
671  } elseif ($fCol == '_LOCALIZATION_') {
672  list($lC1, $lC2) = $this->makeLocalizationPanel($table, $row);
673  $theData[$fCol] = $lC1;
674  $theData[$fCol . 'b'] = $lC2;
675  } elseif ($fCol == '_LOCALIZATION_b') {
676 
677  } else {
678  $tmpProc = BackendUtility::getProcessedValueExtra($table, $fCol, $row[$fCol], 100, $row['uid']);
679  $theData[$fCol] = $this->linkUrlMail(htmlspecialchars($tmpProc), $row[$fCol]);
680  if ($this->csvOutput) {
681  $row[$fCol] = BackendUtility::getProcessedValueExtra($table, $fCol, $row[$fCol], 0, $row['uid']);
682  }
683  }
684  }
685  // Reset the ID if it was overwritten
686  if (strlen($this->searchString)) {
687  $this->id = $id_orig;
688  }
689  // Add row to CSV list:
690  if ($this->csvOutput) {
691  $this->addToCSV($row, $table);
692  }
693  // Add classes to table cells
694  $this->addElement_tdCssClass[$titleCol] = 'col-title' . $localizationMarkerClass;
695  if (!$this->dontShowClipControlPanels) {
696  $this->addElement_tdCssClass['_CONTROL_'] = 'col-control';
697  $this->addElement_tdCssClass['_AFTERCONTROL_'] = 'col-control-space';
698  $this->addElement_tdCssClass['_CLIPBOARD_'] = 'col-clipboard';
699  }
700  $this->addElement_tdCssClass['_PATH_'] = 'col-path';
701  $this->addElement_tdCssClass['_LOCALIZATION_'] = 'col-localizationa';
702  $this->addElement_tdCssClass['_LOCALIZATION_b'] = 'col-localizationb';
703  // Create element in table cells:
704  $iOut .= $this->addelement(1, $theIcon, $theData, $row_bgColor);
705  // Finally, return table row element:
706  return $iOut;
707  }
708  }
709 
718  protected function getReferenceCount($tableName, $uid) {
719  if (!isset($this->referenceCount[$tableName][$uid])) {
720  $numberOfReferences = $GLOBALS['TYPO3_DB']->exec_SELECTcountRows('*', 'sys_refindex', 'ref_table = ' . $GLOBALS['TYPO3_DB']->fullQuoteStr($tableName, 'sys_refindex') . ' AND ref_uid = ' . $uid . ' AND deleted = 0');
721  $this->referenceCount[$tableName][$uid] = $numberOfReferences;
722  }
723  return $this->referenceCount[$tableName][$uid];
724  }
725 
736  public function renderListHeader($table, $currentIdList) {
737  // Init:
738  $theData = array();
739  // Traverse the fields:
740  foreach ($this->fieldArray as $fCol) {
741  // Calculate users permissions to edit records in the table:
742  $permsEdit = $this->calcPerms & ($table == 'pages' ? 2 : 16);
743  switch ((string) $fCol) {
744  case '_PATH_':
745  // Path
746  $theData[$fCol] = '<i>[' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:labels._PATH_', TRUE) . ']</i>';
747  break;
748  case '_REF_':
749  // References
750  $theData[$fCol] = '<i>[' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_mod_file_list.xlf:c__REF_', TRUE) . ']</i>';
751  break;
752  case '_LOCALIZATION_':
753  // Path
754  $theData[$fCol] = '<i>[' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:labels._LOCALIZATION_', TRUE) . ']</i>';
755  break;
756  case '_LOCALIZATION_b':
757  // Path
758  $theData[$fCol] = $GLOBALS['LANG']->getLL('Localize', TRUE);
759  break;
760  case '_CLIPBOARD_':
761  // Clipboard:
762  $cells = array();
763  // If there are elements on the clipboard for this table, then display the "paste into" icon:
764  $elFromTable = $this->clipObj->elFromTable($table);
765  if (count($elFromTable)) {
766  $cells['pasteAfter'] = '<a href="' . htmlspecialchars($this->clipObj->pasteUrl($table, $this->id)) . '" onclick="' . htmlspecialchars(('return ' . $this->clipObj->confirmMsg('pages', $this->pageRow, 'into', $elFromTable))) . '" title="' . $GLOBALS['LANG']->getLL('clip_paste', TRUE) . '">' . IconUtility::getSpriteIcon('actions-document-paste-after') . '</a>';
767  }
768  // If the numeric clipboard pads are enabled, display the control icons for that:
769  if ($this->clipObj->current != 'normal') {
770  // The "select" link:
771  $cells['copyMarked'] = $this->linkClipboardHeaderIcon(IconUtility::getSpriteIcon('actions-edit-copy', array('title' => $GLOBALS['LANG']->getLL('clip_selectMarked', TRUE))), $table, 'setCB');
772  // The "edit marked" link:
773  $editIdList = implode(',', $currentIdList);
774  $editIdList = '\'+editList(\'' . $table . '\',\'' . $editIdList . '\')+\'';
775  $params = '&edit[' . $table . '][' . $editIdList . ']=edit&disHelp=1';
776  $cells['edit'] = '<a href="#" onclick="' . htmlspecialchars(BackendUtility::editOnClick($params, $this->backPath, -1)) . '" title="' . $GLOBALS['LANG']->getLL('clip_editMarked', TRUE) . '">' . IconUtility::getSpriteIcon('actions-document-open') . '</a>';
777  // The "Delete marked" link:
778  $cells['delete'] = $this->linkClipboardHeaderIcon(IconUtility::getSpriteIcon('actions-edit-delete', array('title' => $GLOBALS['LANG']->getLL('clip_deleteMarked', TRUE))), $table, 'delete', sprintf($GLOBALS['LANG']->getLL('clip_deleteMarkedWarning'), $GLOBALS['LANG']->sL($GLOBALS['TCA'][$table]['ctrl']['title'])));
779  // The "Select all" link:
780  $cells['markAll'] = '<a class="cbcCheckAll" rel="" href="#" onclick="' . htmlspecialchars(('checkOffCB(\'' . implode(',', $this->CBnames) . '\', this); return false;')) . '" title="' . $GLOBALS['LANG']->getLL('clip_markRecords', TRUE) . '">' . IconUtility::getSpriteIcon('actions-document-select') . '</a>';
781  } else {
782  $cells['empty'] = '';
783  }
790  if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['typo3/class.db_list_extra.inc']['actions'])) {
791  foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['typo3/class.db_list_extra.inc']['actions'] as $classData) {
792  $hookObject = GeneralUtility::getUserObj($classData);
793  if (!$hookObject instanceof \TYPO3\CMS\Recordlist\RecordList\RecordListHookInterface) {
794  throw new \UnexpectedValueException('$hookObject must implement interface TYPO3\\CMS\\Recordlist\\RecordList\\RecordListHookInterface', 1195567850);
795  }
796  $cells = $hookObject->renderListHeaderActions($table, $currentIdList, $cells, $this);
797  }
798  }
799  $theData[$fCol] = implode('', $cells);
800  break;
801  case '_CONTROL_':
802  // Control panel:
803  if (!$GLOBALS['TCA'][$table]['ctrl']['readOnly']) {
804  // If new records can be created on this page, add links:
805  if ($this->calcPerms & ($table == 'pages' ? 8 : 16) && $this->showNewRecLink($table)) {
806  if ($table == 'tt_content' && $this->newWizards) {
807  // If mod.web_list.newContentWiz.overrideWithExtension is set, use that extension's create new content wizard instead:
808  $tmpTSc = BackendUtility::getModTSconfig($this->pageinfo['uid'], 'mod.web_list');
809  $tmpTSc = $tmpTSc['properties']['newContentWiz.']['overrideWithExtension'];
810  $newContentWizScriptPath = $this->backPath . ExtensionManagementUtility::isLoaded($tmpTSc) ? ExtensionManagementUtility::extRelPath($tmpTSc) . 'mod1/db_new_content_el.php' : 'sysext/cms/layout/db_new_content_el.php';
811  $icon = '<a href="#" onclick="' . htmlspecialchars(('return jumpExt(\'' . $newContentWizScriptPath . '?id=' . $this->id . '\');')) . '" title="' . $GLOBALS['LANG']->getLL('new', TRUE) . '">' . ($table == 'pages' ? IconUtility::getSpriteIcon('actions-page-new') : IconUtility::getSpriteIcon('actions-document-new')) . '</a>';
812  } elseif ($table == 'pages' && $this->newWizards) {
813  $icon = '<a href="' . htmlspecialchars(($this->backPath . 'db_new.php?id=' . $this->id . '&pagesOnly=1&returnUrl=' . rawurlencode(GeneralUtility::getIndpEnv('REQUEST_URI')))) . '" title="' . $GLOBALS['LANG']->getLL('new', TRUE) . '">' . ($table == 'pages' ? IconUtility::getSpriteIcon('actions-page-new') : IconUtility::getSpriteIcon('actions-document-new')) . '</a>';
814  } else {
815  $params = '&edit[' . $table . '][' . $this->id . ']=new';
816  if ($table == 'pages_language_overlay') {
817  $params .= '&overrideVals[pages_language_overlay][doktype]=' . (int)$this->pageRow['doktype'];
818  }
819  $icon = '<a href="#" onclick="' . htmlspecialchars(BackendUtility::editOnClick($params, $this->backPath, -1)) . '" title="' . $GLOBALS['LANG']->getLL('new', TRUE) . '">' . ($table == 'pages' ? IconUtility::getSpriteIcon('actions-page-new') : IconUtility::getSpriteIcon('actions-document-new')) . '</a>';
820  }
821  }
822  // If the table can be edited, add link for editing ALL SHOWN fields for all listed records:
823  if ($permsEdit && $this->table && is_array($currentIdList)) {
824  $editIdList = implode(',', $currentIdList);
825  if ($this->clipNumPane()) {
826  $editIdList = '\'+editList(\'' . $table . '\',\'' . $editIdList . '\')+\'';
827  }
828  $params = '&edit[' . $table . '][' . $editIdList . ']=edit&columnsOnly=' . implode(',', $this->fieldArray) . '&disHelp=1';
829  $icon .= '<a href="#" onclick="' . htmlspecialchars(BackendUtility::editOnClick($params, $this->backPath, -1)) . '" title="' . $GLOBALS['LANG']->getLL('editShownColumns', TRUE) . '">' . IconUtility::getSpriteIcon('actions-document-open') . '</a>';
830  }
831  // Add an empty entry, so column count fits again after moving this into $icon
832  $theData[$fCol] = '&nbsp;';
833  }
834  break;
835  case '_AFTERCONTROL_':
836 
837  case '_AFTERREF_':
838  // space column
839  $theData[$fCol] = '&nbsp;';
840  break;
841  default:
842  // Regular fields header:
843  $theData[$fCol] = '';
844 
845  // Check if $fCol is really a field and get the label and remove the colons at the end
846  $sortLabel = BackendUtility::getItemLabel($table, $fCol);
847  if ($sortLabel !== NULL) {
848  $sortLabel = $GLOBALS['LANG']->sL($sortLabel, TRUE);
849  $sortLabel = rtrim(trim($sortLabel), ':');
850  } else {
851  // No TCA field, only output the $fCol variable with square brackets []
852  $sortLabel = htmlspecialchars($fCol);
853  $sortLabel = '<i>[' . rtrim(trim($sortLabel), ':') . ']</i>';
854  }
855 
856  if ($this->table && is_array($currentIdList)) {
857  // If the numeric clipboard pads are selected, show duplicate sorting link:
858  if ($this->clipNumPane()) {
859  $theData[$fCol] .= '<a href="' . htmlspecialchars(($this->listURL('', -1) . '&duplicateField=' . $fCol)) . '" title="' . $GLOBALS['LANG']->getLL('clip_duplicates', TRUE) . '">' . IconUtility::getSpriteIcon('actions-document-duplicates-select') . '</a>';
860  }
861  // If the table can be edited, add link for editing THIS field for all listed records:
862  if (!$GLOBALS['TCA'][$table]['ctrl']['readOnly'] && $permsEdit && $GLOBALS['TCA'][$table]['columns'][$fCol]) {
863  $editIdList = implode(',', $currentIdList);
864  if ($this->clipNumPane()) {
865  $editIdList = '\'+editList(\'' . $table . '\',\'' . $editIdList . '\')+\'';
866  }
867  $params = '&edit[' . $table . '][' . $editIdList . ']=edit&columnsOnly=' . $fCol . '&disHelp=1';
868  $iTitle = sprintf($GLOBALS['LANG']->getLL('editThisColumn'), $sortLabel);
869  $theData[$fCol] .= '<a href="#" onclick="' . htmlspecialchars(BackendUtility::editOnClick($params, $this->backPath, -1)) . '" title="' . htmlspecialchars($iTitle) . '">' . IconUtility::getSpriteIcon('actions-document-open') . '</a>';
870  }
871  }
872  $theData[$fCol] .= $this->addSortLink($sortLabel, $fCol, $table);
873  }
874  }
881  if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['typo3/class.db_list_extra.inc']['actions'])) {
882  foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['typo3/class.db_list_extra.inc']['actions'] as $classData) {
883  $hookObject = GeneralUtility::getUserObj($classData);
884  if (!$hookObject instanceof \TYPO3\CMS\Recordlist\RecordList\RecordListHookInterface) {
885  throw new \UnexpectedValueException('$hookObject must implement interface TYPO3\\CMS\\Recordlist\\RecordList\\RecordListHookInterface', 1195567855);
886  }
887  $theData = $hookObject->renderListHeader($table, $currentIdList, $theData, $this);
888  }
889  }
890  // Create and return header table row:
891  return $this->addelement(1, $icon, $theData, ' class="c-headLine"', '');
892  }
893 
900  protected function getPointerForPage($page) {
901  return ($page - 1) * $this->iLimit;
902  }
903 
910  protected function renderListNavigation($renderPart = 'top') {
911  $totalPages = ceil($this->totalItems / $this->iLimit);
912  $content = '';
913  $returnContent = '';
914  // Show page selector if not all records fit into one page
915  if ($totalPages > 1) {
916  $listURL = $this->listURL('', $this->table);
917  // 1 = first page
918  // 0 = first element
919  $currentPage = floor($this->firstElementNumber / $this->iLimit) + 1;
920  // Compile first, previous, next, last and refresh buttons
921  if ($currentPage > 1) {
922  $labelFirst = $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_common.xlf:first');
923  $labelPrevious = $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_common.xlf:previous');
924  $first = '<a href="' . $listURL . '&pointer=' . $this->getPointerForPage(1) . '">' . IconUtility::getSpriteIcon('actions-view-paging-first', array('title' => $labelFirst)) . '</a>';
925  $previous = '<a href="' . $listURL . '&pointer=' . $this->getPointerForPage($currentPage - 1) . '">' . IconUtility::getSpriteIcon('actions-view-paging-previous', array('title' => $labelPrevious)) . '</a>';
926  } else {
927  $first = IconUtility::getSpriteIcon('actions-view-paging-first-disabled');
928  $previous = IconUtility::getSpriteIcon('actions-view-paging-previous-disabled');
929  }
930  if ($currentPage < $totalPages) {
931  $labelNext = $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_common.xlf:next');
932  $labelLast = $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_common.xlf:last');
933  $next = '<a href="' . $listURL . '&pointer=' . $this->getPointerForPage($currentPage + 1) . '">' . IconUtility::getSpriteIcon('actions-view-paging-next', array('title' => $labelNext)) . '</a>';
934  $last = '<a href="' . $listURL . '&pointer=' . $this->getPointerForPage($totalPages) . '">' . IconUtility::getSpriteIcon('actions-view-paging-last', array('title' => $labelLast)) . '</a>';
935  } else {
936  $next = IconUtility::getSpriteIcon('actions-view-paging-next-disabled');
937  $last = IconUtility::getSpriteIcon('actions-view-paging-last-disabled');
938  }
939  $reload = '<a href="#" onclick="document.dblistForm.action=\'' . $listURL . '&pointer=\'+calculatePointer(document.getElementById(\'jumpPage-' . $renderPart . '\').value); document.dblistForm.submit(); return true;" title="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_common.xlf:reload', TRUE) . '">' . IconUtility::getSpriteIcon('actions-system-refresh') . '</a>';
940  if ($renderPart === 'top') {
941  // Add js to traverse a page select input to a pointer value
942  $content = '
943 <script type="text/JavaScript">
944 /*<![CDATA[*/
945 
946  function calculatePointer(page) {
947  if (page > ' . $totalPages . ') {
948  page = ' . $totalPages . ';
949  }
950 
951  if (page < 1) {
952  page = 1;
953  }
954 
955  pointer = (page - 1) * ' . $this->iLimit . ';
956 
957  return pointer;
958  }
959 
960 /*]]>*/
961 </script>
962 ';
963  }
964  $pageNumberInput = '<span>
965  <input type="text" value="' . $currentPage . '" size="3" id="jumpPage-' . $renderPart . '" name="jumpPage-' . $renderPart . '" onkeyup="if (event.keyCode == Event.KEY_RETURN) { document.dblistForm.action=\'' . $listURL . '&pointer=\'+calculatePointer(this.value); document.dblistForm.submit(); } return true;" />
966  </span>';
967  $pageIndicator = '<span class="pageIndicator">' . sprintf($GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_mod_web_list.xlf:pageIndicator'), $pageNumberInput, $totalPages) . '</span>';
968  if ($this->totalItems > $this->firstElementNumber + $this->iLimit) {
969  $lastElementNumber = $this->firstElementNumber + $this->iLimit;
970  } else {
971  $lastElementNumber = $this->totalItems;
972  }
973  $rangeIndicator = '<span class="pageIndicator">' . sprintf($GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_mod_web_list.xlf:rangeIndicator'), ($this->firstElementNumber + 1), $lastElementNumber) . '</span>';
974  $content .= '<div id="typo3-dblist-pagination">' . $first . $previous . '<span class="bar">&nbsp;</span>' . $rangeIndicator . '<span class="bar">&nbsp;</span>' . $pageIndicator . '<span class="bar">&nbsp;</span>' . $next . $last . '<span class="bar">&nbsp;</span>' . $reload . '</div>';
975  $data = array();
976  $titleColumn = $this->fieldArray[0];
977  $data[$titleColumn] = $content;
978  $returnContent = $this->addElement(1, '', $data);
979  }
980  // end of if pages > 1
981  return $returnContent;
982  }
983 
984  /*********************************
985  *
986  * Rendering of various elements
987  *
988  *********************************/
997  public function makeControl($table, $row) {
998  if ($this->dontShowClipControlPanels) {
999  return '';
1000  }
1001  $rowUid = $row['uid'];
1002  if (ExtensionManagementUtility::isLoaded('version') && isset($row['_ORIG_uid'])) {
1003  $rowUid = $row['_ORIG_uid'];
1004  }
1005  $cells = array();
1006  // If the listed table is 'pages' we have to request the permission settings for each page:
1007  if ($table == 'pages') {
1008  $localCalcPerms = $GLOBALS['BE_USER']->calcPerms(BackendUtility::getRecord('pages', $row['uid']));
1009  }
1010  // This expresses the edit permissions for this particular element:
1011  $permsEdit = $table == 'pages' && $localCalcPerms & 2 || $table != 'pages' && $this->calcPerms & 16;
1012  // "Show" link (only pages and tt_content elements)
1013  if ($table == 'pages' || $table == 'tt_content') {
1014  $cells['view'] = '<a href="#" onclick="'
1015  . htmlspecialchars(
1017  ($table === 'tt_content' ? $this->id : $row['uid']),
1018  $this->backPath,
1019  '',
1020  ($table === 'tt_content' ? '#' . $row['uid'] : '')
1021  )
1022  ) . '" title="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:labels.showPage', TRUE) . '">'
1023  . IconUtility::getSpriteIcon('actions-document-view') . '</a>';
1024  } elseif (!$this->table) {
1025  $cells['view'] = $this->spaceIcon;
1026  }
1027  // "Edit" link: ( Only if permissions to edit the page-record of the content of the parent page ($this->id)
1028  if ($permsEdit) {
1029  $params = '&edit[' . $table . '][' . $row['uid'] . ']=edit';
1030  $cells['edit'] = '<a href="#" onclick="' . htmlspecialchars(BackendUtility::editOnClick($params, $this->backPath, -1)) . '" title="' . $GLOBALS['LANG']->getLL('edit', TRUE) . '">' . ($GLOBALS['TCA'][$table]['ctrl']['readOnly'] ? IconUtility::getSpriteIcon('actions-document-open-read-only') : IconUtility::getSpriteIcon('actions-document-open')) . '</a>';
1031  } elseif (!$this->table) {
1032  $cells['edit'] = $this->spaceIcon;
1033  }
1034  // "Move" wizard link for pages/tt_content elements:
1035  if ($table == 'tt_content' && $permsEdit || $table == 'pages') {
1036  $cells['move'] = '<a href="#" onclick="' . htmlspecialchars(('return jumpExt(\'' . $this->backPath . 'move_el.php?table=' . $table . '&uid=' . $row['uid'] . '\');')) . '" title="' . $GLOBALS['LANG']->getLL(('move_' . ($table == 'tt_content' ? 'record' : 'page')), TRUE) . '">' . ($table == 'tt_content' ? IconUtility::getSpriteIcon('actions-document-move') : IconUtility::getSpriteIcon('actions-page-move')) . '</a>';
1037  } elseif (!$this->table) {
1038  $cells['move'] = $this->spaceIcon;
1039  }
1040  // If the extended control panel is enabled OR if we are seeing a single table:
1041  if ($GLOBALS['SOBE']->MOD_SETTINGS['bigControlPanel'] || $this->table) {
1042  // "Info": (All records)
1043  $cells['viewBig'] = '<a href="#" onclick="' . htmlspecialchars(('top.launchView(\'' . $table . '\', \'' . $row['uid'] . '\'); return false;')) . '" title="' . $GLOBALS['LANG']->getLL('showInfo', TRUE) . '">' . IconUtility::getSpriteIcon('actions-document-info') . '</a>';
1044  // If the table is NOT a read-only table, then show these links:
1045  if (!$GLOBALS['TCA'][$table]['ctrl']['readOnly']) {
1046  // "Revert" link (history/undo)
1047  $cells['history'] = '<a href="#" onclick="' . htmlspecialchars(('return jumpExt(' . GeneralUtility::quoteJSvalue($this->backPath . BackendUtility::getModuleUrl('record_history', array('element' => $table . ':' . $row['uid']))) . ',\'#latest\');')) . '" title="' . $GLOBALS['LANG']->getLL('history', TRUE) . '">' . IconUtility::getSpriteIcon('actions-document-history-open') . '</a>';
1048  // Versioning:
1049  if (ExtensionManagementUtility::isLoaded('version') && !ExtensionManagementUtility::isLoaded('workspaces')) {
1050  $vers = BackendUtility::selectVersionsOfRecord($table, $row['uid'], 'uid', $GLOBALS['BE_USER']->workspace, FALSE, $row);
1051  // If table can be versionized.
1052  if (is_array($vers)) {
1053  $versionIcon = 'no-version';
1054  if (count($vers) > 1) {
1055  $versionIcon = count($vers) - 1;
1056  }
1057  $cells['version'] = '<a href="' . htmlspecialchars($this->backPath . BackendUtility::getModuleUrl('web_txversionM1', array('table' => $table, 'uid' => $row['uid']))) . '" title="' . $GLOBALS['LANG']->getLL('displayVersions', TRUE) . '">' . IconUtility::getSpriteIcon(('status-version-' . $versionIcon)) . '</a>';
1058  } elseif (!$this->table) {
1059  $cells['version'] = $this->spaceIcon;
1060  }
1061  }
1062  // "Edit Perms" link:
1063  if ($table == 'pages' && $GLOBALS['BE_USER']->check('modules', 'web_perm') && ExtensionManagementUtility::isLoaded('perm')) {
1064  $cells['perms'] = '<a href="' . htmlspecialchars((BackendUtility::getModuleUrl('web_perm') . '&id=' . $row['uid'] . '&return_id=' . $row['uid'] . '&edit=1')) . '" title="' . $GLOBALS['LANG']->getLL('permissions', TRUE) . '">' . IconUtility::getSpriteIcon('status-status-locked') . '</a>';
1065  } elseif (!$this->table && $GLOBALS['BE_USER']->check('modules', 'web_perm')) {
1066  $cells['perms'] = $this->spaceIcon;
1067  }
1068  // "New record after" link (ONLY if the records in the table are sorted by a "sortby"-row or if default values can depend on previous record):
1069  if ($GLOBALS['TCA'][$table]['ctrl']['sortby'] || $GLOBALS['TCA'][$table]['ctrl']['useColumnsForDefaultValues']) {
1070  if ($table != 'pages' && $this->calcPerms & 16 || $table == 'pages' && $this->calcPerms & 8) {
1071  if ($this->showNewRecLink($table)) {
1072  $params = '&edit[' . $table . '][' . -($row['_MOVE_PLH'] ? $row['_MOVE_PLH_uid'] : $row['uid']) . ']=new';
1073  $cells['new'] = '<a href="#" onclick="' . htmlspecialchars(BackendUtility::editOnClick($params, $this->backPath, -1)) . '" title="' . $GLOBALS['LANG']->getLL(('new' . ($table == 'pages ' ? 'Page' : 'Record')), TRUE) . '">' . ($table == 'pages' ? IconUtility::getSpriteIcon('actions-page-new') : IconUtility::getSpriteIcon('actions-document-new')) . '</a>';
1074  }
1075  }
1076  } elseif (!$this->table) {
1077  $cells['new'] = $this->spaceIcon;
1078  }
1079  // "Up/Down" links
1080  if ($permsEdit && $GLOBALS['TCA'][$table]['ctrl']['sortby'] && !$this->sortField && !$this->searchLevels) {
1081  if (isset($this->currentTable['prev'][$row['uid']])) {
1082  // Up
1083  $params = '&cmd[' . $table . '][' . $row['uid'] . '][move]=' . $this->currentTable['prev'][$row['uid']];
1084  $cells['moveUp'] = '<a href="#" onclick="' . htmlspecialchars(('return jumpToUrl(\'' . $GLOBALS['SOBE']->doc->issueCommand($params, -1) . '\');')) . '" title="' . $GLOBALS['LANG']->getLL('moveUp', TRUE) . '">' . IconUtility::getSpriteIcon('actions-move-up') . '</a>';
1085  } else {
1086  $cells['moveUp'] = $this->spaceIcon;
1087  }
1088  if ($this->currentTable['next'][$row['uid']]) {
1089  // Down
1090  $params = '&cmd[' . $table . '][' . $row['uid'] . '][move]=' . $this->currentTable['next'][$row['uid']];
1091  $cells['moveDown'] = '<a href="#" onclick="' . htmlspecialchars(('return jumpToUrl(\'' . $GLOBALS['SOBE']->doc->issueCommand($params, -1) . '\');')) . '" title="' . $GLOBALS['LANG']->getLL('moveDown', TRUE) . '">' . IconUtility::getSpriteIcon('actions-move-down') . '</a>';
1092  } else {
1093  $cells['moveDown'] = $this->spaceIcon;
1094  }
1095  } elseif (!$this->table) {
1096  $cells['moveUp'] = $this->spaceIcon;
1097  $cells['moveDown'] = $this->spaceIcon;
1098  }
1099  // "Hide/Unhide" links:
1100  $hiddenField = $GLOBALS['TCA'][$table]['ctrl']['enablecolumns']['disabled'];
1101  if ($permsEdit && $hiddenField && $GLOBALS['TCA'][$table]['columns'][$hiddenField] && (!$GLOBALS['TCA'][$table]['columns'][$hiddenField]['exclude'] || $GLOBALS['BE_USER']->check('non_exclude_fields', $table . ':' . $hiddenField))) {
1102  if ($row[$hiddenField]) {
1103  $params = '&data[' . $table . '][' . $rowUid . '][' . $hiddenField . ']=0';
1104  $cells['hide'] = '<a href="#" onclick="' . htmlspecialchars('return jumpToUrl(\'' . $GLOBALS['SOBE']->doc->issueCommand($params, -1) . '\');') . '" title="' . $GLOBALS['LANG']->getLL(('unHide' . ($table == 'pages' ? 'Page' : '')), TRUE) . '">' . IconUtility::getSpriteIcon('actions-edit-unhide') . '</a>';
1105  } else {
1106  $params = '&data[' . $table . '][' . $rowUid . '][' . $hiddenField . ']=1';
1107  $cells['hide'] = '<a href="#" onclick="' . htmlspecialchars('return jumpToUrl(\'' . $GLOBALS['SOBE']->doc->issueCommand($params, -1) . '\');') . '" title="' . $GLOBALS['LANG']->getLL(('hide' . ($table == 'pages' ? 'Page' : '')), TRUE) . '">' . IconUtility::getSpriteIcon('actions-edit-hide') . '</a>';
1108  }
1109  } elseif (!$this->table) {
1110  $cells['hide'] = $this->spaceIcon;
1111  }
1112  // "Delete" link:
1113  if ($table == 'pages' && $localCalcPerms & 4 || $table != 'pages' && $this->calcPerms & 16) {
1114  // Check if the record version is in "deleted" state, because that will switch the action to "restore"
1115  if ($GLOBALS['BE_USER']->workspace > 0 && isset($row['t3ver_state']) && (int)$row['t3ver_state'] === 2) {
1116  $actionName = 'restore';
1117  $refCountMsg = '';
1118  } else {
1119  $actionName = 'delete';
1120  $refCountMsg = BackendUtility::referenceCount(
1121  $table,
1122  $row['uid'],
1123  ' ' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:labels.referencesToRecord'),
1124  $this->getReferenceCount($table, $row['uid'])) . BackendUtility::translationCount($table, $row['uid'],
1125  ' ' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:labels.translationsOfRecord')
1126  );
1127  }
1128 
1129  $titleOrig = BackendUtility::getRecordTitle($table, $row, FALSE, TRUE);
1130  $title = GeneralUtility::fixed_lgd_cs($titleOrig, $this->fixedL);
1131  $warningText = GeneralUtility::quoteJSvalue(
1132  $GLOBALS['LANG']->getLL($actionName . 'Warning') . ' "' . $title . '" ' . $refCountMsg
1133  );
1134 
1135  $params = '&cmd[' . $table . '][' . $row['uid'] . '][delete]=1';
1136  $onClick = 'if (confirm(' . $warningText . ')) {jumpToUrl(\'' . $GLOBALS['SOBE']->doc->issueCommand($params, -1) . '\');} return false;';
1137 
1138  $icon = IconUtility::getSpriteIcon('actions-edit-' . $actionName);
1139  $linkTitle = $GLOBALS['LANG']->getLL($actionName, TRUE);
1140  $cells['delete'] = '<a href="#" onclick="' . htmlspecialchars($onClick) . '" title="' . $linkTitle . '">' . $icon . '</a>';
1141  } elseif (!$this->table) {
1142  $cells['delete'] = $this->spaceIcon;
1143  }
1144  // "Levels" links: Moving pages into new levels...
1145  if ($permsEdit && $table == 'pages' && !$this->searchLevels) {
1146  // Up (Paste as the page right after the current parent page)
1147  if ($this->calcPerms & 8) {
1148  $params = '&cmd[' . $table . '][' . $row['uid'] . '][move]=' . -$this->id;
1149  $cells['moveLeft'] = '<a href="#" onclick="' . htmlspecialchars('return jumpToUrl(\'' . $GLOBALS['SOBE']->doc->issueCommand($params, -1) . '\');') . '" title="' . $GLOBALS['LANG']->getLL('prevLevel', TRUE) . '">' . IconUtility::getSpriteIcon('actions-move-left') . '</a>';
1150  }
1151  // Down (Paste as subpage to the page right above)
1152  if ($this->currentTable['prevUid'][$row['uid']]) {
1153  $localCalcPerms = $GLOBALS['BE_USER']->calcPerms(BackendUtility::getRecord('pages', $this->currentTable['prevUid'][$row['uid']]));
1154  if ($localCalcPerms & 8) {
1155  $params = '&cmd[' . $table . '][' . $row['uid'] . '][move]=' . $this->currentTable['prevUid'][$row['uid']];
1156  $cells['moveRight'] = '<a href="#" onclick="' . htmlspecialchars('return jumpToUrl(\'' . $GLOBALS['SOBE']->doc->issueCommand($params, -1) . '\');') . '" title="' . $GLOBALS['LANG']->getLL('nextLevel', TRUE) . '">' . IconUtility::getSpriteIcon('actions-move-right') . '</a>';
1157  } else {
1158  $cells['moveRight'] = $this->spaceIcon;
1159  }
1160  } else {
1161  $cells['moveRight'] = $this->spaceIcon;
1162  }
1163  } elseif (!$this->table) {
1164  $cells['moveLeft'] = $this->spaceIcon;
1165  $cells['moveRight'] = $this->spaceIcon;
1166  }
1167  }
1168  }
1174  if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['GLOBAL']['recStatInfoHooks'])) {
1175  $stat = '';
1176  $_params = array($table, $row['uid']);
1177  foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['GLOBAL']['recStatInfoHooks'] as $_funcRef) {
1178  $stat .= GeneralUtility::callUserFunction($_funcRef, $_params, $this);
1179  }
1180  $cells['stat'] = $stat;
1181  }
1188  if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['typo3/class.db_list_extra.inc']['actions'])) {
1189  foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['typo3/class.db_list_extra.inc']['actions'] as $classData) {
1190  $hookObject = GeneralUtility::getUserObj($classData);
1191  if (!$hookObject instanceof \TYPO3\CMS\Recordlist\RecordList\RecordListHookInterface) {
1192  throw new \UnexpectedValueException('$hookObject must implement interface TYPO3\\CMS\\Recordlist\\RecordList\\RecordListHookInterface', 1195567840);
1193  }
1194  $cells = $hookObject->makeControl($table, $row, $cells, $this);
1195  }
1196  }
1197  // Compile items into a DIV-element:
1198  return '
1199  <!-- CONTROL PANEL: ' . $table . ':' . $row['uid'] . ' -->
1200  <div class="typo3-DBctrl">' . implode('', $cells) . '</div>';
1201  }
1202 
1211  public function makeClip($table, $row) {
1212  // Return blank, if disabled:
1213  if ($this->dontShowClipControlPanels) {
1214  return '';
1215  }
1216  $cells = array();
1217  $cells['pasteAfter'] = ($cells['pasteInto'] = $this->spaceIcon);
1218  //enables to hide the copy, cut and paste icons for localized records - doesn't make much sense to perform these options for them
1219  $isL10nOverlay = $this->localizationView && $table != 'pages_language_overlay' && $row[$GLOBALS['TCA'][$table]['ctrl']['transOrigPointerField']] != 0;
1220  // Return blank, if disabled:
1221  // Whether a numeric clipboard pad is active or the normal pad we will see different content of the panel:
1222  // For the "Normal" pad:
1223  if ($this->clipObj->current == 'normal') {
1224  // Show copy/cut icons:
1225  $isSel = (string) $this->clipObj->isSelected($table, $row['uid']);
1226  $cells['copy'] = $isL10nOverlay ? $this->spaceIcon : '<a href="#" onclick="' . htmlspecialchars(('return jumpSelf(\'' . $this->clipObj->selUrlDB($table, $row['uid'], 1, ($isSel == 'copy'), array('returnUrl' => '')) . '\');')) . '" title="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:cm.copy', TRUE) . '">' . (!$isSel == 'copy' ? IconUtility::getSpriteIcon('actions-edit-copy') : IconUtility::getSpriteIcon('actions-edit-copy-release')) . '</a>';
1227  $cells['cut'] = $isL10nOverlay ? $this->spaceIcon : '<a href="#" onclick="' . htmlspecialchars(('return jumpSelf(\'' . $this->clipObj->selUrlDB($table, $row['uid'], 0, ($isSel == 'cut'), array('returnUrl' => '')) . '\');')) . '" title="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:cm.cut', TRUE) . '">' . (!$isSel == 'cut' ? IconUtility::getSpriteIcon('actions-edit-cut') : IconUtility::getSpriteIcon('actions-edit-cut-release')) . '</a>';
1228  } else {
1229  // For the numeric clipboard pads (showing checkboxes where one can select elements on/off)
1230  // Setting name of the element in ->CBnames array:
1231  $n = $table . '|' . $row['uid'];
1232  $this->CBnames[] = $n;
1233  // Check if the current element is selected and if so, prepare to set the checkbox as selected:
1234  $checked = $this->clipObj->isSelected($table, $row['uid']) ? ' checked="checked"' : '';
1235  // If the "duplicateField" value is set then select all elements which are duplicates...
1236  if ($this->duplicateField && isset($row[$this->duplicateField])) {
1237  $checked = '';
1238  if (in_array($row[$this->duplicateField], $this->duplicateStack)) {
1239  $checked = ' checked="checked"';
1240  }
1241  $this->duplicateStack[] = $row[$this->duplicateField];
1242  }
1243  // Adding the checkbox to the panel:
1244  $cells['select'] = $isL10nOverlay ? $this->spaceIcon : '<input type="hidden" name="CBH[' . $n . ']" value="0" /><input type="checkbox" name="CBC[' . $n . ']" value="1" class="smallCheckboxes"' . $checked . ' />';
1245  }
1246  // Now, looking for selected elements from the current table:
1247  $elFromTable = $this->clipObj->elFromTable($table);
1248  if (count($elFromTable) && $GLOBALS['TCA'][$table]['ctrl']['sortby']) {
1249  // IF elements are found and they can be individually ordered, then add a "paste after" icon:
1250  $cells['pasteAfter'] = $isL10nOverlay ? $this->spaceIcon : '<a href="' . htmlspecialchars($this->clipObj->pasteUrl($table, -$row['uid'])) . '" onclick="' . htmlspecialchars(('return ' . $this->clipObj->confirmMsg($table, $row, 'after', $elFromTable))) . '" title="' . $GLOBALS['LANG']->getLL('clip_pasteAfter', TRUE) . '">' . IconUtility::getSpriteIcon('actions-document-paste-after') . '</a>';
1251  }
1252  // Now, looking for elements in general:
1253  $elFromTable = $this->clipObj->elFromTable('');
1254  if ($table == 'pages' && count($elFromTable)) {
1255  $cells['pasteInto'] = '<a href="' . htmlspecialchars($this->clipObj->pasteUrl('', $row['uid'])) . '" onclick="' . htmlspecialchars(('return ' . $this->clipObj->confirmMsg($table, $row, 'into', $elFromTable))) . '" title="' . $GLOBALS['LANG']->getLL('clip_pasteInto', TRUE) . '">' . IconUtility::getSpriteIcon('actions-document-paste-into') . '</a>';
1256  }
1263  if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['typo3/class.db_list_extra.inc']['actions'])) {
1264  foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['typo3/class.db_list_extra.inc']['actions'] as $classData) {
1265  $hookObject = GeneralUtility::getUserObj($classData);
1266  if (!$hookObject instanceof \TYPO3\CMS\Recordlist\RecordList\RecordListHookInterface) {
1267  throw new \UnexpectedValueException('$hookObject must implement interface TYPO3\\CMS\\Recordlist\\RecordList\\RecordListHookInterface', 1195567845);
1268  }
1269  $cells = $hookObject->makeClip($table, $row, $cells, $this);
1270  }
1271  }
1272  // Compile items into a DIV-element:
1273  return ' <!-- CLIPBOARD PANEL: ' . $table . ':' . $row['uid'] . ' -->
1274  <div class="typo3-clipCtrl">' . implode('', $cells) . '</div>';
1275  }
1276 
1285  protected function createReferenceHtml($tableName, $uid) {
1286  $rows = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows(
1287  'tablename, recuid, field',
1288  'sys_refindex',
1289  'ref_table = ' . $GLOBALS['TYPO3_DB']->fullQuoteStr($tableName, 'sys_refindex') .
1290  ' AND ref_uid = ' . $uid . ' AND deleted = 0'
1291  );
1292  return $this->generateReferenceToolTip($rows, '\'' . $tableName . '\', \'' . $uid . '\'');
1293  }
1294 
1303  public function makeLocalizationPanel($table, $row) {
1304  $out = array(
1305  0 => '',
1306  1 => ''
1307  );
1308  // Reset translations
1309  $this->translations = array();
1310  $translations = $this->translateTools->translationInfo($table, $row['uid'], 0, $row, $this->selFieldList);
1311  // Language title and icon:
1312  $out[0] = $this->languageFlag($row[$GLOBALS['TCA'][$table]['ctrl']['languageField']]);
1313  if (is_array($translations)) {
1314  $this->translations = $translations['translations'];
1315  // Traverse page translations and add icon for each language that does NOT yet exist:
1316  $lNew = '';
1317  foreach ($this->pageOverlays as $lUid_OnPage => $lsysRec) {
1318  if (!isset($translations['translations'][$lUid_OnPage]) && $GLOBALS['BE_USER']->checkLanguageAccess($lUid_OnPage)) {
1319  $url = substr($this->listURL(), strlen($this->backPath));
1320  $href = $GLOBALS['SOBE']->doc->issueCommand('&cmd[' . $table . '][' . $row['uid'] . '][localize]=' . $lUid_OnPage, $url . '&justLocalized=' . rawurlencode(($table . ':' . $row['uid'] . ':' . $lUid_OnPage)));
1321  $language = BackendUtility::getRecord('sys_language', $lUid_OnPage, 'title');
1322  if ($this->languageIconTitles[$lUid_OnPage]['flagIcon']) {
1323  $lC = IconUtility::getSpriteIcon($this->languageIconTitles[$lUid_OnPage]['flagIcon']);
1324  } else {
1325  $lC = $this->languageIconTitles[$lUid_OnPage]['title'];
1326  }
1327  $lC = '<a href="' . htmlspecialchars($href) . '" title="' . htmlspecialchars($language['title']) . '">' . $lC . '</a> ';
1328  $lNew .= $lC;
1329  }
1330  }
1331  if ($lNew) {
1332  $out[1] .= $lNew;
1333  }
1334  } elseif ($row['l18n_parent']) {
1335  $out[0] = '&nbsp;&nbsp;&nbsp;&nbsp;' . $out[0];
1336  }
1337  return $out;
1338  }
1339 
1348  public function fieldSelectBox($table, $formFields = 1) {
1349  // Init:
1350  $formElements = array('', '');
1351  if ($formFields) {
1352  $formElements = array('<form action="' . htmlspecialchars($this->listURL()) . '" method="post">', '</form>');
1353  }
1354  // Load already selected fields, if any:
1355  $setFields = is_array($this->setFields[$table]) ? $this->setFields[$table] : array();
1356  // Request fields from table:
1357  $fields = $this->makeFieldList($table, FALSE, TRUE);
1358  // Add pseudo "control" fields
1359  $fields[] = '_PATH_';
1360  $fields[] = '_REF_';
1361  $fields[] = '_LOCALIZATION_';
1362  $fields[] = '_CONTROL_';
1363  $fields[] = '_CLIPBOARD_';
1364  // Create an option for each field:
1365  $opt = array();
1366  $opt[] = '<option value=""></option>';
1367  foreach ($fields as $fN) {
1368  // Field label
1369  $fL = is_array($GLOBALS['TCA'][$table]['columns'][$fN]) ? rtrim($GLOBALS['LANG']->sL($GLOBALS['TCA'][$table]['columns'][$fN]['label']), ':') : '[' . $fN . ']';
1370  $opt[] = '
1371  <option value="' . $fN . '"' . (in_array($fN, $setFields) ? ' selected="selected"' : '') . '>' . htmlspecialchars($fL) . '</option>';
1372  }
1373  // Compile the options into a multiple selector box:
1374  $lMenu = '
1375  <select size="' . \TYPO3\CMS\Core\Utility\MathUtility::forceIntegerInRange((count($fields) + 1), 3, 20) . '" multiple="multiple" name="displayFields[' . $table . '][]">' . implode('', $opt) . '
1376  </select>
1377  ';
1378  // Table with the field selector::
1379  $content = $formElements[0] . '
1380 
1381  <!--
1382  Field selector for extended table view:
1383  -->
1384  <table border="0" cellpadding="0" cellspacing="0" id="typo3-dblist-fieldSelect">
1385  <tr>
1386  <td>' . $lMenu . '</td>
1387  <td><input type="submit" name="search" value="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:labels.setFields', TRUE) . '" /></td>
1388  </tr>
1389  </table>
1390  ' . $formElements[1];
1391  return '<div class="db_list-fieldSelect">' . $content . '</div>';
1392  }
1393 
1394  /*********************************
1395  *
1396  * Helper functions
1397  *
1398  *********************************/
1410  public function linkClipboardHeaderIcon($string, $table, $cmd, $warning = '') {
1411  $onClickEvent = 'document.dblistForm.cmd.value=\'' . $cmd . '\';document.dblistForm.cmd_table.value=\'' . $table . '\';document.dblistForm.submit();';
1412  if ($warning) {
1413  $onClickEvent = 'if (confirm(' . GeneralUtility::quoteJSvalue($warning) . ')){' . $onClickEvent . '}';
1414  }
1415  return '<a href="#" onclick="' . htmlspecialchars(($onClickEvent . 'return false;')) . '">' . $string . '</a>';
1416  }
1417 
1424  public function clipNumPane() {
1425  return in_Array('_CLIPBOARD_', $this->fieldArray) && $this->clipObj->current != 'normal';
1426  }
1427 
1439  public function addSortLink($code, $field, $table) {
1440  // Certain circumstances just return string right away (no links):
1441  if ($field == '_CONTROL_' || $field == '_LOCALIZATION_' || $field == '_CLIPBOARD_' || $field == '_REF_' || $this->disableSingleTableView) {
1442  return $code;
1443  }
1444  // If "_PATH_" (showing record path) is selected, force sorting by pid field (will at least group the records!)
1445  if ($field == '_PATH_') {
1446  $field = 'pid';
1447  }
1448  // Create the sort link:
1449  $sortUrl = $this->listURL('', -1, 'sortField,sortRev,table,firstElementNumber') . '&table=' . $table . '&sortField=' . $field . '&sortRev=' . ($this->sortRev || $this->sortField != $field ? 0 : 1);
1450  $sortArrow = $this->sortField === $field ? IconUtility::getSpriteIcon('status-status-sorting-' . ($this->sortRev ? 'desc' : 'asc')) : '';
1451  // Return linked field:
1452  return '<a href="' . htmlspecialchars($sortUrl) . '">' . $code . $sortArrow . '</a>';
1453  }
1454 
1463  public function recPath($pid) {
1464  if (!isset($this->recPath_cache[$pid])) {
1465  $this->recPath_cache[$pid] = BackendUtility::getRecordPath($pid, $this->perms_clause, 20);
1466  }
1467  return $this->recPath_cache[$pid];
1468  }
1469 
1478  public function showNewRecLink($table) {
1479  // No deny/allow tables are set:
1480  if (!count($this->allowedNewTables) && !count($this->deniedNewTables)) {
1481  return TRUE;
1482  } elseif (!in_array($table, $this->deniedNewTables) && (!count($this->allowedNewTables) || in_array($table, $this->allowedNewTables))) {
1483  return TRUE;
1484  } else {
1485  return FALSE;
1486  }
1487  }
1488 
1496  public function makeReturnUrl() {
1497  return '&returnUrl=' . rawurlencode(GeneralUtility::getIndpEnv('REQUEST_URI'));
1498  }
1499 
1500  /************************************
1501  *
1502  * CSV related functions
1503  *
1504  ************************************/
1510  protected function initCSV() {
1511  $this->addHeaderRowToCSV();
1512  }
1513 
1519  protected function addHeaderRowToCSV() {
1520  // Add header row, control fields will be reduced inside addToCSV()
1521  $this->addToCSV(array_combine($this->fieldArray, $this->fieldArray));
1522  }
1523 
1530  protected function addToCSV(array $row = array()) {
1531  $rowReducedByControlFields = self::removeControlFieldsFromFieldRow($row);
1532  $rowReducedToSelectedColumns = array_intersect_key($rowReducedByControlFields, array_flip($this->fieldArray));
1533  $this->setCsvRow($rowReducedToSelectedColumns);
1534  }
1535 
1542  static protected function removeControlFieldsFromFieldRow(array $row = array()) {
1543  // Possible control fields in a list row
1544  $controlFields = array(
1545  '_PATH_',
1546  '_REF_',
1547  '_CONTROL_',
1548  '_AFTERCONTROL_',
1549  '_AFTERREF_',
1550  '_CLIPBOARD_',
1551  '_LOCALIZATION_',
1552  '_LOCALIZATION_b'
1553  );
1554  return array_diff_key($row, array_flip($controlFields));
1555  }
1556 
1564  public function setCsvRow($csvRow) {
1565  $this->csvLines[] = GeneralUtility::csvValues($csvRow);
1566  }
1567 
1576  public function outputCSV($prefix) {
1577  // Setting filename:
1578  $filename = $prefix . '_' . date('dmy-Hi') . '.csv';
1579  // Creating output header:
1580  header('Content-Type: application/octet-stream');
1581  header('Content-Disposition: attachment; filename=' . $filename);
1582  // Cache-Control header is needed here to solve an issue with browser IE and
1583  // versions lower then 9. See for more information: http://support.microsoft.com/kb/323308
1584  header("Cache-Control: ''");
1585  // Printing the content of the CSV lines:
1586  echo implode(chr(13) . chr(10), $this->csvLines);
1587  // Exits:
1588  die;
1589  }
1590 
1591 }
static editOnClick($params, $backPath='', $requestUri='')
static BEgetRootLine($uid, $clause='', $workspaceOL=FALSE)
static cshItem($table, $field, $BACK_PATH, $wrap='', $onlyIconMode=FALSE, $styleAttrib='')
static trimExplode($delim, $string, $removeEmptyValues=FALSE, $limit=0)
static viewOnClick($pageUid, $backPath='', $rootLine='', $anchorSection='', $alternativeUrl='', $additionalGetVars='', $switchFocus=TRUE)
static getModuleUrl($moduleName, $urlParameters=array(), $backPathOverride=FALSE, $returnAbsoluteUrl=FALSE)
static selectVersionsOfRecord($table, $uid, $fields=' *', $workspace=0, $includeDeletedRecords=FALSE, $row=NULL)
if(!defined('TYPO3_MODE')) $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_userauth.php']['logoff_pre_processing'][]
addElement($h, $icon, $data, $trParams='', $lMargin='', $altLine='')