Add show plugin, prepare consider date

This commit is contained in:
Dirk 2019-11-13 10:46:21 +01:00
parent 6e11f00c13
commit 38a76b26f9
8 changed files with 124 additions and 4 deletions

View file

@ -88,6 +88,7 @@ class DateController extends ActionController
$selRegion = $arguments['region']; $selRegion = $arguments['region'];
$start = $arguments['start']; $start = $arguments['start'];
$end = $arguments['end']; $end = $arguments['end'];
$considerDate = $arguments['considerDate'];
$regions = $this->regionRepository->findAll(); $regions = $this->regionRepository->findAll();
$this->view->assign('regions', $regions); $this->view->assign('regions', $regions);
@ -96,6 +97,7 @@ class DateController extends ActionController
$this->view->assign('selRegion', $selRegion); $this->view->assign('selRegion', $selRegion);
$this->view->assign('start', $start); $this->view->assign('start', $start);
$this->view->assign('end', $end); $this->view->assign('end', $end);
$this->view->assign('considerDate', $considerDate);
} }
/** /**
@ -165,6 +167,9 @@ class DateController extends ActionController
if ($this->request->hasArgument('end') && $this->request->getArgument('end') != '') if ($this->request->hasArgument('end') && $this->request->getArgument('end') != '')
$demand->setEnd(strtotime($this->request->getArgument('end'))); $demand->setEnd(strtotime($this->request->getArgument('end')));
if ($this->request->hasArgument('considerDate') && $this->request->getArgument('considerDate') != '')
$demand->setConsiderDate(strtotime($this->request->getArgument('considerDate')));
$demand->setSortBy((string)$this->settings['sortByDate']); $demand->setSortBy((string)$this->settings['sortByDate']);
$demand->setSortOrder((string)$this->settings['sortOrder']); $demand->setSortOrder((string)$this->settings['sortOrder']);

View file

@ -59,6 +59,11 @@ class DateDemand {
*/ */
protected $searchword = ''; protected $searchword = '';
/**
* @var bool
*/
protected $considerDate = 0;
/** /**
* @return string * @return string
*/ */
@ -235,4 +240,20 @@ class DateDemand {
$this->end = $end; $this->end = $end;
} }
/**
* @return bool
*/
public function getConsiderDate(): bool
{
return $this->considerDate;
}
/**
* @param bool $considerDate
*/
public function setConsiderDate(string $considerDate): void
{
$this->considerDate = $considerDate;
}
} }

View file

@ -82,7 +82,7 @@ class DateRepository extends \TYPO3\CMS\Extbase\Persistence\Repository
$constraints['daterange'] = $query->logicalAnd( $constraints['daterange'] = $query->logicalAnd(
[ [
$query->greaterThanOrEqual('start', $demand->getStart()), $query->greaterThanOrEqual('start', $demand->getStart()),
$query->lessThanOrEqual('start', $demand->getEnd()) $query->lessThanOrEqual('end', $demand->getEnd())
] ]
); );
} else { } else {

View file

@ -0,0 +1,57 @@
<T3DataStructure>
<sheets>
<sDEF>
<ROOT>
<TCEforms>
<sheetTitle>Options</sheetTitle>
</TCEforms>
<type>array</type>
<el>
<settings.backPID>
<TCEforms>
<exclude>1</exclude>
<label>Back page</label>
<config>
<type>group</type>
<internal_type>db</internal_type>
<allowed>pages</allowed>
<size>1</size>
<maxitems>1</maxitems>
<minitems>0</minitems>
<show_thumbs>1</show_thumbs>
</config>
</TCEforms>
</settings.backPID>
</el>
</ROOT>
</sDEF>
<sTemplate>
<ROOT>
<TCEforms>
<sheetTitle>Template</sheetTitle>
</TCEforms>
<type>array</type>
<el>
<settings.template>
<exclude>1</exclude>
<label>Layout option</label>
<config>
<type>select</type>
<items type="array">
<numIndex index="0" type="array">
<numIndex index="0">Default</numIndex>
<numIndex index="1">default</numIndex>
</numIndex>
<numIndex index="1" type="array">
<numIndex index="0">Costum</numIndex>
<numIndex index="1">costum</numIndex>
</numIndex>
</items>
<default>default</default>
</config>
</settings.template>
</el>
</ROOT>
</sTemplate>
</sheets>
</T3DataStructure>

View file

@ -25,7 +25,7 @@ call_user_func(function () {
\TYPO3\CMS\Extbase\Utility\ExtensionUtility::registerPlugin( \TYPO3\CMS\Extbase\Utility\ExtensionUtility::registerPlugin(
'Wrm.Events', 'Wrm.Events',
'DateSearch', 'DateSearch',
'Events Date Search', 'Events: Date Search',
'EXT:events/Resources/Public/Icons/user_plugin_events.svg' 'EXT:events/Resources/Public/Icons/user_plugin_events.svg'
); );
@ -33,7 +33,7 @@ call_user_func(function () {
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addPiFlexFormValue( \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addPiFlexFormValue(
'events_datesearch', 'events_datesearch',
'FILE:EXT:events/Configuration/FlexForms/Search.xml' 'FILE:EXT:events/Configuration/FlexForms/DateSearch.xml'
); );
/* Date List Plugin */ /* Date List Plugin */
@ -41,7 +41,7 @@ call_user_func(function () {
\TYPO3\CMS\Extbase\Utility\ExtensionUtility::registerPlugin( \TYPO3\CMS\Extbase\Utility\ExtensionUtility::registerPlugin(
'Wrm.Events', 'Wrm.Events',
'DateList', 'DateList',
'Events Date List', 'Events: Date List',
'EXT:events/Resources/Public/Icons/user_plugin_events.svg' 'EXT:events/Resources/Public/Icons/user_plugin_events.svg'
); );
@ -52,5 +52,21 @@ call_user_func(function () {
'FILE:EXT:events/Configuration/FlexForms/DateList.xml' 'FILE:EXT:events/Configuration/FlexForms/DateList.xml'
); );
/* Date Show Plugin */
\TYPO3\CMS\Extbase\Utility\ExtensionUtility::registerPlugin(
'Wrm.Events',
'DateShow',
'Events: Date Show',
'EXT:events/Resources/Public/Icons/user_plugin_events.svg'
);
$GLOBALS['TCA']['tt_content']['types']['list']['subtypes_addlist']['events_dateshow'] = 'pi_flexform';
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addPiFlexFormValue(
'events_dateshow',
'FILE:EXT:events/Configuration/FlexForms/DateShow.xml'
);
}); });

View file

@ -12,6 +12,16 @@
</div> </div>
</div> </div>
</div> </div>
<f:comment><!--
<div class="row">
<div class="col">
<div class="form-group form-check">
<f:form.checkbox class="form-check-input" id="considerDate" name="considerDate" value="1" checked="{considerDate} == 1" />
<label class="form-check-label" for="considerDate">Datum berücksichtigen?</label>
</div>
</div>
</div>
--></f:comment>
<div class="row"> <div class="row">
<div class="col col-md-6"> <div class="col col-md-6">
<div class="form-group"> <div class="form-group">

View file

@ -40,6 +40,17 @@ call_user_func(
] ]
); );
\TYPO3\CMS\Extbase\Utility\ExtensionUtility::configurePlugin(
'Wrm.Events',
'DateShow',
[
'Date' => 'show'
],
[
'Date' => 'show'
]
);
/* /*
$iconRegistry = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Core\Imaging\IconRegistry::class); $iconRegistry = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Core\Imaging\IconRegistry::class);