Commit b04a5de3 authored by Dirk Wildt's avatar Dirk Wildt

0.0.8

parent b0b8535f
0.0.8
19-07-13
Feature
* #t3869: Caddy
0.0.7
19-07-03
19-07-13
Feature
* #t3865: Frontend plugin. Here: Flexform
New files:
......
......@@ -5,6 +5,7 @@ namespace Netzmacher\Tile\Controller;
use \Netzmacher\Tile\Domain\Repository\AreaRepository;
use \Netzmacher\Tile\Domain\Repository\CategoryRepository;
use \Netzmacher\Tile\Domain\Repository\CellRepository;
use \Netzmacher\Tile\Domain\Repository\ContentRepository;
use \Netzmacher\Tile\Domain\Repository\CssRepository;
use \Netzmacher\Tile\Domain\Repository\GroupRepository;
use \Netzmacher\Tile\Domain\Repository\PageRepository;
......@@ -20,7 +21,7 @@ use TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer;
* For the full copyright and license information, please read the
* LICENSE.txt file that was distributed with this source code.
*
* (c) 2019 Dirk Wildt (Die Netzmacher) <http://wildt@die-netzmacher.de>, Die Netzmacher
* (c) 2019 - Dirk Wildt (Die Netzmacher) <http://wildt@die-netzmacher.de>, Die Netzmacher
*
* * */
......@@ -63,6 +64,14 @@ abstract class AbstractController extends \TYPO3\CMS\Extbase\Mvc\Controller\Acti
*/
protected $contentObject;
/**
* contentRepository
*
* @var \Netzmacher\Tile\Domain\Repository\ContentRepository
* @inject
*/
protected $contentRepository = null;
/**
* cssRepository
*
......@@ -205,6 +214,15 @@ abstract class AbstractController extends \TYPO3\CMS\Extbase\Mvc\Controller\Acti
$this->cellRepository = $cellRepository;
}
/**
* @param ContentRepository $contentRepository
* @return void
*/
public function injectContentRepository( ContentRepository $contentRepository )
{
$this->contentRepository = $contentRepository;
}
/**
* @param CssRepository $cssRepository
* @return void
......
......@@ -9,7 +9,7 @@ namespace Netzmacher\Tile\Controller;
* For the full copyright and license information, please read the
* LICENSE.txt file that was distributed with this source code.
*
* (c) 2019 Dirk Wildt (Die Netzmacher) <http://wildt@die-netzmacher.de>, Die Netzmacher
* (c) 2019 - Dirk Wildt (Die Netzmacher) <http://wildt@die-netzmacher.de>, Die Netzmacher
*
* * */
......
......@@ -13,7 +13,7 @@ use Netzmacher\Tile\Utility\SessionUtility;
* For the full copyright and license information, please read the
* LICENSE.txt file that was distributed with this source code.
*
* (c) 2019 Dirk Wildt (Die Netzmacher) <http://wildt@die-netzmacher.de>, Die Netzmacher
* (c) 2019 - Dirk Wildt (Die Netzmacher) <http://wildt@die-netzmacher.de>, Die Netzmacher
*
* * */
......@@ -25,18 +25,84 @@ use Netzmacher\Tile\Utility\SessionUtility;
*/
class BookingController extends AbstractFrontendController
{
// /**
// * Content object of the Caddy
// *
// * @var \Netzmacher\Tile\Domain\Model\Caddy
// */
// private $_cObjCaddy = null;
/**
* _cellIntoTheCaddy
*
* @param int $caddyUid
* @return \Netzmacher\Tile\Domain\Model\Content $cObjCaddy
* @version 0.0.8
* @since 0.0.8
* @internal #t3869
*/
private function _getContentCaddy( $caddyUid )
{
static $cObjCaddy = [];
if( !empty( $cObjCaddy[ $caddyUid ] ) )
{
return $cObjCaddy[ $caddyUid ];
}
$cObjCaddy[ $caddyUid ] = $this->contentRepository->findByUid( $caddyUid );
return $cObjCaddy[ $caddyUid ];
}
/**
* _cellIntoTheCaddy
*
* @return integer pid
* @version 0.0.8
* @since 0.0.8
* @internal #t3869
*/
private function _getCaddyPid( )
{
$caddyUid = $this->_getFlexformCaddy();
$ttContent = $this->_getContentCaddy( $caddyUid );
return $ttContent->getPid();
}
/**
* _cellIntoTheCaddy
*
* @param \Netzmacher\Tile\Domain\Model\Cell $cell
* @return boolean
* @version 0.0.7
* @since 0.0.7
* @version 0.0.8
* @since 0.0.8
* @internal #t3869
*/
private function _cellIntoTheCaddy( \Netzmacher\Tile\Domain\Model\Cell $cell ): bool
{
$this->addFlashMessage( 'Ticket wurde in den Warenkorb gelegt.', '', \TYPO3\CMS\Core\Messaging\AbstractMessage::OK );
$caddyUid = $this->_getFlexformCaddy();
if( empty( $caddyUid ) )
{
$this->addFlashMessage( 'Die Anwendung ist mit keinem Warenkorb verbunden.', '', \TYPO3\CMS\Core\Messaging\AbstractMessage::ERROR );
$this->addFlashMessage( 'Aktualisiere bitte das Plugin.', '', \TYPO3\CMS\Core\Messaging\AbstractMessage::INFO );
return false;
}
$caddyPid = $this->_getCaddyPid( $caddyUid );
$productUid = $cell->getTxTileProduct()->getUid();
$conf = array(
'parameter' => $caddyPid
, 'additionalParams' => '&tx_browser_pi1[itemUid]=' . $productUid
, 'useCashHash' => true
, 'returnLast' => 'url'
, 'forceAbsoluteUrl' => false
);
$uri = $this->contentObject->typoLink( 'Warenkorb', $conf );
$this->redirectToUri( $uri );
$link = 'Warenkorb';
$this->addFlashMessage( 'Ticket wurde in den ' . $link . ' gelegt. #' . $caddyPid, '', \TYPO3\CMS\Core\Messaging\AbstractMessage::OK );
return true;
}
......@@ -108,6 +174,29 @@ class BookingController extends AbstractFrontendController
return $area;
}
/**
* _getFlexformCaddy
*
* @return integer
* @version 0.0.8
* @since 0.0.8
*/
private function _getFlexformCaddy()
{
static $caddyUid = null;
if( !empty( $caddyUid ) )
{
return $caddyUid;
}
$xmlFlexform = $this->contentObject->data[ 'pi_flexform' ];
$sheet = 'caddy';
$field = 'settings.flexform.pi1.caddy.uid';
$caddyUid = $this->_getFlexformValue( __METHOD__, __LINE__, $xmlFlexform, $sheet, $field );
return $caddyUid;
}
/**
* _getFlexformCellsize
*
......@@ -135,8 +224,9 @@ class BookingController extends AbstractFrontendController
* @param \Netzmacher\Tile\Domain\Model\Cell $cell
* @param \Netzmacher\Tile\Domain\Model\Area $area
* @return void
* @version 0.0.7
* @version 0.0.8
* @since 0.0.7
* @internal #t3869
*/
public function caddyAction( \Netzmacher\Tile\Domain\Model\Cell $cell, \Netzmacher\Tile\Domain\Model\Area $area )
{
......@@ -149,7 +239,7 @@ class BookingController extends AbstractFrontendController
case($this->_cellIntoTheCaddy( $cell )):
break;
default:
$this->addFlashMessage( 'Undefinierter Fehler @ ' . __METHOD__ . ' (#' . __LINE__ . ')', '', \TYPO3\CMS\Core\Messaging\AbstractMessage::ERROR );
$this->addFlashMessage( 'Undefinierter Fehler: Es wurde keine Bedingung erfüllt @ ' . __METHOD__ . ' (#' . __LINE__ . ')', '', \TYPO3\CMS\Core\Messaging\AbstractMessage::ERROR );
break;
}
......@@ -188,6 +278,8 @@ class BookingController extends AbstractFrontendController
$this->view->assignMultiple(
array(
'area' => $area
, 'caddyPid' => $this->_getCaddyPid()
, 'cData' => $this->contentObject->data
, 'cells' => $this->_getAreaCells( $area )
, 'formCellWiBgimageChecked' => $this->_oSessionUtility->getSessionElement( 'formCellWiBgimage', false )
, 'formCellWiCategoriesChecked' => $this->_oSessionUtility->getSessionElement( 'formCellWiCategories', false )
......
......@@ -13,7 +13,7 @@ use Netzmacher\Tile\Utility\Module\SessionModuleUtility;
* For the full copyright and license information, please read the
* LICENSE.txt file that was distributed with this source code.
*
* (c) 2019 Dirk Wildt (Die Netzmacher) <http://wildt@die-netzmacher.de>, Die Netzmacher
* (c) 2019 - Dirk Wildt (Die Netzmacher) <http://wildt@die-netzmacher.de>, Die Netzmacher
*
* * */
......
......@@ -11,7 +11,7 @@ use Netzmacher\Tile\Utility\Module\SessionModuleUtility;
* For the full copyright and license information, please read the
* LICENSE.txt file that was distributed with this source code.
*
* (c) 2019 Dirk Wildt (Die Netzmacher) <http://wildt@die-netzmacher.de>, Die Netzmacher
* (c) 2019 - Dirk Wildt (Die Netzmacher) <http://wildt@die-netzmacher.de>, Die Netzmacher
*
* * */
......
......@@ -9,7 +9,7 @@ namespace Netzmacher\Tile\Controller;
* For the full copyright and license information, please read the
* LICENSE.txt file that was distributed with this source code.
*
* (c) 2019 Dirk Wildt (Die Netzmacher) <http://wildt@die-netzmacher.de>, Die Netzmacher
* (c) 2019 - Dirk Wildt (Die Netzmacher) <http://wildt@die-netzmacher.de>, Die Netzmacher
*
* * */
......
......@@ -11,7 +11,7 @@ use Netzmacher\Tile\Utility\Module\SessionModuleUtility;
* For the full copyright and license information, please read the
* LICENSE.txt file that was distributed with this source code.
*
* (c) 2019 Dirk Wildt (Die Netzmacher) <http://wildt@die-netzmacher.de>, Die Netzmacher
* (c) 2019 - Dirk Wildt (Die Netzmacher) <http://wildt@die-netzmacher.de>, Die Netzmacher
*
* * */
......
......@@ -13,7 +13,7 @@ use Netzmacher\Tile\Utility\Module\SessionModuleUtility;
* For the full copyright and license information, please read the
* LICENSE.txt file that was distributed with this source code.
*
* (c) 2019 Dirk Wildt (Die Netzmacher) <http://wildt@die-netzmacher.de>, Die Netzmacher
* (c) 2019 - Dirk Wildt (Die Netzmacher) <http://wildt@die-netzmacher.de>, Die Netzmacher
*
* * */
......
......@@ -9,7 +9,7 @@ namespace Netzmacher\Tile\Domain\Model;
* For the full copyright and license information, please read the
* LICENSE.txt file that was distributed with this source code.
*
* (c) 2019 Dirk Wildt (Die Netzmacher) <http://wildt@die-netzmacher.de>, Die Netzmacher
* (c) 2019 - Dirk Wildt (Die Netzmacher) <http://wildt@die-netzmacher.de>, Die Netzmacher
*
* * */
......
......@@ -9,7 +9,7 @@ namespace Netzmacher\Tile\Domain\Model;
* For the full copyright and license information, please read the
* LICENSE.txt file that was distributed with this source code.
*
* (c) 2019 Dirk Wildt (Die Netzmacher) <http://wildt@die-netzmacher.de>, Die Netzmacher
* (c) 2019 - Dirk Wildt (Die Netzmacher) <http://wildt@die-netzmacher.de>, Die Netzmacher
*
* * */
......
......@@ -11,7 +11,7 @@ use Netzmacher\Tile\Utility\Module\SessionModuleUtility;
* For the full copyright and license information, please read the
* LICENSE.txt file that was distributed with this source code.
*
* (c) 2019 Dirk Wildt (Die Netzmacher) <http://wildt@die-netzmacher.de>, Die Netzmacher
* (c) 2019 - Dirk Wildt (Die Netzmacher) <http://wildt@die-netzmacher.de>, Die Netzmacher
*
* * */
......
<?php
namespace Netzmacher\Tile\Domain\Model;
/* * *
*
* This file is part of the "Book a tile!" Extension for TYPO3 CMS.
*
* For the full copyright and license information, please read the
* LICENSE.txt file that was distributed with this source code.
*
* (c) 2019 - Dirk Wildt (Die Netzmacher) <http://wildt@die-netzmacher.de>, Die Netzmacher
*
* * */
/**
* Page
*
* @internal #t3869
*/
class Content extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity
{
/**
* header
*
* @var string
* @validate NotEmpty
*/
protected $header = '';
/**
* pid
*
* @var integer
*/
protected $pid = '';
/**
* uid
*
* @var integer
*/
protected $uid = '';
/**
* Returns the header
*
* @return string $header
*/
public function getHeader()
{
return $this->header;
}
/**
* Sets the header
*
* @param string $header
* @return void
*/
public function setHeader( $header )
{
$this->header = $header;
}
/**
* Returns the pid
*
* @return string $pid
*/
public function getPid()
{
return $this->pid;
}
/**
* Sets the pid
*
* @param string $pid
* @return void
*/
public function setPid( $pid )
{
$this->pid = $pid;
}
/**
* Returns the uid
*
* @return string $uid
*/
public function getUid()
{
return $this->uid;
}
/**
* Sets the uid
*
* @param string $uid
* @return void
*/
public function setUid( $uid )
{
$this->uid = $uid;
}
}
......@@ -9,7 +9,7 @@ namespace Netzmacher\Tile\Domain\Model;
* For the full copyright and license information, please read the
* LICENSE.txt file that was distributed with this source code.
*
* (c) 2019 Dirk Wildt (Die Netzmacher) <http://wildt@die-netzmacher.de>, Die Netzmacher
* (c) 2019 - Dirk Wildt (Die Netzmacher) <http://wildt@die-netzmacher.de>, Die Netzmacher
*
* * */
......
......@@ -9,7 +9,7 @@ namespace Netzmacher\Tile\Domain\Model;
* For the full copyright and license information, please read the
* LICENSE.txt file that was distributed with this source code.
*
* (c) 2019 Dirk Wildt (Die Netzmacher) <http://wildt@die-netzmacher.de>, Die Netzmacher
* (c) 2019 - Dirk Wildt (Die Netzmacher) <http://wildt@die-netzmacher.de>, Die Netzmacher
*
* * */
......
......@@ -9,7 +9,7 @@ namespace Netzmacher\Tile\Domain\Model;
* For the full copyright and license information, please read the
* LICENSE.txt file that was distributed with this source code.
*
* (c) 2019 Dirk Wildt (Die Netzmacher) <http://wildt@die-netzmacher.de>, Die Netzmacher
* (c) 2019 - Dirk Wildt (Die Netzmacher) <http://wildt@die-netzmacher.de>, Die Netzmacher
*
* * */
......
......@@ -9,7 +9,7 @@ namespace Netzmacher\Tile\Domain\Model;
* For the full copyright and license information, please read the
* LICENSE.txt file that was distributed with this source code.
*
* (c) 2019 Dirk Wildt (Die Netzmacher) <http://wildt@die-netzmacher.de>, Die Netzmacher
* (c) 2019 - Dirk Wildt (Die Netzmacher) <http://wildt@die-netzmacher.de>, Die Netzmacher
*
* * */
......
......@@ -9,7 +9,7 @@ namespace Netzmacher\Tile\Domain\Model;
* For the full copyright and license information, please read the
* LICENSE.txt file that was distributed with this source code.
*
* (c) 2019 Dirk Wildt (Die Netzmacher) <http://wildt@die-netzmacher.de>, Die Netzmacher
* (c) 2019 - Dirk Wildt (Die Netzmacher) <http://wildt@die-netzmacher.de>, Die Netzmacher
*
* * */
......
......@@ -9,7 +9,7 @@ namespace Netzmacher\Tile\Domain\Repository;
* For the full copyright and license information, please read the
* LICENSE.txt file that was distributed with this source code.
*
* (c) 2019 Dirk Wildt (Die Netzmacher) <http://wildt@die-netzmacher.de>, Die Netzmacher
* (c) 2019 - Dirk Wildt (Die Netzmacher) <http://wildt@die-netzmacher.de>, Die Netzmacher
*
* * */
......
......@@ -9,7 +9,7 @@ namespace Netzmacher\Tile\Domain\Repository;
* For the full copyright and license information, please read the
* LICENSE.txt file that was distributed with this source code.
*
* (c) 2019 Dirk Wildt (Die Netzmacher) <http://wildt@die-netzmacher.de>, Die Netzmacher
* (c) 2019 - Dirk Wildt (Die Netzmacher) <http://wildt@die-netzmacher.de>, Die Netzmacher
*
***/
/**
......
......@@ -12,7 +12,7 @@ use TYPO3\CMS\Core\Database\ConnectionPool;
* For the full copyright and license information, please read the
* LICENSE.txt file that was distributed with this source code.
*
* (c) 2019 Dirk Wildt (Die Netzmacher) <http://wildt@die-netzmacher.de>, Die Netzmacher
* (c) 2019 - Dirk Wildt (Die Netzmacher) <http://wildt@die-netzmacher.de>, Die Netzmacher
*
* * */
......
<?php
namespace Netzmacher\Tile\Domain\Repository;
/* * *
*
* This file is part of the "Book a tile!" Extension for TYPO3 CMS.
*
* For the full copyright and license information, please read the
* LICENSE.txt file that was distributed with this source code.
*
* (c) 2019 - Dirk Wildt (Die Netzmacher) <http://wildt@die-netzmacher.de>, Die Netzmacher
*
* * */
/**
* The repository for Areas
*/
class ContentRepository extends \TYPO3\CMS\Extbase\Persistence\Repository
{
}
......@@ -9,7 +9,7 @@ namespace Netzmacher\Tile\Domain\Repository;
* For the full copyright and license information, please read the
* LICENSE.txt file that was distributed with this source code.
*
* (c) 2019 Dirk Wildt (Die Netzmacher) <http://wildt@die-netzmacher.de>, Die Netzmacher
* (c) 2019 - Dirk Wildt (Die Netzmacher) <http://wildt@die-netzmacher.de>, Die Netzmacher
*
* * */
......
......@@ -9,7 +9,7 @@ namespace Netzmacher\Tile\Domain\Repository;
* For the full copyright and license information, please read the
* LICENSE.txt file that was distributed with this source code.
*
* (c) 2019 Dirk Wildt (Die Netzmacher) <http://wildt@die-netzmacher.de>, Die Netzmacher
* (c) 2019 - Dirk Wildt (Die Netzmacher) <http://wildt@die-netzmacher.de>, Die Netzmacher
*
* * */
......
......@@ -11,7 +11,7 @@ namespace Netzmacher\Tile\Domain\Repository;
* For the full copyright and license information, please read the
* LICENSE.txt file that was distributed with this source code.
*
* (c) 2019 Dirk Wildt (Die Netzmacher) <http://wildt@die-netzmacher.de>, Die Netzmacher
* (c) 2019 - Dirk Wildt (Die Netzmacher) <http://wildt@die-netzmacher.de>, Die Netzmacher
*
* * */
......
......@@ -9,7 +9,7 @@ namespace Netzmacher\Tile\Domain\Repository;
* For the full copyright and license information, please read the
* LICENSE.txt file that was distributed with this source code.
*
* (c) 2019 Dirk Wildt (Die Netzmacher) <http://wildt@die-netzmacher.de>, Die Netzmacher
* (c) 2019 - Dirk Wildt (Die Netzmacher) <http://wildt@die-netzmacher.de>, Die Netzmacher
*
* * */
......
......@@ -9,7 +9,7 @@ namespace Netzmacher\Tile\Domain\Repository;
* For the full copyright and license information, please read the
* LICENSE.txt file that was distributed with this source code.
*
* (c) 2019 Dirk Wildt (Die Netzmacher) <http://wildt@die-netzmacher.de>, Die Netzmacher
* (c) 2019 - Dirk Wildt (Die Netzmacher) <http://wildt@die-netzmacher.de>, Die Netzmacher
*
***/
/**
......
......@@ -8,7 +8,7 @@ use TYPO3\CMS\Core\Database\ConnectionPool;
/* * *************************************************************
* Copyright notice
*
* (c) 2018-2019 - Dirk Wildt <http://wildt.at.die-netzmacher.de>
* (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
......@@ -34,12 +34,98 @@ use TYPO3\CMS\Core\Database\ConnectionPool;
* @package TYPO3
* @subpackage tile
* @author Dirk Wildt <http://wildt.at.die-netzmacher.de>
* @version 0.0.7
* @version 0.0.8
* @since 0.0.7
*/
class ItemsprocFlexform
{
/**
* 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->_promptCreateAreaCloneFirst( $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;
}
/**
* Caddy( ) :
*
* @return array item array for a flexform
* @access public
* @version 0.0.8
* @since 0.0.8
*/
public function Caddy( &$params )
{
$rows = $this->_getCaddies();
if( empty( $rows ) )
{
$params = $this->_promptCreateCaddyFirst( $params );
// var_dump( __METHOD__, __LINE__, $rows, $params );
// die();
return $params;
}
$params[ 'items' ][] = [ '', '', '' ];
foreach( ( array ) $rows as $row )
{
$params[ 'items' ][] = [
$row[ 'header' ] . ' (on page #' . $row[ 'pid' ] . ')'
, $row[ 'uid' ]
, 'EXT:caddy/ext_icon.svg'
];
}
// var_dump( __METHOD__, __LINE__, $rows, $params );
// die();
array_multisort( array_column( $params[ 'items' ], 0 ), SORT_ASC, $params[ 'items' ] );
return $params;
}
/**
* _getAreasCloned( ) :
*
......@@ -70,14 +156,43 @@ class ItemsprocFlexform
}
/**
* _promptCreateClone( ) :
* _getCaddies( ) :
*
* @return array item array for a flexform
* @return array rows
* @access public
* @version 0.0.7
* @since 0.0.7
*/
public function _promptCreateClone( &$params )
private function _getCaddies()
{
$queryBuilder = GeneralUtility::makeInstance( ConnectionPool::class )->getConnectionForTable( 'tt_content' )->createQueryBuilder();
$queryBuilder
->select( '*' )
->from( 'tt_content' )
->where(
$queryBuilder->expr()->eq( 'CType', $queryBuilder->createNamedParameter( 'list' ) )
, $queryBuilder->expr()->eq( 'list_type', $queryBuilder->createNamedParameter( 'caddy_pi1' ) )
)
;
$result = $queryBuilder->execute();
while( $row = $result->fetch() )
{
$rows[] = $row;
}
return $rows;
}
/**
* _promptCreateAreaCloneFirst( ) :
*
* @return array item array for a flexform
* @version 0.0.7
* @since 0.0.7
*/
private function _promptCreateAreaCloneFirst( &$params )
{
$params[ 'items' ][] = [
......@@ -90,47 +205,20 @@ class ItemsprocFlexform
}
/**
* AreasCloned( ) :
* _promptCreateCaddyFirst( ) :
*
* @return array item array for a flexform
* @access public
* @version 0.0.7
* @since 0.0.7
* @version 0.0.8
* @since 0.0.8
*/