TYPO3 CMS  TYPO3_6-2
AbstractExportTestCase.php
Go to the documentation of this file.
1 <?php
3 
19 
24 
28  protected $coreExtensionsToLoad = array('impexp');
29 
33  protected $export;
34 
41  public function setUp() {
42  parent::setUp();
43 
44  $this->setUpBackendUserFromFixture(1);
45  // Needed to avoid PHP Warnings
46  $GLOBALS['TBE_STYLES']['spriteIconApi']['iconsAvailable'] = array();
47 
48  \TYPO3\CMS\Core\Core\Bootstrap::getInstance()->initializeLanguageObject();
49 
50  $this->export = GeneralUtility::makeInstance('TYPO3\\CMS\\Impexp\\ImportExport');
51  $this->export->init(0, 'export');
52  }
53 
62  protected function setPageTree($pidToStart, $depth = 1) {
63 
64  $permsClause = $GLOBALS['BE_USER']->getPagePermsClause(1);
65 
67  $tree = GeneralUtility::makeInstance('TYPO3\\CMS\\Backend\\Tree\\View\\PageTreeView');
68  $tree->init('AND ' . $permsClause);
69  $tree->tree[] = array('row' => $pidToStart);
70  $tree->buffer_idH = array();
71  if ($depth > 0) {
72  $tree->getTree($pidToStart, $depth, '');
73  }
74 
75  $idH[$pidToStart]['uid'] = $pidToStart;
76  if (count($tree->buffer_idH)) {
77  $idH[$pidToStart]['subrow'] = $tree->buffer_idH;
78  }
79 
80  $this->export->setPageTree($idH);
81  }
82 
90  protected function addRecordsForPid($pid, array $tables) {
91  foreach ($GLOBALS['TCA'] as $table => $value) {
92  if ($table != 'pages' && (in_array($table, $tables) || in_array('_ALL', $tables))) {
93  if ($GLOBALS['BE_USER']->check('tables_select', $table) && !$GLOBALS['TCA'][$table]['ctrl']['is_static']) {
94  $orderBy = $GLOBALS['TCA'][$table]['ctrl']['sortby'] ? 'ORDER BY ' . $GLOBALS['TCA'][$table]['ctrl']['sortby'] : $GLOBALS['TCA'][$table]['ctrl']['default_sortby'];
95  $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
96  '*',
97  $table,
98  'pid = ' . (int)$pid . BackendUtility::deleteClause($table),
99  '',
100  $GLOBALS['TYPO3_DB']->stripOrderBy($orderBy)
101  );
102  while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
103  $this->export->export_addRecord($table, $row);
104  }
105  }
106  }
107  }
108  }
109 
110 }
if(!defined('TYPO3_MODE')) $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_userauth.php']['logoff_pre_processing'][]
static deleteClause($table, $tableAlias='')