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


PHP IconFactory::getIconForResource方法代码示例

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


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

示例1: getFolderTree

 /**
  * Fetches the data for the tree
  *
  * @param \TYPO3\CMS\Core\Resource\Folder $folderObject the folderobject
  * @param int $depth Max depth (recursivity limit)
  * @param string $type HTML-code prefix for recursive calls.
  * @return int The count of items on the level
  * @see getBrowsableTree()
  */
 public function getFolderTree(\TYPO3\CMS\Core\Resource\Folder $folderObject, $depth = 999, $type = '')
 {
     $depth = (int) $depth;
     // This generates the directory tree
     /* array of \TYPO3\CMS\Core\Resource\Folder */
     if ($folderObject instanceof InaccessibleFolder) {
         $subFolders = array();
     } else {
         $subFolders = $folderObject->getSubfolders();
         $subFolders = \TYPO3\CMS\Core\Resource\Utility\ListUtility::resolveSpecialFolderNames($subFolders);
         uksort($subFolders, 'strnatcasecmp');
     }
     $totalSubFolders = count($subFolders);
     $HTML = '';
     $subFolderCounter = 0;
     $treeKey = '';
     /** @var Folder $subFolder */
     foreach ($subFolders as $subFolderName => $subFolder) {
         $subFolderCounter++;
         // Reserve space.
         $this->tree[] = array();
         // Get the key for this space
         end($this->tree);
         $isLocked = $subFolder instanceof InaccessibleFolder;
         $treeKey = key($this->tree);
         $specUID = GeneralUtility::md5int($subFolder->getCombinedIdentifier());
         $this->specUIDmap[$specUID] = $subFolder->getCombinedIdentifier();
         $row = array('uid' => $specUID, 'path' => $subFolder->getCombinedIdentifier(), 'title' => $subFolderName, 'folder' => $subFolder);
         // Make a recursive call to the next level
         if (!$isLocked && $depth > 1 && $this->expandNext($specUID)) {
             $nextCount = $this->getFolderTree($subFolder, $depth - 1, $type);
             // Set "did expand" flag
             $isOpen = 1;
         } else {
             $nextCount = $isLocked ? 0 : $this->getNumberOfSubfolders($subFolder);
             // Clear "did expand" flag
             $isOpen = 0;
         }
         // Set HTML-icons, if any:
         if ($this->makeHTML) {
             $HTML = $this->PMicon($subFolder, $subFolderCounter, $totalSubFolders, $nextCount, $isOpen);
             $type = '';
             $role = $subFolder->getRole();
             if ($role !== FolderInterface::ROLE_DEFAULT) {
                 $row['_title'] = '<strong>' . $subFolderName . '</strong>';
             }
             $icon = '<span title="' . htmlspecialchars($subFolderName) . '">' . $this->iconFactory->getIconForResource($subFolder, Icon::SIZE_SMALL, null, array('folder-open' => (bool) $isOpen)) . '</span>';
             $HTML .= $this->wrapIcon($icon, $subFolder);
         }
         // Finally, add the row/HTML content to the ->tree array in the reserved key.
         $this->tree[$treeKey] = array('row' => $row, 'HTML' => $HTML, 'hasSub' => $nextCount && $this->expandNext($specUID), 'isFirst' => $subFolderCounter == 1, 'isLast' => false, 'invertedDepth' => $depth, 'bank' => $this->bank);
     }
     if ($subFolderCounter > 0) {
         $this->tree[$treeKey]['isLast'] = true;
     }
     return $totalSubFolders;
 }
开发者ID:Gregpl,项目名称:TYPO3.CMS,代码行数:66,代码来源:FolderTreeView.php

示例2: renderFilesInFolder

    /**
     * For TYPO3 Element Browser: Expand folder of files.
     *
     * @param Folder $folder The folder path to expand
     * @param array $extensionList List of fileextensions to show
     * @param bool $noThumbs Whether to show thumbnails or not. If set, no thumbnails are shown.
     * @return string HTML output
     */
    public function renderFilesInFolder(Folder $folder, array $extensionList = [], $noThumbs = false)
    {
        if (!$folder->checkActionPermission('read')) {
            return '';
        }
        $lang = $this->getLanguageService();
        $titleLen = (int) $this->getBackendUser()->uc['titleLen'];
        if ($this->searchWord !== '') {
            $files = $this->fileRepository->searchByName($folder, $this->searchWord);
        } else {
            $extensionList = !empty($extensionList) && $extensionList[0] === '*' ? [] : $extensionList;
            $files = $this->getFilesInFolder($folder, $extensionList);
        }
        $filesCount = count($files);
        $lines = array();
        // Create the header of current folder:
        $folderIcon = $this->iconFactory->getIconForResource($folder, Icon::SIZE_SMALL);
        $lines[] = '
			<tr>
				<th class="col-title" nowrap="nowrap">' . $folderIcon . ' ' . htmlspecialchars(GeneralUtility::fixed_lgd_cs($folder->getIdentifier(), $titleLen)) . '</th>
				<th class="col-control" nowrap="nowrap"></th>
				<th class="col-clipboard" nowrap="nowrap">
					<a href="#" class="btn btn-default" id="t3js-importSelection" title="' . $lang->getLL('importSelection', true) . '">' . $this->iconFactory->getIcon('actions-document-import-t3d', Icon::SIZE_SMALL) . '</a>
					<a href="#" class="btn btn-default" id="t3js-toggleSelection" title="' . $lang->getLL('toggleSelection', true) . '">' . $this->iconFactory->getIcon('actions-document-select', Icon::SIZE_SMALL) . '</a>
				</th>
				<th nowrap="nowrap">&nbsp;</th>
			</tr>';
        if ($filesCount === 0) {
            $lines[] = '
				<tr>
					<td colspan="4">No files found.</td>
				</tr>';
        }
        foreach ($files as $fileObject) {
            $fileExtension = $fileObject->getExtension();
            // Thumbnail/size generation:
            $imgInfo = array();
            if (!$noThumbs && GeneralUtility::inList(strtolower($GLOBALS['TYPO3_CONF_VARS']['GFX']['imagefile_ext'] . ',' . $GLOBALS['TYPO3_CONF_VARS']['SYS']['mediafile_ext']), strtolower($fileExtension))) {
                $processedFile = $fileObject->process(ProcessedFile::CONTEXT_IMAGEPREVIEW, array('width' => 64, 'height' => 64));
                $imageUrl = $processedFile->getPublicUrl(true);
                $imgInfo = array($fileObject->getProperty('width'), $fileObject->getProperty('height'));
                $pDim = $imgInfo[0] . 'x' . $imgInfo[1] . ' pixels';
                $clickIcon = '<img src="' . $imageUrl . '"' . ' width="' . $processedFile->getProperty('width') . '"' . ' height="' . $processedFile->getProperty('height') . '"' . ' hspace="5" vspace="5" border="1" />';
            } else {
                $clickIcon = '';
                $pDim = '';
            }
            // Create file icon:
            $size = ' (' . GeneralUtility::formatSize($fileObject->getSize()) . 'bytes' . ($pDim ? ', ' . $pDim : '') . ')';
            $icon = '<span title="' . htmlspecialchars($fileObject->getName() . $size) . '">' . $this->iconFactory->getIconForResource($fileObject, Icon::SIZE_SMALL) . '</span>';
            // Create links for adding the file:
            $filesIndex = count($this->elements);
            $this->elements['file_' . $filesIndex] = array('type' => 'file', 'table' => 'sys_file', 'uid' => $fileObject->getUid(), 'fileName' => $fileObject->getName(), 'filePath' => $fileObject->getUid(), 'fileExt' => $fileExtension, 'fileIcon' => $icon);
            if ($this->fileIsSelectableInFileList($fileObject, $imgInfo)) {
                $ATag = '<a href="#" class="btn btn-default" title="' . htmlspecialchars($fileObject->getName()) . '" data-file-index="' . htmlspecialchars($filesIndex) . '" data-close="0">';
                $ATag_alt = '<a href="#" title="' . htmlspecialchars($fileObject->getName()) . '" data-file-index="' . htmlspecialchars($filesIndex) . '" data-close="1">';
                $ATag_e = '</a>';
                $bulkCheckBox = '<label class="btn btn-default btn-checkbox"><input type="checkbox" class="typo3-bulk-item" name="file_' . $filesIndex . '" value="0" /><span class="t3-icon fa"></span></label>';
            } else {
                $ATag = '';
                $ATag_alt = '';
                $ATag_e = '';
                $bulkCheckBox = '';
            }
            // Create link to showing details about the file in a window:
            $Ahref = BackendUtility::getModuleUrl('show_item', array('type' => 'file', 'table' => '_FILE', 'uid' => $fileObject->getCombinedIdentifier(), 'returnUrl' => GeneralUtility::getIndpEnv('REQUEST_URI')));
            // Combine the stuff:
            $filenameAndIcon = $ATag_alt . $icon . htmlspecialchars(GeneralUtility::fixed_lgd_cs($fileObject->getName(), $titleLen)) . $ATag_e;
            // Show element:
            $lines[] = '
					<tr class="file_list_normal">
						<td class="col-title" nowrap="nowrap">' . $filenameAndIcon . '&nbsp;</td>
						<td class="col-control">
							<div class="btn-group">' . $ATag . '<span title="' . $lang->getLL('addToList', true) . '">' . $this->iconFactory->getIcon('actions-edit-add', Icon::SIZE_SMALL)->render() . '</span>' . $ATag_e . '
							<a href="' . htmlspecialchars($Ahref) . '" class="btn btn-default" title="' . $lang->getLL('info', true) . '">' . $this->iconFactory->getIcon('actions-document-info', Icon::SIZE_SMALL) . '</a>
						</td>
						<td class="col-clipboard" valign="top">' . $bulkCheckBox . '</td>
						<td nowrap="nowrap">&nbsp;' . $pDim . '</td>
					</tr>';
            if ($pDim) {
                $lines[] = '
					<tr>
						<td class="filelistThumbnail" colspan="4">' . $ATag_alt . $clickIcon . $ATag_e . '</td>
					</tr>';
            }
        }
        $out = '<h3>' . $lang->getLL('files', true) . ' ' . $filesCount . ':</h3>';
        $out .= GeneralUtility::makeInstance(FolderUtilityRenderer::class, $this)->getFileSearchField($this->searchWord);
        $out .= '<div id="filelist">';
        $out .= $this->getBulkSelector($filesCount);
        // Wrap all the rows in table tags:
        $out .= '
//.........这里部分代码省略.........
开发者ID:dachcom-digital,项目名称:TYPO3.CMS,代码行数:101,代码来源:AddImageHandler.php

示例3: formatFileList

 /**
  * This returns tablerows for the files in the array $items['sorting'].
  *
  * @param File[] $files File items
  * @return string HTML table rows.
  */
 public function formatFileList(array $files)
 {
     $out = '';
     // first two keys are "0" (default) and "-1" (multiple), after that comes the "other languages"
     $allSystemLanguages = GeneralUtility::makeInstance(TranslationConfigurationProvider::class)->getSystemLanguages();
     $systemLanguages = array_filter($allSystemLanguages, function ($languageRecord) {
         if ($languageRecord['uid'] === -1 || $languageRecord['uid'] === 0 || !$this->getBackendUser()->checkLanguageAccess($languageRecord['uid'])) {
             return false;
         } else {
             return true;
         }
     });
     foreach ($files as $fileObject) {
         // Initialization
         $this->counter++;
         $this->totalbytes += $fileObject->getSize();
         $ext = $fileObject->getExtension();
         $fileName = trim($fileObject->getName());
         // The icon with link
         $theIcon = '<span title="' . htmlspecialchars($fileName . ' [' . (int) $fileObject->getUid() . ']') . '">' . $this->iconFactory->getIconForResource($fileObject, Icon::SIZE_SMALL)->render() . '</span>';
         if ($this->clickMenus) {
             $theIcon = BackendUtility::wrapClickMenuOnIcon($theIcon, $fileObject->getCombinedIdentifier());
         }
         // Preparing and getting the data-array
         $theData = array();
         foreach ($this->fieldArray as $field) {
             switch ($field) {
                 case 'size':
                     $theData[$field] = GeneralUtility::formatSize($fileObject->getSize(), $this->getLanguageService()->getLL('byteSizeUnits', true));
                     break;
                 case 'rw':
                     $theData[$field] = '' . (!$fileObject->checkActionPermission('read') ? ' ' : '<strong class="text-danger">' . $this->getLanguageService()->getLL('read', true) . '</strong>') . (!$fileObject->checkActionPermission('write') ? '' : '<strong class="text-danger">' . $this->getLanguageService()->getLL('write', true) . '</strong>');
                     break;
                 case 'fileext':
                     $theData[$field] = strtoupper($ext);
                     break;
                 case 'tstamp':
                     $theData[$field] = BackendUtility::date($fileObject->getModificationTime());
                     break;
                 case '_CONTROL_':
                     $theData[$field] = $this->makeEdit($fileObject);
                     break;
                 case '_CLIPBOARD_':
                     $theData[$field] = $this->makeClip($fileObject);
                     break;
                 case '_LOCALIZATION_':
                     if (!empty($systemLanguages) && $fileObject->isIndexed() && $fileObject->checkActionPermission('write') && $this->getBackendUser()->check('tables_modify', 'sys_file_metadata')) {
                         $metaDataRecord = $fileObject->_getMetaData();
                         $translations = $this->getTranslationsForMetaData($metaDataRecord);
                         $languageCode = '';
                         foreach ($systemLanguages as $language) {
                             $languageId = $language['uid'];
                             $flagIcon = $language['flagIcon'];
                             if (array_key_exists($languageId, $translations)) {
                                 $title = htmlspecialchars(sprintf($this->getLanguageService()->getLL('editMetadataForLanguage'), $language['title']));
                                 // @todo the overlay for the flag needs to be added ($flagIcon . '-overlay')
                                 $urlParameters = ['edit' => ['sys_file_metadata' => [$translations[$languageId]['uid'] => 'edit']], 'returnUrl' => $this->listURL()];
                                 $flagButtonIcon = $this->iconFactory->getIcon($flagIcon, Icon::SIZE_SMALL, 'overlay-edit')->render();
                                 $url = BackendUtility::getModuleUrl('record_edit', $urlParameters);
                                 $languageCode .= '<a href="' . htmlspecialchars($url) . '" class="btn btn-default" title="' . $title . '">' . $flagButtonIcon . '</a>';
                             } else {
                                 $parameters = ['justLocalized' => 'sys_file_metadata:' . $metaDataRecord['uid'] . ':' . $languageId, 'returnUrl' => $this->listURL()];
                                 $returnUrl = BackendUtility::getModuleUrl('record_edit', $parameters);
                                 $href = BackendUtility::getLinkToDataHandlerAction('&cmd[sys_file_metadata][' . $metaDataRecord['uid'] . '][localize]=' . $languageId, $returnUrl);
                                 $flagButtonIcon = '<span title="' . htmlspecialchars(sprintf($this->getLanguageService()->getLL('createMetadataForLanguage'), $language['title'])) . '">' . $this->iconFactory->getIcon($flagIcon, Icon::SIZE_SMALL, 'overlay-new')->render() . '</span>';
                                 $languageCode .= '<a href="' . htmlspecialchars($href) . '" class="btn btn-default">' . $flagButtonIcon . '</a> ';
                             }
                         }
                         // Hide flag button bar when not translated yet
                         $theData[$field] = ' <div class="localisationData btn-group" data-fileid="' . $fileObject->getUid() . '"' . (empty($translations) ? ' style="display: none;"' : '') . '>' . $languageCode . '</div>';
                         $theData[$field] .= '<a class="btn btn-default filelist-translationToggler" data-fileid="' . $fileObject->getUid() . '">' . '<span title="' . $this->getLanguageService()->getLL('translateMetadata', true) . '">' . $this->iconFactory->getIcon('mimetypes-x-content-page-language-overlay', Icon::SIZE_SMALL)->render() . '</span>' . '</a>';
                     }
                     break;
                 case '_REF_':
                     $theData[$field] = $this->makeRef($fileObject);
                     break;
                 case 'file':
                     // Edit metadata of file
                     $theData[$field] = $this->linkWrapFile(htmlspecialchars($fileName), $fileObject);
                     if ($fileObject->isMissing()) {
                         $flashMessage = \TYPO3\CMS\Core\Resource\Utility\BackendUtility::getFlashMessageForMissingFile($fileObject);
                         $theData[$field] .= $flashMessage->render();
                         // Thumbnails?
                     } elseif ($this->thumbs && ($this->isImage($ext) || $this->isMediaFile($ext))) {
                         $processedFile = $fileObject->process(ProcessedFile::CONTEXT_IMAGEPREVIEW, array());
                         if ($processedFile) {
                             $thumbUrl = $processedFile->getPublicUrl(true);
                             $theData[$field] .= '<br /><img src="' . $thumbUrl . '" ' . 'width="' . $processedFile->getProperty('width') . '" ' . 'height="' . $processedFile->getProperty('height') . '" ' . 'title="' . htmlspecialchars($fileName) . '" alt="" />';
                         }
                     }
                     break;
                 default:
                     $theData[$field] = '';
                     if ($fileObject->hasProperty($field)) {
//.........这里部分代码省略.........
开发者ID:rickymathew,项目名称:TYPO3.CMS,代码行数:101,代码来源:FileList.php

示例4: getResourceHeader

 /**
  * Like ->getHeader() but for files and folders
  * Returns the icon with the path of the file/folder set in the alt/title attribute. Shows the name after the icon.
  *
  * @param \TYPO3\CMS\Core\Resource\ResourceInterface $resource
  * @param array $tWrap is an array with indexes 0 and 1 each representing HTML-tags (start/end) which will wrap the title
  * @param bool $enableClickMenu If TRUE, render click menu code around icon image
  * @return string
  */
 public function getResourceHeader(\TYPO3\CMS\Core\Resource\ResourceInterface $resource, $tWrap = array('', ''), $enableClickMenu = true)
 {
     try {
         $path = $resource->getStorage()->getName() . $resource->getParentFolder()->getIdentifier();
         $iconImgTag = '<span title="' . htmlspecialchars($path) . '">' . $this->iconFactory->getIconForResource($resource, Icon::SIZE_SMALL)->render() . '</span>';
     } catch (\TYPO3\CMS\Core\Resource\Exception\ResourceDoesNotExistException $e) {
         $iconImgTag = '';
     }
     if ($enableClickMenu && $resource instanceof \TYPO3\CMS\Core\Resource\File) {
         $metaData = $resource->_getMetaData();
         $iconImgTag = BackendUtility::wrapClickMenuOnIcon($iconImgTag, 'sys_file_metadata', $metaData['uid']);
     }
     return '<span class="typo3-moduleHeader">' . $iconImgTag . $tWrap[0] . htmlspecialchars(GeneralUtility::fixed_lgd_cs($resource->getName(), 45)) . $tWrap[1] . '</span>';
 }
开发者ID:burguin,项目名称:test01,代码行数:23,代码来源:DocumentTemplate.php

示例5: printContentFromTab

    /**
     * Print the content on a pad. Called from ->printClipboard()
     *
     * @access private
     * @param string $pad Pad reference
     * @return array Array with table rows for the clipboard.
     */
    public function printContentFromTab($pad)
    {
        $lines = array();
        if (is_array($this->clipData[$pad]['el'])) {
            foreach ($this->clipData[$pad]['el'] as $k => $v) {
                if ($v) {
                    list($table, $uid) = explode('|', $k);
                    $bgColClass = $table == '_FILE' && $this->fileMode || $table != '_FILE' && !$this->fileMode ? 'bgColor4-20' : 'bgColor4';
                    // Rendering files/directories on the clipboard
                    if ($table == '_FILE') {
                        $fileObject = ResourceFactory::getInstance()->retrieveFileOrFolderObject($v);
                        if ($fileObject) {
                            $thumb = '';
                            $folder = $fileObject instanceof \TYPO3\CMS\Core\Resource\Folder;
                            $size = $folder ? '' : '(' . GeneralUtility::formatSize($fileObject->getSize()) . 'bytes)';
                            $icon = '<span title="' . htmlspecialchars($fileObject->getName() . ' ' . $size) . '">' . $this->iconFactory->getIconForResource($fileObject, Icon::SIZE_SMALL)->render() . '</span>';
                            if (!$folder && GeneralUtility::inList($GLOBALS['TYPO3_CONF_VARS']['GFX']['imagefile_ext'], $fileObject->getExtension())) {
                                $processedFile = $fileObject->process(\TYPO3\CMS\Core\Resource\ProcessedFile::CONTEXT_IMAGEPREVIEW, array());
                                if ($processedFile) {
                                    $thumbUrl = $processedFile->getPublicUrl(true);
                                    $thumb = '<br /><img src="' . htmlspecialchars($thumbUrl) . '" ' . 'width="' . $processedFile->getProperty('width') . '" ' . 'height="' . $processedFile->getProperty('height') . '" ' . 'title="' . htmlspecialchars($fileObject->getName()) . '" alt="" />';
                                }
                            }
                            $lines[] = '
								<tr>
									<td nowrap="nowrap" class="col-icon">' . $icon . '</td>
									<td nowrap="nowrap" width="95%">' . $this->linkItemText(htmlspecialchars(GeneralUtility::fixed_lgd_cs($fileObject->getName(), $this->getBackendUser()->uc['titleLen'])), $fileObject->getName()) . ($pad == 'normal' ? ' <strong>(' . ($this->clipData['normal']['mode'] == 'copy' ? $this->clLabel('copy', 'cm') : $this->clLabel('cut', 'cm')) . ')</strong>' : '') . '&nbsp;' . $thumb . '</td>
									<td nowrap="nowrap" class="col-control">
										<div class="btn-group">
											<a class="btn btn-default" href="#" onclick="' . htmlspecialchars('top.launchView(' . GeneralUtility::quoteJSvalue($table) . ', ' . GeneralUtility::quoteJSvalue($v) . '); return false;') . '"title="' . $this->clLabel('info', 'cm') . '">' . $this->iconFactory->getIcon('actions-document-info', Icon::SIZE_SMALL)->render() . '</a>' . '<a class="btn btn-default" href="' . htmlspecialchars($this->removeUrl('_FILE', GeneralUtility::shortmd5($v))) . '#clip_head" title="' . $this->clLabel('removeItem') . '">' . $this->iconFactory->getIcon('actions-selection-delete', Icon::SIZE_SMALL)->render() . '</a>
										</div>
									</td>
								</tr>';
                        } else {
                            // If the file did not exist (or is illegal) then it is removed from the clipboard immediately:
                            unset($this->clipData[$pad]['el'][$k]);
                            $this->changed = 1;
                        }
                    } else {
                        // Rendering records:
                        $rec = BackendUtility::getRecordWSOL($table, $uid);
                        if (is_array($rec)) {
                            $lines[] = '
								<tr>
									<td nowrap="nowrap" class="col-icon">' . $this->linkItemText($this->iconFactory->getIconForRecord($table, $rec, Icon::SIZE_SMALL)->render(), $rec, $table) . '</td>
									<td nowrap="nowrap" width="95%">' . $this->linkItemText(htmlspecialchars(GeneralUtility::fixed_lgd_cs(BackendUtility::getRecordTitle($table, $rec), $this->getBackendUser()->uc['titleLen'])), $rec, $table) . ($pad == 'normal' ? ' <strong>(' . ($this->clipData['normal']['mode'] == 'copy' ? $this->clLabel('copy', 'cm') : $this->clLabel('cut', 'cm')) . ')</strong>' : '') . '&nbsp;</td>
									<td nowrap="nowrap" class="col-control">
										<div class="btn-group">
											<a class="btn btn-default" href="#" onclick="' . htmlspecialchars('top.launchView(' . GeneralUtility::quoteJSvalue($table) . ', \'' . (int) $uid . '\'); return false;') . '" title="' . $this->clLabel('info', 'cm') . '">' . $this->iconFactory->getIcon('actions-document-info', Icon::SIZE_SMALL)->render() . '</a>' . '<a class="btn btn-default" href="' . htmlspecialchars($this->removeUrl($table, $uid)) . '#clip_head" title="' . $this->clLabel('removeItem') . '">' . $this->iconFactory->getIcon('actions-selection-delete', Icon::SIZE_SMALL)->render() . '</a>
										</div>
									</td>
								</tr>';
                            $localizationData = $this->getLocalizations($table, $rec, $bgColClass, $pad);
                            if ($localizationData) {
                                $lines[] = $localizationData;
                            }
                        } else {
                            unset($this->clipData[$pad]['el'][$k]);
                            $this->changed = 1;
                        }
                    }
                }
            }
        }
        $this->endClipboard();
        return $lines;
    }
开发者ID:Audibene-GMBH,项目名称:TYPO3.CMS,代码行数:74,代码来源:Clipboard.php

示例6: renderPageTitle

 /**
  * Render page title with icon, table title and record title
  *
  * @return string
  */
 protected function renderPageTitle()
 {
     $title = strip_tags(BackendUtility::getRecordTitle($this->table, $this->row));
     if ($this->type === 'folder') {
         $table = $this->getLanguageService()->sL('LLL:EXT:lang/locallang_common.xlf:folder');
         $icon = $this->iconFactory->getIconForResource($this->folderObject, Icon::SIZE_SMALL)->render();
     } elseif ($this->type === 'file') {
         $table = $this->getLanguageService()->sL($GLOBALS['TCA'][$this->table]['ctrl']['title']);
         $icon = $this->iconFactory->getIconForResource($this->fileObject, Icon::SIZE_SMALL)->render();
     } else {
         $table = $this->getLanguageService()->sL($GLOBALS['TCA'][$this->table]['ctrl']['title']);
         $icon = $this->iconFactory->getIconForRecord($this->table, $this->row, Icon::SIZE_SMALL);
     }
     // Set HTML title tag
     $this->moduleTemplate->setTitle($table . ': ' . $title);
     return '<h1>' . ($table ? '<small>' . $table . '</small><br />' : '') . $icon . $title . '</h1>';
 }
开发者ID:cosmox,项目名称:TYPO3.CMS,代码行数:22,代码来源:ElementInformationController.php

示例7: printFileClickMenu

 /**
  * Make 1st level clickmenu:
  *
  * @param string $combinedIdentifier The combined identifier
  * @return string HTML content
  * @see \TYPO3\CMS\Core\Resource\ResourceFactory::retrieveFileOrFolderObject()
  */
 public function printFileClickMenu($combinedIdentifier)
 {
     $icon = '';
     $identifier = '';
     $menuItems = array();
     $combinedIdentifier = rawurldecode($combinedIdentifier);
     $fileObject = ResourceFactory::getInstance()->retrieveFileOrFolderObject($combinedIdentifier);
     if ($fileObject) {
         $folder = false;
         $isStorageRoot = false;
         $isOnline = true;
         $userMayViewStorage = false;
         $userMayEditStorage = false;
         $identifier = $fileObject->getCombinedIdentifier();
         if ($fileObject instanceof Folder) {
             $icon = '<span title="' . htmlspecialchars($fileObject->getName()) . '" class="absmiddle">' . $this->iconFactory->getIconForResource($fileObject, Icon::SIZE_SMALL)->render() . '</span>';
             $folder = true;
             if ($fileObject->getIdentifier() === $fileObject->getStorage()->getRootLevelFolder()->getIdentifier()) {
                 $isStorageRoot = true;
                 if ($this->backendUser->check('tables_select', 'sys_file_storage')) {
                     $userMayViewStorage = true;
                 }
                 if ($this->backendUser->check('tables_modify', 'sys_file_storage')) {
                     $userMayEditStorage = true;
                 }
             }
             if (!$fileObject->getStorage()->isOnline()) {
                 $isOnline = false;
             }
         } else {
             $title = $fileObject->getName() . ' (' . GeneralUtility::formatSize($fileObject->getSize()) . ')';
             $icon = '<span class="absmiddle" title="' . htmlspecialchars($title) . '">' . $this->iconFactory->getIconForResource($fileObject, Icon::SIZE_SMALL)->render() . '</span>';
         }
         // Hide
         if (!in_array('hide', $this->disabledItems, true) && $isStorageRoot && $userMayEditStorage) {
             $record = BackendUtility::getRecord('sys_file_storage', $fileObject->getStorage()->getUid());
             $menuItems['hide'] = $this->DB_changeFlag('sys_file_storage', $record, 'is_online', $this->label($record['is_online'] ? 'offline' : 'online'), 'hide');
         }
         // Edit
         if (!in_array('edit', $this->disabledItems, true) && $fileObject->checkActionPermission('write')) {
             if (!$folder && !$isStorageRoot && $fileObject->isIndexed() && $this->backendUser->check('tables_modify', 'sys_file_metadata')) {
                 $metaData = $fileObject->_getMetaData();
                 $menuItems['edit2'] = $this->DB_edit('sys_file_metadata', $metaData['uid']);
             }
             if (!$folder && GeneralUtility::inList($GLOBALS['TYPO3_CONF_VARS']['SYS']['textfile_ext'], $fileObject->getExtension()) && $fileObject->checkActionPermission('write')) {
                 $menuItems['edit'] = $this->FILE_launch($identifier, 'file_edit', 'editcontent', 'actions-page-open');
             } elseif ($isStorageRoot && $userMayEditStorage) {
                 $menuItems['edit'] = $this->DB_edit('sys_file_storage', $fileObject->getStorage()->getUid());
             }
         }
         // Rename
         if (!in_array('rename', $this->disabledItems, true) && !$isStorageRoot && $fileObject->checkActionPermission('rename')) {
             $menuItems['rename'] = $this->FILE_launch($identifier, 'file_rename', 'rename', 'actions-edit-rename');
         }
         // Upload
         if (!in_array('upload', $this->disabledItems, true) && $folder && $isOnline && $fileObject->checkActionPermission('write')) {
             $menuItems['upload'] = $this->FILE_launch($identifier, 'file_upload', 'upload', 'actions-edit-upload');
         }
         // New
         if (!in_array('new', $this->disabledItems, true) && $folder && $isOnline && $fileObject->checkActionPermission('write')) {
             $menuItems['new'] = $this->FILE_launch($identifier, 'file_newfolder', 'new', 'actions-document-new');
         }
         // Info
         if (!in_array('info', $this->disabledItems, true) && $fileObject->checkActionPermission('read')) {
             if ($isStorageRoot && $userMayViewStorage) {
                 $menuItems['info'] = $this->DB_info('sys_file_storage', $fileObject->getStorage()->getUid());
             } elseif (!$folder) {
                 $menuItems['info'] = $this->fileInfo($identifier);
             }
         }
         $menuItems[] = 'spacer';
         // Copy:
         if (!in_array('copy', $this->disabledItems, true) && !$isStorageRoot && $fileObject->checkActionPermission('read')) {
             $menuItems['copy'] = $this->FILE_copycut($identifier, 'copy');
         }
         // Cut:
         if (!in_array('cut', $this->disabledItems, true) && !$isStorageRoot && $fileObject->checkActionPermission('move')) {
             $menuItems['cut'] = $this->FILE_copycut($identifier, 'cut');
         }
         // Paste:
         $elFromAllTables = count($this->clipObj->elFromTable('_FILE'));
         if (!in_array('paste', $this->disabledItems, true) && $elFromAllTables && $folder && $fileObject->checkActionPermission('write')) {
             $elArr = $this->clipObj->elFromTable('_FILE');
             $selItem = reset($elArr);
             $clickedFileOrFolder = ResourceFactory::getInstance()->retrieveFileOrFolderObject($combinedIdentifier);
             $fileOrFolderInClipBoard = ResourceFactory::getInstance()->retrieveFileOrFolderObject($selItem);
             $elInfo = array($fileOrFolderInClipBoard->getName(), $clickedFileOrFolder->getName(), $this->clipObj->currentMode());
             if (!$fileOrFolderInClipBoard instanceof Folder || !$fileOrFolderInClipBoard->getStorage()->isWithinFolder($fileOrFolderInClipBoard, $clickedFileOrFolder)) {
                 $menuItems['pasteinto'] = $this->FILE_paste($identifier, $selItem, $elInfo);
             }
         }
         $menuItems[] = 'spacer';
         // Delete:
//.........这里部分代码省略.........
开发者ID:graurus,项目名称:testgit_t37,代码行数:101,代码来源:ClickMenu.php

示例8: getIconForResourceWithMountRootReturnsMountFolderIcon

 /**
  * Tests the returns of mount root
  *
  * @test
  */
 public function getIconForResourceWithMountRootReturnsMountFolderIcon()
 {
     $folderObject = $this->getTestSubjectFolderObject('/mount');
     $result = $this->subject->getIconForResource($folderObject, Icon::SIZE_DEFAULT, null, array('mount-root' => true))->render();
     $this->assertContains('<span class="t3js-icon icon icon-size-default icon-state-default icon-apps-filetree-mount" data-identifier="apps-filetree-mount">', $result);
 }
开发者ID:rickymathew,项目名称:TYPO3.CMS,代码行数:11,代码来源:IconFactoryTest.php

示例9: TBE_dragNDrop

    /**
     * For RTE: This displays all IMAGES (gif,png,jpg) (from extensionList) from folder. Thumbnails are shown for images.
     * This listing is of images located in the web-accessible paths ONLY - the listing is for drag-n-drop use in the RTE
     *
     * @param Folder $folder The folder path to expand
     * @param string $extensionList List of file extensions to show
     * @return string HTML output
     */
    public function TBE_dragNDrop(Folder $folder, $extensionList = '')
    {
        if (!$folder) {
            return '';
        }
        $lang = $this->getLanguageService();
        if (!$folder->getStorage()->isPublic()) {
            // Print this warning if the folder is NOT a web folder
            return GeneralUtility::makeInstance(FlashMessage::class, $lang->getLL('noWebFolder'), $lang->getLL('files'), FlashMessage::WARNING)->render();
        }
        $out = '';
        // Read files from directory:
        $extensionList = $extensionList == '*' ? '' : $extensionList;
        $files = $this->getFilesInFolder($folder, $extensionList);
        $out .= $this->barheader(sprintf($lang->getLL('files') . ' (%s):', count($files)));
        $titleLen = (int) $this->getBackendUser()->uc['titleLen'];
        $picon = $this->iconFactory->getIcon('apps-filetree-folder-default', Icon::SIZE_SMALL)->render();
        $picon .= htmlspecialchars(GeneralUtility::fixed_lgd_cs(basename($folder->getName()), $titleLen));
        $out .= $picon . '<br />';
        // Init row-array:
        $lines = array();
        // Add "drag-n-drop" message:
        $infoText = GeneralUtility::makeInstance(FlashMessage::class, $lang->getLL('findDragDrop'), '', FlashMessage::INFO)->render();
        $lines[] = '
			<tr>
				<td colspan="2">' . $infoText . '</td>
			</tr>';
        // Traverse files:
        foreach ($files as $fileObject) {
            // URL of image:
            $iUrl = GeneralUtility::rawurlencodeFP($fileObject->getPublicUrl(true));
            // Show only web-images
            $fileExtension = strtolower($fileObject->getExtension());
            if (GeneralUtility::inList('gif,jpeg,jpg,png', $fileExtension)) {
                $imgInfo = array($fileObject->getProperty('width'), $fileObject->getProperty('height'));
                $pDim = $imgInfo[0] . 'x' . $imgInfo[1] . ' pixels';
                $size = ' (' . GeneralUtility::formatSize($fileObject->getSize()) . 'bytes' . ($pDim ? ', ' . $pDim : '') . ')';
                $filenameAndIcon = '<span title="' . htmlspecialchars($fileObject->getName() . $size) . '">' . $this->iconFactory->getIconForResource($fileObject, Icon::SIZE_SMALL)->render() . '</span>';
                if (GeneralUtility::_GP('noLimit')) {
                    $maxW = 10000;
                    $maxH = 10000;
                } else {
                    $maxW = 380;
                    $maxH = 500;
                }
                $IW = $imgInfo[0];
                $IH = $imgInfo[1];
                if ($IW > $maxW) {
                    $IH = ceil($IH / $IW * $maxW);
                    $IW = $maxW;
                }
                if ($IH > $maxH) {
                    $IW = ceil($IW / $IH * $maxH);
                    $IH = $maxH;
                }
                // Make row:
                $lines[] = '
					<tr class="bgColor4">
						<td nowrap="nowrap">' . $filenameAndIcon . '&nbsp;</td>
						<td nowrap="nowrap">' . ($imgInfo[0] != $IW ? '<a href="' . htmlspecialchars(GeneralUtility::linkThisScript(array('noLimit' => '1'))) . '" title="' . $lang->getLL('clickToRedrawFullSize', true) . '">' . $this->iconFactory->getIcon('status-dialog-warning', Icon::SIZE_SMALL)->render() . '</a>' : '') . $pDim . '&nbsp;</td>
					</tr>';
                $lines[] = '
					<tr>
						<td colspan="2"><img src="' . htmlspecialchars($iUrl) . '" data-htmlarea-file-uid="' . $fileObject->getUid() . '" width="' . htmlspecialchars($IW) . '" height="' . htmlspecialchars($IH) . '" border="1" alt="" /></td>
					</tr>';
                $lines[] = '
					<tr>
						<td colspan="2"><span style="width: 1px; height: 3px; display: inline-block;"></span></td>
					</tr>';
            }
        }
        // Finally, wrap all rows in a table tag:
        $out .= '


<!--
	Filelisting / Drag-n-drop
-->
			<table border="0" cellpadding="0" cellspacing="1" id="typo3-dragBox">
				' . implode('', $lines) . '
			</table>';
        return $out;
    }
开发者ID:hlop,项目名称:TYPO3.CMS,代码行数:91,代码来源:ElementBrowser.php


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