/**
  * @param array $arguments
  * @param callable $renderChildrenClosure
  * @param RenderingContextInterface $renderingContext
  *
  * @return string
  */
 public static function renderStatic(array $arguments, \Closure $renderChildrenClosure, RenderingContextInterface $renderingContext)
 {
     $id = GeneralUtility::_GP('id');
     $pageRecord = BackendUtility::readPageAccess($id, $GLOBALS['BE_USER']->getPagePermsClause(1));
     // Add icon with clickmenu, etc:
     /** @var IconFactory $iconFactory */
     $iconFactory = GeneralUtility::makeInstance(IconFactory::class);
     if ($pageRecord['uid']) {
         // If there IS a real page
         $altText = BackendUtility::getRecordIconAltText($pageRecord, 'pages');
         $theIcon = '<span title="' . $altText . '">' . $iconFactory->getIconForRecord('pages', $pageRecord, Icon::SIZE_SMALL)->render() . '</span>';
         // Make Icon:
         $theIcon = BackendUtility::wrapClickMenuOnIcon($theIcon, 'pages', $pageRecord['uid']);
         // Setting icon with clickmenu + uid
         $theIcon .= ' <em>[PID: ' . $pageRecord['uid'] . ']</em>';
     } else {
         // On root-level of page tree
         // Make Icon
         $theIcon = '<span title="' . htmlspecialchars($GLOBALS['TYPO3_CONF_VARS']['SYS']['sitename']) . '">' . $iconFactory->getIcon('apps-pagetree-page-domain', Icon::SIZE_SMALL)->render() . '</span>';
         if ($GLOBALS['BE_USER']->user['admin']) {
             $theIcon = BackendUtility::wrapClickMenuOnIcon($theIcon, 'pages', 0);
         }
     }
     return $theIcon;
 }
 /**
  * Initializes the Module
  *
  * @return 	void
  */
 public function initialize()
 {
     parent::init();
     $this->doc = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Backend\\Template\\DocumentTemplate');
     $this->doc->setModuleTemplate(\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath('recycler') . 'mod1/mod_template.html');
     $this->doc->backPath = $GLOBALS['BACK_PATH'];
     $this->doc->setExtDirectStateProvider();
     $this->pageRenderer = $this->doc->getPageRenderer();
     $this->relativePath = \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extRelPath('recycler');
     $this->pageRecord = BackendUtility::readPageAccess($this->id, $this->perms_clause);
     $this->isAccessibleForCurrentUser = $this->id && is_array($this->pageRecord) || !$this->id && $this->isCurrentUserAdmin();
     //don't access in workspace
     if ($GLOBALS['BE_USER']->workspace !== 0) {
         $this->isAccessibleForCurrentUser = FALSE;
     }
     //read configuration
     $modTS = $GLOBALS['BE_USER']->getTSConfig('mod.recycler');
     if ($this->isCurrentUserAdmin()) {
         $this->allowDelete = TRUE;
     } else {
         $this->allowDelete = $modTS['properties']['allowDelete'] == '1';
     }
     if (isset($modTS['properties']['recordsPageLimit']) && (int) $modTS['properties']['recordsPageLimit'] > 0) {
         $this->recordsPageLimit = (int) $modTS['properties']['recordsPageLimit'];
     }
 }
Exemplo n.º 3
0
 /**
  * Renders a record list as known from the TYPO3 list module
  * Note: This feature is experimental!
  *
  * @param string $tableName name of the database table
  * @param array $fieldList list of fields to be displayed. If empty, only the title column (configured in $TCA[$tableName]['ctrl']['title']) is shown
  * @param int $storagePid by default, records are fetched from the storage PID configured in persistence.storagePid. With this argument, the storage PID can be overwritten
  * @param int $levels corresponds to the level selector of the TYPO3 list module. By default only records from the current storagePid are fetched
  * @param string $filter corresponds to the "Search String" textbox of the TYPO3 list module. If not empty, only records matching the string will be fetched
  * @param int $recordsPerPage amount of records to be displayed at once. Defaults to $TCA[$tableName]['interface']['maxSingleDBListItems'] or (if that's not set) to 100
  * @param string $sortField table field to sort the results by
  * @param bool $sortDescending if TRUE records will be sorted in descending order
  * @param bool $readOnly if TRUE, the edit icons won't be shown. Otherwise edit icons will be shown, if the current BE user has edit rights for the specified table!
  * @param bool $enableClickMenu enables context menu
  * @param string $clickTitleMode one of "edit", "show" (only pages, tt_content), "info
  * @param bool $alternateBackgroundColors Deprecated since TYPO3 CMS 7, will be removed in TYPO3 CMS 8
  * @return string the rendered record list
  * @see \TYPO3\CMS\Recordlist\RecordList\DatabaseRecordList
  */
 public function render($tableName, array $fieldList = array(), $storagePid = NULL, $levels = 0, $filter = '', $recordsPerPage = 0, $sortField = '', $sortDescending = FALSE, $readOnly = FALSE, $enableClickMenu = TRUE, $clickTitleMode = NULL, $alternateBackgroundColors = FALSE)
 {
     if ($alternateBackgroundColors) {
         \TYPO3\CMS\Core\Utility\GeneralUtility::deprecationLog('The option alternateBackgroundColors has no effect anymore and can be removed without problems. The parameter will be removed in TYPO3 CMS 8.');
     }
     $pageinfo = \TYPO3\CMS\Backend\Utility\BackendUtility::readPageAccess(\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('id'), $GLOBALS['BE_USER']->getPagePermsClause(1));
     /** @var $dblist \TYPO3\CMS\Recordlist\RecordList\DatabaseRecordList */
     $dblist = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Recordlist\RecordList\DatabaseRecordList::class);
     $dblist->backPath = $GLOBALS['BACK_PATH'];
     $dblist->pageRow = $pageinfo;
     if ($readOnly === FALSE) {
         $dblist->calcPerms = $GLOBALS['BE_USER']->calcPerms($pageinfo);
     }
     $dblist->showClipboard = FALSE;
     $dblist->disableSingleTableView = TRUE;
     $dblist->clickTitleMode = $clickTitleMode;
     $dblist->clickMenuEnabled = $enableClickMenu;
     if ($storagePid === NULL) {
         $frameworkConfiguration = $this->configurationManager->getConfiguration(\TYPO3\CMS\Extbase\Configuration\ConfigurationManagerInterface::CONFIGURATION_TYPE_FRAMEWORK);
         $storagePid = $frameworkConfiguration['persistence']['storagePid'];
     }
     $dblist->start($storagePid, $tableName, (int) \TYPO3\CMS\Core\Utility\GeneralUtility::_GP('pointer'), $filter, $levels, $recordsPerPage);
     $dblist->allFields = TRUE;
     $dblist->dontShowClipControlPanels = TRUE;
     $dblist->displayFields = FALSE;
     $dblist->setFields = array($tableName => $fieldList);
     $dblist->noControlPanels = TRUE;
     $dblist->sortField = $sortField;
     $dblist->sortRev = $sortDescending;
     $dblist->script = $_SERVER['REQUEST_URI'];
     $dblist->generateList();
     return $dblist->HTMLcode;
 }
 /**
  * Renders a record list as known from the TYPO3 list module
  * Note: This feature is experimental!
  *
  * @param string $tableName name of the database table
  * @param array $fieldList list of fields to be displayed. If empty, only the title column (configured in $TCA[$tableName]['ctrl']['title']) is shown
  * @param int $storagePid by default, records are fetched from the storage PID configured in persistence.storagePid. With this argument, the storage PID can be overwritten
  * @param int $levels corresponds to the level selector of the TYPO3 list module. By default only records from the current storagePid are fetched
  * @param string $filter corresponds to the "Search String" textbox of the TYPO3 list module. If not empty, only records matching the string will be fetched
  * @param int $recordsPerPage amount of records to be displayed at once. Defaults to $TCA[$tableName]['interface']['maxSingleDBListItems'] or (if that's not set) to 100
  * @param string $sortField table field to sort the results by
  * @param bool $sortDescending if TRUE records will be sorted in descending order
  * @param bool $readOnly if TRUE, the edit icons won't be shown. Otherwise edit icons will be shown, if the current BE user has edit rights for the specified table!
  * @param bool $enableClickMenu enables context menu
  * @param string $clickTitleMode one of "edit", "show" (only pages, tt_content), "info
  * @return string the rendered record list
  * @see \TYPO3\CMS\Recordlist\RecordList\DatabaseRecordList
  */
 public function render($tableName, array $fieldList = array(), $storagePid = null, $levels = 0, $filter = '', $recordsPerPage = 0, $sortField = '', $sortDescending = false, $readOnly = false, $enableClickMenu = true, $clickTitleMode = null)
 {
     $pageinfo = BackendUtility::readPageAccess(GeneralUtility::_GP('id'), $GLOBALS['BE_USER']->getPagePermsClause(1));
     /** @var $dblist \TYPO3\CMS\Recordlist\RecordList\DatabaseRecordList */
     $dblist = GeneralUtility::makeInstance(\TYPO3\CMS\Recordlist\RecordList\DatabaseRecordList::class);
     $dblist->pageRow = $pageinfo;
     if ($readOnly === false) {
         $dblist->calcPerms = $GLOBALS['BE_USER']->calcPerms($pageinfo);
     }
     $dblist->showClipboard = false;
     $dblist->disableSingleTableView = true;
     $dblist->clickTitleMode = $clickTitleMode;
     $dblist->clickMenuEnabled = $enableClickMenu;
     if ($storagePid === null) {
         $frameworkConfiguration = $this->configurationManager->getConfiguration(\TYPO3\CMS\Extbase\Configuration\ConfigurationManagerInterface::CONFIGURATION_TYPE_FRAMEWORK);
         $storagePid = $frameworkConfiguration['persistence']['storagePid'];
     }
     $dblist->start($storagePid, $tableName, (int) GeneralUtility::_GP('pointer'), $filter, $levels, $recordsPerPage);
     $dblist->allFields = true;
     $dblist->dontShowClipControlPanels = true;
     $dblist->displayFields = false;
     $dblist->setFields = array($tableName => $fieldList);
     $dblist->noControlPanels = true;
     $dblist->sortField = $sortField;
     $dblist->sortRev = $sortDescending;
     $dblist->script = $_SERVER['REQUEST_URI'];
     $dblist->generateList();
     return $dblist->HTMLcode;
 }
Exemplo n.º 5
0
 /**
  * Render javascript in header
  *
  * @return string the rendered page info icon
  * @see template::getPageInfo() Note: can't call this method as it's protected!
  */
 public function render()
 {
     $doc = $this->getDocInstance();
     $id = \TYPO3\CMS\Core\Utility\GeneralUtility::_GP('id');
     $pageRecord = BackendUtility::readPageAccess($id, $GLOBALS['BE_USER']->getPagePermsClause(1));
     // Add icon with clickmenu, etc:
     if ($pageRecord['uid']) {
         // If there IS a real page
         $alttext = BackendUtility::getRecordIconAltText($pageRecord, 'pages');
         $iconImg = IconUtility::getSpriteIconForRecord('pages', $pageRecord, array('title' => htmlspecialchars($alttext)));
         // Make Icon:
         $theIcon = $doc->wrapClickMenuOnIcon($iconImg, 'pages', $pageRecord['uid']);
     } else {
         // On root-level of page tree
         // Make Icon
         $iconImg = '<img' . IconUtility::skinImg($GLOBALS['BACK_PATH'], 'gfx/i/_icon_website.gif') . ' alt="' . htmlspecialchars($GLOBALS['TYPO3_CONF_VARS']['SYS']['sitename']) . '" />';
         if ($GLOBALS['BE_USER']->user['admin']) {
             $theIcon = $doc->wrapClickMenuOnIcon($iconImg, 'pages', 0);
         } else {
             $theIcon = $iconImg;
         }
     }
     // Setting icon with clickmenu + uid
     $pageInfo = $theIcon . '<em>[pid: ' . $pageRecord['uid'] . ']</em>';
     return $pageInfo;
 }
Exemplo n.º 6
0
 /**
  * This method forwards the call to Bootstrap's run() method. This method is invoked by the mod.php
  * function of TYPO3.
  *
  * @param string $moduleSignature
  * @throws \RuntimeException
  * @return boolean TRUE, if the request request could be dispatched
  * @see run()
  */
 public function callModule($moduleSignature)
 {
     if (!isset($GLOBALS['TBE_MODULES']['_configuration'][$moduleSignature])) {
         return FALSE;
     }
     $moduleConfiguration = $GLOBALS['TBE_MODULES']['_configuration'][$moduleSignature];
     // Check permissions and exit if the user has no permission for entry
     $GLOBALS['BE_USER']->modAccess($moduleConfiguration, TRUE);
     $id = \TYPO3\CMS\Core\Utility\GeneralUtility::_GP('id');
     if ($id && \TYPO3\CMS\Core\Utility\MathUtility::canBeInterpretedAsInteger($id)) {
         // Check page access
         $permClause = $GLOBALS['BE_USER']->getPagePermsClause(TRUE);
         $access = is_array(\TYPO3\CMS\Backend\Utility\BackendUtility::readPageAccess((int) $id, $permClause));
         if (!$access) {
             throw new \RuntimeException('You don\'t have access to this page', 1289917924);
         }
     }
     // BACK_PATH is the path from the typo3/ directory from within the
     // directory containing the controller file. We are using mod.php dispatcher
     // and thus we are already within typo3/ because we call typo3/mod.php
     $GLOBALS['BACK_PATH'] = '';
     $configuration = array('extensionName' => $moduleConfiguration['extensionName'], 'pluginName' => $moduleSignature);
     if (isset($moduleConfiguration['vendorName'])) {
         $configuration['vendorName'] = $moduleConfiguration['vendorName'];
     }
     $bootstrap = $this->objectManager->get('TYPO3\\CMS\\Extbase\\Core\\BootstrapInterface');
     $content = $bootstrap->run('', $configuration);
     print $content;
     return TRUE;
 }
    /**
     * Main module function
     *
     * @return void
     * @todo Define visibility
     */
    public function main()
    {
        // Start document template object:
        $this->doc = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Backend\\Template\\DocumentTemplate');
        $this->doc->backPath = $GLOBALS['BACK_PATH'];
        $this->doc->bodyTagId = 'imp-exp-mod';
        $this->doc->setModuleTemplate(\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extRelPath('impexp') . '/app/template.html');
        $this->pageinfo = \TYPO3\CMS\Backend\Utility\BackendUtility::readPageAccess($this->id, $this->perms_clause);
        // JavaScript
        $this->doc->JScode = $this->doc->wrapScriptTags('
			script_ended = 0;
			function jumpToUrl(URL) {	//
				window.location.href = URL;
			}
		');
        // Setting up the context sensitive menu:
        $this->doc->getContextMenuCode();
        $this->doc->postCode = $this->doc->wrapScriptTags('
			script_ended = 1;
			if (top.fsMod) top.fsMod.recentIds["web"] = ' . intval($this->id) . ';
		');
        $this->doc->form = '<form action="' . htmlspecialchars($GLOBALS['MCONF']['_']) . '" method="post" enctype="' . $GLOBALS['TYPO3_CONF_VARS']['SYS']['form_enctype'] . '"><input type="hidden" name="id" value="' . $this->id . '" />';
        $this->content .= $this->doc->header($GLOBALS['LANG']->getLL('title'));
        $this->content .= $this->doc->spacer(5);
        // Input data grabbed:
        $inData = \TYPO3\CMS\Core\Utility\GeneralUtility::_GP('tx_impexp');
        $this->checkUpload();
        switch ((string) $inData['action']) {
            case 'export':
                // Finally: If upload went well, set the new file as the thumbnail in the $inData array:
                if (is_object($this->fileProcessor) && $this->fileProcessor->internalUploadMap[1]) {
                    $inData['meta']['thumbnail'] = md5($this->fileProcessor->internalUploadMap[1]);
                }
                // Call export interface
                $this->exportData($inData);
                break;
            case 'import':
                // Finally: If upload went well, set the new file as the import file:
                if (is_object($this->fileProcessor) && $this->fileProcessor->internalUploadMap[1]) {
                    $fI = pathinfo($this->fileProcessor->internalUploadMap[1]);
                    // Only allowed extensions....
                    if (\TYPO3\CMS\Core\Utility\GeneralUtility::inList('t3d,xml', strtolower($fI['extension']))) {
                        $inData['file'] = $this->fileProcessor->internalUploadMap[1];
                    }
                }
                // Call import interface:
                $this->importData($inData);
                break;
        }
        // Setting up the buttons and markers for docheader
        $docHeaderButtons = $this->getButtons();
        $markers['CONTENT'] = $this->content;
        // Build the <body> for the module
        $this->content = $this->doc->startPage($GLOBALS['LANG']->getLL('title'));
        $this->content .= $this->doc->moduleBody($this->pageinfo, $docHeaderButtons, $markers);
        $this->content .= $this->doc->endPage();
        $this->content = $this->doc->insertStylesAndJS($this->content);
    }
Exemplo n.º 8
0
 /**
  * Set up the doc header properly here
  *
  * @param ViewInterface $view
  */
 protected function initializeView(ViewInterface $view)
 {
     /** @var BackendTemplateView $view */
     parent::initializeView($view);
     $permissionClause = $this->getBackendUserAuthentication()->getPagePermsClause(1);
     $pageRecord = BackendUtility::readPageAccess($this->pageUid, $permissionClause);
     $view->getModuleTemplate()->getDocHeaderComponent()->setMetaInformation($pageRecord);
     $this->generateMenu();
 }
Exemplo n.º 9
0
    /**
     * 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
     */
    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 || $BE_USER->user['uid'] && !$this->id) {
            // Draw the header.
            $this->doc = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Backend\Template\DocumentTemplate::class);
            $this->doc->docType = 'xhtml_trans';
            $this->doc->backPath = $BACK_PATH;
            $this->doc->form = '<form action="" method="post">';
            // JavaScript
            $this->doc->JScode = '
				<script language="javascript" type="text/javascript">
					script_ended = 0;
					function jumpToUrl(URL)	{
						document.location = URL;
					}
				</script>
			';
            $this->doc->postCode = '
				<script language="javascript" type="text/javascript">
					script_ended = 1;
					if (top.fsMod) top.fsMod.recentIds["web"] = 0;
				</script>';
            $this->doc->inDocStylesArray[] = '
					.dirmenu a:link, .dirmenu a:visited {
						text-decoration: underline;
					}
					.description {
						margin-top: 8px;
					}';
            $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(\TYPO3\CMS\Backend\Template\DocumentTemplate::class);
            $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);
        }
    }
    /**
     * Initialize module header etc and call extObjContent function
     *
     * @return void
     * @todo Define visibility
     */
    public function main()
    {
        global $LANG, $BACK_PATH;
        // 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;
        // Template markers
        $markers = array('CSH' => '', 'FUNC_MENU' => '', 'CONTENT' => '');
        $this->doc = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Backend\\Template\\DocumentTemplate');
        $this->doc->backPath = $BACK_PATH;
        $this->doc->setModuleTemplate('templates/func.html');
        // Main
        if ($this->id && $access) {
            // JavaScript
            $this->doc->JScode = $this->doc->wrapScriptTags('
				script_ended = 0;
				function jumpToUrl(URL) {	//
					window.location.href = URL;
				}
			');
            $this->doc->postCode = $this->doc->wrapScriptTags('
				script_ended = 1;
				if (top.fsMod) top.fsMod.recentIds["web"] = ' . intval($this->id) . ';
			');
            // Setting up the context sensitive menu:
            $this->doc->getContextMenuCode();
            $this->doc->form = '<form action="index.php" method="post"><input type="hidden" name="id" value="' . $this->id . '" />';
            $vContent = $this->doc->getVersionSelector($this->id, 1);
            if ($vContent) {
                $this->content .= $this->doc->section('', $vContent);
            }
            $this->extObjContent();
            // Setting up the buttons and markers for docheader
            $docHeaderButtons = $this->getButtons();
            $markers['CSH'] = $docHeaderButtons['csh'];
            $markers['FUNC_MENU'] = \TYPO3\CMS\Backend\Utility\BackendUtility::getFuncMenu($this->id, 'SET[function]', $this->MOD_SETTINGS['function'], $this->MOD_MENU['function']);
            $markers['CONTENT'] = $this->content;
        } else {
            // If no access or if ID == zero
            $flashMessage = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Messaging\\FlashMessage', $LANG->getLL('clickAPage_content'), $LANG->getLL('title'), \TYPO3\CMS\Core\Messaging\FlashMessage::INFO);
            $this->content = $flashMessage->render();
            // 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->moduleBody($this->pageinfo, $docHeaderButtons, $markers);
        // Renders the module page
        $this->content = $this->doc->render($LANG->getLL('title'), $this->content);
    }
Exemplo n.º 11
0
    public function main()
    {
        global $BE_USER, $LANG, $BACK_PATH, $TCA_DESCR, $TCA, $CLIENT, $TYPO3_CONF_VARS, $TYPO3_DB;
        $this->pageinfo = BackendUtility::readPageAccess($this->id, $this->perms_clause);
        $access = is_array($this->pageinfo) ? 1 : 0;
        $this->pageId = $this->pageinfo['uid'];
        if ($this->id && $access || $BE_USER->user['admin'] && !$this->id) {
            // Draw the header.
            $this->doc = GeneralUtility::makeInstance('template');
            $this->doc->backPath = $BACK_PATH;
            $this->doc->form = '<form action="mod.php?M=web_txvalidateurlsM1" method="POST">';
            // JavaScript
            $this->doc->JScode = '
				<script language="javascript" type="text/javascript">
					script_ended = 0;
					function jumpToUrl(URL)
					{
						document.location = URL;
					}
				</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') . ': ' . 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, 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);
            $this->content .= '</div>';
        } else {
            // If no access or if ID == zero
            $this->doc = GeneralUtility::makeInstance('TYPO3\\CMS\\Backend\\Template\\DocumentTemplate');
            $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);
        }
    }
Exemplo n.º 12
0
    /**
     * Initialize module header etc and call extObjContent function
     *
     * @return void
     * @todo Define visibility
     */
    public function main()
    {
        // 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 || $GLOBALS['BE_USER']->user['admin'] && !$this->id) {
            $this->CALC_PERMS = $GLOBALS['BE_USER']->calcPerms($this->pageinfo);
            if ($GLOBALS['BE_USER']->user['admin'] && !$this->id) {
                $this->pageinfo = array('title' => '[root-level]', 'uid' => 0, 'pid' => 0);
            }
            $this->doc = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Backend\\Template\\DocumentTemplate');
            $this->doc->backPath = $GLOBALS['BACK_PATH'];
            $this->doc->setModuleTemplate('templates/info.html');
            $this->doc->tableLayout = array('0' => array('0' => array('<td valign="top"><strong>', '</strong></td>'), 'defCol' => array('<td><img src="' . $this->doc->backPath . 'clear.gif" width="10" height="1" alt="" /></td><td valign="top"><strong>', '</strong></td>')), 'defRow' => array('0' => array('<td valign="top">', '</td>'), 'defCol' => array('<td><img src="' . $this->doc->backPath . 'clear.gif" width="10" height="1" alt="" /></td><td valign="top">', '</td>')));
            // JavaScript
            $this->doc->JScode = $this->doc->wrapScriptTags('
				script_ended = 0;
				function jumpToUrl(URL) {	//
					window.location.href = URL;
				}
			');
            $this->doc->postCode = $this->doc->wrapScriptTags('
				script_ended = 1;
				if (top.fsMod) top.fsMod.recentIds["web"] = ' . intval($this->id) . ';
			');
            // Setting up the context sensitive menu:
            $this->doc->getContextMenuCode();
            $this->doc->form = '<form action="index.php" method="post" name="webinfoForm">';
            $vContent = $this->doc->getVersionSelector($this->id, 1);
            if ($vContent) {
                $this->content .= $this->doc->section('', $vContent);
            }
            $this->extObjContent();
            // Setting up the buttons and markers for docheader
            $docHeaderButtons = $this->getButtons();
            $markers = array('CSH' => $docHeaderButtons['csh'], 'FUNC_MENU' => \TYPO3\CMS\Backend\Utility\BackendUtility::getFuncMenu($this->id, 'SET[function]', $this->MOD_SETTINGS['function'], $this->MOD_MENU['function']), 'CONTENT' => $this->content);
            // Build the <body> for the module
            $this->content = $this->doc->moduleBody($this->pageinfo, $docHeaderButtons, $markers);
        } else {
            // If no access or if ID == zero
            $this->doc = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Backend\\Template\\MediumDocumentTemplate');
            $this->doc->backPath = $GLOBALS['BACK_PATH'];
            $this->content = $this->doc->header($GLOBALS['LANG']->getLL('title'));
            $this->content .= $this->doc->spacer(5);
            $this->content .= $this->doc->spacer(10);
        }
        // Renders the module page
        $this->content = $this->doc->render($GLOBALS['LANG']->getLL('title'), $this->content);
    }
Exemplo n.º 13
0
    /**
     * 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, $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;
        // create document template
        $this->doc = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Backend\\Template\\DocumentTemplate');
        if ($this->id && $access || $GLOBALS['BE_USER']->user['admin'] && !$this->id) {
            $this->doc->backPath = $BACK_PATH;
            $this->doc->form = '<form action="" method="post" enctype="multipart/form-data">';
            // JavaScript
            $this->doc->JScode = '
				<script language="javascript" type="text/javascript">
					script_ended = 0;
					function jumpToUrl(URL)	{
						document.location = URL;
					}
				</script>
			';
            $this->doc->postCode = '
				<script language="javascript" type="text/javascript">
					script_ended = 1;
					if (top.fsMod) top.fsMod.recentIds["web"] = 0;
				</script>
			';
            // add some css
            $cssFile = 'res/backendModule.css';
            $this->doc->getPageRenderer()->addCssFile(TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extRelPath('ke_search') . $cssFile);
            $this->content .= '<div id="typo3-docheader"><div class="typo3-docheader-functions">';
            $this->content .= \TYPO3\CMS\Backend\Utility\BackendUtility::getFuncMenu($this->id, 'SET[function]', $this->MOD_SETTINGS['function'], $this->MOD_MENU['function']);
            $this->content .= '</div></div>';
            $this->content .= '<div id="typo3-docbody"><div id="typo3-inner-docbody">';
            $this->content .= $this->doc->startPage($GLOBALS['LANG']->getLL('title'));
            $this->content .= $this->doc->header($GLOBALS['LANG']->getLL('title'));
            // 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 {
            $this->doc->backPath = $BACK_PATH;
            $this->content .= '<div class="alert alert-info">' . $GLOBALS['LANG']->getLL('select_a_page') . '</div>';
            $this->content .= $this->doc->spacer(10);
        }
        $this->content .= '</div></div>';
    }
Exemplo n.º 14
0
    /**
     * Main function of the module.
     * Write the content to $this->content
     */
    function main()
    {
        // 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;
        $this->doc = GeneralUtility::makeInstance('TYPO3\\CMS\\Backend\\Template\\DocumentTemplate');
        $this->doc->backPath = $GLOBALS['BACK_PATH'];
        if ($this->id && $access || $GLOBALS['BE_USER']->user['admin'] && !$this->id) {
            // Draw the header.
            $this->doc->form = '<form action="" method="POST">';
            // JavaScript
            $this->doc->JScode = '
				<script language="javascript" type="text/javascript">
					script_ended = 0;
					function jumpToUrl(URL)	{
						document.location = URL;
					}
				</script>
			';
            $this->doc->postCode = '
				<script language="javascript" type="text/javascript">
					script_ended = 1;
					if (top.fsMod) top.fsMod.recentIds["web"] = ' . intval($this->id) . ';
				</script>
			';
            $headerSection = $this->doc->getHeader('pages', $this->pageinfo, $this->pageinfo['_thePath']) . '<br>' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:labels.path') . ': ' . GeneralUtility::fixed_lgd_cs($this->pageinfo['_thePath'], -50);
            $this->content .= $this->doc->startPage($GLOBALS['LANG']->getLL('title'));
            $this->content .= $this->doc->header($GLOBALS['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 ($GLOBALS['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->content .= $this->doc->startPage($GLOBALS['LANG']->getLL('title'));
            $this->content .= $this->doc->header($GLOBALS['LANG']->getLL('title'));
            $this->content .= $this->doc->spacer(5);
            $this->content .= $this->doc->spacer(10);
        }
    }
Exemplo n.º 15
0
 /**
  * Initialize action
  *
  * @return void
  */
 protected function initializeAction()
 {
     // determine id parameter
     $this->id = (int) GeneralUtility::_GP('id');
     if ($this->request->hasArgument('id')) {
         $this->id = (int) $this->request->getArgument('id');
     }
     // determine depth parameter
     $this->depth = (int) GeneralUtility::_GP('depth') > 0 ? (int) GeneralUtility::_GP('depth') : $this->getBackendUser()->getSessionData(self::SESSION_PREFIX . 'depth');
     if ($this->request->hasArgument('depth')) {
         $this->depth = (int) $this->request->getArgument('depth');
     }
     $this->getBackendUser()->setAndSaveSessionData(self::SESSION_PREFIX . 'depth', $this->depth);
     $this->lastEdited = GeneralUtility::_GP('lastEdited');
     $this->returnId = GeneralUtility::_GP('returnId');
     $this->pageInfo = BackendUtility::readPageAccess($this->id, ' 1=1');
 }
Exemplo n.º 16
0
 /**
  * Initialize module header etc and call extObjContent function
  *
  * @return void
  */
 public function main()
 {
     // 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 = BackendUtility::readPageAccess($this->id, $this->perms_clause);
     $access = is_array($this->pageinfo);
     // Template markers
     $markers = array('CSH' => '', 'FUNC_MENU' => '', 'CONTENT' => '');
     $this->doc = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Backend\Template\DocumentTemplate::class);
     $this->doc->backPath = $GLOBALS['BACK_PATH'];
     $this->doc->setModuleTemplate('EXT:func/Resources/Private/Templates/func.html');
     // Main
     if ($this->id && $access) {
         // JavaScript
         $this->doc->postCode = $this->doc->wrapScriptTags('if (top.fsMod) top.fsMod.recentIds["web"] = ' . (int) $this->id . ';');
         // Setting up the context sensitive menu:
         $this->doc->getContextMenuCode();
         $this->doc->form = '<form action="' . htmlspecialchars(BackendUtility::getModuleUrl('web_func')) . '" method="post"><input type="hidden" name="id" value="' . htmlspecialchars($this->id) . '" />';
         $vContent = $this->doc->getVersionSelector($this->id, TRUE);
         if ($vContent) {
             $this->content .= $this->doc->section('', $vContent);
         }
         $this->extObjContent();
         // Setting up the buttons and markers for docheader
         $docHeaderButtons = $this->getButtons();
         $markers['CSH'] = $docHeaderButtons['csh'];
         $markers['FUNC_MENU'] = BackendUtility::getFuncMenu($this->id, 'SET[function]', $this->MOD_SETTINGS['function'], $this->MOD_MENU['function']);
         $markers['CONTENT'] = $this->content;
     } else {
         // If no access or if ID == zero
         $title = $this->getLanguageService()->getLL('title');
         $message = $this->getLanguageService()->getLL('clickAPage_content');
         $view = GeneralUtility::makeInstance(StandaloneView::class);
         $view->setTemplatePathAndFilename(GeneralUtility::getFileAbsFileName('EXT:func/Resources/Private/Templates/InfoBox.html'));
         $view->assignMultiple(array('title' => $title, 'message' => $message, 'state' => InfoboxViewHelper::STATE_INFO));
         $this->content = $view->render();
         // 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->moduleBody($this->pageinfo, $docHeaderButtons, $markers);
     // Renders the module page
     $this->content = $this->doc->render($this->getLanguageService()->getLL('title'), $this->content);
 }
 /**
  *
  */
 public function initializeAction()
 {
     parent::initializeAction();
     $this->extConf = unserialize($GLOBALS['TYPO3_CONF_VARS']['EXT']['extConf']['ke_search']);
     $this->do = GeneralUtility::_GET('do');
     $this->perms_clause = $this->getBackendUser()->getPagePermsClause($this->id);
     $this->pageinfo = BackendUtility::readPageAccess($this->id, $this->perms_clause);
     // check access and redirect accordingly
     $access = is_array($this->pageinfo) ? 1 : 0;
     if ($this->id && $access || $this->getBackendUser()->user['admin'] && !$this->id) {
         //proceed normally
     } else {
         if ($this->getActionName() !== 'alert') {
             $this->redirect('alert', $this->getControllerName());
         }
     }
 }
Exemplo n.º 18
0
 /**
  * Initialize module header etc and call extObjContent function
  *
  * @return void
  */
 public function main()
 {
     // 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 = BackendUtility::readPageAccess($this->id, $this->perms_clause);
     $access = is_array($this->pageinfo);
     if ($this->id && $access || $this->backendUser->user['admin'] && !$this->id) {
         if ($this->backendUser->user['admin'] && !$this->id) {
             $this->pageinfo = array('title' => '[root-level]', 'uid' => 0, 'pid' => 0);
         }
         $this->doc = GeneralUtility::makeInstance(\TYPO3\CMS\Backend\Template\DocumentTemplate::class);
         $this->doc->backPath = $GLOBALS['BACK_PATH'];
         $this->doc->setModuleTemplate('EXT:info/Resources/Private/Templates/info.html');
         $this->doc->tableLayout = array('0' => array('0' => array('<td valign="top"><strong>', '</strong></td>'), 'defCol' => array('<td><img src="' . $this->doc->backPath . 'clear.gif" width="10" height="1" alt="" /></td><td valign="top"><strong>', '</strong></td>')), 'defRow' => array('0' => array('<td valign="top">', '</td>'), 'defCol' => array('<td><img src="' . $this->doc->backPath . 'clear.gif" width="10" height="1" alt="" /></td><td valign="top">', '</td>')));
         // JavaScript
         $this->doc->postCode = $this->doc->wrapScriptTags('if (top.fsMod) top.fsMod.recentIds["web"] = ' . (int) $this->id . ';');
         // Setting up the context sensitive menu:
         $this->doc->getContextMenuCode();
         $this->doc->form = '<form action="' . htmlspecialchars(BackendUtility::getModuleUrl($this->moduleName)) . '" method="post" name="webinfoForm">';
         $vContent = $this->doc->getVersionSelector($this->id, 1);
         if ($vContent) {
             $this->content .= $this->doc->section('', $vContent);
         }
         $this->extObjContent();
         // Setting up the buttons and markers for docheader
         $docHeaderButtons = $this->getButtons();
         $markers = array('CSH' => $docHeaderButtons['csh'], 'FUNC_MENU' => BackendUtility::getFuncMenu($this->id, 'SET[function]', $this->MOD_SETTINGS['function'], $this->MOD_MENU['function']), 'CONTENT' => $this->content);
         // Build the <body> for the module
         $this->content = $this->doc->moduleBody($this->pageinfo, $docHeaderButtons, $markers);
     } else {
         // If no access or if ID == zero
         $this->doc = GeneralUtility::makeInstance(\TYPO3\CMS\Backend\Template\DocumentTemplate::class);
         $this->doc->backPath = $GLOBALS['BACK_PATH'];
         $this->content = $this->doc->header($this->languageService->getLL('title'));
         $this->content .= $this->doc->spacer(5);
         $this->content .= $this->doc->spacer(10);
     }
     // Renders the module page
     $this->content = $this->doc->render($this->languageService->getLL('title'), $this->content);
 }
Exemplo n.º 19
0
    /**
     * Initialize module header etc and call extObjContent function
     *
     * @return void
     */
    public function main()
    {
        // We leave this here because of dependencies to submodules
        $this->doc = GeneralUtility::makeInstance(\TYPO3\CMS\Backend\Template\DocumentTemplate::class);
        // The page will show only if there is a valid page and if this page
        // may be viewed by the user
        $this->pageinfo = BackendUtility::readPageAccess($this->id, $this->perms_clause);
        if ($this->pageinfo) {
            $this->moduleTemplate->getDocHeaderComponent()->setMetaInformation($this->pageinfo);
        }
        $access = is_array($this->pageinfo);
        if ($this->id && $access || $this->backendUser->user['admin'] && !$this->id) {
            if ($this->backendUser->user['admin'] && !$this->id) {
                $this->pageinfo = array('title' => '[root-level]', 'uid' => 0, 'pid' => 0);
            }
            // JavaScript
            $this->moduleTemplate->addJavaScriptCode('WebFuncInLineJS', 'if (top.fsMod) top.fsMod.recentIds["web"] = ' . (int) $this->id . ';
				function jumpToUrl(URL) {
					window.location.href = URL;
					return false;
				}
				');
            // Setting up the context sensitive menu:
            $this->moduleTemplate->getPageRenderer()->loadRequireJsModule('TYPO3/CMS/Backend/ClickMenu');
            $this->content .= '<form action="' . htmlspecialchars(BackendUtility::getModuleUrl($this->moduleName)) . '" method="post" id="InfoModuleController" name="webinfoForm" class="form-inline form-inline-spaced">';
            $vContent = $this->moduleTemplate->getVersionSelector($this->id, 1);
            if ($vContent) {
                $this->content .= $this->moduleTemplate->section('', $vContent);
            }
            $this->extObjContent();
            // Setting up the buttons and markers for docheader
            $this->getButtons();
            $this->generateMenu();
            $this->content .= '</form>';
        } else {
            // If no access or if ID == zero
            $this->content = $this->doc->header($this->languageService->getLL('title'));
        }
    }
Exemplo n.º 20
0
 /**
  * Initializes the Module
  *
  * @return void
  */
 public function initializeAction()
 {
     $this->id = (int) GeneralUtility::_GP('id');
     $backendUser = $this->getBackendUser();
     $this->perms_clause = $backendUser->getPagePermsClause(1);
     $this->pageRecord = \TYPO3\CMS\Backend\Utility\BackendUtility::readPageAccess($this->id, $this->perms_clause);
     $this->isAccessibleForCurrentUser = $this->id && is_array($this->pageRecord) || !$this->id && $this->getBackendUser()->isAdmin();
     // don't access in workspace
     if ($backendUser->workspace !== 0) {
         $this->isAccessibleForCurrentUser = false;
     }
     // read configuration
     $modTS = $backendUser->getTSConfig('mod.recycler');
     if ($this->getBackendUser()->isAdmin()) {
         $this->allowDelete = true;
     } else {
         $this->allowDelete = (bool) $modTS['properties']['allowDelete'];
     }
     if (isset($modTS['properties']['recordsPageLimit']) && intval($modTS['properties']['recordsPageLimit']) > 0) {
         $this->recordsPageLimit = intval($modTS['properties']['recordsPageLimit']);
     }
 }
Exemplo n.º 21
0
 /**
  * Renders the current page path
  *
  * @return string the rendered page path
  * @see template::getPagePath() Note: can't call this method as it's protected!
  */
 public function render()
 {
     $id = \TYPO3\CMS\Core\Utility\GeneralUtility::_GP('id');
     $pageRecord = \TYPO3\CMS\Backend\Utility\BackendUtility::readPageAccess($id, $GLOBALS['BE_USER']->getPagePermsClause(1));
     // Is this a real page
     if ($pageRecord['uid']) {
         $title = $pageRecord['_thePathFull'];
     } else {
         $title = $GLOBALS['TYPO3_CONF_VARS']['SYS']['sitename'];
     }
     // Setting the path of the page
     $pagePath = $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:labels.path', TRUE) . ': <span class="typo3-docheader-pagePath">';
     // crop the title to title limit (or 50, if not defined)
     $cropLength = empty($GLOBALS['BE_USER']->uc['titleLen']) ? 50 : $GLOBALS['BE_USER']->uc['titleLen'];
     $croppedTitle = \TYPO3\CMS\Core\Utility\GeneralUtility::fixed_lgd_cs($title, -$cropLength);
     if ($croppedTitle !== $title) {
         $pagePath .= '<abbr title="' . htmlspecialchars($title) . '">' . htmlspecialchars($croppedTitle) . '</abbr>';
     } else {
         $pagePath .= htmlspecialchars($title);
     }
     $pagePath .= '</span>';
     return $pagePath;
 }
Exemplo n.º 22
0
 /**
  * @param array $arguments
  * @param \Closure $renderChildrenClosure
  * @param RenderingContextInterface $renderingContext
  *
  * @return string
  */
 public static function renderStatic(array $arguments, \Closure $renderChildrenClosure, RenderingContextInterface $renderingContext)
 {
     $id = GeneralUtility::_GP('id');
     $pageRecord = BackendUtility::readPageAccess($id, $GLOBALS['BE_USER']->getPagePermsClause(1));
     // Is this a real page
     if ($pageRecord['uid']) {
         $title = $pageRecord['_thePathFull'];
     } else {
         $title = $GLOBALS['TYPO3_CONF_VARS']['SYS']['sitename'];
     }
     // Setting the path of the page
     $pagePath = htmlspecialchars($GLOBALS['LANG']->sL('LLL:EXT:lang/Resources/Private/Language/locallang_core.xlf:labels.path')) . ': <span class="typo3-docheader-pagePath">';
     // crop the title to title limit (or 50, if not defined)
     $cropLength = empty($GLOBALS['BE_USER']->uc['titleLen']) ? 50 : $GLOBALS['BE_USER']->uc['titleLen'];
     $croppedTitle = GeneralUtility::fixed_lgd_cs($title, -$cropLength);
     if ($croppedTitle !== $title) {
         $pagePath .= '<abbr title="' . htmlspecialchars($title) . '">' . htmlspecialchars($croppedTitle) . '</abbr>';
     } else {
         $pagePath .= htmlspecialchars($title);
     }
     $pagePath .= '</span>';
     return $pagePath;
 }
Exemplo n.º 23
0
 /**
  * @param array $arguments
  * @param callable $renderChildrenClosure
  * @param RenderingContextInterface $renderingContext
  *
  * @return string
  */
 public static function renderStatic(array $arguments, \Closure $renderChildrenClosure, RenderingContextInterface $renderingContext)
 {
     $doc = GeneralUtility::makeInstance(DocumentTemplate::class);
     $id = GeneralUtility::_GP('id');
     $pageRecord = BackendUtility::readPageAccess($id, $GLOBALS['BE_USER']->getPagePermsClause(1));
     // Add icon with clickmenu, etc:
     if ($pageRecord['uid']) {
         // If there IS a real page
         $alttext = BackendUtility::getRecordIconAltText($pageRecord, 'pages');
         $theIcon = IconUtility::getSpriteIconForRecord('pages', $pageRecord, array('title' => htmlspecialchars($alttext)));
         // Make Icon:
         $theIcon = $doc->wrapClickMenuOnIcon($theIcon, 'pages', $pageRecord['uid']);
         // Setting icon with clickmenu + uid
         $theIcon .= ' <em>[PID: ' . $pageRecord['uid'] . ']</em>';
     } else {
         // On root-level of page tree
         // Make Icon
         $theIcon = IconUtility::getSpriteIcon('apps-pagetree-page-domain', array('title' => htmlspecialchars($GLOBALS['TYPO3_CONF_VARS']['SYS']['sitename'])));
         if ($GLOBALS['BE_USER']->user['admin']) {
             $theIcon = $doc->wrapClickMenuOnIcon($theIcon, 'pages', 0);
         }
     }
     return $theIcon;
 }
 /**
  * Initialize module header etc and call extObjContent function
  *
  * @return void
  */
 public function main()
 {
     // 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 = BackendUtility::readPageAccess($this->id, $this->perms_clause);
     if ($this->pageinfo) {
         $this->moduleTemplate->getDocHeaderComponent()->setMetaInformation($this->pageinfo);
     }
     $access = is_array($this->pageinfo);
     // We keep this here, in case somebody relies on the old doc being here
     $this->doc = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Backend\Template\DocumentTemplate::class);
     // Main
     if ($this->id && $access) {
         // JavaScript
         $this->moduleTemplate->addJavaScriptCode('WebFuncInLineJS', 'if (top.fsMod) top.fsMod.recentIds["web"] = ' . (int) $this->id . ';');
         // Setting up the context sensitive menu:
         $this->moduleTemplate->getPageRenderer()->loadRequireJsModule('TYPO3/CMS/Backend/ClickMenu');
         $this->content .= '<form action="' . htmlspecialchars(BackendUtility::getModuleUrl('web_func')) . '" id="PageFunctionsController" method="post"><input type="hidden" name="id" value="' . htmlspecialchars($this->id) . '" />';
         $vContent = $this->moduleTemplate->getVersionSelector($this->id, true);
         if ($vContent) {
             $this->content .= '<div>' . $vContent . '</div>';
         }
         $this->extObjContent();
         // Setting up the buttons and markers for docheader
         $this->getButtons();
         $this->generateMenu();
         $this->content .= '</form>';
     } else {
         // If no access or if ID == zero
         $title = $this->getLanguageService()->getLL('title');
         $message = $this->getLanguageService()->getLL('clickAPage_content');
         $view = GeneralUtility::makeInstance(StandaloneView::class);
         $view->setTemplatePathAndFilename(GeneralUtility::getFileAbsFileName('EXT:func/Resources/Private/Templates/InfoBox.html'));
         $view->assignMultiple(array('title' => $title, 'message' => $message, 'state' => InfoboxViewHelper::STATE_INFO));
         $this->content = $view->render();
         // Setting up the buttons and markers for docheader
         $this->getButtons();
     }
 }
 /**
  * Get admin command
  *
  * @param integer $pageId
  * @return string
  */
 protected function getAdminCommand($pageId)
 {
     // The page will show only if there is a valid page and if this page may be viewed by the user
     $pageinfo = BackendUtility::readPageAccess($pageId, $GLOBALS['BE_USER']->getPagePermsClause(1));
     $addCommand = '';
     if (is_array($pageinfo)) {
         $addCommand = '&ADMCMD_editIcons=1' . BackendUtility::ADMCMD_previewCmds($pageinfo);
     }
     return $addCommand;
 }
Exemplo n.º 26
0
 /**
  * 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'));
 }
Exemplo n.º 27
0
    /**
     * Renders Content Elements from the tt_content table from page id
     *
     * @param int $id Page id
     * @return string HTML for the listing
     */
    public function getTable_tt_content($id)
    {
        $backendUser = $this->getBackendUser();
        $this->pageinfo = BackendUtility::readPageAccess($this->id, $backendUser->getPagePermsClause($this->ext_CALC_PERMS));
        $this->initializeLanguages();
        $this->initializeClipboard();
        $pageTitleParamForAltDoc = '&recTitle=' . rawurlencode(BackendUtility::getRecordTitle('pages', BackendUtility::getRecordWSOL('pages', $id), true));
        /** @var $pageRenderer PageRenderer */
        $pageRenderer = GeneralUtility::makeInstance(PageRenderer::class);
        $pageRenderer->loadRequireJsModule('TYPO3/CMS/Backend/LayoutModule/DragDrop');
        $pageRenderer->loadRequireJsModule('TYPO3/CMS/Backend/Modal');
        $userCanEditPage = $this->ext_CALC_PERMS & Permission::PAGE_EDIT && !empty($this->id) && ($backendUser->isAdmin() || (int) $this->pageinfo['editlock'] === 0);
        if ($this->tt_contentConfig['languageColsPointer'] > 0) {
            $userCanEditPage = $this->getBackendUser()->check('tables_modify', 'pages_language_overlay');
        }
        if ($userCanEditPage) {
            $pageRenderer->loadRequireJsModule('TYPO3/CMS/Backend/PageActions', 'function(PageActions) {
                PageActions.setPageId(' . (int) $this->id . ');
                PageActions.setLanguageOverlayId(' . $this->tt_contentConfig['languageColsPointer'] . ');
                PageActions.initializePageTitleRenaming();
            }');
        }
        // Get labels for CTypes and tt_content element fields in general:
        $this->CType_labels = array();
        foreach ($GLOBALS['TCA']['tt_content']['columns']['CType']['config']['items'] as $val) {
            $this->CType_labels[$val[1]] = $this->getLanguageService()->sL($val[0]);
        }
        $this->itemLabels = array();
        foreach ($GLOBALS['TCA']['tt_content']['columns'] as $name => $val) {
            $this->itemLabels[$name] = $this->getLanguageService()->sL($val['label']);
        }
        $languageColumn = array();
        $out = '';
        // Setting language list:
        $langList = $this->tt_contentConfig['sys_language_uid'];
        if ($this->tt_contentConfig['languageMode']) {
            if ($this->tt_contentConfig['languageColsPointer']) {
                $langList = '0,' . $this->tt_contentConfig['languageColsPointer'];
            } else {
                $langList = implode(',', array_keys($this->tt_contentConfig['languageCols']));
            }
            $languageColumn = array();
        }
        $langListArr = GeneralUtility::intExplode(',', $langList);
        $defLanguageCount = array();
        $defLangBinding = array();
        // For each languages... :
        // If not languageMode, then we'll only be through this once.
        foreach ($langListArr as $lP) {
            $lP = (int) $lP;
            if (!isset($this->contentElementCache[$lP])) {
                $this->contentElementCache[$lP] = array();
            }
            if (count($langListArr) === 1 || $lP === 0) {
                $showLanguage = ' AND sys_language_uid IN (' . $lP . ',-1)';
            } else {
                $showLanguage = ' AND sys_language_uid=' . $lP;
            }
            $cList = explode(',', $this->tt_contentConfig['cols']);
            $content = array();
            $head = array();
            // Select content records per column
            $contentRecordsPerColumn = $this->getContentRecordsPerColumn('table', $id, array_values($cList), $showLanguage);
            // For each column, render the content into a variable:
            foreach ($cList as $key) {
                if (!isset($this->contentElementCache[$lP][$key])) {
                    $this->contentElementCache[$lP][$key] = array();
                }
                if (!$lP) {
                    $defLanguageCount[$key] = array();
                }
                // Start wrapping div
                $content[$key] .= '<div data-colpos="' . $key . '" data-language-uid="' . $lP . '" class="t3js-sortable t3js-sortable-lang t3js-sortable-lang-' . $lP . ' t3-page-ce-wrapper';
                if (empty($contentRecordsPerColumn[$key])) {
                    $content[$key] .= ' t3-page-ce-empty';
                }
                $content[$key] .= '">';
                // Add new content at the top most position
                $link = '';
                if ($this->getPageLayoutController()->pageIsNotLockedForEditors() && $this->getBackendUser()->doesUserHaveAccess($this->pageinfo, Permission::CONTENT_EDIT)) {
                    $link = '<a href="#" onclick="' . htmlspecialchars($this->newContentElementOnClick($id, $key, $lP)) . '" title="' . $this->getLanguageService()->getLL('newContentElement', true) . '" class="btn btn-default btn-sm">' . $this->iconFactory->getIcon('actions-document-new', Icon::SIZE_SMALL)->render() . ' ' . $this->getLanguageService()->getLL('content', true) . '</a>';
                }
                $content[$key] .= '
				<div class="t3-page-ce t3js-page-ce" data-page="' . (int) $id . '" id="' . StringUtility::getUniqueId() . '">
					<div class="t3js-page-new-ce t3-page-ce-wrapper-new-ce" id="colpos-' . $key . '-' . 'page-' . $id . '-' . StringUtility::getUniqueId() . '">' . $link . '</div>
                    <div class="t3-page-ce-dropzone-available t3js-page-ce-dropzone-available"></div>
                </div>
				';
                $editUidList = '';
                $rowArr = $contentRecordsPerColumn[$key];
                $this->generateTtContentDataArray($rowArr);
                foreach ((array) $rowArr as $rKey => $row) {
                    $this->contentElementCache[$lP][$key][$row['uid']] = $row;
                    if ($this->tt_contentConfig['languageMode']) {
                        $languageColumn[$key][$lP] = $head[$key] . $content[$key];
                        if (!$this->defLangBinding) {
                            $languageColumn[$key][$lP] .= $this->newLanguageButton($this->getNonTranslatedTTcontentUids($defLanguageCount[$key], $id, $lP), $lP, $key);
                        }
                    }
                    if (is_array($row) && !VersionState::cast($row['t3ver_state'])->equals(VersionState::DELETE_PLACEHOLDER)) {
                        $singleElementHTML = '';
                        if (!$lP && ($this->defLangBinding || $row['sys_language_uid'] != -1)) {
                            $defLanguageCount[$key][] = isset($row['_ORIG_uid']) ? $row['_ORIG_uid'] : $row['uid'];
                        }
                        $editUidList .= $row['uid'] . ',';
                        $disableMoveAndNewButtons = $this->defLangBinding && $lP > 0;
                        if (!$this->tt_contentConfig['languageMode']) {
                            $singleElementHTML .= '<div class="t3-page-ce-dragitem" id="' . StringUtility::getUniqueId() . '">';
                        }
                        $singleElementHTML .= $this->tt_content_drawHeader($row, $this->tt_contentConfig['showInfo'] ? 15 : 5, $disableMoveAndNewButtons, !$this->tt_contentConfig['languageMode'], $this->getBackendUser()->doesUserHaveAccess($this->pageinfo, Permission::CONTENT_EDIT));
                        $innerContent = '<div ' . ($row['_ORIG_uid'] ? ' class="ver-element"' : '') . '>' . $this->tt_content_drawItem($row) . '</div>';
                        $singleElementHTML .= '<div class="t3-page-ce-body-inner">' . $innerContent . '</div>' . $this->tt_content_drawFooter($row);
                        $isDisabled = $this->isDisabled('tt_content', $row);
                        $statusHidden = $isDisabled ? ' t3-page-ce-hidden t3js-hidden-record' : '';
                        $displayNone = !$this->tt_contentConfig['showHidden'] && $isDisabled ? ' style="display: none;"' : '';
                        $singleElementHTML = '<div class="t3-page-ce t3js-page-ce t3js-page-ce-sortable ' . $statusHidden . '" id="element-tt_content-' . $row['uid'] . '" data-table="tt_content" data-uid="' . $row['uid'] . '"' . $displayNone . '>' . $singleElementHTML . '</div>';
                        if ($this->tt_contentConfig['languageMode']) {
                            $singleElementHTML .= '<div class="t3-page-ce t3js-page-ce">';
                        }
                        $singleElementHTML .= '<div class="t3js-page-new-ce t3-page-ce-wrapper-new-ce" id="colpos-' . $key . '-' . 'page-' . $id . '-' . StringUtility::getUniqueId() . '">';
                        // Add icon "new content element below"
                        if (!$disableMoveAndNewButtons && $this->getPageLayoutController()->pageIsNotLockedForEditors() && $this->getBackendUser()->doesUserHaveAccess($this->pageinfo, Permission::CONTENT_EDIT)) {
                            // New content element:
                            if ($this->option_newWizard) {
                                $onClick = 'window.location.href=' . GeneralUtility::quoteJSvalue(BackendUtility::getModuleUrl('new_content_element') . '&id=' . $row['pid'] . '&sys_language_uid=' . $row['sys_language_uid'] . '&colPos=' . $row['colPos'] . '&uid_pid=' . -$row['uid'] . '&returnUrl=' . rawurlencode(GeneralUtility::getIndpEnv('REQUEST_URI'))) . ';';
                            } else {
                                $params = '&edit[tt_content][' . -$row['uid'] . ']=new';
                                $onClick = BackendUtility::editOnClick($params);
                            }
                            $singleElementHTML .= '
								<a href="#" onclick="' . htmlspecialchars($onClick) . '" title="' . $this->getLanguageService()->getLL('newContentElement', true) . '" class="btn btn-default btn-sm">' . $this->iconFactory->getIcon('actions-document-new', Icon::SIZE_SMALL)->render() . ' ' . $this->getLanguageService()->getLL('content', true) . '</a>
							';
                        }
                        $singleElementHTML .= '</div></div><div class="t3-page-ce-dropzone-available t3js-page-ce-dropzone-available"></div></div>';
                        if ($this->defLangBinding && $this->tt_contentConfig['languageMode']) {
                            $defLangBinding[$key][$lP][$row[$lP ? 'l18n_parent' : 'uid']] = $singleElementHTML;
                        } else {
                            $content[$key] .= $singleElementHTML;
                        }
                    } else {
                        unset($rowArr[$rKey]);
                    }
                }
                $content[$key] .= '</div>';
                // Add new-icon link, header:
                $newP = $this->newContentElementOnClick($id, $key, $lP);
                $colTitle = BackendUtility::getProcessedValue('tt_content', 'colPos', $key);
                $tcaItems = GeneralUtility::callUserFunction(\TYPO3\CMS\Backend\View\BackendLayoutView::class . '->getColPosListItemsParsed', $id, $this);
                foreach ($tcaItems as $item) {
                    if ($item[1] == $key) {
                        $colTitle = $this->getLanguageService()->sL($item[0]);
                    }
                }
                $pasteP = array('colPos' => $key, 'sys_language_uid' => $lP);
                $editParam = $this->doEdit && !empty($rowArr) ? '&edit[tt_content][' . $editUidList . ']=edit' . $pageTitleParamForAltDoc : '';
                $head[$key] .= $this->tt_content_drawColHeader($colTitle, $editParam, $newP, $pasteP);
            }
            // For each column, fit the rendered content into a table cell:
            $out = '';
            if ($this->tt_contentConfig['languageMode']) {
                // in language mode process the content elements, but only fill $languageColumn. output will be generated later
                $sortedLanguageColumn = array();
                foreach ($cList as $key) {
                    $languageColumn[$key][$lP] = $head[$key] . $content[$key];
                    if (!$this->defLangBinding) {
                        $languageColumn[$key][$lP] .= $this->newLanguageButton($this->getNonTranslatedTTcontentUids($defLanguageCount[$key], $id, $lP), $lP, $key);
                    }
                    // We sort $languageColumn again according to $cList as it may contain data already from above.
                    $sortedLanguageColumn[$key] = $languageColumn[$key];
                }
                $languageColumn = $sortedLanguageColumn;
            } else {
                $backendLayout = $this->getBackendLayoutView()->getSelectedBackendLayout($this->id);
                // GRID VIEW:
                $grid = '<div class="t3-grid-container"><table border="0" cellspacing="0" cellpadding="0" width="100%" class="t3-page-columns t3-grid-table t3js-page-columns">';
                // Add colgroups
                $colCount = (int) $backendLayout['__config']['backend_layout.']['colCount'];
                $rowCount = (int) $backendLayout['__config']['backend_layout.']['rowCount'];
                $grid .= '<colgroup>';
                for ($i = 0; $i < $colCount; $i++) {
                    $grid .= '<col style="width:' . 100 / $colCount . '%"></col>';
                }
                $grid .= '</colgroup>';
                // Cycle through rows
                for ($row = 1; $row <= $rowCount; $row++) {
                    $rowConfig = $backendLayout['__config']['backend_layout.']['rows.'][$row . '.'];
                    if (!isset($rowConfig)) {
                        continue;
                    }
                    $grid .= '<tr>';
                    for ($col = 1; $col <= $colCount; $col++) {
                        $columnConfig = $rowConfig['columns.'][$col . '.'];
                        if (!isset($columnConfig)) {
                            continue;
                        }
                        // Which tt_content colPos should be displayed inside this cell
                        $columnKey = (int) $columnConfig['colPos'];
                        // Render the grid cell
                        $colSpan = (int) $columnConfig['colspan'];
                        $rowSpan = (int) $columnConfig['rowspan'];
                        $grid .= '<td valign="top"' . ($colSpan > 0 ? ' colspan="' . $colSpan . '"' : '') . ($rowSpan > 0 ? ' rowspan="' . $rowSpan . '"' : '') . ' data-colpos="' . (int) $columnConfig['colPos'] . '" data-language-uid="' . $lP . '" class="t3js-page-lang-column-' . $lP . ' t3js-page-column t3-grid-cell t3-page-column t3-page-column-' . $columnKey . (!isset($columnConfig['colPos']) || $columnConfig['colPos'] === '' ? ' t3-grid-cell-unassigned' : '') . (isset($columnConfig['colPos']) && $columnConfig['colPos'] !== '' && !$head[$columnKey] || !GeneralUtility::inList($this->tt_contentConfig['activeCols'], $columnConfig['colPos']) ? ' t3-grid-cell-restricted' : '') . ($colSpan > 0 ? ' t3-gridCell-width' . $colSpan : '') . ($rowSpan > 0 ? ' t3-gridCell-height' . $rowSpan : '') . '">';
                        // Draw the pre-generated header with edit and new buttons if a colPos is assigned.
                        // If not, a new header without any buttons will be generated.
                        if (isset($columnConfig['colPos']) && $columnConfig['colPos'] !== '' && $head[$columnKey] && GeneralUtility::inList($this->tt_contentConfig['activeCols'], $columnConfig['colPos'])) {
                            $grid .= $head[$columnKey] . $content[$columnKey];
                        } elseif (isset($columnConfig['colPos']) && $columnConfig['colPos'] !== '' && GeneralUtility::inList($this->tt_contentConfig['activeCols'], $columnConfig['colPos'])) {
                            $grid .= $this->tt_content_drawColHeader($this->getLanguageService()->getLL('noAccess'), '', '');
                        } elseif (isset($columnConfig['colPos']) && $columnConfig['colPos'] !== '' && !GeneralUtility::inList($this->tt_contentConfig['activeCols'], $columnConfig['colPos'])) {
                            $grid .= $this->tt_content_drawColHeader($this->getLanguageService()->sL($columnConfig['name']) . ' (' . $this->getLanguageService()->getLL('noAccess') . ')', '', '');
                        } elseif (isset($columnConfig['name']) && $columnConfig['name'] !== '') {
                            $grid .= $this->tt_content_drawColHeader($this->getLanguageService()->sL($columnConfig['name']) . ' (' . $this->getLanguageService()->getLL('notAssigned') . ')', '', '');
                        } else {
                            $grid .= $this->tt_content_drawColHeader($this->getLanguageService()->getLL('notAssigned'), '', '');
                        }
                        $grid .= '</td>';
                    }
                    $grid .= '</tr>';
                }
                $out .= $grid . '</table></div>';
            }
            // CSH:
            $out .= BackendUtility::cshItem($this->descrTable, 'columns_multi');
        }
        // If language mode, then make another presentation:
        // Notice that THIS presentation will override the value of $out!
        // But it needs the code above to execute since $languageColumn is filled with content we need!
        if ($this->tt_contentConfig['languageMode']) {
            // Get language selector:
            $languageSelector = $this->languageSelector($id);
            // Reset out - we will make new content here:
            $out = '';
            // Traverse languages found on the page and build up the table displaying them side by side:
            $cCont = array();
            $sCont = array();
            foreach ($langListArr as $lP) {
                // Header:
                $lP = (int) $lP;
                $cCont[$lP] = '
					<td valign="top" class="t3-page-column" data-language-uid="' . $lP . '">
						<h2>' . htmlspecialchars($this->tt_contentConfig['languageCols'][$lP]) . '</h2>
					</td>';
                // "View page" icon is added:
                $viewLink = '';
                if (!VersionState::cast($this->getPageLayoutController()->pageinfo['t3ver_state'])->equals(VersionState::DELETE_PLACEHOLDER)) {
                    $onClick = BackendUtility::viewOnClick($this->id, '', BackendUtility::BEgetRootLine($this->id), '', '', '&L=' . $lP);
                    $viewLink = '<a href="#" class="btn btn-default btn-sm" onclick="' . htmlspecialchars($onClick) . '" title="' . $this->getLanguageService()->sL('LLL:EXT:lang/locallang_core.xlf:labels.showPage', true) . '">' . $this->iconFactory->getIcon('actions-view', Icon::SIZE_SMALL)->render() . '</a>';
                }
                // Language overlay page header:
                if ($lP) {
                    list($lpRecord) = BackendUtility::getRecordsByField('pages_language_overlay', 'pid', $id, 'AND sys_language_uid=' . $lP);
                    BackendUtility::workspaceOL('pages_language_overlay', $lpRecord);
                    $params = '&edit[pages_language_overlay][' . $lpRecord['uid'] . ']=edit&overrideVals[pages_language_overlay][sys_language_uid]=' . $lP;
                    $recordIcon = BackendUtility::wrapClickMenuOnIcon($this->iconFactory->getIconForRecord('pages_language_overlay', $lpRecord, Icon::SIZE_SMALL)->render(), 'pages_language_overlay', $lpRecord['uid']);
                    $editLink = $this->getBackendUser()->check('tables_modify', 'pages_language_overlay') ? '<a href="#" class="btn btn-default btn-sm" onclick="' . htmlspecialchars(BackendUtility::editOnClick($params)) . '" title="' . $this->getLanguageService()->getLL('edit', true) . '">' . $this->iconFactory->getIcon('actions-open', Icon::SIZE_SMALL)->render() . '</a>' : '';
                    $lPLabel = '<div class="btn-group">' . $viewLink . $editLink . '</div>' . ' ' . $recordIcon . ' ' . htmlspecialchars(GeneralUtility::fixed_lgd_cs($lpRecord['title'], 20));
                } else {
                    $params = '&edit[pages][' . $this->id . ']=edit';
                    $recordIcon = BackendUtility::wrapClickMenuOnIcon($this->iconFactory->getIconForRecord('pages', $this->pageRecord, Icon::SIZE_SMALL)->render(), 'pages', $this->id);
                    $editLink = $this->getBackendUser()->check('tables_modify', 'pages_language_overlay') ? '<a href="#" class="btn btn-default btn-sm" onclick="' . htmlspecialchars(BackendUtility::editOnClick($params)) . '" title="' . $this->getLanguageService()->getLL('edit', true) . '">' . $this->iconFactory->getIcon('actions-open', Icon::SIZE_SMALL)->render() . '</a>' : '';
                    $lPLabel = '<div class="btn-group">' . $viewLink . $editLink . '</div>' . ' ' . $recordIcon . ' ' . htmlspecialchars(GeneralUtility::fixed_lgd_cs($this->pageRecord['title'], 20));
                }
                $sCont[$lP] = '
					<td nowrap="nowrap" class="t3-page-column t3-page-lang-label">' . $lPLabel . '</td>';
            }
            // Add headers:
            $out .= '<tr>' . implode($cCont) . '</tr>';
            $out .= '<tr>' . implode($sCont) . '</tr>';
            unset($cCont, $sCont);
            // Traverse previously built content for the columns:
            foreach ($languageColumn as $cKey => $cCont) {
                $out .= '<tr>';
                foreach ($cCont as $languageId => $columnContent) {
                    $out .= '<td valign="top" class="t3-grid-cell t3-page-column t3js-page-column t3js-page-lang-column t3js-page-lang-column-' . $languageId . '">' . $columnContent . '</td>';
                }
                $out .= '</tr>';
                if ($this->defLangBinding) {
                    // "defLangBinding" mode
                    foreach ($defLanguageCount[$cKey] as $defUid) {
                        $cCont = array();
                        foreach ($langListArr as $lP) {
                            $cCont[] = $defLangBinding[$cKey][$lP][$defUid] . $this->newLanguageButton($this->getNonTranslatedTTcontentUids(array($defUid), $id, $lP), $lP, $cKey);
                        }
                        $out .= '
                        <tr>
							<td valign="top" class="t3-grid-cell">' . implode('</td>' . '
							<td valign="top" class="t3-grid-cell">', $cCont) . '</td>
						</tr>';
                    }
                }
            }
            // Finally, wrap it all in a table and add the language selector on top of it:
            $out = $languageSelector . '
                <div class="t3-grid-container">
                    <table cellpadding="0" cellspacing="0" class="t3-page-columns t3-grid-table t3js-page-columns">
						' . $out . '
                    </table>
				</div>';
            // CSH:
            $out .= BackendUtility::cshItem($this->descrTable, 'language_list');
        }
        return $out;
    }
Exemplo n.º 28
0
 /**
  * Main
  *
  * @return void
  */
 public function main()
 {
     // 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 = BackendUtility::readPageAccess($this->id, $this->perms_clause);
     $this->access = is_array($this->pageinfo);
     $view = $this->getFluidTemplateObject('tstemplate');
     if ($this->id && $this->access) {
         $urlParameters = ['id' => $this->id, 'template' => 'all'];
         $aHref = BackendUtility::getModuleUrl('web_ts', $urlParameters);
         // JavaScript
         $this->moduleTemplate->addJavaScriptCode('TSTemplateInlineJS', 'function uFormUrl(aname) {
                 document.forms[0].action = ' . GeneralUtility::quoteJSvalue($aHref . '#') . '+aname;
             }
             function brPoint(lnumber,t) {
                 window.location.href = ' . GeneralUtility::quoteJSvalue($aHref . '&SET[function]=TYPO3\\CMS\\Tstemplate\\Controller\\' . 'TypoScriptTemplateObjectBrowserModuleFunctionController&SET[ts_browser_type]=') . '+(t?"setup":"const")+"&breakPointLN="+lnumber;
                 return false;
             }
             if (top.fsMod) top.fsMod.recentIds["web"] = ' . $this->id . ';');
         $this->moduleTemplate->getPageRenderer()->addCssInlineBlock('TSTemplateInlineStyle', 'TABLE#typo3-objectBrowser { width: 100%; margin-bottom: 24px; }
             TABLE#typo3-objectBrowser A { text-decoration: none; }
             TABLE#typo3-objectBrowser .comment { color: maroon; font-weight: bold; }
             .ts-typoscript { width: 100%; }
             .tsob-search-submit {margin-left: 3px; margin-right: 3px;}
             .tst-analyzer-options { margin:5px 0; }');
         // Setting up the context sensitive menu:
         $this->moduleTemplate->getPageRenderer()->loadRequireJsModule('TYPO3/CMS/Backend/ClickMenu');
         // Build the module content
         $view->assign('actionName', $aHref);
         $view->assign('typoscriptTemplateModuleContent', $this->getExtObjContent());
         // Setting up the buttons and markers for docheader
         $this->getButtons();
         $this->generateMenu();
     } else {
         $queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class)->getQueryBuilderForTable('pages');
         $queryBuilder->getRestrictions()->removeAll()->add(GeneralUtility::makeInstance(DeletedRestriction::class))->add(GeneralUtility::makeInstance(BackendWorkspaceRestriction::class));
         $result = $queryBuilder->select('pages.uid')->addSelectLiteral($queryBuilder->expr()->count('*', 'count'), $queryBuilder->expr()->max('sys_template.root', 'root_max_val'), $queryBuilder->expr()->min('sys_template.root', 'root_min_val'))->from('pages')->from('sys_template')->where($queryBuilder->expr()->eq('pages.uid', $queryBuilder->quoteIdentifier('sys_template.pid')))->groupBy('pages.uid')->orderBy('pages.pid')->addOrderBy('pages.sorting')->execute();
         $pArray = [];
         while ($record = $result->fetch()) {
             $this->setInPageArray($pArray, BackendUtility::BEgetRootLine($record['uid'], 'AND 1=1'), $record);
         }
         $view->getRenderingContext()->setControllerAction('PageZero');
         $view->assign('templateList', $this->renderList($pArray));
         // RENDER LIST of pages with templates, END
         // Setting up the buttons and markers for docheader
         $this->getButtons();
     }
     $this->content = $view->render();
 }
Exemplo n.º 29
0
 /**
  * Constructor, initializing internal variables.
  *
  * @return void
  */
 public function init()
 {
     $lang = $this->getLanguageService();
     $lang->includeLLFile('EXT:lang/locallang_misc.xlf');
     $LOCAL_LANG_orig = $GLOBALS['LOCAL_LANG'];
     $lang->includeLLFile('EXT:backend/Resources/Private/Language/locallang_db_new_content_el.xlf');
     ArrayUtility::mergeRecursiveWithOverrule($LOCAL_LANG_orig, $GLOBALS['LOCAL_LANG']);
     $GLOBALS['LOCAL_LANG'] = $LOCAL_LANG_orig;
     // Setting internal vars:
     $this->id = (int) GeneralUtility::_GP('id');
     $this->sys_language = (int) GeneralUtility::_GP('sys_language_uid');
     $this->R_URI = GeneralUtility::sanitizeLocalUrl(GeneralUtility::_GP('returnUrl'));
     $this->colPos = GeneralUtility::_GP('colPos') === null ? null : (int) GeneralUtility::_GP('colPos');
     $this->uid_pid = (int) GeneralUtility::_GP('uid_pid');
     $this->MCONF['name'] = 'xMOD_db_new_content_el';
     $this->modTSconfig = BackendUtility::getModTSconfig($this->id, 'mod.wizards.newContentElement');
     $config = BackendUtility::getPagesTSconfig($this->id);
     $this->config = $config['mod.']['wizards.']['newContentElement.'];
     // Starting the document template object:
     // We keep this here in case somebody relies on it in a hook or alike
     $this->doc = GeneralUtility::makeInstance(DocumentTemplate::class);
     // Setting up the context sensitive menu:
     $this->moduleTemplate->getPageRenderer()->loadRequireJsModule('TYPO3/CMS/Backend/ClickMenu');
     // Getting the current page and receiving access information (used in main())
     $perms_clause = $this->getBackendUser()->getPagePermsClause(1);
     $this->pageInfo = BackendUtility::readPageAccess($this->id, $perms_clause);
     $this->access = is_array($this->pageInfo) ? 1 : 0;
 }
 /**
  * Main function of the module. Write the content to $this->content.
  *
  * @return void
  */
 public function main()
 {
     $backendUser = $this->getBackendUser();
     $language = $this->getLanguageService();
     // 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);
     // Checking access:
     if ($this->id && $access || $backendUser->isAdmin()) {
         // Render content:
         $this->moduleContent();
     } else {
         // If no access or if ID == zero
         $this->content .= $this->doc->header($language->getLL('statistic'));
     }
     $docHeaderButtons = $this->getHeaderButtons();
     $markers = array('CSH' => $docHeaderButtons['csh'], 'CONTENT' => $this->content);
     $markers['FUNC_MENU'] = $this->doc->funcMenu('', \TYPO3\CMS\Backend\Utility\BackendUtility::getFuncMenu($this->id, 'SET[function]', $this->MOD_SETTINGS['function'], $this->MOD_MENU['function']));
     // put it all together
     $this->content = $this->doc->startPage($language->getLL('statistic'));
     $this->content .= $this->doc->moduleBody($this->pageinfo, $docHeaderButtons, $markers);
     $this->content .= $this->doc->endPage();
     $this->content = $this->doc->insertStylesAndJS($this->content);
 }