46 'getModConfigCache' =>
'Using $getModConfigCache of class PagePositionMap is discouraged. This property will be removed in TYPO3 v10.0.',
47 'modConfigStr' =>
'Using $$modConfigStr of class PagePositionMap is discouraged. This property will be removed in TYPO3 v10.0.',
148 $this->iconFactory = GeneralUtility::makeInstance(IconFactory::class);
169 $pageTree = GeneralUtility::makeInstance($this->pageTreeClassName);
170 $pageTree->init(
' AND ' . $perms_clause);
171 $pageTree->addField(
'pid');
176 $pageTree->getTree($pageinfo[
'pid'], $this->depth);
182 foreach ($pageTree->tree as $cc => $dat) {
183 if ($latestInvDepth > $dat[
'invertedDepth']) {
184 $margin =
'style="margin-left: ' . ($dat[
'invertedDepth'] * 16 + 9) .
'px;"';
185 $lines[] =
'<ul class="list-tree" ' . $margin .
'>';
188 $latestInvDepth = $dat[
'invertedDepth'];
189 $saveLatestUid[$latestInvDepth] = $dat;
190 if (isset($pageTree->tree[$cc - 1])) {
191 $prev_dat = $pageTree->tree[$cc - 1];
193 if ($prev_dat[
'row'][
'uid'] == $id) {
195 if (!$this->dontPrintPageInsertIcons && $this->
checkNewPageInPid($id) && !($prev_dat[
'invertedDepth'] > $pageTree->tree[$cc][
'invertedDepth'])) {
197 $margin =
'style="margin-left: ' . (($dat[
'invertedDepth'] - 1) * 16 + 9) .
'px;"';
198 $lines[] =
'<ul class="list-tree" ' . $margin .
'><li><span class="text-nowrap"><a href="#" onclick="' . htmlspecialchars($this->
onClickEvent($id, $id)) .
'"><i class="t3-icon fa fa-long-arrow-left" title="' . $this->
insertlabel() .
'"></i></a></span></li></ul>';
202 if ($prev_dat[
'invertedDepth'] > $pageTree->tree[$cc][
'invertedDepth']) {
203 $prevPid = $pageTree->tree[$cc][
'row'][
'pid'];
204 } elseif ($prev_dat[
'invertedDepth'] < $pageTree->tree[$cc][
'invertedDepth']) {
207 if (!$this->dontPrintPageInsertIcons && $this->
checkNewPageInPid($prev_dat[
'row'][
'pid'])) {
208 $prevPid = -$prev_dat[
'row'][
'uid'];
210 $lines[] =
'<li><span class="text-nowrap"><a href="#" onclick="' . htmlspecialchars($this->
onClickEvent($prevPid, $prev_dat[
'row'][
'pid'])) .
'"><i class="t3-icon fa fa-long-arrow-left" title="' . $this->
insertlabel() .
'"></i></a></span></li>';
213 $prevPid = -$prev_dat[
'row'][
'pid'];
214 if ($prevPid !== $dat[
'row'][
'pid']) {
219 $prevPid = -$prev_dat[
'row'][
'uid'];
223 $prevPid = $dat[
'row'][
'pid'];
226 if (!$this->dontPrintPageInsertIcons && $this->
checkNewPageInPid($dat[
'row'][
'pid'])) {
227 $lines[] =
'<span class="text-nowrap"><a href="#" onclick="' . htmlspecialchars($this->
onClickEvent($prevPid, $dat[
'row'][
'pid'])) .
'"><i class="t3-icon fa fa-long-arrow-left" title="' . $this->
insertlabel() .
'"></i></a></span>';
231 $icon =
'<span ' . $toolTip .
'>' . $this->iconFactory->getIconForRecord(
'pages', $dat[
'row'],
Icon::SIZE_SMALL)->render() .
'</span>';
233 $lines[] =
'<span class="text-nowrap">' . $icon . $this->
linkPageTitle($this->
boldTitle(htmlspecialchars(GeneralUtility::fixed_lgd_cs($dat[
'row'][
'title'], $this->
getBackendUser()->uc[
'titleLen'])), $dat, $id), $dat[
'row']) .
'</span>';
236 $prev_dat = end($pageTree->tree);
237 if ($prev_dat[
'row'][
'uid'] == $id) {
239 $lines[] =
'<ul class="list-tree" style="margin-left: 25px"><li><span class="text-nowrap"><a href="#" onclick="' . htmlspecialchars($this->
onClickEvent($id, $id)) .
'"><i class="t3-icon fa fa-long-arrow-left" title="' . $this->
insertlabel() .
'"></i></a></span></li></ul>';
243 $dat = $saveLatestUid[$a];
244 $prevPid = -$dat[
'row'][
'uid'];
245 if (!$this->dontPrintPageInsertIcons && $this->
checkNewPageInPid($dat[
'row'][
'pid'])) {
246 if ($latestInvDepth < $dat[
'invertedDepth']) {
249 $lines[] =
'<span class="text-nowrap"><a href="#" onclick="' . htmlspecialchars($this->
onClickEvent($prevPid, $dat[
'row'][
'pid'])) .
'"><i class="t3-icon fa fa-long-arrow-left" title="' . $this->
insertlabel() .
'"></i></a></span>';
253 $code =
'<ul class="list-tree">';
255 foreach ($lines as $line) {
256 if ((strpos($line,
'<ul') === 0) || (strpos($line,
'</ul') === 0)) {
259 $code .=
'<li>' . $line .
'</li>';
275 public function boldTitle($t_code, $dat, $id)
277 if ($dat[
'row'][
'uid'] == $id) {
278 $t_code =
'<strong>' . $t_code .
'</strong>';
296 if (isset($TSconfig[
'override']) && !empty($TSconfig[
'override'])) {
297 $uriBuilder = GeneralUtility::makeInstance(UriBuilder::class);
298 $url = $uriBuilder->buildUriFromRoute(
299 $TSconfig[
'override'],
301 'positionPid' => $pid,
302 'newPageId' => $newPagePID,
304 'returnUrl' => GeneralUtility::getIndpEnv(
'REQUEST_URI')
307 return $this->clientContext .
'.location.href=' . GeneralUtility::quoteJSvalue((
string)$url) .
';';
309 $params =
'&edit[pages][' . $pid .
']=new&returnNewPageId=1';
344 if (!isset($this->checkNewPageCache[$pid])) {
348 return $this->checkNewPageCache[$pid];
361 trigger_error(
'PagePositionMap->getModConfig() will be removed in TYPO3 v10.0.', E_USER_DEPRECATED);
362 if (!isset($this->getModConfigCache[$pid])) {
366 return $this->getModConfigCache[$pid][
'properties'];
388 $colPosArray = GeneralUtility::trimExplode(
',', $colPosList,
true);
390 foreach ($colPosArray as $kk => $vv) {
391 $queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class)->getQueryBuilderForTable(
'tt_content');
392 $queryBuilder->getRestrictions()->add(GeneralUtility::makeInstance(BackendWorkspaceRestriction::class));
394 $queryBuilder->getRestrictions()
395 ->removeByType(HiddenRestriction::class)
396 ->removeByType(StartTimeRestriction::class)
397 ->removeByType(EndTimeRestriction::class);
403 $queryBuilder->expr()->eq(
'pid', $queryBuilder->createNamedParameter($pid, \PDO::PARAM_INT)),
404 $queryBuilder->expr()->eq(
'colPos', $queryBuilder->createNamedParameter($vv, \PDO::PARAM_INT))
406 ->orderBy(
'sorting');
408 if ((
string)$this->cur_sys_language !==
'') {
409 $queryBuilder->andWhere(
410 $queryBuilder->expr()->eq(
412 $queryBuilder->createNamedParameter($this->cur_sys_language, \PDO::PARAM_INT)
417 $res = $queryBuilder->execute();
421 while ($row = $res->fetch()) {
423 if (is_array($row)) {
443 $backendLayout = GeneralUtility::callUserFunction(\
TYPO3\CMS\Backend\View\BackendLayoutView::class .
'->getSelectedBackendLayout', $pid, $this);
444 if (isset($backendLayout[
'__config'][
'backend_layout.'])) {
446 $table =
'<div class="table-fit"><table class="table table-condensed table-bordered table-vertical-top">';
447 $colCount = (int)$backendLayout[
'__config'][
'backend_layout.'][
'colCount'];
448 $rowCount = (int)$backendLayout[
'__config'][
'backend_layout.'][
'rowCount'];
449 $table .=
'<colgroup>';
450 for ($i = 0; $i < $colCount; $i++) {
451 $table .=
'<col style="width:' . 100 / $colCount .
'%"></col>';
453 $table .=
'</colgroup>';
455 $tcaItems = GeneralUtility::callUserFunction(\
TYPO3\CMS\Backend\View\BackendLayoutView::class .
'->getColPosListItemsParsed', $pid, $this);
457 for ($row = 1; $row <= $rowCount; $row++) {
458 $rowConfig = $backendLayout[
'__config'][
'backend_layout.'][
'rows.'][$row .
'.'];
459 if (!isset($rowConfig)) {
463 for ($col = 1; $col <= $colCount; $col++) {
464 $columnConfig = $rowConfig[
'columns.'][$col .
'.'];
465 if (!isset($columnConfig)) {
469 $columnKey = (int)$columnConfig[
'colPos'];
471 foreach ($tcaItems as $item) {
472 if ($item[1] == $columnKey) {
478 . (isset($columnConfig[
'colspan']) ?
' colspan="' . $columnConfig[
'colspan'] .
'"' :
'')
479 . (isset($columnConfig[
'rowspan']) ?
' rowspan="' . $columnConfig[
'rowspan'] .
'"' :
'')
480 .
' class="col-nowrap col-min'
481 . (!isset($columnConfig[
'colPos']) ?
' warning' :
'')
482 . (isset($columnConfig[
'colPos']) && !$head ?
' danger' :
'') .
'">';
485 if (isset($columnConfig[
'colPos']) && $head) {
487 } elseif ($columnConfig[
'colPos']) {
494 if (isset($columnConfig[
'colPos']) && $head && !empty($lines[$columnKey])) {
495 $table .=
'<ul class="list-unstyled">';
496 foreach ($lines[$columnKey] as $line) {
497 $table .=
'<li>' . $line .
'</li>';
505 $table .=
'</tbody>';
506 $table .=
'</table></div>';
510 foreach ($colPosArray as $kk => $vv) {
511 $row .=
'<td class="col-nowrap col-min" width="' . round(100 / $count) .
'%">';
513 if (!empty($lines[$vv])) {
514 $row .=
'<ul class="list-unstyled">';
515 foreach ($lines[$vv] as $line) {
516 $row .=
'<li>' . $line .
'</li>';
525 Map of records in columns:
527 <div class="table-fit">
528 <table class="table table-condensed table-bordered table-vertical-top">
529 <tr>' . $row .
'</tr>
564 if (is_array($row) && !empty($row[
'uid'])) {
571 $cc = hexdec(substr(md5($uid .
'-' . $vv .
'-' . $kk), 0, 4));
572 return '<a href="#" onclick="' . htmlspecialchars($this->
onClickInsertRecord($row, $vv,
$moveUid, $pid, $this->cur_sys_language)) .
'" data-dismiss="modal">' .
'<i class="t3-icon fa fa-long-arrow-left" name="mImgEnd' . $cc .
'" title="' . htmlspecialchars($this->
getLanguageService()->getLL($this->l_insertNewRecordHere)) .
'"></i></a>';
588 $uriBuilder = GeneralUtility::makeInstance(UriBuilder::class);
589 if (is_array($row)) {
590 $location = $uriBuilder->buildUriFromRoute(
'tce_db', [
591 'cmd[tt_content][' .
$moveUid .
'][' . $this->moveOrCopy .
']' =>
'-' . $row[
'uid'],
592 'redirect' => $this->R_URI,
595 $location = $uriBuilder->buildUriFromRoute(
'tce_db', [
596 'cmd[tt_content][' .
$moveUid .
'][' . $this->moveOrCopy .
']' => $pid,
598 'redirect' => $this->R_URI,
602 return $this->clientContext .
'.location.href=' . GeneralUtility::quoteJSvalue((
string)$location) .
';return false;';
625 $iconFactory = GeneralUtility::makeInstance(IconFactory::class);
641 return '<a href="' . htmlspecialchars(GeneralUtility::linkThisScript([
'uid' => (
int)$row[
'uid'],
'moveUid' =>
''])) .
'">' . $str .
'</a>';