~slub.team/goobi-presentation/old-bzr-trunk

« back to all changes in this revision

Viewing changes to dlf/plugins/listview/class.tx_dlf_listview.php

  • Committer: Sebastian Meyer
  • Date: 2012-09-13 17:53:13 UTC
  • mfrom: (84.1.21 F404M)
  • Revision ID: sebastian.meyer@slub-dresden.de-20120913175313-3mrnzcpff0ugqbqy
Fix Bug #956155: Add preview image to listview

Show diffs side-by-side

added added

removed removed

Lines of Context:
29
29
/**
30
30
 * Plugin 'DLF: List View' for the 'dlf' extension.
31
31
 *
32
 
 * @author      Sebastian Meyer <sebastian.meyer@slub-dresden.de>
 
32
 * @author      Sebastian Meyer <sebastian.meyer@slub-dresden.de>, Henrik Lochmann <dev@mentalmotive.com>
33
33
 * @copyright   Copyright (c) 2011, Sebastian Meyer, SLUB Dresden
34
34
 * @package     TYPO3
35
35
 * @subpackage  tx_dlf
158
158
 
159
159
                $markerArray['###METADATA###'] = '';
160
160
 
 
161
                $markerArray['###THUMBNAIL###'] = '';
 
162
 
161
163
                $subpart = '';
162
164
 
163
 
                $element = $this->list->elements[$number];
 
165
                $imgAlt = '';
 
166
 
 
167
                $metadata = $this->list->elements[$number]['metadata'];
164
168
 
165
169
                foreach ($this->metadata as $index_name => $metaConf) {
166
170
 
170
174
 
171
175
                        do {
172
176
 
173
 
                                $value = @array_shift($element['metadata'][$index_name]);
 
177
                                $value = @array_shift($metadata[$index_name]);
174
178
 
175
179
                                // Link title to pageview.
176
180
                                if ($index_name == 'title') {
178
182
                                        // Get title of parent document if needed.
179
183
                                        if (empty($value) && $this->conf['getTitle']) {
180
184
 
181
 
                                                $value = '['.tx_dlf_document::getTitle($element['uid'], TRUE).']';
 
185
                                                $value = '['.tx_dlf_document::getTitle($this->list->elements[$number]['uid'], TRUE).']';
182
186
 
183
187
                                        }
184
188
 
189
193
 
190
194
                                        }
191
195
 
192
 
                                        $value = $this->pi_linkTP(htmlspecialchars($value), array ($this->prefixId => array ('id' => $this->list->elements[$number]['uid'], 'page' => $element['page'], 'pointer' => $this->piVars['pointer'])), TRUE, $this->conf['targetPid']);
 
196
                                        $imgAlt = htmlspecialchars($value);
 
197
 
 
198
                                        $value = $this->pi_linkTP(htmlspecialchars($value), array ($this->prefixId => array ('id' => $this->list->elements[$number]['uid'], 'page' => $this->list->elements[$number]['page'], 'pointer' => $this->piVars['pointer'])), TRUE, $this->conf['targetPid']);
193
199
 
194
200
                                // Translate name of holding library.
195
201
                                } elseif ($index_name == 'owner' && !empty($value)) {
220
226
 
221
227
                                }
222
228
 
223
 
                        } while (count($element['metadata'][$index_name]));
 
229
                        } while (count($metadata[$index_name]));
224
230
 
225
231
                        if (!empty($parsedValue)) {
226
232
 
234
240
 
235
241
                }
236
242
 
237
 
                if (!empty($element['subparts'])) {
 
243
                // Add thumbnail.
 
244
                if (!empty($this->list->elements[$number]['thumbnail'])) {
 
245
 
 
246
                        $markerArray['###THUMBNAIL###'] = '<img alt="'.$imgAlt.'" src="'.$this->list->elements[$number]['thumbnail'].'" />';
 
247
 
 
248
                }
 
249
 
 
250
                if (!empty($this->list->elements[$number]['subparts'])) {
238
251
 
239
252
                        $subpart = $this->getSubEntries($number, $template);
240
253
 
329
342
 
330
343
                        $markerArray['###SUBMETADATA###'] = '';
331
344
 
 
345
                        $markerArray['###SUBTHUMBNAIL###'] = '';
 
346
 
 
347
                        $imgAlt = '';
 
348
 
332
349
                        foreach ($this->metadata as $index_name => $metaConf) {
333
350
 
334
351
                                $parsedValue = '';
356
373
 
357
374
                                                }
358
375
 
 
376
                                                $imgAlt = htmlspecialchars($value);
 
377
 
359
378
                                                $value = $this->pi_linkTP(htmlspecialchars($value), array ($this->prefixId => array ('id' => $subpart['uid'], 'page' => $subpart['page'], 'pointer' => $this->piVars['pointer'])), TRUE, $this->conf['targetPid']);
360
379
 
361
380
                                        // Translate name of holding library.
401
420
 
402
421
                        }
403
422
 
 
423
                        // Add thumbnail.
 
424
                        if (!empty($subpart['thumbnail'])) {
 
425
 
 
426
                                $markerArray['###SUBTHUMBNAIL###'] = '<img alt="'.$imgAlt.'" src="'.$subpart['thumbnail'].'" />';
 
427
 
 
428
                        }
 
429
 
404
430
                        $content .= $this->cObj->substituteMarkerArray($template['subentry'], $markerArray);
405
431
 
406
432
                }