Commit 8ddc4c93 authored by Dirk Wildt's avatar Dirk Wildt

0.0.6

parent c813be6f
......@@ -45,6 +45,96 @@ class AreaController extends AbstractController
return $newArea;
}
/**
* _getCells
*
* @param \Netzmacher\Tile\Domain\Model\Area $area
* @return void
* @version 0.0.6
* @since 0.0.6
*/
private function _getCells( \Netzmacher\Tile\Domain\Model\Area $area )
{
static $rows = null;
if( is_array( $rows ) )
{
//$this->addFlashMessage( __METHOD__ . ' (#' . __LINE__ . ')', '', \TYPO3\CMS\Core\Messaging\AbstractMessage::WARNING );
return $rows;
}
//$this->addFlashMessage( __METHOD__ . ' (#' . __LINE__ . ')', '', \TYPO3\CMS\Core\Messaging\AbstractMessage::WARNING );
$rows = $this->cellRepository->getCellsByArea( $area );
return $rows;
}
/**
* _sumGroup
*
* @param \Netzmacher\Tile\Domain\Model\Area $area
* @param string $relation
* @return void
* @version 0.0.6
* @since 0.0.6
*/
private function _sumGroup( \Netzmacher\Tile\Domain\Model\Area $area )
{
$groups = [];
$sum = 0;
$rows = $this->_getCells( $area );
foreach( $rows as $row )
{
if( !$row[ 'tx_tile_group' ] )
{
continue;
}
$group = $row[ 'tx_tile_group' ];
if( in_array( $row[ 'tx_tile_group' ], $groups ) )
{
continue;
}
$groups[] = $group;
$sum++;
}
return $sum;
}
/**
* _sumRelation
*
* @param \Netzmacher\Tile\Domain\Model\Area $area
* @param string $relation
* @return void
* @version 0.0.6
* @since 0.0.6
*/
private function _sumRelation( \Netzmacher\Tile\Domain\Model\Area $area, $relation )
{
$sum = 0;
$rows = $this->_getCells( $area );
foreach( $rows as $row )
{
if( $row[ $relation ] )
{
$sum++;
}
}
return $sum;
}
/**
* _sumTile
*
* @param \Netzmacher\Tile\Domain\Model\Area $area
* @return int
* @version 0.0.6
* @since 0.0.6
*/
private function _sumTile( \Netzmacher\Tile\Domain\Model\Area $area ): int
{
return ( int ) count( $this->_getCells( $area ) );
}
/**
* action create
*
......@@ -71,11 +161,6 @@ class AreaController extends AbstractController
*/
public function createconfirmAction( \Netzmacher\Tile\Domain\Model\Area $newArea )
{
// $area = [
// 'title' => $newArea->getTitle()
// , 'lenx' => $newArea->getLenx()
// , 'leny' => $newArea->getLeny()
// ];
$this->view->assign( 'newArea', $newArea );
}
......@@ -152,6 +237,10 @@ class AreaController extends AbstractController
*/
public function showAction( \Netzmacher\Tile\Domain\Model\Area $area )
{
$this->view->assign( 'sumCategory', $this->_sumRelation( $area, 'tx_tile_category' ) );
$this->view->assign( 'sumGroup', $this->_sumGroup( $area ) );
$this->view->assign( 'sumTicket', $this->_sumRelation( $area, 'tx_tile_ticket' ) );
$this->view->assign( 'sumTile', $this->_sumTile( $area ) );
$this->view->assign( 'area', $area );
}
......@@ -169,4 +258,5 @@ class AreaController extends AbstractController
$this->areaRepository->update( $area );
$this->redirect( 'list', 'Module' );
}
}
......@@ -22,9 +22,23 @@ use TYPO3\CMS\Core\Database\ConnectionPool;
class CellRepository extends \TYPO3\CMS\Extbase\Persistence\Repository
{
/**
* @param \Netzmacher\Tile\Domain\Model\Area $area
* @return int
* @version 0.0.6
* @since 0.0.6
* @internal #t3835
*/
public function countCellsByArea( \Netzmacher\Tile\Domain\Model\Area $area ): int
{
$rows = $this->getCellsByArea( $area );
$sum = count($rows);
return $sum;
}
/**
* @param \Netzmacher\Tile\Domain\Model\Group $group
* @param array
* @return array
* @version 0.0.6
* @since 0.0.5
......@@ -52,6 +66,35 @@ class CellRepository extends \TYPO3\CMS\Extbase\Persistence\Repository
return $rows;
}
/**
* @param \Netzmacher\Tile\Domain\Model\Area $area
* @return array
* @version 0.0.6
* @since 0.0.6
* @internal #t3835
*/
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( '*' )
->from( 'tx_tile_domain_model_cell' )
->where(
$queryBuilder->expr()->eq( 'tx_tile_area', $queryBuilder->createNamedParameter( $area->getUid() ) )
)
;
$result = $queryBuilder->execute();
while( $row = $result->fetch() )
{
$rows[] = $row;
}
return $rows;
}
/**
* @param \Netzmacher\Tile\Domain\Model\Cell $cell
* @param array
......
......@@ -10,41 +10,57 @@
</tr>
<tr>
<td>
<f:translate key="tx_tile_domain_model_area.title" />
<f:translate key="tx_tile_domain_model_area.lenx" />
</td>
<td>
{area.title}
<td class="right">
{area.lenx}
</td>
</tr>
<tr>
<td>
<f:translate key="tx_tile_domain_model_area.type" />
<f:translate key="tx_tile_domain_model_area.leny" />
</td>
<td>
{area.type}
<td class="right">
{area.leny}
</td>
</tr>
<tr>
<td>
<f:translate key="tx_tile_domain_model_area.lenx" />
Kacheln
</td>
<td class="right">
{sumTile}
</td>
</tr>
<tr>
<td>
{area.lenx}
– mit Objekten
</td>
<td class="right">
{sumCategory}
</td>
</tr>
<tr>
<td>
<f:translate key="tx_tile_domain_model_area.leny" />
– mit Tickets
</td>
<td class="right">
{sumTicket}
</td>
</tr>
<tr>
<td>
{area.leny}
– Gruppen mit Tickets
</td>
<td class="right">
{sumGroup}
</td>
</tr>
<tr>
<td>
<i>uid</i>
</td>
<td>
<td class="right">
<i>{area.uid}</i>
</td>
</tr>
......@@ -52,7 +68,7 @@
<td>
<i>pid</i>
</td>
<td>
<td class="right">
<i>{area.pid}</i>
</td>
</tr>
......
......@@ -4,8 +4,11 @@
<h1><f:translate key="tx_tile_domain_model_area.title" />: {area.title}</h1>
<f:flashMessages />
<f:render partial="Area/Properties" arguments="{area:area}" />
<f:link.action action="list" controller="Module" class="btn btn-default">Zurück</f:link.action>
<f:link.action action="edit" arguments="{area : area}" class="btn btn-default">Bearbeiten</f:link.action>
<f:render partial="Area/Properties" arguments="{_all}" />
<div class="buttons">
<f:link.action action="list" controller="Module" class="btn btn-default">Zurück</f:link.action>
<f:link.action action="edit" arguments="{area : area}" class="btn btn-default disabled">Bearbeiten</f:link.action>
</div>
</f:section>
</html>
\ No newline at end of file
......@@ -57,6 +57,10 @@ table td .btn {
margin:0.2rem 0;
}
table td.right {
text-align: right;
}
/*table .button {
border:1px solid #FFF;
display:block;
......
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