... | ... |
@@ -12,7 +12,7 @@ use vonRotenberg\RealEstateListingBundle\Controller\FrontendModule\RealEstateAss |
12 | 12 |
use vonRotenberg\RealEstateListingBundle\Controller\FrontendModule\RealEstateAssetsListController; |
13 | 13 |
use vonRotenberg\RealEstateListingBundle\Controller\FrontendModule\RealEstateAssetsReaderController; |
14 | 14 |
|
15 |
-$GLOBALS['TL_DCA']['tl_module']['palettes'][RealEstateAssetsListController::TYPE] = '{title_legend},name,headline,type;{real_estate_legend},vr_re_categories,imgSize;{re_reader_legend},jumpTo;{template_legend:hide},customTpl;{protected_legend:hide},protected;{expert_legend:hide},guests,cssID'; |
|
15 |
+$GLOBALS['TL_DCA']['tl_module']['palettes'][RealEstateAssetsListController::TYPE] = '{title_legend},name,headline,type;{real_estate_legend},vr_re_categories,imgSize,vr_re_grouped;{re_reader_legend},jumpTo;{template_legend:hide},customTpl;{protected_legend:hide},protected;{expert_legend:hide},guests,cssID'; |
|
16 | 16 |
$GLOBALS['TL_DCA']['tl_module']['palettes'][RealEstateAssetsAdController::TYPE] = '{title_legend},name,headline,type;{real_estate_legend},vr_re_categories;{re_reader_legend},jumpTo;{template_legend:hide},customTpl;{protected_legend:hide},protected;{expert_legend:hide},guests,cssID'; |
17 | 17 |
$GLOBALS['TL_DCA']['tl_module']['palettes'][RealEstateAssetsReaderController::TYPE] = '{title_legend},name,headline,type;{real_estate_legend},imgSize;{re_form_legend},vr_re_formUrl;{re_overview_legend},jumpTo;{template_legend:hide},customTpl;{protected_legend:hide},protected;{expert_legend:hide},guests,cssID'; |
18 | 18 |
|
... | ... |
@@ -31,3 +31,10 @@ $GLOBALS['TL_DCA']['tl_module']['fields']['vr_re_formUrl'] = [ |
31 | 31 |
'eval' => array('mandatory'=>true, 'rgxp'=>'url', 'decodeEntities'=>true, 'maxlength'=>255, 'tl_class'=>'w50'), |
32 | 32 |
'sql' => "varchar(255) NOT NULL default ''" |
33 | 33 |
]; |
34 |
+ |
|
35 |
+$GLOBALS['TL_DCA']['tl_module']['fields']['vr_re_grouped'] = [ |
|
36 |
+ 'exclude' => true, |
|
37 |
+ 'inputType' => 'checkbox', |
|
38 |
+ 'eval' => array('tl_class'=>'clr m12 w50'), |
|
39 |
+ 'sql' => "char(1) NOT NULL default ''" |
|
40 |
+]; |
... | ... |
@@ -1,39 +1,48 @@ |
1 |
-<?xml version="1.0" encoding="UTF-8"?><xliff version="1.1"> |
|
2 |
- <file datatype="php" original="contao/languages/en/tl_module.php" source-language="en" target-language="de"> |
|
3 |
- <body> |
|
4 |
- <trans-unit id="tl_module.vr_re_categories.0"> |
|
5 |
- <source>Asset categories</source> |
|
6 |
- <target>Objektkategorien</target> |
|
7 |
- </trans-unit> |
|
8 |
- <trans-unit id="tl_module.vr_re_categories.1"> |
|
9 |
- <source>Please select one or more asset categories.</source> |
|
10 |
- <target>Bitte wählen Sie eine oder mehrere Objektkategorien aus.</target> |
|
11 |
- </trans-unit> |
|
12 |
- <trans-unit id="tl_module.vr_re_formUrl.0"> |
|
13 |
- <source>Form URL</source> |
|
14 |
- <target>Formular-URL</target> |
|
15 |
- </trans-unit> |
|
16 |
- <trans-unit id="tl_module.vr_re_formUrl.1"> |
|
17 |
- <source>The URL of the application form.</source> |
|
18 |
- <target>Die URL des Bewerbungsformulars.</target> |
|
19 |
- </trans-unit> |
|
1 |
+<?xml version="1.0" encoding="UTF-8"?> |
|
2 |
+<xliff version="1.1"> |
|
3 |
+ <file datatype="php" original="contao/languages/en/tl_module.php" source-language="en" target-language="de"> |
|
4 |
+ <body> |
|
5 |
+ <trans-unit id="tl_module.vr_re_categories.0"> |
|
6 |
+ <source>Asset categories</source> |
|
7 |
+ <target>Objektkategorien</target> |
|
8 |
+ </trans-unit> |
|
9 |
+ <trans-unit id="tl_module.vr_re_categories.1"> |
|
10 |
+ <source>Please select one or more asset categories.</source> |
|
11 |
+ <target>Bitte wählen Sie eine oder mehrere Objektkategorien aus.</target> |
|
12 |
+ </trans-unit> |
|
13 |
+ <trans-unit id="tl_module.vr_re_formUrl.0"> |
|
14 |
+ <source>Form URL</source> |
|
15 |
+ <target>Formular-URL</target> |
|
16 |
+ </trans-unit> |
|
17 |
+ <trans-unit id="tl_module.vr_re_formUrl.1"> |
|
18 |
+ <source>The URL of the application form.</source> |
|
19 |
+ <target>Die URL des Bewerbungsformulars.</target> |
|
20 |
+ </trans-unit> |
|
21 |
+ <trans-unit id="tl_module.vr_re_grouped.0"> |
|
22 |
+ <source>Grouping</source> |
|
23 |
+ <target>Gruppieren</target> |
|
24 |
+ </trans-unit> |
|
25 |
+ <trans-unit id="tl_module.vr_re_grouped.1"> |
|
26 |
+ <source>Groups the assets in categories.</source> |
|
27 |
+ <target>Gruppiert die Objekte in Kategorien.</target> |
|
28 |
+ </trans-unit> |
|
20 | 29 |
|
21 |
- <trans-unit id="tl_module.real_estate_legend"> |
|
22 |
- <source>List settings</source> |
|
23 |
- <target>Listen-Einstellungen</target> |
|
24 |
- </trans-unit> |
|
25 |
- <trans-unit id="tl_module.re_reader_legend"> |
|
26 |
- <source>Reader page</source> |
|
27 |
- <target>Detail-Seite</target> |
|
28 |
- </trans-unit> |
|
29 |
- <trans-unit id="tl_module.re_overview_legend"> |
|
30 |
- <source>Overview page</source> |
|
31 |
- <target>Übersichts-Seite</target> |
|
32 |
- </trans-unit> |
|
33 |
- <trans-unit id="tl_module.re_form_legend"> |
|
34 |
- <source>Form settings</source> |
|
35 |
- <target>Formular-Einstellungen</target> |
|
36 |
- </trans-unit> |
|
37 |
- </body> |
|
38 |
- </file> |
|
39 |
-</xliff> |
|
40 | 30 |
\ No newline at end of file |
31 |
+ <trans-unit id="tl_module.real_estate_legend"> |
|
32 |
+ <source>List settings</source> |
|
33 |
+ <target>Listen-Einstellungen</target> |
|
34 |
+ </trans-unit> |
|
35 |
+ <trans-unit id="tl_module.re_reader_legend"> |
|
36 |
+ <source>Reader page</source> |
|
37 |
+ <target>Detail-Seite</target> |
|
38 |
+ </trans-unit> |
|
39 |
+ <trans-unit id="tl_module.re_overview_legend"> |
|
40 |
+ <source>Overview page</source> |
|
41 |
+ <target>Übersichts-Seite</target> |
|
42 |
+ </trans-unit> |
|
43 |
+ <trans-unit id="tl_module.re_form_legend"> |
|
44 |
+ <source>Form settings</source> |
|
45 |
+ <target>Formular-Einstellungen</target> |
|
46 |
+ </trans-unit> |
|
47 |
+ </body> |
|
48 |
+ </file> |
|
49 |
+</xliff> |
... | ... |
@@ -1,42 +1,50 @@ |
1 | 1 |
{% extends '@Contao/frontend_module/_base.html.twig' %} |
2 |
+{% import "@ContaoCore/Image/Studio/_macros.html.twig" as studio %} |
|
2 | 3 |
|
3 | 4 |
{% block content %} |
4 |
- {% import "@ContaoCore/Image/Studio/_macros.html.twig" as studio %} |
|
5 |
- |
|
6 |
- {% if items is not defined or items is empty %} |
|
5 |
+ {% if groups is not defined or groups is empty %} |
|
7 | 6 |
<p class="alert alert-secondary">{{ 'MSC.re_empty'|trans({}, 'contao_default') }}</p> |
8 | 7 |
{% else %} |
9 |
- <div class="assetList"> |
|
10 |
- {% for item in items %} |
|
11 |
- <div class="asset re_asset_card"> |
|
12 |
- {% if item.teaserFigure %} |
|
13 |
- {{- studio.figure(item.teaserFigure, { attr: { class: ('image_container media') }}) -}} |
|
14 |
- {% endif %} |
|
8 |
+ {% for group in groups %} |
|
9 |
+ {% block group %} |
|
10 |
+ {% if data.vr_re_grouped is defined and data.vr_re_grouped == '1' %} |
|
11 |
+ <h3>{{ group.label }}</h3> |
|
12 |
+ {% endif %} |
|
13 |
+ <div class="assetList"> |
|
14 |
+ {% for item in group.items %} |
|
15 |
+ {% block item %} |
|
16 |
+ <div class="asset re_asset_card"> |
|
17 |
+ {% if item.teaserFigure %} |
|
18 |
+ {{- studio.figure(item.teaserFigure, { attr: { class: ('image_container media') }}) -}} |
|
19 |
+ {% endif %} |
|
15 | 20 |
|
16 |
- <div class="details"> |
|
17 |
- <ul> |
|
18 |
- <li> |
|
19 |
- <span class="label">Adresse:</span> |
|
20 |
- {% if item.address is not empty %}{{ item.address }}<br>{% endif %} |
|
21 |
- {% if item.postal is not empty and item.city is not empty %}{{ item.postal }} {{ item.city }}<br>{% endif %} |
|
22 |
- </li> |
|
23 |
- {% if item.livingSpace > 0 %} |
|
24 |
- <li> |
|
25 |
- <span class="label">Wohnfläche:</span> |
|
26 |
- {{ item.livingSpace|number_format(2, ',', '') }} m² |
|
27 |
- </li> |
|
28 |
- {% endif %} |
|
29 |
- <li> |
|
30 |
- <span class="label">Kaltmiete:</span> |
|
31 |
- {% if item.coldRent is not empty %}{{ item.coldRent|number_format(2, ',', '') }} €{% endif %} |
|
32 |
- </li> |
|
33 |
- </ul> |
|
34 |
- {% if item.detailsUrl %} |
|
35 |
- <a class="link" href="{{ item.detailsUrl }}"></a> |
|
36 |
- {% endif %} |
|
37 |
- </div> |
|
21 |
+ <div class="details"> |
|
22 |
+ <ul> |
|
23 |
+ <li> |
|
24 |
+ <span class="label">Adresse:</span> |
|
25 |
+ {% if item.address is not empty %}{{ item.address }}<br>{% endif %} |
|
26 |
+ {% if item.postal is not empty and item.city is not empty %}{{ item.postal }} {{ item.city }}<br>{% endif %} |
|
27 |
+ </li> |
|
28 |
+ {% if item.livingSpace > 0 %} |
|
29 |
+ <li> |
|
30 |
+ <span class="label">Wohnfläche:</span> |
|
31 |
+ {{ item.livingSpace|number_format(2, ',', '') }} m² |
|
32 |
+ </li> |
|
33 |
+ {% endif %} |
|
34 |
+ <li> |
|
35 |
+ <span class="label">Kaltmiete:</span> |
|
36 |
+ {% if item.coldRent is not empty %}{{ item.coldRent|number_format(2, ',', '') }} €{% endif %} |
|
37 |
+ </li> |
|
38 |
+ </ul> |
|
39 |
+ {% if item.detailsUrl %} |
|
40 |
+ <a class="link" href="{{ item.detailsUrl }}"></a> |
|
41 |
+ {% endif %} |
|
42 |
+ </div> |
|
43 |
+ </div> |
|
44 |
+ {% endblock %} |
|
45 |
+ {% endfor %} |
|
38 | 46 |
</div> |
39 |
- {% endfor %} |
|
40 |
- </div> |
|
47 |
+ {% endblock %} |
|
48 |
+ {% endfor %} |
|
41 | 49 |
{% endif %} |
42 | 50 |
{% endblock %} |
... | ... |
@@ -26,7 +26,7 @@ class RealEstateAssetsListController extends RealEstateAssetsModuleController |
26 | 26 |
|
27 | 27 |
protected function getResponse(FragmentTemplate $template, ModuleModel $model, Request $request): Response |
28 | 28 |
{ |
29 |
- $arrItems = []; |
|
29 |
+ $arrGroups = []; |
|
30 | 30 |
|
31 | 31 |
$jumpTo = PageModel::findByPk($model->jumpTo); |
32 | 32 |
$urlGenerator = System::getContainer()->get('contao.routing.content_url_generator'); |
... | ... |
@@ -50,10 +50,26 @@ class RealEstateAssetsListController extends RealEstateAssetsModuleController |
50 | 50 |
'detailsUrl' => $jumpTo !== null ? $urlGenerator->generate($jumpTo)/*(\Config::get('useAutoItem') ? '/' : '/items/') . $asset->id)*/ : null |
51 | 51 |
]); |
52 | 52 |
|
53 |
- $arrItems[] = $arrItem; |
|
53 |
+ // Grouping |
|
54 |
+ if ($model->vr_re_grouped) |
|
55 |
+ { |
|
56 |
+ if (!isset($arrGroups[$arrItem['pid']])) |
|
57 |
+ { |
|
58 |
+ $Group = $asset->getRelated('pid'); |
|
59 |
+ $arrGroups[$arrItem['pid']] = [ |
|
60 |
+ 'label' => $Group->title, |
|
61 |
+ 'items' => [] |
|
62 |
+ ]; |
|
63 |
+ } |
|
64 |
+ |
|
65 |
+ $arrGroups[$arrItem['pid']]['items'][] = $arrItem; |
|
66 |
+ } else { |
|
67 |
+ $arrGroups['nogroup']['items'][] = $arrItem; |
|
68 |
+ } |
|
69 |
+ |
|
54 | 70 |
} |
55 | 71 |
|
56 |
- $template->set('items',$arrItems); |
|
72 |
+ $template->set('groups',$arrGroups); |
|
57 | 73 |
return $template->getResponse(); |
58 | 74 |
} |
59 | 75 |
|