コード例 #1
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);
     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();
     }
 }
コード例 #2
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'));
        }
    }
コード例 #3
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);
     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->view = $this->getFluidTemplateObject('func', 'func');
         $this->view->assign('moduleName', BackendUtility::getModuleUrl('web_func'));
         $this->view->assign('id', $this->id);
         $this->view->assign('versionSelector', $this->moduleTemplate->getVersionSelector($this->id, true));
         $this->view->assign('functionMenuModuleContent', $this->getExtObjContent());
         // Setting up the buttons and markers for docheader
         $this->getButtons();
         $this->generateMenu();
         $this->content .= $this->view->render();
     } else {
         // If no access or if ID == zero
         $title = $this->getLanguageService()->getLL('title');
         $message = $this->getLanguageService()->getLL('clickAPage_content');
         $this->view = $this->getFluidTemplateObject('func', 'func', 'InfoBox');
         $this->view->assignMultiple(['title' => $title, 'message' => $message, 'state' => InfoboxViewHelper::STATE_INFO]);
         $this->content = $this->view->render();
         // Setting up the buttons and markers for docheader
         $this->getButtons();
     }
 }
コード例 #4
0
 /**
  * Rendering all other listings than QuickEdit
  *
  * @return string
  */
 public function renderListContent()
 {
     $this->moduleTemplate->getPageRenderer()->loadJquery();
     $this->moduleTemplate->getPageRenderer()->loadRequireJsModule('TYPO3/CMS/Backend/ClickMenu');
     /** @var $dbList \TYPO3\CMS\Backend\View\PageLayoutView */
     $dbList = GeneralUtility::makeInstance(PageLayoutView::class);
     $dbList->thumbs = $this->imagemode;
     $dbList->no_noWrap = 1;
     $dbList->descrTable = $this->descrTable;
     $this->pointer = MathUtility::forceIntegerInRange($this->pointer, 0, 100000);
     $dbList->script = BackendUtility::getModuleUrl($this->moduleName);
     $dbList->showIcon = 0;
     $dbList->setLMargin = 0;
     $dbList->doEdit = $this->EDIT_CONTENT;
     $dbList->ext_CALC_PERMS = $this->CALC_PERMS;
     $dbList->agePrefixes = $this->getLanguageService()->sL('LLL:EXT:lang/locallang_core.xlf:labels.minutesHoursDaysYears');
     $dbList->id = $this->id;
     $dbList->nextThree = MathUtility::forceIntegerInRange($this->modTSconfig['properties']['editFieldsAtATime'], 0, 10);
     $dbList->option_newWizard = $this->modTSconfig['properties']['disableNewContentElementWizard'] ? 0 : 1;
     $dbList->defLangBinding = $this->modTSconfig['properties']['defLangBinding'] ? 1 : 0;
     if (!$dbList->nextThree) {
         $dbList->nextThree = 1;
     }
     $dbList->externalTables = $this->externalTables;
     // Create menu for selecting a table to jump to (this is, if more than just pages/tt_content elements are found on the page!)
     // also fills $dbList->activeTables
     $dbList->getTableMenu($this->id);
     // Initialize other variables:
     $tableOutput = array();
     $tableJSOutput = array();
     $CMcounter = 0;
     // Traverse the list of table names which has records on this page (that array is populated
     // by the $dblist object during the function getTableMenu()):
     foreach ($dbList->activeTables as $table => $value) {
         $h_func = '';
         $h_func_b = '';
         if (!isset($dbList->externalTables[$table])) {
             // Toggle hidden ContentElements
             $numberOfHiddenElements = $this->getNumberOfHiddenElements();
             if ($numberOfHiddenElements > 0) {
                 $h_func_b = '
                     <div class="checkbox">
                         <label for="checkTt_content_showHidden">
                             <input type="checkbox" id="checkTt_content_showHidden" class="checkbox" name="SET[tt_content_showHidden]" value="1" ' . ($this->MOD_SETTINGS['tt_content_showHidden'] ? 'checked="checked"' : '') . ' />
                             ' . $this->getLanguageService()->getLL('hiddenCE', true) . ' (<span class="t3js-hidden-counter">' . $numberOfHiddenElements . '</span>)
                         </label>
                     </div>';
             }
             // Boolean: Display up/down arrows and edit icons for tt_content records
             $dbList->tt_contentConfig['showCommands'] = 1;
             // Boolean: Display info-marks or not
             $dbList->tt_contentConfig['showInfo'] = 1;
             // Setting up the tt_content columns to show:
             if (is_array($GLOBALS['TCA']['tt_content']['columns']['colPos']['config']['items'])) {
                 $colList = array();
                 $tcaItems = GeneralUtility::callUserFunction(BackendLayoutView::class . '->getColPosListItemsParsed', $this->id, $this);
                 foreach ($tcaItems as $temp) {
                     $colList[] = $temp[1];
                 }
             } else {
                 // ... should be impossible that colPos has no array. But this is the fallback should it make any sense:
                 $colList = array('1', '0', '2', '3');
             }
             if ($this->colPosList !== '') {
                 $colList = array_intersect(GeneralUtility::intExplode(',', $this->colPosList), $colList);
             }
             // The order of the rows: Default is left(1), Normal(0), right(2), margin(3)
             $dbList->tt_contentConfig['cols'] = implode(',', $colList);
             $dbList->tt_contentConfig['activeCols'] = $this->activeColPosList;
             $dbList->tt_contentConfig['showHidden'] = $this->MOD_SETTINGS['tt_content_showHidden'];
             $dbList->tt_contentConfig['sys_language_uid'] = (int) $this->current_sys_language;
             // If the function menu is set to "Language":
             if ($this->MOD_SETTINGS['function'] == 2) {
                 $dbList->tt_contentConfig['languageMode'] = 1;
                 $dbList->tt_contentConfig['languageCols'] = $this->MOD_MENU['language'];
                 $dbList->tt_contentConfig['languageColsPointer'] = $this->current_sys_language;
             }
         } else {
             if (isset($this->MOD_SETTINGS) && isset($this->MOD_MENU)) {
                 $h_func = BackendUtility::getFuncMenu($this->id, 'SET[' . $table . ']', $this->MOD_SETTINGS[$table], $this->MOD_MENU[$table], '', '');
             }
         }
         // Start the dblist object:
         $dbList->itemsLimitSingleTable = 1000;
         $dbList->start($this->id, $table, $this->pointer, $this->search_field, $this->search_levels, $this->showLimit);
         $dbList->counter = $CMcounter;
         $dbList->ext_function = $this->MOD_SETTINGS['function'];
         // Render versioning selector:
         $dbList->HTMLcode .= $this->moduleTemplate->getVersionSelector($this->id);
         // Generate the list of elements here:
         $dbList->generateList();
         // Adding the list content to the tableOutput variable:
         $tableOutput[$table] = $h_func . $dbList->HTMLcode . $h_func_b;
         // ... and any accumulated JavaScript goes the same way!
         $tableJSOutput[$table] = $dbList->JScode;
         // Increase global counter:
         $CMcounter += $dbList->counter;
         // Reset variables after operation:
         $dbList->HTMLcode = '';
         $dbList->JScode = '';
     }
     // END: traverse tables
     // For Context Sensitive Menus:
     // Init the content
     $content = '';
     // Additional header content
     $headerContentHook = $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['cms/layout/db_layout.php']['drawHeaderHook'];
     if (is_array($headerContentHook)) {
         foreach ($headerContentHook as $hook) {
             $params = array();
             $content .= GeneralUtility::callUserFunction($hook, $params, $this);
         }
     }
     // Add the content for each table we have rendered (traversing $tableOutput variable)
     foreach ($tableOutput as $table => $output) {
         $content .= $output;
     }
     // Making search form:
     if (!$this->modTSconfig['properties']['disableSearchBox'] && !empty($tableOutput)) {
         $this->getPageRenderer()->loadRequireJsModule('TYPO3/CMS/Backend/ToggleSearchToolbox');
         $toggleSearchFormButton = $this->buttonBar->makeLinkButton()->setClasses('t3js-toggle-search-toolbox')->setTitle($this->getLanguageService()->sL('LLL:EXT:lang/locallang_core.xlf:labels.title.searchIcon', true))->setIcon($this->iconFactory->getIcon('actions-search', Icon::SIZE_SMALL))->setHref('#');
         $this->buttonBar->addButton($toggleSearchFormButton, ButtonBar::BUTTON_POSITION_LEFT, 4);
         $this->searchContent = $dbList->getSearchBox();
     }
     // Additional footer content
     $footerContentHook = $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['cms/layout/db_layout.php']['drawFooterHook'];
     if (is_array($footerContentHook)) {
         foreach ($footerContentHook as $hook) {
             $params = array();
             $content .= GeneralUtility::callUserFunction($hook, $params, $this);
         }
     }
     return $content;
 }