/**
  * Transforms the rows for the deleted Records into the Array View necessary for ExtJS Ext.data.ArrayReader
  *
  * @param array     $rows   Array with table as key and array with all deleted rows
  * @param integer	$totalDeleted: Number of deleted records in total, for PagingToolbar
  * @return string   JSON Array
  */
 public function transform($deletedRowsArray, $totalDeleted)
 {
     $total = 0;
     $jsonArray = array('rows' => array());
     // iterate
     if (is_array($deletedRowsArray) && count($deletedRowsArray) > 0) {
         foreach ($deletedRowsArray as $table => $rows) {
             $total += count($deletedRowsArray[$table]);
             foreach ($rows as $row) {
                 $backendUser = \TYPO3\CMS\Backend\Utility\BackendUtility::getRecord('be_users', $row[$GLOBALS['TCA'][$table]['ctrl']['cruser_id']], 'username', '', FALSE);
                 $jsonArray['rows'][] = array('uid' => $row['uid'], 'pid' => $row['pid'], 'table' => $table, 'crdate' => \TYPO3\CMS\Backend\Utility\BackendUtility::datetime($row[$GLOBALS['TCA'][$table]['ctrl']['crdate']]), 'tstamp' => \TYPO3\CMS\Backend\Utility\BackendUtility::datetime($row[$GLOBALS['TCA'][$table]['ctrl']['tstamp']]), 'owner' => htmlspecialchars($backendUser['username']), 'owner_uid' => $row[$GLOBALS['TCA'][$table]['ctrl']['cruser_id']], 'tableTitle' => \TYPO3\CMS\Recycler\Utility\RecyclerUtility::getUtf8String($GLOBALS['LANG']->sL($GLOBALS['TCA'][$table]['ctrl']['title'])), 'title' => htmlspecialchars(\TYPO3\CMS\Recycler\Utility\RecyclerUtility::getUtf8String(\TYPO3\CMS\Backend\Utility\BackendUtility::getRecordTitle($table, $row))), 'path' => \TYPO3\CMS\Recycler\Utility\RecyclerUtility::getRecordPath($row['pid']));
             }
         }
     }
     $jsonArray['total'] = $totalDeleted;
     return json_encode($jsonArray);
 }
 /**
  * Transforms the rows for the deleted records
  *
  * @param array $deletedRowsArray Array with table as key and array with all deleted rows
  * @param int $totalDeleted Number of deleted records in total
  * @return string JSON array
  */
 public function transform($deletedRowsArray, $totalDeleted)
 {
     $total = 0;
     $jsonArray = array('rows' => array());
     if (is_array($deletedRowsArray)) {
         $lang = $this->getLanguageService();
         $backendUser = $this->getBackendUser();
         foreach ($deletedRowsArray as $table => $rows) {
             $total += count($deletedRowsArray[$table]);
             foreach ($rows as $row) {
                 $pageTitle = $this->getPageTitle((int) $row['pid']);
                 $backendUser = BackendUtility::getRecord('be_users', $row[$GLOBALS['TCA'][$table]['ctrl']['cruser_id']], 'username', '', FALSE);
                 $jsonArray['rows'][] = array('uid' => $row['uid'], 'pid' => $row['pid'], 'icon' => IconUtility::getSpriteIconForRecord($table, $row), 'pageTitle' => RecyclerUtility::getUtf8String($pageTitle), 'table' => $table, 'crdate' => BackendUtility::datetime($row[$GLOBALS['TCA'][$table]['ctrl']['crdate']]), 'tstamp' => BackendUtility::datetime($row[$GLOBALS['TCA'][$table]['ctrl']['tstamp']]), 'owner' => htmlspecialchars($backendUser['username']), 'owner_uid' => $row[$GLOBALS['TCA'][$table]['ctrl']['cruser_id']], 'tableTitle' => RecyclerUtility::getUtf8String($lang->sL($GLOBALS['TCA'][$table]['ctrl']['title'])), 'title' => htmlspecialchars(RecyclerUtility::getUtf8String(BackendUtility::getRecordTitle($table, $row))), 'path' => RecyclerUtility::getRecordPath($row['pid']));
             }
         }
     }
     $jsonArray['total'] = $totalDeleted;
     return $jsonArray;
 }
Ejemplo n.º 3
0
 /**
  * Transforms the rows for the deleted records
  *
  * @param array $deletedRowsArray Array with table as key and array with all deleted rows
  * @param int $totalDeleted Number of deleted records in total
  * @return string JSON array
  */
 public function transform($deletedRowsArray, $totalDeleted)
 {
     $total = 0;
     $jsonArray = array('rows' => array());
     if (is_array($deletedRowsArray)) {
         $lang = $this->getLanguageService();
         $iconFactory = GeneralUtility::makeInstance(IconFactory::class);
         foreach ($deletedRowsArray as $table => $rows) {
             $total += count($deletedRowsArray[$table]);
             foreach ($rows as $row) {
                 $pageTitle = $this->getPageTitle((int) $row['pid']);
                 $backendUser = BackendUtility::getRecord('be_users', $row[$GLOBALS['TCA'][$table]['ctrl']['cruser_id']], 'username', '', false);
                 $jsonArray['rows'][] = array('uid' => $row['uid'], 'pid' => $row['pid'], 'icon' => $iconFactory->getIconForRecord($table, $row, Icon::SIZE_SMALL)->render(), 'pageTitle' => $pageTitle, 'table' => $table, 'crdate' => BackendUtility::datetime($row[$GLOBALS['TCA'][$table]['ctrl']['crdate']]), 'tstamp' => BackendUtility::datetime($row[$GLOBALS['TCA'][$table]['ctrl']['tstamp']]), 'owner' => htmlspecialchars($backendUser['username']), 'owner_uid' => $row[$GLOBALS['TCA'][$table]['ctrl']['cruser_id']], 'tableTitle' => $lang->sL($GLOBALS['TCA'][$table]['ctrl']['title']), 'title' => htmlspecialchars(BackendUtility::getRecordTitle($table, $row)), 'path' => RecyclerUtility::getRecordPath($row['pid']));
             }
         }
     }
     $jsonArray['total'] = $totalDeleted;
     return $jsonArray;
 }