Commit 1b22cde9 authored by Dirk Wildt's avatar Dirk Wildt

0.0.6

parent 7cfc9d7a
0.0.6
19-06-24
Feature
* #t3815: New field tx_tile_domain_model_cell.ticket
Affectd files:
* ext_tables.sql
* Classes
* Domain/Model/Cell.php
* ViewHelpers/Get/CssFieldViewHelper.php
* Configuration/TCA/tx_tile_domain_model_cell.php
* Resources
* Private
* Language
* de.locallang_db.xlf
* locallang_db.xlf
* Templates/Cell
* CreateCategory.html
* CreateTicket.html
* #t3815: New field tx_tile_domain_model_cell.groupcss
Affected files:
* ext_tables.sql
* Classes
* Domain/Model/Cell.php
* ViewHelpers/Get/CssFieldViewHelper.php
* Configuration/TCA/tx_tile_domain_model_cell.php
* Resources
* Private
* Language
* de.locallang_db.xlf
* locallang_db.xlf
* Templates/Cell
* CreateCategory.html
* CreateTicket.html
* Public/Css/Module/Styles.css
* #t3812: New table ticket: GUI
New files:
* /opt/typo3/extensions/tile/Classes/ViewHelpers/Get/TicketFieldViewHelper.php
* /opt/typo3/extensions/tile/Resources/Private/Templates/Cell/CreateTicket.html
* Classes/ViewHelpers/Get/TicketFieldViewHelper.php
* Resources/Private/Templates/Cell/CreateTicket.html
Affected files:
* /opt/typo3/extensions/tile/Classes/Controller/CellController.php
* /opt/typo3/extensions/tile/Classes/Utility/Module/SessionModuleUtility.php
* /opt/typo3/extensions/tile/Classes/Controller/AbstractController.php
* Classes
* Controller
* AbstractController.php
* CellController.php
* Utility/Module/SessionModuleUtility.php
* #t3811: New table ticket
New files:
* Classes
......
......@@ -199,13 +199,13 @@ class CellController extends AbstractController
* @param \Netzmacher\Tile\Domain\Model\Cell $cell
*
* @return void
* @version 0.0.5
* @version 0.0.6
* @since 0.0.5
* @internal #t3749
*/
private function _setCategoryForCellRange( \Netzmacher\Tile\Domain\Model\Cell $cell )
{
if( !$this->_setCategoryForCellRangeRequirements( $cell ) )
if( !$this->_setCategoryForCellRangeRequirements() )
{
return;
}
......@@ -246,14 +246,80 @@ class CellController extends AbstractController
/**
* _setCategoryForCellRangeRequirements()
*
* @param \Netzmacher\Tile\Domain\Model\Cell $cell
*
* @return boolean
* @version 0.0.5
* @version 0.0.6
* @since 0.0.5
* @internal #t3749
*/
private function _setCategoryForCellRangeRequirements( \Netzmacher\Tile\Domain\Model\Cell $cell )
private function _setCategoryForCellRangeRequirements()
{
$mode = SessionModuleUtility::getFormCellMode();
switch( $mode )
{
case('cell'):
return false;
case('group'):
return true;
default:
$prompt = 'Warning @ ' . __METHOD__ . ' (#' . __LINE__ . ')! Undefined value in switch: "' . $mode . '"';
$this->addFlashMessage( $prompt, '', \TYPO3\CMS\Core\Messaging\AbstractMessage::WARNING );
return false;
}
}
/**
* _setTicketForCellRange()
*
* @param \Netzmacher\Tile\Domain\Model\Cell $cell
*
* @return void
* @version 0.0.6
* @since 0.0.6
* @internal #t3816
*/
private function _setTicketForCellRange( \Netzmacher\Tile\Domain\Model\Cell $cell )
{
if( !$this->_setTicketForCellRangeRequirements() )
{
return;
}
$formerCellUid = SessionModuleUtility::getValue( 'formerCellUid' );
// return, there is no former cell
if( empty( $formerCellUid ) )
{
// $prompt = 'No former cell @ ' . __METHOD__ . ' (#' . __LINE__ . ')';
// $this->addFlashMessage( $prompt, '', \TYPO3\CMS\Core\Messaging\AbstractMessage::INFO );
SessionModuleUtility::setValue( 'formerCellUid', $cell->getUid() );
return;
}
$formerCell = $this->cellRepository->findByUid( $formerCellUid );
SessionModuleUtility::removeValue( 'formerCellUid' );
$xyRange = $this->_getXsYsOrdered( $formerCell, $cell );
$cellUids = $this->cellRepository->getCellsByXyRange( $xyRange );
foreach( $cellUids as $cellUid )
{
$cell = $this->cellRepository->findByUid( $cellUid );
$cell->setTxTileTicket( SessionModuleUtility::getFormCellTicket() );
$this->cellRepository->update( $cell );
}
return;
}
/**
* _setTicketForCellRangeRequirements()
*
* @return boolean
* @version 0.0.6
* @since 0.0.6
* @internal #t3816
*/
private function _setTicketForCellRangeRequirements()
{
$mode = SessionModuleUtility::getFormCellMode();
switch( $mode )
......@@ -314,6 +380,13 @@ class CellController extends AbstractController
{
$currentModeLabel = 'Kachel';
}
$formCellWiBgimageChecked = SessionModuleUtility::getFormCellWoBgimage();
$formCellWiCategoriesChecked = SessionModuleUtility::getFormCellWoCategories();
$formCellWiGroupsChecked = SessionModuleUtility::getFormCellWoGroups();
$formCellWiTicketsChecked = SessionModuleUtility::getFormCellWoTickets();
$formCellWiUndefinedCellsChecked = SessionModuleUtility::getFormCellWoUndefinedCells();
$this->view->assign( 'area', $area );
$this->view->assign( 'categoryTitle', $categoryTitle );
$this->view->assign( 'cells', $this->_getAreaCells( $area ) );
......@@ -322,6 +395,11 @@ class CellController extends AbstractController
$this->view->assign( 'formCellCategorySelected', $formCellCategorySelected );
$this->view->assign( 'formCellModeOptions', $formCellModeOptions );
$this->view->assign( 'formCellModeSelected', $formCellModeSelected );
$this->view->assign( 'formCellWiBgimageChecked', $formCellWiBgimageChecked );
$this->view->assign( 'formCellWiCategoriesChecked', $formCellWiCategoriesChecked );
$this->view->assign( 'formCellWiGroupsChecked', $formCellWiGroupsChecked );
$this->view->assign( 'formCellWiTicketsChecked', $formCellWiTicketsChecked );
$this->view->assign( 'formCellWiUndefinedCellsChecked', $formCellWiUndefinedCellsChecked );
$this->view->assign( 'grid-template-columns', $this->_getAutoElementsForGridCSS( $area ) );
$this->view->assign( 'size', '15' );
}
......@@ -342,8 +420,6 @@ class CellController extends AbstractController
{
$ticketTitle = 'Zurücksetzen';
}
$formCellTicketOptions = [ 0 => 'Zurücksetzen' ] + ( array ) $this->_getTickets();
$formCellTicketSelected = SessionModuleUtility::getFormCellTicket();
$formCellModeSelected = SessionModuleUtility::getFormCellMode();
if( empty( $formCellModeSelected ) )
{
......@@ -358,14 +434,28 @@ class CellController extends AbstractController
{
$currentModeLabel = 'Kachel';
}
$formCellTicketOptions = [ 0 => 'Zurücksetzen' ] + ( array ) $this->_getTickets();
$formCellTicketSelected = SessionModuleUtility::getFormCellTicket();
$formCellWiBgimageChecked = SessionModuleUtility::getFormCellWoBgimage();
$formCellWiCategoriesChecked = SessionModuleUtility::getFormCellWoCategories();
$formCellWiGroupsChecked = SessionModuleUtility::getFormCellWoGroups();
$formCellWiTicketsChecked = SessionModuleUtility::getFormCellWoTickets();
$formCellWiUndefinedCellsChecked = SessionModuleUtility::getFormCellWoUndefinedCells();
$this->view->assign( 'area', $area );
$this->view->assign( 'ticketTitle', $ticketTitle );
$this->view->assign( 'cells', $this->_getAreaCells( $area ) );
$this->view->assign( 'currentModeLabel', $currentModeLabel );
$this->view->assign( 'formCellTicketOptions', $formCellTicketOptions );
$this->view->assign( 'formCellTicketSelected', $formCellTicketSelected );
$this->view->assign( 'formCellModeOptions', $formCellModeOptions );
$this->view->assign( 'formCellModeSelected', $formCellModeSelected );
$this->view->assign( 'formCellTicketOptions', $formCellTicketOptions );
$this->view->assign( 'formCellTicketSelected', $formCellTicketSelected );
$this->view->assign( 'formCellWiBgimageChecked', $formCellWiBgimageChecked );
$this->view->assign( 'formCellWiCategoriesChecked', $formCellWiCategoriesChecked );
$this->view->assign( 'formCellWiGroupsChecked', $formCellWiGroupsChecked );
$this->view->assign( 'formCellWiTicketsChecked', $formCellWiTicketsChecked );
$this->view->assign( 'formCellWiUndefinedCellsChecked', $formCellWiUndefinedCellsChecked );
$this->view->assign( 'grid-template-columns', $this->_getAutoElementsForGridCSS( $area ) );
$this->view->assign( 'size', '15' );
}
......
......@@ -54,12 +54,11 @@ class Category extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity
protected $colorselled = '';
/**
* txTileGroup
* txTileCss
*
* @var \TYPO3\CMS\Extbase\Persistence\ObjectStorage<\Netzmacher\Tile\Domain\Model\Group>
* @lazy
* @var \Netzmacher\Tile\Domain\Model\Css
*/
protected $txTileGroup = null;
protected $txTileCss = null;
/**
* Returns the title
......@@ -146,66 +145,24 @@ class Category extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity
}
/**
* __construct
*/
public function __construct()
{
//Do not remove the next line: It would break the functionality
$this->initStorageObjects();
}
/**
* Initializes all ObjectStorage properties
*
* @return void
*/
protected function initStorageObjects()
{
$this->txTileGroup = new \TYPO3\CMS\Extbase\Persistence\ObjectStorage();
}
/**
* Adds a Group
*
* @param \Netzmacher\Tile\Domain\Model\Group $txTileGroup
* @return void
*/
public function addTxTileGroup( \Netzmacher\Tile\Domain\Model\Group $txTileGroup )
{
$this->txTileGroup->attach( $txTileGroup );
}
/**
* Removes a Group
*
* @param \Netzmacher\Tile\Domain\Model\Group $txTileGroupToRemove The Group to be removed
* @return void
*/
public function removeTxTileGroup( \Netzmacher\Tile\Domain\Model\Group $txTileGroupToRemove )
{
$this->txTileGroup->detach( $txTileGroupToRemove );
}
/**
* Returns the txTileGroup
* Returns the txTileCss
*
* @return \TYPO3\CMS\Extbase\Persistence\ObjectStorage<\Netzmacher\Tile\Domain\Model\Group> $txTileGroup
* @return \Netzmacher\Tile\Domain\Model\Css $txTileCss
*/
public function getTxTileGroup()
public function getTxTileCss()
{
return $this->txTileGroup;
return $this->txTileCss;
}
/**
* Sets the txTileGroup
* Sets the txTileCss
*
* @param \TYPO3\CMS\Extbase\Persistence\ObjectStorage<\Netzmacher\Tile\Domain\Model\Group> $txTileGroup
* @param \Netzmacher\Tile\Domain\Model\Css $txTileCss
* @return void
*/
public function setTxTileGroup( \TYPO3\CMS\Extbase\Persistence\ObjectStorage $txTileGroup )
public function setTxTileCss( \Netzmacher\Tile\Domain\Model\Css $txTileCss )
{
$this->txTileGroup = $txTileGroup;
$this->txTileCss = $txTileCss;
}
}
}
\ No newline at end of file
......@@ -21,6 +21,13 @@ class Cell extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity
const TABLE_NAME = 'tx_tile_domain_model_cell';
/**
* groupcss
*
* @var string
*/
protected $groupcss = '';
/**
* title
*
......@@ -29,6 +36,34 @@ class Cell extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity
*/
protected $title = '';
/**
* txTileArea
*
* @var \Netzmacher\Tile\Domain\Model\Area
*/
protected $txTileArea = null;
/**
* txTileCategory
*
* @var int
*/
protected $txTileCategory = null;
/**
* txTileGroup
*
* @var \Netzmacher\Tile\Domain\Model\Group
*/
protected $txTileGroup = null;
/**
* txTileTicket
*
* @var int
*/
protected $txTileTicket = null;
/**
* x
*
......@@ -46,25 +81,25 @@ class Cell extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity
protected $y = 0;
/**
* txTileArea
*
* @var \Netzmacher\Tile\Domain\Model\Area
*/
protected $txTileArea = null;
/**
* txTileCategory
* Returns the groupcss
*
* @var int
* @return string $groupcss
*/
protected $txTileCategory = null;
public function getGroupcss()
{
return $this->groupcss;
}
/**
* txTileGroup
* Sets the groupcss
*
* @var \Netzmacher\Tile\Domain\Model\Group
* @param string $groupcss
* @return void
*/
protected $txTileGroup = null;
public function setGroupcss( $groupcss )
{
$this->groupcss = $groupcss;
}
/**
* Returns the title
......@@ -192,4 +227,25 @@ class Cell extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity
$this->txTileGroup = $txTileGroup;
}
/**
* Returns the txTileTicket
*
* @return int
*/
public function getTxTileTicket()
{
return $this->txTileTicket;
}
/**
* Sets the txTileTicket
*
* @param int
* @return int
*/
public function setTxTileTicket( $ticket )
{
$this->txTileTicket = $ticket;
}
}
......@@ -14,7 +14,7 @@ namespace Netzmacher\Tile\Domain\Model;
* * */
/**
* Group
* Ticket
*/
class Ticket extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity
{
......@@ -30,31 +30,31 @@ class Ticket extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity
protected $title = '';
/**
* txTileGroup
* txTileCss
*
* @var \Netzmacher\Tile\Domain\Model\Group
* @var \Netzmacher\Tile\Domain\Model\Css
*/
protected $txTileGroup = null;
protected $txTileCss = null;
/**
* __construct
*/
public function __construct()
{
//Do not remove the next line: It would break the functionality
$this->initStorageObjects();
}
/**
* Initializes all ObjectStorage properties
*
* @return void
*/
protected function initStorageObjects()
{
$this->txTileGroup = new \TYPO3\CMS\Extbase\Persistence\ObjectStorage();
}
// /**
// * __construct
// */
// public function __construct()
// {
//
// //Do not remove the next line: It would break the functionality
// $this->initStorageObjects();
// }
//
// /**
// * Initializes all ObjectStorage properties
// *
// * @return void
// */
// protected function initStorageObjects()
// {
// $this->txTileGroup = new \TYPO3\CMS\Extbase\Persistence\ObjectStorage();
// }
/**
* Returns the title
......@@ -78,24 +78,24 @@ class Ticket extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity
}
/**
* Returns the txTileGroup
* Returns the txTileCss
*
* @return \Netzmacher\Tile\Domain\Model\Group $txTileGroup
* @return \Netzmacher\Tile\Domain\Model\Css $txTileCss
*/
public function getTxTileGroup()
public function getTxTileCss()
{
return $this->txTileGroup;
return $this->txTileCss;
}
/**
* Sets the txTileGroup
* Sets the txTileCss
*
* @param \Netzmacher\Tile\Domain\Model\Group $txTileGroup
* @param \Netzmacher\Tile\Domain\Model\Css $txTileCss
* @return void
*/
public function setTxTileGroup( \Netzmacher\Tile\Domain\Model\Group $txTileGroup )
public function setTxTileCss( \Netzmacher\Tile\Domain\Model\Css $txTileCss )
{
$this->txTileGroup = $txTileGroup;
$this->txTileCss = $txTileCss;
}
}
......@@ -92,6 +92,19 @@ class SessionModuleUtility
return $value;
}
/**
* getFormCellMode: get moede from the session data
*
* @return string
* @version 0.0.5
* @since 0.0.5
*/
static public function getFormCellMode()
{
$value = self::_getSessionElement( 'formCellMode' );
return $value;
}
/**
* getFormCellTicket: get tx_tile_ticket from the session data
*
......@@ -107,15 +120,72 @@ class SessionModuleUtility
}
/**
* getFormCellMode: get moede from the session data
* getFormCellWoBgimage
*
* @return string
* @version 0.0.5
* @since 0.0.5
* @version 0.0.6
* @since 0.0.6
* @internal t3812
*/
static public function getFormCellMode()
static public function getFormCellWoBgimage()
{
$value = self::_getSessionElement( 'formCellMode' );
$value = self::_getSessionElement( 'formCellWiBgimage' );
return $value;
}
/**
* getFormCellWoCategories
*
* @return string
* @version 0.0.6
* @since 0.0.6
* @internal t3812
*/
static public function getFormCellWoCategories()
{
$value = self::_getSessionElement( 'formCellWiCategories' );
return $value;
}
/**
* getFormCellWoGroups
*
* @return string
* @version 0.0.6
* @since 0.0.6
* @internal t3812
*/
static public function getFormCellWoGroups()
{
$value = self::_getSessionElement( 'formCellWiGroups' );
return $value;
}
/**
* getFormCellWoTickets
*
* @return string
* @version 0.0.6
* @since 0.0.6
* @internal t3812
*/
static public function getFormCellWoTickets()
{
$value = self::_getSessionElement( 'formCellWiTickets' );
return $value;
}
/**
* getFormCellWoUndefinedCells
*
* @return string
* @version 0.0.6
* @since 0.0.6
* @internal t3812
*/
static public function getFormCellWoUndefinedCells()
{
$value = self::_getSessionElement( 'formCellWiUndefinedCells' );
return $value;
}
......
<?php
//declare(strict_types=1);
namespace Netzmacher\Tile\ViewHelpers\Get;
use Netzmacher\Tile\Domain\Repository\CategoryRepository;
use Netzmacher\Tile\Domain\Repository\CellRepository;
use Netzmacher\Tile\Domain\Repository\CssRepository;
use Netzmacher\Tile\Domain\Repository\TicketRepository;
use Netzmacher\Tile\Utility\ObjectUtility;
use TYPO3Fluid\Fluid\Core\ViewHelper\AbstractViewHelper;
/**
* Class CssClassViewHelper
*
* @version 0.0.6
* @since 0.0.6
* @internal #t3816
*/
class CssClassViewHelper extends AbstractViewHelper
{
/**
* @return mixed
*/
private function _getCategoryCss()
{
$default = $this->arguments[ 'default' ];
$uid = $this->arguments[ 'uidCategory' ];
if( empty( $uid ) )
{
return $default;
}
$categoryRepository = ObjectUtility::getObjectManager()->get( CategoryRepository::class );
$category = $categoryRepository->findByUid( $uid );
if( empty( $category ) )
{
return $default;
}
$categoryCss = $category->getTxTileCss();
$categoryCssUid = $categoryCss->getUid();
$cssRepository = ObjectUtility::getObjectManager()->get( CssRepository::class );
$css = $cssRepository->findByUid( $categoryCssUid );
return $css->getClass();
}
/**
* @return mixed
*/
private function _getGroupCss()
{
$default = $this->arguments[ 'default' ];
$class = $this->arguments[ 'class' ];
$uidCell = $this->arguments[ 'uidCell' ];
switch( true )
{
case( empty( $uidCell ) ):
case( empty( $class ) ):
return $default;
default :
// follow the workflow
break;
}
$cssCell = ObjectUtility::getObjectManager()->get( CellRepository::class );
$cell = $cssCell->findByUid( $uidCell );
if( empty( $cell ) )
{
return '';
}
return $cell->getGroupcss();
}
/**
* @param int $uid
* @return mixed
*/
private function _getTicketCss()
{
$default = $this->arguments[ 'default' ];
$class = $this->arguments[ 'class' ];
$uid = $this->arguments[ 'uidTicket' ];
switch( true )
{
case( empty( $uid ) ):
case( empty( $class ) ):
return $default;