2 /***************************************************************
5 * (c) 2009 Julian Kleinhans <typo3@kj187.de>
8 * This script is part of the TYPO3 project. The TYPO3 project is
9 * free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
14 * The GNU General Public License can be found at
15 * http://www.gnu.org/copyleft/gpl.html.
17 * This script is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 * GNU General Public License for more details.
22 * This copyright notice MUST APPEAR in all copies of the script!
23 ***************************************************************/
25 require_once(t3lib_extMgm
::extPath('recycler', 'classes/model/class.tx_recycler_model_deletedRecords.php'));
28 * Model class for the 'recycler' extension.
30 * @author Julian Kleinhans <typo3@kj187.de>
32 * @subpackage tx_recycler
33 * @version $Id: class.tx_recycler_model_tables.php 17681 2009-03-10 18:28:28Z ohader $
35 class tx_recycler_model_tables
{
37 * Get tables for menu example
39 * @param string $format: Return format (example: json)
40 * @param boolean $withAllOption: 0 no, 1 return tables with a "all" option
41 * @param integer $id: UID from selected page
42 * @param integer $depth: How many levels recursive
43 * @return string The tables to be displayed
45 public function getTables($format, $withAllOption=0, $startUid, $depth=0) {
46 $deletedRecordsTotal = 0;
49 foreach (array_keys($GLOBALS['TCA']) as $tableName) {
50 $deletedField = tx_recycler_helper
::getDeletedField($tableName);
52 // Determine whether the table has deleted records:
53 $deletedCount = $GLOBALS['TYPO3_DB']->exec_SELECTcountRows(
59 $deletedDataObject = t3lib_div
::makeInstance('tx_recycler_model_deletedRecords');
60 $deletedData = $deletedDataObject->loadData($startUid, $tableName, $depth)->getDeletedRows();
61 if (isset($deletedData[$tableName])) {
62 if ($deletedRecordsInTable = count($deletedData[$tableName])) {
63 $deletedRecordsTotal +
= $deletedRecordsInTable;
66 $deletedRecordsInTable,
68 tx_recycler_helper
::getUtf8String(
69 $GLOBALS['LANG']->sL($GLOBALS['TCA'][$tableName]['ctrl']['title'])
86 $GLOBALS['LANG']->sL('LLL:EXT:recycler/mod1/locallang.xml:label_alltables'),
90 $output = json_encode($jsonArray);
96 if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE
]['XCLASS']['ext/recycler/classes/model/class.tx_recycler_model_tables.php']) {
97 include_once($TYPO3_CONF_VARS[TYPO3_MODE
]['XCLASS']['ext/recycler/classes/model/class.tx_recycler_model_tables.php']);