/**
  * @return void
  */
 private static function initialize()
 {
     if (FALSE === self::$initialized) {
         self::$hasGridElementsVersionTwo = VersionUtility::assertExtensionVersionIsAtLeastVersion('gridelements', 2);
         self::$isLegacyCoreVersion = VersionUtility::assertCoreVersionIsBelowSixPointZero();
     }
     self::$initialized = TRUE;
 }
示例#2
0
 /**
  * @return void
  */
 private static function initialize()
 {
     if (FALSE === self::$initialized) {
         self::$hasGridElementsVersionTwo = VersionUtility::assertExtensionVersionIsAtLeastVersion('gridelements', 2);
         self::$recordService = GeneralUtility::makeInstance('TYPO3\\CMS\\Extbase\\Object\\ObjectManager')->get('FluidTYPO3\\Flux\\Service\\WorkspacesAwareRecordService');
     }
     self::$initialized = TRUE;
 }
 /**
  * Postprocesses a selected backend layout
  *
  * @param integer $pageUid Starting page UID in the rootline (this current page)
  * @param array $backendLayout The backend layout which was detected from page id
  * @return NULL|void
  */
 public function postProcessBackendLayout(&$pageUid, &$backendLayout)
 {
     try {
         $record = $this->pageService->getPage($pageUid);
         // Stop processing if no fluidpages template configured in rootline
         if (NULL === $record) {
             return NULL;
         }
         $provider = $this->configurationService->resolvePrimaryConfigurationProvider('pages', 'tx_fed_page_flexform', $record);
         $action = $provider->getControllerActionFromRecord($record);
         if (TRUE === empty($action)) {
             $this->configurationService->message('No template selected - backend layout will not be rendered', GeneralUtility::SYSLOG_SEVERITY_INFO);
             return NULL;
         }
         $paths = $provider->getTemplatePaths($record);
         if (0 === count($paths)) {
             if (VersionUtility::assertCoreVersionIsAtLeastSixPointZero()) {
                 if (FALSE === (bool) GeneralUtility::_GET('redirected')) {
                     // BUG: TYPO3 6.0 exhibits an odd behavior in some circumstances; reloading the page seems to completely avoid problems
                     $get = GeneralUtility::_GET();
                     unset($get['id']);
                     $get['redirected'] = 1;
                     $params = GeneralUtility::implodeArrayForUrl('', $get);
                     header('Location: ?id=' . $pageUid . $params);
                     exit;
                 }
                 return NULL;
             }
             $this->configurationService->message('Unable to detect a configuration. If it is not intentional, check that you ' . 'have included the TypoScript for the desired template collection.', GeneralUtility::SYSLOG_SEVERITY_NOTICE);
             return NULL;
         }
         $grid = $provider->getGrid($record)->build();
         if (FALSE === is_array($grid) || 0 === count($grid['rows'])) {
             // no grid is defined; we use the "raw" BE layout as a default behavior
             $this->configurationService->message('The selected page template does not contain a grid but the template is itself valid.');
             return NULL;
         }
     } catch (\Exception $error) {
         $this->configurationService->debug($error);
         return NULL;
     }
     $config = array('backend_layout.' => array('colCount' => 0, 'rowCount' => 0, 'rows.' => array()));
     $colPosList = array();
     $items = array();
     $rowIndex = 0;
     foreach ($grid['rows'] as $row) {
         $index = 0;
         $colCount = 0;
         $rowKey = $rowIndex + 1 . '.';
         $columns = array();
         foreach ($row['columns'] as $column) {
             $key = $index + 1 . '.';
             $columnName = $GLOBALS['LANG']->sL($column['label']);
             if (TRUE === empty($columnName)) {
                 $columnName = $column['name'];
             }
             $columns[$key] = array('name' => $columnName, 'colPos' => $column['colPos'] >= 0 ? $column['colPos'] : $config['backend_layout.']['colCount']);
             if ($column['colspan']) {
                 $columns[$key]['colspan'] = $column['colspan'];
             }
             if ($column['rowspan']) {
                 $columns[$key]['rowspan'] = $column['rowspan'];
             }
             array_push($colPosList, $columns[$key]['colPos']);
             array_push($items, array($columns[$key]['name'], $columns[$key]['colPos'], NULL));
             $colCount += $column['colspan'] ? $column['colspan'] : 1;
             ++$index;
         }
         $config['backend_layout.']['colCount'] = max($config['backend_layout.']['colCount'], $colCount);
         $config['backend_layout.']['rowCount']++;
         $config['backend_layout.']['rows.'][$rowKey] = array('columns.' => $columns);
         ++$rowIndex;
     }
     unset($backendLayout['config']);
     $backendLayout['__config'] = $config;
     $backendLayout['__colPosList'] = $colPosList;
     $backendLayout['__items'] = $items;
 }
示例#4
0
 /**
  * @test
  */
 public function returnsFalseIfExtensionKeyIsNotLoaded()
 {
     $isFalseResponse = VersionUtility::assertExtensionVersionIsAtLeastVersion('void', 1, 0, 0);
     $this->assertFalse($isFalseResponse);
 }
示例#5
0
 /**
  * @return ExposedTemplateParser
  */
 protected function getTemplateParser()
 {
     if (VersionUtility::assertExtensionVersionIsAtLeastVersion('core', 8)) {
         $exposedTemplateParser = new ExposedTemplateParser();
         $exposedTemplateParser->setRenderingContext(new RenderingContext());
     } else {
         $exposedTemplateParser = new ExposedTemplateParserLegacy();
     }
     return $exposedTemplateParser;
 }
 /**
  * Render uri
  *
  * @return string
  */
 public function render()
 {
     $row = $this->arguments['row'];
     $area = $this->arguments['area'];
     $pageRes = $GLOBALS['TYPO3_DB']->exec_SELECTquery('*', 'pages', "uid = '" . $row['pid'] . "'");
     $pageRecord = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($pageRes);
     $GLOBALS['TYPO3_DB']->sql_free_result($pageRes);
     // note: the following chained makeInstance is not an error; it is there to make the ViewHelper work on TYPO3 6.0
     /** @var $dblist PageLayoutView */
     $dblist = GeneralUtility::makeInstance('TYPO3\\CMS\\Extbase\\Object\\ObjectManager')->get('TYPO3\\CMS\\Backend\\View\\PageLayoutView');
     $dblist->backPath = $GLOBALS['BACK_PATH'];
     $dblist->script = 'db_layout.php';
     $dblist->showIcon = 1;
     $dblist->setLMargin = 0;
     $dblist->doEdit = 1;
     $dblist->no_noWrap = 1;
     $dblist->setLMargin = 0;
     $dblist->ext_CALC_PERMS = $GLOBALS['BE_USER']->calcPerms($pageRecord);
     $dblist->id = $row['pid'];
     $dblist->nextThree = 1;
     $dblist->showCommands = 1;
     $dblist->tt_contentConfig['showCommands'] = 1;
     $dblist->tt_contentConfig['showInfo'] = 1;
     $dblist->tt_contentConfig['single'] = 0;
     $dblist->CType_labels = array();
     foreach ($GLOBALS['TCA']['tt_content']['columns']['CType']['config']['items'] as $val) {
         $dblist->CType_labels[$val[1]] = $GLOBALS['LANG']->sL($val[0]);
     }
     $dblist->itemLabels = array();
     foreach ($GLOBALS['TCA']['tt_content']['columns'] as $name => $val) {
         $dblist->itemLabels[$name] = $GLOBALS['LANG']->sL($val['label']);
     }
     $condition = "((tx_flux_column = '" . $area . ':' . $row['uid'] . "') OR (tx_flux_parent = '" . $row['uid'] . "' AND tx_flux_column = '" . $area . "')) AND deleted = 0";
     $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('*', 'tt_content', $condition, 'uid', 'sorting ASC');
     $records = $dblist->getResult($res);
     $fluxColumnId = 'column-' . $area . '-' . $row['uid'] . '-' . $row['pid'] . '-FLUX';
     $this->templateVariableContainer->add('records', $records);
     $this->templateVariableContainer->add('dblist', $dblist);
     $this->templateVariableContainer->add('fluxColumnId', $fluxColumnId);
     $content = $this->renderChildren();
     $this->templateVariableContainer->remove('records');
     $this->templateVariableContainer->remove('dblist');
     $this->templateVariableContainer->remove('fluxColumnId');
     if (FALSE === VersionUtility::assertExtensionVersionIsAtLeastVersion('gridelements', 2)) {
         $content = '<div id="column-' . $area . '-' . $row['uid'] . '-' . $row['pid'] . '-FLUX">' . $content . '</div>';
     }
     return $content;
 }