/** * Renders else-child or else-argument if variable $item is in $list * * @param string $list * @param string $item * @return string */ public function render() { $item = $this->arguments['item']; $as = $this->arguments['as']; $plugin = $this->arguments['plugin']; $ctype = $this->arguments['ctype']; // plugin if ($plugin === TRUE) { foreach ($GLOBALS['TCA']['tt_content']['columns']['list_type']['config']['items'] as $itemKey => $itemValue) { if (trim($itemValue[1]) == $item['list_type']) { preg_match('/EXT:(.*?)\\//', $itemValue[0], $ext); preg_match('/^LLL:(EXT:.*?):(.*)/', $itemValue[0], $llfile); $localLang = \TYPO3\CMS\Core\Utility\GeneralUtility::readLLfile($llfile[1], $GLOBALS['LANG']->lang); $item['iconext'] = tx_additionalreports_util::getExtIcon($ext[1]); $item['extension'] = $ext[1]; $item['plugin'] = $GLOBALS['LANG']->getLLL($llfile[2], $localLang) . ' (' . $item['list_type'] . ')'; } else { $item['plugin'] = $item['list_type']; } } } // CType if ($ctype === TRUE) { foreach ($GLOBALS['TCA']['tt_content']['columns']['CType']['config']['items'] as $itemValue) { if ($itemValue[1] != '--div--') { if (trim($itemValue[1]) == $item['CType']) { preg_match('/^LLL:(EXT:.*?):(.*)/', $itemValue[0], $llfile); $localLang = \TYPO3\CMS\Core\Utility\GeneralUtility::readLLfile($llfile[1], $GLOBALS['LANG']->lang); $item['iconext'] = tx_additionalreports_util::getContentTypeIcon($itemValue[2]); $item['ctype'] = $GLOBALS['LANG']->getLLL($llfile[2], $localLang) . ' (' . $item['CType'] . ')'; } else { $item['ctype'] = $item['CType']; } } } } $item = array_merge($item, tx_additionalreports_main::getContentInfos($item)); if ($this->templateVariableContainer->exists($as)) { $this->templateVariableContainer->remove($as); } $this->templateVariableContainer->add($as, $item); }
/** * @test */ public function getExtIcon() { $this->assertTrue(tx_additionalreports_util::getExtIcon('additional_reports') == \TYPO3\CMS\Core\Utility\GeneralUtility::getIndpEnv('TYPO3_SITE_URL') . 'typo3conf/ext/additional_reports/ext_icon.gif'); }
/** * Generate the eid report * * @return string HTML code */ public static function displayEid() { $items = $GLOBALS['TYPO3_CONF_VARS']['FE']['eID_include']; $eids = array(); if (count($items) > 0) { foreach ($items as $itemKey => $itemValue) { preg_match('/EXT:(.*?)\\//', $itemValue, $ext); if (\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::isLoaded($ext[1])) { $eids[] = array('icon' => tx_additionalreports_util::getExtIcon($ext[1]), 'extension' => $ext[1], 'name' => $itemKey, 'path' => $itemValue); } } } $view = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Fluid\\View\\StandaloneView'); $view->setTemplatePathAndFilename(\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath('additional_reports') . 'Resources/Private/Templates/eid-fluid.html'); $view->assign('eids', $eids); return $view->render(); }
/** * Gathers all extensions in $path * * @param string $path Absolute path to local, global or system extensions * @param array $dbSchema array with all the tables * @return array "Returns" content by reference */ public static function getInstExtList($path, $dbSchema) { $list = array(); if (@is_dir($path)) { $extList = \TYPO3\CMS\Core\Utility\GeneralUtility::get_dirs($path); if (is_array($extList)) { foreach ($extList as $extKey) { if (@is_file($path . $extKey . '/ext_emconf.php')) { $emConf = self::includeEMCONF($path . $extKey . '/ext_emconf.php', $extKey); if (is_array($emConf)) { $currentExt = array(); $currentExt['extkey'] = $extKey; $currentExt['installed'] = \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::isLoaded($extKey); $currentExt['EM_CONF'] = $emConf; $currentExt['files'] = \TYPO3\CMS\Core\Utility\GeneralUtility::getFilesInDir($path . $extKey, '', 0, '', null); $currentExt['lastversion'] = tx_additionalreports_util::checkExtensionUpdate($currentExt); $currentExt['affectedfiles'] = tx_additionalreports_util::getExtAffectedFiles($currentExt); $currentExt['icon'] = tx_additionalreports_util::getExtIcon($extKey); // db infos $fdFile = array(); $updateStatements = array(); tx_additionalreports_util::getExtSqlUpdateStatements($currentExt, $dbSchema, $fdFile, $updateStatements); $currentExt['fdfile'] = $fdFile; $currentExt['updatestatements'] = $updateStatements; if ($currentExt['installed']) { if ($currentExt['lastversion']) { $list['ter'][$extKey] = $currentExt; } else { $list['dev'][$extKey] = $currentExt; } } else { $list['unloaded'][$extKey] = $currentExt; } } } } } } return $list; }