/** * Creating the module output. * * @return void */ function main() { global $LANG, $BACK_PATH; if ($this->id && $this->access) { // Init position map object: $posMap = t3lib_div::makeInstance('ext_posMap'); $posMap->cur_sys_language = $this->sys_language; $posMap->backPath = $BACK_PATH; if ((string) $this->colPos != '') { // If a column is pre-set: if ($this->uid_pid < 0) { $row = array(); $row['uid'] = abs($this->uid_pid); } else { $row = ''; } $this->onClickEvent = $posMap->onClickInsertRecord($row, $this->colPos, '', $this->uid_pid, $this->sys_language); } else { $this->onClickEvent = ''; } // *************************** // Creating content // *************************** // use a wrapper div $this->content .= '<div id="user-setup-wrapper">'; $this->content .= $this->doc->header($LANG->getLL('newContentElement')); $this->content .= $this->doc->spacer(5); // Wizard $code = ''; $wizardItems = $this->getWizardItems(); // Wrapper for wizards $this->elementWrapper['sectionHeader'] = array('<h3 class="divider">', '</h3>'); $this->elementWrapper['section'] = array('<table border="0" cellpadding="1" cellspacing="2">', '</table>'); $this->elementWrapper['wizard'] = array('<tr>', '</tr>'); $this->elementWrapper['wizardPart'] = array('<td>', '</td>'); // copy wrapper for tabs $this->elementWrapperForTabs = $this->elementWrapper; // Hook for manipulating wizardItems, wrapper, onClickEvent etc. if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['cms']['db_new_content_el']['wizardItemsHook'])) { foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['cms']['db_new_content_el']['wizardItemsHook'] as $classData) { $hookObject = t3lib_div::getUserObj($classData); if (!$hookObject instanceof cms_newContentElementWizardsHook) { throw new UnexpectedValueException('$hookObject must implement interface cms_newContentElementWizardItemsHook', 1227834741); } $hookObject->manipulateWizardItems($wizardItems, $this); } } if ($this->config['renderMode'] == 'tabs' && $this->elementWrapperForTabs != $this->elementWrapper) { // restore wrapper for tabs if they are overwritten in hook $this->elementWrapper = $this->elementWrapperForTabs; } // add document inline javascript $this->doc->JScode = $this->doc->wrapScriptTags(' function goToalt_doc() { // ' . $this->onClickEvent . ' } if(top.refreshMenu) { top.refreshMenu(); } else { top.TYPO3ModuleMenu.refreshMenu(); } '); // Traverse items for the wizard. // An item is either a header or an item rendered with a radio button and title/description and icon: $cc = $key = 0; $menuItems = array(); foreach ($wizardItems as $k => $wInfo) { if ($wInfo['header']) { $menuItems[] = array('label' => htmlspecialchars($wInfo['header']), 'content' => $this->elementWrapper['section'][0]); $key = count($menuItems) - 1; } else { $content = ''; // Radio button: $oC = "document.editForm.defValues.value=unescape('" . rawurlencode($wInfo['params']) . "');goToalt_doc();" . (!$this->onClickEvent ? "window.location.hash='#sel2';" : ''); $content .= $this->elementWrapper['wizardPart'][0] . '<input type="radio" name="tempB" value="' . htmlspecialchars($k) . '" onclick="' . htmlspecialchars($this->doc->thisBlur() . $oC) . '" />' . $this->elementWrapper['wizardPart'][1]; // Onclick action for icon/title: $aOnClick = 'document.getElementsByName(\'tempB\')[' . $cc . '].checked=1;' . $this->doc->thisBlur() . $oC . 'return false;'; // Icon: $iInfo = @getimagesize($wInfo['icon']); $content .= $this->elementWrapper['wizardPart'][0] . '<a href="#" onclick="' . htmlspecialchars($aOnClick) . '"> <img' . t3lib_iconWorks::skinImg($this->doc->backPath, $wInfo['icon'], '') . ' alt="" /></a>' . $this->elementWrapper['wizardPart'][1]; // Title + description: $content .= $this->elementWrapper['wizardPart'][0] . '<a href="#" onclick="' . htmlspecialchars($aOnClick) . '"><strong>' . htmlspecialchars($wInfo['title']) . '</strong><br />' . nl2br(htmlspecialchars(trim($wInfo['description']))) . '</a>' . $this->elementWrapper['wizardPart'][1]; // Finally, put it together in a container: $menuItems[$key]['content'] .= $this->elementWrapper['wizard'][0] . $content . $this->elementWrapper['wizard'][1]; $cc++; } } // add closing section-tag foreach ($menuItems as $key => $val) { $menuItems[$key]['content'] .= $this->elementWrapper['section'][1]; } // Add the wizard table to the content, wrapped in tabs: if ($this->config['renderMode'] == 'tabs') { $this->doc->inDocStylesArray[] = ' .typo3-dyntabmenu-divs { background-color: #fafafa; border: 1px solid #adadad; width: 680px; } .typo3-dyntabmenu-divs table { margin: 15px; } .typo3-dyntabmenu-divs table td { padding: 3px; } '; $code = $LANG->getLL('sel1', 1) . '<br /><br />' . $this->doc->getDynTabMenu($menuItems, 'new-content-element-wizard', false, false, 100); } else { $code = $LANG->getLL('sel1', 1) . '<br /><br />'; foreach ($menuItems as $section) { $code .= $this->elementWrapper['sectionHeader'][0] . $section['label'] . $this->elementWrapper['sectionHeader'][1] . $section['content']; } } $this->content .= $this->doc->section(!$this->onClickEvent ? $LANG->getLL('1_selectType') : '', $code, 0, 1); // If the user must also select a column: if (!$this->onClickEvent) { // Add anchor "sel2" $this->content .= $this->doc->section('', '<a name="sel2"></a>'); $this->content .= $this->doc->spacer(20); // Select position $code = $LANG->getLL('sel2', 1) . '<br /><br />'; // Load SHARED page-TSconfig settings and retrieve column list from there, if applicable: $modTSconfig_SHARED = t3lib_BEfunc::getModTSconfig($this->id, 'mod.SHARED'); $colPosList = strcmp(trim($modTSconfig_SHARED['properties']['colPos_list']), '') ? trim($modTSconfig_SHARED['properties']['colPos_list']) : '1,0,2,3'; $colPosList = implode(',', array_unique(t3lib_div::intExplode(',', $colPosList))); // Removing duplicates, if any // Finally, add the content of the column selector to the content: $code .= $posMap->printContentElementColumns($this->id, 0, $colPosList, 1, $this->R_URI); $this->content .= $this->doc->section($LANG->getLL('2_selectPosition'), $code, 0, 1); } // Close wrapper div $this->content .= '</div>'; } else { // In case of no access: $this->content = ''; $this->content .= $this->doc->header($LANG->getLL('newContentElement')); $this->content .= $this->doc->spacer(5); } // Setting up the buttons and markers for docheader $docHeaderButtons = $this->getButtons(); $markers['CSH'] = $docHeaderButtons['csh']; $markers['CONTENT'] = $this->content; // Build the <body> for the module $this->content = $this->doc->startPage($LANG->getLL('newContentElement')); $this->content .= $this->doc->moduleBody($this->pageinfo, $docHeaderButtons, $markers); $this->content .= $this->doc->sectionEnd(); $this->content .= $this->doc->endPage(); $this->content = $this->doc->insertStylesAndJS($this->content); }