当前位置: 首页>>代码示例>>PHP>>正文


PHP IconUtility::mapFileExtensionToSpriteIconName方法代码示例

本文整理汇总了PHP中TYPO3\CMS\Backend\Utility\IconUtility::mapFileExtensionToSpriteIconName方法的典型用法代码示例。如果您正苦于以下问题:PHP IconUtility::mapFileExtensionToSpriteIconName方法的具体用法?PHP IconUtility::mapFileExtensionToSpriteIconName怎么用?PHP IconUtility::mapFileExtensionToSpriteIconName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在TYPO3\CMS\Backend\Utility\IconUtility的用法示例。


在下文中一共展示了IconUtility::mapFileExtensionToSpriteIconName方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: expandFolder

 /**
  * For RTE: This displays all files from folder. No thumbnails shown
  *
  * @param Folder $folder The folder path to expand
  * @param string $extensionList List of file extensions to show
  * @return string HTML output
  * @todo Define visibility
  */
 public function expandFolder(Folder $folder, $extensionList = '')
 {
     $out = '';
     $renderFolders = $this->act === 'folder';
     if ($folder->checkActionPermission('read')) {
         // Create header for file listing:
         $out .= $this->barheader($GLOBALS['LANG']->getLL('files') . ':');
         // Prepare current path value for comparison (showing red arrow)
         $currentIdentifier = '';
         if ($this->curUrlInfo['value']) {
             $currentIdentifier = $this->curUrlInfo['info'];
         }
         // Create header element; The folder from which files are listed.
         $titleLen = (int) $GLOBALS['BE_USER']->uc['titleLen'];
         $folderIcon = IconUtility::getSpriteIconForResource($folder);
         $folderIcon .= htmlspecialchars(GeneralUtility::fixed_lgd_cs($folder->getIdentifier(), $titleLen));
         $picon = '<a href="#" onclick="return link_folder(\'file:' . $folder->getCombinedIdentifier() . '\');">' . $folderIcon . '</a>';
         if ($this->curUrlInfo['act'] == 'folder' && $currentIdentifier == $folder->getCombinedIdentifier()) {
             $out .= '<img' . IconUtility::skinImg($GLOBALS['BACK_PATH'], 'gfx/blinkarrow_left.gif', 'width="5" height="9"') . ' class="c-blinkArrowL" alt="" />';
         }
         $out .= $picon . '<br />';
         // Get files from the folder:
         if ($renderFolders) {
             $items = $folder->getSubfolders();
         } else {
             $items = $this->getFilesInFolder($folder, $extensionList);
         }
         $c = 0;
         $totalItems = count($items);
         foreach ($items as $fileOrFolderObject) {
             $c++;
             if ($renderFolders) {
                 $fileIdentifier = $fileOrFolderObject->getCombinedIdentifier();
                 $overlays = array();
                 if ($fileOrFolderObject instanceof \TYPO3\CMS\Core\Resource\InaccessibleFolder) {
                     $overlays = array('status-overlay-locked' => array());
                 }
                 $icon = IconUtility::getSpriteIcon(IconUtility::mapFileExtensionToSpriteIconName('folder'), array('title' => $fileOrFolderObject->getName()), $overlays);
                 $itemUid = 'file:' . $fileIdentifier;
             } else {
                 $fileIdentifier = $fileOrFolderObject->getUid();
                 // File icon:
                 $fileExtension = $fileOrFolderObject->getExtension();
                 // Get size and icon:
                 $size = ' (' . GeneralUtility::formatSize($fileOrFolderObject->getSize()) . 'bytes)';
                 $icon = IconUtility::getSpriteIconForResource($fileOrFolderObject, array('title' => $fileOrFolderObject->getName() . $size));
                 $itemUid = 'file:' . $fileIdentifier;
             }
             // If the listed file turns out to be the CURRENT file, then show blinking arrow:
             if (($this->curUrlInfo['act'] == 'file' || $this->curUrlInfo['act'] == 'folder') && $currentIdentifier == $fileIdentifier) {
                 $arrCol = '<img' . IconUtility::skinImg($GLOBALS['BACK_PATH'], 'gfx/blinkarrow_left.gif', 'width="5" height="9"') . ' class="c-blinkArrowL" alt="" />';
             } else {
                 $arrCol = '';
             }
             // Put it all together for the file element:
             $out .= '<img' . IconUtility::skinImg($GLOBALS['BACK_PATH'], 'gfx/ol/join' . ($c == $totalItems ? 'bottom' : '') . '.gif', 'width="18" height="16"') . ' alt="" />' . $arrCol . '<a href="#" onclick="return link_folder(\'' . $itemUid . '\');">' . $icon . htmlspecialchars(GeneralUtility::fixed_lgd_cs($fileOrFolderObject->getName(), $titleLen)) . '</a><br />';
         }
     }
     return $out;
 }
开发者ID:allipierre,项目名称:Typo3,代码行数:68,代码来源:ElementBrowser.php


注:本文中的TYPO3\CMS\Backend\Utility\IconUtility::mapFileExtensionToSpriteIconName方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。