* FIX Alternative terms (term_alt) were not searched
[TYPO3CMS/Extensions/contagged.git] / pi1 / class.tx_contagged_pi1.php
1 <?php
2 /***************************************************************
3 * Copyright notice
4 *
5 * (c) 2007 Jochen Rau <j.rau@web.de>
6 * All rights reserved
7 *
8 * This script is part of the TYPO3 project. The TYPO3 project is
9 * free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
13 *
14 * The GNU General Public License can be found at
15 * http://www.gnu.org/copyleft/gpl.html.
16 *
17 * This script is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 * GNU General Public License for more details.
21 *
22 * This copyright notice MUST APPEAR in all copies of the script!
23 ***************************************************************/
24
25 require_once (PATH_tslib . 'class.tslib_pibase.php');
26 require_once (t3lib_extMgm::extPath('contagged') . 'model/class.tx_contagged_model_terms.php');
27 require_once (t3lib_extMgm::extPath('contagged') . 'model/class.tx_contagged_model_mapper.php');
28
29 /**
30 * contagged list plugin
31 *
32 * @author Jochen Rau <j.rau@web.de>
33 * @package TYPO3
34 * @subpackage tx_contagged_pi1
35 */
36 class tx_contagged_pi1 extends tslib_pibase {
37 var $prefixId = 'tx_contagged'; // same as class name
38 var $scriptRelPath = 'pi1/class.tx_contagged_pi1.php'; // path to this script relative to the extension dir
39 var $extKey = 'contagged'; // the extension key
40 var $templateFile = 'EXT:contagged/pi1/contagged.tmpl';
41 var $conf; // the TypoScript configuration array
42 var $templateCode; // template file
43 var $local_cObj;
44 var $typolinkConf;
45 var $backPid; // pid of the last visited page (from piVars)
46 var $indexChar; // char of the given index the user has clicked on (from piVars)
47
48 /**
49 * main method of the contagged list plugin
50 *
51 * @param string $content: The content of the cObj
52 * @param array $conf: The configuration
53 * @return string a single or list view of terms
54 */
55 function main($content, $conf) {
56 $this->local_cObj = t3lib_div::makeInstance('tslib_cObj');
57 $this->local_cObj->setCurrentVal($GLOBALS['TSFE']->id);
58 if (is_array($GLOBALS['TSFE']->tmpl->setup['plugin.']['tx_contagged.'])) {
59 $this->conf = t3lib_div::array_merge_recursive_overrule($GLOBALS['TSFE']->tmpl->setup['plugin.']['tx_contagged.'], $conf);
60 }
61 $this->pi_loadLL();
62 $this->templateCode = $this->cObj->fileResource($this->conf['templateFile']?$this->conf['templateFile']:$this->templateFile);
63 $this->typolinkConf = is_array($this->conf['typolink.']) ? $this->conf['typolink.'] : array();
64 $this->typolinkConf['parameter.']['current'] = 1;
65 if (!empty($this->typolinkConf['additionalParams'])) {
66 $this->typolinkConf['additionalParams'] = $this->cObj->stdWrap($typolinkConf['additionalParams'], $typolinkConf['additionalParams.']);
67 unset($this->typolinkConf['additionalParams.']);
68 }
69 $this->typolinkConf['useCacheHash'] = 1;
70 $this->backPid = $this->piVars['backPid'] ? intval($this->piVars['backPid']) : NULL;
71 $this->pointer = $this->piVars['pointer'] ? intval($this->piVars['pointer']) : NULL;
72 $this->indexChar = $this->piVars['index'] ? urldecode($this->piVars['index']) : NULL; // TODO The length should be configurable
73 if (!is_null($this->piVars['termSource']) && !is_null($this->piVars['termUid'])) {
74 $termKey = stripslashes($this->piVars['termSource']) . '_' . intval($this->piVars['termUid']);
75 }
76 $sword = $this->piVars['sword'] ? htmlspecialchars(urldecode($this->piVars['sword'])) : NULL;
77
78 // get an array of all type configurations
79 $this->typesArray = $this->conf['types.'];
80
81 // get the model (an associated array of terms)
82 $this->mapper = new tx_contagged_model_mapper($this);
83 $this->model = new tx_contagged_model_terms($this);
84 $this->termsArray = $this->model->findAllTermsToListOnPage();
85
86 if ( !is_null($termKey) ) {
87 $content .= $this->renderSingleItemByKey($termKey);
88 } elseif ((strtolower($this->conf['layout']) == 'minilist') || (strtolower($this->cObj->data['select_key']) == 'minilist')) {
89 $content .= $this->renderMiniList();
90 } elseif ( is_null($termKey) && is_null($sword) ) {
91 $content .= $this->renderList();
92 } elseif ( is_null($termKey) && !is_null($sword) ) {
93 $content .= $this->renderListBySword($sword);
94 }
95
96 // TODO hook "newRenderFunctionName"
97
98 $content = $this->removeUnfilledMarker($content);
99
100 return $this->pi_wrapInBaseClass($content);
101 }
102
103 /**
104 * Renders the list of terms
105 *
106 * @return $string The list as HTML
107 */
108 function renderList() {
109 $markerArray = array();
110 $wrappedSubpartArray = array();
111 $subparts = $this->getSubparts('LIST');
112 $this->renderLinks($markerArray, $wrappedSubpartArray);
113 $this->renderIndex($markerArray);
114 $this->renderSearchBox($markerArray);
115 $indexedTerms = array();
116 foreach ( $this->termsArray as $termKey => $termArray ) {
117 if ( $this->indexChar==NULL || $termArray['indexChar']==$this->indexChar ) {
118 $indexedTerms[$termKey] = $termArray;
119 }
120 }
121 if ( $this->conf['pagebrowser.']['enable'] > 0 ) {
122 $this->renderPageBrowser($markerArray, count($indexedTerms));
123 $terms = array_slice($indexedTerms, ($this->pointer * $this->internal['results_at_a_time']), $this->internal['results_at_a_time'], TRUE);
124 } else {
125 $terms = $indexedTerms;
126 }
127 foreach ( $terms as $termKey => $termArray ) {
128 $this->renderSingleItem($termKey,$markerArray,$wrappedSubpartArray);
129 $subpartArray['###LIST###'] .= $this->cObj->substituteMarkerArrayCached($subparts['item'],$markerArray,$subpartArray,$wrappedSubpartArray);
130 }
131 $content = $this->cObj->substituteMarkerArrayCached($subparts['template_list'],$markerArray,$subpartArray,$wrappedSubpartArray);
132
133 return $content;
134 }
135
136 /**
137 * Renders the mini list of terms
138 *
139 * @return $string The list as HTML
140 */
141 function renderMiniList() {
142 $subparts = $this->getSubparts('MINILIST');
143 $terms = $this->termsArray;
144 foreach ( $terms as $termKey => $termArray ) {
145 $this->renderSingleItem($termKey,$markerArray,$wrappedSubpartArray);
146 $subpartArray['###LIST###'] .= $this->cObj->substituteMarkerArrayCached($subparts['item'],$markerArray,$subpartArray,$wrappedSubpartArray);
147 }
148 $content = $this->cObj->substituteMarkerArrayCached($subparts['template_list'],$markerArray,$subpartArray,$wrappedSubpartArray);
149
150 return $content;
151 }
152
153 function renderListBySword($sword) {
154 $swordMatched = FALSE;
155 $subparts = $this->getSubparts('LIST');
156 $this->renderLinks($markerArray,$wrappedSubpartArray);
157 $this->renderIndex($markerArray);
158 $this->renderSearchBox($markerArray);
159 foreach ( $this->termsArray as $termKey => $termArray ) {
160 $fieldsToSearch = t3lib_div::trimExplode(',', $this->conf['searchbox.']['fieldsToSearch'] );
161 foreach ($fieldsToSearch as $field) {
162 if (is_array($termArray[$field])) {
163 foreach ($termArray[$field] as $subFieldValue) {
164 if (preg_match('/' . preg_quote($sword,'/') . '/Uis', strip_tags($subFieldValue)) > 0) {
165 $swordMatched = TRUE;
166 break;
167 }
168 }
169 } else {
170 if (preg_match('/' . preg_quote($sword,'/') . '/Uis', strip_tags($termArray[$field])) > 0) {
171 $swordMatched = TRUE;
172 break;
173 }
174 }
175 }
176 if ( $swordMatched ) {
177 $this->renderSingleItem($termKey,$markerArray,$wrappedSubpartArray);
178 $subpartArray['###LIST###'] .= $this->cObj->substituteMarkerArrayCached($subparts['item'],$markerArray,$subpartArray,$wrappedSubpartArray);
179 $swordMatched = FALSE;
180 }
181 }
182 if ($subpartArray['###LIST###'] == '') {
183 $subpartArray['###LIST###'] = $this->pi_getLL('no_matches');
184 }
185
186 $content = $this->cObj->substituteMarkerArrayCached($subparts['template_list'],$markerArray,$subpartArray,$wrappedSubpartArray);
187
188 return $content;
189 }
190
191 function renderSingleItemByKey($termKey) {
192 $subparts = $this->getSubparts('SINGLE');
193 $this->renderLinks($markerArray,$wrappedSubpartArray);
194 $this->renderIndex($markerArray);
195 $this->renderSingleItem($termKey,$markerArray,$wrappedSubpartArray);
196 $subpartArray['###LIST###'] = $this->cObj->substituteMarkerArrayCached($subparts['item'],$markerArray,$subpartArray,$wrappedSubpartArray);
197 $content = $this->cObj->substituteMarkerArrayCached($subparts['template_list'],$markerArray,$subpartArray,$wrappedSubpartArray);
198
199 return $content;
200 }
201
202 // TODO hook "newRenderFunction"
203
204 function getSubparts($templateName = 'LIST') {
205 $subparts['template_list'] = $this->cObj->getSubpart($this->templateCode,'###TEMPLATE_' . $templateName . '###');
206 $subparts['item'] = $this->cObj->getSubpart($subparts['template_list'], '###ITEM###');
207
208 return $subparts;
209 }
210
211 function renderLinks(&$markerArray, &$wrappedSubpartArray) {
212 // make "back to..." link
213 if ($this->backPid) {
214 if($this->conf['addBackLinkDescription']>0) {
215 $backPage = $this->pi_getRecord('pages', $this->backPid);
216 $markerArray['###BACK_TO###'] = $this->pi_getLL('backToPage') . " \"" . $backPage['title'] . "\"";
217 } else {
218 $markerArray['###BACK_TO###'] = $this->pi_getLL('back');
219 }
220 } else {
221 $markerArray['###BACK_TO###'] = '';
222 }
223 unset($typolinkConf);
224 $typolinkConf['parameter'] = $this->backPid;
225 $wrappedSubpartArray['###LINK_BACK_TO###'] = $this->local_cObj->typolinkWrap($typolinkConf);
226
227 // make "link to all entries"
228 $markerArray['###INDEX_ALL###'] = $this->pi_linkTP($this->pi_getLL('all'));
229
230 // make "to list ..." link
231 unset($typolinkConf);
232 $markerArray['###TO_LIST###'] = $this->pi_getLL('toList');
233 $typolinkConf = $this->typolinkConf;
234 $typolinkConf['parameter.']['wrap'] = "|,".$GLOBALS['TSFE']->type;
235 $wrappedSubpartArray['###LINK_TO_LIST###'] = $this->local_cObj->typolinkWrap($typolinkConf);
236 }
237
238 function renderSingleItem ($termKey,&$markerArray,&$wrappedSubpartArray) {
239 $termArray = $this->termsArray[$termKey];
240 $typeConfigArray = $this->conf['types.'][$termArray['term_type'] . '.'];
241
242 $markerArray['###TERM_TYPE###'] = $typeConfigArray['label'];
243 $markerArray['###TERM###'] = $termArray['term'];
244 $editIconsConf = array(
245 'styleAttribute' => '',
246 );
247 $markerArray['###TERM###'] = $this->cObj->editIcons($termArray['term'],'tx_contagged_terms:term_main,term_alt,term_type,term_lang,term_replace,desc_short,desc_long,image,dam_images,imagecaption,imagealt,imagetitle,related,link,exclude',$editIconsConf,'tx_contagged_terms:'.$termArray['uid']);
248 $markerArray['###TERM_MAIN###'] = $termArray['term_main'];
249 $markerArray['###TERM_ALT###'] = $termArray['term_alt']?implode(', ',$termArray['term_alt']):$this->pi_getLL('na');
250 $markerArray['###TERM_REPLACE###'] = $termArray['term_replace']?$termArray['term_replace']:$this->pi_getLL('na');
251 $markerArray['###DESC_SHORT###'] = $termArray['desc_short']?$termArray['desc_short']:$this->pi_getLL('na');
252 $markerArray['###DESC_LONG###'] = $termArray['desc_long']?$termArray['desc_long']:$this->pi_getLL('na');
253 $markerArray['###IMAGES###'] = $this->renderImages($termArray);
254 $markerArray['###RELATED###'] = $this->renderRelated($termArray);
255 $markerArray['###TERM_LANG###'] = $this->pi_getLL('lang.'.$termArray['term_lang'])?$this->pi_getLL('lang.'.$termArray['term_lang']):$this->pi_getLL('na');
256
257 $labelWrap = array();
258 $labelWrap['wrap'] = $typeConfigArray['labelWrap1']?$typeConfigArray['labelWrap1']:$this->conf['labelWrap1'];
259 $markerArray['###TERM_TYPE_LABEL###'] = $markerArray['###TERM_TYPE###']?$this->local_cObj->stdWrap($this->pi_getLL('term_type'),$labelWrap):'';
260 $markerArray['###TERM_LABEL###'] = $this->local_cObj->stdWrap($this->pi_getLL('term'),$labelWrap);
261 $markerArray['###TERM_MAIN_LABEL###'] = $this->local_cObj->stdWrap($this->pi_getLL('term_main'),$labelWrap);
262 $markerArray['###TERM_ALT_LABEL###'] = $markerArray['###TERM_ALT###']?$this->local_cObj->stdWrap($this->pi_getLL('term_alt'),$labelWrap):'';
263 $markerArray['###TERM_REPLACE_LABEL###'] = $markerArray['###TERM_REPLACE###']?$this->local_cObj->stdWrap($this->pi_getLL('term_replace'),$labelWrap):'';
264 $markerArray['###DESC_SHORT_LABEL###'] = $markerArray['###DESC_SHORT###']?$this->local_cObj->stdWrap($this->pi_getLL('desc_short'),$labelWrap):'';
265 $markerArray['###DESC_LONG_LABEL###'] = $markerArray['###DESC_LONG###']?$this->local_cObj->stdWrap($this->pi_getLL('desc_long'),$labelWrap):'';
266 $markerArray['###RELATED_LABEL###'] = $markerArray['###RELATED###']?$this->local_cObj->stdWrap($this->pi_getLL('related'),$labelWrap):'';
267 $markerArray['###IMAGES_LABEL###'] = $markerArray['###IMAGES###']?$this->local_cObj->stdWrap($this->pi_getLL('images'),$labelWrap):'';
268 $markerArray['###TERM_LANG_LABEL###'] = $markerArray['###TERM_LANG###']?$this->local_cObj->stdWrap($this->pi_getLL('term_lang'),$labelWrap):'';
269
270 // make "more..." link
271 $markerArray['###DETAILS###'] = $this->pi_getLL('details');
272 $typolinkConf = $this->typolinkConf;
273 if (!empty($typeConfigArray['typolink.'])) {
274 $typolinkConf = t3lib_div::array_merge_recursive_overrule($typolinkConf, $typeConfigArray['typolink.']);
275 }
276 $typolinkConf['additionalParams'] .= '&' . $this->prefixId . '[termSource]=' . $termArray['sourceName'] . '&' . $this->prefixId . '[termUid]=' . $termArray['uid'];
277 $typolinkConf['parameter'] = $termArray['listPages'][0];
278 $this->typolinkConf['parameter.']['current'] = 0;
279 $typolinkConf['parameter.']['wrap'] = "|,".$GLOBALS['TSFE']->type;
280 $wrappedSubpartArray['###LINK_DETAILS###'] = $this->local_cObj->typolinkWrap($typolinkConf);
281 }
282
283 function renderRelated($term) {
284 $relatedCode = '';
285 if (is_array($term['related'])) {
286 foreach ($term['related'] as $termReference) {
287 $result = $this->model->findTermByUid($termReference['sourceName'], $termReference['uid']);
288 $key = key($result);
289 if (array_key_exists($key, $this->termsArray)) {
290 $relatedTerm = current($result);
291 $typolinkConf = $this->typolinkConf;
292 if (!empty($typeConfigArray['typolink.'])) {
293 $typolinkConf = t3lib_div::array_merge_recursive_overrule($typolinkConf, $typeConfigArray['typolink.']);
294 }
295 $typolinkConf['useCacheHash'] = 1;
296 $typolinkConf['additionalParams'] .= '&' . $this->prefixId . '[termSource]=' . $relatedTerm['sourceName'] . '&' . $this->prefixId . '[termUid]=' . $relatedTerm['uid'];
297 $typolinkConf['parameter.']['wrap'] = "|,".$GLOBALS['TSFE']->type;
298 $relatedCode .= $this->local_cObj->stdWrap($this->local_cObj->typoLink($relatedTerm['term'], $typolinkConf), $this->conf['related.']['single.']['stdWrap.']);
299 }
300 }
301 return $this->local_cObj->stdWrap(trim($relatedCode), $this->conf['related.']['stdWrap.']);
302 } else {
303 return NULL;
304 }
305 }
306
307 function renderImages($termArray) {
308 $images = array();
309 $imagesCaption = array();
310 $imagesAltText = array();
311 $imagesTitleText = array();
312 $imagesCode = '';
313 $imagesConf = $this->conf['images.']['single.'];
314 $extConfArray = unserialize($GLOBALS['TYPO3_CONF_VARS']['EXT']['extConf']['contagged']);
315 if ( $extConfArray['getImagesFromDAM'] > 0 && t3lib_extMgm::isLoaded('dam') ) {
316 $res = $GLOBALS['TYPO3_DB']->exec_SELECT_mm_query(
317 'tx_dam.file_path, tx_dam.file_name, tx_dam.alt_text, tx_dam.caption, tx_dam.title',
318 'tx_dam', 'tx_dam_mm_ref', 'tx_contagged_terms',
319 'AND tx_dam_mm_ref.tablenames = "tx_contagged_terms" AND tx_dam_mm_ref.ident="dam_images" ' .
320 'AND tx_dam_mm_ref.uid_foreign = "' . $termArray['uid'] . '"', '', 'tx_dam_mm_ref.sorting_foreign ASC'
321 );
322 while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
323 $images[] = $row['file_path'] . $row['file_name'];
324 $imagesCaption[] = str_replace(array(chr(10),chr(13)), ' ', $row['caption'] . ' ');
325 $imagesAltText[] = str_replace(array(chr(10),chr(13)), ' ', $row['alt_text'] . ' ');
326 $imagesTitleText[] = str_replace(array(chr(10),chr(13)), ' ', $row['title'] . ' ');
327 }
328 } else {
329 $images = t3lib_div::trimExplode(',', $termArray['image'], 1);
330 $imagesWithPath = array();
331 foreach ($images as $image) {
332 $imagesWithPath[] = 'uploads/pics/' . $image;
333 }
334 $images = $imagesWithPath;
335 $imagesCaption = t3lib_div::trimExplode(chr(10), $termArray['imagecaption']);
336 $imagesAltText = t3lib_div::trimExplode(chr(10), $termArray['imagealt']);
337 $imagesTitleText = t3lib_div::trimExplode(chr(10), $termArray['imagetitle']);
338 }
339
340 if (!empty($images)) {
341 foreach ($images as $key => $image) {
342 $imagesConf['image.']['file'] = $image;
343 $imagesConf['image.']['altText'] = $imagesAltText[$key];
344 $imagesConf['image.']['titleText'] = $imagesTitleText[$key];
345 $caption = $imagesCaption[$key] != '' ? $this->local_cObj->stdWrap($imagesCaption[$key], $this->conf['images.']['caption.']['stdWrap.']) : '';
346 $imagesCode .= $this->local_cObj->IMAGE($imagesConf['image.']);
347 $imagesCode .= $caption;
348 }
349 return $this->local_cObj->stdWrap(trim($imagesCode), $this->conf['images.']['stdWrap.']);
350 } else {
351 return NULL;
352 }
353
354 }
355
356 function renderIndex(&$markerArray) {
357 if ($this->conf['index.']['enable'] > 0) {
358 $subparts = array();
359 $subparts['template_index'] = $this->cObj->getSubpart($this->templateCode,'###TEMPLATE_INDEX###');
360 $subparts['item'] = $this->cObj->getSubpart($subparts['template_index'],'###ITEM###');
361
362 $indexArray = $this->getIndexArray();
363
364 // wrap index chars and add a class attribute if there is a selected index char.
365 foreach ($indexArray as $indexChar => $link) {
366 $cssClass = '';
367 if ($this->piVars['index']==$indexChar) {
368 $cssClass = " class='tx-contagged-act'";
369 }
370 if ($link) {
371 $markerArray['###SINGLE_CHAR###'] = '<span' . $cssClass . '>' . $link . '</span>';
372 } elseif ($this->conf['index.']['showOnlyMatchedIndexChars'] == 0) {
373 $markerArray['###SINGLE_CHAR###'] = '<span' . $cssClass . '>' . $indexChar . '</span>';
374 } else {
375 $markerArray['###SINGLE_CHAR###'] = '';
376 }
377 $subpartArray['###INDEX_CONTENT###'] .= $this->cObj->substituteMarkerArrayCached($subparts['item'], $markerArray);
378 }
379 $markerArray['###INDEX###'] = $this->cObj->substituteMarkerArrayCached($subparts['template_index'], $markerArray, $subpartArray);
380 } else {
381 $markerArray['###INDEX###'] = '';
382 }
383 }
384
385 function getIndexArray() {
386 $indexArray = array();
387 $reverseIndexArray = array();
388 // Get localized index chars.
389 foreach (t3lib_div::trimExplode(',', $this->pi_getLL('indexChars')) as $key => $value) {
390 $subCharArray = t3lib_div::trimExplode('|', $value);
391 $indexArray[$subCharArray[0]] = NULL;
392 foreach($subCharArray as $subChar) {
393 $reverseIndexArray[$subChar] = $subCharArray[0];
394 }
395 }
396
397 // The configuered subchars like Ö will be linked as O (see documentation and file "locallang.xml").
398 $typolinkConf = $this->typolinkConf;
399 foreach ($this->termsArray as $termKey => $termArray) {
400 if ( $termArray['exclude']!=1 && $this->conf['types.'][$termArray['term_type'].'.']['dontListTerms']!=1 && in_array($GLOBALS['TSFE']->id,$termArray['listPages']) ) {
401 $sortField = $this->model->getSortField($termArray);
402 foreach ($reverseIndexArray as $subChar => $indexChar) {
403 if ( preg_match('/^'.preg_quote($subChar).'/' . $this->conf['modifier'],$termArray[$sortField])>0 ) {
404 $typolinkConf['additionalParams'] = '&' . $this->prefixId . '[index]=' . $indexChar;
405 $indexArray[$indexChar] = $this->local_cObj->typolink($indexChar, $typolinkConf);
406 $this->termsArray[$termKey]['indexChar'] = $indexChar;
407 }
408 }
409 // If the term matches no given index char, crate one if desired and add it to the index
410 if ( ($this->termsArray[$termKey]['indexChar'] == '') && ($this->conf['index.']['autoAddIndexChars'] == 1) ) {
411 // get the first char of the term (UTF8)
412 // TODO: Make the RegEx configurable to make ZIP-Codes possible
413 preg_match('/^./' . $this->conf['modifier'],$termArray[$sortField],$match);
414 $newIndexChar = $match[0];
415 $indexArray[$newIndexChar] = NULL;
416 $typolinkConf['additionalParams'] .= '&' . $this->prefixId . '[index]=' . urlencode($newIndexChar);
417 $indexArray[$newIndexChar] = $this->local_cObj->typolink($newIndexChar, $typolinkConf);
418 $this->termsArray[$termKey]['indexChar'] = $newIndexChar;
419 }
420 }
421 }
422
423 // TODO Sorting of the index (UTF8)
424 ksort($indexArray,SORT_LOCALE_STRING);
425
426 return $indexArray;
427 }
428
429 function renderPageBrowser(&$markerArray, $resultCount) {
430 // setup the page browser
431 $this->internal['res_count'] = $resultCount;
432 $this->internal['results_at_a_time'] = $this->conf['pagebrowser.']['results_at_a_time'] ? intval($this->conf['pagebrowser.']['results_at_a_time']) : 20;
433 $this->internal['maxPages'] = $this->conf['pagebrowser.']['maxPages'] ? intval($this->conf['pagebrowser.']['maxPages']) : 3;
434 $this->internal['dontLinkActivePage'] = $this->conf['pagebrowser.']['dontLinkActivePage'] ? (boolean)$this->conf['pagebrowser.']['dontLinkActivePage'] : FALSE;
435 $this->internal['showFirstLast'] = $this->conf['pagebrowser.']['showFirstLast'] ? (boolean)$this->conf['pagebrowser.']['showFirstLast'] : FALSE;
436 $this->internal['pagefloat'] = 'center';
437 if ( ($this->internal['res_count'] > $this->internal['results_at_a_time']) && ($this->conf['pagebrowser.']['enable'] > 0)) {
438 $showResultCount = $this->conf['pagebrowser.']['showResultCount'] ? (boolean)$this->conf['pagebrowser.']['showResultCount'] : FALSE;
439 $markerArray['###PAGEBROWSER###'] = $this->pi_list_browseresults($showResultCount);
440 } else {
441 $markerArray['###PAGEBROWSER###'] = '';
442 }
443 }
444
445 function renderSearchBox(&$markerArray) {
446 if ($this->conf['searchbox.']['enable'] > 0) {
447 $markerArray['###SEARCHBOX###'] = $this->pi_list_searchBox();
448 } else {
449 $markerArray['###SEARCHBOX###'] = '';
450 }
451 }
452
453 protected function removeUnfilledMarker($content) {
454 return preg_replace('/###.*?###/', '', $content);
455 }
456
457 }
458
459
460 if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/contagged/pi1/class.tx_contagged_pi1.php']) {
461 include_once ($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/contagged/pi1/class.tx_contagged_pi1.php']);
462 }
463 ?>