/** * Return an Array of PIDs recursive to given PID * * @param int $pageUID * * @return array */ private function getRecursivePageUIDs($pageUID) { $depth = 999999; $rGetTreeList = $this->queryGenerator->getTreeList($pageUID, $depth, 0, 1); //Will be a string return explode(',', $rGetTreeList); }
/** * Returns a comma separated list of storagePid that are below a certain storage pid. * * @param string $storagePid Storage PID to start at; multiple PIDs possible as comma-separated list * @param int $recursionDepth Maximum number of levels to search, 0 to disable recursive lookup * @return string storage PIDs */ protected function getRecursiveStoragePids($storagePid, $recursionDepth = 0) { if ($recursionDepth <= 0) { return $storagePid; } $recursiveStoragePids = ''; $storagePids = \TYPO3\CMS\Core\Utility\GeneralUtility::intExplode(',', $storagePid); foreach ($storagePids as $startPid) { $pids = $this->queryGenerator->getTreeList($startPid, $recursionDepth, 0, 1); if ((string) $pids !== '') { $recursiveStoragePids .= $pids . ','; } } return rtrim($recursiveStoragePids, ','); }
/** * Collects tt_content data from a single page or a page tree starting at a given page * * @param string $shortcutItem : The single page to be used as the tree root * @param array $collectedItems : The collected item data rows ordered by parent position, column position and sorting * @param int $recursive : The number of levels for the recursion * @param string $showHidden : query String containing enable fields * @param string $deleteClause : query String to check for deleted items * @param int $parentUid : uid of the referencing tt_content record * * @return void */ public function collectContentDataFromPages($shortcutItem, &$collectedItems, $recursive = 0, &$showHidden, &$deleteClause, $parentUid) { $itemList = str_replace('pages_', '', $shortcutItem); if ($recursive) { if (!$this->tree instanceof QueryGenerator) { $this->tree = GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Database\\QueryGenerator'); } $itemList = $this->tree->getTreeList($itemList, (int) $recursive, 0, 1); } $itemRows = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows('*', 'tt_content', 'uid != ' . (int) $parentUid . ' AND pid IN (' . $itemList . ') AND colPos >= 0 ' . $showHidden . $deleteClause, '', 'FIND_IN_SET(pid, \'' . $itemList . '\'),colPos,sorting'); foreach ($itemRows as $itemRow) { if ($GLOBALS['BE_USER']->workspace > 0) { BackendUtility::workspaceOL('tt_content', $itemRow, $GLOBALS['BE_USER']->workspace); } $itemRow['tx_gridelements_reference_container'] = $itemRow['pid']; $collectedItems[] = $itemRow; } }