/** * Common function for rendering of the Flexible Content / Page Templates. * For Page Templates the input row may be manipulated to contain the proper reference to a data structure (pages can have those inherited which content elements cannot). * * @param array Current data record, either a tt_content element or page record. * @param string Table name, either "pages" or "tt_content". * @return string HTML output. */ function renderElement($row,$table) { global $TYPO3_CONF_VARS; // First prepare user defined objects (if any) for hooks which extend this function: $hookObjectsArr = array(); if (is_array ($TYPO3_CONF_VARS['EXTCONF']['templavoila']['pi1']['renderElementClass'])) { foreach ($TYPO3_CONF_VARS['EXTCONF']['templavoila']['pi1']['renderElementClass'] as $classRef) { $hookObjectsArr[] = &t3lib_div::getUserObj($classRef); } } // Hook: renderElement_preProcessRow foreach($hookObjectsArr as $hookObj) { if (method_exists ($hookObj, 'renderElement_preProcessRow')) { $hookObj->renderElement_preProcessRow($row, $table, $this); } } $dsRepo = t3lib_div::makeInstance('tx_templavoila_datastructureRepository'); try { $dsObj = $dsRepo->getDatastructureByUidOrFilename($row['tx_templavoila_ds']); $DS = $dsObj->getDataprotArray(); } catch (InvalidArgumentException $e) { $DS = null; } // If a Data Structure was found: if (is_array($DS)) { // Sheet Selector: if ($DS['meta']['sheetSelector']) { // <meta><sheetSelector> could be something like "EXT:user_extension/class.user_extension_selectsheet.php:&user_extension_selectsheet" $sheetSelector = &t3lib_div::getUserObj($DS['meta']['sheetSelector']); $renderSheet = $sheetSelector->selectSheet(); } else { $renderSheet = 'sDEF'; } // Initialize: $langChildren = $DS['meta']['langChildren'] ? 1 : 0; $langDisabled = $DS['meta']['langDisable'] ? 1 : 0; list ($dataStruct, $sheet, $singleSheet) = t3lib_div::resolveSheetDefInDS($DS,$renderSheet); // Data from FlexForm field: $data = t3lib_div::xml2array($row['tx_templavoila_flex']); $lKey = ($GLOBALS['TSFE']->sys_language_isocode && !$langDisabled && !$langChildren) ? 'l'.$GLOBALS['TSFE']->sys_language_isocode : 'lDEF'; /* Hook to modify language key - e.g. used for EXT:languagevisibility */ foreach($hookObjectsArr as $hookObj) { if (method_exists ($hookObj, 'renderElement_preProcessLanguageKey')) { $lKey = $hookObj->renderElement_preProcessLanguageKey($row, $table, $lKey, $langDisabled, $langChildren, $this); } } $dataValues = is_array($data['data']) ? $data['data'][$sheet][$lKey] : ''; if (!is_array($dataValues)) $dataValues = array(); // Init mark up object. $this->markupObj = t3lib_div::makeInstance('tx_templavoila_htmlmarkup'); $this->markupObj->htmlParse = t3lib_div::makeInstance('t3lib_parsehtml'); // Get template record: if ($row['tx_templavoila_to']) { // Initialize rendering type: if ($this->conf['childTemplate']) { $renderType = $this->conf['childTemplate']; if (substr($renderType, 0, 9) == 'USERFUNC:') { $conf = array( 'conf' => is_array($this->conf['childTemplate.']) ? $this->conf['childTemplate.'] : array(), 'toRecord' => $row ); $renderType = t3lib_div::callUserFunction(substr($renderType, 9), $conf, $this); } } else { // Default: $renderType = t3lib_div::_GP('print') ? 'print' : ''; } // Get Template Object record: $TOrec = $this->markupObj->getTemplateRecord($row['tx_templavoila_to'], $renderType, $GLOBALS['TSFE']->sys_language_uid); if (is_array($TOrec)) { // Get mapping information from Template Record: $TO = unserialize($TOrec['templatemapping']); if (is_array($TO)) { // Get local processing: $TOproc = array(); if ($TOrec['localprocessing']) { $TOproc = t3lib_div::xml2array($TOrec['localprocessing']); if (!is_array($TOproc)) { // Must be a error! // TODO log to TT the content of $TOproc (it is a error message now) $TOproc = array(); } } // Processing the data array: if ($GLOBALS['TT']->LR) $GLOBALS['TT']->push('Processing data'); $vKey = ($GLOBALS['TSFE']->sys_language_isocode && !$langDisabled && $langChildren) ? 'v'.$GLOBALS['TSFE']->sys_language_isocode : 'vDEF'; /* Hook to modify value key - e.g. used for EXT:languagevisibility */ foreach($hookObjectsArr as $hookObj) { if (method_exists ($hookObj, 'renderElement_preProcessValueKey')) { $vKey = $hookObj->renderElement_preProcessValueKey($row, $table, $vKey, $langDisabled, $langChildren, $this); } } $TOlocalProc = $singleSheet ? $TOproc['ROOT']['el'] : $TOproc['sheets'][$sheet]['ROOT']['el']; // Store the original data values before the get processed. $originalDataValues = $dataValues; $this->processDataValues($dataValues,$dataStruct['ROOT']['el'],$TOlocalProc,$vKey, ($this->conf['renderUnmapped'] !== 'false' ? TRUE : $TO['MappingInfo']['ROOT']['el'])); // Hook: renderElement_postProcessDataValues foreach ($hookObjectsArr as $hookObj) { if (method_exists($hookObj, 'renderElement_postProcessDataValues')) { $flexformData = array( 'table' => $table, 'row' => $row, 'sheet' => $renderSheet, 'sLang' => $lKey, 'vLang' => $vKey ); $hookObj->renderElement_postProcessDataValues($DS, $dataValues, $originalDataValues, $flexformData); } } if ($GLOBALS['TT']->LR) $GLOBALS['TT']->pull(); // Merge the processed data into the cached template structure: if ($GLOBALS['TT']->LR) $GLOBALS['TT']->push('Merge data and TO'); // Getting the cached mapping data out (if sheets, then default to "sDEF" if no mapping exists for the specified sheet!) $mappingDataBody = $singleSheet ? $TO['MappingData_cached'] : (is_array($TO['MappingData_cached']['sub'][$sheet]) ? $TO['MappingData_cached']['sub'][$sheet] : $TO['MappingData_cached']['sub']['sDEF']); $content = $this->markupObj->mergeFormDataIntoTemplateStructure($dataValues,$mappingDataBody,'',$vKey); $this->markupObj->setHeaderBodyParts($TO['MappingInfo_head'],$TO['MappingData_head_cached'],$TO['BodyTag_cached'], self::$enablePageRenderer); if ($GLOBALS['TT']->LR) $GLOBALS['TT']->pull(); // Edit icon (frontend editing): $eIconf = array('styleAttribute'=>'position:absolute;'); if ($table=='pages') $eIconf['beforeLastTag']=-1; // For "pages", set icon in top, not after. $content = $this->pi_getEditIcon($content,'tx_templavoila_flex','Edit element',$row,$table,$eIconf); // Visual identification aids: $feedit = is_object($GLOBALS['BE_USER']) && method_exists($GLOBALS['BE_USER'], 'isFrontendEditingActive') && $GLOBALS['BE_USER']->isFrontendEditingActive(); if ($GLOBALS['TSFE']->fePreview && $GLOBALS['TSFE']->beUserLogin && !$GLOBALS['TSFE']->workspacePreview && !$this->conf['disableExplosivePreview'] && !$feedit) { $content = $this->visualID($content, $srcPointer, $DSrec, $TOrec, $row, $table); } } else { $content = $this->formatError('Template Object could not be unserialized successfully. Are you sure you saved mapping information into Template Object with UID "'.$row['tx_templavoila_to'].'"?'); } } else { $content = $this->formatError('Couldn\'t find Template Object with UID "'.$row['tx_templavoila_to'].'". Please make sure a Template Object is accessible.'); } } else { $content = $this->formatError('You haven\'t selected a Template Object yet for table/uid "'.$table.'/'.$row['uid'].'". Without a Template Object TemplaVoila cannot map the XML content into HTML. Please select a Template Object now.'); } } else { $content = $this->formatError(' Couldn\'t find a Data Structure set for table/row "'.$table.':'.$row['uid'].'". Please select a Data Structure and Template Object first.'); } return $content; }
/** * Renders the hierarchical display for a Data Structure. * Calls itself recursively * * @param array Part of Data Structure (array of elements) * @param boolean If true, the Data Structure table will show links for mapping actions. Otherwise it will just layout the Data Structure visually. * @param array Part of Current mapping information corresponding to the $dataStruct array - used to evaluate the status of mapping for a certain point in the structure. * @param array Array of HTML paths * @param array Options for mapping mode control (INNER, OUTER etc...) * @param array Content from template file splitted by current mapping info - needed to evaluate whether mapping information for a certain level actually worked on live content! * @param integer Recursion level, counting up * @param array Accumulates the table rows containing the structure. This is the array returned from the function. * @param string Form field prefix. For each recursion of this function, two [] parts are added to this prefix * @param string HTML path. For each recursion a section (divided by "|") is added. * @param boolean If true, the "Map" link can be shown, otherwise not. Used internally in the recursions. * @return array Table rows as an array of <tr> tags, $tRows */ function drawDataStructureMap($dataStruct,$mappingMode=0,$currentMappingInfo=array(),$pathLevels=array(),$optDat=array(),$contentSplittedByMapping=array(),$level=0,$tRows=array(),$formPrefix='',$path='',$mapOK=1) { $bInfo = t3lib_div::clientInfo(); $multilineTooltips = ($bInfo['BROWSER'] == 'msie'); $rowIndex = -1; // Data Structure array must be ... and array of course... if (is_array($dataStruct)) { foreach($dataStruct as $key => $value) { $rowIndex++; if ($key == 'meta') { // Do not show <meta> information in mapping interface! continue; } if (is_array($value)) { // The value of each entry must be an array. // ******************** // Making the row: // ******************** $rowCells=array(); // Icon: $info = $this->dsTypeInfo($value); $icon = '<img'.$info[2].' alt="" title="'.$info[1].$key.'" class="absmiddle" />'; // Composing title-cell: if (preg_match('/^LLL:/', $value['tx_templavoila']['title'])) { $translatedTitle = $GLOBALS['LANG']->sL($value['tx_templavoila']['title']); $translateIcon = '<sup title="' . $GLOBALS['LANG']->getLL('displayDSTitleTranslated') . '">*</sup>'; } else { $translatedTitle = $value['tx_templavoila']['title']; $translateIcon = ''; } $this->elNames[$formPrefix.'['.$key.']']['tx_templavoila']['title'] = $icon.'<strong>'.htmlspecialchars(t3lib_div::fixed_lgd_cs($translatedTitle, 30)).'</strong>'.$translateIcon; $rowCells['title'] = '<img src="clear.gif" width="'.($level*16).'" height="1" alt="" />'.$this->elNames[$formPrefix.'['.$key.']']['tx_templavoila']['title']; // Description: $this->elNames[$formPrefix.'['.$key.']']['tx_templavoila']['description'] = $rowCells['description'] = htmlspecialchars($value['tx_templavoila']['description']); // In "mapping mode", render HTML page and Command links: if ($mappingMode) { // HTML-path + CMD links: $isMapOK = 0; if ($currentMappingInfo[$key]['MAP_EL']) { // If mapping information exists...: $mappingElement = str_replace('~~~', ' ', $currentMappingInfo[$key]['MAP_EL']); if (isset($contentSplittedByMapping['cArray'][$key])) { // If mapping of this information also succeeded...: $cF = implode(chr(10),t3lib_div::trimExplode(chr(10),$contentSplittedByMapping['cArray'][$key],1)); if (strlen($cF)>200) { $cF = t3lib_div::fixed_lgd_cs($cF,90).' '.t3lib_div::fixed_lgd_cs($cF,-90); } // Render HTML path: list($pI) = $this->markupObj->splitPath($currentMappingInfo[$key]['MAP_EL']); $tagIcon = t3lib_iconWorks::skinImg($this->doc->backPath, t3lib_extMgm::extRelPath('templavoila') . 'html_tags/' . $pI['el'] . '.gif', 'height="17"') . ' alt="" border="0"'; $okTitle = htmlspecialchars($cF ? sprintf($GLOBALS['LANG']->getLL('displayDSContentFound'), strlen($contentSplittedByMapping['cArray'][$key])) . ($multilineTooltips ? ':' . chr(10) . chr(10) . $cF : '') : $GLOBALS['LANG']->getLL('displayDSContentEmpty')); $rowCells['htmlPath'] = t3lib_iconWorks::getSpriteIcon('status-dialog-ok', array('title' => $okTitle)). tx_templavoila_htmlmarkup::getGnyfMarkup($pI['el'], '---' . htmlspecialchars(t3lib_div::fixed_lgd_cs($mappingElement, -80)) ). ($pI['modifier'] ? $pI['modifier'] . ($pI['modifier_value'] ? ':' . ($pI['modifier'] != 'RANGE' ? $pI['modifier_value'] : '...') : '') : ''); $rowCells['htmlPath'] = '<a href="'.$this->linkThisScript(array( 'htmlPath'=>$path.($path?'|':'').preg_replace('/\/[^ ]*$/','',$currentMappingInfo[$key]['MAP_EL']), 'showPathOnly'=>1, 'DS_element' => t3lib_div::_GP('DS_element') )).'">'.$rowCells['htmlPath'].'</a>'; // CMD links, default content: $rowCells['cmdLinks'] = '<span class="nobr"><input type="submit" value="Re-Map" name="_" onclick="document.location=\'' . $this->linkThisScript(array( 'mapElPath' => $formPrefix . '[' . $key . ']', 'htmlPath' => $path, 'mappingToTags' => $value['tx_templavoila']['tags'], 'DS_element' => t3lib_div::_GP('DS_element') )) . '\';return false;" title="' . $GLOBALS['LANG']->getLL('buttonRemapTitle') . '" />' . '<input type="submit" value="' . $GLOBALS['LANG']->getLL('buttonChangeMode') . '" name="_" onclick="document.location=\'' . $this->linkThisScript(array( 'mapElPath' => $formPrefix . '[' . $key . ']', 'htmlPath' => $path . ($path ? '|' :'') . $pI['path'], 'doMappingOfPath' => 1, 'DS_element' => t3lib_div::_GP('DS_element') )) . '\';return false;" title="' . $GLOBALS['LANG']->getLL('buttonChangeMode') . '" /></span>'; // If content mapped ok, set flag: $isMapOK=1; } else { // Issue warning if mapping was lost: $rowCells['htmlPath'] = t3lib_iconWorks::getSpriteIcon('status-dialog-warning', array('title' => $GLOBALS['LANG']->getLL('msgNoContentFound'))) . htmlspecialchars($mappingElement); } } else { // For non-mapped cases, just output a no-break-space: $rowCells['htmlPath'] = ' '; } // CMD links; Content when current element is under mapping, then display control panel or message: if ($this->mapElPath == $formPrefix.'['.$key.']') { if ($this->doMappingOfPath) { // Creating option tags: $lastLevel = end($pathLevels); $tagsMapping = $this->explodeMappingToTagsStr($value['tx_templavoila']['tags']); $mapDat = is_array($tagsMapping[$lastLevel['el']]) ? $tagsMapping[$lastLevel['el']] : $tagsMapping['*']; unset($mapDat['']); if (is_array($mapDat) && !count($mapDat)) unset($mapDat); // Create mapping options: $didSetSel=0; $opt=array(); foreach($optDat as $k => $v) { list($pI) = $this->markupObj->splitPath($k); if (($value['type']=='attr' && $pI['modifier']=='ATTR') || ($value['type']!='attr' && $pI['modifier']!='ATTR')) { if ( (!$this->markupObj->tags[$lastLevel['el']]['single'] || $pI['modifier']!='INNER') && (!is_array($mapDat) || ($pI['modifier']!='ATTR' && isset($mapDat[strtolower($pI['modifier']?$pI['modifier']:'outer')])) || ($pI['modifier']=='ATTR' && (isset($mapDat['attr']['*']) || isset($mapDat['attr'][$pI['modifier_value']])))) ) { if($k==$currentMappingInfo[$key]['MAP_EL']) { $sel = ' selected="selected"'; $didSetSel=1; } else { $sel = ''; } $opt[]='<option value="'.htmlspecialchars($k).'"'.$sel.'>'.htmlspecialchars($v).'</option>'; } } } // Finally, put together the selector box: $rowCells['cmdLinks'] = tx_templavoila_htmlmarkup::getGnyfMarkup($pI['el'], '---' . htmlspecialchars(t3lib_div::fixed_lgd_cs($lastLevel['path'], -80)) ). '<br /><select name="dataMappingForm'.$formPrefix.'['.$key.'][MAP_EL]"> '.implode(' ',$opt).' <option value=""></option> </select> <br /> <input type="submit" name="_save_data_mapping" value="' . $GLOBALS['LANG']->getLL('buttonSet') . '" /> <input type="submit" name="_" value="' . $GLOBALS['LANG']->getLL('buttonCancel') . '" />'; $rowCells['cmdLinks'].= $this->cshItem('xMOD_tx_templavoila','mapping_modeset',$this->doc->backPath,'',FALSE,'margin-bottom: 0px;'); } else { $rowCells['cmdLinks'] = t3lib_iconWorks::getSpriteIcon('status-dialog-notification') . ' <strong>' . $GLOBALS['LANG']->getLL('msgHowToMap') . '</strong>'; $rowCells['cmdLinks'].= '<br /> <input type="submit" value="' . $GLOBALS['LANG']->getLL('buttonCancel') . '" name="_" onclick="document.location=\'' . $this->linkThisScript(array( 'DS_element' => t3lib_div::_GP('DS_element') )) .'\';return false;" />'; } } elseif (!$rowCells['cmdLinks'] && $mapOK && $value['type']!='no_map') { $rowCells['cmdLinks'] = '<input type="submit" value="' . $GLOBALS['LANG']->getLL('buttonMap') . '" name="_" onclick="document.location=\'' . $this->linkThisScript(array( 'mapElPath' => $formPrefix . '[' . $key . ']', 'htmlPath' => $path, 'mappingToTags' => $value['tx_templavoila']['tags'], 'DS_element' => t3lib_div::_GP('DS_element') )) . '\';return false;" />'; } } // Display mapping rules: $rowCells['tagRules'] = implode('<br />', t3lib_div::trimExplode(',', strtolower($value['tx_templavoila']['tags']), 1)); if (!$rowCells['tagRules']) { $rowCells['tagRules'] = $GLOBALS['LANG']->getLL('all'); } // Display edit/delete icons: if ($this->editDataStruct) { $editAddCol = '<a href="' . $this->linkThisScript(array( 'DS_element' => $formPrefix . '[' . $key . ']' )) . '">' . t3lib_iconWorks::getSpriteIcon('actions-document-open', array('title' => $GLOBALS['LANG']->getLL('editEntry'))). '</a> <a href="' . $this->linkThisScript(array( 'DS_element_DELETE' => $formPrefix . '[' . $key . ']' )) . '" onClick="return confirm(' . $GLOBALS['LANG']->JScharCode($GLOBALS['LANG']->getLL('confirmDeleteEntry')) . ');">' . t3lib_iconWorks::getSpriteIcon('actions-edit-delete', array('title' => $GLOBALS['LANG']->getLL('deleteEntry'))). '</a>'; $editAddCol = '<td nowrap="nowrap">' . $editAddCol . '</td>'; } else { $editAddCol = ''; } // Description: if ($this->_preview) { if (!is_array($value['tx_templavoila']['sample_data'])) { $rowCells['description'] = '[' . $GLOBALS['LANG']->getLL('noSampleData') . ']'; } elseif (tx_templavoila_div::convertVersionNumberToInteger(TYPO3_version) < 4005000){ $rowCells['description'] = t3lib_div::view_array($value['tx_templavoila']['sample_data']); } else { $rowCells['description'] = t3lib_utility_Debug::viewArray($value['tx_templavoila']['sample_data']); } } // Getting editing row, if applicable: list($addEditRows, $placeBefore) = $this->dsEdit->drawDataStructureMap_editItem($formPrefix, $key, $value, $level, $rowCells); // Add edit-row if found and destined to be set BEFORE: if ($addEditRows && $placeBefore) { $tRows[]= $addEditRows; } else // Put row together if (!$this->mapElPath || $this->mapElPath == $formPrefix.'['.$key.']') { $tRows[]=' <tr class="' . ($rowIndex % 2 ? 'bgColor4' : 'bgColor6') . '"> <td nowrap="nowrap" valign="top">'.$rowCells['title'].'</td> '.($this->editDataStruct ? '<td nowrap="nowrap">'.$key.'</td>' : '').' <td>'.$rowCells['description'].'</td> '.($mappingMode ? '<td nowrap="nowrap">'.$rowCells['htmlPath'].'</td> <td>'.$rowCells['cmdLinks'].'</td>' : '' ).' <td>'.$rowCells['tagRules'].'</td> '.$editAddCol.' </tr>'; } // Recursive call: if (($value['type']=='array') || ($value['type']=='section')) { $tRows = $this->drawDataStructureMap( $value['el'], $mappingMode, $currentMappingInfo[$key]['el'], $pathLevels, $optDat, $contentSplittedByMapping['sub'][$key], $level+1, $tRows, $formPrefix.'['.$key.'][el]', $path.($path?'|':'').$currentMappingInfo[$key]['MAP_EL'], $isMapOK ); } // Add edit-row if found and destined to be set AFTER: if ($addEditRows && !$placeBefore) { $tRows[]= $addEditRows; } } } } return $tRows; }
/** * Common function for rendering of the Flexible Content / Page Templates. * For Page Templates the input row may be manipulated to contain the proper reference to a data structure (pages can have those inherited which content elements cannot). * * @param array Current data record, either a tt_content element or page record. * @param string Table name, either "pages" or "tt_content". * @return string HTML output. */ function renderElement($row, $table) { global $TYPO3_CONF_VARS; // First prepare user defined objects (if any) for hooks which extend this function: $hookObjectsArr = array(); if (is_array($TYPO3_CONF_VARS['EXTCONF']['templavoila']['pi1']['renderElementClass'])) { foreach ($TYPO3_CONF_VARS['EXTCONF']['templavoila']['pi1']['renderElementClass'] as $classRef) { $hookObjectsArr[] =& t3lib_div::getUserObj($classRef); } } // Hook: renderElement_preProcessRow foreach ($hookObjectsArr as $hookObj) { if (method_exists($hookObj, 'renderElement_preProcessRow')) { $hookObj->renderElement_preProcessRow($row, $table, $this); } } // Get data structure: $srcPointer = $row['tx_templavoila_ds']; if (t3lib_div::testInt($srcPointer)) { // If integer, then its a record we will look up: $DSrec = $GLOBALS['TSFE']->sys_page->checkRecord('tx_templavoila_datastructure', $srcPointer); $DS = t3lib_div::xml2array($DSrec['dataprot']); } else { // Otherwise expect it to be a file: $file = t3lib_div::getFileAbsFileName($srcPointer); if ($file && @is_file($file)) { $DS = t3lib_div::xml2array(t3lib_div::getUrl($file)); } } // If a Data Structure was found: if (is_array($DS)) { // Sheet Selector: if ($DS['meta']['sheetSelector']) { // <meta><sheetSelector> could be something like "EXT:user_extension/class.user_extension_selectsheet.php:&user_extension_selectsheet" $sheetSelector =& t3lib_div::getUserObj($DS['meta']['sheetSelector']); $renderSheet = $sheetSelector->selectSheet(); } else { $renderSheet = 'sDEF'; } // Initialize: $langChildren = $DS['meta']['langChildren'] ? 1 : 0; $langDisabled = $DS['meta']['langDisable'] ? 1 : 0; list($dataStruct, $sheet, $singleSheet) = t3lib_div::resolveSheetDefInDS($DS, $renderSheet); // Data from FlexForm field: $data = t3lib_div::xml2array($row['tx_templavoila_flex']); $lKey = $GLOBALS['TSFE']->sys_language_isocode && !$langDisabled && !$langChildren ? 'l' . $GLOBALS['TSFE']->sys_language_isocode : 'lDEF'; $dataValues = is_array($data['data']) ? $data['data'][$sheet][$lKey] : ''; if (!is_array($dataValues)) { $dataValues = array(); } // Init mark up object. $this->markupObj = t3lib_div::makeInstance('tx_templavoila_htmlmarkup'); $this->markupObj->htmlParse = t3lib_div::makeInstance('t3lib_parsehtml'); // Get template record: if ($row['tx_templavoila_to']) { // Initialize rendering type: if ($this->conf['childTemplate']) { $renderType = $this->conf['childTemplate']; } else { // Default: $renderType = t3lib_div::GPvar('print') ? 'print' : ''; } // Get Template Object record: $TOrec = $this->markupObj->getTemplateRecord($row['tx_templavoila_to'], $renderType, $GLOBALS['TSFE']->sys_language_uid); if (is_array($TOrec)) { // Get mapping information from Template Record: $TO = unserialize($TOrec['templatemapping']); if (is_array($TO)) { // Get local processing: $TOproc = t3lib_div::xml2array($TOrec['localprocessing']); if (!is_array($TOproc)) { $TOproc = array(); } // Processing the data array: if ($GLOBALS['TT']->LR) { $GLOBALS['TT']->push('Processing data'); } $vKey = $GLOBALS['TSFE']->sys_language_isocode && !$langDisabled && $langChildren ? 'v' . $GLOBALS['TSFE']->sys_language_isocode : 'vDEF'; $TOlocalProc = $singleSheet ? $TOproc['ROOT']['el'] : $TOproc['sheets'][$sheet]['ROOT']['el']; $this->processDataValues($dataValues, $dataStruct['ROOT']['el'], $TOlocalProc, $vKey); if ($GLOBALS['TT']->LR) { $GLOBALS['TT']->pull(); } // Merge the processed data into the cached template structure: if ($GLOBALS['TT']->LR) { $GLOBALS['TT']->push('Merge data and TO'); } // Getting the cached mapping data out (if sheets, then default to "sDEF" if no mapping exists for the specified sheet!) $mappingDataBody = $singleSheet ? $TO['MappingData_cached'] : (is_array($TO['MappingData_cached']['sub'][$sheet]) ? $TO['MappingData_cached']['sub'][$sheet] : $TO['MappingData_cached']['sub']['sDEF']); $content = $this->markupObj->mergeFormDataIntoTemplateStructure($dataValues, $mappingDataBody, '', $vKey); $this->markupObj->setHeaderBodyParts($TO['MappingInfo_head'], $TO['MappingData_head_cached'], $TO['BodyTag_cached']); if ($GLOBALS['TT']->LR) { $GLOBALS['TT']->pull(); } // Edit icon (frontend editing): $eIconf = array('styleAttribute' => 'position:absolute;'); if ($table == 'pages') { $eIconf['beforeLastTag'] = -1; } // For "pages", set icon in top, not after. $content = $this->pi_getEditIcon($content, 'tx_templavoila_flex', 'Edit element', $row, $table, $eIconf); // Visual identification aids: if ($GLOBALS['TSFE']->fePreview && $GLOBALS['TSFE']->beUserLogin && !$GLOBALS['TSFE']->workspacePreview && !$this->conf['disableExplosivePreview']) { $content = $this->visualID($content, $srcPointer, $DSrec, $TOrec, $row, $table); } } else { $content = $this->formatError('Template Object could not be unserialized successfully. Are you sure you saved mapping information into Template Object with UID "' . $row['tx_templavoila_to'] . '"?'); } } else { $content = $this->formatError('Couldn\'t find Template Object with UID "' . $row['tx_templavoila_to'] . '". Please make sure a Template Object is accessible.'); } } else { $content = $this->formatError('You haven\'t selected a Template Object yet for table/uid "' . $table . '/' . $row['uid'] . '". Without a Template Object TemplaVoila cannot map the XML content into HTML. Please select a Template Object now.'); } } else { $content = $this->formatError(' Couldn\'t find a Data Structure set for table/row "' . $table . ':' . $row['uid'] . '". Please select a Data Structure and Template Object first.'); } return $content; }