Commit 77c2d844 authored by Dirk Wildt's avatar Dirk Wildt

0.0.6

parent 7d994b0a
......@@ -76,7 +76,7 @@ class ShopController extends AbstractController
* @since 0.0.6
* @internal #t3843
*/
public function _checkPid( $pid )
private function _checkPid( $pid )
{
$checkPid = true;
......@@ -103,7 +103,7 @@ class ShopController extends AbstractController
}
/**
* action createAction
* _cloneArea
*
* @param \Netzmacher\Tile\Domain\Model\Area $area
* @param int $pid
......@@ -112,7 +112,7 @@ class ShopController extends AbstractController
* @since 0.0.6
* @internal #t3843
*/
public function _cloneArea( \Netzmacher\Tile\Domain\Model\Area $area, $pid ): int
private function _cloneArea( \Netzmacher\Tile\Domain\Model\Area $area, $pid ): int
{
$clone = new \Netzmacher\Tile\Domain\Model\Area;
......@@ -136,6 +136,45 @@ class ShopController extends AbstractController
return $uid;
}
/**
* _cloneCells
*
* @param \Netzmacher\Tile\Domain\Model\Area $area
* @param int $pid
* @param int $cloneAreaUid
* @return int
* @version 0.0.6
* @since 0.0.6
* @internal #t3845
*/
private function _cloneCells( $area, $pid, $cloneAreaUid )
{
$rows = $this->cellRepository->getCellsByArea( $area );
foreach( $rows as $properties )
{
$clone = new \Netzmacher\Tile\Domain\Model\Cell;
unset( $properties[ 'uid' ] );
unset( $properties[ 'tx_tile_area' ] ); // neu machen!!!
unset( $properties[ 'tx_tile_group' ] ); // neu machen!!!
unset( $properties[ 'tx_tile_ticket' ] ); // neu machen!!!
$properties[ 'pid' ] = $pid;
$properties[ 'tx_tile_area' ] = $this->areaRepository->findByUid( $cloneAreaUid );
foreach( $properties as $key => $value )
{
$clone->_setProperty( $key, $value );
}
$clone->setTxTileArea( $this->areaRepository->findByUid( $cloneAreaUid ) );
$this->cellRepository->add( $clone );
$this->addFlashMessage( __METHOD__ . ' (#' . __LINE__ . '): Cell with area uid: ' . $cloneAreaUid, '', \TYPO3\CMS\Core\Messaging\AbstractMessage::WARNING );
// $this->persistenceManager->persistAll();
// $uid = $clone->getUid();
}
return $uid;
}
/**
* _getCells
*
......@@ -231,12 +270,10 @@ class ShopController extends AbstractController
$this->redirect( 'createconfirm', 'Shop', null, array( 'area' => $area ) );
// $this->redirect( 'list', 'Module' );
}
$cloneAreaUid = $this->_cloneArea( $area, $pid );
$cloneCells = $this->_cloneCells( $area, $pid, $cloneAreaUid );
// // Check Destination Pid: Must exist
// $header = ':TODO: Developer';
// $prompt = 'Plan kopieren, Quick Shop Products generieren.';
// $this->addFlashMessage( $prompt, $header, \TYPO3\CMS\Core\Messaging\AbstractMessage::NOTICE );
$this->redirect( 'list', 'Module' );
}
......
......@@ -15,6 +15,8 @@ namespace Netzmacher\Tile\Domain\Model;
/**
* Page
*
* @internal #t3823, t3843
*/
class Page extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity
{
......
......@@ -32,27 +32,27 @@ class CellRepository extends \TYPO3\CMS\Extbase\Persistence\Repository
public function countCellsByArea( \Netzmacher\Tile\Domain\Model\Area $area ): int
{
$rows = $this->getCellsByArea( $area );
$sum = count($rows);
$sum = count( $rows );
return $sum;
}
/**
* @param \Netzmacher\Tile\Domain\Model\Group $group
* @param \Netzmacher\Tile\Domain\Model\Area $area
* @return array
* @version 0.0.6
* @since 0.0.5
* @internal #t3749
* @since 0.0.6
* @internal #t3835
*/
public function getCellsByGroup( \Netzmacher\Tile\Domain\Model\Group $group ): array
public function getCellsByArea( \Netzmacher\Tile\Domain\Model\Area $area ): array
{
$rows = [];
$queryBuilder = GeneralUtility::makeInstance( ConnectionPool::class )->getConnectionForTable( 'tx_tile_domain_model_cell' )->createQueryBuilder();
$queryBuilder
->select( 'uid' )
->select( '*' )
->from( 'tx_tile_domain_model_cell' )
->where(
$queryBuilder->expr()->eq( 'tx_tile_group', $queryBuilder->createNamedParameter( $group->getUid() ) )
$queryBuilder->expr()->eq( 'tx_tile_area', $queryBuilder->createNamedParameter( $area->getUid() ) )
)
;
......@@ -60,28 +60,28 @@ class CellRepository extends \TYPO3\CMS\Extbase\Persistence\Repository
while( $row = $result->fetch() )
{
$rows[] = $row[ 'uid' ];
$rows[] = $row;
}
return $rows;
}
/**
* @param \Netzmacher\Tile\Domain\Model\Area $area
* @param \Netzmacher\Tile\Domain\Model\Group $group
* @return array
* @version 0.0.6
* @since 0.0.6
* @internal #t3835
* @since 0.0.5
* @internal #t3749
*/
public function getCellsByArea( \Netzmacher\Tile\Domain\Model\Area $area ): array
public function getCellsByGroup( \Netzmacher\Tile\Domain\Model\Group $group ): array
{
$rows = [];
$queryBuilder = GeneralUtility::makeInstance( ConnectionPool::class )->getConnectionForTable( 'tx_tile_domain_model_cell' )->createQueryBuilder();
$queryBuilder
->select( '*' )
->select( 'uid' )
->from( 'tx_tile_domain_model_cell' )
->where(
$queryBuilder->expr()->eq( 'tx_tile_area', $queryBuilder->createNamedParameter( $area->getUid() ) )
$queryBuilder->expr()->eq( 'tx_tile_group', $queryBuilder->createNamedParameter( $group->getUid() ) )
)
;
......@@ -89,7 +89,7 @@ class CellRepository extends \TYPO3\CMS\Extbase\Persistence\Repository
while( $row = $result->fetch() )
{
$rows[] = $row;
$rows[] = $row[ 'uid' ];
}
return $rows;
......
......@@ -16,7 +16,9 @@ namespace Netzmacher\Tile\Domain\Repository;
* * */
/**
* The repository for Areas
* The repository for Pages
*
* @internal #t3823, t3843
*/
class PageRepository extends \TYPO3\CMS\Extbase\Persistence\Repository
{
......
......@@ -4,6 +4,9 @@
<f:if condition="{area}">
<f:then>
<h1>Go live!</h1>
<p>
Mache aus Deinem Plan eine Veranstaltung mit Tickets für Online-Reservierung oder Verkauf.
</p>
<h2>
Plan "{area.title}" mit <f:format.number decimals="0" thousandsSeparator=".">
<f:cObject typoscriptObjectPath="lib.tile.math" data="{area.lenx}*{area.leny}"/>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment