/** * Returns a file or folder icon for a given (file)path as HTML img tag. * * @param array $infoArr info array: eg. $pathInfo = tx_dam::path_getInfo($path) * @param boolean $addAttrib Additional attributes for the image tag.. * @param string $mode TYPO3_MODE to be used: 'FE', 'BE'. Constant TYPO3_MODE is default. * @return string Icon img tag * @see tx_dam::path_getInfo() */ function icon_getFileTypeImgTag($infoArr, $addAttrib = '', $mode = TYPO3_MODE) { global $TYPO3_CONF_VARS, $TCA; static $iconCacheSize = array(); require_once PATH_t3lib . 'class.t3lib_iconworks.php'; if (isset($infoArr['dir_name'])) { $iconfile = tx_dam::icon_getFolder($infoArr); } elseif (isset($infoArr['file_name']) or isset($infoArr['file_type']) or isset($infoArr['media_type'])) { $iconfile = tx_dam::icon_getFileType($infoArr); if ($mode === 'BE') { $tca_temp_typeicons = $TCA['tx_dam']['ctrl']['typeicons']; $tca_temp_iconfile = $TCA['tx_dam']['ctrl']['iconfile']; unset($TCA['tx_dam']['ctrl']['typeicons']); $TCA['tx_dam']['ctrl']['iconfile'] = $iconfile; $iconfile = t3lib_iconWorks::getIcon('tx_dam', $infoArr, $shaded = false); $TCA['tx_dam']['ctrl']['iconfile'] = $tca_temp_iconfile; $TCA['tx_dam']['ctrl']['typeicons'] = $tca_temp_typeicons; } } if (!$iconCacheSize[$iconfile]) { // Get width/height: $iInfo = @getimagesize(t3lib_div::resolveBackPath(PATH_site . TYPO3_mainDir . $iconfile)); $iconCacheSize[$iconfile] = $iInfo[3]; } $icon = '<img' . t3lib_iconWorks::skinImg($GLOBALS['BACK_PATH'], $iconfile, $iconCacheSize[$iconfile]) . ' class="typo3-icon" alt="" ' . trim($addAttrib) . ' />'; return $icon; }
/** * Makes the code for the foldericon in the top * * @param array $pathInfo Path info array: $pathInfo = tx_dam::path_getInfo($path) * @param boolean $browsable If set the path is browsable to navigate into the folders. * @param string $allowedIcons Comma list that defines the icons to display. * @return string HTML code */ function getFolderNavBar($pathInfo, $browsable = true, $allowedIcons = NULL) { global $BACK_PATH, $LANG; if (is_array($pathInfo)) { $allowedIcons = is_null($allowedIcons) ? 'up,refresh' : $allowedIcons; $allowedIcons = is_array($allowedIcons) ? $allowedIcons : t3lib_div::trimExplode(',', $allowedIcons, TRUE); $allowedIcons = array_diff($allowedIcons, $this->guiCmdIconsDeny); // refresh button if ($browsable and in_array('refresh', $allowedIcons)) { $icon = '<img' . t3lib_iconWorks::skinImg($BACK_PATH, 'gfx/refresh_n.gif', 'width="14" height="14"') . ' title="' . $LANG->sL('LLL:EXT:lang/locallang_core.xml:labels.reload', 1) . '" class="absmiddle" alt="" />'; $elements['refresh'] = '<a href="' . htmlspecialchars(t3lib_div::linkThisScript(array('unique' => uniqid('tx_dam_scbase')))) . '">' . $icon . '</a>'; //$elements['refreshSpacer'] = '<span class="spacer05em"><span>'; } // folder up button if ($browsable and in_array('up', $allowedIcons) and $pathInfo['mount_id'] and strcmp($pathInfo['mount_path'], $pathInfo['dir_path_absolute'])) { $icon = '<img' . t3lib_iconWorks::skinImg($BACK_PATH, 'gfx/i/folder_up.gif', 'width="18" height="16"') . ' title="' . $LANG->sL('LLL:EXT:lang/locallang_core.xml:labels.upOneLevel', 1) . '" class="absmiddle" alt="" />'; $elements['up'] = '<a href="' . htmlspecialchars(t3lib_div::linkThisScript(array('SET[tx_dam_folder]' => dirname($pathInfo['dir_path_absolute'])))) . '">' . $icon . '</a>'; } $iconFolder = tx_dam::icon_getFolder($pathInfo); $elements['icon'] = '<img' . t3lib_iconWorks::skinImg($BACK_PATH, $iconFolder, 'width="18" height="16"') . ' alt="" />'; $elements['path'] = tx_dam_guiFunc::getPathBreadcrumbMenu($pathInfo, $browsable, $maxLength = 35); $this->markers['REFRESH'] .= $elements['refresh']; $this->markers['LEVEL_UP'] .= $elements['up']; $this->markers['FOLDER_INFO'] .= $elements['path']; $this->markers['PAGE_ICON'] .= $elements['icon']; } return ''; }
/** * Makes the code for the foldericon in the top * * @param array $pathInfo Path info array: $pathInfo = tx_dam::path_getInfo($path) * @param integer $maxLength Maximum Text length * @return string HTML code */ function getFolderInfoBar($pathInfo, $maxLength = 55) { global $BACK_PATH, $LANG; if (is_array($pathInfo)) { $iconFolder = tx_dam::icon_getFolder($pathInfo); $elements['icon'] = '<img' . t3lib_iconWorks::skinImg($BACK_PATH, $iconFolder, 'width="18" height="16"') . ' alt="" />'; $elements['path'] = tx_dam_guiFunc::getPathBreadcrumbMenu($pathInfo, false, $maxLength); $out = ' <!-- Page header for file list --> <table border="0" cellpadding="0" cellspacing="0" id="typo3-pathBreadcrumbBar"> <tr><td>' . implode('</td><td>', $elements) . '</td></tr> </table>'; } return $out; }