Commit 68e64735 authored by Dirk Wildt's avatar Dirk Wildt

0.0.7

parent 28e8af5d
0.0.7
19-07-03
Feature
* #t3865: Frontend plugin. Here: Flexform
New files:
* Classes/Flexform/ItemsprocFlexform.php
* Configuration
* Flexform/Booking/*
* TypoScript/page/includeCSS/tileModule.ts
* Resources/Private/Language/Flexform/*
Affected file:
* /opt/typo3/extensions/tile/Classes/Controller/AbstractController.php
* #t3864: Frontend plugin. Here: Booking Controller
New files:
* Classes/Controller/BookController.php
* Configuration/TCA/Overrides/tt_content.php
Affected files:
* ext_localconf.php
0.0.6
19-06-29
19-07-02
Feature
* #t3857: Relation cell <> product
* #t3854: Type clone
......
......@@ -10,6 +10,8 @@ use \Netzmacher\Tile\Domain\Repository\GroupRepository;
use \Netzmacher\Tile\Domain\Repository\PageRepository;
use \Netzmacher\Tile\Domain\Repository\ProductRepository;
use \Netzmacher\Tile\Domain\Repository\TicketRepository;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer;
/* * *
*
......@@ -24,6 +26,10 @@ use \Netzmacher\Tile\Domain\Repository\TicketRepository;
/**
* Class AbstractController
*
* @version 0.0.6
* @since 0.0.1
*/
abstract class AbstractController extends \TYPO3\CMS\Extbase\Mvc\Controller\ActionController
{
......@@ -52,6 +58,11 @@ abstract class AbstractController extends \TYPO3\CMS\Extbase\Mvc\Controller\Acti
*/
protected $cellRepository = null;
/**
* @var ContentObjectRenderer
*/
protected $contentObject;
/**
* cssRepository
*
......@@ -89,6 +100,7 @@ abstract class AbstractController extends \TYPO3\CMS\Extbase\Mvc\Controller\Acti
* @inject
*/
protected $productRepository = null;
/**
* ticketRepository
*
......@@ -97,6 +109,71 @@ abstract class AbstractController extends \TYPO3\CMS\Extbase\Mvc\Controller\Acti
*/
protected $ticketRepository = null;
/**
* _getFlexformValue():
*
* @param string method
* @param string line
* @param string flexform
* @param string label of the sheet
* @param string label of the field
* @return mixed value from flexform
* @access protected
* @version 0.5.2
* @since 0.5.2
*/
protected function _getFlexformValue( $method, $line, $xmlFlexform, $sheet, $field )
{
$NSprefix = '';
$reportDocTag = false;
$arrFlexform = GeneralUtility::xml2array( $xmlFlexform, $NSprefix, $reportDocTag );
if( !isset( $arrFlexform[ 'data' ][ $sheet ][ 'lDEF' ][ $field ][ 'vDEF' ] ) )
{
$this->_getFlexformValueDiePrompt( $method, $line, $sheet, $field );
}
return $arrFlexform[ 'data' ][ $sheet ][ 'lDEF' ][ $field ][ 'vDEF' ];
}
/**
* _getFlexformValueDiePrompt():
*
* @param string method
* @param string line
* @param string label of the sheet
* @param string label of the field
* @return mixed value from flexform
* @access protected
* @version 0.5.2
* @since 0.5.2
*/
private function _getFlexformValueDiePrompt( $method, $line, $sheet, $field )
{
$prompt = ''
. 'ERROR<br />'
. 'Current Flexform does\'t contain a sheet ' . $sheet . ' with field ' . $field . '<br />'
. '@ ' . $method . ' (#' . $line . ')'
;
die( $prompt );
}
/**
* Initializes this object
*
* @return void
* @codeCoverageIgnore
* @throws InvalidSlotException
* @throws InvalidSlotReturnException
*/
protected function _initObjectContent()
{
// @extensionScannerIgnoreLine Seems to be a false positive: getContentObject() is still correct in 9.0
$this->contentObject = $this->configurationManager->getContentObject();
//var_dump(__METHOD__, __LINE__, $this->contentObject->data);
}
/**
* @param AreaRepository $areaRepository
* @return void
......
<?php
namespace Netzmacher\Tile\Controller;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer;
/* * *************************************************************
* Copyright notice
*
* (c) 2019 - Dirk Wildt <http://wildt.at.die-netzmacher.de>
* 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.
*
* 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!
* ************************************************************* */
/**
* AbstractObjectController for the tile extension
*
* @package TYPO3
* @subpackage tile
* @author Dirk Wildt <http://wildt.at.die-netzmacher.de>
* @version 0.0.7
* @since 0.0.7
*/
class AbstractObjectController extends AbstractController
{
/**
* @var TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer
*/
private $_oCObj;
/**
* @var TYPO3\CMS\Extbase\Object\ObjectManager
*/
private $_oObjectManager;
/**
* @var \TYPO3\CMS\Frontend\Plugin\AbstractPlugin
*/
protected $_oPlugin;
/**
* @var TYPO3\CMS\Extbase\Service\TypoScriptService
*/
protected $_oTypoScriptService;
/**
* @var ContentObjectRenderer
*/
protected $contentObject;
/**
* TypoScript configuration
*
* @var array
*/
protected $conf;
/**
* @var string Extension key
*/
public $extKey = 'tile';
/**
* Initializes this object
*
* @return void
* @codeCoverageIgnore
* @throws InvalidSlotException
* @throws InvalidSlotReturnException
*/
private function _initObjectContent()
{
// @extensionScannerIgnoreLine Seems to be a false positive: getContentObject() is still correct in 9.0
$this->contentObject = $this->configurationManager->getContentObject();
//var_dump(__METHOD__, __LINE__, $this->contentObject->data);
}
/**
* _initObjectCObj( ) :
*
* @return void
* @access private
* @version 0.0.1
* @since 0.0.1
*/
private function _initObjectCObj()
{
$this->_oCObj = $this->_oObjectManager->get( 'TYPO3\\CMS\\Frontend\\ContentObject\\ContentObjectRenderer' );
$this->_initObjectCObjData();
}
/**
* _initObjectCObjData( ) : Is needed, if in TypoScript is used: data = flexform : pi_flexform:...
* If it isn't set, data will be empty, and data[pi_flexform] too of course.
*
* @return void
* @access private
* @version 0.0.1
* @since 0.0.1
*/
private function _initObjectCObjData()
{
$this->_oCObj->data = $this->contentObject->data;
}
/**
* _initObjectObjectManager( ) :
*
* @return void
* @access private
* @version 0.0.1
* @since 0.0.1
*/
private function _initObjectObjectManager()
{
$this->_oObjectManager = GeneralUtility::makeInstance( 'TYPO3\\CMS\\Extbase\\Object\\ObjectManager' );
}
/**
* _initObjectPlugin( ) : Init localisation
*
* @return void
* @access private
* @version 0.8.4
* @since 0.0.1
* @internal #i0062
*/
private function _initObjectPlugin()
{
$this->_oPlugin = GeneralUtility::makeInstance( 'TYPO3\\CMS\\Frontend\\Plugin\\AbstractPlugin' );
}
/**
* _initObjectTypoScriptService( ) :
*
* @return void
* @access private
* @version 0.0.1
* @since 0.0.1
*/
private function _initObjectTypoScriptService()
{
$this->_oTypoScriptService = GeneralUtility::makeInstance( 'TYPO3\\CMS\\Extbase\\Service\\TypoScriptService' );
}
/**
* _cObjGetSingle( ) :
*
* @param array $record
* @return string $value
* @access protected
* @version 0.0.1
* @since 0.0.1
*/
protected function cObjGetSingle( $record )
{
if( empty( $record ) )
{
return;
}
$name = $record[ '_typoScriptNodeValue' ];
$conf = $this->_oTypoScriptService->convertPlainArrayToTypoScriptArray( $record );
$value = $this->_oCObj->cObjGetSingle( $name, $conf );
return $value;
}
/**
* initObjects( ) :
*
* @return void
* @access private
* @version 0.3.0
* @since 0.0.1
*/
protected function initObjects()
{
$this->_initObjectObjectManager();
$this->_initObjectContent();
$this->_initObjectCObj();
$this->_initObjectPlugin();
$this->_initObjectTypoScriptService();
}
}
......@@ -14,7 +14,10 @@ namespace Netzmacher\Tile\Controller;
* * */
/**
* AreaController
* AreaController: backend module
*
* @version 0.0.6
* @since 0.0.1
*/
class AreaController extends AbstractController
{
......@@ -167,7 +170,6 @@ class AreaController extends AbstractController
return ( int ) count( $this->_getCells( $area ) );
}
/**
* action create
*
......
This diff is collapsed.
......@@ -18,7 +18,10 @@ use Netzmacher\Tile\Utility\Module\SessionModuleUtility;
* * */
/**
* CategoryController
* CategoryController: backend module
*
* @version 0.0.6
* @since 0.0.1
*/
class CategoryController extends AbstractController
{
......
......@@ -16,7 +16,7 @@ use Netzmacher\Tile\Utility\Module\SessionModuleUtility;
* * */
/**
* CellController
* CellController: backend module
*
* @version 0.0.6
* @since 0.0.1
......
......@@ -14,7 +14,7 @@ namespace Netzmacher\Tile\Controller;
* * */
/**
* ModuleController
* ModuleController: backend module
*
* @version 0.0.6
* @since 0.0.1
......
......@@ -16,7 +16,10 @@ use Netzmacher\Tile\Utility\Module\SessionModuleUtility;
* * */
/**
* ShopController
* ShopController: backend module
*
* @version 0.0.6
* @since 0.0.1
* @internal #t3823
*/
class ShopController extends AbstractController
......
......@@ -18,7 +18,10 @@ use Netzmacher\Tile\Utility\Module\SessionModuleUtility;
* * */
/**
* TicketController
* TicketController: backend module
*
* @version 0.0.6
* @since 0.0.1
*/
class TicketController extends AbstractController
{
......
<?php
namespace Netzmacher\Tile\Domain\Repository;
namespace Netzmacher\Tile\Domain\Repository;
/***
/* * *
*
* This file is part of the "Book a tile!" Extension for TYPO3 CMS.
*
......@@ -11,10 +11,15 @@ namespace Netzmacher\Tile\Domain\Repository;
*
* (c) 2019 Dirk Wildt (Die Netzmacher) <http://wildt@die-netzmacher.de>, Die Netzmacher
*
***/
* * */
/**
* The repository for Areas
*
* @version 0.0.7
* @since 0.0.1
*/
class AreaRepository extends \TYPO3\CMS\Extbase\Persistence\Repository
{
}
<?php
namespace Netzmacher\Tile\Flexform;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Core\Database\ConnectionPool;
/* * *************************************************************
* Copyright notice
*
* (c) 2018-2019 - Dirk Wildt <http://wildt.at.die-netzmacher.de>
* 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.
*
* 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!
* ************************************************************* */
/**
* AbstractController for the xBlog xtension
*
* @package TYPO3
* @subpackage tile
* @author Dirk Wildt <http://wildt.at.die-netzmacher.de>
* @version 0.0.7
* @since 0.0.7
*/
class ItemsprocFlexform
{
/**
* _getAreasCloned( ) :
*
* @return array rows
* @access public
* @version 0.0.7
* @since 0.0.7
*/
private function _getAreasCloned()
{
$queryBuilder = GeneralUtility::makeInstance( ConnectionPool::class )->getConnectionForTable( 'tx_tile_domain_model_cell' )->createQueryBuilder();
$queryBuilder
->select( '*' )
->from( 'tx_tile_domain_model_area' )
->where(
$queryBuilder->expr()->eq( 'type', $queryBuilder->createNamedParameter( '1' ) )
)
;
$result = $queryBuilder->execute();
while( $row = $result->fetch() )
{
$rows[] = $row;
}
return $rows;
}
/**
* _promptCreateClone( ) :
*
* @return array item array for a flexform
* @access public
* @version 0.0.7
* @since 0.0.7
*/
public function _promptCreateClone( &$params )
{
$params[ 'items' ][] = [
'You have to create a live version of a site plan first.'
, null
, ''
];
return $params;
}
/**
* AreasCloned( ) :
*
* @return array item array for a flexform
* @access public
* @version 0.0.7
* @since 0.0.7
*/
public function AreasCloned( &$params )
{
$rows = $this->_getAreasCloned();
if( empty( $rows ) )
{
$params = $this->_promptCreateClone( $params );
// var_dump( __METHOD__, __LINE__, $rows, $params );
// die();
return $params;
}
$params[ 'items' ][] = [ '', '', '' ];
foreach( ( array ) $rows as $row )
{
// if not clone
// continue;
if( $row[ 'type' ] != 1 )
{
continue;
}
$params[ 'items' ][] = [
$row[ 'title' ]
, $row[ 'uid' ]
, 'EXT:tile/Resources/Public/Icons/ext-tile-area-clone.svg'
];
}
// var_dump( __METHOD__, __LINE__, $rows, $params );
// die();
array_multisort( array_column( $params[ 'items' ], 0 ), SORT_ASC, $params[ 'items' ] );
return $params;
}
}
<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
<T3DataStructure>
<meta>
<langDisable>1</langDisable>
</meta>
<sheets>
<area>EXT:tile/Configuration/Flexform/Booking/flexform_sheet_area.xml</area>
</sheets>
</T3DataStructure>
<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
<T3DataStructure>
<ROOT>
<TCEforms>
<sheetTitle>LLL:EXT:tile/Resources/Private/Language/Flexform/Booking.xlf:sheet_area</sheetTitle>
</TCEforms>
<type>array</type>
<el>
<settings.flexform.pi1.area.uid>
<TCEforms>
<exclude>1</exclude>
<label>LLL:EXT:tile/Resources/Private/Language/Flexform/Booking.xlf:sheet_area.uid</label>
<onChange>reload</onChange>
<config>
<type>select</type>
<allowNonIdValues>1</allowNonIdValues>
<items type="array"></items>
<itemsProcFunc>Netzmacher\Tile\Flexform\ItemsprocFlexform->AreasCloned</itemsProcFunc>
<maxitems>1</maxitems>
<multiple>0</multiple>
<size>1</size>
</config>
</TCEforms>
</settings.flexform.pi1.area.uid>
</el>
</ROOT>
</T3DataStructure>
\ No newline at end of file
<?php
defined( 'TYPO3_MODE' ) || die();
/**
* Include Plugins
*/
//\TYPO3\CMS\Extbase\Utility\ExtensionUtility::registerPlugin( 'powermail', 'Pi1', 'Powermail' );
//\TYPO3\CMS\Extbase\Utility\ExtensionUtility::registerPlugin( 'powermail', 'Pi2', 'Powermail_Frontend' );
//\TYPO3\CMS\Extbase\Utility\ExtensionUtility::registerPlugin( 'tile', 'Pi1', 'Book a Tile!' );
TYPO3\CMS\Extbase\Utility\ExtensionUtility::registerPlugin(
'tile'
, 'Pi1'
, 'LLL:EXT:tile/Resources/Private/Language/Flexform/Booking.xlf:pi1_title'
, Netzmacher\Refresh\Compatibility\Core\Utility\ExtensionManagementUtility::extRelPath( 'tile' ) . 'ext_icon.svg'
);
$pluginSignature = str_replace( '_', '', 'tile' ) . '_pi1';
//TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addPlugin(
// [
// 'LLL:EXT:tile/Resources/Private/Language/Flexform/Booking.xlf:pi1_title'
// , $pluginSignature
// , Netzmacher\Refresh\Compatibility\Core\Utility\ExtensionManagementUtility::extRelPath( 'tile' ) . 'ext_icon.svg'
// ]
// , 'list_type'
// , 'tile'
//);
$GLOBALS[ 'TCA' ][ 'tt_content' ][ 'types' ][ 'list' ][ 'subtypes_excludelist' ][ $pluginSignature ] = 'select_key,pages,recursive';
$GLOBALS[ 'TCA' ][ 'tt_content' ][ 'types' ][ 'list' ][ 'subtypes_addlist' ][ $pluginSignature ] = 'pi_flexform';
TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addPiFlexFormValue(
$pluginSignature, 'FILE:EXT:tile/Configuration/Flexform/Booking/flexform.xml'
);
<INCLUDE_TYPOSCRIPT: source="FILE:EXT:tile/Configuration/TypoScript/config/_setup.ts">
<INCLUDE_TYPOSCRIPT: source="FILE:EXT:tile/Configuration/TypoScript/lib/_setup.ts">
<INCLUDE_TYPOSCRIPT: source="FILE:EXT:tile/Configuration/TypoScript/module/_setup.ts">
<INCLUDE_TYPOSCRIPT: source="FILE:EXT:tile/Configuration/TypoScript/page/_setup.ts">
<INCLUDE_TYPOSCRIPT: source="FILE:EXT:tile/Configuration/TypoScript/plugin/_setup.ts">
\ No newline at end of file
<INCLUDE_TYPOSCRIPT: source="FILE:EXT:tile/Configuration/TypoScript/page/includeCSS/_setup.ts">
<INCLUDE_TYPOSCRIPT: source="FILE:EXT:tile/Configuration/TypoScript/page/includeCSS/tileModule.ts">
page {
// empty statement for proper comments only
includeCSS {
}
// tileModule
includeCSS =
includeCSS {
tileModule = EXT:tile/Resources/Public/Css/Module/Styles.css
}
}
<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
<xliff version="1.0">
<file source-language="en" datatype="plaintext" original="messages" date="2019-07-30T21:10:20Z" product-name="tile">
<header/>
<body>
<trans-unit id="pi1_title">
<source>Book a Tile!</source>
<target>Buche eine Kachel!</target>
</trans-unit>
<trans-unit id="sheet_area">
<source>Site Plan</source>
<target>Plan</target>
</trans-unit>
<trans-unit id="sheet_area.uid">
<source>Site Plan</source>
<target>Plan</target>
</trans-unit>
</body>
</file>
</xliff>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
<xliff version="1.0">
<file source-language="en" datatype="plaintext" original="messages" date="2019-07-30T21:10:20Z" product-name="tile">
<header/>
<body>
<trans-unit id="pi1_title">
<source>Book a Tile!</source>
<target>Buche eine Kachel!</target>
</trans-unit>
<trans-unit id="sheet_area">
<source>Site Plan</source>
<target>Plan</target>
</trans-unit>
<trans-unit id="sheet_area.uid">
<source>Site Plan</source>
<target>Plan</target>
</trans-unit>
</body>
</file>
</xliff>
\ No newline at end of file
<f:spaceless>
<f:render section="content" />
</f:spaceless>
\ No newline at end of file
{namespace vh=Netzmacher\Tile\ViewHelpers}