... | ... |
@@ -23,6 +23,11 @@ class ModulePagelist extends Module |
23 | 23 |
*/ |
24 | 24 |
protected $strTemplate = 'mod_pagelist'; |
25 | 25 |
|
26 |
+ /** |
|
27 |
+ * Layout template |
|
28 |
+ * @var string |
|
29 |
+ */ |
|
30 |
+ protected $strItemsTemplate = 'espl_default'; |
|
26 | 31 |
|
27 | 32 |
/** |
28 | 33 |
* Do not display the module if there are no menu items |
... | ... |
@@ -151,13 +156,13 @@ class ModulePagelist extends Module |
151 | 156 |
$groups = $this->User->groups; |
152 | 157 |
} |
153 | 158 |
|
154 |
- // Layout template fallback |
|
155 |
- if (!strlen($this->eSM_pagelist_template)) |
|
159 |
+ // Custom layout template |
|
160 |
+ if (strlen($this->eSM_pagelist_template)) |
|
156 | 161 |
{ |
157 |
- $this->esTemplate = 'espl_default'; |
|
162 |
+ $this->strItemsTemplate = $this->eSM_pagelist_template; |
|
158 | 163 |
} |
159 | 164 |
|
160 |
- $objTemplate = new \FrontendTemplate($this->eSM_pagelist_template); |
|
165 |
+ $objTemplate = new \FrontendTemplate($this->strItemsTemplate); |
|
161 | 166 |
|
162 | 167 |
$objTemplate->type = get_class($this); |
163 | 168 |
$objTemplate->level = 'level_' . $level++; |
... | ... |
@@ -202,9 +207,11 @@ class ModulePagelist extends Module |
202 | 207 |
if ($size[0] > 0 || $size[1] > 0 || is_numeric($size[2])) |
203 | 208 |
{ |
204 | 209 |
$arrData['size'] = $this->imgSize; |
210 |
+ $objTemplate->imgSize = deserialize($this->imgSize); |
|
205 | 211 |
} |
206 | 212 |
} else { |
207 | 213 |
$arrData['size'] = $objSubpages->teaserSize; |
214 |
+ $objTemplate->imgSize = deserialize($objSubpages->teaserSize); |
|
208 | 215 |
} |
209 | 216 |
|
210 | 217 |
if ($objModel !== null && is_file(TL_ROOT . '/' . $objModel->path)) |
... | ... |
@@ -23,6 +23,11 @@ class ModulePagelist extends Module |
23 | 23 |
*/ |
24 | 24 |
protected $strTemplate = 'mod_pagelist'; |
25 | 25 |
|
26 |
+ /** |
|
27 |
+ * Layout template |
|
28 |
+ * @var string |
|
29 |
+ */ |
|
30 |
+ protected $strItemsTemplate = 'espl_default'; |
|
26 | 31 |
|
27 | 32 |
/** |
28 | 33 |
* Do not display the module if there are no menu items |
... | ... |
@@ -151,16 +156,17 @@ class ModulePagelist extends Module |
151 | 156 |
$groups = $this->User->groups; |
152 | 157 |
} |
153 | 158 |
|
154 |
- // Layout template fallback |
|
155 |
- if (!strlen($this->eSM_pagelist_template)) |
|
159 |
+ // Custom layout template |
|
160 |
+ if (strlen($this->eSM_pagelist_template)) |
|
156 | 161 |
{ |
157 |
- $this->esTemplate = 'espl_default'; |
|
162 |
+ $this->strItemsTemplate = $this->eSM_pagelist_template; |
|
158 | 163 |
} |
159 | 164 |
|
160 |
- $objTemplate = new \FrontendTemplate($this->eSM_pagelist_template); |
|
165 |
+ $objTemplate = new \FrontendTemplate($this->strItemsTemplate); |
|
161 | 166 |
|
162 | 167 |
$objTemplate->type = get_class($this); |
163 | 168 |
$objTemplate->level = 'level_' . $level++; |
169 |
+ $objTemplate->imgSize = deserialize($this->imgSize); |
|
164 | 170 |
|
165 | 171 |
// Get page object |
166 | 172 |
global $objPage; |
... | ... |
@@ -226,7 +226,7 @@ class ModulePagelist extends Module |
226 | 226 |
|
227 | 227 |
$row['headline'] = $objSubpages->title; |
228 | 228 |
$row['text'] = $objSubpages->teaser; |
229 |
- $row['readMore'] = specialchars(sprintf($GLOBALS['TL_LANG']['MSC']['readMore'], $objSubpages->title)); |
|
229 |
+ $row['readMore'] = specialchars(sprintf($GLOBALS['TL_LANG']['MSC']['gotoPage'], $objSubpages->title)); |
|
230 | 230 |
$row['more'] = $GLOBALS['TL_LANG']['MSC']['more']; |
231 | 231 |
|
232 | 232 |
$items[] = $row; |
... | ... |
@@ -185,25 +185,14 @@ class ModulePagelist extends Module |
185 | 185 |
// Get href |
186 | 186 |
$href = $this->generateFrontendUrl($objSubpages->row()); |
187 | 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 | 188 |
$row = $objSubpages->row(); |
200 | 189 |
|
201 | 190 |
// Add an image |
202 |
- if ($this->showTeaserImg && $objArticle->teaserSRC != '') |
|
191 |
+ if ($this->showTeaserImg && $objSubpages->teaserSRC != '') |
|
203 | 192 |
{ |
204 | 193 |
$arrData = array(); |
205 | 194 |
$objClass = new \stdClass(); |
206 |
- $objModel = \FilesModel::findByUuid($objArticle->teaserSRC); |
|
195 |
+ $objModel = \FilesModel::findByUuid($objSubpages->teaserSRC); |
|
207 | 196 |
|
208 | 197 |
// Override the default image size |
209 | 198 |
if ($this->imgSize != '') |
... | ... |
@@ -215,7 +204,7 @@ class ModulePagelist extends Module |
215 | 204 |
$arrData['size'] = $this->imgSize; |
216 | 205 |
} |
217 | 206 |
} else { |
218 |
- $arrData['size'] = $objArticle->teaserSize; |
|
207 |
+ $arrData['size'] = $objSubpages->teaserSize; |
|
219 | 208 |
} |
220 | 209 |
|
221 | 210 |
if ($objModel !== null && is_file(TL_ROOT . '/' . $objModel->path)) |
... | ... |
@@ -230,18 +219,15 @@ class ModulePagelist extends Module |
230 | 219 |
|
231 | 220 |
$row['isActive'] = ($objPage->id == $objSubpages->id ? true : false); |
232 | 221 |
$row['subitems'] = (bool) $subitems; |
233 |
- list($row['cssId'], $row['class']) = (deserialize($objArticle->teaserCssID)); |
|
222 |
+ list($row['cssId'], $row['class']) = (deserialize($objSubpages->teaserCssID)); |
|
234 | 223 |
$row['title'] = $objSubpages->title; |
235 | 224 |
$row['pageTitle'] = $objSubpages->pageTitle; |
236 | 225 |
$row['href'] = $href; |
237 | 226 |
|
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 |
- } |
|
227 |
+ $row['headline'] = $objSubpages->title; |
|
228 |
+ $row['text'] = $objSubpages->teaser; |
|
229 |
+ $row['readMore'] = specialchars(sprintf($GLOBALS['TL_LANG']['MSC']['readMore'], $objSubpages->title)); |
|
230 |
+ $row['more'] = $GLOBALS['TL_LANG']['MSC']['more']; |
|
245 | 231 |
|
246 | 232 |
$items[] = $row; |
247 | 233 |
} |
... | ... |
@@ -90,7 +90,7 @@ class ModulePagelist extends Module |
90 | 90 |
// Get all active subpages |
91 | 91 |
|
92 | 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"); |
|
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 | 94 |
$objSubpagesStatement = $this->Database->prepare("SELECT p1.* 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 | 95 |
|
96 | 96 |
$objTotal = $objSubpagesCountStatement->execute($pid); |
... | ... |
@@ -90,8 +90,8 @@ class ModulePagelist extends Module |
90 | 90 |
// Get all active subpages |
91 | 91 |
|
92 | 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"); |
|
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.* 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 | 95 |
|
96 | 96 |
$objTotal = $objSubpagesCountStatement->execute($pid); |
97 | 97 |
$total = $objTotal->total; |
1 | 1 |
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 |