/** * @param Tx_PtExtlist_Domain_Model_Bookmark_Bookmark $bookmark * @param Tx_PtExtlist_Domain_Configuration_ConfigurationBuilder $configurationBuilder * @param array $sessionData * @return void */ public function addContentToBookmark(Tx_PtExtlist_Domain_Model_Bookmark_Bookmark $bookmark, Tx_PtExtlist_Domain_Configuration_ConfigurationBuilder $configurationBuilder, array $sessionData) { $listIdentifier = $configurationBuilder->getListIdentifier(); $bookmarkContentArray = array(); if (array_key_exists($listIdentifier, $sessionData)) { if (array_key_exists('headerColumns', $sessionData[$listIdentifier])) { $bookmarkContentArray[$listIdentifier]['headerColumns'] = $sessionData[$listIdentifier]['headerColumns']; } if (array_key_exists('filters', $sessionData[$listIdentifier])) { $bookmarkContentArray[$listIdentifier]['filters'] = $sessionData[$listIdentifier]['filters']; } } $bookmark->setContent(serialize($bookmarkContentArray)); }
/** * @test */ public function getObjectNamespaceBuildsCorrectObjectNamespace() { $listId = 'hallo'; $uid = 3; $expected = 'hallo.bookmark.3'; $this->proxy->_set('listId', $listId); $this->proxy->_set('uid', $uid); $actual = $this->proxy->getObjectNamespace(); $this->assertEquals($expected, $actual); }
/** * @param Tx_PtExtlist_Domain_Model_Bookmark_Bookmark $bookmark */ public function storeBookmark(Tx_PtExtlist_Domain_Model_Bookmark_Bookmark $bookmark) { $bookmark->setPid($this->bookmarkConfiguration->getBookmarkPid()); $bookmark->setFeUser($this->feUser); $this->addContentToBookmark($bookmark); $this->bookmarkRepository->add($bookmark); }
/** * Creates a new bookmark and forwards to show action * * @param Tx_PtExtlist_Domain_Model_Bookmark_Bookmark $bookmark */ public function createAction(Tx_PtExtlist_Domain_Model_Bookmark_Bookmark $bookmark) { // Check whether user is allowed to create public bookmarks if ($this->request->hasArgument('isPublic') && $this->request->getArgument('isPublic') == '1') { if ($this->userIsAllowedToCreatePublicBookmarks()) { $bookmark->setIsPublic(true); } else { // TODO show some message, that user is not allowed to create public bookmarks $this->forward('show'); } } // Check, whether user is allowed to create group bookmarks if ($this->request->hasArgument('feGroup') && $this->request->getArgument('feGroup') > 0) { if ($this->userIsAllowedToCreateGroupBookmarks()) { $bookmark->setFeGroup($this->request->getArgument('feGroup')); } else { $this->forward('show'); } } $bookmark->setPid($this->settings['bookmarks']['bookmarksPid']); $this->bookmarkManager->addContentToBookmark($bookmark); $this->bookmarksRepository->add($bookmark); $this->persistenceManager->persistAll(); $this->forward('show'); }