コード例 #1
0
 /**
  * Get drop down
  *
  * @return string
  */
 public function getDropDown()
 {
     $backendUser = $this->getBackendUser();
     $languageService = $this->getLanguageService();
     $index = 0;
     $activeWorkspace = (int) $backendUser->workspace;
     $stateCheckedIcon = $this->iconFactory->getIcon('status-status-checked', Icon::SIZE_SMALL)->render();
     $stateUncheckedIcon = '<span title="' . $languageService->getLL('bookmark_inactive', true) . '">' . $this->iconFactory->getIcon('empty-empty', Icon::SIZE_SMALL)->render() . '</span>';
     $workspaceSections = array('top' => array(), 'items' => array());
     foreach ($this->availableWorkspaces as $workspaceId => $label) {
         $workspaceId = (int) $workspaceId;
         $iconState = $workspaceId === $activeWorkspace ? $stateCheckedIcon : $stateUncheckedIcon;
         $classValue = $workspaceId === $activeWorkspace ? ' class="selected"' : '';
         $sectionName = $index++ === 0 ? 'top' : 'items';
         $workspaceSections[$sectionName][] = '<li' . $classValue . '>' . '<a href="' . htmlspecialchars(\TYPO3\CMS\Backend\Utility\BackendUtility::getModuleUrl('main', array('changeWorkspace' => $workspaceId))) . '" data-workspaceid="' . $workspaceId . '" class="dropdown-list-link tx-workspaces-switchlink">' . $iconState . ' ' . htmlspecialchars($label) . '</a></li>';
     }
     if (!empty($workspaceSections['top'])) {
         // Add the "Go to workspace module" link
         // if there is at least one icon on top and if the access rights are there
         if ($backendUser->check('modules', 'web_WorkspacesWorkspaces')) {
             $workspaceSections['top'][] = '<li><a target="content" data-module="web_WorkspacesWorkspaces" class="dropdown-list-link tx-workspaces-modulelink">' . $stateUncheckedIcon . ' ' . $languageService->getLL('bookmark_workspace', true) . '</a></li>';
         }
     } else {
         // no items on top (= no workspace to work in)
         $workspaceSections['top'][] = '<li>' . $stateUncheckedIcon . ' ' . $languageService->getLL('bookmark_noWSfound', true) . '</li>';
     }
     $workspaceMenu = array('<ul class="dropdown-list">', implode(LF, $workspaceSections['top']), !empty($workspaceSections['items']) ? '<li class="divider"></li>' : '', implode(LF, $workspaceSections['items']), '</ul>');
     return implode(LF, $workspaceMenu);
 }
コード例 #2
0
ファイル: Clickmenu.php プロジェクト: rickymathew/TYPO3.CMS
 /**
  * Processing of clickmenu items
  *
  * @param \TYPO3\CMS\Backend\ClickMenu\ClickMenu $backRef parent
  * @param array $menuItems Menu items array to modify
  * @param string $table Table name
  * @param int $uid Uid of the record
  * @return array Menu item array, returned after modification
  * @todo Skinning for icons...
  */
 public function main(&$backRef, $menuItems, $table, $uid)
 {
     $localItems = array();
     // Show import/export on second level menu OR root level.
     if ($backRef->cmLevel && \TYPO3\CMS\Core\Utility\GeneralUtility::_GP('subname') == 'moreoptions' || $table === 'pages' && $uid == 0) {
         $LL = $this->includeLL();
         $urlParameters = array('tx_impexp' => array('action' => 'export'), 'id' => $table == 'pages' ? $uid : $backRef->rec['pid']);
         if ($table == 'pages') {
             $urlParameters['tx_impexp']['pagetree']['id'] = $uid;
             $urlParameters['tx_impexp']['pagetree']['levels'] = 0;
             $urlParameters['tx_impexp']['pagetree']['tables'][] = '_ALL';
         } else {
             $urlParameters['tx_impexp']['record'][] = $table . ':' . $uid;
             $urlParameters['tx_impexp']['external_ref']['tables'][] = '_ALL';
         }
         $url = \TYPO3\CMS\Backend\Utility\BackendUtility::getModuleUrl('xMOD_tximpexp', $urlParameters);
         $localItems[] = $backRef->linkItem($GLOBALS['LANG']->makeEntities($GLOBALS['LANG']->getLLL('export', $LL)), $backRef->excludeIcon($this->iconFactory->getIcon('actions-document-export-t3d', Icon::SIZE_SMALL)), $backRef->urlRefForCM($url), 1);
         if ($table == 'pages') {
             $urlParameters = array('id' => $uid, 'table' => $table, 'tx_impexp' => array('action' => 'import'));
             $url = \TYPO3\CMS\Backend\Utility\BackendUtility::getModuleUrl('xMOD_tximpexp', $urlParameters);
             $localItems[] = $backRef->linkItem($GLOBALS['LANG']->makeEntities($GLOBALS['LANG']->getLLL('import', $LL)), $backRef->excludeIcon($this->iconFactory->getIcon('actions-document-import-t3d', Icon::SIZE_SMALL)), $backRef->urlRefForCM($url), 1);
         }
     }
     return array_merge($menuItems, $localItems);
 }
コード例 #3
0
 /**
  * Processing of clickmenu items
  *
  * @param \TYPO3\CMS\Backend\ClickMenu\ClickMenu $backRef parent
  * @param array $menuItems Menu items array to modify
  * @param string $table Table name
  * @param int $uid Uid of the record
  * @return array Menu item array, returned after modification
  * @todo Skinning for icons...
  */
 public function main(&$backRef, $menuItems, $table, $uid)
 {
     $localItems = [];
     // Show import/export on second level menu OR root level.
     if ($backRef->cmLevel && GeneralUtility::_GP('subname') == 'moreoptions' || $table === 'pages' && $uid == 0) {
         $LL = $this->includeLL();
         $urlParameters = ['tx_impexp' => ['action' => 'export'], 'id' => $table == 'pages' ? $uid : $backRef->rec['pid']];
         if ($table == 'pages') {
             $urlParameters['tx_impexp']['pagetree']['id'] = $uid;
             $urlParameters['tx_impexp']['pagetree']['levels'] = 0;
             $urlParameters['tx_impexp']['pagetree']['tables'][] = '_ALL';
         } else {
             $urlParameters['tx_impexp']['record'][] = $table . ':' . $uid;
             $urlParameters['tx_impexp']['external_ref']['tables'][] = '_ALL';
         }
         $url = BackendUtility::getModuleUrl('xMOD_tximpexp', $urlParameters);
         $localItems[] = $backRef->linkItem(htmlspecialchars($this->getLanguageService()->getLLL('export', $LL)), $this->iconFactory->getIcon('actions-document-export-t3d', Icon::SIZE_SMALL), $backRef->urlRefForCM($url), 1);
         if ($table === 'pages') {
             $backendUser = $this->getBackendUser();
             $isEnabledForNonAdmin = $backendUser->getTSConfig('options.impexp.enableImportForNonAdminUser');
             if ($backendUser->isAdmin() || !empty($isEnabledForNonAdmin['value'])) {
                 $urlParameters = ['id' => $uid, 'table' => $table, 'tx_impexp' => ['action' => 'import']];
                 $url = BackendUtility::getModuleUrl('xMOD_tximpexp', $urlParameters);
                 $localItems[] = $backRef->linkItem(htmlspecialchars($this->getLanguageService()->getLLL('import', $LL)), $this->iconFactory->getIcon('actions-document-import-t3d', Icon::SIZE_SMALL), $backRef->urlRefForCM($url), 1);
             }
         }
     }
     return array_merge($menuItems, $localItems);
 }
コード例 #4
0
 /**
  * Render help icon
  *
  * @return string Help
  */
 public function getItem()
 {
     $icon = $this->iconFactory->getIcon('apps-toolbar-menu-help', Icon::SIZE_SMALL)->render('inline');
     $view = $this->getFluidTemplateObject('HelpToolbarItem.html');
     $view->assignMultiple(['title' => 'LLL:EXT:lang/Resources/Private/Language/locallang_core.xlf:toolbarItems.help', 'icon' => $icon]);
     return $view->render();
 }
コード例 #5
0
 /**
  * @param string $icon
  * @return string
  */
 public static function getIcon($icon)
 {
     if (NULL === static::$iconFactory) {
         static::$iconFactory = GeneralUtility::makeInstance(IconFactory::class);
     }
     return static::$iconFactory->getIcon($icon, Icon::SIZE_SMALL);
 }
コード例 #6
0
 /**
  * Get drop down
  *
  * @return string
  */
 public function getDropDown()
 {
     $backendUser = $this->getBackendUser();
     $languageService = $this->getLanguageService();
     $index = 0;
     $activeWorkspace = (int) $backendUser->workspace;
     $stateCheckedIcon = $this->iconFactory->getIcon('status-status-checked', Icon::SIZE_SMALL)->render();
     $stateUncheckedIcon = '<span title="' . htmlspecialchars($languageService->getLL('bookmark_inactive')) . '">' . $this->iconFactory->getIcon('empty-empty', Icon::SIZE_SMALL)->render() . '</span>';
     $workspaceSections = ['top' => [], 'items' => []];
     foreach ($this->availableWorkspaces as $workspaceId => $label) {
         $workspaceId = (int) $workspaceId;
         $iconState = $workspaceId === $activeWorkspace ? $stateCheckedIcon : $stateUncheckedIcon;
         $classValue = $workspaceId === $activeWorkspace ? 'selected' : '';
         $sectionName = $index++ === 0 ? 'top' : 'items';
         $workspaceSections[$sectionName][] = '
             <div class="dropdown-table-row t3js-workspace-item ' . $classValue . '">
                 <div class="dropdown-table-column dropdown-table-icon">
                     ' . $iconState . '
                 </div>
                 <div class="dropdown-table-column">
                     <a href="' . htmlspecialchars(\TYPO3\CMS\Backend\Utility\BackendUtility::getModuleUrl('main', ['changeWorkspace' => $workspaceId])) . '" data-workspaceid="' . $workspaceId . '" class="t3js-workspaces-switchlink">
                         ' . htmlspecialchars($label) . '
                     </a>
                 </div>
             </div>
         ';
     }
     if (!empty($workspaceSections['top'])) {
         // Add the "Go to workspace module" link
         // if there is at least one icon on top and if the access rights are there
         if ($backendUser->check('modules', 'web_WorkspacesWorkspaces')) {
             $workspaceSections['top'][] = '
                 <div class="dropdown-table-row">
                     <div class="dropdown-table-column dropdown-table-icon">
                         ' . $stateUncheckedIcon . '
                     </div>
                     <div class="dropdown-table-column">
                         <a href="#" target="list_frame" data-module="web_WorkspacesWorkspaces" class="t3js-workspaces-modulelink">
                             ' . htmlspecialchars($languageService->getLL('bookmark_workspace')) . '
                         </a>
                     </div>
                 </div>
             ';
         }
     } else {
         // no items on top (= no workspace to work in)
         $workspaceSections['top'][] = '
             <div class="dropdown-table-row">
                 <div class="dropdown-table-column dropdown-table-icon">
                     ' . $stateUncheckedIcon . '
                 </div>
                 <div class="dropdown-table-column">
                     ' . htmlspecialchars($languageService->getLL('bookmark_noWSfound')) . '
                 </div>
             </div>
         ';
     }
     $workspaceMenu = ['<h3 class="dropdown-headline">' . htmlspecialchars($this->getLanguageService()->sL('LLL:EXT:lang/Resources/Private/Language/locallang_core.xlf:toolbarItems.workspace')) . '</h3>', '<hr>', '<div class="dropdown-table">' . implode(LF, $workspaceSections['top']) . '</div>', !empty($workspaceSections['items']) ? '<hr>' : '', '<div class="dropdown-table">' . implode(LF, $workspaceSections['items']) . '</div>'];
     return implode(LF, $workspaceMenu);
 }
コード例 #7
0
ファイル: VersionClickMenu.php プロジェクト: hlop/TYPO3.CMS
 /**
  * Main function, adding the item to input menuItems array
  *
  * @param ClickMenu $backRef References to parent clickmenu objects.
  * @param array $menuItems Array of existing menu items accumulated. New element added to this.
  * @param string $table Table name of the element
  * @param int $uid Record UID of the element
  * @return array Modified menuItems array
  */
 public function main(&$backRef, $menuItems, $table, $uid)
 {
     $localItems = array();
     if (!$backRef->cmLevel && $uid > 0 && $GLOBALS['BE_USER']->check('modules', 'web_txversionM1')) {
         // Returns directly, because the clicked item was not from the pages table
         if (in_array('versioning', $backRef->disabledItems) || !$GLOBALS['TCA'][$table] || !$GLOBALS['TCA'][$table]['ctrl']['versioningWS']) {
             return $menuItems;
         }
         // Adds the regular item
         $LL = $this->includeLL();
         // "Versioning" element added:
         $url = \TYPO3\CMS\Backend\Utility\BackendUtility::getModuleUrl('web_txversionM1', array('table' => $table, 'uid' => $uid));
         $localItems[] = $backRef->linkItem($GLOBALS['LANG']->getLLL('title', $LL), $backRef->excludeIcon($this->iconFactory->getIcon('actions-version-open', Icon::SIZE_SMALL)->render()), $backRef->urlRefForCM($url), true);
         // Find position of "delete" element:
         $c = 0;
         foreach ($menuItems as $k => $value) {
             $c++;
             if ($k === 'delete') {
                 break;
             }
         }
         // .. subtract two (delete item + divider line)
         $c -= 2;
         // ... and insert the items just before the delete element.
         array_splice($menuItems, $c, 0, $localItems);
     }
     return $menuItems;
 }
コード例 #8
0
    /**
     * Returns the recent documents list as an array
     *
     * @param array $document
     * @param string $md5sum
     * @param bool $isRecentDoc
     * @param bool $isFirstDoc
     * @return array All recent documents as list-items
     */
    protected function renderMenuEntry($document, $md5sum, $isRecentDoc = false, $isFirstDoc = false)
    {
        $table = $document[3]['table'];
        $uid = $document[3]['uid'];
        $record = \TYPO3\CMS\Backend\Utility\BackendUtility::getRecordWSOL($table, $uid);
        if (!is_array($record)) {
            // Record seems to be deleted
            return '';
        }
        $label = htmlspecialchars(strip_tags(htmlspecialchars_decode($document[0])));
        $icon = $this->iconFactory->getIconForRecord($table, $record, Icon::SIZE_SMALL)->render();
        $link = \TYPO3\CMS\Backend\Utility\BackendUtility::getModuleUrl('record_edit') . '&' . $document[2];
        $pageId = (int) $document[3]['uid'];
        if ($document[3]['table'] !== 'pages') {
            $pageId = (int) $document[3]['pid'];
        }
        $onClickCode = 'jump(' . GeneralUtility::quoteJSvalue($link) . ', \'web_list\', \'web\', ' . $pageId . '); TYPO3.OpendocsMenu.toggleMenu(); return false;';
        if (!$isRecentDoc) {
            $title = $this->getLanguageService()->sL('LLL:EXT:lang/locallang_core.xlf:rm.closeDoc', true);
            // Open document
            $closeIcon = $this->iconFactory->getIcon('actions-close', Icon::SIZE_SMALL)->render('inline');
            $entry = '
				<li class="opendoc">
					<a href="#" class="dropdown-list-link dropdown-link-list-add-close" onclick="' . htmlspecialchars($onClickCode) . '" target="content">' . $icon . ' ' . $label . '</a>
					<a href="#" class="dropdown-list-link-close" data-opendocsidentifier="' . $md5sum . '" title="' . $title . '">' . $closeIcon . '</a>
				</li>';
        } else {
            // Recently used document
            $entry = '
				<li>
					<a href="#" class="dropdown-list-link" onclick="' . htmlspecialchars($onClickCode) . '" target="content">' . $icon . ' ' . $label . '</a>
				</li>';
        }
        return $entry;
    }
コード例 #9
0
    /**
     * Gets all localizations of the current record.
     *
     * @param string $table The table
     * @param array $parentRec The current record
     * @param string $bgColClass Class for the background color of a column
     * @param string $pad Pad reference
     * @return string HTML table rows
     */
    public function getLocalizations($table, $parentRec, $bgColClass, $pad)
    {
        $lines = array();
        $tcaCtrl = $GLOBALS['TCA'][$table]['ctrl'];
        if ($table != 'pages' && BackendUtility::isTableLocalizable($table) && !$tcaCtrl['transOrigPointerTable']) {
            $queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class)->getQueryBuilderForTable($table);
            $queryBuilder->getQueryContext()->setContext(QueryContextType::UNRESTRICTED);
            $queryBuilder->select('*')->from($table)->where($queryBuilder->expr()->eq($tcaCtrl['transOrigPointerField'], (int) $parentRec['uid']))->andWhere($queryBuilder->expr()->neq($tcaCtrl['languageField'], 0));
            if (isset($tcaCtrl['delete']) && $tcaCtrl['delete']) {
                $queryBuilder->andWhere($queryBuilder->expr()->eq($tcaCtrl['delete'], 0));
            }
            if (isset($tcaCtrl['versioningWS']) && $tcaCtrl['versioningWS']) {
                $queryBuilder->andWhere($queryBuilder->expr()->eq('t3ver_wsid', $parentRec['t3ver_wsid']));
            }
            $rows = $queryBuilder->execute()->fetchAll();
            if (is_array($rows)) {
                $modeData = '';
                if ($pad == 'normal') {
                    $mode = $this->clipData['normal']['mode'] == 'copy' ? 'copy' : 'cut';
                    $modeData = ' <strong>(' . $this->clLabel($mode, 'cm') . ')</strong>';
                }
                foreach ($rows as $rec) {
                    $lines[] = '
					<tr>
						<td nowrap="nowrap" class="col-icon">' . $this->iconFactory->getIconForRecord($table, $rec, Icon::SIZE_SMALL)->render() . '</td>
						<td nowrap="nowrap" width="95%">' . htmlspecialchars(GeneralUtility::fixed_lgd_cs(BackendUtility::getRecordTitle($table, $rec), $this->getBackendUser()->uc['titleLen'])) . $modeData . '</td>
						<td nowrap="nowrap" class="col-control"></td>
					</tr>';
                }
            }
        }
        return implode('', $lines);
    }
コード例 #10
0
 /**
  * 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->iconFactory->getIcon('actions-window-open', Icon::SIZE_SMALL)->render() . '</a>';
     return $content;
 }
コード例 #11
0
ファイル: DrawItem.php プロジェクト: stigfaerch/gridelements
    /**
     * Draw header for a content element column:
     *
     * @param string $colName Column name
     * @param string $editParams Edit params (Syntax: &edit[...] for FormEngine)
     * @param \TYPO3\CMS\Backend\View\PageLayoutView $parentObject
     * @param boolean $expanded
     *
     * @return string HTML table
     */
    public function tt_content_drawColHeader($colName, $editParams, PageLayoutView $parentObject, $expanded = true)
    {
        $iconsArr = array();
        // Create command links:
        if ($parentObject->tt_contentConfig['showCommands']) {
            // Edit whole of column:
            if ($editParams) {
                $iconsArr['edit'] = '<a class="btn btn-default" href="#" onclick="' . htmlspecialchars(BackendUtility::editOnClick($editParams)) . '" title="' . $this->getLanguageService()->getLL('editColumn', true) . '">' . $this->iconFactory->getIcon('actions-document-open', Icon::SIZE_SMALL)->render() . '</a>';
            }
        }
        if ($expanded) {
            $state = 'expanded';
            $title = $this->languageService->sL('LLL:EXT:gridelements/Resources/Private/Language/locallang_db.xml:tx_gridelements_collapsecontent');
            $toggleTitle = $this->languageService->sL('LLL:EXT:gridelements/Resources/Private/Language/locallang_db.xml:tx_gridelements_expandcontent');
        } else {
            $state = 'collapsed';
            $title = $this->languageService->sL('LLL:EXT:gridelements/Resources/Private/Language/locallang_db.xml:tx_gridelements_expandcontent');
            $toggleTitle = $this->languageService->sL('LLL:EXT:gridelements/Resources/Private/Language/locallang_db.xml:tx_gridelements_collapsecontent');
        }
        $iconsArr['toggleContent'] = '<a href="#" class="btn btn-default t3js-toggle-gridelements-column toggle-content" title="' . $title . '" data-toggle-title="' . $toggleTitle . '" data-state="' . $state . '">' . $this->iconFactory->getIcon('actions-view-list-collapse', 'small') . $this->iconFactory->getIcon('actions-view-list-expand', 'small') . '</a>';
        $icons = '<div class="t3-page-column-header-icons btn-group btn-group-sm">' . implode('', $iconsArr) . '</div>';
        // Create header row:
        $out = '<div class="t3-page-column-header">
					' . $icons . '
					<div class="t3-page-column-header-label">' . htmlspecialchars($colName) . '</div>
				</div>';
        return $out;
    }
コード例 #12
0
ファイル: Clipboard.php プロジェクト: Audibene-GMBH/TYPO3.CMS
    /**
     * Gets all localizations of the current record.
     *
     * @param string $table The table
     * @param array $parentRec The current record
     * @param string $bgColClass Class for the background color of a column
     * @param string $pad Pad reference
     * @return string HTML table rows
     */
    public function getLocalizations($table, $parentRec, $bgColClass, $pad)
    {
        $lines = array();
        $tcaCtrl = $GLOBALS['TCA'][$table]['ctrl'];
        if ($table != 'pages' && BackendUtility::isTableLocalizable($table) && !$tcaCtrl['transOrigPointerTable']) {
            $where = array();
            $where[] = $tcaCtrl['transOrigPointerField'] . '=' . (int) $parentRec['uid'];
            $where[] = $tcaCtrl['languageField'] . '<>0';
            if (isset($tcaCtrl['delete']) && $tcaCtrl['delete']) {
                $where[] = $tcaCtrl['delete'] . '=0';
            }
            if (isset($tcaCtrl['versioningWS']) && $tcaCtrl['versioningWS']) {
                $where[] = 't3ver_wsid=' . $parentRec['t3ver_wsid'];
            }
            $rows = $this->getDatabaseConnection()->exec_SELECTgetRows('*', $table, implode(' AND ', $where));
            if (is_array($rows)) {
                $modeData = '';
                if ($pad == 'normal') {
                    $mode = $this->clipData['normal']['mode'] == 'copy' ? 'copy' : 'cut';
                    $modeData = ' <strong>(' . $this->clLabel($mode, 'cm') . ')</strong>';
                }
                foreach ($rows as $rec) {
                    $lines[] = '
					<tr>
						<td nowrap="nowrap" class="col-icon">' . $this->iconFactory->getIconForRecord($table, $rec, Icon::SIZE_SMALL)->render() . '</td>
						<td nowrap="nowrap" width="95%">' . htmlspecialchars(GeneralUtility::fixed_lgd_cs(BackendUtility::getRecordTitle($table, $rec), $this->getBackendUser()->uc['titleLen'])) . $modeData . '</td>
						<td nowrap="nowrap" class="col-control"></td>
					</tr>';
                }
            }
        }
        return implode('', $lines);
    }
コード例 #13
0
 /**
  * Render drop down
  *
  * @return string HTML
  */
 public function getDropDown()
 {
     $backendUser = $this->getBackendUser();
     $languageService = $this->getLanguageService();
     $dropdown = array();
     $dropdown[] = '<ul class="dropdown-list">';
     /** @var BackendModuleRepository $backendModuleRepository */
     $backendModuleRepository = GeneralUtility::makeInstance(BackendModuleRepository::class);
     /** @var \TYPO3\CMS\Backend\Domain\Model\Module\BackendModule $userModuleMenu */
     $userModuleMenu = $backendModuleRepository->findByModuleName('user');
     if ($userModuleMenu != false && $userModuleMenu->getChildren()->count() > 0) {
         foreach ($userModuleMenu->getChildren() as $module) {
             /** @var BackendModule $module */
             $dropdown[] = '<li' . ' id="' . htmlspecialchars($module->getName()) . '"' . ' class="typo3-module-menu-item submodule mod-' . htmlspecialchars($module->getName()) . '" ' . ' data-modulename="' . htmlspecialchars($module->getName()) . '"' . ' data-navigationcomponentid="' . htmlspecialchars($module->getNavigationComponentId()) . '"' . ' data-navigationframescript="' . htmlspecialchars($module->getNavigationFrameScript()) . '"' . ' data-navigationframescriptparameters="' . htmlspecialchars($module->getNavigationFrameScriptParameters()) . '"' . '>';
             $dropdown[] = '<a title="' . htmlspecialchars($module->getDescription()) . '" href="' . htmlspecialchars($module->getLink()) . '" class="dropdown-list-link modlink">';
             $dropdown[] = '<span class="submodule-icon typo3-app-icon"><span><span>' . $module->getIcon() . '</span></span></span>';
             $dropdown[] = '<span class="submodule-label">' . htmlspecialchars($module->getTitle()) . '</span>';
             $dropdown[] = '</a>';
             $dropdown[] = '</li>';
         }
         $dropdown[] = '<li class="divider"></li>';
     }
     // Logout button
     $buttonLabel = 'LLL:EXT:lang/locallang_core.xlf:' . ($backendUser->user['ses_backuserid'] ? 'buttons.exit' : 'buttons.logout');
     $dropdown[] = '<li class="reset-dropdown">';
     $dropdown[] = '<a href="' . htmlspecialchars(BackendUtility::getModuleUrl('logout')) . '" class="btn btn-danger pull-right" target="_top">';
     $dropdown[] = $this->iconFactory->getIcon('actions-logout', Icon::SIZE_SMALL)->render('inline') . ' ';
     $dropdown[] = $languageService->sL($buttonLabel, true);
     $dropdown[] = '</a>';
     $dropdown[] = '</li>';
     $dropdown[] = '</ul>';
     return implode(LF, $dropdown);
 }
コード例 #14
0
 /**
  * Returns the language labels and configuration options for the pagetree
  *
  * @return array
  */
 public function loadResources()
 {
     $file = 'LLL:EXT:lang/Resources/Private/Language/locallang_core.xlf:';
     $indicators = $this->getIndicators();
     $configuration = ['LLL' => ['copyHint' => htmlspecialchars($GLOBALS['LANG']->sL($file . 'tree.copyHint')), 'fakeNodeHint' => htmlspecialchars($GLOBALS['LANG']->sL($file . 'mess.please_wait')), 'activeFilterMode' => htmlspecialchars($GLOBALS['LANG']->sL($file . 'tree.activeFilterMode')), 'dropToRemove' => htmlspecialchars($GLOBALS['LANG']->sL($file . 'tree.dropToRemove')), 'buttonRefresh' => htmlspecialchars($GLOBALS['LANG']->sL($file . 'labels.refresh')), 'buttonNewNode' => htmlspecialchars($GLOBALS['LANG']->sL($file . 'tree.buttonNewNode')), 'buttonFilter' => htmlspecialchars($GLOBALS['LANG']->sL($file . 'tree.buttonFilter')), 'dropZoneElementRemoved' => htmlspecialchars($GLOBALS['LANG']->sL($file . 'tree.dropZoneElementRemoved')), 'dropZoneElementRestored' => htmlspecialchars($GLOBALS['LANG']->sL($file . 'tree.dropZoneElementRestored')), 'searchTermInfo' => htmlspecialchars($GLOBALS['LANG']->sL($file . 'tree.searchTermInfo')), 'temporaryMountPointIndicatorInfo' => htmlspecialchars($GLOBALS['LANG']->sL($file . 'labels.temporaryDBmount')), 'deleteDialogTitle' => htmlspecialchars($GLOBALS['LANG']->sL('LLL:EXT:backend/Resources/Private/Language/locallang_layout.xlf:deleteItem')), 'deleteDialogMessage' => htmlspecialchars($GLOBALS['LANG']->sL('LLL:EXT:backend/Resources/Private/Language/locallang_layout.xlf:deleteWarning')), 'recursiveDeleteDialogMessage' => htmlspecialchars($GLOBALS['LANG']->sL('LLL:EXT:backend/Resources/Private/Language/locallang_layout.xlf:recursiveDeleteWarning'))], 'Configuration' => ['hideFilter' => $GLOBALS['BE_USER']->getTSConfigVal('options.pageTree.hideFilter'), 'displayDeleteConfirmation' => $GLOBALS['BE_USER']->jsConfirmation(JsConfirmation::DELETE), 'canDeleteRecursivly' => $GLOBALS['BE_USER']->uc['recursiveDelete'] == true, 'disableIconLinkToContextmenu' => $GLOBALS['BE_USER']->getTSConfigVal('options.pageTree.disableIconLinkToContextmenu'), 'indicator' => $indicators['html'], 'temporaryMountPoint' => Commands::getMountPointPath()], 'Icons' => ['InputClear' => $this->iconFactory->getIcon('actions-input-clear', Icon::SIZE_SMALL)->render(), 'Close' => $this->iconFactory->getIcon('actions-close', Icon::SIZE_SMALL)->render('inline'), 'TrashCan' => $this->iconFactory->getIcon('actions-edit-delete', Icon::SIZE_SMALL)->render('inline'), 'TrashCanRestore' => $this->iconFactory->getIcon('actions-edit-restore', Icon::SIZE_SMALL)->render('inline'), 'Info' => $this->iconFactory->getIcon('actions-document-info', Icon::SIZE_SMALL)->render('inline'), 'NewNode' => $this->iconFactory->getIcon('actions-page-new', Icon::SIZE_SMALL)->render(), 'Filter' => $this->iconFactory->getIcon('actions-filter', Icon::SIZE_SMALL)->render(), 'Refresh' => $this->iconFactory->getIcon('actions-refresh', Icon::SIZE_SMALL)->render()]];
     return $configuration;
 }
コード例 #15
0
    /**
     * Render the list of pages to show.
     * This function is called recursively
     *
     * @param array $pageArray The Page Array
     * @param array $lines Lines that have been processed up to this point
     * @param int $pageDepth The level of the current $pageArray being processed
     * @return array
     */
    protected function renderList($pageArray, $lines = array(), $pageDepth = 0)
    {
        $cellStyle = 'padding-left: ' . $pageDepth * 20 . 'px';
        if (!is_array($pageArray)) {
            return $lines;
        }
        foreach ($pageArray as $identifier => $_) {
            if (!MathUtility::canBeInterpretedAsInteger($identifier)) {
                continue;
            }
            if (isset($pageArray[$identifier . '_'])) {
                $lines[] = '
				<tr>
					<td nowrap style="' . $cellStyle . '">
						<a href="' . htmlspecialchars(GeneralUtility::linkThisScript(array('id' => $identifier))) . '" title="' . htmlspecialchars('ID: ' . $identifier) . '">' . $this->iconFactory->getIconForRecord('pages', BackendUtility::getRecordWSOL('pages', $identifier), Icon::SIZE_SMALL)->render() . GeneralUtility::fixed_lgd_cs($pageArray[$identifier], 30) . '</a></td>
					<td>' . ($pageArray[$identifier . '_']['includeLines'] === 0 ? '' : $pageArray[$identifier . '_']['includeLines']) . '</td>
					<td>' . ($pageArray[$identifier . '_']['writtenLines'] === 0 ? '' : $pageArray[$identifier . '_']['writtenLines']) . '</td>
					</tr>';
            } else {
                $lines[] = '<tr>
					<td nowrap style="' . $cellStyle . '">' . $this->iconFactory->getIconForRecord('pages', BackendUtility::getRecordWSOL('pages', $identifier), Icon::SIZE_SMALL)->render() . GeneralUtility::fixed_lgd_cs($pageArray[$identifier], 30) . '</td>
					<td></td>
					<td></td>
					</tr>';
            }
            $lines = $this->renderList($pageArray[$identifier . '.'], $lines, $pageDepth + 1);
        }
        return $lines;
    }
コード例 #16
0
 /**
  * Get the list of pages to show.
  * This function is called recursively
  *
  * @param array $pageArray The Page Array
  * @param array $lines Lines that have been processed up to this point
  * @param int $pageDepth The level of the current $pageArray being processed
  * @return array
  */
 protected function getList($pageArray, $lines = array(), $pageDepth = 0)
 {
     if (!is_array($pageArray)) {
         return $lines;
     }
     foreach ($pageArray as $identifier => $_) {
         if (!MathUtility::canBeInterpretedAsInteger($identifier)) {
             continue;
         }
         $line = array();
         $line['padding'] = $pageDepth * 20;
         if (isset($pageArray[$identifier . '_'])) {
             $line['link'] = htmlspecialchars(GeneralUtility::linkThisScript(array('id' => $identifier)));
             $line['icon'] = $this->iconFactory->getIconForRecord('pages', BackendUtility::getRecordWSOL('pages', $identifier), Icon::SIZE_SMALL)->render();
             $line['title'] = htmlspecialchars('ID: ' . $identifier);
             $line['pageTitle'] = GeneralUtility::fixed_lgd_cs($pageArray[$identifier], 30);
             $line['includedFiles'] = $pageArray[$identifier . '_']['includeLines'] === 0 ? '' : $pageArray[$identifier . '_']['includeLines'];
             $line['lines'] = $pageArray[$identifier . '_']['writtenLines'] === 0 ? '' : $pageArray[$identifier . '_']['writtenLines'];
         } else {
             $line['link'] = '';
             $line['icon'] = $this->iconFactory->getIconForRecord('pages', BackendUtility::getRecordWSOL('pages', $identifier), Icon::SIZE_SMALL)->render();
             $line['title'] = '';
             $line['pageTitle'] = GeneralUtility::fixed_lgd_cs($pageArray[$identifier], 30);
             $line['includedFiles'] = '';
             $line['lines'] = '';
         }
         $lines[] = $line;
         $lines = $this->getList($pageArray[$identifier . '.'], $lines, $pageDepth + 1);
     }
     return $lines;
 }
コード例 #17
0
    /**
     * Render search field
     *
     * @return string Live search form HTML
     */
    public function getItem()
    {
        return '
			<form class="t3js-topbar-navigation-search toolbar-item-search-form live-search-wrapper" role="search">
				<div class="form-group">
                    <div class="form-control-holder">
                        <div class="form-control-icon">
                            ' . $this->iconFactory->getIcon('apps-toolbar-menu-search', Icon::SIZE_SMALL)->render('inline') . '
                        </div>
					    <input type="text" class="form-control toolbar-item-search-field t3js-topbar-navigation-search-field" placeholder="' . htmlspecialchars($this->getLanguageService()->sL('LLL:EXT:lang/Resources/Private/Language/locallang_core.xlf:toolbarItems.search')) . '" id="live-search-box" autocomplete="off">
                    </div>
				</div>
			</form>
            <a href="#" class="dropdown-toggle t3js-toolbar-search-dropdowntoggle" data-toggle="dropdown" aria-expanded="false"></a>
			<div class="dropdown-menu" role="menu"></div>
		';
    }
コード例 #18
0
 /**
  * Action to view the result of a SQL query
  *
  * @param array $record sys_action record
  * @return string Result of the query
  */
 protected function viewSqlQuery($record)
 {
     $content = '';
     if (\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::isLoaded('lowlevel')) {
         $sql_query = unserialize($record['t2_data']);
         if (!is_array($sql_query) || is_array($sql_query) && strtoupper(substr(trim($sql_query['qSelect']), 0, 6)) === 'SELECT') {
             $actionContent = '';
             $fullsearch = GeneralUtility::makeInstance(\TYPO3\CMS\Core\Database\QueryView::class);
             $fullsearch->formW = 40;
             $fullsearch->noDownloadB = 1;
             $type = $sql_query['qC']['search_query_makeQuery'];
             if ($sql_query['qC']['labels_noprefix'] === 'on') {
                 $GLOBALS['SOBE']->MOD_SETTINGS['labels_noprefix'] = 'on';
             }
             $sqlQuery = $sql_query['qSelect'];
             $queryIsEmpty = false;
             if ($sqlQuery) {
                 $res = $this->getDatabaseConnection()->sql_query($sqlQuery);
                 if (!$this->getDatabaseConnection()->sql_error()) {
                     $fullsearch->formW = 48;
                     // Additional configuration
                     $GLOBALS['SOBE']->MOD_SETTINGS['search_result_labels'] = 1;
                     $GLOBALS['SOBE']->MOD_SETTINGS['queryFields'] = $sql_query['qC']['queryFields'];
                     $cP = $fullsearch->getQueryResultCode($type, $res, $sql_query['qC']['queryTable']);
                     $actionContent = $cP['content'];
                     // If the result is rendered as csv or xml, show a download link
                     if ($type === 'csv' || $type === 'xml') {
                         $actionContent .= '<a href="' . GeneralUtility::getIndpEnv('REQUEST_URI') . '&download_file=1"><strong>' . $this->getLanguageService()->getLL('action_download_file') . '</strong></a>';
                     }
                 } else {
                     $actionContent .= $this->getDatabaseConnection()->sql_error();
                 }
             } else {
                 // Query is empty (not built)
                 $queryIsEmpty = true;
                 $this->addMessage($this->getLanguageService()->getLL('action_emptyQuery'), $this->getLanguageService()->getLL('action_error'), FlashMessage::ERROR);
                 $content .= $this->renderFlashMessages();
             }
             // Admin users are allowed to see and edit the query
             if ($this->getBackendUser()->isAdmin()) {
                 if (!$queryIsEmpty) {
                     $actionContent .= '<div class="panel panel-default"><div class="panel-body">' . $fullsearch->tableWrap($sql_query['qSelect']) . '</div></div>';
                 }
                 $actionContent .= '<a title="' . $this->getLanguageService()->getLL('action_editQuery') . '" class="btn btn-default" href="' . htmlspecialchars(BackendUtility::getModuleUrl('system_dbint') . '&id=' . '&SET[function]=search' . '&SET[search]=query' . '&storeControl[STORE]=-' . $record['uid'] . '&storeControl[LOAD]=1') . '">' . $this->iconFactory->getIcon('actions-document-info', Icon::SIZE_SMALL)->render() . ' ' . $this->getLanguageService()->getLL($queryIsEmpty ? 'action_createQuery' : 'action_editQuery') . '</a>';
             }
             $content .= '<h2>' . $this->getLanguageService()->getLL('action_t2_result', true) . '</h2>' . $actionContent;
         } else {
             // Query is not configured
             $this->addMessage($this->getLanguageService()->getLL('action_notReady'), $this->getLanguageService()->getLL('action_error'), FlashMessage::ERROR);
             $content .= $this->renderFlashMessages();
         }
     } else {
         // Required sysext lowlevel is not installed
         $this->addMessage($this->getLanguageService()->getLL('action_lowlevelMissing'), $this->getLanguageService()->getLL('action_error'), FlashMessage::ERROR);
         $content .= $this->renderFlashMessages();
     }
     return $content;
 }
コード例 #19
0
ファイル: Dmail.php プロジェクト: kartolo/direct_mail
 /**
  * The icon for the source tab
  *
  * @param bool $expand State of the tab
  *
  * @return string
  */
 protected function getNewsletterTabIcon($expand = false)
 {
     if ($expand) {
         // opened
         return $this->iconFactory->getIcon('apps-pagetree-expand', Icon::SIZE_SMALL);
     }
     // closes
     return $this->iconFactory->getIcon('apps-pagetree-collapse', Icon::SIZE_SMALL);
 }
コード例 #20
0
ファイル: FolderTreeView.php プロジェクト: Gregpl/TYPO3.CMS
 /**
  * Fetches the data for the tree
  *
  * @param \TYPO3\CMS\Core\Resource\Folder $folderObject the folderobject
  * @param int $depth Max depth (recursivity limit)
  * @param string $type HTML-code prefix for recursive calls.
  * @return int The count of items on the level
  * @see getBrowsableTree()
  */
 public function getFolderTree(\TYPO3\CMS\Core\Resource\Folder $folderObject, $depth = 999, $type = '')
 {
     $depth = (int) $depth;
     // This generates the directory tree
     /* array of \TYPO3\CMS\Core\Resource\Folder */
     if ($folderObject instanceof InaccessibleFolder) {
         $subFolders = array();
     } else {
         $subFolders = $folderObject->getSubfolders();
         $subFolders = \TYPO3\CMS\Core\Resource\Utility\ListUtility::resolveSpecialFolderNames($subFolders);
         uksort($subFolders, 'strnatcasecmp');
     }
     $totalSubFolders = count($subFolders);
     $HTML = '';
     $subFolderCounter = 0;
     $treeKey = '';
     /** @var Folder $subFolder */
     foreach ($subFolders as $subFolderName => $subFolder) {
         $subFolderCounter++;
         // Reserve space.
         $this->tree[] = array();
         // Get the key for this space
         end($this->tree);
         $isLocked = $subFolder instanceof InaccessibleFolder;
         $treeKey = key($this->tree);
         $specUID = GeneralUtility::md5int($subFolder->getCombinedIdentifier());
         $this->specUIDmap[$specUID] = $subFolder->getCombinedIdentifier();
         $row = array('uid' => $specUID, 'path' => $subFolder->getCombinedIdentifier(), 'title' => $subFolderName, 'folder' => $subFolder);
         // Make a recursive call to the next level
         if (!$isLocked && $depth > 1 && $this->expandNext($specUID)) {
             $nextCount = $this->getFolderTree($subFolder, $depth - 1, $type);
             // Set "did expand" flag
             $isOpen = 1;
         } else {
             $nextCount = $isLocked ? 0 : $this->getNumberOfSubfolders($subFolder);
             // Clear "did expand" flag
             $isOpen = 0;
         }
         // Set HTML-icons, if any:
         if ($this->makeHTML) {
             $HTML = $this->PMicon($subFolder, $subFolderCounter, $totalSubFolders, $nextCount, $isOpen);
             $type = '';
             $role = $subFolder->getRole();
             if ($role !== FolderInterface::ROLE_DEFAULT) {
                 $row['_title'] = '<strong>' . $subFolderName . '</strong>';
             }
             $icon = '<span title="' . htmlspecialchars($subFolderName) . '">' . $this->iconFactory->getIconForResource($subFolder, Icon::SIZE_SMALL, null, array('folder-open' => (bool) $isOpen)) . '</span>';
             $HTML .= $this->wrapIcon($icon, $subFolder);
         }
         // Finally, add the row/HTML content to the ->tree array in the reserved key.
         $this->tree[$treeKey] = array('row' => $row, 'HTML' => $HTML, 'hasSub' => $nextCount && $this->expandNext($specUID), 'isFirst' => $subFolderCounter == 1, 'isLast' => false, 'invertedDepth' => $depth, 'bank' => $this->bank);
     }
     if ($subFolderCounter > 0) {
         $this->tree[$treeKey]['isLast'] = true;
     }
     return $totalSubFolders;
 }
コード例 #21
0
 /**
  * Tests the returns of tt_content + mock record with hidden flag
  *
  * @test
  */
 public function getIconForRecordWithMockRecordWithHiddenFlagReturnsNormalIconAndOverlay()
 {
     $GLOBALS['TCA'] = array('tt_content' => array('ctrl' => array('enablecolumns' => array('disabled' => 'hidden'), 'typeicon_column' => 'CType', 'typeicon_classes' => array('text' => 'mimetypes-x-content-text'))));
     $mockRecord = $this->mockRecord;
     $mockRecord['hidden'] = '1';
     $result = $this->subject->getIconForRecord('tt_content', $mockRecord)->render();
     $this->assertContains('<span class="t3js-icon icon icon-size-default icon-state-default icon-mimetypes-x-content-text" data-identifier="mimetypes-x-content-text">', $result);
     $this->assertContains('<span class="icon-overlay icon-overlay-hidden">', $result);
 }
コード例 #22
0
 /**
  * Create delete link with trash icon
  *
  * @param int $uid Uid of the record
  *
  * @return string Link with the trash icon
  */
 function deleteLink($uid)
 {
     $icon = $this->iconFactory->getIcon('actions-edit-delete', Icon::SIZE_SMALL);
     $dmail = BackendUtility::getRecord('sys_dmail', $uid);
     if (!$dmail['scheduled_begin']) {
         return '<a href="' . BackendUtility::getModuleUrl('txdirectmailM1_txdirectmailM5') . '&id=' . $this->id . '&cmd=delete&uid=' . $uid . '">' . $icon . '</a>';
     }
     return "";
 }
コード例 #23
0
 /**
  * Print the string with the new edit lock state of a page record
  *
  * @param int $page The TYPO3 page id
  * @param string $editLockState The state of the TYPO3 page (locked, unlocked)
  * @return string The new edit lock string wrapped in HTML
  */
 protected function renderToggleEditLock($page, $editLockState)
 {
     $page = (int) $page;
     if ($editLockState === 1) {
         $ret = '<span id="el_' . $page . '"><a class="editlock btn btn-default" data-page="' . $page . '" data-lockstate="1" title="The page and all content is locked for editing by all non-Admin users.">' . $this->iconFactory->getIcon('actions-lock', Icon::SIZE_SMALL)->render() . '</a></span>';
     } else {
         $ret = '<span id="el_' . $page . '"><a class="editlock btn btn-default" data-page="' . $page . '" data-lockstate="0" title="Enable the &raquo;Admin-only&laquo; edit lock for this page">' . $this->iconFactory->getIcon('actions-unlock', Icon::SIZE_SMALL)->render() . '</a></span>';
     }
     return $ret;
 }
コード例 #24
0
 /**
  * Render system information dropdown
  *
  * @return string Icon HTML
  */
 public function getItem()
 {
     $title = htmlspecialchars($this->getLanguageService()->sL('LLL:EXT:lang/Resources/Private/Language/locallang_core.xlf:toolbarItems.sysinfo'));
     $icon = $this->iconFactory->getIcon('actions-system-list-open', Icon::SIZE_SMALL)->render('inline');
     return '
         <span class="toolbar-item-icon" title="' . $title . '">' . $icon . '</span>
         <span class="toolbar-item-title">' . $title . '</span>
         <span class="toolbar-item-badge t3js-systeminformation-counter badge"></span>
         ';
 }
コード例 #25
0
 /**
  * Create the workspace information
  *
  * @return string HTML containing workspace info
  */
 protected function getWorkspaceInfo()
 {
     if (ExtensionManagementUtility::isLoaded('workspaces') && ($this->getBackendUser()->workspace !== 0 || $this->getBackendUser()->getTSConfigVal('options.pageTree.onlineWorkspaceInfo'))) {
         $wsTitle = htmlspecialchars(WorkspaceService::getWorkspaceTitle($this->getBackendUser()->workspace));
         $workspaceInfo = '<div class="bgColor4 workspace-info"><span title="' . $wsTitle . '" onclick="top.goToModule(\'web_WorkspacesWorkspaces\');" style="cursor:pointer;">' . $this->iconFactory->getIcon('apps-toolbar-menu-workspace', Icon::SIZE_SMALL)->render() . '</span>' . $wsTitle . '</div>';
     } else {
         $workspaceInfo = '';
     }
     return $workspaceInfo;
 }
コード例 #26
0
 /**
  * Creates the tool bar links for the "edit" section of the Admin Panel.
  *
  * @return string A string containing images wrapped in <a>-tags linking them to proper functions.
  */
 public function ext_makeToolBar()
 {
     $tsfe = $this->getTypoScriptFrontendController();
     //  If mod.newContentElementWizard.override is set, use that extension's create new content wizard instead:
     $tsConfig = BackendUtility::getModTSconfig($tsfe->page['uid'], 'mod');
     $moduleName = isset($tsConfig['properties']['newContentElementWizard.']['override']) ? $tsConfig['properties']['newContentElementWizard.']['override'] : 'new_content_element';
     $newContentWizScriptPath = BackendUtility::getModuleUrl($moduleName);
     $perms = $this->getBackendUser()->calcPerms($tsfe->page);
     $langAllowed = $this->getBackendUser()->checkLanguageAccess($tsfe->sys_language_uid);
     $id = $tsfe->id;
     $returnUrl = GeneralUtility::getIndpEnv('REQUEST_URI');
     $icon = $this->iconFactory->getIcon('actions-document-history-open', Icon::SIZE_SMALL)->render();
     $link = BackendUtility::getModuleUrl('record_history', ['element' => 'pages:' . $id, 'returnUrl' => $returnUrl]);
     $toolBar = '<a class="t3-icon btn btn-default" href="' . htmlspecialchars($link) . '#latest" title="' . $this->extGetLL('edit_recordHistory') . '">' . $icon . '</a>';
     if ($perms & Permission::CONTENT_EDIT && $langAllowed) {
         $params = '';
         if ($tsfe->sys_language_uid) {
             $params = '&sys_language_uid=' . $tsfe->sys_language_uid;
         }
         $icon = $this->iconFactory->getIcon('actions-document-new', Icon::SIZE_SMALL)->render();
         $link = $newContentWizScriptPath . 'id=' . $id . $params . '&returnUrl=' . rawurlencode($returnUrl);
         $toolBar .= '<a class="t3-icon btn btn-default" href="' . htmlspecialchars($link) . '" title="' . $this->extGetLL('edit_newContentElement') . '"">' . $icon . '</a>';
     }
     if ($perms & Permission::PAGE_EDIT) {
         $icon = $this->iconFactory->getIcon('actions-document-move', Icon::SIZE_SMALL)->render();
         $link = BackendUtility::getModuleUrl('move_element', ['table' => 'pages', 'uid' => $id, 'returnUrl' => $returnUrl]);
         $toolBar .= '<a class="t3-icon btn btn-default" href="' . htmlspecialchars($link) . '" title="' . $this->extGetLL('edit_move_page') . '">' . $icon . '</a>';
     }
     if ($perms & Permission::PAGE_NEW) {
         $toolBar .= '<a class="t3-icon btn btn-default" href="' . htmlspecialchars(BackendUtility::getModuleUrl('db_new', ['id' => $id, 'pagesOnly' => 1, 'returnUrl' => $returnUrl])) . '" title="' . $this->extGetLL('edit_newPage') . '">' . $this->iconFactory->getIcon('actions-page-new', Icon::SIZE_SMALL)->render() . '</a>';
     }
     if ($perms & Permission::PAGE_EDIT) {
         $icon = $this->iconFactory->getIcon('actions-page-open', Icon::SIZE_SMALL)->render();
         $url = BackendUtility::getModuleUrl('record_edit', ['edit[pages][' . $id . ']' => 'edit', 'noView' => 1, 'returnUrl' => $returnUrl]);
         $toolBar .= '<a class="t3-icon btn btn-default" href="' . htmlspecialchars($url) . '">' . $icon . '</a>';
         if ($tsfe->sys_language_uid && $langAllowed) {
             $queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class)->getQueryBuilderForTable('pages_language_overlay');
             $queryBuilder->setRestrictions(GeneralUtility::makeInstance(FrontendRestrictionContainer::class));
             $row = $queryBuilder->select('uid', 'pid', 't3ver_state')->from('pages_language_overlay')->where($queryBuilder->expr()->eq('pid', $queryBuilder->createNamedParameter($id, \PDO::PARAM_INT)), $queryBuilder->expr()->eq('sys_language_uid', $queryBuilder->createNamedParameter($tsfe->sys_language_uid, \PDO::PARAM_INT)))->setMaxResults(1)->execute()->fetch();
             $tsfe->sys_page->versionOL('pages_language_overlay', $row);
             if (is_array($row)) {
                 $icon = '<span title="' . $this->extGetLL('edit_editPageOverlay', true) . '">' . $this->iconFactory->getIcon('mimetypes-x-content-page-language-overlay', Icon::SIZE_SMALL)->render() . '</span>';
                 $url = BackendUtility::getModuleUrl('record_edit', ['edit[pages_language_overlay][' . $row['uid'] . ']' => 'edit', 'noView' => 1, 'returnUrl' => $returnUrl]);
                 $toolBar .= '<a href="' . htmlspecialchars($url) . '">' . $icon . '</a>';
             }
         }
     }
     if ($this->getBackendUser()->check('modules', 'web_list')) {
         $urlParams = ['id' => $id, 'returnUrl' => GeneralUtility::getIndpEnv('REQUEST_URI')];
         $icon = '<span title="' . $this->extGetLL('edit_db_list', false) . '">' . $this->iconFactory->getIcon('actions-system-list-open', Icon::SIZE_SMALL)->render() . '</span>';
         $toolBar .= '<a class="t3-icon btn btn-default" href="' . htmlspecialchars(BackendUtility::getModuleUrl('web_list', $urlParams)) . '">' . $icon . '</a>';
     }
     $toolBar = '<div class="toolbar btn-group" role="group">' . $toolBar . '</div>';
     return $toolBar;
 }
コード例 #27
0
    /**
     * Get a selector as used for the select type, to select from all available
     * records and to create a relation to the embedding record (e.g. like MM).
     *
     * @param array $selItems Array of all possible records
     * @param array $conf TCA configuration of the parent(!) field
     * @param array $PA An array with additional configuration options
     * @param array $uniqueIds The uids that have already been used and should be unique
     * @return string A HTML <select> box with all possible records
     */
    protected function renderPossibleRecordsSelectorTypeSelect($selItems, $conf, &$PA, $uniqueIds = array())
    {
        $foreign_table = $conf['foreign_table'];
        $foreign_selector = $conf['foreign_selector'];
        $PA = array();
        $PA['fieldConf'] = $GLOBALS['TCA'][$foreign_table]['columns'][$foreign_selector];
        $PA['fieldTSConfig'] = FormEngineUtility::getTSconfigForTableRow($foreign_table, array(), $foreign_selector);
        $config = $PA['fieldConf']['config'];
        $item = '';
        // @todo $disabled is not present - should be read from config?
        $disabled = false;
        if (!$disabled) {
            $nameObject = $this->inlineStackProcessor->getCurrentStructureDomObjectIdPrefix($this->data['inlineFirstPid']);
            // Create option tags:
            $opt = array();
            foreach ($selItems as $p) {
                if (!in_array($p[1], $uniqueIds)) {
                    $opt[] = '<option value="' . htmlspecialchars($p[1]) . '">' . htmlspecialchars($p[0]) . '</option>';
                }
            }
            // Put together the selector box:
            $itemListStyle = isset($config['itemListStyle']) ? ' style="' . htmlspecialchars($config['itemListStyle']) . '"' : '';
            $size = (int) $conf['size'];
            $size = $conf['autoSizeMax'] ? MathUtility::forceIntegerInRange(count($selItems) + 1, MathUtility::forceIntegerInRange($size, 1), $conf['autoSizeMax']) : $size;
            $onChange = 'return inline.importNewRecord(' . GeneralUtility::quoteJSvalue($nameObject . '-' . $conf['foreign_table']) . ')';
            $item = '
				<select id="' . $nameObject . '-' . $conf['foreign_table'] . '_selector" class="form-control"' . ($size ? ' size="' . $size . '"' : '') . ' onchange="' . htmlspecialchars($onChange) . '"' . $PA['onFocus'] . $itemListStyle . ($conf['foreign_unique'] ? ' isunique="isunique"' : '') . '>
					' . implode('', $opt) . '
				</select>';
            if ($size <= 1) {
                // Add a "Create new relation" link for adding new relations
                // This is necessary, if the size of the selector is "1" or if
                // there is only one record item in the select-box, that is selected by default
                // The selector-box creates a new relation on using an onChange event (see some line above)
                if (!empty($conf['appearance']['createNewRelationLinkTitle'])) {
                    $createNewRelationText = $this->getLanguageService()->sL($conf['appearance']['createNewRelationLinkTitle'], true);
                } else {
                    $createNewRelationText = $this->getLanguageService()->sL('LLL:EXT:lang/locallang_core.xlf:cm.createNewRelation', true);
                }
                $item .= '
				<span class="input-group-btn">
					<a href="#" class="btn btn-default" onclick="' . htmlspecialchars($onChange) . '" title="' . $createNewRelationText . '">
						' . $this->iconFactory->getIcon('actions-document-new', Icon::SIZE_SMALL)->render() . $createNewRelationText . '
					</a>
				</span>';
            } else {
                $item .= '
				<span class="input-group-btn btn"></span>';
            }
            // Wrap the selector and add a spacer to the bottom
            $item = '<div class="input-group form-group t3js-formengine-validation-marker ' . $this->inlineData['config'][$nameObject]['md5'] . '">' . $item . '</div>';
        }
        return $item;
    }
コード例 #28
0
 /**
  * Return one line in the form
  *
  * @param int|string $index An integer: the line counter for which to create the line. Use "#" to create an template for javascript (used by ExtJS)
  * @return string HTML code for one input line for one new page
  */
 protected function getFormLine($index)
 {
     if (is_numeric($index)) {
         $label = $index + 1;
     } else {
         // used as template for JavaScript
         $index = '{0}';
         $label = '{1}';
     }
     $content = '' . '<div class="form-section" id="form-line-' . $index . '">' . '<div class="row">' . '<div class="form-group col-sm-6">' . '<label for="page_new_' . $index . '">' . $this->getLanguageService()->getLL('wiz_newPages_page') . ' ' . $label . ':' . '</label>' . '<div class="form-control-wrap">' . '<input class="form-control" type="text" id="page_new_' . $index . '" name="data[pages][NEW' . $index . '][title]" />' . '</div>' . '</div>' . '<div class="form-group col-sm-6">' . '<label>' . $this->getLanguageService()->sL('LLL:EXT:lang/locallang_general.xlf:LGL.type') . '</label>' . '<div class="form-control-wrap">' . '<div class="input-group">' . '<div id="page_new_icon_' . $index . '" class="input-group-addon input-group-icon">' . $this->iconFactory->getIconForRecord('pages', array(), Icon::SIZE_SMALL)->render() . '</div>' . '<select class="form-control form-control-adapt t3js-wizardcrpages-select-doktype" name="data[pages][NEW' . $index . '][doktype]" data-target="#page_new_icon_' . $index . '">' . $this->typeSelectHtml . '</select>' . '</div>' . '</div>' . '</div>' . '</div>' . '</div>';
     return $content;
 }
コード例 #29
0
ファイル: AdminPanelView.php プロジェクト: Gregpl/TYPO3.CMS
 /**
  * Creates the tool bar links for the "edit" section of the Admin Panel.
  *
  * @return string A string containing images wrapped in <a>-tags linking them to proper functions.
  */
 public function ext_makeToolBar()
 {
     $tsfe = $this->getTypoScriptFrontendController();
     //  If mod.web_list.newContentWiz.overrideWithExtension is set, use that extension's create new content wizard instead:
     $tsConfig = BackendUtility::getModTSconfig($tsfe->page['uid'], 'mod.web_list');
     $tsConfig = $tsConfig['properties']['newContentWiz.']['overrideWithExtension'];
     $newContentWizScriptPath = ExtensionManagementUtility::isLoaded($tsConfig) ? ExtensionManagementUtility::extRelPath($tsConfig) . 'mod1/db_new_content_el.php?' : BackendUtility::getModuleUrl('new_content_element') . '&';
     $perms = $this->getBackendUser()->calcPerms($tsfe->page);
     $langAllowed = $this->getBackendUser()->checkLanguageAccess($tsfe->sys_language_uid);
     $id = $tsfe->id;
     $returnUrl = GeneralUtility::getIndpEnv('REQUEST_URI');
     $icon = $this->iconFactory->getIcon('actions-document-history-open', Icon::SIZE_SMALL)->render();
     $link = BackendUtility::getModuleUrl('record_history', array('element' => 'pages:' . $id, 'returnUrl' => $returnUrl));
     $toolBar = '<a class="t3-icon btn btn-default" href="' . htmlspecialchars($link) . '#latest" title="' . $this->extGetLL('edit_recordHistory') . '">' . $icon . '</a>';
     if ($perms & Permission::CONTENT_EDIT && $langAllowed) {
         $params = '';
         if ($tsfe->sys_language_uid) {
             $params = '&sys_language_uid=' . $tsfe->sys_language_uid;
         }
         $icon = $this->iconFactory->getIcon('actions-document-new', Icon::SIZE_SMALL)->render();
         $link = $newContentWizScriptPath . 'id=' . $id . $params . '&returnUrl=' . rawurlencode($returnUrl);
         $toolBar .= '<a class="t3-icon btn btn-default" href="' . htmlspecialchars($link) . '" title="' . $this->extGetLL('edit_newContentElement') . '"">' . $icon . '</a>';
     }
     if ($perms & Permission::PAGE_EDIT) {
         $icon = $this->iconFactory->getIcon('actions-document-move', Icon::SIZE_SMALL)->render();
         $link = BackendUtility::getModuleUrl('move_element', ['table' => 'pages', 'uid' => $id, 'returnUrl' => $returnUrl]);
         $toolBar .= '<a class="t3-icon btn btn-default" href="' . htmlspecialchars($link) . '" title="' . $this->extGetLL('edit_move_page') . '">' . $icon . '</a>';
     }
     if ($perms & Permission::PAGE_NEW) {
         $toolBar .= '<a class="t3-icon btn btn-default" href="' . htmlspecialchars(BackendUtility::getModuleUrl('db_new', ['id' => $id, 'pagesOnly' => 1, 'returnUrl' => $returnUrl])) . '" title="' . $this->extGetLL('edit_newPage') . '">' . $this->iconFactory->getIcon('actions-page-new', Icon::SIZE_SMALL)->render() . '</a>';
     }
     if ($perms & Permission::PAGE_EDIT) {
         $icon = $this->iconFactory->getIcon('actions-document-open', Icon::SIZE_SMALL)->render();
         $url = BackendUtility::getModuleUrl('record_edit', array('edit[pages][' . $id . ']' => 'edit', 'noView' => 1, 'returnUrl' => $returnUrl));
         $toolBar .= '<a class="t3-icon btn btn-default" href="' . htmlspecialchars($url) . '">' . $icon . '</a>';
         if ($tsfe->sys_language_uid && $langAllowed) {
             $row = $this->getDatabaseConnection()->exec_SELECTgetSingleRow('uid,pid,t3ver_state', 'pages_language_overlay', 'pid=' . (int) $id . ' AND sys_language_uid=' . $tsfe->sys_language_uid . $tsfe->sys_page->enableFields('pages_language_overlay'));
             $tsfe->sys_page->versionOL('pages_language_overlay', $row);
             if (is_array($row)) {
                 $icon = '<span title="' . $this->extGetLL('edit_editPageOverlay', true) . '">' . $this->iconFactory->getIcon('mimetypes-x-content-page-language-overlay', Icon::SIZE_SMALL)->render() . '</span>';
                 $url = BackendUtility::getModuleUrl('record_edit', array('edit[pages_language_overlay][' . $row['uid'] . ']' => 'edit', 'noView' => 1, 'returnUrl' => $returnUrl));
                 $toolBar .= '<a href="' . htmlspecialchars($url) . '">' . $icon . '</a>';
             }
         }
     }
     if ($this->getBackendUser()->check('modules', 'web_list')) {
         $urlParams = array('id' => $id, 'returnUrl' => GeneralUtility::getIndpEnv('REQUEST_URI'));
         $icon = '<span title="' . $this->extGetLL('edit_db_list', false) . '">' . $this->iconFactory->getIcon('actions-system-list-open', Icon::SIZE_SMALL)->render() . '</span>';
         $toolBar .= '<a class="t3-icon btn btn-default" href="' . htmlspecialchars(BackendUtility::getModuleUrl('web_list', $urlParams)) . '">' . $icon . '</a>';
     }
     $toolBar = '<div class="toolbar btn-group" role="group">' . $toolBar . '</div>';
     return $toolBar;
 }
コード例 #30
0
 /**
  * Create the panel of buttons
  *
  * @return void
  */
 protected function createButtons()
 {
     $buttonBar = $this->view->getModuleTemplate()->getDocHeaderComponent()->getButtonBar();
     $uriBuilder = $this->objectManager->get(UriBuilder::class);
     $uriBuilder->setRequest($this->request);
     $buttons = [['table' => 'tx_news_domain_model_news', 'label' => 'module.createNewNewsRecord', 'action' => 'newNews'], ['table' => 'tx_news_domain_model_tag', 'label' => 'module.createNewTag', 'action' => 'newTag'], ['table' => 'sys_category', 'label' => 'module.createNewCategory', 'action' => 'newCategory']];
     foreach ($buttons as $key => $tableConfiguration) {
         if ($this->getBackendUser()->isAdmin() || GeneralUtility::inList($this->getBackendUser()->groupData['tables_modify'], $tableConfiguration['table'])) {
             $viewButton = $buttonBar->makeLinkButton()->setHref($uriBuilder->reset()->setRequest($this->request)->uriFor($tableConfiguration['action'], array(), 'Administration'))->setTitle($this->getLanguageService()->sL('LLL:EXT:news/Resources/Private/Language/locallang_be.xlf:' . $tableConfiguration['label'], true))->setIcon($this->iconFactory->getIconForRecord($tableConfiguration['table'], [], Icon::SIZE_SMALL));
             $buttonBar->addButton($viewButton, ButtonBar::BUTTON_POSITION_LEFT, $key);
         }
     }
 }