/** * 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'); }
/** * @return void */ protected function buildAndInitSessionPersistenceManager() { $this->buildSessionPersistenceManager(); $this->bookmarkManager = $this->bookmarkManagerFactory->getInstanceByConfigurationBuilder($this->configurationBuilder); $this->bookmarkManager->processRequest($this->request); $this->lifecycleManager->registerAndUpdateStateOnRegisteredObject($this->sessionPersistenceManager); //TODO: if session was restored from bookmark do not reset session // We reset session data, if we want to have a reset on empty submit if ($this->configurationBuilder->buildBaseConfiguration()->getResetOnEmptySubmit()) { $this->sessionPersistenceManager->resetSessionDataOnEmptyGpVars($this->getPostVarsAdapterFactory->getInstance()); } $this->resetOnEmptySubmit(); }
/** * @test */ public function injectConfigurationBuilderInjectsConfigurationBuilder() { $this->proxy->_injectConfigurationBuilder($this->configurationBuilderMock); $this->assertEquals($this->configurationBuilderMock, $this->proxy->_get('configurationBuilder')); }
/** * @param Tx_PtExtlist_Domain_Model_Bookmark_Bookmark $bookmark */ public function removeBookmark(Tx_PtExtlist_Domain_Model_Bookmark_Bookmark $bookmark) { $this->bookmarkManager->removeBookmark($bookmark); }