TYPO3 CMS  TYPO3_7-6
Tables.php
Go to the documentation of this file.
1 <?php
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 
18 
22 class Tables
23 {
31  public function getTables($startUid, $depth = 0)
32  {
33  $deletedRecordsTotal = 0;
34  $lang = $this->getLanguageService();
35  $tables = [];
36  foreach (RecyclerUtility::getModifyableTables() as $tableName) {
37  $deletedField = RecyclerUtility::getDeletedField($tableName);
38  if ($deletedField) {
39  // Determine whether the table has deleted records:
40  $deletedCount = $this->getDatabaseConnection()->exec_SELECTcountRows('uid', $tableName, $deletedField . '<>0');
41  if ($deletedCount) {
42  /* @var $deletedDataObject \TYPO3\CMS\Recycler\Domain\Model\DeletedRecords */
43  $deletedDataObject = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Recycler\Domain\Model\DeletedRecords::class);
44  $deletedData = $deletedDataObject->loadData($startUid, $tableName, $depth)->getDeletedRows();
45  if (isset($deletedData[$tableName])) {
46  if ($deletedRecordsInTable = count($deletedData[$tableName])) {
47  $deletedRecordsTotal += $deletedRecordsInTable;
48  $tables[] = [
49  $tableName,
50  $deletedRecordsInTable,
51  RecyclerUtility::getUtf8String($lang->sL($GLOBALS['TCA'][$tableName]['ctrl']['title']))
52  ];
53  }
54  }
55  }
56  }
57  }
58  $jsonArray = $tables;
59  array_unshift($jsonArray, [
60  '',
61  $deletedRecordsTotal,
62  $lang->sL('LLL:EXT:recycler/mod1/locallang.xlf:label_allrecordtypes')
63  ]);
64  return $jsonArray;
65  }
66 
72  protected function getDatabaseConnection()
73  {
74  return $GLOBALS['TYPO3_DB'];
75  }
76 
82  protected function getLanguageService()
83  {
84  return $GLOBALS['LANG'];
85  }
86 }
getTables($startUid, $depth=0)
Definition: Tables.php:31
if(TYPO3_MODE==='BE') $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_tsfebeuserauth.php']['frontendEditingController']['default']