/**
  * Adds records to the export object for a specific page id.
  *
  * @param int $pid Page id for which to select records to add
  * @param array $tables Array of table names to select from
  * @return void
  */
 protected function addRecordsForPid($pid, array $tables)
 {
     foreach ($GLOBALS['TCA'] as $table => $value) {
         if ($table != 'pages' && (in_array($table, $tables) || in_array('_ALL', $tables))) {
             if ($GLOBALS['BE_USER']->check('tables_select', $table) && !$GLOBALS['TCA'][$table]['ctrl']['is_static']) {
                 $orderBy = $GLOBALS['TCA'][$table]['ctrl']['sortby'] ? 'ORDER BY ' . $GLOBALS['TCA'][$table]['ctrl']['sortby'] : $GLOBALS['TCA'][$table]['ctrl']['default_sortby'];
                 $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('*', $table, 'pid = ' . (int) $pid . BackendUtility::deleteClause($table), '', $GLOBALS['TYPO3_DB']->stripOrderBy($orderBy));
                 while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
                     $this->export->export_addRecord($table, $row);
                 }
             }
         }
     }
 }
Ejemplo n.º 2
0
 /**
  * Adds records to the export object for a specific page id.
  *
  * @param int $k Page id for which to select records to add
  * @param array $tables Array of table names to select from
  * @param int $maxNumber Max amount of records to select
  * @return void
  */
 public function addRecordsForPid($k, $tables, $maxNumber)
 {
     if (!is_array($tables)) {
         return;
     }
     $db = $this->getDatabaseConnection();
     foreach ($GLOBALS['TCA'] as $table => $value) {
         if ($table != 'pages' && (in_array($table, $tables) || in_array('_ALL', $tables))) {
             if ($this->getBackendUser()->check('tables_select', $table) && !$GLOBALS['TCA'][$table]['ctrl']['is_static']) {
                 $res = $this->exec_listQueryPid($table, $k, MathUtility::forceIntegerInRange($maxNumber, 1));
                 while ($subTrow = $db->sql_fetch_assoc($res)) {
                     $this->export->export_addRecord($table, $subTrow);
                 }
                 $db->sql_free_result($res);
             }
         }
     }
 }