/** * Main function * * @param [type] $$backRef: ... * @param [type] $menuItems: ... * @param [type] $table: ... * @param [type] $uid: ... * @return [type] ... */ function main(&$backRef, $menuItems, $table, $uid) { global $BE_USER, $TCA, $LANG; $localItems = array(); if (!$backRef->cmLevel) { // Returns directly, because the clicked item was not from the pages table if ($table == "tx_l10nmgr_cfg") { // Adds the regular item: $LL = $this->includeLL(); // Repeat this (below) for as many items you want to add! // Remember to add entries in the localconf.php file for additional titles. $url = ExtensionManagementUtility::extRelPath("l10nmgr") . "cm1/index.php?id=" . $uid; $localItems[] = $backRef->linkItem($GLOBALS["LANG"]->getLLL("cm1_title", $LL), $backRef->excludeIcon('<img src="' . ExtensionManagementUtility::extRelPath("l10nmgr") . 'cm1/cm_icon.gif" width="15" height="12" border="0" align="top" />'), $backRef->urlRefForCM($url), 1); } $localItems["moreoptions_tx_l10nmgr_cm3"] = $backRef->linkItem('L10Nmgr tools', '', "top.loadTopMenu('" . GeneralUtility::linkThisScript() . "&cmLevel=1&subname=moreoptions_tx_l10nmgrXX_cm3');return false;", 0, 1); // Simply merges the two arrays together and returns ... $menuItems = array_merge($menuItems, $localItems); } elseif (GeneralUtility::_GET('subname') == 'moreoptions_tx_l10nmgrXX_cm3') { $url = ExtensionManagementUtility::extRelPath("l10nmgr") . "cm3/index.php?id=" . $uid . '&table=' . $table; $localItems[] = $backRef->linkItem('Create priority', '', $backRef->urlRefForCM($url . '&cmd=createPriority'), 1); $localItems[] = $backRef->linkItem('Manage priorities', '', $backRef->urlRefForCM($url . '&cmd=managePriorities'), 1); $localItems[] = $backRef->linkItem('Update Index', '', $backRef->urlRefForCM($url . '&cmd=updateIndex'), 1); $localItems[] = $backRef->linkItem('Flush Translations', '', $backRef->urlRefForCM($url . '&cmd=flushTranslations'), 1); $menuItems = array_merge($menuItems, $localItems); } return $menuItems; }
/** * Add return unl * * @param array $result * @return array */ public function addData(array $result) { if ($result['returnUrl'] === null) { $result['returnUrl'] = GeneralUtility::linkThisScript(); } return $result; }
/** * @param \TYPO3\CMS\Beuser\Domain\Model\BackendUser $backendUser Target backendUser to switch active session to * @param boolean $emulate Return to current session or logout after target session termination? * @return string */ public function render(\TYPO3\CMS\Beuser\Domain\Model\BackendUser $backendUser, $emulate = FALSE) { if ($backendUser->getUid() == $GLOBALS['BE_USER']->user['uid']) { return ''; } $title = \TYPO3\CMS\Extbase\Utility\LocalizationUtility::translate($emulate ? 'switchBackMode' : 'changeToMode', 'beuser'); return '<a href="' . \TYPO3\CMS\Core\Utility\GeneralUtility::linkThisScript(array('SwitchUser' => $backendUser->getUid(), 'switchBackUser' => $emulate)) . '" target="_top" title="' . htmlspecialchars($title) . '">' . \TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIcon('actions-system-backend-user-' . ($emulate ? 'emulate' : 'switch')) . '</a>'; }
/** * @param \TYPO3\CMS\Beuser\Domain\Model\BackendUser $backendUser Target backendUser to switch active session to * @param boolean $emulate Return to current session or logout after target session termination? * @return string */ public function render(\TYPO3\CMS\Beuser\Domain\Model\BackendUser $backendUser, $emulate = FALSE) { if ($backendUser->getIsAdministrator()) { return ''; } $title = $GLOBALS['LANG']->getLL('switchUserTo', TRUE) . ' ' . $backendUser->getUserName() . ' ' . $GLOBALS['LANG']->getLL('switchBackMode', TRUE); return '<a href="' . \TYPO3\CMS\Core\Utility\GeneralUtility::linkThisScript(array('SwitchUser' => $backendUser->getUid(), 'switchBackUser' => $emulate)) . '" target="_top" title="' . htmlspecialchars($title) . '">' . \TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIcon('actions-system-backend-user-' . ($emulate ? 'emulate' : 'switch')) . '</a>'; }
/** * Creates the version selector for the page id inputted. * Moved out of the core file \TYPO3\CMS\Backend\Template\DocumentTemplate * * @param int $id Page id to create selector for. * @param bool $noAction If set, there will be no button for swapping page. * @return void * @see \TYPO3\CMS\Backend\Template\DocumentTemplate */ public function getVersionSelector($id, $noAction = FALSE) { if ($id <= 0) { return; } if ($GLOBALS['BE_USER']->workspace == 0) { // Get Current page record: $curPage = \TYPO3\CMS\Backend\Utility\BackendUtility::getRecord('pages', $id); // If the selected page is not online, find the right ID $onlineId = $curPage['pid'] == -1 ? $curPage['t3ver_oid'] : $id; // Select all versions of online version: $versions = \TYPO3\CMS\Backend\Utility\BackendUtility::selectVersionsOfRecord('pages', $onlineId, 'uid,pid,t3ver_label,t3ver_oid,t3ver_wsid,t3ver_id'); // If more than one was found...: if (count($versions) > 1) { $selectorLabel = '<strong>' . $GLOBALS['LANG']->sL('LLL:EXT:version/locallang.xlf:versionSelect.label', TRUE) . '</strong>'; // Create selector box entries: $opt = array(); foreach ($versions as $vRow) { if ($vRow['uid'] == $onlineId) { // Live version $label = '[' . $GLOBALS['LANG']->sL('LLL:EXT:version/locallang.xlf:versionSelect.live', TRUE) . ']'; } else { $label = $vRow['t3ver_label'] . ' (' . $GLOBALS['LANG']->sL('LLL:EXT:version/locallang.xlf:versionId', TRUE) . ' ' . $vRow['t3ver_id'] . ($vRow['t3ver_wsid'] != 0 ? ' ' . $GLOBALS['LANG']->sL('LLL:EXT:version/locallang.xlf:workspaceId', TRUE) . ' ' . $vRow['t3ver_wsid'] : '') . ')'; } $opt[] = '<option value="' . htmlspecialchars(GeneralUtility::linkThisScript(array('id' => $vRow['uid']))) . '"' . ($id == $vRow['uid'] ? ' selected="selected"' : '') . '>' . htmlspecialchars($label) . '</option>'; } // Add management link: $management = '<input type="button" value="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:ver.mgm', TRUE) . '" onclick="window.location.href=\'' . htmlspecialchars($GLOBALS['BACK_PATH'] . \TYPO3\CMS\Backend\Utility\BackendUtility::getModuleUrl('web_txversionM1', array('table' => 'pages', 'uid' => $onlineId))) . '\';" />'; // Create onchange handler: $onChange = 'window.location.href=this.options[this.selectedIndex].value;'; // Controls: if ($id == $onlineId) { $controls = '<img' . \TYPO3\CMS\Backend\Utility\IconUtility::skinImg($GLOBALS['BACK_PATH'], 'gfx/blinkarrow_left.gif', 'width="5" height="9"') . ' class="absmiddle" alt="" /> <strong>' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:ver.online', TRUE) . '</strong>'; } elseif (!$noAction) { $href = $GLOBALS['TBE_TEMPLATE']->issueCommand('&cmd[pages][' . $onlineId . '][version][swapWith]=' . $id . '&cmd[pages][' . $onlineId . '][version][action]=swap', GeneralUtility::linkThisScript(array('id' => $onlineId))); $controls = '<a href="' . htmlspecialchars($href) . '" class="text-nowrap">' . \TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIcon('actions-version-swap-version', array('title' => $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:ver.swapPage', TRUE), 'style' => 'margin-left:5px;vertical-align:bottom;')) . '<strong>' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:ver.swap', TRUE) . '</strong></a>'; } // Write out HTML code: return ' <!-- Version selector: --> <table border="0" cellpadding="0" cellspacing="0" id="typo3-versionSelector"> <tr> <td>' . $selectorLabel . '</td> <td> <select onchange="' . htmlspecialchars($onChange) . '"> ' . implode('', $opt) . ' </select></td> <td>' . $controls . '</td> <td>' . $management . '</td> </tr> </table> '; } } }
/** * Render warning * * @return string */ protected function renderWarning() { $action = GeneralUtility::linkThisScript(array('M' => GeneralUtility::_GP('M'), 'tx_extensionmanager_tools_extensionmanagerextensionmanager' => GeneralUtility::_GP('tx_extensionmanager_tools_extensionmanagerextensionmanager'))); $content = sprintf('</br>Do you want to start the migration?</br> <form action="%1$s" method="POST"> <button name="tx_storefinder_update[confirm]" value="1">Start migration</button> </form>', $action); return $content; }
/** * @param array $arguments * @param callable $renderChildrenClosure * @param RenderingContextInterface $renderingContext * * @return string */ public static function renderStatic(array $arguments, \Closure $renderChildrenClosure, RenderingContextInterface $renderingContext) { $backendUser = $arguments['backendUser']; if ($backendUser->getUid() == $GLOBALS['BE_USER']->user['uid'] || !$backendUser->isActive()) { return '<span class="btn btn-default disabled">' . IconUtility::getSpriteIcon('empty-empty') . '</span>'; } $title = LocalizationUtility::translate('switchBackMode', 'beuser'); return '<a class="btn btn-default" href="' . htmlspecialchars(GeneralUtility::linkThisScript(array('SwitchUser' => $backendUser->getUid()))) . '" target="_top" title="' . htmlspecialchars($title) . '">' . IconUtility::getSpriteIcon('actions-system-backend-user-switch') . '</a>'; }
/** * Render link with sprite icon to change current backend user to target * * @param array $arguments * @param \Closure $renderChildrenClosure * @param RenderingContextInterface $renderingContext * * @return string */ public static function renderStatic(array $arguments, \Closure $renderChildrenClosure, RenderingContextInterface $renderingContext) { $backendUser = $arguments['backendUser']; $iconFactory = GeneralUtility::makeInstance(IconFactory::class); if ($backendUser->getUid() == $GLOBALS['BE_USER']->user['uid'] || !$backendUser->isActive() || $GLOBALS['BE_USER']->user['ses_backuserid']) { return '<span class="btn btn-default disabled">' . $iconFactory->getIcon('empty-empty', Icon::SIZE_SMALL)->render() . '</span>'; } $title = LocalizationUtility::translate('switchBackMode', 'beuser'); return '<a class="btn btn-default" href="' . htmlspecialchars(GeneralUtility::linkThisScript(['SwitchUser' => $backendUser->getUid()])) . '" target="_top" title="' . htmlspecialchars($title) . '">' . $iconFactory->getIcon('actions-system-backend-user-switch', Icon::SIZE_SMALL)->render() . '</a>'; }
/** * Initialization of the class * * @return void */ protected function init() { // Setting GPvars: $this->P = GeneralUtility::_GP('P'); $this->popView = GeneralUtility::_GP('popView'); $this->R_URI = GeneralUtility::linkThisScript(array('popView' => '')); // "Module name": $this->MCONF['name'] = 'wizard_rte'; // Need to NOT have the page wrapped in DIV since if we do that we destroy // the feature that the RTE spans the whole height of the page!!! }
/** * Initialization of the class * * @return void */ protected function init() { // Setting GPvars: $this->P = GeneralUtility::_GP('P'); $this->popView = GeneralUtility::_GP('popView'); $this->R_URI = GeneralUtility::linkThisScript(array('popView' => '')); // "Module name": $this->MCONF['name'] = 'wizard_rte'; // Need to NOT have the page wrapped in DIV since if we do that we destroy // the feature that the RTE spans the whole height of the page!!! $this->moduleTemplate->setForm('<form action="' . htmlspecialchars(BackendUtility::getModuleUrl('tce_db')) . '" method="post" enctype="multipart/form-data" name="editform" ' . ' onsubmit="return TBE_EDITOR.checkSubmit(1);">'); }
/** * Main function, returning the HTML content of the module * * @return string HTML */ public function main() { $onclick = 'document.forms[\'pageform\'].action = \'' . GeneralUtility::linkThisScript(array()) . '\';document.forms[\'pageform\'].submit();return false;'; $content = ''; $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('uid, pid, name', 'tt_address', 'name != \'\' AND deleted = 0', '', 'uid'); $hasAddressgroups = FALSE; if (\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::isLoaded('addressgroups')) { $hasAddressgroups = TRUE; $groupRes = $GLOBALS['TYPO3_DB']->exec_SELECTquery('*', 'tx_addressgroups_group', 'title != \'\' AND deleted = 0'); $contentRes = $GLOBALS['TYPO3_DB']->exec_SELECTquery('uid, list_type', 'tt_content', 'list_type = \'addressgroups_pi1\' AND deleted = 0'); } if (!GeneralUtility::_GP('do_update')) { // init $count = $GLOBALS['TYPO3_DB']->sql_num_rows($res); $content .= '<p>' . $count . ' address records found.</p>'; if ($hasAddressgroups) { $groupCount = $GLOBALS['TYPO3_DB']->sql_num_rows($groupRes); $contentCount = $GLOBALS['TYPO3_DB']->sql_num_rows($contentRes); $content .= '<p>Additionally ' . $groupCount . ' groups from EXT:addresgroups and ' . $contentCount . ' plugin content elements were found.</p>'; } $content .= '<br />'; $content .= '<input type="hidden" name="do_update" value="1"/>'; $content .= '<input type="button" value="UPDATE!" style="color: #fff; background-color: #f00;" onclick="' . $onclick . '" />'; } else { $updateCount = 0; $groupUpdateCount = 0; $groupRelUpdateCount = 0; $contentUpdateCount = 0; // do the update if ($hasAddressgroups) { while ($groupRow = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($groupRes)) { // could easily be done with a INSERT INTO ... SELECT FROM ... but I don't know how this would work with DBAL $GLOBALS['TYPO3_DB']->exec_INSERTquery('tt_address_group', $groupRow); $groupUpdateCount++; } $relRows = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows('*', 'tt_address_tx_addressgroups_group_mm', '1 = 1'); foreach ($relRows as $relRow) { $GLOBALS['TYPO3_DB']->exec_INSERTquery('tt_address_group_mm', $relRow); $groupRelUpdateCount++; } $contentPlugins = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows('uid, list_type', 'tt_content', 'list_type = \'addressgroups_pi1\' AND deleted = 0'); foreach ($contentPlugins as $contentPlugin) { $GLOBALS['TYPO3_DB']->exec_UPDATEquery('tt_content', 'uid = ' . $contentPlugin['uid'], array('list_type' => 'tt_address_pi1')); $contentUpdateCount++; } } if ($hasAddressgroups) { $content .= '<br /><strong>' . $groupUpdateCount . ' group records and ' . $groupRelUpdateCount . ' relations updated.'; $content .= '<br />' . $contentUpdateCount . ' address plugin content elements updated.</strong>'; } } return $content; }
/** * Main function, returning the HTML content of the module * * @return string HTML */ function main() { $GLOBALS['LANG']->includeLLFile('EXT:direct_mail/Resources/Private/Language/locallang_mod2-6.xml'); $content = $this->displayWarning(); if (!GeneralUtility::_GP('do_update')) { $onClick = "document.location='" . GeneralUtility::linkThisScript(array('do_update' => 1)) . "'; return false;"; $content .= htmlspecialchars($GLOBALS['LANG']->getLL('update_convert_now')) . ' <br /><br /> <form action=""><input type="submit" value="' . htmlspecialchars($GLOBALS['LANG']->getLL('update_convert_do_it_now')) . '" onclick="' . htmlspecialchars($onClick) . '"></form> '; } else { $updated = $this->convertTable(); $content .= sprintf($GLOBALS['LANG']->getLL('update_convert_result'), $updated); } return $content; }
/** * Main function, returning the HTML content of the module * * @return string HTML */ public function main() { $content = array(); $content[] = '<h3>' . LocalizationUtility::translate('update.upgradeTo6', 'SrLanguageMenu') . '</h3>'; if (GeneralUtility::_GP('proceed')) { $content[] = $this->updatePluginInstances(); $content[] = $this->updateTsTemplates(); $content[] = '<p>' . LocalizationUtility::translate('update.pleaseRead', 'SrLanguageMenu') . '</p>'; } else { $linkThisScript = GeneralUtility::linkThisScript(); $content[] = '<form name="sr_language_menu_ext_update_form" action="' . $linkThisScript . '" method="post">'; $content[] = '<p><strong>' . LocalizationUtility::translate('update.warning', 'SrLanguageMenu') . '</strong><br />' . LocalizationUtility::translate('update.changesToDatabase', 'SrLanguageMenu') . '</p>'; $content[] = '<input type="submit" name="proceed" value="' . LocalizationUtility::translate('update.update', 'SrLanguageMenu') . '" onclick="this.form.action=\'' . GeneralUtility::slashJS($linkThisScript) . '\';submit();" />'; $content[] = '</form>'; } return implode(LF, $content); }
/** * Initialization of the class * * @return void */ protected function init() { // Setting GPvars: $this->P = GeneralUtility::_GP('P'); $this->popView = GeneralUtility::_GP('popView'); $this->R_URI = GeneralUtility::linkThisScript(array('popView' => '')); // "Module name": $this->MCONF['name'] = 'wizard_rte'; // Starting the document template object: $this->doc = GeneralUtility::makeInstance(DocumentTemplate::class); $this->doc->backPath = $this->getBackPath(); $this->doc->setModuleTemplate('EXT:backend/Resources/Private/Templates/wizard_rte.html'); // Need to NOT have the page wrapped in DIV since if we do that we destroy // the feature that the RTE spans the whole height of the page!!! $this->doc->divClass = ''; $this->doc->form = '<form action="' . htmlspecialchars(BackendUtility::getModuleUrl('tce_db')) . '" method="post" enctype="' . $GLOBALS['TYPO3_CONF_VARS']['SYS']['form_enctype'] . '" name="editform" onsubmit="return TBE_EDITOR.checkSubmit(1);">'; }
/** * Initialization of the class * * @return void * @todo Define visibility */ public function init() { // Setting GPvars: $this->P = \TYPO3\CMS\Core\Utility\GeneralUtility::_GP('P'); $this->popView = \TYPO3\CMS\Core\Utility\GeneralUtility::_GP('popView'); $this->R_URI = \TYPO3\CMS\Core\Utility\GeneralUtility::linkThisScript(array('popView' => '')); // "Module name": $this->MCONF['name'] = 'xMOD_wizard_rte.php'; // Starting the document template object: $this->doc = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Backend\\Template\\DocumentTemplate'); $this->doc->backPath = $GLOBALS['BACK_PATH']; $this->doc->setModuleTemplate('templates/wizard_rte.html'); // Need to NOT have the page wrapped in DIV since if we do that we destroy // the feature that the RTE spans the whole height of the page!!! $this->doc->divClass = ''; $this->doc->form = '<form action="tce_db.php" method="post" enctype="' . $GLOBALS['TYPO3_CONF_VARS']['SYS']['form_enctype'] . '" name="editform" onsubmit="return TBE_EDITOR.checkSubmit(1);">'; }
/** * The main function. Executes all updates. * @return string The update process output. */ function main() { if (\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('do_update') == 'htaccess') { $this->removeHtaccessFromUploadFolder(); } $content = ''; foreach ($this->action as $action) { if ($action == 'rename_tables') { $content .= $this->renameTables(); } } if ($this->hasHtaccessFile()) { $content .= '<a href="' . \TYPO3\CMS\Core\Utility\GeneralUtility::linkThisScript(array('do_update' => 'htaccess')) . '">Remove .htaccess file in upload dir<img style="vertical-align:bottom;" ' . \TYPO3\CMS\Backend\Utility\IconUtility::skinImg($GLOBALS['BACK_PATH'], 'gfx/refresh_n.gif', 'width="18" height="16"') . '></a><br>'; } if ($content == '') { $content = 'Nothing to update!'; } return $content; }
/** * Adds a red "+" to the input string, $str, if the field "php_tree_stop" in the $row (pages) is set * * @param string $str Input string, like a page title for the tree * @param array $row Record row with "php_tree_stop" field * @return string Modified string * @access private */ public function wrapStop($str, $row) { if ($row['php_tree_stop']) { $str .= '<a href="' . htmlspecialchars(GeneralUtility::linkThisScript(array('setTempDBmount' => $row['uid']))) . '" class="typo3-red">+</a> '; } return $str; }
/** * Get the list * * @param array $pArray * @param array $lines * @param int $c * @return array */ public function renderList($pArray, $lines = [], $c = 0) { if (!is_array($pArray)) { return $lines; } $statusCheckedIcon = $this->moduleTemplate->getIconFactory()->getIcon('status-status-checked', Icon::SIZE_SMALL)->render(); $i = 0; foreach ($pArray as $k => $v) { if (MathUtility::canBeInterpretedAsInteger($k)) { $line = []; $key = $k . '_'; $line['marginLeft'] = $c * 20; $line['class'] = $i++ % 2 === 0 ? 'bgColor4' : 'bgColor6'; $line['pageTitle'] = GeneralUtility::fixed_lgd_cs($pArray[$k], 30); $line['icon'] = $this->moduleTemplate->getIconFactory()->getIconForRecord('pages', BackendUtility::getRecordWSOL('pages', $k), Icon::SIZE_SMALL)->render(); if (!empty($pArray[$key])) { $line['href'] = GeneralUtility::linkThisScript(['id' => (int) $k]); $line['title'] = 'ID: ' . (int) $k; $line['count'] = $pArray[$k . '_']['count']; $line['root_max_val'] = $pArray[$key]['root_max_val'] > 0 ? $statusCheckedIcon : ' '; $line['root_min_val'] = $pArray[$key]['root_min_val'] === 0 ? $statusCheckedIcon : ' '; } else { $line['href'] = ''; $line['title'] = ''; $line['count'] = ''; $line['root_max_val'] = ''; $line['root_min_val'] = ''; } $lines[] = $line; $lines = $this->renderList($pArray[$k . '.'], $lines, $c + 1); } } return $lines; }
/** * Returns list URL; This is the URL of the current script with id and imagemode parameters, that's all. * The URL however is not relative (with the backpath), otherwise GeneralUtility::sanitizeLocalUrl() would say that * the URL would be invalid * * @return string URL */ public function listURL() { return GeneralUtility::linkThisScript(array('target' => rawurlencode($this->folderObject->getCombinedIdentifier()), 'imagemode' => $this->thumbs)); }
/** * Check if a temporary tree mount is set and return a cancel button * * @return string */ protected function getTemporaryTreeMountCancelNotice() { if ((int) $GLOBALS['BE_USER']->getSessionData('pageTree_temporaryMountPoint') === 0) { return ''; } $link = '<a href="' . htmlspecialchars(GeneralUtility::linkThisScript(array('setTempDBmount' => 0))) . '">' . $GLOBALS['LANG']->sl('LLL:EXT:lang/locallang_core.xlf:labels.temporaryDBmount', TRUE) . '</a>'; /** @var \TYPO3\CMS\Core\Messaging\FlashMessage $flashMessage */ $flashMessage = GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Messaging\\FlashMessage', $link, '', \TYPO3\CMS\Core\Messaging\FlashMessage::INFO); return $flashMessage->render(); }
/** * Wrapping page title. * * @param string $str Page title. * @param array $rec Page record (?) * @return string Wrapped title. */ public function linkPageTitle($str, $rec) { $url = \TYPO3\CMS\Core\Utility\GeneralUtility::linkThisScript(array('uid' => (int) $rec['uid'], 'moveUid' => $GLOBALS['SOBE']->moveUid)); return '<a href="' . htmlspecialchars($url) . '">' . $str . '</a>'; }
/** * Returns a new tab for the browse links wizard * Returns the 'media' tab to the RTE link browser * * @param string current link selector action * @return string a tab for the selected link action */ public function getTab($linkSelectorAction) { // Only return content if the media tab was called. if ($linkSelectorAction !== 'jfmulticontent') { return FALSE; } $this->browseLinks = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('tx_rtehtmlarea_browse_links'); $this->browseLinks->init(); $content .= $this->browseLinks->addAttributesForm(); $pagetree = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('tx_rtehtmlarea_pageTree'); $pagetree->ext_showNavTitle = $GLOBALS['BE_USER']->getTSConfigVal('options.pageTree.showNavTitle'); $pagetree->ext_showPageId = $GLOBALS['BE_USER']->getTSConfigVal('options.pageTree.showPageIdWithTitle'); $pagetree->addField('nav_title'); $tree = $pagetree->getBrowsableTree(); $cElements = $this->expandPage(); // Outputting Temporary DB mount notice: if (intval($GLOBALS['BE_USER']->getSessionData('pageTree_temporaryMountPoint'))) { $link = '<a href="' . htmlspecialchars(\TYPO3\CMS\Core\Utility\GeneralUtility::linkThisScript(array('setTempDBmount' => 0))) . '">' . $GLOBALS['LANG']->sl('LLL:EXT:lang/locallang_core.xml:labels.temporaryDBmount', 1) . '</a>'; $flashMessage = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('t3lib_FlashMessage', $link, '', t3lib_FlashMessage::INFO); $dbmount = $flashMessage->render(); } $content .= ' <!-- Wrapper table for page tree / record list: --> <table border="0" cellpadding="0" cellspacing="0" id="typo3-linkPages"> <tr> <td class="c-wCell" valign="top">' . $this->browseLinks->barheader($GLOBALS['LANG']->getLL('pageTree') . ':') . $dbmount . $tree . '</td> <td class="c-wCell" valign="top">' . $cElements . '</td> </tr> </table> '; return $content; }
/** * Returns the remove-url (file and db) * for file $table='_FILE' and $uid = shortmd5 hash of path * * @param string $table Tablename * @param string $uid Uid integer/shortmd5 hash * @return string URL * @todo Define visibility */ public function removeUrl($table, $uid) { return \TYPO3\CMS\Core\Utility\GeneralUtility::linkThisScript(array('CB' => array('remove' => $table . '|' . $uid))); }
/** * Main function, rendering the browsable page tree * * @return void * @todo Define visibility */ public function main() { // Produce browse-tree: $tree = $this->pagetree->getBrowsableTree(); // Outputting Temporary DB mount notice: if ($this->active_tempMountPoint) { $flashText = ' <a href="' . htmlspecialchars(\TYPO3\CMS\Core\Utility\GeneralUtility::linkThisScript(array('setTempDBmount' => 0))) . '">' . $GLOBALS['LANG']->sl('LLL:EXT:lang/locallang_core.xml:labels.temporaryDBmount', 1) . '</a> <br />' . $GLOBALS['LANG']->sl('LLL:EXT:lang/locallang_core.xml:labels.path', 1) . ': <span title="' . htmlspecialchars($this->active_tempMountPoint['_thePathFull']) . '">' . htmlspecialchars(\TYPO3\CMS\Core\Utility\GeneralUtility::fixed_lgd_cs($this->active_tempMountPoint['_thePath'], -50)) . '</span> '; $flashMessage = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Messaging\\FlashMessage', $flashText, '', \TYPO3\CMS\Core\Messaging\FlashMessage::INFO); $this->content .= $flashMessage->render(); } // Outputting page tree: $this->content .= '<div id="PageTreeDiv">' . $tree . '</div>'; // Adding javascript for drag & drop activation and highlighting $this->content .= $this->doc->wrapScriptTags(' ' . ($this->doHighlight ? 'Tree.highlightActiveItem("",top.fsMod.navFrameHighlightedID["web"]);' : '') . ' Tree.registerDragDropHandlers();'); // Setting up the buttons and markers for docheader $docHeaderButtons = $this->getButtons(); $markers = array('IMG_RESET' => \TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIcon('actions-document-close', array('id' => 'treeFilterReset', 'alt' => $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xml:labels.resetFilter'), 'title' => $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xml:labels.resetFilter'))), 'WORKSPACEINFO' => $this->getWorkspaceInfo(), 'CONTENT' => $this->content); $subparts = array(); if (!$this->hasFilterBox) { $subparts['###SECOND_ROW###'] = ''; } // Build the <body> for the module $this->content = $this->doc->startPage('TYPO3 Page Tree'); $this->content .= $this->doc->moduleBody($this->pageinfo, $docHeaderButtons, $markers, $subparts); $this->content .= $this->doc->endPage(); $this->content = $this->doc->insertStylesAndJS($this->content); }
/** * Get the list of pages to show. * This function is called recursively * * @param array $pageArray The Page Array * @param array $lines Lines that have been processed up to this point * @param int $pageDepth The level of the current $pageArray being processed * @return array */ protected function getList($pageArray, $lines = array(), $pageDepth = 0) { if (!is_array($pageArray)) { return $lines; } foreach ($pageArray as $identifier => $_) { if (!MathUtility::canBeInterpretedAsInteger($identifier)) { continue; } $line = array(); $line['padding'] = $pageDepth * 20; if (isset($pageArray[$identifier . '_'])) { $line['link'] = htmlspecialchars(GeneralUtility::linkThisScript(array('id' => $identifier))); $line['icon'] = $this->iconFactory->getIconForRecord('pages', BackendUtility::getRecordWSOL('pages', $identifier), Icon::SIZE_SMALL)->render(); $line['title'] = htmlspecialchars('ID: ' . $identifier); $line['pageTitle'] = GeneralUtility::fixed_lgd_cs($pageArray[$identifier], 30); $line['includedFiles'] = $pageArray[$identifier . '_']['includeLines'] === 0 ? '' : $pageArray[$identifier . '_']['includeLines']; $line['lines'] = $pageArray[$identifier . '_']['writtenLines'] === 0 ? '' : $pageArray[$identifier . '_']['writtenLines']; } else { $line['link'] = ''; $line['icon'] = $this->iconFactory->getIconForRecord('pages', BackendUtility::getRecordWSOL('pages', $identifier), Icon::SIZE_SMALL)->render(); $line['title'] = ''; $line['pageTitle'] = GeneralUtility::fixed_lgd_cs($pageArray[$identifier], 30); $line['includedFiles'] = ''; $line['lines'] = ''; } $lines[] = $line; $lines = $this->getList($pageArray[$identifier . '.'], $lines, $pageDepth + 1); } return $lines; }
/** * Result row display * * @param array $row * @param array $conf * @param string $table * @return string */ public function resultRowDisplay($row, $conf, $table) { $SET = $GLOBALS['SOBE']->MOD_SETTINGS; $out = '<tr>'; foreach ($row as $fieldName => $fieldValue) { if (GeneralUtility::inList($SET['queryFields'], $fieldName) || !$SET['queryFields'] && $fieldName != 'pid' && $fieldName != 'deleted') { if ($SET['search_result_labels']) { $fVnew = $this->getProcessedValueExtra($table, $fieldName, $fieldValue, $conf, '<br />'); } else { $fVnew = htmlspecialchars($fieldValue); } $out .= '<td>' . $fVnew . '</td>'; } } $out .= '<td><div class="btn-group">'; if (!$row['deleted']) { $url = BackendUtility::getModuleUrl('record_edit', ['edit' => [$table => [$row['uid'] => 'edit']], 'returnUrl' => GeneralUtility::getIndpEnv('REQUEST_URI') . GeneralUtility::implodeArrayForUrl('SET', (array) GeneralUtility::_POST('SET'))]); $out .= '<a class="btn btn-default" href="#" onClick="top.launchView(\'' . $table . '\',' . $row['uid'] . ');return false;">' . $this->iconFactory->getIcon('actions-document-info', Icon::SIZE_SMALL)->render() . '</a>'; $out .= '<a class="btn btn-default" href="' . htmlspecialchars($url) . '">' . $this->iconFactory->getIcon('actions-document-open', Icon::SIZE_SMALL)->render() . '</a>'; } else { $out .= '<a class="btn btn-default" href="' . GeneralUtility::linkThisUrl(BackendUtility::getModuleUrl('tce_db'), array('cmd[' . $table . '][' . $row['uid'] . '][undelete]' => '1', 'redirect' => GeneralUtility::linkThisScript(array()))) . '" title="' . $GLOBALS['LANG']->getLL('undelete_only', true) . '">'; $out .= $this->iconFactory->getIcon('actions-edit-restore', Icon::SIZE_SMALL)->render() . '</a>'; $formEngineParameters = array('edit[' . $table . '][' . $row['uid'] . ']' => 'edit', 'returnUrl' => GeneralUtility::linkThisScript(array())); $redirectUrl = BackendUtility::getModuleUrl('record_edit', $formEngineParameters); $out .= '<a class="btn btn-default" href="' . GeneralUtility::linkThisUrl(BackendUtility::getModuleUrl('tce_db'), array('cmd[' . $table . '][' . $row['uid'] . '][undelete]' => '1', 'redirect' => $redirectUrl)) . '" title="' . $GLOBALS['LANG']->getLL('undelete_and_edit', true) . '">'; $out .= $this->iconFactory->getIcon('actions-edit-restore-edit', Icon::SIZE_SMALL)->render() . '</a>'; } $_params = array($table => $row); if (is_array($this->hookArray['additionalButtons'])) { foreach ($this->hookArray['additionalButtons'] as $_funcRef) { $out .= GeneralUtility::callUserFunction($_funcRef, $_params, $this); } } $out .= '</div></td> </tr> '; return $out; }
/** * Render the list * * @param array $pArray * @param array $lines * @param integer $c * @return array * @todo Define visibility */ public function renderList($pArray, $lines = array(), $c = 0) { if (is_array($pArray)) { reset($pArray); static $i; foreach ($pArray as $k => $v) { if (\TYPO3\CMS\Core\Utility\MathUtility::canBeInterpretedAsInteger($k)) { if (isset($pArray[$k . '_'])) { $lines[] = '<tr class="' . ($i++ % 2 == 0 ? 'bgColor4' : 'bgColor6') . '"> <td nowrap><img src="clear.gif" width="1" height="1" hspace=' . $c * 10 . ' align="top">' . '<a href="' . htmlspecialchars(GeneralUtility::linkThisScript(array('id' => $k))) . '">' . IconUtility::getSpriteIconForRecord('pages', BackendUtility::getRecordWSOL('pages', $k), array('title' => 'ID: ' . $k)) . GeneralUtility::fixed_lgd_cs($pArray[$k], 30) . '</a></td> <td>' . $pArray[$k . '_']['count'] . '</td> <td>' . ($pArray[$k . '_']['root_max_val'] > 0 ? IconUtility::getSpriteIcon('status-status-checked') : ' ') . '</td> <td>' . ($pArray[$k . '_']['root_min_val'] == 0 ? IconUtility::getSpriteIcon('status-status-checked') : ' ') . '</td> </tr>'; } else { $lines[] = '<tr class="' . ($i++ % 2 == 0 ? 'bgColor4' : 'bgColor6') . '"> <td nowrap ><img src="clear.gif" width="1" height="1" hspace=' . $c * 10 . ' align=top>' . IconUtility::getSpriteIconForRecord('pages', BackendUtility::getRecordWSOL('pages', $k)) . GeneralUtility::fixed_lgd_cs($pArray[$k], 30) . '</td> <td></td> <td></td> <td></td> </tr>'; } $lines = $this->renderList($pArray[$k . '.'], $lines, $c + 1); } } } return $lines; }
/** * Create a regular new element (pages and records) * * @return void */ public function regularNew() { $lang = $this->getLanguageService(); // Initialize array for accumulating table rows: $this->tRows = array(); // Get TSconfig for current page $pageTS = BackendUtility::getPagesTSconfig($this->id); // Finish initializing new pages options with TSconfig // Each new page option may be hidden by TSconfig // Enabled option for the position of a new page $this->newPagesSelectPosition = !empty($pageTS['mod.']['wizards.']['newRecord.']['pages.']['show.']['pageSelectPosition']); // Pseudo-boolean (0/1) for backward compatibility $displayNewPagesIntoLink = $this->newPagesInto && !empty($pageTS['mod.']['wizards.']['newRecord.']['pages.']['show.']['pageInside']) ? 1 : 0; $displayNewPagesAfterLink = $this->newPagesAfter && !empty($pageTS['mod.']['wizards.']['newRecord.']['pages.']['show.']['pageAfter']) ? 1 : 0; // Slight spacer from header: $this->code .= ''; // New Page $table = 'pages'; $v = $GLOBALS['TCA'][$table]; $pageIcon = $this->moduleTemplate->getIconFactory()->getIconForRecord($table, array(), Icon::SIZE_SMALL)->render(); $newPageIcon = $this->moduleTemplate->getIconFactory()->getIcon('actions-page-new', Icon::SIZE_SMALL)->render(); $rowContent = ''; // New pages INSIDE this pages $newPageLinks = array(); if ($displayNewPagesIntoLink && $this->isTableAllowedForThisPage($this->pageinfo, 'pages') && $this->getBackendUserAuthentication()->check('tables_modify', 'pages') && $this->getBackendUserAuthentication()->workspaceCreateNewRecord($this->pageinfo['_ORIG_uid'] ?: $this->id, 'pages')) { // Create link to new page inside: $newPageLinks[] = $this->linkWrap($this->moduleTemplate->getIconFactory()->getIconForRecord($table, array(), Icon::SIZE_SMALL)->render() . $lang->sL($v['ctrl']['title'], true) . ' (' . $lang->sL('LLL:EXT:lang/locallang_core.xlf:db_new.php.inside', true) . ')', $table, $this->id); } // New pages AFTER this pages if ($displayNewPagesAfterLink && $this->isTableAllowedForThisPage($this->pidInfo, 'pages') && $this->getBackendUserAuthentication()->check('tables_modify', 'pages') && $this->getBackendUserAuthentication()->workspaceCreateNewRecord($this->pidInfo['uid'], 'pages')) { $newPageLinks[] = $this->linkWrap($pageIcon . $lang->sL($v['ctrl']['title'], true) . ' (' . $lang->sL('LLL:EXT:lang/locallang_core.xlf:db_new.php.after', true) . ')', 'pages', -$this->id); } // New pages at selection position if ($this->newPagesSelectPosition && $this->showNewRecLink('pages')) { // Link to page-wizard: $newPageLinks[] = '<a href="' . htmlspecialchars(GeneralUtility::linkThisScript(array('pagesOnly' => 1))) . '">' . $pageIcon . htmlspecialchars($lang->getLL('pageSelectPosition')) . '</a>'; } // Assemble all new page links $numPageLinks = count($newPageLinks); for ($i = 0; $i < $numPageLinks; $i++) { $rowContent .= '<li>' . $newPageLinks[$i] . '</li>'; } if ($this->showNewRecLink('pages')) { $rowContent = '<ul class="list-tree"><li>' . $newPageIcon . '<strong>' . $lang->getLL('createNewPage') . '</strong><ul>' . $rowContent . '</ul></li>'; } else { $rowContent = '<ul class="list-tree"><li><ul>' . $rowContent . '</li></ul>'; } // Compile table row $startRows = array($rowContent); $iconFile = array(); // New tables (but not pages) INSIDE this pages $isAdmin = $this->getBackendUserAuthentication()->isAdmin(); $newContentIcon = $this->moduleTemplate->getIconFactory()->getIcon('actions-document-new', Icon::SIZE_SMALL)->render(); if ($this->newContentInto) { if (is_array($GLOBALS['TCA'])) { $groupName = ''; foreach ($GLOBALS['TCA'] as $table => $v) { if ($table != 'pages' && $this->showNewRecLink($table) && $this->isTableAllowedForThisPage($this->pageinfo, $table) && $this->getBackendUserAuthentication()->check('tables_modify', $table) && (($v['ctrl']['rootLevel'] xor $this->id) || $v['ctrl']['rootLevel'] == -1) && $this->getBackendUserAuthentication()->workspaceCreateNewRecord($this->pageinfo['_ORIG_uid'] ? $this->pageinfo['_ORIG_uid'] : $this->id, $table)) { $newRecordIcon = $this->moduleTemplate->getIconFactory()->getIconForRecord($table, array(), Icon::SIZE_SMALL)->render(); $rowContent = ''; $thisTitle = ''; // Create new link for record: $newLink = $this->linkWrap($newRecordIcon . $lang->sL($v['ctrl']['title'], true), $table, $this->id); // If the table is 'tt_content', create link to wizard if ($table == 'tt_content') { $groupName = $lang->getLL('createNewContent'); $rowContent = $newContentIcon . '<strong>' . $lang->getLL('createNewContent') . '</strong><ul>'; // If mod.newContentElementWizard.override is set, use that extension's wizard instead: $tsConfig = BackendUtility::getModTSconfig($this->id, 'mod'); $moduleName = isset($tsConfig['properties']['newContentElementWizard.']['override']) ? $tsConfig['properties']['newContentElementWizard.']['override'] : 'new_content_element'; $url = BackendUtility::getModuleUrl($moduleName, ['id' => $this->id, 'returnUrl' => GeneralUtility::getIndpEnv('REQUEST_URI')]); $rowContent .= '<li>' . $newLink . ' ' . BackendUtility::wrapInHelp($table, '') . '</li><li><a href="' . htmlspecialchars($url) . '">' . $newContentIcon . htmlspecialchars($lang->getLL('clickForWizard')) . '</a></li></ul>'; } else { // Get the title if ($v['ctrl']['readOnly'] || $v['ctrl']['hideTable'] || $v['ctrl']['is_static']) { continue; } if ($v['ctrl']['adminOnly'] && !$isAdmin) { continue; } $nameParts = explode('_', $table); $thisTitle = ''; $_EXTKEY = ''; if ($nameParts[0] == 'tx' || $nameParts[0] == 'tt') { // Try to extract extension name if (substr($v['ctrl']['title'], 0, 8) == 'LLL:EXT:') { $_EXTKEY = substr($v['ctrl']['title'], 8); $_EXTKEY = substr($_EXTKEY, 0, strpos($_EXTKEY, '/')); if ($_EXTKEY != '') { // First try to get localisation of extension title $temp = explode(':', substr($v['ctrl']['title'], 9 + strlen($_EXTKEY))); $langFile = $temp[0]; $thisTitle = $lang->sL('LLL:EXT:' . $_EXTKEY . '/' . $langFile . ':extension.title'); // If no localisation available, read title from ext_emconf.php $extEmConfFile = ExtensionManagementUtility::extPath($_EXTKEY) . 'ext_emconf.php'; if (!$thisTitle && is_file($extEmConfFile)) { $EM_CONF = array(); include $extEmConfFile; $thisTitle = $EM_CONF[$_EXTKEY]['title']; } $iconFile[$_EXTKEY] = '<img ' . 'src="' . ExtensionManagementUtility::extRelPath($_EXTKEY) . $GLOBALS['TYPO3_LOADED_EXT'][$_EXTKEY]['ext_icon'] . '" ' . 'width="16" height="16" ' . 'alt="' . $thisTitle . '" />'; } } if (empty($thisTitle)) { $_EXTKEY = $nameParts[1]; $thisTitle = $nameParts[1]; $iconFile[$_EXTKEY] = ''; } } else { if ($table === 'pages_language_overlay' && !$this->checkIfLanguagesExist()) { continue; } $_EXTKEY = 'system'; $thisTitle = $lang->getLL('system_records'); $iconFile['system'] = $this->moduleTemplate->getIconFactory()->getIcon('apps-pagetree-root', Icon::SIZE_SMALL)->render(); } if ($groupName == '' || $groupName != $_EXTKEY) { $groupName = empty($v['ctrl']['groupName']) ? $_EXTKEY : $v['ctrl']['groupName']; } $rowContent .= $newLink; } // Compile table row: if ($table == 'tt_content') { $startRows[] = '<li>' . $rowContent . '</li>'; } else { $this->tRows[$groupName]['title'] = $thisTitle; $this->tRows[$groupName]['html'][] = $rowContent; $this->tRows[$groupName]['table'][] = $table; } } } } } // User sort if (isset($pageTS['mod.']['wizards.']['newRecord.']['order'])) { $this->newRecordSortList = GeneralUtility::trimExplode(',', $pageTS['mod.']['wizards.']['newRecord.']['order'], true); } uksort($this->tRows, array($this, 'sortNewRecordsByConfig')); // Compile table row: $finalRows = array(); $finalRows[] = implode('', $startRows); foreach ($this->tRows as $key => $value) { $row = '<li>' . $iconFile[$key] . ' <strong>' . $value['title'] . '</strong><ul>'; foreach ($value['html'] as $recordKey => $record) { $row .= '<li>' . $record . ' ' . BackendUtility::wrapInHelp($value['table'][$recordKey], '') . '</li>'; } $row .= '</ul></li>'; $finalRows[] = $row; } $finalRows[] = '</ul>'; // Make table: $this->code .= implode('', $finalRows); }
/** * Creating the module output. * * @return void */ public function main() { $lang = $this->getLanguageService(); if ($this->page_id) { $backendUser = $this->getBackendUser(); $this->moduleTemplate->getPageRenderer()->loadRequireJsModule('TYPO3/CMS/Backend/Tooltip'); // Get record for element: $elRow = BackendUtility::getRecordWSOL($this->table, $this->moveUid); // Headerline: Icon, record title: $headerLine = '<span ' . BackendUtility::getRecordToolTip($elRow, $this->table) . '>' . $this->moduleTemplate->getIconFactory()->getIconForRecord($this->table, $elRow, Icon::SIZE_SMALL)->render() . '</span>'; $headerLine .= BackendUtility::getRecordTitle($this->table, $elRow, true); // Make-copy checkbox (clicking this will reload the page with the GET var makeCopy set differently): $onClick = 'window.location.href=' . GeneralUtility::quoteJSvalue(GeneralUtility::linkThisScript(array('makeCopy' => !$this->makeCopy))) . ';'; $headerLine .= '<div><input type="hidden" name="makeCopy" value="0" />' . '<input type="checkbox" name="makeCopy" id="makeCopy" value="1"' . ($this->makeCopy ? ' checked="checked"' : '') . ' onclick="' . htmlspecialchars($onClick) . '" /> <label for="makeCopy" class="t3-label-valign-top">' . $lang->getLL('makeCopy', 1) . '</label></div>'; // Add the header-content to the module content: $this->content .= '<div>' . $headerLine . '</div>'; // Reset variable to pick up the module content in: $code = ''; // IF the table is "pages": if ((string) $this->table == 'pages') { // Get page record (if accessible): $pageInfo = BackendUtility::readPageAccess($this->page_id, $this->perms_clause); if (is_array($pageInfo) && $backendUser->isInWebMount($pageInfo['pid'], $this->perms_clause)) { // Initialize the position map: $posMap = GeneralUtility::makeInstance(PageMovingPagePositionMap::class); $posMap->moveOrCopy = $this->makeCopy ? 'copy' : 'move'; // Print a "go-up" link IF there is a real parent page (and if the user has read-access to that page). if ($pageInfo['pid']) { $pidPageInfo = BackendUtility::readPageAccess($pageInfo['pid'], $this->perms_clause); if (is_array($pidPageInfo)) { if ($backendUser->isInWebMount($pidPageInfo['pid'], $this->perms_clause)) { $code .= '<a href="' . htmlspecialchars(GeneralUtility::linkThisScript(array('uid' => (int) $pageInfo['pid'], 'moveUid' => $this->moveUid))) . '">' . $this->moduleTemplate->getIconFactory()->getIcon('actions-view-go-up', Icon::SIZE_SMALL)->render() . BackendUtility::getRecordTitle('pages', $pidPageInfo, true) . '</a><br />'; } else { $code .= $this->moduleTemplate->getIconFactory()->getIconForRecord('pages', $pidPageInfo, Icon::SIZE_SMALL)->render() . BackendUtility::getRecordTitle('pages', $pidPageInfo, true) . '<br />'; } } } // Create the position tree: $code .= $posMap->positionTree($this->page_id, $pageInfo, $this->perms_clause, $this->R_URI); } } // IF the table is "tt_content": if ((string) $this->table == 'tt_content') { // First, get the record: $tt_content_rec = BackendUtility::getRecord('tt_content', $this->moveUid); // ? if (!$this->input_moveUid) { $this->page_id = $tt_content_rec['pid']; } // Checking if the parent page is readable: $pageInfo = BackendUtility::readPageAccess($this->page_id, $this->perms_clause); if (is_array($pageInfo) && $backendUser->isInWebMount($pageInfo['pid'], $this->perms_clause)) { // Initialize the position map: $posMap = GeneralUtility::makeInstance(ContentMovingPagePositionMap::class); $posMap->moveOrCopy = $this->makeCopy ? 'copy' : 'move'; $posMap->cur_sys_language = $this->sys_language; // Headerline for the parent page: Icon, record title: $headerLine = '<span ' . BackendUtility::getRecordToolTip($pageInfo, 'pages') . '>' . $this->moduleTemplate->getIconFactory()->getIconForRecord('pages', $pageInfo, Icon::SIZE_SMALL)->render() . '</span>'; $headerLine .= BackendUtility::getRecordTitle('pages', $pageInfo, true); // Load SHARED page-TSconfig settings and retrieve column list from there, if applicable: // SHARED page-TSconfig settings. // $modTSconfig_SHARED = BackendUtility::getModTSconfig($this->pageId, 'mod.SHARED'); $colPosArray = GeneralUtility::callUserFunction(\TYPO3\CMS\Backend\View\BackendLayoutView::class . '->getColPosListItemsParsed', $this->page_id, $this); $colPosIds = array(); foreach ($colPosArray as $colPos) { $colPosIds[] = $colPos[1]; } // Removing duplicates, if any $colPosList = implode(',', array_unique($colPosIds)); // Adding parent page-header and the content element columns from position-map: $code = $headerLine . '<br />'; $code .= $posMap->printContentElementColumns($this->page_id, $this->moveUid, $colPosList, 1, $this->R_URI); // Print a "go-up" link IF there is a real parent page (and if the user has read-access to that page). $code .= '<br /><br />'; if ($pageInfo['pid']) { $pidPageInfo = BackendUtility::readPageAccess($pageInfo['pid'], $this->perms_clause); if (is_array($pidPageInfo)) { if ($backendUser->isInWebMount($pidPageInfo['pid'], $this->perms_clause)) { $code .= '<a href="' . htmlspecialchars(GeneralUtility::linkThisScript(array('uid' => (int) $pageInfo['pid'], 'moveUid' => $this->moveUid))) . '">' . $this->moduleTemplate->getIconFactory()->getIcon('actions-view-go-up', Icon::SIZE_SMALL)->render() . BackendUtility::getRecordTitle('pages', $pidPageInfo, true) . '</a><br />'; } else { $code .= $this->moduleTemplate->getIconFactory()->getIconForRecord('pages', $pidPageInfo, Icon::SIZE_SMALL)->render() . BackendUtility::getRecordTitle('pages', $pidPageInfo, true) . '<br />'; } } } // Create the position tree (for pages): $code .= $posMap->positionTree($this->page_id, $pageInfo, $this->perms_clause, $this->R_URI); } } // Add the $code content as a new section to the module: $this->content .= '<h2>' . $lang->getLL('selectPositionOfElement') . '</h2>'; $this->content .= '<div>' . $code . '</div>'; } // Setting up the buttons and markers for docheader $this->getButtons(); // Build the <body> for the module $this->moduleTemplate->setTitle($lang->getLL('movingElement')); }
/** * Get the form for extension configuration * * @param string $cat * @param array $theConstants * @param string $script * @param string $addFields * @param string $extKey * @param bool $addFormTag Adds opening <form> tag to the output, if TRUE * @return string The form */ public function ext_getForm($cat, $theConstants, $script = '', $addFields = '', $extKey = '', $addFormTag = true) { $this->ext_makeHelpInformationForCategory($cat); $printFields = trim($this->ext_printFields($theConstants, $cat)); $content = ''; $content .= GeneralUtility::wrapJS(' function uFormUrl(aname) { document.' . $this->ext_CEformName . '.action = ' . GeneralUtility::quoteJSvalue(GeneralUtility::linkThisScript() . '#') . '+aname; } '); if ($addFormTag) { $content .= '<form action="' . htmlspecialchars($script ?: GeneralUtility::linkThisScript()) . '" name="' . $this->ext_CEformName . '" method="post" enctype="multipart/form-data">'; } $content .= $addFields; $content .= $printFields; $content .= '<input class="btn btn-default" type="submit" name="submit" value="' . $this->getLanguageService()->sL('LLL:EXT:lang/locallang_tsfe.xlf:update', true) . '" id="configuration-submit-' . htmlspecialchars($extKey) . '" />'; $example = $this->ext_displayExample(); $content .= $example ? '<hr/>' . $example : ''; return $content; }