/** * Renders show action for bookmark controller * * @return string The rendered HTML source for this action */ public function showAction() { $this->view->assign('bookmarkConfig', $this->bookmarkConfiguration); $feGroupsQuery = $this->feUserGroupRepository->createQuery(); $feGroupsQuery->getQuerySettings()->setRespectStoragePage(FALSE); $feGroups = $feGroupsQuery->execute(); $this->view->assign('feGroups', $feGroups); $allBookmarks = new \TYPO3\CMS\Extbase\Persistence\ObjectStorage(); if ($this->bookmarkConfiguration->getShowPublicBookmarks()) { $publicBookmarks = $this->bookmarkRepository->findPublicBookmarksByListIdentifier($this->listIdentifier); $this->addObjectsToObjectStorageByArray($allBookmarks, $publicBookmarks); } if ($this->bookmarkConfiguration->getShowPrivateBookmarks() && $this->feUser != NULL) { $privateBookmarks = $this->bookmarkRepository->findPrivateBookmarksByFeUserAndListIdentifier($this->feUser, $this->listIdentifier); $this->addObjectsToObjectStorageByArray($allBookmarks, $privateBookmarks); } if ($this->bookmarkConfiguration->getShowGroupBookmarks() && $this->feUser != NULL && count($this->feUser->getUsergroup()) > 0) { $groupBookmarks = $this->bookmarkRepository->findGroupBookmarksByFeUserAndListIdentifier($this->feUser, $this->listIdentifier); $this->addObjectsToObjectStorageByArray($allBookmarks, $groupBookmarks); } $userLoggedIn = 0; if ($this->feUser != NULL) { $userLoggedIn = 1; } $this->view->assign('userLoggedIn', $userLoggedIn); $this->view->assign('bookmarks', $allBookmarks); }
/** * @return \TYPO3\CMS\Extbase\Persistence\ObjectStorage */ public function getBookmarksForCurrentConfigAndFeUser() { $allBookmarks = new \TYPO3\CMS\Extbase\Persistence\ObjectStorage(); if ($this->bookmarkConfiguration->getShowPrivateBookmarks() && $this->feUser != NULL) { $privateBookmarks = $this->bookmarkRepository->findPrivateBookmarksByFeUserAndListIdentifier($this->feUser, $this->listIdentifier); $this->addObjectsToObjectStorageByArray($allBookmarks, $privateBookmarks); } if ($this->bookmarkConfiguration->getShowGroupBookmarks() && $this->feUser != NULL && count($this->feUser->getUsergroup()) > 0) { $groupBookmarks = $this->bookmarkRepository->findGroupBookmarksByFeUserAndListIdentifier($this->feUser, $this->listIdentifier); $this->addObjectsToObjectStorageByArray($allBookmarks, $groupBookmarks); } if ($this->bookmarkConfiguration->getShowPublicBookmarks()) { $publicBookmarks = $this->bookmarkRepository->findPublicBookmarksByListIdentifier($this->listIdentifier); $this->addObjectsToObjectStorageByArray($allBookmarks, $publicBookmarks); } return $allBookmarks; }
/** * @test */ public function getShowGroupBookmarks() { $this->assertEquals(NULL, $this->bookmarkConfigToBeTested->getShowGroupBookmarks()); }