1 | 1 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,28 @@ |
1 |
+Pagelist |
|
2 |
+==== |
|
3 |
+ |
|
4 |
+Provides a link list module of subpages or subpages of an alternative reference page. It also extends the article settings with a teaser image. |
|
5 |
+ |
|
6 |
+This module is developed and provided by [eSales Media][1]. |
|
7 |
+ |
|
8 |
+__Author:__ Benjamin Roth [benjamin@esales-media.de] |
|
9 |
+ |
|
10 |
+ |
|
11 |
+System requirements |
|
12 |
+---- |
|
13 |
+Contao CMS >= 3.4.x |
|
14 |
+ |
|
15 |
+ |
|
16 |
+ |
|
17 |
+Installation |
|
18 |
+---- |
|
19 |
+Copy into your system/modules/ folder and don't forget to update the database. |
|
20 |
+ |
|
21 |
+ |
|
22 |
+License |
|
23 |
+---- |
|
24 |
+LGPL-3.0+ |
|
25 |
+ |
|
26 |
+ |
|
27 |
+ |
|
28 |
+[1]: http://www.esales-media.de |
|
0 | 29 |
\ No newline at end of file |
1 | 30 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,19 @@ |
1 |
+;; |
|
2 |
+; List modules which are required to be loaded beforehand |
|
3 |
+;; |
|
4 |
+requires[] = "core" |
|
5 |
+ |
|
6 |
+;; |
|
7 |
+; Configure what you want the autoload creator to register |
|
8 |
+;; |
|
9 |
+register_namespaces = true |
|
10 |
+register_classes = true |
|
11 |
+register_templates = true |
|
12 |
+ |
|
13 |
+;; |
|
14 |
+; Override the default configuration for certain sub directories |
|
15 |
+;; |
|
16 |
+[vendor/*] |
|
17 |
+register_namespaces = false |
|
18 |
+register_classes = false |
|
19 |
+register_templates = false |
0 | 20 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,38 @@ |
1 |
+<?php |
|
2 |
+ |
|
3 |
+/** |
|
4 |
+ * Contao Open Source CMS |
|
5 |
+ * |
|
6 |
+ * Copyright (c) 2005-2016 Leo Feyer |
|
7 |
+ * |
|
8 |
+ * @license LGPL-3.0+ |
|
9 |
+ */ |
|
10 |
+ |
|
11 |
+ |
|
12 |
+/** |
|
13 |
+ * Register the namespaces |
|
14 |
+ */ |
|
15 |
+ClassLoader::addNamespaces(array |
|
16 |
+( |
|
17 |
+ 'eSM_pagelist', |
|
18 |
+)); |
|
19 |
+ |
|
20 |
+ |
|
21 |
+/** |
|
22 |
+ * Register the classes |
|
23 |
+ */ |
|
24 |
+ClassLoader::addClasses(array |
|
25 |
+( |
|
26 |
+ // Modules |
|
27 |
+ 'eSM_pagelist\ModulePagelist' => 'system/modules/eSM_pagelist/modules/ModulePagelist.php', |
|
28 |
+)); |
|
29 |
+ |
|
30 |
+ |
|
31 |
+/** |
|
32 |
+ * Register the templates |
|
33 |
+ */ |
|
34 |
+TemplateLoader::addFiles(array |
|
35 |
+( |
|
36 |
+ 'mod_pagelist' => 'system/modules/eSM_pagelist/templates/modules', |
|
37 |
+ 'espl_default' => 'system/modules/eSM_pagelist/templates/pagelist', |
|
38 |
+)); |
0 | 39 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,14 @@ |
1 |
+<?php |
|
2 |
+ |
|
3 |
+/** |
|
4 |
+ * Pagelist for Contao |
|
5 |
+ * |
|
6 |
+ * Copyright (c) 2015 Benjamin Roth |
|
7 |
+ * |
|
8 |
+ * @license LGPL-3.0+ |
|
9 |
+ */ |
|
10 |
+ |
|
11 |
+/** |
|
12 |
+ * Front end modules |
|
13 |
+ */ |
|
14 |
+$GLOBALS['FE_MOD']['miscellaneous']['pagelist'] = 'ModulePagelist'; |
|
0 | 15 |
\ No newline at end of file |
1 | 16 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,39 @@ |
1 |
+<?php |
|
2 |
+ |
|
3 |
+/** |
|
4 |
+ * Pagelist for Contao |
|
5 |
+ * |
|
6 |
+ * Copyright (c) 2015 Benjamin Roth |
|
7 |
+ * |
|
8 |
+ * @license LGPL-3.0+ |
|
9 |
+ */ |
|
10 |
+ |
|
11 |
+/** |
|
12 |
+ * Palettes |
|
13 |
+ */ |
|
14 |
+$str_replace = ',teaser,teaserSRC,teaserSize'; |
|
15 |
+$GLOBALS['TL_DCA']['tl_article']['palettes']['default'] = str_replace(array(',teaser,',',teaser;'), array($str_replace.',',$str_replace.';'),$GLOBALS['TL_DCA']['tl_article']['palettes']['default']); |
|
16 |
+ |
|
17 |
+ |
|
18 |
+/** |
|
19 |
+ * Fields |
|
20 |
+ */ |
|
21 |
+$GLOBALS['TL_DCA']['tl_article']['fields']['teaserSRC'] = array |
|
22 |
+( |
|
23 |
+ 'label' => &$GLOBALS['TL_LANG']['tl_article']['teaserSRC'], |
|
24 |
+ 'exclude' => true, |
|
25 |
+ 'inputType' => 'fileTree', |
|
26 |
+ 'eval' => array('fieldType'=>'checkbox', 'multiple'=>false, 'files'=>true, 'filesOnly'=>true, 'extensions'=>'jpg,gif,png,jpeg'), |
|
27 |
+ 'sql' => 'binary(16) NULL' |
|
28 |
+); |
|
29 |
+ |
|
30 |
+$GLOBALS['TL_DCA']['tl_article']['fields']['teaserSize'] = array |
|
31 |
+( |
|
32 |
+ 'label' => &$GLOBALS['TL_LANG']['tl_article']['teaserSize'], |
|
33 |
+ 'exclude' => true, |
|
34 |
+ 'inputType' => 'imageSize', |
|
35 |
+ 'options' => System::getImageSizes(), |
|
36 |
+ 'reference' => &$GLOBALS['TL_LANG']['MSC'], |
|
37 |
+ 'eval' => array('rgxp'=>'natural', 'includeBlankOption'=>true, 'nospace'=>true, 'helpwizard'=>true), |
|
38 |
+ 'sql' => "varchar(64) NOT NULL default ''" |
|
39 |
+); |
|
0 | 40 |
\ No newline at end of file |
1 | 41 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,55 @@ |
1 |
+<?php |
|
2 |
+ |
|
3 |
+/** |
|
4 |
+ * Pagelist for Contao |
|
5 |
+ * |
|
6 |
+ * Copyright (c) 2015 Benjamin Roth |
|
7 |
+ * |
|
8 |
+ * @license LGPL-3.0+ |
|
9 |
+ */ |
|
10 |
+ |
|
11 |
+/** |
|
12 |
+ * Palettes |
|
13 |
+ */ |
|
14 |
+$GLOBALS['TL_DCA']['tl_module']['palettes']['__selector__'][] = 'showTeaserImg'; |
|
15 |
+$GLOBALS['TL_DCA']['tl_module']['palettes']['pagelist'] = '{title_legend},name,headline,type;{config_legend},showProtected,showTeaserImg,perPage;{reference_legend},defineRoot;{template_legend:hide},customTpl,eSM_pagelist_template;{protected_legend:hide},protected;{expert_legend:hide},guests,cssID,space'; |
|
16 |
+$GLOBALS['TL_DCA']['tl_module']['subpalettes']['showTeaserImg'] = 'imgSize'; |
|
17 |
+ |
|
18 |
+/** |
|
19 |
+ * Fields |
|
20 |
+ */ |
|
21 |
+$GLOBALS['TL_DCA']['tl_module']['fields']['showTeaserImg'] = array |
|
22 |
+( |
|
23 |
+ 'label' => &$GLOBALS['TL_LANG']['tl_module']['showTeaserImg'], |
|
24 |
+ 'exclude' => true, |
|
25 |
+ 'inputType' => 'checkbox', |
|
26 |
+ 'eval' => array('tl_class'=>'w50', 'submitOnChange'=>true), |
|
27 |
+ 'sql' => "char(1) NOT NULL default ''" |
|
28 |
+); |
|
29 |
+ |
|
30 |
+$GLOBALS['TL_DCA']['tl_module']['fields']['eSM_pagelist_template'] = array |
|
31 |
+( |
|
32 |
+ 'label' => &$GLOBALS['TL_LANG']['tl_module']['eSM_pagelist_template'], |
|
33 |
+ 'exclude' => true, |
|
34 |
+ 'default' => 'espl_default', |
|
35 |
+ 'inputType' => 'select', |
|
36 |
+ 'options_callback' => array('tl_module_esm_pagelist', 'getPagelistTemplates'), |
|
37 |
+ 'eval' => array('tl_class'=>'w50'), |
|
38 |
+ 'sql' => "varchar(64) NOT NULL default ''" |
|
39 |
+); |
|
40 |
+ |
|
41 |
+/** |
|
42 |
+ * Class tl_module_esm_pagelist |
|
43 |
+ * Provide miscellaneous methods that are used by the data configuration array. |
|
44 |
+ */ |
|
45 |
+class tl_module_esm_pagelist extends Backend |
|
46 |
+{ |
|
47 |
+ /** |
|
48 |
+ * Return all clientsShowcase snippet templates as array |
|
49 |
+ * @return array |
|
50 |
+ */ |
|
51 |
+ public function getPagelistTemplates() |
|
52 |
+ { |
|
53 |
+ return $this->getTemplateGroup('espl_'); |
|
54 |
+ } |
|
55 |
+} |
|
0 | 56 |
\ No newline at end of file |
1 | 57 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,15 @@ |
1 |
+<?php |
|
2 |
+ |
|
3 |
+/** |
|
4 |
+ * Pagelist for Contao |
|
5 |
+ * |
|
6 |
+ * Copyright (c) 2015 Benjamin Roth |
|
7 |
+ * |
|
8 |
+ * @license LGPL-3.0+ |
|
9 |
+ */ |
|
10 |
+ |
|
11 |
+/** |
|
12 |
+ * Frontend modules |
|
13 |
+ */ |
|
14 |
+$GLOBALS['TL_LANG']['FMD']['pagelist'][0] = 'Seitenliste'; |
|
15 |
+$GLOBALS['TL_LANG']['FMD']['pagelist'][1] = 'Erzeugt eine Linkliste mit Unterseiten.'; |
|
0 | 16 |
\ No newline at end of file |
1 | 17 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,17 @@ |
1 |
+<?php |
|
2 |
+ |
|
3 |
+/** |
|
4 |
+ * Pagelist for Contao |
|
5 |
+ * |
|
6 |
+ * Copyright (c) 2015 Benjamin Roth |
|
7 |
+ * |
|
8 |
+ * @license LGPL-3.0+ |
|
9 |
+ */ |
|
10 |
+ |
|
11 |
+/** |
|
12 |
+ * Fields |
|
13 |
+ */ |
|
14 |
+$GLOBALS['TL_LANG']['tl_article']['teaserSRC'][0] = 'Teaserbild'; |
|
15 |
+$GLOBALS['TL_LANG']['tl_article']['teaserSRC'][1] = 'Bitte wählen Sie eine Bilddatei aus der Dateiübersicht.'; |
|
16 |
+$GLOBALS['TL_LANG']['tl_article']['teaserSize'][0] = 'Bildgröße'; |
|
17 |
+$GLOBALS['TL_LANG']['tl_article']['teaserSize'][1] = 'Hier können Sie Abmessungen des Bildes und den Skalierungsmodus festlegen.'; |
0 | 18 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,17 @@ |
1 |
+<?php |
|
2 |
+ |
|
3 |
+/** |
|
4 |
+ * Pagelist for Contao |
|
5 |
+ * |
|
6 |
+ * Copyright (c) 2015 Benjamin Roth |
|
7 |
+ * |
|
8 |
+ * @license LGPL-3.0+ |
|
9 |
+ */ |
|
10 |
+ |
|
11 |
+/** |
|
12 |
+ * Fields |
|
13 |
+ */ |
|
14 |
+$GLOBALS['TL_LANG']['tl_module']['showTeaserImg'][0] = 'Teaserbild anzeigen'; |
|
15 |
+$GLOBALS['TL_LANG']['tl_module']['showTeaserImg'][1] = 'Gibt auch das Teaserbild aus, falls vorhanden.'; |
|
16 |
+$GLOBALS['TL_LANG']['tl_module']['eSM_pagelist_template'][0] = 'Listen-Template'; |
|
17 |
+$GLOBALS['TL_LANG']['tl_module']['eSM_pagelist_template'][1] = 'Hier können Sie das Listen-Template überschreiben.'; |
0 | 18 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,15 @@ |
1 |
+<?php |
|
2 |
+ |
|
3 |
+/** |
|
4 |
+ * Pagelist for Contao |
|
5 |
+ * |
|
6 |
+ * Copyright (c) 2015 Benjamin Roth |
|
7 |
+ * |
|
8 |
+ * @license LGPL-3.0+ |
|
9 |
+ */ |
|
10 |
+ |
|
11 |
+/** |
|
12 |
+ * Frontend modules |
|
13 |
+ */ |
|
14 |
+$GLOBALS['TL_LANG']['FMD']['pagelist'][0] = 'Pagelist'; |
|
15 |
+$GLOBALS['TL_LANG']['FMD']['pagelist'][1] = 'Generates a link list of subpages.'; |
|
0 | 16 |
\ No newline at end of file |
1 | 17 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,17 @@ |
1 |
+<?php |
|
2 |
+ |
|
3 |
+/** |
|
4 |
+ * Pagelist for Contao |
|
5 |
+ * |
|
6 |
+ * Copyright (c) 2015 Benjamin Roth |
|
7 |
+ * |
|
8 |
+ * @license LGPL-3.0+ |
|
9 |
+ */ |
|
10 |
+ |
|
11 |
+/** |
|
12 |
+ * Fields |
|
13 |
+ */ |
|
14 |
+$GLOBALS['TL_LANG']['tl_article']['teaserSRC'][0] = 'Teaser image'; |
|
15 |
+$GLOBALS['TL_LANG']['tl_article']['teaserSRC'][1] = 'Please choose an image file from the files directory.'; |
|
16 |
+$GLOBALS['TL_LANG']['tl_article']['teaserSize'][0] = 'Image size'; |
|
17 |
+$GLOBALS['TL_LANG']['tl_article']['teaserSize'][1] = 'Here you can set the image dimensions and the resize mode.'; |
0 | 18 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,17 @@ |
1 |
+<?php |
|
2 |
+ |
|
3 |
+/** |
|
4 |
+ * Pagelist for Contao |
|
5 |
+ * |
|
6 |
+ * Copyright (c) 2015 Benjamin Roth |
|
7 |
+ * |
|
8 |
+ * @license LGPL-3.0+ |
|
9 |
+ */ |
|
10 |
+ |
|
11 |
+/** |
|
12 |
+ * Fields |
|
13 |
+ */ |
|
14 |
+$GLOBALS['TL_LANG']['tl_module']['showTeaserImg'][0] = 'Show teaser image'; |
|
15 |
+$GLOBALS['TL_LANG']['tl_module']['showTeaserImg'][1] = 'Also displays the teaser image if available.'; |
|
16 |
+$GLOBALS['TL_LANG']['tl_module']['eSM_pagelist_template'][0] = 'List template'; |
|
17 |
+$GLOBALS['TL_LANG']['tl_module']['eSM_pagelist_template'][1] = 'Here you can override the default list template.'; |
0 | 18 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,264 @@ |
1 |
+<?php |
|
2 |
+ |
|
3 |
+/** |
|
4 |
+ * Pagelist for Contao |
|
5 |
+ * |
|
6 |
+ * Copyright (c) 2015 Benjamin Roth |
|
7 |
+ * |
|
8 |
+ * @license LGPL-3.0+ |
|
9 |
+ */ |
|
10 |
+ |
|
11 |
+namespace eSM_pagelist; |
|
12 |
+use \Contao\Module; |
|
13 |
+/** |
|
14 |
+ * Class ModulePagelist |
|
15 |
+ * @package eSM_pagelist |
|
16 |
+ */ |
|
17 |
+class ModulePagelist extends Module |
|
18 |
+{ |
|
19 |
+ |
|
20 |
+ /** |
|
21 |
+ * Template |
|
22 |
+ * @var string |
|
23 |
+ */ |
|
24 |
+ protected $strTemplate = 'mod_pagelist'; |
|
25 |
+ |
|
26 |
+ |
|
27 |
+ /** |
|
28 |
+ * Do not display the module if there are no menu items |
|
29 |
+ * @return string |
|
30 |
+ */ |
|
31 |
+ public function generate() |
|
32 |
+ { |
|
33 |
+ if (TL_MODE == 'BE') |
|
34 |
+ { |
|
35 |
+ $objTemplate = new \BackendTemplate('be_wildcard'); |
|
36 |
+ |
|
37 |
+ $objTemplate->wildcard = '### ' . utf8_strtoupper($GLOBALS['TL_LANG']['FMD']['pagelist'][0]) . ' ###'; |
|
38 |
+ $objTemplate->title = $this->headline; |
|
39 |
+ $objTemplate->id = $this->id; |
|
40 |
+ $objTemplate->link = $this->name; |
|
41 |
+ $objTemplate->href = 'contao/main.php?do=themes&table=tl_module&act=edit&id=' . $this->id; |
|
42 |
+ |
|
43 |
+ return $objTemplate->parse(); |
|
44 |
+ } |
|
45 |
+ |
|
46 |
+ $strBuffer = parent::generate(); |
|
47 |
+ return strlen($this->Template->items) ? $strBuffer : ''; |
|
48 |
+ } |
|
49 |
+ |
|
50 |
+ |
|
51 |
+ /** |
|
52 |
+ * Generate content element |
|
53 |
+ */ |
|
54 |
+ protected function compile() |
|
55 |
+ { |
|
56 |
+ global $objPage; |
|
57 |
+ |
|
58 |
+ $intPage = $objPage->id; |
|
59 |
+ $trail = $objPage->trail; |
|
60 |
+ |
|
61 |
+ // Overwrite with custom reference page |
|
62 |
+ if ($this->defineRoot && $this->rootPage > 0) |
|
63 |
+ { |
|
64 |
+ $trail = array($this->rootPage); |
|
65 |
+ $intPage = $this->rootPage; |
|
66 |
+ } |
|
67 |
+ $level = array_search($intPage, $trail, true); |
|
68 |
+ |
|
69 |
+ $this->Template->request = ampersand(\Environment::get('indexFreeRequest')); |
|
70 |
+ $this->Template->skipId = 'skipNavigation' . $this->id; |
|
71 |
+ $this->Template->skipNavigation = specialchars($GLOBALS['TL_LANG']['MSC']['skipNavigation']); |
|
72 |
+ $this->Template->items = $this->getSubpages($trail[$level]); |
|
73 |
+ |
|
74 |
+ } |
|
75 |
+ |
|
76 |
+ /** |
|
77 |
+ * Recursively compile the navigation menu and return it as HTML string |
|
78 |
+ * @param integer |
|
79 |
+ * @param integer |
|
80 |
+ * @return string |
|
81 |
+ */ |
|
82 |
+ protected function getSubpages($pid, $level=1) |
|
83 |
+ { |
|
84 |
+ $time = time(); |
|
85 |
+ |
|
86 |
+ $offset = 0; |
|
87 |
+ $limit = null; |
|
88 |
+ |
|
89 |
+ |
|
90 |
+ // Get all active subpages |
|
91 |
+ |
|
92 |
+ // Get the total number of items |
|
93 |
+ $objSubpagesCountStatement = $this->Database->prepare("SELECT COUNT(p1.id) as total FROM tl_page p1 WHERE p1.pid=? AND p1.type!='root' AND p1.type!='error_403' AND p1.type!='error_404' AND p1.hide!=1" . ((FE_USER_LOGGED_IN && !BE_USER_LOGGED_IN) ? " AND p1.guests!=1" : "") . (!BE_USER_LOGGED_IN ? " AND (p1.start='' OR p1.start<".$time.") AND (p1.stop='' OR p1.stop>".$time.") AND p1.published=1" : "") . " ORDER BY p1.sorting"); |
|
94 |
+ $objSubpagesStatement = $this->Database->prepare("SELECT p1.* as total FROM tl_page p1 WHERE p1.pid=? AND p1.type!='root' AND p1.type!='error_403' AND p1.type!='error_404' AND p1.hide!=1" . ((FE_USER_LOGGED_IN && !BE_USER_LOGGED_IN) ? " AND p1.guests!=1" : "") . (!BE_USER_LOGGED_IN ? " AND (p1.start='' OR p1.start<".$time.") AND (p1.stop='' OR p1.stop>".$time.") AND p1.published=1" : "") . " ORDER BY p1.sorting"); |
|
95 |
+ |
|
96 |
+ $objTotal = $objSubpagesCountStatement->execute($pid); |
|
97 |
+ $total = $objTotal->total; |
|
98 |
+ |
|
99 |
+ // Split the results |
|
100 |
+ if ($this->perPage > 0 && !isset($limit)) |
|
101 |
+ { |
|
102 |
+ // Adjust the overall limit |
|
103 |
+ if (isset($limit)) |
|
104 |
+ { |
|
105 |
+ $total = min($limit, $total); |
|
106 |
+ } |
|
107 |
+ |
|
108 |
+ $page = $this->Input->get('page') ? $this->Input->get('page') : 1; |
|
109 |
+ |
|
110 |
+ // Check the maximum page number |
|
111 |
+ if ($page > ($total/$this->perPage)) |
|
112 |
+ { |
|
113 |
+ $page = ceil($total/$this->perPage); |
|
114 |
+ } |
|
115 |
+ |
|
116 |
+ // Limit and offset |
|
117 |
+ $limit = $this->perPage; |
|
118 |
+ $offset = (max($page, 1) - 1) * $this->perPage; |
|
119 |
+ |
|
120 |
+ // Overall limit |
|
121 |
+ if ($offset + $limit > $total) |
|
122 |
+ { |
|
123 |
+ $limit = $total - $offset; |
|
124 |
+ } |
|
125 |
+ |
|
126 |
+ // Add the pagination menu |
|
127 |
+ $objPagination = new \Pagination($total, $this->perPage); |
|
128 |
+ $this->Template->pagination = $objPagination->generate("\n "); |
|
129 |
+ } |
|
130 |
+ |
|
131 |
+ // Limit the result |
|
132 |
+ if (isset($limit)) |
|
133 |
+ { |
|
134 |
+ $objSubpagesStatement = $objSubpagesStatement->limit($limit, $offset); |
|
135 |
+ } |
|
136 |
+ |
|
137 |
+ $objSubpages = $objSubpagesStatement->execute($pid); |
|
138 |
+ |
|
139 |
+ if ($objSubpages->numRows < 1) |
|
140 |
+ { |
|
141 |
+ return ''; |
|
142 |
+ } |
|
143 |
+ |
|
144 |
+ $items = array(); |
|
145 |
+ $groups = array(); |
|
146 |
+ |
|
147 |
+ // Get all groups of the current front end user |
|
148 |
+ if (FE_USER_LOGGED_IN) |
|
149 |
+ { |
|
150 |
+ $this->import('FrontendUser', 'User'); |
|
151 |
+ $groups = $this->User->groups; |
|
152 |
+ } |
|
153 |
+ |
|
154 |
+ // Layout template fallback |
|
155 |
+ if (!strlen($this->eSM_pagelist_template)) |
|
156 |
+ { |
|
157 |
+ $this->esTemplate = 'espl_default'; |
|
158 |
+ } |
|
159 |
+ |
|
160 |
+ $objTemplate = new \FrontendTemplate($this->eSM_pagelist_template); |
|
161 |
+ |
|
162 |
+ $objTemplate->type = get_class($this); |
|
163 |
+ $objTemplate->level = 'level_' . $level++; |
|
164 |
+ |
|
165 |
+ // Get page object |
|
166 |
+ global $objPage; |
|
167 |
+ |
|
168 |
+ // Browse subpages |
|
169 |
+ while($objSubpages->next()) |
|
170 |
+ { |
|
171 |
+ |
|
172 |
+ if ($objSubpages->type == 'redirect' || $objSubpages->type == 'forward') |
|
173 |
+ { |
|
174 |
+ continue; |
|
175 |
+ } |
|
176 |
+ |
|
177 |
+ |
|
178 |
+ $subitems = ''; |
|
179 |
+ $_groups = deserialize($objSubpages->groups); |
|
180 |
+ |
|
181 |
+ // Do not show protected pages unless a back end or front end user is logged in |
|
182 |
+ if (!$objSubpages->protected || BE_USER_LOGGED_IN || (is_array($_groups) && count(array_intersect($_groups, $groups))) || $this->showProtected) |
|
183 |
+ { |
|
184 |
+ |
|
185 |
+ // Get href |
|
186 |
+ $href = $this->generateFrontendUrl($objSubpages->row()); |
|
187 |
+ |
|
188 |
+ $objArticle = $this->Database->prepare("SELECT a.id AS aid, a.title AS title, a.alias AS aalias, a.teaser AS teaser, a.teaserSRC AS teaserSRC, a.teaserSize AS teaserSize, a.inColumn AS inColumn, a.teaserCssID AS teaserCssID FROM tl_article a WHERE a.pid=? AND inColumn = 'main' ORDER BY sorting") |
|
189 |
+ ->limit(1) |
|
190 |
+ ->execute($objSubpages->id); |
|
191 |
+ |
|
192 |
+ if ($objArticle->numRows < 1) |
|
193 |
+ { |
|
194 |
+ continue; |
|
195 |
+ } |
|
196 |
+ |
|
197 |
+ $objContent = $this->Database->execute("SELECT count(id) as `count` FROM tl_content WHERE pid = '".$objArticle->aid."'"); |
|
198 |
+ |
|
199 |
+ $row = $objSubpages->row(); |
|
200 |
+ |
|
201 |
+ // Add an image |
|
202 |
+ if ($this->showTeaserImg && $objArticle->teaserSRC != '') |
|
203 |
+ { |
|
204 |
+ $arrData = array(); |
|
205 |
+ $objClass = new \stdClass(); |
|
206 |
+ $objModel = \FilesModel::findByUuid($objArticle->teaserSRC); |
|
207 |
+ |
|
208 |
+ // Override the default image size |
|
209 |
+ if ($this->imgSize != '') |
|
210 |
+ { |
|
211 |
+ $size = deserialize($this->imgSize); |
|
212 |
+ |
|
213 |
+ if ($size[0] > 0 || $size[1] > 0) |
|
214 |
+ { |
|
215 |
+ $arrData['size'] = $this->imgSize; |
|
216 |
+ } |
|
217 |
+ } else { |
|
218 |
+ $arrData['size'] = $objArticle->teaserSize; |
|
219 |
+ } |
|
220 |
+ |
|
221 |
+ if ($objModel !== null && is_file(TL_ROOT . '/' . $objModel->path)) |
|
222 |
+ { |
|
223 |
+ $arrData['singleSRC'] = $objModel->path; |
|
224 |
+ $arrData['alt'] = specialchars($objSubpages->title); |
|
225 |
+ $this->addImageToTemplate($objClass, $arrData); |
|
226 |
+ $row['picture'] = $objClass; |
|
227 |
+ } |
|
228 |
+ |
|
229 |
+ } |
|
230 |
+ |
|
231 |
+ $row['isActive'] = ($objPage->id == $objSubpages->id ? true : false); |
|
232 |
+ $row['subitems'] = (bool) $subitems; |
|
233 |
+ list($row['cssId'], $row['class']) = (deserialize($objArticle->teaserCssID)); |
|
234 |
+ $row['title'] = $objSubpages->title; |
|
235 |
+ $row['pageTitle'] = $objSubpages->pageTitle; |
|
236 |
+ $row['href'] = $href; |
|
237 |
+ |
|
238 |
+ $row['headline'] = $objArticle->title; |
|
239 |
+ $row['text'] = $objArticle->teaser; |
|
240 |
+ if ($objContent->count > 0) |
|
241 |
+ { |
|
242 |
+ $row['readMore'] = specialchars(sprintf($GLOBALS['TL_LANG']['MSC']['readMore'], $objArticle->title)); |
|
243 |
+ $row['more'] = $GLOBALS['TL_LANG']['MSC']['more']; |
|
244 |
+ } |
|
245 |
+ |
|
246 |
+ $items[] = $row; |
|
247 |
+ } |
|
248 |
+ } |
|
249 |
+ |
|
250 |
+ // Add classes first and last |
|
251 |
+ if (count($items)) |
|
252 |
+ { |
|
253 |
+ $last = count($items) - 1; |
|
254 |
+ |
|
255 |
+ $items[0]['class'] = trim($items[0]['class'] . ' first'); |
|
256 |
+ $items[$last]['class'] = trim($items[$last]['class'] . ' last'); |
|
257 |
+ } |
|
258 |
+ |
|
259 |
+ $objTemplate->items = $items; |
|
260 |
+ return count($items) ? $objTemplate->parse() : ''; |
|
261 |
+ } |
|
262 |
+ |
|
263 |
+ |
|
264 |
+} |
|
0 | 265 |
\ No newline at end of file |
0 | 10 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,25 @@ |
1 |
+<ul class="layout_pagelist"> |
|
2 |
+<?php foreach ($this->items as $item): ?> |
|
3 |
+<li class="<?php echo $item['class']; ?>"> |
|
4 |
+ |
|
5 |
+<?php if ($item['picture']): ?> |
|
6 |
+ <figure class="image_container"> |
|
7 |
+ |
|
8 |
+ <?php if ($item['href']): ?><a href="<?= $item['href'] ?>"<?php if ($item['title']): ?> title="<?= $item['title'] ?>"<?php endif; ?><?= $this->attributes ?>><?php endif; ?> |
|
9 |
+ |
|
10 |
+ <?php $this->insert('picture_default', $item['picture']->picture); ?> |
|
11 |
+ |
|
12 |
+ <?php if ($item['href']): ?></a><?php endif; ?> |
|
13 |
+ |
|
14 |
+ </figure> |
|
15 |
+<?php endif; ?> |
|
16 |
+ |
|
17 |
+<?php if ($item['headline']): ?> |
|
18 |
+ |
|
19 |
+<h2><?php echo $item['headline']; ?></h2> |
|
20 |
+<?php endif; ?> |
|
21 |
+ |
|
22 |
+<?php echo $item['text']; ?> <a href="<?php echo $item['href']; ?>" title="<?php echo $item['readmore']; ?>" class="more handwritten-small"><?php echo $item['more']; ?> <span class="invisible"><?php echo $item['more']; ?></span></a> |
|
23 |
+</li> |
|
24 |
+<?php endforeach; ?> |
|
25 |
+</ul> |