/** * 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); }
/** * Initialization of all actions. * Check if the plugin is correctly configured and set the basic variables. * * @return void */ public function initializeAction() { $this->user = $GLOBALS['TSFE']->fe_user->user; if ($this->settings['startFolder'] != '') { $this->startFolder = $this->settings['startFolder']; } else { throw new Exception("The root folder was not configured. Please add it in plugin configuration."); } // Setting feUser Repository if ($this->settings['stockageGroupPid'] != '') { $querySettings = $this->feGroupRepository->createQuery()->getQuerySettings(); $querySettings->setStoragePageIds(array($this->settings['stockageGroupPid'])); $this->feGroupRepository->setDefaultQuerySettings($querySettings); } else { throw new Exception("The user folder was not configured. Please add it in plugin configuration."); } // Setting storage folder, return error if not set or not found. if ($this->settings['storage']) { $this->storageUid = $this->settings['storage']; } else { throw new Exception("The storage folder was not configured. Please add it in plugin configuration."); } $storageRepository = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Resource\\StorageRepository'); $this->storage = $storageRepository->findByUid($this->storageUid); if ($this->storage == null) { throw new Exception("Storage folder not found. Please check configuration"); } // Setting list of usergroups to send to form actions if ($this->settings['authorizedGroups']) { $this->authorizedGroups = $this->settings['authorizedGroups']; } // Setting list of categories to send to form actions if ($this->settings['authorizedCategories']) { $this->authorizedCategories = $this->settings['authorizedCategories']; } }