Corrected doeble code
authorSteffen Kamper <info@sk-typo3.de>
Tue, 16 Nov 2010 12:16:30 +0000 (12:16 +0000)
committerSteffen Kamper <info@sk-typo3.de>
Tue, 16 Nov 2010 12:16:30 +0000 (12:16 +0000)
git-svn-id: https://svn.typo3.org/TYPO3v4/Core/trunk@9396 709f56b5-9817-0410-a4d7-c38de5d9e867

typo3/sysext/cms/class.tx_cms_be_layout.php
typo3/sysext/cms/layout/class.tx_cms_layout.php

index 9a73979..598deea 100644 (file)
@@ -1,4 +1,29 @@
 <?php
+/***************************************************************
+ *  Copyright notice
+ *
+ *  (c) 2010 GridView Team
+ *  All rights reserved
+ *
+ *  This script is part of the TYPO3 project. The TYPO3 project is
+ *  free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  The GNU General Public License can be found at
+ *  http://www.gnu.org/copyleft/gpl.html.
+ *  A copy is found in the textfile GPL.txt and important notices to the license
+ *  from the author is found in LICENSE.txt distributed with these scripts.
+ *
+ *
+ *  This script is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  This copyright notice MUST APPEAR in all copies of the script!
+ ***************************************************************/
 
 class tx_cms_be_layout {
 
@@ -7,31 +32,31 @@ class tx_cms_be_layout {
         * @todo add items
         * @param unknown_type $params
         */
-       function colPosListItemProcFunc( &$params ){
-               $params['items'] = $this->addColPosListLayoutItems ( $params['row']['pid'], $params['items'] );
+       function colPosListItemProcFunc(&$params) {
+               $params['items'] = $this->addColPosListLayoutItems($params['row']['pid'], $params['items']);
        }
 
-       function addColPosListLayoutItems ( $pageId, $items ){
+       function addColPosListLayoutItems($pageId, $items) {
                $layout = $this->getSelectedBackendLayout($pageId);
-               if( $layout && $layout['__items'] ){
+               if ($layout && $layout['__items']) {
                        $items = $layout['__items'];
                }
                return $items;
        }
 
-       function getColPosListItemsParsed ( $id ){
+       function getColPosListItemsParsed($id) {
 
-               $tsConfig = t3lib_BEfunc::getModTSconfig( $id ,'TCEFORM.tt_content.colPos');
+               $tsConfig = t3lib_BEfunc::getModTSconfig($id, 'TCEFORM.tt_content.colPos');
                $tcaConfig = $GLOBALS['TCA']['tt_content']['columns']['colPos']['config'];
 
-               $TCEForms = t3lib_div::makeInstance( 't3lib_TCEForms' );
+               $TCEForms = t3lib_div::makeInstance('t3lib_TCEForms');
                $tcaItems = $tcaConfig['items'];
                $tcaItems = $TCEForms->addItems($tcaItems, $tsConfig['properties']['addItems.']);
                if (isset($tcaConfig['itemsProcFunc']) && $tcaConfig['itemsProcFunc']) {
-                       $tcaItems = $this->addColPosListLayoutItems ($id , $tcaItems ) ;
+                       $tcaItems = $this->addColPosListLayoutItems($id, $tcaItems);
                }
-               foreach ( t3lib_div::trimExplode(',',$tsConfig['properties']['removeItems'],1) as $removeId ){
-                       unset( $tcaItems[$removeId] );
+               foreach (t3lib_div::trimExplode(',', $tsConfig['properties']['removeItems'], 1) as $removeId) {
+                       unset($tcaItems[$removeId]);
                }
                return $tcaItems;
        }
@@ -40,109 +65,22 @@ class tx_cms_be_layout {
                $rootline = t3lib_BEfunc::BEgetRootLine($id);
                $backendLayoutUid = null;
                for ($i = count($rootline); $i > 0; $i--) {
-                       $res = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows('uid,be_layout,be_layout_next_level','pages','uid='.intval($rootline[$i]['uid']));
+                       $res = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows('uid,be_layout,be_layout_next_level', 'pages', 'uid=' . intval($rootline[$i]['uid']));
                        $page = $res[0];
-                       if (intval($page['be_layout_next_level']) > 0 && $page['uid'] != $id ) {
+                       if (intval($page['be_layout_next_level']) > 0 && $page['uid'] != $id) {
                                $backendLayoutUid = intval($page['be_layout_next_level']);
                                break;
-                       } else if (intval($page['be_layout']) > 0) {
-                               $backendLayoutUid = intval($page['be_layout']);
-                               break;
-                       }
-               }
-               $backendLayout = null;
-               if ($backendLayoutUid){
-                       $res = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows('*','be_layouts','uid='.$backendLayoutUid  );
-                       if ($res){
-                               $backendLayout = $res[0];
-                               $parser = t3lib_div::makeInstance('t3lib_TSparser');
-                               $parser->parse($backendLayout['config']);
-                               $backendLayout['__config'] = $parser->setup;
-                               $backendLayout['__items'] = array();
-                               $backendLayout['__colPosList'] = array();
-
-                                       // create items and colPosList
-                               if ( $backendLayout['__config']['be_layout.'] && $backendLayout['__config']['be_layout.']['rows.'] ){
-                                       foreach( $backendLayout['__config']['be_layout.']['rows.']  as  $row){
-                                               if ( true && count($row['columns.'])){
-                                                       foreach ( $row['columns.'] as $column) {
-                                                               if ( true ){
-                                                                       $backendLayout['__items'][] = array (
-                                                                               $column['name'],
-                                                                               $column['colPos'],
-                                                                               null
-                                                                       );
-                                                                       $backendLayout['__colPosList'][] =  $column['colPos'];
-                                                               }
-                                                       }
-                                               }
-                                       }
+                       } else {
+                               if (intval($page['be_layout']) > 0) {
+                                       $backendLayoutUid = intval($page['be_layout']);
+                                       break;
                                }
-
-                       }
-               }
-               return $backendLayout;
-       }
-
-}
-
-?>
-<?php
-
-class tx_cms_be_layout {
-
-       /**
-        * @mficzel
-        * @todo add items
-        * @param unknown_type $params
-        */
-       function colPosListItemProcFunc( &$params ){
-               $params['items'] = $this->addColPosListLayoutItems ( $params['row']['pid'], $params['items'] );
-       }
-
-       function addColPosListLayoutItems ( $pageId, $items ){
-               $layout = $this->getSelectedBackendLayout($pageId);
-               if( $layout && $layout['__items'] ){
-                       $items = $layout['__items'];
-               }
-               return $items;
-       }
-
-       function getColPosListItemsParsed ( $id ){
-
-               $tsConfig = t3lib_BEfunc::getModTSconfig( $id ,'TCEFORM.tt_content.colPos');
-               $tcaConfig = $GLOBALS['TCA']['tt_content']['columns']['colPos']['config'];
-
-               $TCEForms = t3lib_div::makeInstance( 't3lib_TCEForms' );
-               $tcaItems = $tcaConfig['items'];
-               $tcaItems = $TCEForms->addItems($tcaItems, $tsConfig['properties']['addItems.']);
-               if (isset($tcaConfig['itemsProcFunc']) && $tcaConfig['itemsProcFunc']) {
-                       $tcaItems = $this->addColPosListLayoutItems ($id , $tcaItems ) ;
-               }
-               foreach ( t3lib_div::trimExplode(',',$tsConfig['properties']['removeItems'],1) as $removeId ){
-                       unset( $tcaItems[$removeId] );
-               }
-               return $tcaItems;
-       }
-
-       function getSelectedBackendLayout($id) {
-               $rootline = t3lib_BEfunc::BEgetRootLine($id);
-               $backendLayoutUid = null;
-               for ($i = count($rootline); $i > 0; $i--) {
-                       $res = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows('uid,be_layout,be_layout_next_level','pages','uid='.intval($rootline[$i]['uid']));
-                       $page = $res[0];
-                       if (intval($page['be_layout_next_level']) > 0 && $page['uid'] != $id ) {
-                               $backendLayoutUid = intval($page['be_layout_next_level']);
-                               break;
-                       } else if (intval($page['be_layout']) > 0) {
-                               $backendLayoutUid = intval($page['be_layout']);
-                               break;
                        }
                }
                $backendLayout = null;
-               if ($backendLayoutUid){
-                       $res = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows('*','be_layouts','uid='.$backendLayoutUid  );
-                       if ($res){
+               if ($backendLayoutUid) {
+                       $res = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows('*', 'be_layouts', 'uid=' . $backendLayoutUid);
+                       if ($res) {
                                $backendLayout = $res[0];
                                $parser = t3lib_div::makeInstance('t3lib_TSparser');
                                $parser->parse($backendLayout['config']);
@@ -150,18 +88,18 @@ class tx_cms_be_layout {
                                $backendLayout['__items'] = array();
                                $backendLayout['__colPosList'] = array();
 
-                                       // create items and colPosList
-                               if ( $backendLayout['__config']['be_layout.'] && $backendLayout['__config']['be_layout.']['rows.'] ){
-                                       foreach( $backendLayout['__config']['be_layout.']['rows.']  as  $row){
-                                               if ( true && count($row['columns.'])){
-                                                       foreach ( $row['columns.'] as $column) {
-                                                               if ( true ){
-                                                                       $backendLayout['__items'][] = array (
+                               // create items and colPosList
+                               if ($backendLayout['__config']['be_layout.'] && $backendLayout['__config']['be_layout.']['rows.']) {
+                                       foreach ($backendLayout['__config']['be_layout.']['rows.'] as $row) {
+                                               if (true && count($row['columns.'])) {
+                                                       foreach ($row['columns.'] as $column) {
+                                                               if (true) {
+                                                                       $backendLayout['__items'][] = array(
                                                                                $column['name'],
                                                                                $column['colPos'],
                                                                                null
                                                                        );
-                                                                       $backendLayout['__colPosList'][] =  $column['colPos'];
+                                                                       $backendLayout['__colPosList'][] = $column['colPos'];
                                                                }
                                                        }
                                                }
@@ -175,4 +113,4 @@ class tx_cms_be_layout {
 
 }
 
-?>
+?>
\ No newline at end of file
index 73dc17f..6ee7f74 100755 (executable)
@@ -2760,4 +2760,4 @@ if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/cms/lay
        include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/cms/layout/class.tx_cms_layout.php']);
 }
 
-?>
+?>
\ No newline at end of file