當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Folder::getParentFolder方法代碼示例

本文整理匯總了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;
 }
開發者ID:adrolli,項目名稱:TYPO3.CMS,代碼行數:20,代碼來源:FileList.php

示例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;
 }
開發者ID:TYPO3Incubator,項目名稱:TYPO3.CMS,代碼行數:44,代碼來源:ResourceStorage.php

示例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;
 }
開發者ID:rickymathew,項目名稱:TYPO3.CMS,代碼行數:20,代碼來源:FileList.php

示例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;
 }
開發者ID:samuweiss,項目名稱:TYPO3-Site,代碼行數:40,代碼來源:ResourceStorage.php

示例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]));
         }
     }
 }
開發者ID:camrun91,項目名稱:fal_securedownload,代碼行數:19,代碼來源:FolderChangedSlot.php

示例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);
 }
開發者ID:vertexvaar,項目名稱:fal_gallery,代碼行數:17,代碼來源:FolderMutationSlot.php


注:本文中的TYPO3\CMS\Core\Resource\Folder::getParentFolder方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。