Commit 7314b090 authored by Dirk Wildt's avatar Dirk Wildt

0.0.8

parent 35929000
<?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();
}
}
{namespace vh=Netzmacher\Tile\ViewHelpers}
<html xmlns:f="http://typo3.org/ns/TYPO3/CMS/Fluid/ViewHelpers" data-namespace-typo3-fluid="true">
<f:layout name="Default" />
<f:section name="content">
<f:flashMessages />
<f:variable name="cssForCategory"></f:variable>
<f:if condition="{formCellWiCategoriesChecked}">
<f:variable name="cssForCategory">cssClassForCategory</f:variable>
</f:if>
<f:variable name="cssForGroup"></f:variable>
<f:if condition="{formCellWiGroupsChecked}">
<f:variable name="cssForGroup">cssClassForGroup</f:variable>
</f:if>
<f:variable name="cssForTicket"></f:variable>
<f:if condition="{formCellWiTicketsChecked}">
<f:variable name="cssForTicket">cssClassForTicket</f:variable>
</f:if>
<f:variable name="cssClassUndefinedCell"></f:variable>
<f:if condition="{formCellWiUndefinedCellsChecked}">
<f:variable name="cssClassUndefinedCell">undefined</f:variable>
</f:if>
<f:if condition="{formCellWiBgimageChecked}==1">
<style>
.grid-container {
background-image: url("/{area.image.originalResource.publicUrl}");
background-position: center;
background-repeat: no-repeat;
background-size: cover;
}
</style>
</f:if>
<style>
.grid-container {
position: relative;
display: inline-grid;
grid-template-columns: {grid-template-columns};
grid-gap: 2px;
background-color: #FF5E00;
background-color: #FDFDFD;
padding: 0.4rem;
}
.grid-container > div {
/*background-color: rgba(255, 255, 255, 1);*/
text-align: center;
font-size: {size}px;
width: {size}px;
height: {size}px;
overflow: hidden;
}
.grid-container div.undefined {
background-color: rgba(0, 0, 0, 0.1);
}
.grid-container div.disabled {
background-color: rgba(255, 255, 255, 0.2);
}
<f:format.raw><vh:Get.CssClasses prefix=".grid-container div" /></f:format.raw>
.grid-container div a {
display: block;
}
</style>
<h1><f:translate key="tx_tile_domain_model_area.title" />: {area.title} ({area.lenx}x{area.leny})</h1>
<h2>Objekt zuweisen: {categoryTitle}, Modus: {currentModeLabel}</h2>
<div class="grid-container">
<f:for each="{cells}" as="cell">
<div class="{vh:Get.CssClass(uidGroup: cell.txTileTicket, uidCell: cell.uid, class: '{cssForGroup}', default: '')}">
<div class="{vh:Get.CssClass(uidTicket: cell.txTileTicket, uidCell: cell.uid, class: '{cssForTicket}', default: '')}">
<div class="{vh:Get.CssClass(uidCategory: cell.txTileCategory, uidCell: cell.uid, class: '{cssForCategory}', default: '{cssClassUndefinedCell}')}">
<f:if condition="{area.type}=1">
<f:then>
<a href="#" title="[Ein Live-Objekt kann nicht verändert werden!] {vh:Get.GroupField(uid: cell.txTileGroup.uid, field: 'title', default: '', prefix: '')}{vh:Get.TicketField(uid: cell.txTileTicket, field: 'title', default: '', prefix: ', ')}{vh:Get.TicketField(uid: cell.txTileTicket, field: 'price', currency: 'EUR', default: '', locale: 'de_DE', prefix: '')}">&nbsp;</a>
</f:then>
<f:else>
<f:link.action action="updatecell" controller="Category" arguments="{cell : cell, area : area}" title="{cell.title}{vh:Get.CategoryField(uid: cell.txTileCategory, field: 'title', default: '', prefix: ', ')}">&nbsp;</f:link.action>
</f:else>
</f:if>
</div>
</div>
</div>
</f:for>
</div>
<div style="clear:both;"></div>
<div class="buttons">
<f:comment>#t3729</f:comment>
<f:form class="form-inline" action="enable" arguments="{cell : cell, area : area}">
<f:form.hidden name="setSession" />
<f:form.hidden name="controller" value="Category" />
<f:form.checkbox
name="formCellWiBgimage"
checked="{formCellWiBgimageChecked}"
value="1" /> Bild
<f:form.checkbox
name="formCellWiGroups"
checked="{formCellWiGroupsChecked}"
value="1" /> Gruppen
<f:form.checkbox
name="formCellWiCategories"
checked="{formCellWiCategoriesChecked}"
value="1" /> Objekte
<f:form.checkbox
name="formCellWiUndefinedCells"
checked="{formCellWiUndefinedCellsChecked}"
value="1" /> Raster
<f:form.checkbox
name="formCellWiTickets"
checked="{formCellWiTicketsChecked}"
value="1" /> Tickets
<br />
<f:link.action action="list" class="btn btn-default" controller="Module">Zurück</f:link.action>
<f:form.select
class="form-control"
name="formCellCategory"
options="{formCellCategoryOptions}"
optionValueField="uid"
optionLabelField="title"
value="{formCellCategorySelected}">
</f:form.select>
<f:form.select
class="form-control"
name="formCellMode"
options="{formCellModeOptions}"
optionValueField="uid"
optionLabelField="title"
value="{formCellModeSelected}">
</f:form.select>
<f:form.submit class="btn btn-primary" value="Aktivieren" />
</f:form>
</div>
<hr />
<h3>Objekt</h3>
<ol>
<li>
Wähle in der Auswahlbox ein Objekt aus und klicke den Button [Aktivieren]
</li>
<li>
Klicke die Kachel, der Du das aktivierte Objekt zuweisen möchtest.
</li>
<li>
Aktiviert ist: {categoryTitle}. Bei einem Klick auf eine Kachel wird das Objekt {categoryTitle} zugewiesen.
</li>
</ol>
<h3>Modus</h3>
<ul>
<li>
Kachel: Ein Objekt wird der Kachel zugewiesen, die Du anklickst.
</li>
<li>
Gruppe: Ein Objekt wird allen Kacheln zugewiesen, die sich innrhalb der beiden
Kacheln befinden, die Du nacheinander anklickst.
</li>
</ul>
</f:section>
</html>
\ No newline at end of file
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