*/ /** * Extension class for the rendering of TCEforms in the frontend * * @author Kasper Skaarhoj */ class t3lib_TCEforms_FE extends t3lib_TCEforms { /** * Constructs this object. */ public function __construct() { $this->initializeTemplateContainer(); parent::__construct(); } /** * Function for wrapping labels. * * @param string The string to wrap * @return string */ public function wrapLabels($str) { return '' . $str . ''; } /** * Prints the palette in the frontend editing (forms-on-page?) * * @param array The palette array to print * @return string HTML output */ public function printPalette(array $paletteArray) { $out = ''; $bgColor = ' bgcolor="#D6DAD0"'; foreach($paletteArray as $content) { $hRow[] = ' ' . $content['NAME'] . ''; $iRow[] = '' . '' . '' . '' . $content['ITEM'] . $content['HELP_ICON'] . ''; } $out = '' . implode('', $hRow) . '' . implode('', $iRow) . '
'; return $out; } /** * Sets the fancy front-end design of the editor. * Frontend * * @return void */ public function setFancyDesign() { $this->fieldTemplate = ' ###FIELD_HELP_ICON######FIELD_NAME######FIELD_HELP_TEXT### ###FIELD_ITEM######FIELD_PAL_LINK_ICON### '; $this->totalWrap = '
|
'; $this->palFieldTemplate = ' ###FIELD_PALETTE### '; $this->palFieldTemplateHeader = ' ###FIELD_HEADER### '; } /** * Includes a javascript library that exists in the core /typo3/ directory. The * backpath is automatically applied. * This method adds the library to $GLOBALS['TSFE']->additionalHeaderData[$lib]. * * @param string $lib: Library name. Call it with the full path like "contrib/prototype/prototype.js" to load it * @return void */ public function loadJavascriptLib($lib) { /** @var $pageRenderer t3lib_PageRenderer */ $pageRenderer = $GLOBALS['TSFE']->getPageRenderer(); $pageRenderer->addJsLibrary($lib, $this->prependBackPath($lib)); } /** * Insert additional style sheet link * * @param string $key: some key identifying the style sheet * @param string $href: uri to the style sheet file * @param string $title: value for the title attribute of the link element * @return string $relation: value for the rel attribute of the link element * @return void */ public function addStyleSheet($key, $href, $title='', $relation='stylesheet') { /** @var $pageRenderer t3lib_PageRenderer */ $pageRenderer = $GLOBALS['TSFE']->getPageRenderer(); $pageRenderer->addCssFile($this->prependBackPath($href), $relation, 'screen', $title); } /** * Initializes an anonymous template container. * The created container can be compared to alt_doc.php in backend-only disposal. * * @return void */ public function initializeTemplateContainer() { t3lib_div::requireOnce(PATH_typo3 . 'template.php'); $GLOBALS['TBE_TEMPLATE'] = t3lib_div::makeInstance('frontendDoc'); $GLOBALS['SOBE'] = new stdClass(); $GLOBALS['SOBE']->doc = $GLOBALS['TBE_TEMPLATE']; } /** * Prepends backPath to given URL if it's not an absolute URL * * @param string $url * @return string */ private function prependBackPath($url) { if (strpos($url, '://') !== FALSE || substr($url, 0, 1) === '/') { return $url; } else { return $this->backPath . $url; } } } if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['t3lib/class.t3lib_tceforms_fe.php']) { include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['t3lib/class.t3lib_tceforms_fe.php']); } ?>