php TYPO3-CMS-Backend-Template-ModuleTemplate类(方法)实例源码

下面列出了php TYPO3-CMS-Backend-Template-ModuleTemplate 类(方法)源码代码实例,从而了解它的用法。

作者:CDR    项目:TYPO3.CM   
/**
  * Create the panel of buttons for submitting the form or otherwise perform
  * operations.
  *
  * @param ModuleTemplate $moduleTemplate
  */
 public function getDocHeaderButtons(ModuleTemplate $moduleTemplate)
 {
     $buttonBar = $moduleTemplate->getDocHeaderComponent()->getButtonBar();
     $module = $this->getModule();
     $backendUser = $this->getBackendUserAuthentication();
     $lang = $this->getLanguageService();
     // Get users permissions for this page record:
     $localCalcPerms = $backendUser->calcPerms($this->pageRow);
     // CSH
     if ((string) $this->id === '') {
         $fieldName = 'list_module_noId';
     } elseif (!$this->id) {
         $fieldName = 'list_module_root';
     } else {
         $fieldName = 'list_module';
     }
     $cshButton = $buttonBar->makeHelpButton()->setModuleName('xMOD_csh_corebe')->setFieldName($fieldName);
     $buttonBar->addButton($cshButton);
     if (isset($this->id)) {
         // View Exclude doktypes 254,255 Configuration:
         // mod.web_list.noViewWithDokTypes = 254,255
         if (isset($module->modTSconfig['properties']['noViewWithDokTypes'])) {
             $noViewDokTypes = GeneralUtility::trimExplode(',', $module->modTSconfig['properties']['noViewWithDokTypes'], true);
         } else {
             //default exclusion: doktype 254 (folder), 255 (recycler)
             $noViewDokTypes = array(PageRepository::DOKTYPE_SYSFOLDER, PageRepository::DOKTYPE_RECYCLER);
         }
         // New record on pages that are not locked by editlock
         if (!$module->modTSconfig['properties']['noCreateRecordsLink'] && $this->editLockPermissions()) {
             $onClick = 'return jumpExt(' . GeneralUtility::quoteJSvalue(BackendUtility::getModuleUrl('db_new', ['id' => $this->id])) . ');';
             $newRecordButton = $buttonBar->makeLinkButton()->setHref('#')->setOnClick($onClick)->setTitle($lang->getLL('newRecordGeneral', true))->setIcon($this->iconFactory->getIcon('actions-document-new', Icon::SIZE_SMALL));
             $buttonBar->addButton($newRecordButton, ButtonBar::BUTTON_POSITION_LEFT, 10);
         }
         if (!in_array($this->pageRow['doktype'], $noViewDokTypes)) {
             $onClick = BackendUtility::viewOnClick($this->id, '', BackendUtility::BEgetRootLine($this->id));
             $viewButton = $buttonBar->makeLinkButton()->setHref('#')->setOnClick($onClick)->setTitle($lang->sL('LLL:EXT:lang/locallang_core.xlf:labels.showPage', true))->setIcon($this->iconFactory->getIcon('actions-document-view', Icon::SIZE_SMALL));
             $buttonBar->addButton($viewButton, ButtonBar::BUTTON_POSITION_LEFT, 20);
         }
         // If edit permissions are set, see
         // \TYPO3\CMS\Core\Authentication\BackendUserAuthentication
         if ($localCalcPerms & Permission::PAGE_EDIT && !empty($this->id) && $this->editLockPermissions()) {
             // Edit
             $params = '&edit[pages][' . $this->pageRow['uid'] . ']=edit';
             $onClick = BackendUtility::editOnClick($params, '', -1);
             $editButton = $buttonBar->makeLinkButton()->setHref('#')->setOnClick($onClick)->setTitle($lang->getLL('editPage', true))->setIcon($this->iconFactory->getIcon('actions-page-open', Icon::SIZE_SMALL));
             $buttonBar->addButton($editButton, ButtonBar::BUTTON_POSITION_LEFT, 20);
         }
         // Paste
         if (($localCalcPerms & Permission::PAGE_NEW || $localCalcPerms & Permission::CONTENT_EDIT) && $this->editLockPermissions()) {
             $elFromTable = $this->clipObj->elFromTable('');
             if (!empty($elFromTable)) {
                 $onClick = 'return ' . $this->clipObj->confirmMsg('pages', $this->pageRow, 'into', $elFromTable);
                 $pasteButton = $buttonBar->makeLinkButton()->setHref($this->clipObj->pasteUrl('', $this->id))->setOnClick($onClick)->setTitle($lang->getLL('clip_paste', true))->setIcon($this->iconFactory->getIcon('actions-document-paste-after', Icon::SIZE_SMALL));
                 $buttonBar->addButton($pasteButton, ButtonBar::BUTTON_POSITION_LEFT, 40);
             }
         }
         // Cache
         $clearCacheButton = $buttonBar->makeLinkButton()->setHref($this->listURL() . '&clear_cache=1')->setTitle($lang->sL('LLL:EXT:lang/locallang_core.xlf:labels.clear_cache', true))->setIcon($this->iconFactory->getIcon('actions-system-cache-clear', Icon::SIZE_SMALL));
         $buttonBar->addButton($clearCacheButton, ButtonBar::BUTTON_POSITION_RIGHT);
         if ($this->table && (!isset($module->modTSconfig['properties']['noExportRecordsLinks']) || isset($module->modTSconfig['properties']['noExportRecordsLinks']) && !$module->modTSconfig['properties']['noExportRecordsLinks'])) {
             // CSV
             $csvButton = $buttonBar->makeLinkButton()->setHref($this->listURL() . '&csv=1')->setTitle($lang->sL('LLL:EXT:lang/locallang_core.xlf:labels.csv', true))->setIcon($this->iconFactory->getIcon('actions-document-export-csv', Icon::SIZE_SMALL));
             $buttonBar->addButton($csvButton, ButtonBar::BUTTON_POSITION_LEFT, 40);
             // Export
             if (ExtensionManagementUtility::isLoaded('impexp')) {
                 $url = BackendUtility::getModuleUrl('xMOD_tximpexp', array('tx_impexp[action]' => 'export'));
                 $exportButton = $buttonBar->makeLinkButton()->setHref($url . '&tx_impexp[list][]=' . rawurlencode($this->table . ':' . $this->id))->setTitle($lang->sL('LLL:EXT:lang/locallang_core.xlf:rm.export', true))->setIcon($this->iconFactory->getIcon('actions-document-export-t3d', Icon::SIZE_SMALL));
                 $buttonBar->addButton($exportButton, ButtonBar::BUTTON_POSITION_LEFT, 40);
             }
         }
         // Reload
         $reloadButton = $buttonBar->makeLinkButton()->setHref($this->listURL())->setTitle($lang->sL('LLL:EXT:lang/locallang_core.xlf:labels.reload', true))->setIcon($this->iconFactory->getIcon('actions-refresh', Icon::SIZE_SMALL));
         $buttonBar->addButton($reloadButton, ButtonBar::BUTTON_POSITION_RIGHT);
         // Shortcut
         if ($backendUser->mayMakeShortcut()) {
             $shortCutButton = $buttonBar->makeShortcutButton()->setModuleName('web_list')->setGetVariables(['id', 'M', 'imagemode', 'pointer', 'table', 'search_field', 'search_levels', 'showLimit', 'sortField', 'sortRev'])->setSetVariables(array_keys($this->MOD_MENU));
             $buttonBar->addButton($shortCutButton, ButtonBar::BUTTON_POSITION_RIGHT);
         }
         // Back
         if ($this->returnUrl) {
             $href = htmlspecialchars(GeneralUtility::linkThisUrl($this->returnUrl, array('id' => $this->id)));
             $buttons['back'] = '<a href="' . $href . '" class="typo3-goBack" title="' . $lang->sL('LLL:EXT:lang/locallang_core.xlf:labels.goBack', true) . '">' . $this->iconFactory->getIcon('actions-view-go-back', Icon::SIZE_SMALL) . '</a>';
         }
     }
 }

作者:dachcom-digita    项目:TYPO3.CM   
/**
     * Render the list
     *
     * @param array $pArray
     * @param array $lines
     * @param int $c
     * @return array
     */
    public function renderList($pArray, $lines = array(), $c = 0)
    {
        if (!is_array($pArray)) {
            return $lines;
        }
        $statusCheckedIcon = $this->moduleTemplate->getIconFactory()->getIcon('status-status-checked', Icon::SIZE_SMALL)->render();
        foreach ($pArray as $k => $v) {
            if (MathUtility::canBeInterpretedAsInteger($k)) {
                if (isset($pArray[$k . '_'])) {
                    $lines[] = '<tr>
						<td nowrap><span style="width: 1px; height: 1px; display:inline-block; margin-left: ' . $c * 20 . 'px"></span>' . '<a href="' . htmlspecialchars(GeneralUtility::linkThisScript(array('id' => $k))) . '" title="' . htmlspecialchars('ID: ' . $k) . '">' . $this->moduleTemplate->getIconFactory()->getIconForRecord('pages', BackendUtility::getRecordWSOL('pages', $k), Icon::SIZE_SMALL)->render() . ' ' . GeneralUtility::fixed_lgd_cs($pArray[$k], 30) . '</a></td>
						<td>' . $pArray[$k . '_']['count'] . '</td>
						<td>' . ($pArray[$k . '_']['root_max_val'] > 0 ? $statusCheckedIcon : '') . '</td>
						<td>' . ($pArray[$k . '_']['root_min_val'] == 0 ? $statusCheckedIcon : '') . '</td>
						</tr>';
                } else {
                    $lines[] = '<tr>
						<td nowrap><span style="width: 1px; height: 1px; display:inline-block; margin-left: ' . $c * 20 . 'px"></span>' . $this->moduleTemplate->getIconFactory()->getIconForRecord('pages', BackendUtility::getRecordWSOL('pages', $k), Icon::SIZE_SMALL)->render() . GeneralUtility::fixed_lgd_cs($pArray[$k], 30) . '</td>
						<td></td>
						<td></td>
						<td></td>
						</tr>';
                }
                $lines = $this->renderList($pArray[$k . '.'], $lines, $c + 1);
            }
        }
        return $lines;
    }

作者:TYPO3Incubato    项目:TYPO3.CM   
/**
  * This method prepares the link for opening the devlog in a new window
  *
  * @return string Hyperlink with icon and appropriate JavaScript
  */
 protected function openInNewWindow()
 {
     $url = GeneralUtility::getIndpEnv('TYPO3_REQUEST_URL');
     $onClick = 'devlogWin=window.open(' . GeneralUtility::quoteJSvalue($url) . ',\'taskcenter\',\'width=790,status=0,menubar=1,resizable=1,location=0,scrollbars=1,toolbar=0\');return false;';
     $content = '<a href="#" onclick="' . htmlspecialchars($onClick) . '" title="' . $this->getLanguageService()->sL('LLL:EXT:lang/locallang_core.xlf:labels.openInNewWindow', true) . '">' . $this->moduleTemplate->getIconFactory()->getIcon('actions-window-open', Icon::SIZE_SMALL)->render() . '</a>';
     return $content;
 }

作者:girardi    项目:image_autoresiz   
/**
  * Returns some statistics and a social link to Twitter.
  *
  * @return void
  */
 protected function addStatisticsAndSocialLink()
 {
     $fileName = PATH_site . 'typo3conf/.tx_imageautoresize';
     if (!is_file($fileName)) {
         return;
     }
     $data = json_decode(file_get_contents($fileName), true);
     if (!is_array($data) || !(isset($data['images']) && isset($data['bytes']))) {
         return;
     }
     $resourcesPath = \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extRelPath($this->extKey) . 'Resources/Public/';
     $pageRenderer = version_compare(TYPO3_version, '7.5.99', '>') ? $this->moduleTemplate->getPageRenderer() : $this->doc->getPageRenderer();
     $pageRenderer->addCssFile($resourcesPath . 'Css/twitter.css');
     $pageRenderer->addJsFile($resourcesPath . 'JavaScript/popup.js');
     $totalSpaceClaimed = GeneralUtility::formatSize((int) $data['bytes']);
     $messagePattern = $this->languageService->getLL('storage.claimed');
     $message = sprintf($messagePattern, $totalSpaceClaimed, (int) $data['images']);
     $flashMessage = htmlspecialchars($message);
     $twitterMessagePattern = $this->languageService->getLL('social.twitter');
     $message = sprintf($twitterMessagePattern, $totalSpaceClaimed);
     $url = 'https://typo3.org/extensions/repository/view/image_autoresize';
     $twitterLink = 'https://twitter.com/intent/tweet?text=' . urlencode($message) . '&url=' . urlencode($url);
     $twitterLink = GeneralUtility::quoteJSvalue($twitterLink);
     $flashMessage .= '
         <div class="custom-tweet-button">
             <a href="#" onclick="popitup(' . $twitterLink . ',\'twitter\')" title="' . $this->languageService->getLL('social.share', true) . '">
                 <i class="btn-icon"></i>
                 <span class="btn-text">Tweet</span>
             </a>
         </div>';
     if (version_compare(TYPO3_version, '7.0.0', '>=')) {
         $this->content .= '
             <div class="alert alert-info">
                 <div class="media">
                     <div class="media-left">
                         <span class="fa-stack fa-lg">
                             <i class="fa fa-circle fa-stack-2x"></i>
                             <i class="fa fa-info fa-stack-1x"></i>
                         </span>
                     </div>
                     <div class="media-body">
                         ' . $flashMessage . '
                     </div>
                 </div>
             </div>
         ';
     } else {
         $this->content .= '
             <div id="typo3-messages">
                 <div class="typo3-message message-information">
                     <div class="message-body">
                         ' . $flashMessage . '
                     </div>
                 </div>
             </div>
         ';
     }
 }

作者:rickymathe    项目:TYPO3.CM   
/**
  * Generates the action menu
  */
 protected function getModuleMenu()
 {
     $menu = $this->moduleTemplate->getDocHeaderComponent()->getMenuRegistry()->makeMenu();
     $menu->setIdentifier('ConfigurationJumpMenu');
     foreach ($this->MOD_MENU['function'] as $controller => $title) {
         $item = $menu->makeMenuItem()->setHref(BackendUtility::getModuleUrl($this->moduleName, ['id' => $this->id, 'SET' => ['function' => $controller]]))->setTitle($title);
         if ($controller === (int) $this->MOD_SETTINGS['function']) {
             $item->setActive(true);
         }
         $menu->addMenuItem($item);
     }
     $this->moduleTemplate->getDocHeaderComponent()->getMenuRegistry()->addMenu($menu);
 }

作者:vip3ou    项目:TYPO3.CM   
/**
  * Register docHeader buttons
  */
 protected function getButtons()
 {
     /** @var ButtonBar $buttonBar */
     $buttonBar = $this->moduleTemplate->getDocHeaderComponent()->getButtonBar();
     /** @var IconFactory $iconFactory */
     $iconFactory = $this->moduleTemplate->getIconFactory();
     // Refresh
     $refreshButton = $buttonBar->makeLinkButton()->setHref(GeneralUtility::getIndpEnv('REQUEST_URI'))->setTitle($this->getLanguageService()->sL('LLL:EXT:lang/locallang_core.xlf:labels.reload'))->setIcon($iconFactory->getIcon('actions-refresh', Icon::SIZE_SMALL));
     $buttonBar->addButton($refreshButton, ButtonBar::BUTTON_POSITION_RIGHT);
     // CSH
     $cshButton = $buttonBar->makeHelpButton()->setModuleName('xMOD_csh_corebe')->setFieldName('filetree');
     $buttonBar->addButton($cshButton);
 }

作者:hlo    项目:TYPO3.CM   
/**
  * Create the panel of buttons for submitting the form or otherwise
  * perform operations.
  *
  * @return void
  */
 protected function getButtons()
 {
     $buttonBar = $this->moduleTemplate->getDocHeaderComponent()->getButtonBar();
     // Fullscreen Button
     $url = GeneralUtility::getIndpEnv('TYPO3_REQUEST_URL');
     $onClick = 'devlogWin=window.open(' . GeneralUtility::quoteJSvalue($url) . ',\'taskcenter\',\'width=790,status=0,menubar=1,resizable=1,location=0,scrollbars=1,toolbar=0\');return false;';
     $fullscreenButton = $buttonBar->makeLinkButton()->setTitle($this->getLanguageService()->sL('LLL:EXT:lang/locallang_core.xlf:labels.openInNewWindow', true))->setOnClick($onClick)->setHref('#')->setIcon($this->iconFactory->getIcon('actions-window-open', Icon::SIZE_SMALL));
     $buttonBar->addButton($fullscreenButton, ButtonBar::BUTTON_POSITION_RIGHT, 1);
     // Shortcut
     if ($this->getBackendUser()->mayMakeShortcut()) {
         $shortCutButton = $buttonBar->makeFullyRenderedButton()->setHtmlSource($this->moduleTemplate->makeShortcutIcon('', 'function', $this->moduleName));
         $buttonBar->addButton($shortCutButton, ButtonBar::BUTTON_POSITION_RIGHT, 2);
     }
 }

作者:TYPO3Incubato    项目:TYPO3.CM   
/**
  * Create the panel of buttons for submitting the form or otherwise perform operations.
  */
 protected function getButtons()
 {
     $buttonBar = $this->moduleTemplate->getDocHeaderComponent()->getButtonBar();
     // CSH
     $cshButton = $buttonBar->makeHelpButton()->setModuleName('_MOD_web_func')->setFieldName('');
     $buttonBar->addButton($cshButton);
     if ($this->id && is_array($this->pageinfo)) {
         // View page
         $viewButton = $buttonBar->makeLinkButton()->setOnClick(BackendUtility::viewOnClick($this->pageinfo['uid'], '', BackendUtility::BEgetRootLine($this->pageinfo['uid'])))->setTitle($this->getLanguageService()->sL('LLL:EXT:lang/locallang_core.xlf:labels.showPage'))->setIcon($this->iconFactory->getIcon('actions-document-view', Icon::SIZE_SMALL))->setHref('#');
         $buttonBar->addButton($viewButton);
         // Shortcut
         $shortcutButton = $buttonBar->makeShortcutButton()->setModuleName($this->moduleName)->setGetVariables(['id', 'edit_record', 'pointer', 'new_unique_uid', 'search_field', 'search_levels', 'showLimit'])->setSetVariables(array_keys($this->MOD_MENU));
         $buttonBar->addButton($shortcutButton);
     }
 }

作者:cosmo    项目:TYPO3.CM   
/**
  * Render page title with icon, table title and record title
  *
  * @return string
  */
 protected function renderPageTitle()
 {
     $title = strip_tags(BackendUtility::getRecordTitle($this->table, $this->row));
     if ($this->type === 'folder') {
         $table = $this->getLanguageService()->sL('LLL:EXT:lang/locallang_common.xlf:folder');
         $icon = $this->iconFactory->getIconForResource($this->folderObject, Icon::SIZE_SMALL)->render();
     } elseif ($this->type === 'file') {
         $table = $this->getLanguageService()->sL($GLOBALS['TCA'][$this->table]['ctrl']['title']);
         $icon = $this->iconFactory->getIconForResource($this->fileObject, Icon::SIZE_SMALL)->render();
     } else {
         $table = $this->getLanguageService()->sL($GLOBALS['TCA'][$this->table]['ctrl']['title']);
         $icon = $this->iconFactory->getIconForRecord($this->table, $this->row, Icon::SIZE_SMALL);
     }
     // Set HTML title tag
     $this->moduleTemplate->setTitle($table . ': ' . $title);
     return '<h1>' . ($table ? '<small>' . $table . '</small><br />' : '') . $icon . $title . '</h1>';
 }

作者:hlo    项目:TYPO3.CM   
/**
  * Create the panel of buttons for submitting the form or otherwise perform operations.
  */
 protected function getButtons()
 {
     $buttonBar = $this->moduleTemplate->getDocHeaderComponent()->getButtonBar();
     // CSH
     $cshButton = $buttonBar->makeFullyRenderedButton()->setHtmlSource(BackendUtility::cshItem('_MOD_web_func', ''));
     $buttonBar->addButton($cshButton);
     if ($this->id && is_array($this->pageinfo)) {
         // View page
         $viewButton = $buttonBar->makeLinkButton()->setOnClick(BackendUtility::viewOnClick($this->pageinfo['uid'], '', BackendUtility::BEgetRootLine($this->pageinfo['uid'])))->setTitle($this->getLanguageService()->sL('LLL:EXT:lang/locallang_core.xlf:labels.showPage', true))->setIcon($this->iconFactory->getIcon('actions-document-view', Icon::SIZE_SMALL))->setHref('#');
         $buttonBar->addButton($viewButton);
         // Shortcut
         if ($this->getBackendUser()->mayMakeShortcut()) {
             $shortCutButton = $buttonBar->makeFullyRenderedButton()->setHtmlSource($this->moduleTemplate->makeShortcutIcon('id, edit_record, pointer, new_unique_uid, search_field, search_levels, showLimit', implode(',', array_keys($this->MOD_MENU)), $this->moduleName));
             $buttonBar->addButton($shortCutButton, ButtonBar::BUTTON_POSITION_RIGHT);
         }
     }
 }

作者:dachcom-digita    项目:TYPO3.CM   
/**
  * Create the panel of buttons for submitting the form or otherwise perform operations.
  */
 protected function getButtons()
 {
     $buttonBar = $this->moduleTemplate->getDocHeaderComponent()->getButtonBar();
     // CSH
     $helpButton = $buttonBar->makeHelpButton()->setModuleName('_MOD_' . $this->moduleName)->setFieldName('');
     $buttonBar->addButton($helpButton);
     // Add and Reload
     if (empty($this->CMD) || $this->CMD === 'list' || $this->CMD === 'delete' || $this->CMD === 'stop' || $this->CMD === 'toggleHidden') {
         $reloadButton = $buttonBar->makeLinkButton()->setTitle($this->getLanguageService()->sL('LLL:EXT:lang/locallang_core.xlf:labels.reload'))->setIcon($this->moduleTemplate->getIconFactory()->getIcon('actions-refresh', Icon::SIZE_SMALL))->setHref($this->moduleUri);
         $buttonBar->addButton($reloadButton, ButtonBar::BUTTON_POSITION_RIGHT, 1);
         if ($this->MOD_SETTINGS['function'] === 'scheduler' && !empty($this->getRegisteredClasses())) {
             $addButton = $buttonBar->makeLinkButton()->setTitle($this->getLanguageService()->getLL('action.add'))->setIcon($this->moduleTemplate->getIconFactory()->getIcon('actions-document-new', Icon::SIZE_SMALL))->setHref($this->moduleUri . '&CMD=add');
             $buttonBar->addButton($addButton, ButtonBar::BUTTON_POSITION_LEFT, 2);
         }
     }
     // Close and Save
     if ($this->CMD === 'add' || $this->CMD === 'edit') {
         // Close
         $closeButton = $buttonBar->makeLinkButton()->setTitle($this->getLanguageService()->sL('LLL:EXT:lang/locallang_common.xlf:cancel'))->setIcon($this->moduleTemplate->getIconFactory()->getIcon('actions-document-close', Icon::SIZE_SMALL))->setOnClick('document.location=' . GeneralUtility::quoteJSvalue($this->moduleUri))->setHref('#');
         $buttonBar->addButton($closeButton, ButtonBar::BUTTON_POSITION_LEFT, 2);
         // Save, SaveAndClose, SaveAndNew
         $saveButtonDropdown = $buttonBar->makeSplitButton();
         $saveButton = $buttonBar->makeInputButton()->setName('CMD')->setValue('save')->setForm('tx_scheduler_form')->setIcon($this->moduleTemplate->getIconFactory()->getIcon('actions-document-save', Icon::SIZE_SMALL))->setTitle($this->getLanguageService()->sL('LLL:EXT:lang/locallang_common.xlf:save'));
         $saveButtonDropdown->addItem($saveButton);
         $saveAndNewButton = $buttonBar->makeInputButton()->setName('CMD')->setValue('savenew')->setForm('tx_scheduler_form')->setIcon($this->moduleTemplate->getIconFactory()->getIcon('actions-document-save-new', Icon::SIZE_SMALL))->setTitle($this->getLanguageService()->sL('LLL:EXT:lang/locallang_common.xlf:saveAndCreateNewDoc'));
         $saveButtonDropdown->addItem($saveAndNewButton);
         $saveAndCloseButton = $buttonBar->makeInputButton()->setName('CMD')->setValue('saveclose')->setForm('tx_scheduler_form')->setIcon($this->moduleTemplate->getIconFactory()->getIcon('actions-document-save-close', Icon::SIZE_SMALL))->setTitle($this->getLanguageService()->sL('LLL:EXT:lang/locallang_common.xlf:saveAndClose'));
         $saveButtonDropdown->addItem($saveAndCloseButton);
         $buttonBar->addButton($saveButtonDropdown, ButtonBar::BUTTON_POSITION_LEFT, 3);
     }
     // Edit
     if ($this->CMD === 'edit') {
         $deleteButton = $buttonBar->makeInputButton()->setName('CMD')->setValue('delete')->setForm('tx_scheduler_form')->setIcon($this->moduleTemplate->getIconFactory()->getIcon('actions-edit-delete', Icon::SIZE_SMALL))->setTitle($this->getLanguageService()->sL('LLL:EXT:lang/locallang_common.xlf:delete'));
         $buttonBar->addButton($deleteButton, ButtonBar::BUTTON_POSITION_LEFT, 4);
     }
     // Shortcut
     $shortcutButton = $buttonBar->makeShortcutButton()->setModuleName($this->moduleName)->setDisplayName($this->MOD_MENU['function'][$this->MOD_SETTINGS['function']])->setSetVariables(['function']);
     $buttonBar->addButton($shortcutButton);
 }

作者:rickymathe    项目:TYPO3.CM   
/**
  * Loads the template source and render the template.
  * If "layoutName" is set in a PostParseFacet callback, it will render the file with the given layout.
  *
  * Additionally amends the rendered template with a module template "frame"
  *
  * @param string $actionName If set, the view of the specified action will be rendered instead. Default is the action specified in the Request object
  * @return string Rendered Template
  * @api
  */
 public function render($actionName = null)
 {
     $actionViewContent = $this->templateView->render($actionName);
     $this->moduleTemplate->setContent($actionViewContent);
     return $this->moduleTemplate->renderContent();
 }

作者:vip3ou    项目:TYPO3.CM   
/**
  * Administrative links for a table / record
  *
  * @param string $table Table name
  * @param array $row Record for which administrative links are generated.
  * @return string HTML link tags.
  */
 public function adminLinks($table, $row)
 {
     // Edit link:
     $editUrl = BackendUtility::getModuleUrl('record_edit', ['edit' => [$table => [$row['uid'] => 'edit']], 'returnUrl' => GeneralUtility::getIndpEnv('REQUEST_URI')]);
     $adminLink = '<a class="btn btn-default" href="' . htmlspecialchars($editUrl) . '" title="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:cm.edit', true) . '">' . $this->moduleTemplate->getIconFactory()->getIcon('actions-document-open', Icon::SIZE_SMALL)->render() . '</a>';
     // Delete link:
     $adminLink .= '<a class="btn btn-default" href="' . htmlspecialchars(BackendUtility::getLinkToDataHandlerAction('&cmd[' . $table . '][' . $row['uid'] . '][delete]=1')) . '" title="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:cm.delete', true) . '">' . $this->moduleTemplate->getIconFactory()->getIcon('actions-edit-delete', Icon::SIZE_SMALL)->render() . '</a>';
     if ($table === 'pages') {
         // If another page module was specified, replace the default Page module with the new one
         $newPageModule = trim($GLOBALS['BE_USER']->getTSConfigVal('options.overridePageModule'));
         $pageModule = BackendUtility::isModuleSetInTBE_MODULES($newPageModule) ? $newPageModule : 'web_layout';
         // Perform some access checks:
         $a_wl = $GLOBALS['BE_USER']->check('modules', 'web_list');
         $a_wp = $GLOBALS['BE_USER']->check('modules', $pageModule);
         $adminLink .= '<a class="btn btn-default" href="#" onclick="top.loadEditId(' . $row['uid'] . ');top.goToModule(' . GeneralUtility::quoteJSvalue($pageModule) . '); return false;">' . $this->moduleTemplate->getIconFactory()->getIcon('actions-page-open', Icon::SIZE_SMALL)->render() . '</a>';
         $adminLink .= '<a class="btn btn-default" href="#" onclick="top.loadEditId(' . $row['uid'] . ');top.goToModule(\'web_list\'); return false;">' . $this->moduleTemplate->getIconFactory()->getIcon('actions-system-list-open', Icon::SIZE_SMALL)->render() . '</a>';
         // "View page" icon is added:
         $adminLink .= '<a class="btn btn-default" href="#" onclick="' . htmlspecialchars(BackendUtility::viewOnClick($row['uid'], '', BackendUtility::BEgetRootLine($row['uid']))) . '">' . $this->moduleTemplate->getIconFactory()->getIcon('actions-document-view', Icon::SIZE_SMALL)->render() . '</a>';
     } else {
         if ($row['pid'] == -1) {
             $getVars = '&ADMCMD_vPrev[' . rawurlencode($table . ':' . $row['t3ver_oid']) . ']=' . $row['uid'];
             // "View page" icon is added:
             $adminLink .= '<a class="btn btn-default" href="#" onclick="' . htmlspecialchars(BackendUtility::viewOnClick($row['_REAL_PID'], '', BackendUtility::BEgetRootLine($row['_REAL_PID']), '', '', $getVars)) . '">' . $this->moduleTemplate->getIconFactory()->getIcon('actions-document-view', Icon::SIZE_SMALL)->render() . '</a>';
         }
     }
     return '<div class="btn-group btn-group-sm" role="group">' . $adminLink . '</div>';
 }

作者:CDR    项目:TYPO3.CM   
/**
  * Make the LanguageMenu
  *
  * @return void
  */
 protected function makeLanguageMenu()
 {
     if (count($this->MOD_MENU['language']) > 1) {
         $lang = $this->getLanguageService();
         $languageMenu = $this->moduleTemplate->getDocHeaderComponent()->getMenuRegistry()->makeMenu();
         $languageMenu->setIdentifier('languageMenu');
         $languageMenu->setLabel($lang->sL('LLL:EXT:lang/locallang_general.xlf:LGL.language', true));
         foreach ($this->MOD_MENU['language'] as $key => $language) {
             $menuItem = $languageMenu->makeMenuItem()->setTitle($language)->setHref(BackendUtility::getModuleUrl($this->moduleName) . '&id=' . $this->id . '&SET[language]=' . $key);
             if ((int) $this->current_sys_language === $key) {
                 $menuItem->setActive(true);
             }
             $languageMenu->addMenuItem($menuItem);
         }
         $this->moduleTemplate->getDocHeaderComponent()->getMenuRegistry()->addMenu($languageMenu);
     }
 }

作者:hlo    项目:TYPO3.CM   
/**
  * No template
  *
  * @param int $newStandardTemplate
  * @return string
  */
 public function noTemplate($newStandardTemplate = 0)
 {
     // Defined global here!
     /** @var ExtendedTemplateService $tmpl */
     $tmpl = GeneralUtility::makeInstance(ExtendedTemplateService::class);
     $GLOBALS['tmpl'] = $tmpl;
     // Do not log time-performance information
     $tmpl->tt_track = false;
     $tmpl->init();
     $lang = $this->getLanguageService();
     $title = $lang->getLL('noTemplate');
     $message = '<p>' . $lang->getLL('noTemplateDescription') . '<br />' . $lang->getLL('createTemplateToEditConfiguration') . '</p>';
     $view = GeneralUtility::makeInstance(StandaloneView::class);
     $view->setTemplatePathAndFilename(GeneralUtility::getFileAbsFileName('EXT:tstemplate/Resources/Private/Templates/InfoBox.html'));
     $view->assignMultiple(array('title' => $title, 'message' => $message, 'state' => InfoboxViewHelper::STATE_INFO));
     $theOutput = $view->render();
     // New standard?
     if ($newStandardTemplate) {
         // Hook to change output, implemented for statictemplates
         if (isset($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS'][TypoScriptTemplateModuleController::class]['newStandardTemplateView'])) {
             $selector = '';
             $staticsText = '';
             $reference = array('selectorHtml' => &$selector, 'staticsText' => &$staticsText);
             GeneralUtility::callUserFunction($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS'][TypoScriptTemplateModuleController::class]['newStandardTemplateView'], $reference, $this);
             $selector = $reference['selectorHtml'];
             $staticsText = $reference['staticsText'];
         } else {
             $selector = '<input type="hidden" name="createStandard" value="" />';
             $staticsText = '';
         }
         // Extension?
         $theOutput .= $this->moduleTemplate->section($lang->getLL('newWebsite') . $staticsText, '<p>' . $lang->getLL('newWebsiteDescription') . '</p>' . $selector . '<input class="btn btn-primary" type="submit" name="newWebsite" value="' . $lang->getLL('newWebsiteAction') . '" />', 0, 1);
     }
     // Extension?
     $theOutput .= $this->moduleTemplate->section($lang->getLL('extTemplate'), '<p>' . $lang->getLL('extTemplateDescription') . '</p>' . '<input class="btn btn-default" type="submit" name="createExtension" value="' . $lang->getLL('extTemplateAction') . '" />', 0, 1);
     // Go to first appearing...
     $first = $tmpl->ext_prevPageWithTemplate($this->id, $this->perms_clause);
     if ($first) {
         $urlParameters = array('id' => $first['uid']);
         $aHref = BackendUtility::getModuleUrl('web_ts', $urlParameters);
         $theOutput .= $this->moduleTemplate->section($lang->getLL('goToClosest'), sprintf('<p>' . $lang->getLL('goToClosestDescription') . '</p>%s' . $lang->getLL('goToClosestAction') . '%s', htmlspecialchars($first['title']), $first['uid'], '<a class="btn btn-default" href="' . htmlspecialchars($aHref) . '">', '</a>'), 0, 1);
     }
     return $theOutput;
 }

作者:burgui    项目:test0   
/**
  * Create the panel of buttons for submitting the form or otherwise perform operations.
  *
  * @return array all available buttons as an associated array
  */
 protected function getButtons()
 {
     $buttonBar = $this->moduleTemplate->getDocHeaderComponent()->getButtonBar();
     if ($this->getBackendUser()->mayMakeShortcut()) {
         $shortcutButton = $buttonBar->makeShortcutButton()->setGetVariables(['tx_impexp'])->setDisplayName($this->shortcutName)->setModuleName($this->moduleName);
         $buttonBar->addButton($shortcutButton);
     }
     // Input data grabbed:
     $inData = GeneralUtility::_GP('tx_impexp');
     if ((string) $inData['action'] == 'import') {
         if ($this->id && is_array($this->pageinfo) || $this->getBackendUser()->user['admin'] && !$this->id) {
             if (is_array($this->pageinfo) && $this->pageinfo['uid']) {
                 // View
                 $onClick = BackendUtility::viewOnClick($this->pageinfo['uid'], '', BackendUtility::BEgetRootLine($this->pageinfo['uid']));
                 $viewButton = $buttonBar->makeLinkButton()->setTitle($this->lang->sL('LLL:EXT:lang/locallang_core.xlf:labels.showPage'))->setHref('#')->setIcon($this->iconFactory->getIcon('actions-document-view', Icon::SIZE_SMALL))->setOnClick($onClick);
                 $buttonBar->addButton($viewButton);
             }
         }
     }
 }

作者:Audibene-GMB    项目:TYPO3.CM   
/**
     * Import part of module
     *
     * @param array $inData Content of POST VAR tx_impexp[]..
     * @throws \BadFunctionCallException
     * @throws \InvalidArgumentException
     * @throws \RuntimeException
     * @return void Setting content in $this->content
     */
    public function importData($inData)
    {
        $access = is_array($this->pageinfo) ? 1 : 0;
        $beUser = $this->getBackendUser();
        if ($this->id && $access || $beUser->user['admin'] && !$this->id) {
            if ($beUser->user['admin'] && !$this->id) {
                $this->pageinfo = array('title' => '[root-level]', 'uid' => 0, 'pid' => 0);
            }
            if ($inData['new_import']) {
                unset($inData['import_mode']);
            }
            /** @var $import \TYPO3\CMS\Impexp\ImportExport */
            $import = GeneralUtility::makeInstance(\TYPO3\CMS\Impexp\ImportExport::class);
            $import->init(0, 'import');
            $import->update = $inData['do_update'];
            $import->import_mode = $inData['import_mode'];
            $import->enableLogging = $inData['enableLogging'];
            $import->global_ignore_pid = $inData['global_ignore_pid'];
            $import->force_all_UIDS = $inData['force_all_UIDS'];
            $import->showDiff = !$inData['notShowDiff'];
            $import->allowPHPScripts = $inData['allowPHPScripts'];
            $import->softrefInputValues = $inData['softrefInputValues'];
            // OUTPUT creation:
            $menuItems = array();
            // Make input selector:
            // must have trailing slash.
            $path = $this->getDefaultImportExportFolder();
            $exportFiles = $this->getExportFiles();
            $this->shortcutName .= ' (' . $this->pageinfo['title'] . ')';
            // Configuration
            $row = array();
            $selectOptions = array('');
            foreach ($exportFiles as $file) {
                $selectOptions[$file->getCombinedIdentifier()] = $file->getPublicUrl();
            }
            $row[] = '
				<tr>
					<th colspan="2">' . $this->lang->getLL('importdata_selectFileToImport', true) . '</th>
				</tr>';
            $noCompressorAvailable = !$import->compress ? '<br /><span class="text-danger">' . $this->lang->getLL('importdata_noteNoDecompressorAvailable', true) . '</span>' : '';
            $row[] = '
				<tr>
					<td valign="top">
						' . $this->lang->getLL('importdata_file', true) . '' . BackendUtility::cshItem('xMOD_tx_impexp', 'importFile') . '
					</td>
					<td>
						' . $this->renderSelectBox('tx_impexp[file]', $inData['file'], $selectOptions) . '<br />' . sprintf($this->lang->getLL('importdata_fromPathS', true), $path ? $path->getCombinedIdentifier() : $this->lang->getLL('importdata_no_accessible_file_mount', true)) . $noCompressorAvailable . '
					</td>
				</tr>';
            $row[] = '
				<tr>
					<th colspan="2">
						' . $this->lang->getLL('importdata_importOptions', true) . '
					</th>
				</tr>';
            $row[] = '
				<tr>
					<td valign="top">
						' . $this->lang->getLL('importdata_update', true) . BackendUtility::cshItem('xMOD_tx_impexp', 'update') . '
					</td>
					<td>
						<input type="checkbox" name="tx_impexp[do_update]" id="checkDo_update" value="1"' . ($inData['do_update'] ? ' checked="checked"' : '') . ' />
						<label for="checkDo_update">' . $this->lang->getLL('importdata_updateRecords', true) . '</label>
						<br/>
						<em>(' . $this->lang->getLL('importdata_thisOptionRequiresThat', true) . ')</em>' . ($inData['do_update'] ? '	<hr/>
						<input type="checkbox" name="tx_impexp[global_ignore_pid]" id="checkGlobal_ignore_pid" value="1"' . ($inData['global_ignore_pid'] ? ' checked="checked"' : '') . ' />
						<label for="checkGlobal_ignore_pid">' . $this->lang->getLL('importdata_ignorePidDifferencesGlobally', true) . '</label><br/>
						<em>(' . $this->lang->getLL('importdata_ifYouSetThis', true) . ')</em>
						' : '') . '
					</td>
				</tr>';
            $allowPhpScripts = $beUser->isAdmin() ? '
					<input type="checkbox" name="tx_impexp[allowPHPScripts]" id="checkAllowPHPScripts" value="1"' . ($inData['allowPHPScripts'] ? ' checked="checked"' : '') . ' />
					<label for="checkAllowPHPScripts">' . $this->lang->getLL('importdata_allowToWriteBanned', true) . '</label><br/>' : '';
            $doUpdate = !$inData['do_update'] && $beUser->isAdmin() ? '
					<br/>
					<input type="checkbox" name="tx_impexp[force_all_UIDS]" id="checkForce_all_UIDS" value="1"' . ($inData['force_all_UIDS'] ? ' checked="checked"' : '') . ' />
					<label for="checkForce_all_UIDS"><span class="text-danger">' . $this->lang->getLL('importdata_force_all_UIDS', true) . '</span></label><br/>
					<em>(' . $this->lang->getLL('importdata_force_all_UIDS_descr', true) . ')</em>' : '';
            $row[] = '<tr>
					<td valign="top">
						' . $this->lang->getLL('importdata_options', true) . BackendUtility::cshItem('xMOD_tx_impexp', 'options') . '
					</td>
					<td>
						<input type="checkbox" name="tx_impexp[notShowDiff]" id="checkNotShowDiff" value="1"' . ($inData['notShowDiff'] ? ' checked="checked"' : '') . ' />
						<label for="checkNotShowDiff">' . $this->lang->getLL('importdata_doNotShowDifferences', true) . '</label><br/>
						<em>(' . $this->lang->getLL('importdata_greenValuesAreFrom', true) . ')</em>
						<br/><br/>

						' . $allowPhpScripts . $doUpdate . '
					</td>
//.........这里部分代码省略.........


问题


面经


文章

微信
公众号

扫码关注公众号