|
TYPO3 API
SVNRelease
|
00001 <?php 00002 /*************************************************************** 00003 * Copyright notice 00004 * 00005 * (c) 2009-2011 Julian Kleinhans <typo3@kj187.de> 00006 * All rights reserved 00007 * 00008 * This script is part of the TYPO3 project. The TYPO3 project is 00009 * free software; you can redistribute it and/or modify 00010 * it under the terms of the GNU General Public License as published by 00011 * the Free Software Foundation; either version 2 of the License, or 00012 * (at your option) any later version. 00013 * 00014 * The GNU General Public License can be found at 00015 * http://www.gnu.org/copyleft/gpl.html. 00016 * 00017 * This script is distributed in the hope that it will be useful, 00018 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00019 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00020 * GNU General Public License for more details. 00021 * 00022 * This copyright notice MUST APPEAR in all copies of the script! 00023 ***************************************************************/ 00024 00025 require_once(t3lib_extMgm::extPath('recycler', 'classes/helper/class.tx_recycler_helper.php')); 00026 00027 /** 00028 * Deleted Records View 00029 * 00030 * @author Erik Frister <erik_frister@otq-solutions.com> 00031 * @author Julian Kleinhans <typo3@kj187.de> 00032 * @package TYPO3 00033 * @subpackage tx_recycler 00034 * @version $Id: class.tx_recycler_view_deletedRecords.php 10551 2011-02-22 22:03:19Z steffenk $ 00035 **/ 00036 class tx_recycler_view_deletedRecords { 00037 00038 /** 00039 * Transforms the rows for the deleted Records into the Array View necessary for ExtJS Ext.data.ArrayReader 00040 * 00041 * @param array $rows Array with table as key and array with all deleted rows 00042 * @param integer $totalDeleted: Number of deleted records in total, for PagingToolbar 00043 * @return string JSON Array 00044 **/ 00045 public function transform ($deletedRowsArray, $totalDeleted) { 00046 $total = 0; 00047 00048 $jsonArray = array( 00049 'rows' => array(), 00050 ); 00051 00052 // iterate 00053 if (is_array($deletedRowsArray) && count($deletedRowsArray) > 0) { 00054 foreach($deletedRowsArray as $table => $rows) { 00055 $total += count($deletedRowsArray[$table]); 00056 00057 foreach($rows as $row) { 00058 $backendUser = t3lib_BEfunc::getRecord('be_users', $row[$GLOBALS['TCA'][$table]['ctrl']['cruser_id']], 'username', '', FALSE); 00059 $jsonArray['rows'][] = array( 00060 'uid' => $row['uid'], 00061 'pid' => $row['pid'], 00062 'table' => $table, 00063 'crdate' => date($GLOBALS['TYPO3_CONF_VARS']['SYS']['ddmmyy'] . ' ' . $GLOBALS['TYPO3_CONF_VARS']['SYS']['hhmm'], $row[$GLOBALS['TCA'][$table]['ctrl']['crdate']]), 00064 'tstamp' => date($GLOBALS['TYPO3_CONF_VARS']['SYS']['ddmmyy'] . ' ' . $GLOBALS['TYPO3_CONF_VARS']['SYS']['hhmm'], $row[$GLOBALS['TCA'][$table]['ctrl']['tstamp']]), 00065 'owner' => $backendUser['username'], 00066 'owner_uid' => $row[$GLOBALS['TCA'][$table]['ctrl']['cruser_id']], 00067 'tableTitle' => tx_recycler_helper::getUtf8String( 00068 $GLOBALS['LANG']->sL($GLOBALS['TCA'][$table]['ctrl']['title']) 00069 ), 00070 'title' => tx_recycler_helper::getUtf8String( 00071 t3lib_BEfunc::getRecordTitle($table, $row) 00072 ), 00073 'path' => tx_recycler_helper::getRecordPath($row['pid']), 00074 ); 00075 } 00076 } 00077 } 00078 00079 $jsonArray['total'] = $totalDeleted; 00080 return json_encode($jsonArray); 00081 } 00082 } 00083 00084 if (defined('TYPO3_MODE') && isset($GLOBALS['TYPO3_CONF_VARS'][TYPO3_MODE]['XCLASS']['ext/recycler/classes/view/class.tx_recycler_view_deletedRecords.php'])) { 00085 include_once($GLOBALS['TYPO3_CONF_VARS'][TYPO3_MODE]['XCLASS']['ext/recycler/classes/view/class.tx_recycler_view_deletedRecords.php']); 00086 } 00087 00088 ?>
1.8.0