/** * Renders the icon * * @param string $icon Icon to be used * @param string $title Optional title * @return strin Content rendered image */ public function render($icon, $title = '') { if (!empty($icon)) { $absIconPath = \TYPO3\CMS\Core\Utility\GeneralUtility::getFileAbsFilename($icon); if (file_exists($absIconPath)) { $icon = $GLOBALS['BACK_PATH'] . '../' . str_replace(PATH_site, '', $absIconPath); } } else { $icon = \TYPO3\CMS\Core\Extension\ExtensionManager::extRelPath('reports') . 'Resources/Public/moduleicon.gif'; } $content = '<img' . \t3lib_iconworks::skinImg($GLOBALS['BACK_PATH'], $icon, 'width="16" height="16"') . ' title="' . htmlspecialchars($title) . '" alt="' . htmlspecialchars($title) . '" />'; return $content; }
/** * Render a list of items as a nicely formated definition list including a * link, icon, title and description. * The keys of a single item are: * - title: Title of the item * - link: Link to the task * - icon: Path to the icon or Icon as HTML if it begins with <img * - description: Description of the task, using htmlspecialchars() * - descriptionHtml: Description allowing HTML tags which will override the * description * * @param array $items: List of items to be displayed in the definition list. * @param boolean $mainMenu: Set it to TRUE to render the main menu * @return string definition list */ public function renderListMenu($items, $mainMenu = FALSE) { $content = $section = ''; $count = 0; // change the sorting of items to the user's one if ($mainMenu) { $userSorting = unserialize($GLOBALS['BE_USER']->uc['taskcenter']['sorting']); if (is_array($userSorting)) { $newSorting = array(); foreach ($userSorting as $item) { if (isset($items[$item])) { $newSorting[] = $items[$item]; unset($items[$item]); } } $items = $newSorting + $items; } } if (is_array($items) && count($items) > 0) { foreach ($items as $item) { $title = htmlspecialchars($item['title']); $icon = $additionalClass = $collapsedStyle = ''; // Check for custom icon if (!empty($item['icon'])) { if (strpos($item['icon'], '<img ') === FALSE) { $absIconPath = t3lib_div::getFileAbsFilename($item['icon']); // If the file indeed exists, assemble relative path to it if (file_exists($absIconPath)) { $icon = $GLOBALS['BACK_PATH'] . '../' . str_replace(PATH_site, '', $absIconPath); $icon = '<img src="' . $icon . '" title="' . $title . '" alt="' . $title . '" />'; } if (@is_file($icon)) { $icon = '<img' . t3lib_iconworks::skinImg($GLOBALS['BACK_PATH'], $icon, 'width="16" height="16"') . ' title="' . $title . '" alt="' . $title . '" />'; } } else { $icon = $item['icon']; } } $description = !empty($item['descriptionHtml']) ? $item['descriptionHtml'] : '<p>' . nl2br(htmlspecialchars($item['description'])) . '</p>'; $id = $this->getUniqueKey($item['uid']); // collapsed & expanded menu items if ($mainMenu && isset($GLOBALS['BE_USER']->uc['taskcenter']['states'][$id]) && $GLOBALS['BE_USER']->uc['taskcenter']['states'][$id]) { $collapsedStyle = 'style="display:none"'; $additionalClass = 'collapsed'; } else { $additionalClass = 'expanded'; } // first & last menu item if ($count == 0) { $additionalClass .= ' first-item'; } elseif ($count + 1 === count($items)) { $additionalClass .= ' last-item'; } // active menu item $active = (string) $this->MOD_SETTINGS['function'] == $item['uid'] ? ' active-task' : ''; // Main menu: Render additional syntax to sort tasks if ($mainMenu) { $dragIcon = '<img' . t3lib_iconWorks::skinImg($GLOBALS['BACK_PATH'], 'gfx/move.gif', 'width="16" height="16" hspace="2"') . ' title="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:labels.move', 1) . '" alt="" />'; $section = '<div class="down"> </div> <div class="drag">' . $dragIcon . '</div>'; $backgroundClass = 't3-row-header '; } $content .= '<li class="' . $additionalClass . $active . '" id="el_' . $id . '"> ' . $section . ' <div class="image">' . $icon . '</div> <div class="' . $backgroundClass . 'link"><a href="' . $item['link'] . '">' . $title . '</a></div> <div class="content " ' . $collapsedStyle . '>' . $description . '</div> </li>'; $count++; } $navigationId = $mainMenu ? 'id="task-list"' : ''; $content = '<ul ' . $navigationId . ' class="task-list">' . $content . '</ul>'; } return $content; }
/** * Shows an overview list of available reports. * * @return string list of available reports */ protected function indexAction() { $defaultIcon = t3lib_extMgm::extRelPath('reports') . 'mod/moduleicon.gif'; $content = '<dl class="report-list">'; $reports = array(); foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['reports'] as $extKey => $extensionReports) { foreach ($extensionReports as $reportName => $report) { $action = $extKey . '.' . $reportName; $link = 'mod.php?M=tools_txreportsM1' . htmlspecialchars('&SET[function]=') . $action; $reportTitle = $GLOBALS['LANG']->sL($report['title']); // Set default report icon $icon = $defaultIcon; // Check for custom icon if (!empty($report['icon'])) { $absIconPath = t3lib_div::getFileAbsFilename($report['icon']); // If the file indeed exists, assemble relative path to it if (file_exists($absIconPath)) { $icon = $GLOBALS['BACK_PATH'] . '../' . str_replace(PATH_site, '', $absIconPath); } } $icon = '<img' . t3lib_iconworks::skinImg($GLOBALS['BACK_PATH'], $icon, 'width="16" height="16"') . ' title="' . $reportTitle . '" alt="' . $reportTitle . '" />'; $reportContent = '<dt><a href="' . $link . '">' . $icon . $reportTitle . '</a></dt>'; $reportContent .= '<dd>' . $GLOBALS['LANG']->sL($report['description']) . '</dd>'; $reports[$reportTitle] = $reportContent; } } ksort($reports); foreach ($reports as $reportContent) { $content .= $reportContent; } return $content . '</dl>'; }
/** * Creates the overview menu. * * @return void */ protected function func_default() { $availableModFuncs = array('records', 'relations', 'search', 'filesearch', 'refindex'); $content = '<dl class="t3-overview-list">'; foreach ($availableModFuncs as $modFunc) { $functionUrl = \TYPO3\CMS\Backend\Utility\BackendUtility::getModuleUrl('tools_dbint') . '&SET[function]=' . $modFunc; $title = $GLOBALS['LANG']->getLL($modFunc); $description = $GLOBALS['LANG']->getLL($modFunc . '_description'); $icon = '<img src="' . \t3lib_iconworks::skinImg($GLOBALS['BACK_PATH'], 'MOD:tools_dbint/db.gif', '', 1) . '" width="16" height="16" title="' . $title . '" alt="' . $title . '" />'; $content .= ' <dt><a href="' . htmlspecialchars($functionUrl) . '">' . $icon . $title . '</a></dt> <dd>' . $description . '</dd> '; } $content .= '</dl>'; $this->content .= $this->doc->header($GLOBALS['LANG']->getLL('title')); $this->content .= $this->doc->section('', $content, FALSE, TRUE); }
/** * Creates the overview menu. * */ protected function func_default() { $availableModFuncs = array('records', 'relations', 'search', 'filesearch', 'refindex'); $moduleTitle = $GLOBALS['LANG']->getLL('title'); $content = '<dl class="t3-overview-list">'; foreach ($availableModFuncs as $modFunc) { $link = 'index.php?SET[function]=' . $modFunc; $title = $GLOBALS['LANG']->getLL($modFunc); $description = $GLOBALS['LANG']->getLL($modFunc . '_description'); $icon = '<img src="' . t3lib_iconworks::skinImg($GLOBALS['BACK_PATH'], 'MOD:tools_dbint/db.gif', '', 1) . '" width="16" height="16" title="' . $title . '" alt="' . $title . '" />'; $content .= ' <dt><a href="' . $link . '">' . $icon . $title . '</a></dt> <dd>' . $description . '</dd> '; } $content .= '</dl>'; $this->content .= $this->doc->section($moduleTitle, $content, false, true); }