feat: snow reports on TYPO3 13, with a page type for the static pages
The snow report list ("Schneehöhen" plugin) is ported from TYPO3 10:
SnowreportController, SnowreportRepository::getSnowreportsForRegions(),
the plugin registration with its flexform (regions) and the template,
which now formats dates with d.m.Y.
Page type 1705 (/<page>/snowreport) renders only the snow report plugins
of a page, like /form for forms. The static pages of the hybrid setup can
load it to replace the snow reports frozen at export time; each list
carries id="snowreport-<content uid>" for hx-select, since TYPO3 10 gives
the plugin no element of its own. ep:import-snowreport already flushes
the page cache after each import. The suffix is in the PageType enhancer
of every site with snow reports.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
feat: the snow report box includes the spacing of its content element
id="snowreport-<content uid>" moves from the list to a wrapper around
ep:container. The static pages of the hybrid setup no longer export the
snow reports at all, only an empty placeholder that loads the whole box,
spacing included, from /<page>/snowreport, so a page never shows
outdated snow depths.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
1 parent
62f3bee230
commit
ca2fdc1e13
12 files changed
+211
-1
No files matched your search
@@ -0,0 +1,23 @@
|
||||
<?php
|
||||
|
||||
namespace EP\EpProducts\Controller;
|
||||
|
||||
use EP\EpProducts\Domain\Repository\SnowreportRepository;
|
||||
use Psr\Http\Message\ResponseInterface;
|
||||
use TYPO3\CMS\Core\Utility\GeneralUtility;
|
||||
use TYPO3\CMS\Extbase\Mvc\Controller\ActionController;
|
||||
|
||||
class SnowreportController extends ActionController
|
||||
{
|
||||
public function __construct(private readonly SnowreportRepository $snowreportRepository)
|
||||
{
|
||||
}
|
||||
|
||||
public function listAction(): ResponseInterface
|
||||
{
|
||||
$regionUids = GeneralUtility::intExplode(',', (string)($this->settings['regionUids'] ?? ''), true);
|
||||
$this->view->assign('data', $this->request->getAttribute('currentContentObject')?->data ?? []);
|
||||
$this->view->assign('list', $this->snowreportRepository->getSnowreportsForRegions($regionUids));
|
||||
return $this->htmlResponse();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
<?php
|
||||
|
||||
namespace EP\EpProducts\Domain\Repository;
|
||||
|
||||
use TYPO3\CMS\Core\Database\Connection;
|
||||
|
||||
class SnowreportRepository extends AbstractRepository
|
||||
{
|
||||
/**
|
||||
* Snow reports of the given regions (all regions with a snow report if empty), one per vendor
|
||||
* record, with region and country data for the list.
|
||||
*/
|
||||
public function getSnowreportsForRegions(array $regionUids = []): array
|
||||
{
|
||||
$qb = $this->getDbConnection()->createQueryBuilder();
|
||||
|
||||
$qb
|
||||
->select(
|
||||
'snowreport.*',
|
||||
'region.name as regionName', 'region.uid as regionUid', 'region.detail_page as regionDetailPage',
|
||||
'country.name as countryName', 'country.uid as countryUid', 'country.code as countryCode',
|
||||
'country.detail_page as countryDetailPage',
|
||||
'season_start as seasonStart', 'season_end as seasonEnd'
|
||||
)
|
||||
->addSelectLiteral('(UNIX_TIMESTAMP() >= snowreport.season_start AND UNIX_TIMESTAMP() <= snowreport.season_end) as inSeason')
|
||||
->from('tx_epproducts_domain_model_snowreport', 'snowreport')
|
||||
->innerJoin('snowreport', 'tx_epproducts_domain_model_region', 'region', 'snowreport.uid = region.snowreport')
|
||||
->innerJoin('region', 'tx_epproducts_domain_model_country', 'country', 'region.country = country.uid')
|
||||
->where('region.snowreport > 0')
|
||||
->groupBy('snowreport.vendor_uid')
|
||||
->orderBy('region.name')
|
||||
;
|
||||
|
||||
if ($regionUids) {
|
||||
$qb->andWhere($qb->expr()->in(
|
||||
'region.uid',
|
||||
$qb->createNamedParameter($regionUids, Connection::PARAM_INT_ARRAY)
|
||||
));
|
||||
}
|
||||
|
||||
return $qb->executeQuery()->fetchAllAssociative();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
<?xml version="1.0"?>
|
||||
<T3DataStructure>
|
||||
<meta>
|
||||
<langDisable>1</langDisable>
|
||||
</meta>
|
||||
<sheets>
|
||||
<sDEF>
|
||||
<ROOT>
|
||||
<sheetTitle>Konfiguration</sheetTitle>
|
||||
<type>array</type>
|
||||
<el>
|
||||
<settings.regionUids>
|
||||
<label>Gebiete einschränken</label>
|
||||
<config>
|
||||
<type>select</type>
|
||||
<renderType>selectMultipleSideBySide</renderType>
|
||||
<foreign_table>tx_epproducts_domain_model_region</foreign_table>
|
||||
<foreign_table_where>AND tx_epproducts_domain_model_region.snowreport > 0 ORDER BY name</foreign_table_where>
|
||||
<minitems>0</minitems>
|
||||
<maxitems>99</maxitems>
|
||||
<size>10</size>
|
||||
</config>
|
||||
</settings.regionUids>
|
||||
</el>
|
||||
</ROOT>
|
||||
</sDEF>
|
||||
</sheets>
|
||||
</T3DataStructure>
|
||||
@@ -43,6 +43,12 @@ call_user_func(function () {
|
||||
'Buchungstabelle'
|
||||
);
|
||||
|
||||
ExtensionUtility::registerPlugin(
|
||||
'EpProducts',
|
||||
'snowreport_list',
|
||||
'Schneehöhen'
|
||||
);
|
||||
|
||||
$GLOBALS['TCA']['tt_content']['types']['list']['subtypes_addlist']['epproducts_product_detail'] = 'pi_flexform';
|
||||
ExtensionManagementUtility::addPiFlexFormValue(
|
||||
'epproducts_product_detail',
|
||||
@@ -61,4 +67,10 @@ call_user_func(function () {
|
||||
'FILE:EXT:ep_products/Configuration/FlexForms/flexform_product_pricetable.xml'
|
||||
);
|
||||
|
||||
$GLOBALS['TCA']['tt_content']['types']['list']['subtypes_addlist']['epproducts_snowreport_list'] = 'pi_flexform';
|
||||
ExtensionManagementUtility::addPiFlexFormValue(
|
||||
'epproducts_snowreport_list',
|
||||
'FILE:EXT:ep_products/Configuration/FlexForms/flexform_snowreport.xml'
|
||||
);
|
||||
|
||||
});
|
||||
@@ -2,6 +2,7 @@
|
||||
use TYPO3\CMS\Extbase\Utility\ExtensionUtility;
|
||||
use EP\EpProducts\Controller\ProductController;
|
||||
use EP\EpProducts\Controller\SearchController;
|
||||
use EP\EpProducts\Controller\SnowreportController;
|
||||
use EP\EpProducts\Controller\TravelinfoController;
|
||||
use EP\EpProducts\Controller\WatchlistController;
|
||||
use EP\EpProducts\Controller\AjaxFilterPanelController;
|
||||
@@ -81,6 +82,14 @@ $boot = function () {
|
||||
]
|
||||
);
|
||||
|
||||
ExtensionUtility::configurePlugin(
|
||||
'EpProducts',
|
||||
'snowreport_list',
|
||||
[
|
||||
SnowreportController::class => 'list',
|
||||
]
|
||||
);
|
||||
|
||||
ExtensionUtility::configurePlugin(
|
||||
'EpProducts',
|
||||
'ajax',
|
||||
|
||||
Reference in new issue
Block a user