/** * Main function. Will generate the information to display for the item * set internally. * * @return void * @todo Define visibility */ public function renderDBInfo() { // Print header, path etc: // @TODO invalid context menu code in the output $code = $this->doc->getHeader($this->table, $this->row, $this->pageinfo['_thePath'], 1) . '<br />'; $this->content .= $this->doc->section('', $code); $tableRows = array(); $extraFields = array('crdate' => $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_general.xml:LGL.creationDate', 1), 'cruser_id' => $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_general.xml:LGL.creationUserId', 1), 'tstamp' => $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_general.xml:LGL.timestamp', 1)); foreach ($extraFields as $name => $value) { $rowValue = \TYPO3\CMS\Backend\Utility\BackendUtility::getProcessedValueExtra($this->table, $name, $this->row[$name]); if ($name === 'cruser_id' && $rowValue) { $userTemp = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows('username, realName', 'be_users', 'uid = ' . intval($rowValue)); if ($userTemp[0]['username'] !== '') { $rowValue = $userTemp[0]['username']; if ($userTemp[0]['realName'] !== '') { $rowValue .= ' - ' . $userTemp[0]['realName']; } } } $tableRows[] = ' <tr> <td class="t3-col-header">' . $value . '</td> <td>' . htmlspecialchars($rowValue) . '</td> </tr>'; } // Traverse the list of fields to display for the record: $fieldList = \TYPO3\CMS\Core\Utility\GeneralUtility::trimExplode(',', $GLOBALS['TCA'][$this->table]['interface']['showRecordFieldList'], 1); foreach ($fieldList as $name) { $name = trim($name); if (!isset($GLOBALS['TCA'][$this->table]['columns'][$name])) { continue; } $isExcluded = !(!$GLOBALS['TCA'][$this->table]['columns'][$name]['exclude'] || $GLOBALS['BE_USER']->check('non_exclude_fields', $this->table . ':' . $name)); if ($isExcluded) { continue; } $uid = $this->row['uid']; $itemValue = \TYPO3\CMS\Backend\Utility\BackendUtility::getProcessedValue($this->table, $name, $this->row[$name], 0, 0, FALSE, $uid); $itemLabel = $GLOBALS['LANG']->sL(\TYPO3\CMS\Backend\Utility\BackendUtility::getItemLabel($this->table, $name), 1); $tableRows[] = ' <tr> <td class="t3-col-header">' . $itemLabel . '</td> <td>' . htmlspecialchars($itemValue) . '</td> </tr>'; } // Create table from the information: $tableCode = ' <table border="0" cellpadding="0" cellspacing="0" id="typo3-showitem" class="t3-table-info"> ' . implode('', $tableRows) . ' </table>'; $this->content .= $this->doc->section('', $tableCode); // Add path and table information in the bottom: $code = ''; $code .= $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xml:labels.path') . ': ' . \TYPO3\CMS\Core\Utility\GeneralUtility::fixed_lgd_cs($this->pageinfo['_thePath'], -48) . '<br />'; $code .= $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xml:labels.table') . ': ' . $GLOBALS['LANG']->sL($GLOBALS['TCA'][$this->table]['ctrl']['title']) . ' (' . $this->table . ') - UID: ' . $this->uid . '<br />'; $this->content .= $this->doc->section('', $code); // References: $this->content .= $this->doc->section($GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xml:show_item.php.referencesToThisItem'), $this->makeRef($this->table, $this->row['uid'])); $this->content .= $this->doc->section($GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xml:show_item.php.referencesFromThisItem'), $this->makeRefFrom($this->table, $this->row['uid'])); }
/** * Render page title with icon, table title and record title * * @return string */ protected function renderPageTitle() { if ($this->type === 'folder') { $table = $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_common.xlf:folder'); $title = $this->doc->getResourceHeader($this->folderObject, array(' ', ''), FALSE); } elseif ($this->type === 'file') { $table = $GLOBALS['LANG']->sL($GLOBALS['TCA'][$this->table]['ctrl']['title']); $title = $this->doc->getResourceHeader($this->fileObject, array(' ', ''), FALSE); } else { $table = $GLOBALS['LANG']->sL($GLOBALS['TCA'][$this->table]['ctrl']['title']); $title = $this->doc->getHeader($this->table, $this->row, $this->pageinfo['_thePath'], 1, array(' ', ''), FALSE); } return '<h1>' . ($table ? '<small>' . $table . '</small><br />' : '') . $title . '</h1>'; }
/** * Render page title with icon, table title and record title * * @return string */ protected function renderPageTitle() { if ($this->type === 'folder') { $table = $this->getLanguageService()->sL('LLL:EXT:lang/locallang_common.xlf:folder'); $title = $this->doc->getResourceHeader($this->folderObject, array(' ', ''), false); } elseif ($this->type === 'file') { $table = $this->getLanguageService()->sL($GLOBALS['TCA'][$this->table]['ctrl']['title']); $title = $this->doc->getResourceHeader($this->fileObject, array(' ', ''), false); } else { $table = $this->getLanguageService()->sL($GLOBALS['TCA'][$this->table]['ctrl']['title']); $title = $this->doc->getHeader($this->table, $this->row, $this->pageInfo['_thePath'], 1, array(' ', ''), false); } // Set HTML title tag $this->titleTag = $table . ': ' . strip_tags(BackendUtility::getRecordTitle($this->table, $this->row)); return '<h1>' . ($table ? '<small>' . $table . '</small><br />' : '') . $title . '</h1>'; }
/** * Main function of the module. Write the content to $this->content * If you chose "web" as main module, you will need to consider the $this->id parameter which will contain the uid-number of the page clicked in the page tree * @return [type] ... */ function main() { global $BE_USER, $LANG, $BACK_PATH, $TCA_DESCR, $TCA, $CLIENT, $TYPO3_CONF_VARS; // Access check! // The page will show only if there is a valid page and if this page may be viewed by the user $this->pageinfo = \TYPO3\CMS\Backend\Utility\BackendUtility::readPageAccess($this->id, $this->perms_clause); $access = is_array($this->pageinfo) ? 1 : 0; if ($this->id && $access || $BE_USER->user['admin'] && !$this->id) { $full_script_path = \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath('multishop') . 'scripts/'; $this->relative_site_path = \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::siteRelPath('multishop'); // first get the http-path to typo3: $this->httpTypo3Path = substr(substr(\TYPO3\CMS\Core\Utility\GeneralUtility::getIndpEnv('TYPO3_SITE_URL'), strlen(\TYPO3\CMS\Core\Utility\GeneralUtility::getIndpEnv('TYPO3_REQUEST_HOST'))), 0, -1); if (strlen($this->httpTypo3Path) == 1) { $this->httpTypo3Path = '/'; } else { $this->httpTypo3Path .= '/'; } // Get the vhost full path (example: /var/www/html/domain.com/public_html/my_cms/) $this->DOCUMENT_ROOT = PATH_site; // Get the vhost full path to multishop (example: /var/www/html/domain.com/public_html/my_cms/typo3conf/ext/multishop/) $this->DOCUMENT_ROOT_MS = PATH_site . \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::siteRelPath('multishop'); // Get the site full URL (example: http://domain.com/my_cms/) $this->FULL_HTTP_URL = \TYPO3\CMS\Core\Utility\GeneralUtility::getIndpEnv('TYPO3_SITE_URL'); // Get the multishop full URL (example: http://domain.com/my_cms/typo3/ext/multishop or http://domain.com/my_cms/typo3conf/ext/multishop) $this->FULL_HTTP_URL_MS = \TYPO3\CMS\Core\Utility\GeneralUtility::getIndpEnv('TYPO3_SITE_URL') . \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::siteRelPath('multishop'); // Get the host URL (example: http://domain.com) // dont use hostURL cause its not supporting subdirectory hosting $this->hostURL = \TYPO3\CMS\Core\Utility\GeneralUtility::getIndpEnv('TYPO3_REQUEST_HOST'); // Draw the header. $this->doc = GeneralUtility::makeInstance('TYPO3\\CMS\\Backend\\Template\\DocumentTemplate'); //$this->doc->setModuleTemplate(ExtensionManagementUtility::extPath($this->extKey) . 'mod1/mod_template.html'); $this->doc->backPath = $GLOBALS['BACK_PATH']; //$this->doc= \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('bigDoc'); //$this->doc->backPath=$BACK_PATH; // JavaScript $this->doc->JScode = ' <style type="text/css"> /*<![CDATA[*/ <!-- /*inDocStyles*/ /*###POSTCSSMARKER###*/ --> /*]]>*/ .shadow_bottom { overflow:hidden; width:100%; background:url(' . $this->FULL_HTTP_URL_MS . 'mod1/images/shadow_bottom.png) left bottom no-repeat; padding:0 0 35px; } fieldset { display:block; border:1px solid #999; background:#fff; margin:10px 0 0; padding:10px 10px 10px; } fieldset legend { background:#585858; color:#fff; font-family:Verdana,Arial,Helvetica,sans-serif; font-size:11px; padding:2px 4px; } fieldset legend a { color:#fff; } fieldset legend a:hover { color:#fff; text-decoration:underline; } ul { list-style:none; margin:0; padding:0; } a.buttons, a.buttons_db { -moz-border-radius:1px 1px 1px 1px; BACKGROUND-IMAGE: url(' . $this->FULL_HTTP_URL . 'typo3/sysext/t3skin/images/backgrounds/button.png); background-color:#F6F6F6; background-image:-moz-linear-gradient(center top , #F6F6F6 10%, #D5D5D5 90%); background-position:center bottom; background-repeat:repeat-x; border:1px solid #7C7C7C; color:#434343; display:block; padding:2px 4px; text-align:center; font-family:Verdana,Arial,Helvetica,sans-serif; font-size:11px; line-height:16px; } a.buttons:hover, a.buttons_db:hover { BACKGROUND-IMAGE: url(' . $this->FULL_HTTP_URL . 'typo3/sysext/t3skin/images/backgrounds/button-hover.png); background-color:#C8C8C8; background-image:-moz-linear-gradient(center top , #F6F6F6 10%, #BDBCBC 90%); background-position:center bottom; background-repeat:repeat-x; border:1px solid #737F91; color:#1E1E1E; } a.buttons { width:142px; } a.buttons_db { width:126px; } fieldset.mod1MultishopFieldset ul { overflow:hidden; width:100%; } fieldset.mod1MultishopFieldset ul li { float:left; margin:0 10px 0 0; } </style> <!--[if IE]> <style> fieldset { position: relative; padding-top:15px; margin:20px 0 0; } legend { position: absolute; top: -10px; left: 10px; } </style> <![endif]--> <script language="javascript" type="text/javascript"> script_ended = 0; function jumpToUrl(URL) { document.location = URL; } function CONFIRM(label) { if (confirm(label)) { return true; } else { return false; } } </script> '; $this->doc->postCode = ' <script language="javascript" type="text/javascript"> script_ended = 1; if (top.fsMod) top.fsMod.recentIds["web"] = 0; </script> '; $headerSection = $this->doc->getHeader('pages', $this->pageinfo, $this->pageinfo['_thePath']) . '<br />' . $LANG->sL('LLL:EXT:lang/locallang_core.xml:labels.path') . ': ' . \TYPO3\CMS\Core\Utility\GeneralUtility::fixed_lgd_cs($this->pageinfo['_thePath'], 50); $this->content .= $this->doc->startPage($LANG->getLL('title')); $this->content .= $this->doc->header($LANG->getLL('title')); $this->content .= $this->doc->spacer(5); $this->content .= $this->doc->section('', $this->doc->funcMenu($headerSection, \TYPO3\CMS\Backend\Utility\BackendUtility::getFuncMenu($this->id, 'SET[function]', $this->MOD_SETTINGS['function'], $this->MOD_MENU['function']))); $this->content .= $this->doc->divider(5); // Render content: $this->moduleContent(); // ShortCut if ($BE_USER->mayMakeShortcut()) { $this->content .= $this->doc->spacer(20) . $this->doc->section('', $this->doc->makeShortcutIcon('id', implode(',', array_keys($this->MOD_MENU)), $this->MCONF['name'])); } $this->content .= $this->doc->spacer(10); } else { // If no access or if ID == zero $this->doc = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('mediumDoc'); $this->doc->backPath = $BACK_PATH; $this->content .= $this->doc->startPage($LANG->getLL('title')); $this->content .= $this->doc->header($LANG->getLL('title')); $this->content .= $this->doc->spacer(5); $this->content .= $this->doc->spacer(10); } }
/** * Main processing, creating the list of new record tables to select from * * @return void */ public function main() { $backendUser = $this->getBackendUser(); $language = $this->getLanguageService(); // If there was a page - or if the user is admin // (admins has access to the root) we proceed: if ($this->pageinfo['uid'] || $backendUser->isAdmin()) { // Acquiring TSconfig for this module/current page: $this->web_list_modTSconfig = \TYPO3\CMS\Backend\Utility\BackendUtility::getModTSconfig($this->pageinfo['uid'], 'mod.web_list'); $this->allowedNewTables = \TYPO3\CMS\Core\Utility\GeneralUtility::trimExplode(',', $this->web_list_modTSconfig['properties']['allowedNewTables'], 1); // Acquiring TSconfig for this module/parent page: $this->web_list_modTSconfig_pid = \TYPO3\CMS\Backend\Utility\BackendUtility::getModTSconfig($this->pageinfo['pid'], 'mod.web_list'); $this->allowedNewTables_pid = \TYPO3\CMS\Core\Utility\GeneralUtility::trimExplode(',', $this->web_list_modTSconfig_pid['properties']['allowedNewTables'], 1); // Set header-HTML and return_url $this->code = $this->doc->getHeader('pages', $this->pageinfo, $this->pageinfo['_thePath']) . '<br /> '; $this->regularNew(); // Create go-back link. if ($this->returnUrl) { $this->code .= '<br /> <a href="' . htmlspecialchars($this->returnUrl) . '" class="typo3-goBack">' . \TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIcon('actions-view-go-back', array('title' => $language->getLL('goBack', 1))) . '</a>'; } // Add all the content to an output section $this->content .= $this->doc->section('', $this->code); } $this->content .= $this->doc->endPage(); }