本文整理汇总了PHP中TYPO3\CMS\Core\Resource\Folder::getParentFolder方法的典型用法代码示例。如果您正苦于以下问题:PHP Folder::getParentFolder方法的具体用法?PHP Folder::getParentFolder怎么用?PHP Folder::getParentFolder使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TYPO3\CMS\Core\Resource\Folder
的用法示例。
在下文中一共展示了Folder::getParentFolder方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getLinkToParentFolder
/**
* If there is a parent folder and user has access to it, return an icon
* which is linked to the filelist of the parent folder.
*
* @param Folder $currentFolder
* @return string
*/
protected function getLinkToParentFolder(Folder $currentFolder)
{
$levelUp = '';
try {
$currentStorage = $currentFolder->getStorage();
$parentFolder = $currentFolder->getParentFolder();
if ($parentFolder->getIdentifier() !== $currentFolder->getIdentifier() && $currentStorage->isWithinFileMountBoundaries($parentFolder)) {
$levelUp = $this->linkWrapDir(IconUtility::getSpriteIcon('actions-view-go-up', array('title' => $this->getLanguageService()->sL('LLL:EXT:lang/locallang_core.php:labels.upOneLevel', TRUE))), $parentFolder);
}
} catch (\Exception $e) {
}
return $levelUp;
}
示例2: moveFolder
/**
* Moves a folder. If you want to move a folder from this storage to another
* one, call this method on the target storage, otherwise you will get an exception.
*
* @param Folder $folderToMove The folder to move.
* @param Folder $targetParentFolder The target parent folder
* @param string $newFolderName
* @param string $conflictMode a value of the DuplicationBehavior enumeration
*
* @throws \Exception|\TYPO3\CMS\Core\Exception
* @throws \InvalidArgumentException
* @throws InvalidTargetFolderException
* @return Folder
*/
public function moveFolder(Folder $folderToMove, Folder $targetParentFolder, $newFolderName = null, $conflictMode = DuplicationBehavior::RENAME)
{
// @todo add tests
$originalFolder = $folderToMove->getParentFolder();
$this->assureFolderMovePermissions($folderToMove, $targetParentFolder);
$sourceStorage = $folderToMove->getStorage();
$returnObject = null;
$sanitizedNewFolderName = $this->driver->sanitizeFileName($newFolderName ?: $folderToMove->getName());
// @todo check if folder already exists in $targetParentFolder, handle this conflict then
$this->emitPreFolderMoveSignal($folderToMove, $targetParentFolder, $sanitizedNewFolderName);
// Get all file objects now so we are able to update them after moving the folder
$fileObjects = $this->getAllFileObjectsInFolder($folderToMove);
if ($sourceStorage === $this) {
if ($this->isWithinFolder($folderToMove, $targetParentFolder)) {
throw new InvalidTargetFolderException(sprintf('Cannot move folder "%s" into target folder "%s", because the target folder is already within the folder to be moved!', $folderToMove->getName(), $targetParentFolder->getName()), 1422723050);
}
$fileMappings = $this->driver->moveFolderWithinStorage($folderToMove->getIdentifier(), $targetParentFolder->getIdentifier(), $sanitizedNewFolderName);
} else {
$fileMappings = $this->moveFolderBetweenStorages($folderToMove, $targetParentFolder, $sanitizedNewFolderName);
}
// Update the identifier and storage of all file objects
foreach ($fileObjects as $oldIdentifier => $fileObject) {
$newIdentifier = $fileMappings[$oldIdentifier];
$fileObject->updateProperties(array('storage' => $this->getUid(), 'identifier' => $newIdentifier));
$this->getIndexer()->updateIndexEntry($fileObject);
}
$returnObject = $this->getFolder($fileMappings[$folderToMove->getIdentifier()]);
$this->emitPostFolderMoveSignal($folderToMove, $targetParentFolder, $returnObject->getName(), $originalFolder);
return $returnObject;
}
示例3: getLinkToParentFolder
/**
* If there is a parent folder and user has access to it, return an icon
* which is linked to the filelist of the parent folder.
*
* @param Folder $currentFolder
* @return string
*/
protected function getLinkToParentFolder(Folder $currentFolder)
{
$levelUp = '';
try {
$currentStorage = $currentFolder->getStorage();
$parentFolder = $currentFolder->getParentFolder();
if ($parentFolder->getIdentifier() !== $currentFolder->getIdentifier() && $currentStorage->isWithinFileMountBoundaries($parentFolder)) {
$levelUp = $this->linkWrapDir('<span title="' . $this->getLanguageService()->sL('LLL:EXT:lang/locallang_core.php:labels.upOneLevel', true) . '">' . $this->iconFactory->getIcon('actions-view-go-up', Icon::SIZE_SMALL)->render() . '</span>', $parentFolder);
}
} catch (\Exception $e) {
}
return $levelUp;
}
示例4: moveFolder
/**
* Moves a folder. If you want to move a folder from this storage to another
* one, call this method on the target storage, otherwise you will get an exception.
*
* @param Folder $folderToMove The folder to move.
* @param Folder $targetParentFolder The target parent folder
* @param string $newFolderName
* @param string $conflictMode How to handle conflicts; one of "overrideExistingFile", "renameNewFolder", "cancel
*
* @throws \Exception|\TYPO3\CMS\Core\Exception
* @throws \InvalidArgumentException
* @return Folder
*/
public function moveFolder(Folder $folderToMove, Folder $targetParentFolder, $newFolderName = NULL, $conflictMode = 'renameNewFolder')
{
// TODO add tests
$originalFolder = $folderToMove->getParentFolder();
$this->assureFolderMovePermissions($folderToMove, $targetParentFolder);
$sourceStorage = $folderToMove->getStorage();
$returnObject = NULL;
$sanitizedNewFolderName = $this->driver->sanitizeFileName($newFolderName ?: $folderToMove->getName());
// TODO check if folder already exists in $targetParentFolder, handle this conflict then
$this->emitPreFolderMoveSignal($folderToMove, $targetParentFolder, $sanitizedNewFolderName);
// Get all file objects now so we are able to update them after moving the folder
$fileObjects = $this->getAllFileObjectsInFolder($folderToMove);
if ($sourceStorage === $this) {
$fileMappings = $this->driver->moveFolderWithinStorage($folderToMove->getIdentifier(), $targetParentFolder->getIdentifier(), $sanitizedNewFolderName);
} else {
$fileMappings = $this->moveFolderBetweenStorages($folderToMove, $targetParentFolder, $sanitizedNewFolderName);
}
// Update the identifier and storage of all file objects
foreach ($fileObjects as $oldIdentifier => $fileObject) {
$newIdentifier = $fileMappings[$oldIdentifier];
$fileObject->updateProperties(array('storage' => $this->getUid(), 'identifier' => $newIdentifier));
$this->getIndexer()->updateIndexEntry($fileObject);
}
$returnObject = $this->getFolder($fileMappings[$folderToMove->getIdentifier()]);
$this->emitPostFolderMoveSignal($folderToMove, $targetParentFolder, $returnObject->getName(), $originalFolder);
return $returnObject;
}
示例5: postFolderRename
/**
* Update folder permissions records when a folder is renamed
*
* @param Folder $folder
* @param string $newName
*/
public function postFolderRename(Folder $folder, $newName)
{
$newFolder = $folder->getParentFolder()->getSubfolder($newName);
$oldStorageUid = $folder->getStorage()->getUid();
$newStorageUid = $newFolder->getStorage()->getUid();
$this->utilityService->updateFolderRecord($oldStorageUid, $folder->getHashedIdentifier(), $folder->getIdentifier(), array('storage' => $newStorageUid, 'folder_hash' => $newFolder->getHashedIdentifier(), 'folder' => $newFolder->getIdentifier()));
if (!empty($this->folderMapping[$folder->getCombinedIdentifier()])) {
$newMapping = $this->getSubFolderIdentifiers($newFolder);
foreach ($this->folderMapping[$folder->getCombinedIdentifier()] as $key => $folderInfo) {
$this->utilityService->updateFolderRecord($oldStorageUid, $folderInfo[0], $folderInfo[1], array('storage' => $newStorageUid, 'folder_hash' => $newMapping[$key][0], 'folder' => $newMapping[$key][1]));
}
}
}
示例6: flushCacheForAffectedPages
/**
* Flush cache of pages containing gallery plugins with matching folders
*
* This is done two levels deep to take care of folders created inside a
* category.
*
* @param Folder $folder The folder
*
* @return void
*/
protected function flushCacheForAffectedPages(Folder $folder)
{
$evaluate = $folder->getStorage()->getEvaluatePermissions();
$folder->getStorage()->setEvaluatePermissions(false);
$this->flushCacheForPages($this->getAffectedPageIds($folder->getParentFolder()->getParentFolder()));
$folder->getStorage()->setEvaluatePermissions($evaluate);
}