/** * @param string $workspaceName * @return void * @todo Pagination * @todo Tree filtering + level limit * @todo Search field * @todo Difference mechanism */ public function indexAction($workspaceName = NULL) { if (is_null($workspaceName)) { $workspaceName = $this->securityContext->getParty()->getPreferences()->get('context.workspace'); } $contentContext = new \TYPO3\TYPO3\Domain\Service\ContentContext($workspaceName); $contentContext->setInvisibleContentShown(TRUE); $contentContext->setRemovedContentShown(TRUE); $contentContext->setInaccessibleContentShown(TRUE); $this->nodeRepository->setContext($contentContext); $sites = array(); foreach ($this->workspacesService->getUnpublishedNodes($workspaceName) as $node) { if (!$node->getContentType()->isOfType('TYPO3.Phoenix.ContentTypes:Section')) { $pathParts = explode('/', $node->getPath()); if (count($pathParts) > 2) { $siteNodeName = $pathParts[2]; $folder = $this->findFolderNode($node); $folderPath = implode('/', array_slice(explode('/', $folder->getPath()), 3)); $relativePath = str_replace(sprintf('/sites/%s/%s', $siteNodeName, $folderPath), '', $node->getPath()); if (!isset($sites[$siteNodeName]['siteNode'])) { $sites[$siteNodeName]['siteNode'] = $this->siteRepository->findOneByNodeName($siteNodeName); } $sites[$siteNodeName]['folders'][$folderPath]['folderNode'] = $folder; $change = array('node' => $node); if ($node->getContentType()->isOfType('TYPO3.Phoenix.ContentTypes:AbstractNode')) { $change['configuration'] = $node->getContentType()->getConfiguration(); } $sites[$siteNodeName]['folders'][$folderPath]['changes'][$relativePath] = $change; } } } $liveWorkspace = $this->workspacesService->getWorkspace('live'); ksort($sites); foreach ($sites as $siteKey => $site) { foreach ($site['folders'] as $folderKey => $folder) { foreach ($folder['changes'] as $changeKey => $change) { $liveNode = $this->nodeRepository->findOneByIdentifier($change['node']->getIdentifier(), $liveWorkspace); $sites[$siteKey]['folders'][$folderKey]['changes'][$changeKey]['isNew'] = is_null($liveNode); $sites[$siteKey]['folders'][$folderKey]['changes'][$changeKey]['isMoved'] = $liveNode && $change['node']->getPath() !== $liveNode->getPath(); } } ksort($sites[$siteKey]['folders']); } $workspaces = array(); foreach ($this->workspacesService->getWorkspaces() as $workspace) { array_push($workspaces, array('workspaceNode' => $workspace, 'unpublishedNodesCount' => $this->workspacesService->getUnpublishedNodesCount($workspace->getName()))); } $this->view->assignMultiple(array('workspaceName' => $workspaceName, 'workspaces' => $workspaces, 'sites' => $sites)); }