Passed
Branch oai_solr_new_directory_structu... (24cd44)
by Erik
04:51
created
plugins/newspaper/class.tx_dlf_newspaper.php 1 patch
Indentation   +274 added lines, -274 removed lines patch added patch discarded remove patch
@@ -20,406 +20,406 @@
 block discarded – undo
20 20
  */
21 21
 class tx_dlf_newspaper extends tx_dlf_plugin {
22 22
 
23
-    public $extKey = 'dlf';
23
+	public $extKey = 'dlf';
24 24
 
25
-    public $scriptRelPath = 'plugins/newspaper/class.tx_dlf_newspaper.php';
25
+	public $scriptRelPath = 'plugins/newspaper/class.tx_dlf_newspaper.php';
26 26
 
27
-    /**
28
-     * The main method of the PlugIn
29
-     *
30
-     * @access	public
31
-     *
32
-     * @param	string		$content: The PlugIn content
33
-     * @param	array		$conf: The PlugIn configuration
34
-     *
35
-     * @return	string		The content that is displayed on the website
36
-     */
37
-    public function main($content, $conf) {
27
+	/**
28
+	 * The main method of the PlugIn
29
+	 *
30
+	 * @access	public
31
+	 *
32
+	 * @param	string		$content: The PlugIn content
33
+	 * @param	array		$conf: The PlugIn configuration
34
+	 *
35
+	 * @return	string		The content that is displayed on the website
36
+	 */
37
+	public function main($content, $conf) {
38 38
 
39
-        // Nothing to do here.
40
-        return $content;
39
+		// Nothing to do here.
40
+		return $content;
41 41
 
42
-    }
42
+	}
43 43
 
44
-    /**
45
-     * The Calendar Method
46
-     *
47
-     * @access	public
48
-     *
49
-     * @param	string		$content: The PlugIn content
50
-     * @param	array		$conf: The PlugIn configuration
51
-     *
52
-     * @return	string		The content that is displayed on the website
53
-     */
54
-    public function calendar($content, $conf) {
44
+	/**
45
+	 * The Calendar Method
46
+	 *
47
+	 * @access	public
48
+	 *
49
+	 * @param	string		$content: The PlugIn content
50
+	 * @param	array		$conf: The PlugIn configuration
51
+	 *
52
+	 * @return	string		The content that is displayed on the website
53
+	 */
54
+	public function calendar($content, $conf) {
55 55
 
56
-        $this->init($conf);
56
+		$this->init($conf);
57 57
 
58
-        // Load current document.
59
-        $this->loadDocument();
58
+		// Load current document.
59
+		$this->loadDocument();
60 60
 
61
-        if ($this->doc === NULL) {
61
+		if ($this->doc === NULL) {
62 62
 
63
-            // Quit without doing anything if required variables are not set.
64
-            return $content;
63
+			// Quit without doing anything if required variables are not set.
64
+			return $content;
65 65
 
66
-        }
66
+		}
67 67
 
68
-        // Load template file.
69
-        if (!empty($this->conf['templateFile'])) {
68
+		// Load template file.
69
+		if (!empty($this->conf['templateFile'])) {
70 70
 
71
-            $this->template = $this->cObj->getSubpart($this->cObj->fileResource($this->conf['templateFile']), '###TEMPLATECALENDAR###');
71
+			$this->template = $this->cObj->getSubpart($this->cObj->fileResource($this->conf['templateFile']), '###TEMPLATECALENDAR###');
72 72
 
73
-        } else {
73
+		} else {
74 74
 
75
-            $this->template = $this->cObj->getSubpart($this->cObj->fileResource('EXT:dlf/plugins/newspaper/template.tmpl'), '###TEMPLATECALENDAR###');
75
+			$this->template = $this->cObj->getSubpart($this->cObj->fileResource('EXT:dlf/plugins/newspaper/template.tmpl'), '###TEMPLATECALENDAR###');
76 76
 
77
-        }
77
+		}
78 78
 
79
-        // Get all children of year anchor.
80
-        $result = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
81
-            'tx_dlf_documents.uid AS uid, tx_dlf_documents.title AS title, tx_dlf_documents.year AS year',
82
-            'tx_dlf_documents',
83
-            '(tx_dlf_documents.structure='.tx_dlf_helper::getIdFromIndexName('issue', 'tx_dlf_structures', $this->doc->pid).' AND tx_dlf_documents.partof='.intval($this->doc->uid).')'.tx_dlf_helper::whereClause('tx_dlf_documents'),
84
-            '',
85
-            'title ASC',
86
-            ''
87
-        );
79
+		// Get all children of year anchor.
80
+		$result = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
81
+			'tx_dlf_documents.uid AS uid, tx_dlf_documents.title AS title, tx_dlf_documents.year AS year',
82
+			'tx_dlf_documents',
83
+			'(tx_dlf_documents.structure='.tx_dlf_helper::getIdFromIndexName('issue', 'tx_dlf_structures', $this->doc->pid).' AND tx_dlf_documents.partof='.intval($this->doc->uid).')'.tx_dlf_helper::whereClause('tx_dlf_documents'),
84
+			'',
85
+			'title ASC',
86
+			''
87
+		);
88 88
 
89
-        // Process results.
90
-        while ($resArray = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($result)) {
89
+		// Process results.
90
+		while ($resArray = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($result)) {
91 91
 
92
-            $issues[] = array (
93
-                'uid' => $resArray['uid'],
94
-                'title' => $resArray['title'],
95
-                'year' => $resArray['year']
96
-            );
92
+			$issues[] = array (
93
+				'uid' => $resArray['uid'],
94
+				'title' => $resArray['title'],
95
+				'year' => $resArray['year']
96
+			);
97 97
 
98
-        }
98
+		}
99 99
 
100
-        // 	We need an array of issues with month number as key.
101
-        $calendarIssues = array ();
100
+		// 	We need an array of issues with month number as key.
101
+		$calendarIssues = array ();
102 102
 
103
-        foreach ($issues as $issue) {
103
+		foreach ($issues as $issue) {
104 104
 
105
-            $calendarIssues[date('n', strtotime($issue['year']))][date('j', strtotime($issue['year']))][] = $issue;
105
+			$calendarIssues[date('n', strtotime($issue['year']))][date('j', strtotime($issue['year']))][] = $issue;
106 106
 
107
-        }
107
+		}
108 108
 
109
-        $allIssues = array ();
109
+		$allIssues = array ();
110 110
 
111
-        // Get subpart templates.
112
-        $subparts['list'] = $this->cObj->getSubpart($this->template, '###ISSUELIST###');
111
+		// Get subpart templates.
112
+		$subparts['list'] = $this->cObj->getSubpart($this->template, '###ISSUELIST###');
113 113
 
114
-        $subparts['month'] = $this->cObj->getSubpart($this->template, '###CALMONTH###');
114
+		$subparts['month'] = $this->cObj->getSubpart($this->template, '###CALMONTH###');
115 115
 
116
-        $subparts['week'] = $this->cObj->getSubpart($subparts['month'], '###CALWEEK###');
116
+		$subparts['week'] = $this->cObj->getSubpart($subparts['month'], '###CALWEEK###');
117 117
 
118
-        $subparts['singleday'] = $this->cObj->getSubpart($subparts['list'], '###SINGLEDAY###');
118
+		$subparts['singleday'] = $this->cObj->getSubpart($subparts['list'], '###SINGLEDAY###');
119 119
 
120
-        // Build calendar for given year.
121
-        $year = date('Y', strtotime($issues[0]['year']));
120
+		// Build calendar for given year.
121
+		$year = date('Y', strtotime($issues[0]['year']));
122 122
 
123
-        for ($i = 0; $i <= 11; $i++) {
123
+		for ($i = 0; $i <= 11; $i++) {
124 124
 
125
-            $markerArray = array (
126
-                '###DAYMON_NAME###' => strftime('%a', strtotime('last Monday')),
127
-                '###DAYTUE_NAME###' => strftime('%a', strtotime('last Tuesday')),
128
-                '###DAYWED_NAME###' => strftime('%a', strtotime('last Wednesday')),
129
-                '###DAYTHU_NAME###' => strftime('%a', strtotime('last Thursday')),
130
-                '###DAYFRI_NAME###' => strftime('%a', strtotime('last Friday')),
131
-                '###DAYSAT_NAME###' => strftime('%a', strtotime('last Saturday')),
132
-                '###DAYSUN_NAME###' => strftime('%a', strtotime('last Sunday')),
133
-                '###MONTHNAME###' 	=> strftime('%B', strtotime($year.'-'.($i + 1).'-1'))
134
-            );
125
+			$markerArray = array (
126
+				'###DAYMON_NAME###' => strftime('%a', strtotime('last Monday')),
127
+				'###DAYTUE_NAME###' => strftime('%a', strtotime('last Tuesday')),
128
+				'###DAYWED_NAME###' => strftime('%a', strtotime('last Wednesday')),
129
+				'###DAYTHU_NAME###' => strftime('%a', strtotime('last Thursday')),
130
+				'###DAYFRI_NAME###' => strftime('%a', strtotime('last Friday')),
131
+				'###DAYSAT_NAME###' => strftime('%a', strtotime('last Saturday')),
132
+				'###DAYSUN_NAME###' => strftime('%a', strtotime('last Sunday')),
133
+				'###MONTHNAME###' 	=> strftime('%B', strtotime($year.'-'.($i + 1).'-1'))
134
+			);
135 135
 
136
-            // Reset week content of new month.
137
-            $subWeekPartContent = '';
136
+			// Reset week content of new month.
137
+			$subWeekPartContent = '';
138 138
 
139
-            $firstOfMonth = strtotime($year.'-'.($i + 1).'-1');
140
-            $lastOfMonth = strtotime('last day of', ($firstOfMonth));
141
-            $firstOfMonthStart = strtotime('last Monday', $firstOfMonth);
139
+			$firstOfMonth = strtotime($year.'-'.($i + 1).'-1');
140
+			$lastOfMonth = strtotime('last day of', ($firstOfMonth));
141
+			$firstOfMonthStart = strtotime('last Monday', $firstOfMonth);
142 142
 
143
-            // There are never more than 6 weeks in a month.
144
-            for ($j = 0; $j <= 5; $j++) {
143
+			// There are never more than 6 weeks in a month.
144
+			for ($j = 0; $j <= 5; $j++) {
145 145
 
146
-                $firstDayOfWeek = strtotime('+ '.$j.' Week', $firstOfMonthStart);
146
+				$firstDayOfWeek = strtotime('+ '.$j.' Week', $firstOfMonthStart);
147 147
 
148
-                $weekArray = array (
149
-                    '###DAYMON###' => '&nbsp;',
150
-                    '###DAYTUE###' => '&nbsp;',
151
-                    '###DAYWED###' => '&nbsp;',
152
-                    '###DAYTHU###' => '&nbsp;',
153
-                    '###DAYFRI###' => '&nbsp;',
154
-                    '###DAYSAT###' => '&nbsp;',
155
-                    '###DAYSUN###' => '&nbsp;',
156
-                );
148
+				$weekArray = array (
149
+					'###DAYMON###' => '&nbsp;',
150
+					'###DAYTUE###' => '&nbsp;',
151
+					'###DAYWED###' => '&nbsp;',
152
+					'###DAYTHU###' => '&nbsp;',
153
+					'###DAYFRI###' => '&nbsp;',
154
+					'###DAYSAT###' => '&nbsp;',
155
+					'###DAYSUN###' => '&nbsp;',
156
+				);
157 157
 
158
-                // Every week has seven days. ;-)
159
-                for ($k = 0; $k <= 6; $k++) {
158
+				// Every week has seven days. ;-)
159
+				for ($k = 0; $k <= 6; $k++) {
160 160
 
161
-                    $currentDayTime = strtotime('+ '.$k.' Day', $firstDayOfWeek);
161
+					$currentDayTime = strtotime('+ '.$k.' Day', $firstDayOfWeek);
162 162
 
163
-                    if ($currentDayTime >= $firstOfMonth && $currentDayTime <= $lastOfMonth) {
163
+					if ($currentDayTime >= $firstOfMonth && $currentDayTime <= $lastOfMonth) {
164 164
 
165
-                        $dayLinks = '';
165
+						$dayLinks = '';
166 166
 
167
-                        $dayLinksText = array ();
167
+						$dayLinksText = array ();
168 168
 
169
-                        $dayLinksList = '';
169
+						$dayLinksList = '';
170 170
 
171
-                        $currentMonth = date('n', $currentDayTime);
171
+						$currentMonth = date('n', $currentDayTime);
172 172
 
173
-                        if (is_array($calendarIssues[$currentMonth])) {
173
+						if (is_array($calendarIssues[$currentMonth])) {
174 174
 
175
-                            foreach ($calendarIssues[$currentMonth] as $id => $day) {
175
+							foreach ($calendarIssues[$currentMonth] as $id => $day) {
176 176
 
177
-                                if ($id == date('j', $currentDayTime)) {
177
+								if ($id == date('j', $currentDayTime)) {
178 178
 
179
-                                    $dayLinks = $id;
179
+									$dayLinks = $id;
180 180
 
181
-                                    foreach ($day as $issue) {
181
+									foreach ($day as $issue) {
182 182
 
183
-                                        $dayLinkLabel = empty($issue['title']) ? strftime('%x', $currentDayTime) : $issue['title'];
183
+										$dayLinkLabel = empty($issue['title']) ? strftime('%x', $currentDayTime) : $issue['title'];
184 184
 
185
-                                        $linkConf = array (
186
-                                            'useCacheHash' => 1,
187
-                                            'parameter' => $this->conf['targetPid'],
188
-                                            'additionalParams' => '&'.$this->prefixId.'[id]='.urlencode($issue['uid']),
189
-                                            'ATagParams' => ' class="title"',
190
-                                        );
185
+										$linkConf = array (
186
+											'useCacheHash' => 1,
187
+											'parameter' => $this->conf['targetPid'],
188
+											'additionalParams' => '&'.$this->prefixId.'[id]='.urlencode($issue['uid']),
189
+											'ATagParams' => ' class="title"',
190
+										);
191 191
 
192
-                                        $dayLinksText[] = $this->cObj->typoLink($dayLinkLabel, $linkConf);
192
+										$dayLinksText[] = $this->cObj->typoLink($dayLinkLabel, $linkConf);
193 193
 
194
-                                        // Save issues for list view.
195
-                                        $allIssues[$currentDayTime][] = $this->cObj->typoLink($dayLinkLabel, $linkConf);
196
-                                    }
197
-                                }
194
+										// Save issues for list view.
195
+										$allIssues[$currentDayTime][] = $this->cObj->typoLink($dayLinkLabel, $linkConf);
196
+									}
197
+								}
198 198
 
199
-                            }
199
+							}
200 200
 
201
-                            if (!empty($dayLinksText)) {
201
+							if (!empty($dayLinksText)) {
202 202
 
203
-                                $dayLinksList = '<ul>';
203
+								$dayLinksList = '<ul>';
204 204
 
205
-                                foreach ($dayLinksText as $link) {
205
+								foreach ($dayLinksText as $link) {
206 206
 
207
-                                    $dayLinksList .= '<li>'.$link.'</li>';
207
+									$dayLinksList .= '<li>'.$link.'</li>';
208 208
 
209
-                                }
209
+								}
210 210
 
211
-                                $dayLinksList .= '</ul>';
211
+								$dayLinksList .= '</ul>';
212 212
 
213
-                            }
213
+							}
214 214
 
215
-                            $dayLinkDiv = '<div class="issues"><h4>'.strftime('%d', $currentDayTime).'</h4><div>'.$dayLinksList.'</div></div>';
216
-                        }
215
+							$dayLinkDiv = '<div class="issues"><h4>'.strftime('%d', $currentDayTime).'</h4><div>'.$dayLinksList.'</div></div>';
216
+						}
217 217
 
218
-                        switch (strftime('%w', strtotime('+ '.$k.' Day', $firstDayOfWeek))) {
218
+						switch (strftime('%w', strtotime('+ '.$k.' Day', $firstDayOfWeek))) {
219 219
 
220
-                            case '0': $weekArray['###DAYSUN###'] = ((int) $dayLinks === (int) date('j', $currentDayTime)) ? $dayLinkDiv : strftime('%d', $currentDayTime);
221
-                                break;
220
+							case '0': $weekArray['###DAYSUN###'] = ((int) $dayLinks === (int) date('j', $currentDayTime)) ? $dayLinkDiv : strftime('%d', $currentDayTime);
221
+								break;
222 222
 
223
-                            case '1': $weekArray['###DAYMON###'] = ((int) $dayLinks === (int) date('j', $currentDayTime)) ? $dayLinkDiv : strftime('%d', $currentDayTime);
224
-                                break;
223
+							case '1': $weekArray['###DAYMON###'] = ((int) $dayLinks === (int) date('j', $currentDayTime)) ? $dayLinkDiv : strftime('%d', $currentDayTime);
224
+								break;
225 225
 
226
-                            case '2': $weekArray['###DAYTUE###'] = ((int) $dayLinks === (int) date('j', $currentDayTime)) ? $dayLinkDiv : strftime('%d', $currentDayTime);
227
-                                break;
226
+							case '2': $weekArray['###DAYTUE###'] = ((int) $dayLinks === (int) date('j', $currentDayTime)) ? $dayLinkDiv : strftime('%d', $currentDayTime);
227
+								break;
228 228
 
229
-                            case '3': $weekArray['###DAYWED###'] = ((int) $dayLinks === (int) date('j', $currentDayTime)) ? $dayLinkDiv : strftime('%d', $currentDayTime);
230
-                                break;
229
+							case '3': $weekArray['###DAYWED###'] = ((int) $dayLinks === (int) date('j', $currentDayTime)) ? $dayLinkDiv : strftime('%d', $currentDayTime);
230
+								break;
231 231
 
232
-                            case '4': $weekArray['###DAYTHU###'] = ((int) $dayLinks === (int) date('j', $currentDayTime)) ? $dayLinkDiv : strftime('%d', $currentDayTime);
233
-                                break;
232
+							case '4': $weekArray['###DAYTHU###'] = ((int) $dayLinks === (int) date('j', $currentDayTime)) ? $dayLinkDiv : strftime('%d', $currentDayTime);
233
+								break;
234 234
 
235
-                            case '5': $weekArray['###DAYFRI###'] = ((int) $dayLinks === (int) date('j', $currentDayTime)) ? $dayLinkDiv : strftime('%d', $currentDayTime);
236
-                                break;
235
+							case '5': $weekArray['###DAYFRI###'] = ((int) $dayLinks === (int) date('j', $currentDayTime)) ? $dayLinkDiv : strftime('%d', $currentDayTime);
236
+								break;
237 237
 
238
-                            case '6': $weekArray['###DAYSAT###'] = ((int) $dayLinks === (int) date('j', $currentDayTime)) ? $dayLinkDiv : strftime('%d', $currentDayTime);
239
-                                break;
238
+							case '6': $weekArray['###DAYSAT###'] = ((int) $dayLinks === (int) date('j', $currentDayTime)) ? $dayLinkDiv : strftime('%d', $currentDayTime);
239
+								break;
240 240
 
241
-                        }
241
+						}
242 242
 
243
-                    }
243
+					}
244 244
 
245
-                }
245
+				}
246 246
 
247
-                // Fill the weeks.
248
-                $subWeekPartContent .= $this->cObj->substituteMarkerArray($subparts['week'], $weekArray);
247
+				// Fill the weeks.
248
+				$subWeekPartContent .= $this->cObj->substituteMarkerArray($subparts['week'], $weekArray);
249 249
 
250
-            }
250
+			}
251 251
 
252
-            // Fill the month markers.
253
-            $subPartContent .= $this->cObj->substituteMarkerArray($subparts['month'], $markerArray);
252
+			// Fill the month markers.
253
+			$subPartContent .= $this->cObj->substituteMarkerArray($subparts['month'], $markerArray);
254 254
 
255
-            // Fill the week markers with the week entries.
256
-            $subPartContent = $this->cObj->substituteSubpart($subPartContent, '###CALWEEK###', $subWeekPartContent);
257
-        }
255
+			// Fill the week markers with the week entries.
256
+			$subPartContent = $this->cObj->substituteSubpart($subPartContent, '###CALWEEK###', $subWeekPartContent);
257
+		}
258 258
 
259
-        // Link to years overview
260
-        $linkConf = array (
261
-            'useCacheHash' => 1,
262
-            'parameter' => $this->conf['targetPid'],
263
-            'additionalParams' => '&'.$this->prefixId.'[id]='.urlencode($this->doc->parentId),
264
-        );
259
+		// Link to years overview
260
+		$linkConf = array (
261
+			'useCacheHash' => 1,
262
+			'parameter' => $this->conf['targetPid'],
263
+			'additionalParams' => '&'.$this->prefixId.'[id]='.urlencode($this->doc->parentId),
264
+		);
265 265
 
266
-        $allYearsLink = $this->cObj->typoLink($this->pi_getLL('allYears', '', TRUE).' '.$this->doc->getTitle($this->doc->parentId), $linkConf);
266
+		$allYearsLink = $this->cObj->typoLink($this->pi_getLL('allYears', '', TRUE).' '.$this->doc->getTitle($this->doc->parentId), $linkConf);
267 267
 
268
-        // Link to current year.
269
-        $linkConf = array (
270
-            'useCacheHash' => 1,
271
-            'parameter' => $this->conf['targetPid'],
272
-            'additionalParams' => '&'.$this->prefixId.'[id]='.urlencode($this->doc->uid),
273
-        );
268
+		// Link to current year.
269
+		$linkConf = array (
270
+			'useCacheHash' => 1,
271
+			'parameter' => $this->conf['targetPid'],
272
+			'additionalParams' => '&'.$this->prefixId.'[id]='.urlencode($this->doc->uid),
273
+		);
274 274
 
275
-        $yearLink = $this->cObj->typoLink($year, $linkConf);
275
+		$yearLink = $this->cObj->typoLink($year, $linkConf);
276 276
 
277
-        // Prepare list as alternative of the calendar view.
278
-        foreach ($allIssues as $dayTime => $issues) {
277
+		// Prepare list as alternative of the calendar view.
278
+		foreach ($allIssues as $dayTime => $issues) {
279 279
 
280
-            $markerArrayDay['###DATE_STRING###'] = strftime('%A, %x', $dayTime);
280
+			$markerArrayDay['###DATE_STRING###'] = strftime('%A, %x', $dayTime);
281 281
 
282
-            $markerArrayDay['###ITEMS###'] = '';
282
+			$markerArrayDay['###ITEMS###'] = '';
283 283
 
284
-            foreach ($issues as $issue) {
284
+			foreach ($issues as $issue) {
285 285
 
286
-                $markerArrayDay['###ITEMS###'] .= $issue;
286
+				$markerArrayDay['###ITEMS###'] .= $issue;
287 287
 
288
-            }
288
+			}
289 289
 
290
-            $subPartContentList .= $this->cObj->substituteMarkerArray($subparts['singleday'], $markerArrayDay);
290
+			$subPartContentList .= $this->cObj->substituteMarkerArray($subparts['singleday'], $markerArrayDay);
291 291
 
292
-        }
292
+		}
293 293
 
294
-        $this->template = $this->cObj->substituteSubpart($this->template, '###SINGLEDAY###', $subPartContentList);
294
+		$this->template = $this->cObj->substituteSubpart($this->template, '###SINGLEDAY###', $subPartContentList);
295 295
 
296
-        if (count($allIssues) < 6) {
296
+		if (count($allIssues) < 6) {
297 297
 
298
-            $listViewActive = TRUE;
298
+			$listViewActive = TRUE;
299 299
 
300
-        } else {
300
+		} else {
301 301
 
302
-            $listViewActive = FALSE;
302
+			$listViewActive = FALSE;
303 303
 
304
-        }
304
+		}
305 305
 
306
-        $markerArray = array (
307
-            '###CALENDARVIEWACTIVE###' => $listViewActive ? '' : 'active',
308
-            '###LISTVIEWACTIVE###' => $listViewActive ? 'active' : '',
309
-            '###CALYEAR###' => $yearLink,
310
-            '###CALALLYEARS###' => $allYearsLink,
311
-            '###LABEL_CALENDAR###' => $this->pi_getLL('label.view_calendar'),
312
-            '###LABEL_LIST_VIEW###' => $this->pi_getLL('label.view_list'),
313
-        );
306
+		$markerArray = array (
307
+			'###CALENDARVIEWACTIVE###' => $listViewActive ? '' : 'active',
308
+			'###LISTVIEWACTIVE###' => $listViewActive ? 'active' : '',
309
+			'###CALYEAR###' => $yearLink,
310
+			'###CALALLYEARS###' => $allYearsLink,
311
+			'###LABEL_CALENDAR###' => $this->pi_getLL('label.view_calendar'),
312
+			'###LABEL_LIST_VIEW###' => $this->pi_getLL('label.view_list'),
313
+		);
314 314
 
315
-        $this->template = $this->cObj->substituteMarkerArray($this->template, $markerArray);
315
+		$this->template = $this->cObj->substituteMarkerArray($this->template, $markerArray);
316 316
 
317
-        return $this->cObj->substituteSubpart($this->template, '###CALMONTH###', $subPartContent);
317
+		return $this->cObj->substituteSubpart($this->template, '###CALMONTH###', $subPartContent);
318 318
 
319
-    }
319
+	}
320 320
 
321
-    /**
322
-     * The Year Method
323
-     *
324
-     * @access	public
325
-     *
326
-     * @param	string		$content: The PlugIn content
327
-     * @param	array		$conf: The PlugIn configuration
328
-     *
329
-     * @return	string		The content that is displayed on the website
330
-     */
331
-    public function years($content, $conf) {
321
+	/**
322
+	 * The Year Method
323
+	 *
324
+	 * @access	public
325
+	 *
326
+	 * @param	string		$content: The PlugIn content
327
+	 * @param	array		$conf: The PlugIn configuration
328
+	 *
329
+	 * @return	string		The content that is displayed on the website
330
+	 */
331
+	public function years($content, $conf) {
332 332
 
333
-        $this->init($conf);
333
+		$this->init($conf);
334 334
 
335
-        // Load current document.
336
-        $this->loadDocument();
335
+		// Load current document.
336
+		$this->loadDocument();
337 337
 
338
-        if ($this->doc === NULL) {
338
+		if ($this->doc === NULL) {
339 339
 
340
-            // Quit without doing anything if required variables are not set.
341
-            return $content;
340
+			// Quit without doing anything if required variables are not set.
341
+			return $content;
342 342
 
343
-        }
343
+		}
344 344
 
345
-        // Load template file.
346
-        if (!empty($this->conf['templateFile'])) {
345
+		// Load template file.
346
+		if (!empty($this->conf['templateFile'])) {
347 347
 
348
-            $this->template = $this->cObj->getSubpart($this->cObj->fileResource($this->conf['templateFile']), '###TEMPLATEYEAR###');
348
+			$this->template = $this->cObj->getSubpart($this->cObj->fileResource($this->conf['templateFile']), '###TEMPLATEYEAR###');
349 349
 
350
-        } else {
350
+		} else {
351 351
 
352
-            $this->template = $this->cObj->getSubpart($this->cObj->fileResource('EXT:dlf/plugins/newspaper/template.tmpl'), '###TEMPLATEYEAR###');
352
+			$this->template = $this->cObj->getSubpart($this->cObj->fileResource('EXT:dlf/plugins/newspaper/template.tmpl'), '###TEMPLATEYEAR###');
353 353
 
354
-        }
354
+		}
355 355
 
356
-        // Get subpart templates
357
-        $subparts['year'] = $this->cObj->getSubpart($this->template, '###LISTYEAR###');
356
+		// Get subpart templates
357
+		$subparts['year'] = $this->cObj->getSubpart($this->template, '###LISTYEAR###');
358 358
 
359
-        // get the title of the anchor file
360
-        $titleAnchor = $this->doc->getTitle($this->doc->uid);
359
+		// get the title of the anchor file
360
+		$titleAnchor = $this->doc->getTitle($this->doc->uid);
361 361
 
362
-        // get all children of anchor. this should be the year anchor documents
363
-        $result = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
364
-            'tx_dlf_documents.uid AS uid, tx_dlf_documents.title AS title',
365
-            'tx_dlf_documents',
366
-            '(tx_dlf_documents.structure='.tx_dlf_helper::getIdFromIndexName('year', 'tx_dlf_structures', $this->doc->pid).' AND tx_dlf_documents.partof='.intval($this->doc->uid).')'.tx_dlf_helper::whereClause('tx_dlf_documents'),
367
-            '',
368
-            'title ASC',
369
-            ''
370
-        );
362
+		// get all children of anchor. this should be the year anchor documents
363
+		$result = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
364
+			'tx_dlf_documents.uid AS uid, tx_dlf_documents.title AS title',
365
+			'tx_dlf_documents',
366
+			'(tx_dlf_documents.structure='.tx_dlf_helper::getIdFromIndexName('year', 'tx_dlf_structures', $this->doc->pid).' AND tx_dlf_documents.partof='.intval($this->doc->uid).')'.tx_dlf_helper::whereClause('tx_dlf_documents'),
367
+			'',
368
+			'title ASC',
369
+			''
370
+		);
371 371
 
372
-        // Process results.
373
-        while ($resArray = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($result)) {
372
+		// Process results.
373
+		while ($resArray = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($result)) {
374 374
 
375
-            $years[] = array (
376
-                'title' => $resArray['title'],
377
-                'uid' => $resArray['uid']
378
-            );
375
+			$years[] = array (
376
+				'title' => $resArray['title'],
377
+				'uid' => $resArray['uid']
378
+			);
379 379
 
380
-        }
380
+		}
381 381
 
382
-        $subYearPartContent = '';
382
+		$subYearPartContent = '';
383 383
 
384
-        if (count($years) > 0) {
384
+		if (count($years) > 0) {
385 385
 
386
-            foreach ($years as $id => $year) {
386
+			foreach ($years as $id => $year) {
387 387
 
388
-                $linkConf = array (
389
-                    'useCacheHash' => 1,
390
-                    'parameter' => $this->conf['targetPid'],
391
-                    'additionalParams' => '&'.$this->prefixId.'[id]='.urlencode($year['uid']),
392
-                    'title' => $titleAnchor.': '.$year['title']
393
-                );
388
+				$linkConf = array (
389
+					'useCacheHash' => 1,
390
+					'parameter' => $this->conf['targetPid'],
391
+					'additionalParams' => '&'.$this->prefixId.'[id]='.urlencode($year['uid']),
392
+					'title' => $titleAnchor.': '.$year['title']
393
+				);
394 394
 
395
-                $yearArray = array (
396
-                    '###YEARNAME###' => $this->cObj->typoLink($year['title'], $linkConf),
397
-                );
395
+				$yearArray = array (
396
+					'###YEARNAME###' => $this->cObj->typoLink($year['title'], $linkConf),
397
+				);
398 398
 
399
-                $subYearPartContent .= $this->cObj->substituteMarkerArray($subparts['year'], $yearArray);
399
+				$subYearPartContent .= $this->cObj->substituteMarkerArray($subparts['year'], $yearArray);
400 400
 
401
-            }
402
-        }
401
+			}
402
+		}
403 403
 
404
-        // link to years overview (should be itself here)
405
-        $linkConf = array (
406
-            'useCacheHash' => 1,
407
-            'parameter' => $this->conf['targetPid'],
408
-            'additionalParams' => '&'.$this->prefixId.'[id]='.$this->doc->uid,
409
-        );
410
-        $allYearsLink = $this->cObj->typoLink($this->pi_getLL('allYears', '', TRUE).' '.$this->doc->getTitle($this->doc->uid), $linkConf);
404
+		// link to years overview (should be itself here)
405
+		$linkConf = array (
406
+			'useCacheHash' => 1,
407
+			'parameter' => $this->conf['targetPid'],
408
+			'additionalParams' => '&'.$this->prefixId.'[id]='.$this->doc->uid,
409
+		);
410
+		$allYearsLink = $this->cObj->typoLink($this->pi_getLL('allYears', '', TRUE).' '.$this->doc->getTitle($this->doc->uid), $linkConf);
411 411
 
412
-        // Fill markers.
413
-        $markerArray = array (
414
-            '###LABEL_CHOOSE_YEAR###' => $this->pi_getLL('label.please_choose_year'),
415
-            '###CALALLYEARS###' => $allYearsLink
416
-        );
412
+		// Fill markers.
413
+		$markerArray = array (
414
+			'###LABEL_CHOOSE_YEAR###' => $this->pi_getLL('label.please_choose_year'),
415
+			'###CALALLYEARS###' => $allYearsLink
416
+		);
417 417
 
418
-        $this->template = $this->cObj->substituteMarkerArray($this->template, $markerArray);
418
+		$this->template = $this->cObj->substituteMarkerArray($this->template, $markerArray);
419 419
 
420
-        // fill the week markers
421
-        return $this->cObj->substituteSubpart($this->template, '###LISTYEAR###', $subYearPartContent);
420
+		// fill the week markers
421
+		return $this->cObj->substituteSubpart($this->template, '###LISTYEAR###', $subYearPartContent);
422 422
 
423
-    }
423
+	}
424 424
 
425 425
 }
Please login to merge, or discard this patch.
plugins/pagegrid/class.tx_dlf_pagegrid.php 1 patch
Indentation   +162 added lines, -162 removed lines patch added patch discarded remove patch
@@ -20,271 +20,271 @@
 block discarded – undo
20 20
  */
21 21
 class tx_dlf_pagegrid extends tx_dlf_plugin {
22 22
 
23
-    public $scriptRelPath = 'plugins/pagegrid/class.tx_dlf_pagegrid.php';
23
+	public $scriptRelPath = 'plugins/pagegrid/class.tx_dlf_pagegrid.php';
24 24
 
25
-    /**
26
-     * Renders entry for one page of the current document.
27
-     *
28
-     * @access	protected
29
-     *
30
-     * @param	integer		$number: The page to render
31
-     * @param	string		$template: Parsed template subpart
32
-     *
33
-     * @return	string		The rendered entry ready for output
34
-     */
35
-    protected function getEntry($number, $template) {
25
+	/**
26
+	 * Renders entry for one page of the current document.
27
+	 *
28
+	 * @access	protected
29
+	 *
30
+	 * @param	integer		$number: The page to render
31
+	 * @param	string		$template: Parsed template subpart
32
+	 *
33
+	 * @return	string		The rendered entry ready for output
34
+	 */
35
+	protected function getEntry($number, $template) {
36 36
 
37
-        // Set current page if applicable.
38
-        if (!empty($this->piVars['page']) && $this->piVars['page'] == $number) {
37
+		// Set current page if applicable.
38
+		if (!empty($this->piVars['page']) && $this->piVars['page'] == $number) {
39 39
 
40
-            $markerArray['###STATE###'] = 'cur';
40
+			$markerArray['###STATE###'] = 'cur';
41 41
 
42
-        } else {
42
+		} else {
43 43
 
44
-            $markerArray['###STATE###'] = 'no';
44
+			$markerArray['###STATE###'] = 'no';
45 45
 
46
-        }
46
+		}
47 47
 
48
-        // Set page number.
49
-        $markerArray['###NUMBER###'] = $number;
48
+		// Set page number.
49
+		$markerArray['###NUMBER###'] = $number;
50 50
 
51
-        // Set pagination.
52
-        $markerArray['###PAGINATION###'] = $this->doc->physicalStructureInfo[$this->doc->physicalStructure[$number]]['orderlabel'];
51
+		// Set pagination.
52
+		$markerArray['###PAGINATION###'] = $this->doc->physicalStructureInfo[$this->doc->physicalStructure[$number]]['orderlabel'];
53 53
 
54
-        // Get thumbnail or placeholder.
55
-        if (!empty($this->doc->physicalStructureInfo[$this->doc->physicalStructure[$number]]['files'][$this->conf['fileGrpThumbs']])) {
54
+		// Get thumbnail or placeholder.
55
+		if (!empty($this->doc->physicalStructureInfo[$this->doc->physicalStructure[$number]]['files'][$this->conf['fileGrpThumbs']])) {
56 56
 
57
-            $thumbnailFile = $this->doc->getFileLocation($this->doc->physicalStructureInfo[$this->doc->physicalStructure[$number]]['files'][$this->conf['fileGrpThumbs']]);
57
+			$thumbnailFile = $this->doc->getFileLocation($this->doc->physicalStructureInfo[$this->doc->physicalStructure[$number]]['files'][$this->conf['fileGrpThumbs']]);
58 58
 
59
-        } elseif (!empty($this->conf['placeholder'])) {
59
+		} elseif (!empty($this->conf['placeholder'])) {
60 60
 
61
-            $thumbnailFile = $GLOBALS['TSFE']->tmpl->getFileName($this->conf['placeholder']);
61
+			$thumbnailFile = $GLOBALS['TSFE']->tmpl->getFileName($this->conf['placeholder']);
62 62
 
63
-        } else {
63
+		} else {
64 64
 
65
-            $thumbnailFile = \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::siteRelPath($this->extKey).'plugins/pagegrid/placeholder.jpg';
65
+			$thumbnailFile = \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::siteRelPath($this->extKey).'plugins/pagegrid/placeholder.jpg';
66 66
 
67
-        }
67
+		}
68 68
 
69
-        $thumbnail = '<img alt="'.$markerArray['###PAGINATION###'].'" src="'.$thumbnailFile.'" />';
69
+		$thumbnail = '<img alt="'.$markerArray['###PAGINATION###'].'" src="'.$thumbnailFile.'" />';
70 70
 
71
-        // Get new plugin variables for typolink.
72
-        $piVars = $this->piVars;
71
+		// Get new plugin variables for typolink.
72
+		$piVars = $this->piVars;
73 73
 
74
-        // Unset no longer needed plugin variables.
75
-        // unset($piVars['pagegrid']) is for DFG Viewer compatibility!
76
-        unset($piVars['pointer'], $piVars['DATA'], $piVars['pagegrid']);
74
+		// Unset no longer needed plugin variables.
75
+		// unset($piVars['pagegrid']) is for DFG Viewer compatibility!
76
+		unset($piVars['pointer'], $piVars['DATA'], $piVars['pagegrid']);
77 77
 
78
-        $piVars['page'] = $number;
78
+		$piVars['page'] = $number;
79 79
 
80
-        $linkConf = array (
81
-            'useCacheHash' => 1,
82
-            'parameter' => $this->conf['targetPid'],
83
-            'additionalParams' => \TYPO3\CMS\Core\Utility\GeneralUtility::implodeArrayForUrl($this->prefixId, $piVars, '', TRUE, FALSE),
84
-            'title' => $markerArray['###PAGINATION###']
85
-        );
80
+		$linkConf = array (
81
+			'useCacheHash' => 1,
82
+			'parameter' => $this->conf['targetPid'],
83
+			'additionalParams' => \TYPO3\CMS\Core\Utility\GeneralUtility::implodeArrayForUrl($this->prefixId, $piVars, '', TRUE, FALSE),
84
+			'title' => $markerArray['###PAGINATION###']
85
+		);
86 86
 
87
-        $markerArray['###THUMBNAIL###'] = $this->cObj->typoLink($thumbnail, $linkConf);
87
+		$markerArray['###THUMBNAIL###'] = $this->cObj->typoLink($thumbnail, $linkConf);
88 88
 
89
-        return $this->cObj->substituteMarkerArray($template, $markerArray);
89
+		return $this->cObj->substituteMarkerArray($template, $markerArray);
90 90
 
91
-    }
91
+	}
92 92
 
93
-    /**
94
-     * Renders the page browser
95
-     *
96
-     * @access	protected
97
-     *
98
-     * @return	string		The rendered page browser ready for output
99
-     */
100
-    protected function getPageBrowser() {
93
+	/**
94
+	 * Renders the page browser
95
+	 *
96
+	 * @access	protected
97
+	 *
98
+	 * @return	string		The rendered page browser ready for output
99
+	 */
100
+	protected function getPageBrowser() {
101 101
 
102
-        // Get overall number of pages.
103
-        $maxPages = intval(ceil($this->doc->numPages / $this->conf['limit']));
102
+		// Get overall number of pages.
103
+		$maxPages = intval(ceil($this->doc->numPages / $this->conf['limit']));
104 104
 
105
-        // Return empty pagebrowser if there is just one page.
106
-        if ($maxPages < 2) {
105
+		// Return empty pagebrowser if there is just one page.
106
+		if ($maxPages < 2) {
107 107
 
108
-            return '';
108
+			return '';
109 109
 
110
-        }
110
+		}
111 111
 
112
-        // Get separator.
113
-        $separator = $this->pi_getLL('separator', ' - ', TRUE);
112
+		// Get separator.
113
+		$separator = $this->pi_getLL('separator', ' - ', TRUE);
114 114
 
115
-        // Add link to previous page.
116
-        if ($this->piVars['pointer'] > 0) {
115
+		// Add link to previous page.
116
+		if ($this->piVars['pointer'] > 0) {
117 117
 
118
-            $output = $this->pi_linkTP_keepPIvars($this->pi_getLL('prevPage', '&lt;', TRUE), array ('pointer' => $this->piVars['pointer'] - 1, 'page' => (($this->piVars['pointer'] - 1) * $this->conf['limit']) + 1), TRUE).$separator;
118
+			$output = $this->pi_linkTP_keepPIvars($this->pi_getLL('prevPage', '&lt;', TRUE), array ('pointer' => $this->piVars['pointer'] - 1, 'page' => (($this->piVars['pointer'] - 1) * $this->conf['limit']) + 1), TRUE).$separator;
119 119
 
120
-        } else {
120
+		} else {
121 121
 
122
-            $output = $this->pi_getLL('prevPage', '&lt;', TRUE).$separator;
122
+			$output = $this->pi_getLL('prevPage', '&lt;', TRUE).$separator;
123 123
 
124
-        }
124
+		}
125 125
 
126
-        $i = 0;
126
+		$i = 0;
127 127
 
128
-        // Add links to pages.
129
-        while ($i < $maxPages) {
128
+		// Add links to pages.
129
+		while ($i < $maxPages) {
130 130
 
131
-            if ($i < 3 || ($i > $this->piVars['pointer'] - 3 && $i < $this->piVars['pointer'] + 3) || $i > $maxPages - 4) {
131
+			if ($i < 3 || ($i > $this->piVars['pointer'] - 3 && $i < $this->piVars['pointer'] + 3) || $i > $maxPages - 4) {
132 132
 
133
-                if ($this->piVars['pointer'] != $i) {
133
+				if ($this->piVars['pointer'] != $i) {
134 134
 
135
-                    $output .= $this->pi_linkTP_keepPIvars(sprintf($this->pi_getLL('page', '%d', TRUE), $i + 1), array ('pointer' => $i, 'page' => ($i * $this->conf['limit']) + 1), TRUE).$separator;
135
+					$output .= $this->pi_linkTP_keepPIvars(sprintf($this->pi_getLL('page', '%d', TRUE), $i + 1), array ('pointer' => $i, 'page' => ($i * $this->conf['limit']) + 1), TRUE).$separator;
136 136
 
137
-                } else {
137
+				} else {
138 138
 
139
-                    $output .= sprintf($this->pi_getLL('page', '%d', TRUE), $i + 1).$separator;
139
+					$output .= sprintf($this->pi_getLL('page', '%d', TRUE), $i + 1).$separator;
140 140
 
141
-                }
141
+				}
142 142
 
143
-                $skip = TRUE;
143
+				$skip = TRUE;
144 144
 
145
-            } elseif ($skip == TRUE) {
145
+			} elseif ($skip == TRUE) {
146 146
 
147
-                $output .= $this->pi_getLL('skip', '...', TRUE).$separator;
147
+				$output .= $this->pi_getLL('skip', '...', TRUE).$separator;
148 148
 
149
-                $skip = FALSE;
149
+				$skip = FALSE;
150 150
 
151
-            }
151
+			}
152 152
 
153
-            $i++;
153
+			$i++;
154 154
 
155
-        }
155
+		}
156 156
 
157
-        // Add link to next page.
158
-        if ($this->piVars['pointer'] < $maxPages - 1) {
157
+		// Add link to next page.
158
+		if ($this->piVars['pointer'] < $maxPages - 1) {
159 159
 
160
-            $output .= $this->pi_linkTP_keepPIvars($this->pi_getLL('nextPage', '&gt;', TRUE), array ('pointer' => $this->piVars['pointer'] + 1, 'page' => ($this->piVars['pointer'] + 1) * $this->conf['limit'] + 1), TRUE);
160
+			$output .= $this->pi_linkTP_keepPIvars($this->pi_getLL('nextPage', '&gt;', TRUE), array ('pointer' => $this->piVars['pointer'] + 1, 'page' => ($this->piVars['pointer'] + 1) * $this->conf['limit'] + 1), TRUE);
161 161
 
162
-        } else {
162
+		} else {
163 163
 
164
-            $output .= $this->pi_getLL('nextPage', '&gt;', TRUE);
164
+			$output .= $this->pi_getLL('nextPage', '&gt;', TRUE);
165 165
 
166
-        }
166
+		}
167 167
 
168
-        return $output;
168
+		return $output;
169 169
 
170
-    }
170
+	}
171 171
 
172
-    /**
173
-     * The main method of the PlugIn
174
-     *
175
-     * @access	public
176
-     *
177
-     * @param	string		$content: The PlugIn content
178
-     * @param	array		$conf: The PlugIn configuration
179
-     *
180
-     * @return	string		The content that is displayed on the website
181
-     */
182
-    public function main($content, $conf) {
172
+	/**
173
+	 * The main method of the PlugIn
174
+	 *
175
+	 * @access	public
176
+	 *
177
+	 * @param	string		$content: The PlugIn content
178
+	 * @param	array		$conf: The PlugIn configuration
179
+	 *
180
+	 * @return	string		The content that is displayed on the website
181
+	 */
182
+	public function main($content, $conf) {
183 183
 
184
-        $this->init($conf);
184
+		$this->init($conf);
185 185
 
186
-        $this->loadDocument();
186
+		$this->loadDocument();
187 187
 
188
-        if ($this->doc === NULL || $this->doc->numPages < 1 || empty($this->conf['fileGrpThumbs'])) {
188
+		if ($this->doc === NULL || $this->doc->numPages < 1 || empty($this->conf['fileGrpThumbs'])) {
189 189
 
190
-            // Quit without doing anything if required variables are not set.
191
-            return $content;
190
+			// Quit without doing anything if required variables are not set.
191
+			return $content;
192 192
 
193
-        } else {
193
+		} else {
194 194
 
195
-            // Set default values for page if not set.
196
-            $this->piVars['pointer'] = \TYPO3\CMS\Core\Utility\MathUtility::forceIntegerInRange($this->piVars['pointer'], 0, $this->doc->numPages, 0);
195
+			// Set default values for page if not set.
196
+			$this->piVars['pointer'] = \TYPO3\CMS\Core\Utility\MathUtility::forceIntegerInRange($this->piVars['pointer'], 0, $this->doc->numPages, 0);
197 197
 
198
-        }
198
+		}
199 199
 
200
-        // Load template file.
201
-        if (!empty($this->conf['templateFile'])) {
200
+		// Load template file.
201
+		if (!empty($this->conf['templateFile'])) {
202 202
 
203
-            $this->template = $this->cObj->getSubpart($this->cObj->fileResource($this->conf['templateFile']), '###TEMPLATE###');
203
+			$this->template = $this->cObj->getSubpart($this->cObj->fileResource($this->conf['templateFile']), '###TEMPLATE###');
204 204
 
205
-        } else {
205
+		} else {
206 206
 
207
-            $this->template = $this->cObj->getSubpart($this->cObj->fileResource('EXT:dlf/plugins/pagegrid/template.tmpl'), '###TEMPLATE###');
207
+			$this->template = $this->cObj->getSubpart($this->cObj->fileResource('EXT:dlf/plugins/pagegrid/template.tmpl'), '###TEMPLATE###');
208 208
 
209
-        }
209
+		}
210 210
 
211
-        $entryTemplate = $this->cObj->getSubpart($this->template, '###ENTRY###');
211
+		$entryTemplate = $this->cObj->getSubpart($this->template, '###ENTRY###');
212 212
 
213
-        if (empty($entryTemplate)) {
213
+		if (empty($entryTemplate)) {
214 214
 
215
-            if (TYPO3_DLOG) {
215
+			if (TYPO3_DLOG) {
216 216
 
217
-                \TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[tx_dlf_pagegrid->main('.$content.', [data])] No template subpart for list entry found', $this->extKey, SYSLOG_SEVERITY_WARNING, $conf);
217
+				\TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[tx_dlf_pagegrid->main('.$content.', [data])] No template subpart for list entry found', $this->extKey, SYSLOG_SEVERITY_WARNING, $conf);
218 218
 
219
-            }
219
+			}
220 220
 
221
-            // Quit without doing anything if required variables are not set.
222
-            return $content;
221
+			// Quit without doing anything if required variables are not set.
222
+			return $content;
223 223
 
224
-        }
224
+		}
225 225
 
226
-        if (!empty($this->piVars['logicalPage'])) {
226
+		if (!empty($this->piVars['logicalPage'])) {
227 227
 
228
-            $this->piVars['page'] = $this->doc->getPhysicalPage($this->piVars['logicalPage']);
229
-            // The logical page parameter should not appear
230
-            unset($this->piVars['logicalPage']);
228
+			$this->piVars['page'] = $this->doc->getPhysicalPage($this->piVars['logicalPage']);
229
+			// The logical page parameter should not appear
230
+			unset($this->piVars['logicalPage']);
231 231
 
232
-        }
232
+		}
233 233
 
234
-        // Set some variable defaults.
235
-        // $this->piVars['page'] may be integer or string (physical structure @ID)
236
-        if ((int) $this->piVars['page'] > 0 || empty($this->piVars['page'])) {
234
+		// Set some variable defaults.
235
+		// $this->piVars['page'] may be integer or string (physical structure @ID)
236
+		if ((int) $this->piVars['page'] > 0 || empty($this->piVars['page'])) {
237 237
 
238
-            $this->piVars['page'] = \TYPO3\CMS\Core\Utility\MathUtility::forceIntegerInRange((int) $this->piVars['page'], 1, $this->doc->numPages, 1);
238
+			$this->piVars['page'] = \TYPO3\CMS\Core\Utility\MathUtility::forceIntegerInRange((int) $this->piVars['page'], 1, $this->doc->numPages, 1);
239 239
 
240
-        } else {
240
+		} else {
241 241
 
242
-            $this->piVars['page'] = array_search($this->piVars['page'], $this->doc->physicalStructure);
242
+			$this->piVars['page'] = array_search($this->piVars['page'], $this->doc->physicalStructure);
243 243
 
244
-        }
244
+		}
245 245
 
246
-        if (!empty($this->piVars['page'])) {
246
+		if (!empty($this->piVars['page'])) {
247 247
 
248
-            $this->piVars['pointer'] = intval(floor(($this->piVars['page'] - 1) / $this->conf['limit']));
248
+			$this->piVars['pointer'] = intval(floor(($this->piVars['page'] - 1) / $this->conf['limit']));
249 249
 
250
-        }
250
+		}
251 251
 
252
-        if (!empty($this->piVars['pointer']) && (($this->piVars['pointer'] * $this->conf['limit']) + 1) <= $this->doc->numPages) {
252
+		if (!empty($this->piVars['pointer']) && (($this->piVars['pointer'] * $this->conf['limit']) + 1) <= $this->doc->numPages) {
253 253
 
254
-            $this->piVars['pointer'] = max(intval($this->piVars['pointer']), 0);
254
+			$this->piVars['pointer'] = max(intval($this->piVars['pointer']), 0);
255 255
 
256
-        } else {
256
+		} else {
257 257
 
258
-            $this->piVars['pointer'] = 0;
258
+			$this->piVars['pointer'] = 0;
259 259
 
260
-        }
260
+		}
261 261
 
262
-        // Iterate through visible page set and display thumbnails.
263
-        for ($i = $this->piVars['pointer'] * $this->conf['limit'], $j = ($this->piVars['pointer'] + 1) * $this->conf['limit']; $i < $j; $i++) {
262
+		// Iterate through visible page set and display thumbnails.
263
+		for ($i = $this->piVars['pointer'] * $this->conf['limit'], $j = ($this->piVars['pointer'] + 1) * $this->conf['limit']; $i < $j; $i++) {
264 264
 
265
-            // +1 because page counting starts at 1.
266
-            $number = $i + 1;
265
+			// +1 because page counting starts at 1.
266
+			$number = $i + 1;
267 267
 
268
-            if ($number > $this->doc->numPages) {
268
+			if ($number > $this->doc->numPages) {
269 269
 
270
-                break;
270
+				break;
271 271
 
272
-            } else {
272
+			} else {
273 273
 
274
-                $content .= $this->getEntry($number, $entryTemplate);
274
+				$content .= $this->getEntry($number, $entryTemplate);
275 275
 
276
-            }
276
+			}
277 277
 
278
-        }
278
+		}
279 279
 
280
-        // Render page browser.
281
-        $markerArray['###PAGEBROWSER###'] = $this->getPageBrowser();
280
+		// Render page browser.
281
+		$markerArray['###PAGEBROWSER###'] = $this->getPageBrowser();
282 282
 
283
-        // Merge everything with template.
284
-        $content = $this->cObj->substituteMarkerArray($this->cObj->substituteSubpart($this->template, '###ENTRY###', $content, TRUE), $markerArray);
283
+		// Merge everything with template.
284
+		$content = $this->cObj->substituteMarkerArray($this->cObj->substituteSubpart($this->template, '###ENTRY###', $content, TRUE), $markerArray);
285 285
 
286
-        return $this->pi_wrapInBaseClass($content);
286
+		return $this->pi_wrapInBaseClass($content);
287 287
 
288
-    }
288
+	}
289 289
 
290 290
 }
Please login to merge, or discard this patch.
plugins/basket/class.tx_dlf_basket.php 1 patch
Indentation   +544 added lines, -544 removed lines patch added patch discarded remove patch
@@ -19,220 +19,220 @@  discard block
 block discarded – undo
19 19
  */
20 20
 class tx_dlf_basket extends tx_dlf_plugin {
21 21
 
22
-    public $scriptRelPath = 'plugins/basket/class.tx_dlf_basket.php';
22
+	public $scriptRelPath = 'plugins/basket/class.tx_dlf_basket.php';
23 23
 
24
-    /**
25
-     * The main method of the PlugIn
26
-     *
27
-     * @access	public
28
-     *
29
-     * @param	string		$content: The PlugIn content
30
-     * @param	array		$conf: The PlugIn configuration
31
-     *
32
-     * @return	string		The content that is displayed on the website
33
-     */
34
-    public function main($content, $conf) {
24
+	/**
25
+	 * The main method of the PlugIn
26
+	 *
27
+	 * @access	public
28
+	 *
29
+	 * @param	string		$content: The PlugIn content
30
+	 * @param	array		$conf: The PlugIn configuration
31
+	 *
32
+	 * @return	string		The content that is displayed on the website
33
+	 */
34
+	public function main($content, $conf) {
35 35
 
36
-        $this->init($conf);
36
+		$this->init($conf);
37 37
 
38
-        // Don't cache the output.
39
-        $this->setCache(FALSE);
38
+		// Don't cache the output.
39
+		$this->setCache(FALSE);
40 40
 
41
-        // Load template file.
42
-        if (!empty($this->conf['templateFile'])) {
41
+		// Load template file.
42
+		if (!empty($this->conf['templateFile'])) {
43 43
 
44
-            $this->template = $this->cObj->getSubpart($this->cObj->fileResource($this->conf['templateFile']), '###TEMPLATE###');
44
+			$this->template = $this->cObj->getSubpart($this->cObj->fileResource($this->conf['templateFile']), '###TEMPLATE###');
45 45
 
46
-        } else {
46
+		} else {
47 47
 
48
-            $this->template = $this->cObj->getSubpart($this->cObj->fileResource('EXT:dlf/plugins/basket/template.tmpl'), '###TEMPLATE###');
48
+			$this->template = $this->cObj->getSubpart($this->cObj->fileResource('EXT:dlf/plugins/basket/template.tmpl'), '###TEMPLATE###');
49 49
 
50
-        }
50
+		}
51 51
 
52
-        $subpartArray['entry'] = $this->cObj->getSubpart($this->template, '###ENTRY###');
52
+		$subpartArray['entry'] = $this->cObj->getSubpart($this->template, '###ENTRY###');
53 53
 
54
-        $markerArray['###JS###'] = '';
54
+		$markerArray['###JS###'] = '';
55 55
 
56
-        // get user session
57
-        $sessionId = $GLOBALS['TSFE']->fe_user->id;
56
+		// get user session
57
+		$sessionId = $GLOBALS['TSFE']->fe_user->id;
58 58
 
59
-        if ($GLOBALS['TSFE']->loginUser) {
59
+		if ($GLOBALS['TSFE']->loginUser) {
60 60
 
61
-            $insertArray['fe_user_id'] = $GLOBALS['TSFE']->fe_user->user['uid'];
61
+			$insertArray['fe_user_id'] = $GLOBALS['TSFE']->fe_user->user['uid'];
62 62
 
63
-            $query = $GLOBALS['TYPO3_DB']->SELECTquery(
64
-                '*',
65
-                'tx_dlf_basket',
66
-                'tx_dlf_basket.fe_user_id='.intval($insertArray['fe_user_id']).tx_dlf_helper::whereClause('tx_dlf_basket'),
67
-                '',
68
-                '',
69
-                '1'
70
-            );
63
+			$query = $GLOBALS['TYPO3_DB']->SELECTquery(
64
+				'*',
65
+				'tx_dlf_basket',
66
+				'tx_dlf_basket.fe_user_id='.intval($insertArray['fe_user_id']).tx_dlf_helper::whereClause('tx_dlf_basket'),
67
+				'',
68
+				'',
69
+				'1'
70
+			);
71 71
 
72
-        } else {
72
+		} else {
73 73
 
74
-            $GLOBALS['TSFE']->fe_user->setKey('ses', 'tx_dlf_basket', '');
74
+			$GLOBALS['TSFE']->fe_user->setKey('ses', 'tx_dlf_basket', '');
75 75
 
76
-            $GLOBALS['TSFE']->fe_user->sesData_change = TRUE;
76
+			$GLOBALS['TSFE']->fe_user->sesData_change = TRUE;
77 77
 
78
-            $GLOBALS['TSFE']->fe_user->storeSessionData();
78
+			$GLOBALS['TSFE']->fe_user->storeSessionData();
79 79
 
80
-            $query = $GLOBALS['TYPO3_DB']->SELECTquery(
81
-                '*',
82
-                'tx_dlf_basket',
83
-                'tx_dlf_basket.session_id='.$GLOBALS['TYPO3_DB']->fullQuoteStr($sessionId, 'tx_dlf_basket').tx_dlf_helper::whereClause('tx_dlf_basket'),
84
-                '',
85
-                '',
86
-                '1'
87
-            );
80
+			$query = $GLOBALS['TYPO3_DB']->SELECTquery(
81
+				'*',
82
+				'tx_dlf_basket',
83
+				'tx_dlf_basket.session_id='.$GLOBALS['TYPO3_DB']->fullQuoteStr($sessionId, 'tx_dlf_basket').tx_dlf_helper::whereClause('tx_dlf_basket'),
84
+				'',
85
+				'',
86
+				'1'
87
+			);
88 88
 
89
-        }
89
+		}
90 90
 
91
-        $result = $GLOBALS['TYPO3_DB']->sql_query($query);
91
+		$result = $GLOBALS['TYPO3_DB']->sql_query($query);
92 92
 
93
-        // session already exists
94
-        if ($GLOBALS['TYPO3_DB']->sql_num_rows($result) == 0) {
93
+		// session already exists
94
+		if ($GLOBALS['TYPO3_DB']->sql_num_rows($result) == 0) {
95 95
 
96
-            // create new basket in db
97
-            $insertArray['session_id'] = $sessionId;
98
-            $insertArray['doc_ids'] = '';
99
-            $insertArray['label'] = '';
100
-            $insertArray['l18n_diffsource'] = '';
96
+			// create new basket in db
97
+			$insertArray['session_id'] = $sessionId;
98
+			$insertArray['doc_ids'] = '';
99
+			$insertArray['label'] = '';
100
+			$insertArray['l18n_diffsource'] = '';
101 101
 
102
-            $GLOBALS['TYPO3_DB']->exec_INSERTquery('tx_dlf_basket', $insertArray);
102
+			$GLOBALS['TYPO3_DB']->exec_INSERTquery('tx_dlf_basket', $insertArray);
103 103
 
104
-            $result = $GLOBALS['TYPO3_DB']->sql_query($query);
104
+			$result = $GLOBALS['TYPO3_DB']->sql_query($query);
105 105
 
106
-        }
106
+		}
107 107
 
108
-        $basketData = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($result);
108
+		$basketData = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($result);
109 109
 
110
-        $piVars = $this->piVars;
110
+		$piVars = $this->piVars;
111 111
 
112
-        // action add to basket
113
-        if (!empty($this->piVars['id']) && $this->piVars['addToBasket']) {
112
+		// action add to basket
113
+		if (!empty($this->piVars['id']) && $this->piVars['addToBasket']) {
114 114
 
115
-            $returnData = $this->addToBasket($this->piVars, $basketData);
115
+			$returnData = $this->addToBasket($this->piVars, $basketData);
116 116
 
117
-            $basketData = $returnData['basketData'];
117
+			$basketData = $returnData['basketData'];
118 118
 
119
-            $markerArray['###JS###'] = $returnData['jsOutput'];
119
+			$markerArray['###JS###'] = $returnData['jsOutput'];
120 120
 
121
-        } else {
121
+		} else {
122 122
 
123
-            $basketData['doc_ids'] = json_decode($basketData['doc_ids']);
123
+			$basketData['doc_ids'] = json_decode($basketData['doc_ids']);
124 124
 
125
-        }
125
+		}
126 126
 
127
-        // action remove from basket
128
-        if ($this->piVars['basket_action'] == 'remove') {
127
+		// action remove from basket
128
+		if ($this->piVars['basket_action'] == 'remove') {
129 129
 
130
-            // remove entry from list
131
-            unset($piVars['basket_action']);
130
+			// remove entry from list
131
+			unset($piVars['basket_action']);
132 132
 
133
-            if (isset($this->piVars['selected'])) {
133
+			if (isset($this->piVars['selected'])) {
134 134
 
135
-                $basketData = $this->removeFromBasket($piVars, $basketData);
135
+				$basketData = $this->removeFromBasket($piVars, $basketData);
136 136
 
137
-            }
137
+			}
138 138
 
139
-        }
139
+		}
140 140
 
141
-        // action remove from basket
142
-        if ($this->piVars['basket_action'] == 'open') {
141
+		// action remove from basket
142
+		if ($this->piVars['basket_action'] == 'open') {
143 143
 
144
-            // open selected documents
145
-            unset($piVars['basket_action']);
144
+			// open selected documents
145
+			unset($piVars['basket_action']);
146 146
 
147
-            if (isset($this->piVars['selected'])) {
147
+			if (isset($this->piVars['selected'])) {
148 148
 
149
-                $basketData = $this->openFromBasket($piVars, $basketData);
149
+				$basketData = $this->openFromBasket($piVars, $basketData);
150 150
 
151
-            }
151
+			}
152 152
 
153
-        }
153
+		}
154 154
 
155
-        // action print from basket
156
-        if ($this->piVars['print_action']) {
155
+		// action print from basket
156
+		if ($this->piVars['print_action']) {
157 157
 
158
-            // open selected documents
159
-            unset($piVars['print_action']);
158
+			// open selected documents
159
+			unset($piVars['print_action']);
160 160
 
161
-            if (isset($this->piVars['selected'])) {
161
+			if (isset($this->piVars['selected'])) {
162 162
 
163
-                $basketData = $this->printDocument($piVars, $basketData);
163
+				$basketData = $this->printDocument($piVars, $basketData);
164 164
 
165
-            }
165
+			}
166 166
 
167
-        }
167
+		}
168 168
 
169
-        // action send mail
170
-        if ($this->piVars['mail_action']) {
169
+		// action send mail
170
+		if ($this->piVars['mail_action']) {
171 171
 
172
-            if (isset($this->piVars['selected'])) {
172
+			if (isset($this->piVars['selected'])) {
173 173
 
174
-                $this->sendMail($this->piVars);
174
+				$this->sendMail($this->piVars);
175 175
 
176
-            }
176
+			}
177 177
 
178
-        }
178
+		}
179 179
 
180
-        // set marker
181
-        $markerArray['###ACTION###'] = $this->pi_getPageLink($GLOBALS['TSFE']->id);
180
+		// set marker
181
+		$markerArray['###ACTION###'] = $this->pi_getPageLink($GLOBALS['TSFE']->id);
182 182
 
183
-        $markerArray['###LISTTITLE###'] = $this->pi_getLL('basket', '', TRUE);
183
+		$markerArray['###LISTTITLE###'] = $this->pi_getLL('basket', '', TRUE);
184 184
 
185
-        if ($basketData['doc_ids']) {
185
+		if ($basketData['doc_ids']) {
186 186
 
187
-            if (is_object($basketData['doc_ids'])) {
187
+			if (is_object($basketData['doc_ids'])) {
188 188
 
189
-                $basketData['doc_ids'] = get_object_vars($basketData['doc_ids']);
189
+				$basketData['doc_ids'] = get_object_vars($basketData['doc_ids']);
190 190
 
191
-            }
191
+			}
192 192
 
193
-            $markerArray['###COUNT###'] = sprintf($this->pi_getLL('count'), count($basketData['doc_ids']));
193
+			$markerArray['###COUNT###'] = sprintf($this->pi_getLL('count'), count($basketData['doc_ids']));
194 194
 
195
-        } else {
195
+		} else {
196 196
 
197
-            $markerArray['###COUNT###'] = sprintf($this->pi_getLL('count'), 0);
197
+			$markerArray['###COUNT###'] = sprintf($this->pi_getLL('count'), 0);
198 198
 
199
-        }
199
+		}
200 200
 
201
-        // get mail addresses
202
-        $resultMail = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
203
-            '*',
204
-            'tx_dlf_mail',
205
-            '1'.tx_dlf_helper::whereClause('tx_dlf_mail'),
206
-            '',
207
-            'tx_dlf_mail.sorting',
208
-            ''
209
-        );
201
+		// get mail addresses
202
+		$resultMail = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
203
+			'*',
204
+			'tx_dlf_mail',
205
+			'1'.tx_dlf_helper::whereClause('tx_dlf_mail'),
206
+			'',
207
+			'tx_dlf_mail.sorting',
208
+			''
209
+		);
210 210
 
211
-        if ($GLOBALS['TYPO3_DB']->sql_num_rows($resultMail) > 0) {
211
+		if ($GLOBALS['TYPO3_DB']->sql_num_rows($resultMail) > 0) {
212 212
 
213
-            $mails = array ();
213
+			$mails = array ();
214 214
 
215
-            $mailForm = '<select name="tx_dlf[mail_action]">';
215
+			$mailForm = '<select name="tx_dlf[mail_action]">';
216 216
 
217
-            $mailForm .= '<option value="">'.$this->pi_getLL('chooseMail', '', TRUE).'</option>';
217
+			$mailForm .= '<option value="">'.$this->pi_getLL('chooseMail', '', TRUE).'</option>';
218 218
 
219
-            while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($resultMail)) {
219
+			while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($resultMail)) {
220 220
 
221
-                $mails[] = $row;
221
+				$mails[] = $row;
222 222
 
223
-                $mailForm .= '<option value="'.$row['uid'].'">'.$row['name'].' ('.$row['mail'].')</option>';
223
+				$mailForm .= '<option value="'.$row['uid'].'">'.$row['name'].' ('.$row['mail'].')</option>';
224 224
 
225
-            }
225
+			}
226 226
 
227
-            $mailForm .= '</select><input type="submit">';
227
+			$mailForm .= '</select><input type="submit">';
228 228
 
229
-        }
229
+		}
230 230
 
231
-        // mail action form
232
-        $markerArray['###MAILACTION###'] = $mailForm;
231
+		// mail action form
232
+		$markerArray['###MAILACTION###'] = $mailForm;
233 233
 
234
-        // remove action form
235
-        $markerArray['###REMOVEACTION###'] = '
234
+		// remove action form
235
+		$markerArray['###REMOVEACTION###'] = '
236 236
 			<select name="tx_dlf[basket_action]">
237 237
 				<option value="">'.$this->pi_getLL('chooseAction', '', TRUE).'</option>
238 238
 				<option value="open">'.$this->pi_getLL('download', '', TRUE).'</option>
@@ -241,275 +241,275 @@  discard block
 block discarded – undo
241 241
 			<input type="submit">
242 242
 		';
243 243
 
244
-        // get mail addresses
245
-        $resultPrinter = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
246
-            '*',
247
-            'tx_dlf_printer',
248
-            '1'.tx_dlf_helper::whereClause('tx_dlf_printer'),
249
-            '',
250
-            '',
251
-            ''
252
-        );
244
+		// get mail addresses
245
+		$resultPrinter = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
246
+			'*',
247
+			'tx_dlf_printer',
248
+			'1'.tx_dlf_helper::whereClause('tx_dlf_printer'),
249
+			'',
250
+			'',
251
+			''
252
+		);
253 253
 
254
-        $printForm = '';
254
+		$printForm = '';
255 255
 
256
-        if ($GLOBALS['TYPO3_DB']->sql_num_rows($resultPrinter) > 0) {
256
+		if ($GLOBALS['TYPO3_DB']->sql_num_rows($resultPrinter) > 0) {
257 257
 
258
-            $printers = array ();
258
+			$printers = array ();
259 259
 
260
-            $printForm = '<select name="tx_dlf[print_action]">';
260
+			$printForm = '<select name="tx_dlf[print_action]">';
261 261
 
262
-            $printForm .= '<option value="">'.$this->pi_getLL('choosePrinter', '', TRUE).'</option>';
262
+			$printForm .= '<option value="">'.$this->pi_getLL('choosePrinter', '', TRUE).'</option>';
263 263
 
264
-            while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($resultPrinter)) {
264
+			while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($resultPrinter)) {
265 265
 
266
-                $printers[] = $row;
266
+				$printers[] = $row;
267 267
 
268
-                $printForm .= '<option value="'.$row['uid'].'">'.$row['label'].'</option>';
268
+				$printForm .= '<option value="'.$row['uid'].'">'.$row['label'].'</option>';
269 269
 
270
-            }
270
+			}
271 271
 
272
-            $printForm .= '</select><input type="submit" />';
272
+			$printForm .= '</select><input type="submit" />';
273 273
 
274
-        }
274
+		}
275 275
 
276
-        // print action form
277
-        $markerArray['###PRINTACTION###'] = $printForm;
276
+		// print action form
277
+		$markerArray['###PRINTACTION###'] = $printForm;
278 278
 
279
-        $entries = '';
279
+		$entries = '';
280 280
 
281
-        if (isset($basketData['doc_ids'])) {
281
+		if (isset($basketData['doc_ids'])) {
282 282
 
283
-            // get each entry
284
-            foreach ($basketData['doc_ids'] as $key => $value) {
283
+			// get each entry
284
+			foreach ($basketData['doc_ids'] as $key => $value) {
285 285
 
286
-                $entries .= $this->getEntry($value, $subpartArray);
286
+				$entries .= $this->getEntry($value, $subpartArray);
287 287
 
288
-            }
288
+			}
289 289
 
290
-        } else {
290
+		} else {
291 291
 
292
-            $entries = '';
292
+			$entries = '';
293 293
 
294
-        }
294
+		}
295 295
 
296
-        // basket go to
297
-        if ($this->conf['targetBasket'] && $this->conf['basketGoToButton'] && $this->piVars['id']) {
296
+		// basket go to
297
+		if ($this->conf['targetBasket'] && $this->conf['basketGoToButton'] && $this->piVars['id']) {
298 298
 
299
-            $label = $this->pi_getLL('goBasket', '', TRUE);
299
+			$label = $this->pi_getLL('goBasket', '', TRUE);
300 300
 
301
-            $basketConf = array (
302
-                'parameter' => $this->conf['targetBasket'],
303
-                'title' => $label
304
-            );
301
+			$basketConf = array (
302
+				'parameter' => $this->conf['targetBasket'],
303
+				'title' => $label
304
+			);
305 305
 
306
-            $markerArray['###BASKET###'] = $this->cObj->typoLink($label, $basketConf);
306
+			$markerArray['###BASKET###'] = $this->cObj->typoLink($label, $basketConf);
307 307
 
308
-        } else {
308
+		} else {
309 309
 
310
-            $markerArray['###BASKET###'] = '';
310
+			$markerArray['###BASKET###'] = '';
311 311
 
312
-        }
312
+		}
313 313
 
314
-        $content = $this->cObj->substituteMarkerArray($this->cObj->substituteSubpart($this->template, '###ENTRY###', $entries, TRUE), $markerArray);
314
+		$content = $this->cObj->substituteMarkerArray($this->cObj->substituteSubpart($this->template, '###ENTRY###', $entries, TRUE), $markerArray);
315 315
 
316
-        return $this->pi_wrapInBaseClass($content);
316
+		return $this->pi_wrapInBaseClass($content);
317 317
 
318
-    }
318
+	}
319 319
 
320
-    /**
321
-     * Return one basket entry
322
-     * @param  array $data     DocumentData
323
-     * @param  array $template Template information
324
-     * @return Template
325
-     */
326
-    public function getEntry($data, $template) {
320
+	/**
321
+	 * Return one basket entry
322
+	 * @param  array $data     DocumentData
323
+	 * @param  array $template Template information
324
+	 * @return Template
325
+	 */
326
+	public function getEntry($data, $template) {
327 327
 
328
-        if (is_object($data)) {
328
+		if (is_object($data)) {
329 329
 
330
-            $data = get_object_vars($data);
330
+			$data = get_object_vars($data);
331 331
 
332
-        }
332
+		}
333 333
 
334
-        $id = $data['id'];
334
+		$id = $data['id'];
335 335
 
336
-        $startpage = $data['startpage'];
336
+		$startpage = $data['startpage'];
337 337
 
338
-        $endpage = $data['endpage'];
338
+		$endpage = $data['endpage'];
339 339
 
340
-        $startX = $data['startX'];
340
+		$startX = $data['startX'];
341 341
 
342
-        $startY = $data['startY'];
342
+		$startY = $data['startY'];
343 343
 
344
-        $endX = $data['endX'];
344
+		$endX = $data['endX'];
345 345
 
346
-        $endY = $data['endY'];
346
+		$endY = $data['endY'];
347 347
 
348
-        $rotation = $data['rotation'];
348
+		$rotation = $data['rotation'];
349 349
 
350
-        $docData = $this->getDocumentData($id, $data);
350
+		$docData = $this->getDocumentData($id, $data);
351 351
 
352
-        $markerArray['###BASKETDATA###'] = $docData['downloadLink'];
352
+		$markerArray['###BASKETDATA###'] = $docData['downloadLink'];
353 353
 
354
-        $arrayKey = $id.'_'.$startpage;
354
+		$arrayKey = $id.'_'.$startpage;
355 355
 
356
-        if (isset($startX)) {
356
+		if (isset($startX)) {
357 357
 
358
-            $arrayKey .= '_'.$startX;
358
+			$arrayKey .= '_'.$startX;
359 359
 
360
-        }
360
+		}
361 361
 
362
-        if (isset($endX)) {
362
+		if (isset($endX)) {
363 363
 
364
-            $arrayKey .= '_'.$endX;
364
+			$arrayKey .= '_'.$endX;
365 365
 
366
-        }
366
+		}
367 367
 
368
-        $controlMark = '<input value="'.$id.'" name="tx_dlf[selected]['.$arrayKey.'][id]" type="checkbox">';
368
+		$controlMark = '<input value="'.$id.'" name="tx_dlf[selected]['.$arrayKey.'][id]" type="checkbox">';
369 369
 
370
-        $controlMark .= '<input value="'.$startpage.'" name="tx_dlf[selected]['.$arrayKey.'][startpage]" type="hidden">';
370
+		$controlMark .= '<input value="'.$startpage.'" name="tx_dlf[selected]['.$arrayKey.'][startpage]" type="hidden">';
371 371
 
372
-        $controlMark .= '<input value="'.$endpage.'" name="tx_dlf[selected]['.$arrayKey.'][endpage]" type="hidden">';
372
+		$controlMark .= '<input value="'.$endpage.'" name="tx_dlf[selected]['.$arrayKey.'][endpage]" type="hidden">';
373 373
 
374
-        // add hidden fields for detail information
375
-        if ($startX) {
374
+		// add hidden fields for detail information
375
+		if ($startX) {
376 376
 
377
-            $controlMark .= '<input type="hidden" name="tx_dlf[selected]['.$arrayKey.'][startX]" value="'.$startX.'">';
377
+			$controlMark .= '<input type="hidden" name="tx_dlf[selected]['.$arrayKey.'][startX]" value="'.$startX.'">';
378 378
 
379
-            $controlMark .= '<input type="hidden" name="tx_dlf[selected]['.$arrayKey.'][startY]"  value="'.$startY.'">';
379
+			$controlMark .= '<input type="hidden" name="tx_dlf[selected]['.$arrayKey.'][startY]"  value="'.$startY.'">';
380 380
 
381
-            $controlMark .= '<input type="hidden" name="tx_dlf[selected]['.$arrayKey.'][endX]"  value="'.$endX.'">';
381
+			$controlMark .= '<input type="hidden" name="tx_dlf[selected]['.$arrayKey.'][endX]"  value="'.$endX.'">';
382 382
 
383
-            $controlMark .= '<input type="hidden" name="tx_dlf[selected]['.$arrayKey.'][endY]"  value="'.$endY.'">';
383
+			$controlMark .= '<input type="hidden" name="tx_dlf[selected]['.$arrayKey.'][endY]"  value="'.$endY.'">';
384 384
 
385
-            $controlMark .= '<input type="hidden" name="tx_dlf[selected]['.$arrayKey.'][rotation]"  value="'.$rotation.'">';
385
+			$controlMark .= '<input type="hidden" name="tx_dlf[selected]['.$arrayKey.'][rotation]"  value="'.$rotation.'">';
386 386
 
387
-        }
387
+		}
388 388
 
389
-        // return one entry
390
-        $markerArray['###CONTROLS###'] = $controlMark;
389
+		// return one entry
390
+		$markerArray['###CONTROLS###'] = $controlMark;
391 391
 
392
-        $markerArray['###NUMBER###'] = $docData['record_id'];
392
+		$markerArray['###NUMBER###'] = $docData['record_id'];
393 393
 
394
-        return $this->cObj->substituteMarkerArray($this->cObj->substituteSubpart($template['entry'], '###ENTRY###', $subpart, TRUE), $markerArray);
394
+		return $this->cObj->substituteMarkerArray($this->cObj->substituteSubpart($template['entry'], '###ENTRY###', $subpart, TRUE), $markerArray);
395 395
 
396
-    }
396
+	}
397 397
 
398
-    /**
399
-     * Adds documents to the basket
400
-     * @param array $_piVars    piVars
401
-     * @param array $basketData basket data
402
-     */
403
-    public function addToBasket($_piVars, $basketData) {
398
+	/**
399
+	 * Adds documents to the basket
400
+	 * @param array $_piVars    piVars
401
+	 * @param array $basketData basket data
402
+	 */
403
+	public function addToBasket($_piVars, $basketData) {
404 404
 
405
-        if (!$_piVars['startpage']) {
405
+		if (!$_piVars['startpage']) {
406 406
 
407
-            $page = 0;
407
+			$page = 0;
408 408
 
409
-        } else {
409
+		} else {
410 410
 
411
-            $page = intval($_piVars['startpage']);
411
+			$page = intval($_piVars['startpage']);
412 412
 
413
-        }
413
+		}
414 414
 
415
-        if ($page != NULL || $_piVars['addToBasket'] == 'list') {
415
+		if ($page != NULL || $_piVars['addToBasket'] == 'list') {
416 416
 
417
-            $documentItem = array (
418
-                'id' => intval($_piVars['id']),
419
-                'startpage' => intval($_piVars['startpage']),
420
-                'endpage' => intval($_piVars['endpage']),
421
-                'startX' => intval($_piVars['startX']),
422
-                'startY' => intval($_piVars['startY']),
423
-                'endX' => intval($_piVars['endX']),
424
-                'endY' => intval($_piVars['endY']),
425
-                'rotation' => intval($_piVars['rotation'])
426
-            );
417
+			$documentItem = array (
418
+				'id' => intval($_piVars['id']),
419
+				'startpage' => intval($_piVars['startpage']),
420
+				'endpage' => intval($_piVars['endpage']),
421
+				'startX' => intval($_piVars['startX']),
422
+				'startY' => intval($_piVars['startY']),
423
+				'endX' => intval($_piVars['endX']),
424
+				'endY' => intval($_piVars['endY']),
425
+				'rotation' => intval($_piVars['rotation'])
426
+			);
427 427
 
428
-            // update basket
429
-            if (!empty($basketData['doc_ids'])) {
428
+			// update basket
429
+			if (!empty($basketData['doc_ids'])) {
430 430
 
431
-                $items = json_decode($basketData['doc_ids']);
431
+				$items = json_decode($basketData['doc_ids']);
432 432
 
433
-                $items = get_object_vars($items);
433
+				$items = get_object_vars($items);
434 434
 
435
-            } else {
435
+			} else {
436 436
 
437
-                $items = array ();
437
+				$items = array ();
438 438
 
439
-            }
439
+			}
440 440
 
441
-            // get document instance to load further information
442
-            $document = tx_dlf_document::getInstance($documentItem['id'], 0);
441
+			// get document instance to load further information
442
+			$document = tx_dlf_document::getInstance($documentItem['id'], 0);
443 443
 
444
-            // set endpage for toc and subentry based on logid
445
-            if (($_piVars['addToBasket'] == 'subentry') or ($_piVars['addToBasket'] == 'toc')) {
444
+			// set endpage for toc and subentry based on logid
445
+			if (($_piVars['addToBasket'] == 'subentry') or ($_piVars['addToBasket'] == 'toc')) {
446 446
 
447
-                $smLinks = $document->smLinks;
447
+				$smLinks = $document->smLinks;
448 448
 
449
-                $pageCounter = sizeof($smLinks['l2p'][$_piVars['logId']]);
449
+				$pageCounter = sizeof($smLinks['l2p'][$_piVars['logId']]);
450 450
 
451
-                $documentItem['endpage'] = ($documentItem['startpage'] + $pageCounter) - 1;
451
+				$documentItem['endpage'] = ($documentItem['startpage'] + $pageCounter) - 1;
452 452
 
453
-            }
453
+			}
454 454
 
455
-            // add whole document
456
-            if ($_piVars['addToBasket'] == 'list') {
455
+			// add whole document
456
+			if ($_piVars['addToBasket'] == 'list') {
457 457
 
458
-                $documentItem['endpage'] = $document->numPages;
458
+				$documentItem['endpage'] = $document->numPages;
459 459
 
460
-            }
460
+			}
461 461
 
462
-            $arrayKey = $documentItem['id'].'_'.$page;
462
+			$arrayKey = $documentItem['id'].'_'.$page;
463 463
 
464
-            if (!empty($documentItem['startX'])) {
464
+			if (!empty($documentItem['startX'])) {
465 465
 
466
-                $arrayKey .= '_'.$documentItem['startX'];
466
+				$arrayKey .= '_'.$documentItem['startX'];
467 467
 
468
-            }
468
+			}
469 469
 
470
-            if (!empty($documentItem['endX'])) {
470
+			if (!empty($documentItem['endX'])) {
471 471
 
472
-                $arrayKey .= '_'.$documentItem['endX'];
472
+				$arrayKey .= '_'.$documentItem['endX'];
473 473
 
474
-            }
474
+			}
475 475
 
476
-            // do not add more than one identical object
477
-            if (!in_array($arrayKey, $items)) {
476
+			// do not add more than one identical object
477
+			if (!in_array($arrayKey, $items)) {
478 478
 
479
-                $items[$arrayKey] = $documentItem;
479
+				$items[$arrayKey] = $documentItem;
480 480
 
481
-                // replace url param placeholder
482
-                $pdfParams = str_replace("##startpage##", $documentItem['startpage'], $this->conf['pdfparams']);
481
+				// replace url param placeholder
482
+				$pdfParams = str_replace("##startpage##", $documentItem['startpage'], $this->conf['pdfparams']);
483 483
 
484
-                $pdfParams = str_replace("##docId##", $document->recordId, $pdfParams);
484
+				$pdfParams = str_replace("##docId##", $document->recordId, $pdfParams);
485 485
 
486
-                $pdfParams = str_replace("##startx##", $documentItem['startX'], $pdfParams);
486
+				$pdfParams = str_replace("##startx##", $documentItem['startX'], $pdfParams);
487 487
 
488
-                $pdfParams = str_replace("##starty##", $documentItem['startY'], $pdfParams);
488
+				$pdfParams = str_replace("##starty##", $documentItem['startY'], $pdfParams);
489 489
 
490
-                $pdfParams = str_replace("##endx##", $documentItem['endX'], $pdfParams);
490
+				$pdfParams = str_replace("##endx##", $documentItem['endX'], $pdfParams);
491 491
 
492
-                $pdfParams = str_replace("##endy##", $documentItem['endY'], $pdfParams);
492
+				$pdfParams = str_replace("##endy##", $documentItem['endY'], $pdfParams);
493 493
 
494
-                $pdfParams = str_replace("##rotation##", $documentItem['rotation'], $pdfParams);
494
+				$pdfParams = str_replace("##rotation##", $documentItem['rotation'], $pdfParams);
495 495
 
496
-                if ($documentItem['startpage'] != $documentItem['endpage']) {
496
+				if ($documentItem['startpage'] != $documentItem['endpage']) {
497 497
 
498
-                    $pdfParams = str_replace("##endpage##", $documentItem['endpage'], $pdfParams);
498
+					$pdfParams = str_replace("##endpage##", $documentItem['endpage'], $pdfParams);
499 499
 
500
-                } else {
500
+				} else {
501 501
 
502
-                    // remove parameter endpage
503
-                    $pdfParams = str_replace(",##endpage##", '', $pdfParams);
502
+					// remove parameter endpage
503
+					$pdfParams = str_replace(",##endpage##", '', $pdfParams);
504 504
 
505
-                }
505
+				}
506 506
 
507
-                $pdfGenerateUrl = $this->conf['pdfgenerate'].$pdfParams;
507
+				$pdfGenerateUrl = $this->conf['pdfgenerate'].$pdfParams;
508 508
 
509
-                if ($this->conf['pregeneration']) {
509
+				if ($this->conf['pregeneration']) {
510 510
 
511
-                    // send ajax request to webapp
512
-                    $output .= '
511
+					// send ajax request to webapp
512
+					$output .= '
513 513
 					<script>
514 514
 						$(document).ready(function(){
515 515
 							$.ajax({
@@ -519,431 +519,431 @@  discard block
 block discarded – undo
519 519
 						});
520 520
 					</script>';
521 521
 
522
-                }
522
+				}
523 523
 
524
-            }
524
+			}
525 525
 
526
-            $update = array ('doc_ids' => json_encode($items));
526
+			$update = array ('doc_ids' => json_encode($items));
527 527
 
528
-            $GLOBALS['TYPO3_DB']->exec_UPDATEquery('tx_dlf_basket', 'uid='.intval($basketData['uid']), $update);
528
+			$GLOBALS['TYPO3_DB']->exec_UPDATEquery('tx_dlf_basket', 'uid='.intval($basketData['uid']), $update);
529 529
 
530
-            $basketData['doc_ids'] = $items;
530
+			$basketData['doc_ids'] = $items;
531 531
 
532
-        }
532
+		}
533 533
 
534
-        return array ('basketData' => $basketData, 'jsOutput' => $output);
534
+		return array ('basketData' => $basketData, 'jsOutput' => $output);
535 535
 
536
-    }
536
+	}
537 537
 
538
-    /**
539
-     * Removes selected documents from basket
540
-     * @param  array $_piVars    plugin variables
541
-     * @param  array $basketData array with document information
542
-     * @return array             basket data
543
-     */
544
-    public function removeFromBasket($_piVars, $basketData) {
538
+	/**
539
+	 * Removes selected documents from basket
540
+	 * @param  array $_piVars    plugin variables
541
+	 * @param  array $basketData array with document information
542
+	 * @return array             basket data
543
+	 */
544
+	public function removeFromBasket($_piVars, $basketData) {
545 545
 
546
-        if (!empty($basketData['doc_ids'])) {
546
+		if (!empty($basketData['doc_ids'])) {
547 547
 
548
-            $items = $basketData['doc_ids'];
548
+			$items = $basketData['doc_ids'];
549 549
 
550
-            $items = get_object_vars($items);
550
+			$items = get_object_vars($items);
551 551
 
552
-        }
552
+		}
553 553
 
554
-        foreach ($_piVars['selected'] as $key => $value) {
554
+		foreach ($_piVars['selected'] as $key => $value) {
555 555
 
556
-            if (isset($value['id'])) {
556
+			if (isset($value['id'])) {
557 557
 
558
-                $arrayKey = $value['id'].'_'.$value['startpage'];
558
+				$arrayKey = $value['id'].'_'.$value['startpage'];
559 559
 
560
-                if (isset($value['startX'])) {
560
+				if (isset($value['startX'])) {
561 561
 
562
-                    $arrayKey .= '_'.$value['startX'];
562
+					$arrayKey .= '_'.$value['startX'];
563 563
 
564
-                }
564
+				}
565 565
 
566
-                if (isset($value['endX'])) {
566
+				if (isset($value['endX'])) {
567 567
 
568
-                    $arrayKey .= '_'.$value['endX'];
568
+					$arrayKey .= '_'.$value['endX'];
569 569
 
570
-                }
570
+				}
571 571
 
572
-                if (isset($items[$arrayKey])) {
572
+				if (isset($items[$arrayKey])) {
573 573
 
574
-                    unset($items[$arrayKey]);
574
+					unset($items[$arrayKey]);
575 575
 
576
-                }
576
+				}
577 577
 
578
-            }
578
+			}
579 579
 
580
-        }
580
+		}
581 581
 
582
-        if (empty($items)) {
582
+		if (empty($items)) {
583 583
 
584
-            $update = array ('doc_ids' => '');
584
+			$update = array ('doc_ids' => '');
585 585
 
586
-        } else {
586
+		} else {
587 587
 
588
-            $update = array ('doc_ids' => json_encode($items));
588
+			$update = array ('doc_ids' => json_encode($items));
589 589
 
590
-        }
590
+		}
591 591
 
592
-        $GLOBALS['TYPO3_DB']->exec_UPDATEquery('tx_dlf_basket', 'uid='.intval($basketData['uid']), $update);
592
+		$GLOBALS['TYPO3_DB']->exec_UPDATEquery('tx_dlf_basket', 'uid='.intval($basketData['uid']), $update);
593 593
 
594
-        $basketData['doc_ids'] = $items;
594
+		$basketData['doc_ids'] = $items;
595 595
 
596
-        return $basketData;
596
+		return $basketData;
597 597
 
598
-    }
598
+	}
599 599
 
600
-    /**
601
-     * Open selected documents from basket
602
-     * @param  array $_piVars    plugin variables
603
-     * @param  array $basketData array with document information
604
-     * @return array             basket data
605
-     */
606
-    public function openFromBasket($_piVars, $basketData) {
600
+	/**
601
+	 * Open selected documents from basket
602
+	 * @param  array $_piVars    plugin variables
603
+	 * @param  array $basketData array with document information
604
+	 * @return array             basket data
605
+	 */
606
+	public function openFromBasket($_piVars, $basketData) {
607 607
 
608
-        $pdfUrl = $this->conf['pdfgenerate'];
608
+		$pdfUrl = $this->conf['pdfgenerate'];
609 609
 
610
-        foreach ($this->piVars['selected'] as $docId => $docValue) {
610
+		foreach ($this->piVars['selected'] as $docId => $docValue) {
611 611
 
612
-            if ($docValue['id']) {
612
+			if ($docValue['id']) {
613 613
 
614
-                $filename .= $docValue['id'].'_';
614
+				$filename .= $docValue['id'].'_';
615 615
 
616
-                $docData = $this->getDocumentData($docValue['id'], $docValue);
616
+				$docData = $this->getDocumentData($docValue['id'], $docValue);
617 617
 
618
-                $pdfUrl .= $docData['urlParams'].$this->conf['pdfparamseparator'];
618
+				$pdfUrl .= $docData['urlParams'].$this->conf['pdfparamseparator'];
619 619
 
620
-                $numberOfPages += $docData['pageNums'];
620
+				$numberOfPages += $docData['pageNums'];
621 621
 
622
-            }
622
+			}
623 623
 
624
-        }
624
+		}
625 625
 
626
-        header('Location: '.$pdfUrl);
626
+		header('Location: '.$pdfUrl);
627 627
 
628
-        ob_end_flush();
628
+		ob_end_flush();
629 629
 
630
-        exit;
630
+		exit;
631 631
 
632
-    }
632
+	}
633 633
 
634
-    /**
635
-     * Returns the downloadurl configured in the basket
636
-     * @param  integer $id Document id
637
-     * @return mixed     download url or false
638
-     */
639
-    public function getDocumentData($id, $data) {
634
+	/**
635
+	 * Returns the downloadurl configured in the basket
636
+	 * @param  integer $id Document id
637
+	 * @return mixed     download url or false
638
+	 */
639
+	public function getDocumentData($id, $data) {
640 640
 
641
-        // get document instance to load further information
642
-        $document = tx_dlf_document::getInstance($id, 0);
641
+		// get document instance to load further information
642
+		$document = tx_dlf_document::getInstance($id, 0);
643 643
 
644
-        if ($document) {
644
+		if ($document) {
645 645
 
646
-            // replace url param placeholder
647
-            $urlParams = str_replace("##page##", intval($data['page']), $this->conf['pdfparams']);
646
+			// replace url param placeholder
647
+			$urlParams = str_replace("##page##", intval($data['page']), $this->conf['pdfparams']);
648 648
 
649
-            $urlParams = str_replace("##docId##", $document->recordId, $urlParams);
649
+			$urlParams = str_replace("##docId##", $document->recordId, $urlParams);
650 650
 
651
-            $urlParams = str_replace("##startpage##", intval($data['startpage']), $urlParams);
651
+			$urlParams = str_replace("##startpage##", intval($data['startpage']), $urlParams);
652 652
 
653
-            if ($data['startpage'] != $data['endpage']) {
653
+			if ($data['startpage'] != $data['endpage']) {
654 654
 
655
-                $urlParams = str_replace("##endpage##", intval($data['endpage']), $urlParams);
655
+				$urlParams = str_replace("##endpage##", intval($data['endpage']), $urlParams);
656 656
 
657
-            } else {
657
+			} else {
658 658
 
659
-                // remove parameter endpage
660
-                $urlParams = str_replace(",##endpage##", '', $urlParams);
659
+				// remove parameter endpage
660
+				$urlParams = str_replace(",##endpage##", '', $urlParams);
661 661
 
662
-            }
662
+			}
663 663
 
664
-            $urlParams = str_replace("##startx##", intval($data['startX']), $urlParams);
664
+			$urlParams = str_replace("##startx##", intval($data['startX']), $urlParams);
665 665
 
666
-            $urlParams = str_replace("##starty##", intval($data['startY']), $urlParams);
666
+			$urlParams = str_replace("##starty##", intval($data['startY']), $urlParams);
667 667
 
668
-            $urlParams = str_replace("##endx##", intval($data['endX']), $urlParams);
668
+			$urlParams = str_replace("##endx##", intval($data['endX']), $urlParams);
669 669
 
670
-            $urlParams = str_replace("##endy##", intval($data['endY']), $urlParams);
670
+			$urlParams = str_replace("##endy##", intval($data['endY']), $urlParams);
671 671
 
672
-            $urlParams = str_replace("##rotation##", intval($data['rotation']), $urlParams);
672
+			$urlParams = str_replace("##rotation##", intval($data['rotation']), $urlParams);
673 673
 
674
-            $downloadUrl = $this->conf['pdfgenerate'].$urlParams;
674
+			$downloadUrl = $this->conf['pdfgenerate'].$urlParams;
675 675
 
676
-            $title = $document->getTitle($id, TRUE);
676
+			$title = $document->getTitle($id, TRUE);
677 677
 
678
-            if (empty($title)) {
678
+			if (empty($title)) {
679 679
 
680
-                $title = $this->pi_getLL('noTitle', '', TRUE);
680
+				$title = $this->pi_getLL('noTitle', '', TRUE);
681 681
 
682
-            }
682
+			}
683 683
 
684
-            // Set page and cutout information
685
-            $info = '';
684
+			// Set page and cutout information
685
+			$info = '';
686 686
 
687
-            if ($data['startX'] != '' && $data['endX'] != '') {
687
+			if ($data['startX'] != '' && $data['endX'] != '') {
688 688
 
689
-                // cutout
690
-                $info .= $this->pi_getLL('cutout', '', TRUE).' ';
689
+				// cutout
690
+				$info .= $this->pi_getLL('cutout', '', TRUE).' ';
691 691
 
692
-            }
692
+			}
693 693
 
694
-            if ($data['startpage'] == $data['endpage']) {
694
+			if ($data['startpage'] == $data['endpage']) {
695 695
 
696
-                // One page
697
-                $info .= $this->pi_getLL('page', '', TRUE).' '.$data['startpage'];
696
+				// One page
697
+				$info .= $this->pi_getLL('page', '', TRUE).' '.$data['startpage'];
698 698
 
699
-            } else {
699
+			} else {
700 700
 
701
-                $info .= $this->pi_getLL('page', '', TRUE).' '.$data['startpage'].'-'.$data['endpage'];
701
+				$info .= $this->pi_getLL('page', '', TRUE).' '.$data['startpage'].'-'.$data['endpage'];
702 702
 
703
-            }
703
+			}
704 704
 
705
-            $downloadLink = '<a href="'.$downloadUrl.'" target="_blank">'.$title.'</a> ('.$info.')';
705
+			$downloadLink = '<a href="'.$downloadUrl.'" target="_blank">'.$title.'</a> ('.$info.')';
706 706
 
707
-            if ($data['startpage'] == $data['endpage']) {
707
+			if ($data['startpage'] == $data['endpage']) {
708 708
 
709
-                $pageNums = 1;
709
+				$pageNums = 1;
710 710
 
711
-            } else {
711
+			} else {
712 712
 
713
-                $pageNums = $data['endpage'] - $data['startpage'];
713
+				$pageNums = $data['endpage'] - $data['startpage'];
714 714
 
715
-            }
715
+			}
716 716
 
717
-            return array (
718
-                'downloadUrl' => $downloadUrl,
719
-                'downloadLink' => $downloadLink,
720
-                'pageNums'	=> $pageNums,
721
-                'urlParams' => $urlParams,
722
-                'record_id' => $document->recordId,
723
-            );
717
+			return array (
718
+				'downloadUrl' => $downloadUrl,
719
+				'downloadLink' => $downloadLink,
720
+				'pageNums'	=> $pageNums,
721
+				'urlParams' => $urlParams,
722
+				'record_id' => $document->recordId,
723
+			);
724 724
 
725
-        }
725
+		}
726 726
 
727
-        return FALSE;
727
+		return FALSE;
728 728
 
729
-    }
729
+	}
730 730
 
731
-    /**
732
-     * Send mail with pdf download url
733
-     */
734
-    public function sendMail() {
731
+	/**
732
+	 * Send mail with pdf download url
733
+	 */
734
+	public function sendMail() {
735 735
 
736
-        // send mail
737
-        $mailId = $this->piVars['mail_action'];
736
+		// send mail
737
+		$mailId = $this->piVars['mail_action'];
738 738
 
739
-        // get id from db and send selected doc downloadlink
740
-        $resultMail = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
741
-            '*',
742
-            'tx_dlf_mail',
743
-            'tx_dlf_mail.uid="'.intval($mailId).'"'.tx_dlf_helper::whereClause('tx_dlf_mail'),
744
-            '',
745
-            '',
746
-            '1'
747
-        );
739
+		// get id from db and send selected doc downloadlink
740
+		$resultMail = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
741
+			'*',
742
+			'tx_dlf_mail',
743
+			'tx_dlf_mail.uid="'.intval($mailId).'"'.tx_dlf_helper::whereClause('tx_dlf_mail'),
744
+			'',
745
+			'',
746
+			'1'
747
+		);
748 748
 
749
-        $mailData = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($resultMail);
749
+		$mailData = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($resultMail);
750 750
 
751
-        $body = $this->pi_getLL('mailBody', '', TRUE)."\n";
751
+		$body = $this->pi_getLL('mailBody', '', TRUE)."\n";
752 752
 
753
-        $numberOfPages = 0;
753
+		$numberOfPages = 0;
754 754
 
755
-        $pdfUrl = $this->conf['pdfdownload'];
755
+		$pdfUrl = $this->conf['pdfdownload'];
756 756
 
757
-        // prepare links
758
-        foreach ($this->piVars['selected'] as $docId => $docValue) {
757
+		// prepare links
758
+		foreach ($this->piVars['selected'] as $docId => $docValue) {
759 759
 
760
-            if ($docValue['id']) {
760
+			if ($docValue['id']) {
761 761
 
762
-                $explodeId = explode("_", $docValue['id']);
762
+				$explodeId = explode("_", $docValue['id']);
763 763
 
764
-                $docData = $this->getDocumentData($explodeId[0], $docValue);
764
+				$docData = $this->getDocumentData($explodeId[0], $docValue);
765 765
 
766
-                $pdfUrl .= $docData['urlParams'].$this->conf['pdfparamseparator'];
766
+				$pdfUrl .= $docData['urlParams'].$this->conf['pdfparamseparator'];
767 767
 
768
-                $pages = (abs(intval($docValue['startpage']) - intval($docValue['endpage'])));
768
+				$pages = (abs(intval($docValue['startpage']) - intval($docValue['endpage'])));
769 769
 
770
-                if ($pages === 0) {
770
+				if ($pages === 0) {
771 771
 
772
-                    $numberOfPages = $numberOfPages + 1;
772
+					$numberOfPages = $numberOfPages + 1;
773 773
 
774
-                } else {
774
+				} else {
775 775
 
776
-                    $numberOfPages = $numberOfPages + $pages;
776
+					$numberOfPages = $numberOfPages + $pages;
777 777
 
778
-                }
778
+				}
779 779
 
780
-            }
780
+			}
781 781
 
782
-        }
782
+		}
783 783
 
784
-        // Remove leading/tailing pdfparamseperator
785
-        $pdfUrl = trim($pdfUrl, $this->conf['pdfparamseparator']);
784
+		// Remove leading/tailing pdfparamseperator
785
+		$pdfUrl = trim($pdfUrl, $this->conf['pdfparamseparator']);
786 786
 
787
-        $body .= $pdfUrl;
787
+		$body .= $pdfUrl;
788 788
 
789
-        $from = \TYPO3\CMS\Core\Utility\MailUtility::getSystemFrom();
789
+		$from = \TYPO3\CMS\Core\Utility\MailUtility::getSystemFrom();
790 790
 
791
-        // send mail
792
-        $mail = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Mail\\MailMessage');
791
+		// send mail
792
+		$mail = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Mail\\MailMessage');
793 793
 
794
-        // Prepare and send the message
795
-        $mail
796
-            // subject
797
-            ->setSubject($this->pi_getLL('mailSubject', '', TRUE))
794
+		// Prepare and send the message
795
+		$mail
796
+			// subject
797
+			->setSubject($this->pi_getLL('mailSubject', '', TRUE))
798 798
 
799
-            // Set the From address with an associative array
800
-            ->setFrom($from)
799
+			// Set the From address with an associative array
800
+			->setFrom($from)
801 801
 
802
-            // Set the To addresses with an associative array
803
-            ->setTo(array ($mailData['mail'] => $mailData['name']))
802
+			// Set the To addresses with an associative array
803
+			->setTo(array ($mailData['mail'] => $mailData['name']))
804 804
 
805
-            ->setBody($body, 'text/html')
805
+			->setBody($body, 'text/html')
806 806
 
807
-            ->send()
808
-        ;
807
+			->send()
808
+		;
809 809
 
810
-        // protocol
811
-        $insertArray = array (
812
-            'pid' => $this->conf['pages'],
813
-            'file_name' => $pdfUrl,
814
-            'count_pages' => $numberOfPages,
815
-            'crdate' => time(),
816
-        );
810
+		// protocol
811
+		$insertArray = array (
812
+			'pid' => $this->conf['pages'],
813
+			'file_name' => $pdfUrl,
814
+			'count_pages' => $numberOfPages,
815
+			'crdate' => time(),
816
+		);
817 817
 
818
-        if ($GLOBALS["TSFE"]->loginUser) {
818
+		if ($GLOBALS["TSFE"]->loginUser) {
819 819
 
820
-            // internal user
821
-            $insertArray['user_id'] = $GLOBALS["TSFE"]->fe_user->user['uid'];
820
+			// internal user
821
+			$insertArray['user_id'] = $GLOBALS["TSFE"]->fe_user->user['uid'];
822 822
 
823
-            $insertArray['name'] = $GLOBALS["TSFE"]->fe_user->user['username'];
823
+			$insertArray['name'] = $GLOBALS["TSFE"]->fe_user->user['username'];
824 824
 
825
-            $insertArray['label'] = 'Mail: '.$mailData['mail'];
825
+			$insertArray['label'] = 'Mail: '.$mailData['mail'];
826 826
 
827
-        } else {
827
+		} else {
828 828
 
829
-            // external user
830
-            $insertArray['user_id'] = 0;
829
+			// external user
830
+			$insertArray['user_id'] = 0;
831 831
 
832
-            $insertArray['name'] = 'n/a';
832
+			$insertArray['name'] = 'n/a';
833 833
 
834
-            $insertArray['label'] = 'Mail: '.$mailData['mail'];
834
+			$insertArray['label'] = 'Mail: '.$mailData['mail'];
835 835
 
836
-        }
836
+		}
837 837
 
838
-        // add action to protocol
839
-        $GLOBALS['TYPO3_DB']->exec_INSERTquery('tx_dlf_actionlog', $insertArray);
838
+		// add action to protocol
839
+		$GLOBALS['TYPO3_DB']->exec_INSERTquery('tx_dlf_actionlog', $insertArray);
840 840
 
841
-    }
841
+	}
842 842
 
843
-    /**
844
-     * Sends document information to an external printer (url)
845
-     */
846
-    public function printDocument() {
843
+	/**
844
+	 * Sends document information to an external printer (url)
845
+	 */
846
+	public function printDocument() {
847 847
 
848
-        $pdfUrl = $this->conf['pdfprint'];
848
+		$pdfUrl = $this->conf['pdfprint'];
849 849
 
850
-        foreach ($this->piVars['selected'] as $docId => $docValue) {
850
+		foreach ($this->piVars['selected'] as $docId => $docValue) {
851 851
 
852
-            if ($docValue['id']) {
852
+			if ($docValue['id']) {
853 853
 
854
-                $docData = $this->getDocumentData($docValue['id'], $docValue);
854
+				$docData = $this->getDocumentData($docValue['id'], $docValue);
855 855
 
856
-                $pdfUrl .= $docData['urlParams'].$this->conf['pdfparamseparator'];
856
+				$pdfUrl .= $docData['urlParams'].$this->conf['pdfparamseparator'];
857 857
 
858
-                $numberOfPages += $docData['pageNums'];
858
+				$numberOfPages += $docData['pageNums'];
859 859
 
860
-            }
860
+			}
861 861
 
862
-        }
862
+		}
863 863
 
864
-        // get printer data
865
-        $printerId = $this->piVars['print_action'];
864
+		// get printer data
865
+		$printerId = $this->piVars['print_action'];
866 866
 
867
-        // get id from db and send selected doc downloadlink
868
-        $resultPrinter = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
869
-            '*',
870
-            'tx_dlf_printer',
871
-            'tx_dlf_printer.uid="'.intval($printerId).'"'.tx_dlf_helper::whereClause('tx_dlf_basket'),
872
-            '',
873
-            '',
874
-            '1'
875
-        );
867
+		// get id from db and send selected doc downloadlink
868
+		$resultPrinter = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
869
+			'*',
870
+			'tx_dlf_printer',
871
+			'tx_dlf_printer.uid="'.intval($printerId).'"'.tx_dlf_helper::whereClause('tx_dlf_basket'),
872
+			'',
873
+			'',
874
+			'1'
875
+		);
876 876
 
877
-        $printerData = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($resultPrinter);
877
+		$printerData = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($resultPrinter);
878 878
 
879
-        // printer is selected
880
-        if ($printerData) {
879
+		// printer is selected
880
+		if ($printerData) {
881 881
 
882
-            $pdfUrl = $printerData['print'];
882
+			$pdfUrl = $printerData['print'];
883 883
 
884
-            $filename = 'Document_';
884
+			$filename = 'Document_';
885 885
 
886
-            $numberOfPages = 0;
886
+			$numberOfPages = 0;
887 887
 
888
-            foreach ($this->piVars['selected'] as $docId => $docValue) {
888
+			foreach ($this->piVars['selected'] as $docId => $docValue) {
889 889
 
890
-                if ($docValue['id']) {
890
+				if ($docValue['id']) {
891 891
 
892
-                    $filename .= $docValue['id'].'_';
892
+					$filename .= $docValue['id'].'_';
893 893
 
894
-                    $explodeId = explode("_", $docId);
894
+					$explodeId = explode("_", $docId);
895 895
 
896
-                    $docData = $this->getDocumentData($explodeId[0], $docValue);
896
+					$docData = $this->getDocumentData($explodeId[0], $docValue);
897 897
 
898
-                    $pdfUrl .= $docData['urlParams'].$this->conf['pdfparamseparator'];
898
+					$pdfUrl .= $docData['urlParams'].$this->conf['pdfparamseparator'];
899 899
 
900
-                    $numberOfPages += $docData['pageNums'];
900
+					$numberOfPages += $docData['pageNums'];
901 901
 
902
-                }
902
+				}
903 903
 
904
-            }
904
+			}
905 905
 
906
-            $pdfUrl = trim($pdfUrl, $this->conf['pdfparamseparator']);
906
+			$pdfUrl = trim($pdfUrl, $this->conf['pdfparamseparator']);
907 907
 
908
-        }
908
+		}
909 909
 
910
-        // protocol
911
-        $insertArray = array (
912
-            'pid' => $this->conf['pages'],
913
-            'file_name' => $pdfUrl,
914
-            'count_pages' => $numberOfPages,
915
-            'crdate' => time(),
916
-        );
910
+		// protocol
911
+		$insertArray = array (
912
+			'pid' => $this->conf['pages'],
913
+			'file_name' => $pdfUrl,
914
+			'count_pages' => $numberOfPages,
915
+			'crdate' => time(),
916
+		);
917 917
 
918
-        if ($GLOBALS["TSFE"]->loginUser) {
918
+		if ($GLOBALS["TSFE"]->loginUser) {
919 919
 
920
-            // internal user
921
-            $insertArray['user_id'] = $GLOBALS["TSFE"]->fe_user->user['uid'];
920
+			// internal user
921
+			$insertArray['user_id'] = $GLOBALS["TSFE"]->fe_user->user['uid'];
922 922
 
923
-            $insertArray['name'] = $GLOBALS["TSFE"]->fe_user->user['username'];
923
+			$insertArray['name'] = $GLOBALS["TSFE"]->fe_user->user['username'];
924 924
 
925
-            $insertArray['label'] = 'Print: '.$printerData['label'];
925
+			$insertArray['label'] = 'Print: '.$printerData['label'];
926 926
 
927
-        } else {
927
+		} else {
928 928
 
929
-            // external user
930
-            $insertArray['user_id'] = 0;
929
+			// external user
930
+			$insertArray['user_id'] = 0;
931 931
 
932
-            $insertArray['name'] = 'n/a';
932
+			$insertArray['name'] = 'n/a';
933 933
 
934
-            $insertArray['label'] = 'Print: '.$printerData['label'];
934
+			$insertArray['label'] = 'Print: '.$printerData['label'];
935 935
 
936
-        }
936
+		}
937 937
 
938
-        // add action to protocol
939
-        $GLOBALS['TYPO3_DB']->exec_INSERTquery('tx_dlf_actionlog', $insertArray);
938
+		// add action to protocol
939
+		$GLOBALS['TYPO3_DB']->exec_INSERTquery('tx_dlf_actionlog', $insertArray);
940 940
 
941
-        header('Location: '.$pdfUrl);
941
+		header('Location: '.$pdfUrl);
942 942
 
943
-        ob_end_flush();
943
+		ob_end_flush();
944 944
 
945
-        exit;
945
+		exit;
946 946
 
947
-    }
947
+	}
948 948
 
949 949
 }
950 950
\ No newline at end of file
Please login to merge, or discard this patch.
plugins/navigation/class.tx_dlf_navigation.php 1 patch
Indentation   +195 added lines, -195 removed lines patch added patch discarded remove patch
@@ -19,315 +19,315 @@
 block discarded – undo
19 19
  */
20 20
 class tx_dlf_navigation extends tx_dlf_plugin {
21 21
 
22
-    public $scriptRelPath = 'plugins/navigation/class.tx_dlf_navigation.php';
22
+	public $scriptRelPath = 'plugins/navigation/class.tx_dlf_navigation.php';
23 23
 
24
-    /**
25
-     * Display a link to the list view
26
-     *
27
-     * @access	protected
28
-     *
29
-     * @return	string		Link to the list view ready to output
30
-     */
31
-    protected function getLinkToListview() {
24
+	/**
25
+	 * Display a link to the list view
26
+	 *
27
+	 * @access	protected
28
+	 *
29
+	 * @return	string		Link to the list view ready to output
30
+	 */
31
+	protected function getLinkToListview() {
32 32
 
33
-        if (!empty($this->conf['targetPid'])) {
33
+		if (!empty($this->conf['targetPid'])) {
34 34
 
35
-            // Load the list.
36
-            $list = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('tx_dlf_list');
35
+			// Load the list.
36
+			$list = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('tx_dlf_list');
37 37
 
38
-            if (count($list) > 0) {
38
+			if (count($list) > 0) {
39 39
 
40
-                // Build typolink configuration array.
41
-                $conf = array (
42
-                    'useCacheHash' => 1,
43
-                    'parameter' => $this->conf['targetPid'],
44
-                    'title' => $this->pi_getLL('linkToList', '', TRUE)
45
-                );
40
+				// Build typolink configuration array.
41
+				$conf = array (
42
+					'useCacheHash' => 1,
43
+					'parameter' => $this->conf['targetPid'],
44
+					'title' => $this->pi_getLL('linkToList', '', TRUE)
45
+				);
46 46
 
47
-                return $this->cObj->typoLink($this->pi_getLL('linkToList', '', TRUE), $conf);
47
+				return $this->cObj->typoLink($this->pi_getLL('linkToList', '', TRUE), $conf);
48 48
 
49
-            }
49
+			}
50 50
 
51
-        }
51
+		}
52 52
 
53
-        return '';
53
+		return '';
54 54
 
55
-    }
55
+	}
56 56
 
57
-    /**
58
-     * Display the page selector for the page view
59
-     *
60
-     * @access	protected
61
-     *
62
-     * @return	string		Page selector ready to output
63
-     */
64
-    protected function getPageSelector() {
57
+	/**
58
+	 * Display the page selector for the page view
59
+	 *
60
+	 * @access	protected
61
+	 *
62
+	 * @return	string		Page selector ready to output
63
+	 */
64
+	protected function getPageSelector() {
65 65
 
66
-        // Configure @action URL for form.
67
-        $linkConf = array (
68
-            'parameter' => $GLOBALS['TSFE']->id,
69
-            'forceAbsoluteUrl' => 1
70
-        );
66
+		// Configure @action URL for form.
67
+		$linkConf = array (
68
+			'parameter' => $GLOBALS['TSFE']->id,
69
+			'forceAbsoluteUrl' => 1
70
+		);
71 71
 
72
-        $output = '<form action="'.$this->cObj->typoLink_URL($linkConf).'" method="get"><div><input type="hidden" name="id" value="'.$GLOBALS['TSFE']->id.'" />';
72
+		$output = '<form action="'.$this->cObj->typoLink_URL($linkConf).'" method="get"><div><input type="hidden" name="id" value="'.$GLOBALS['TSFE']->id.'" />';
73 73
 
74
-        // Add plugin variables.
75
-        foreach ($this->piVars as $piVar => $value) {
74
+		// Add plugin variables.
75
+		foreach ($this->piVars as $piVar => $value) {
76 76
 
77
-            if ($piVar != 'page' && $piVars != 'DATA' && !empty($value)) {
77
+			if ($piVar != 'page' && $piVars != 'DATA' && !empty($value)) {
78 78
 
79
-                $output .= '<input type="hidden" name="'.$this->prefixId.'['.$piVar.']" value="'.$value.'" />';
79
+				$output .= '<input type="hidden" name="'.$this->prefixId.'['.$piVar.']" value="'.$value.'" />';
80 80
 
81
-            }
81
+			}
82 82
 
83
-        }
83
+		}
84 84
 
85
-        // Add page selector.
86
-        $uniqId = uniqid(str_replace('_', '-', get_class($this)).'-');
85
+		// Add page selector.
86
+		$uniqId = uniqid(str_replace('_', '-', get_class($this)).'-');
87 87
 
88
-        $output .= '<label for="'.$uniqId.'">'.$this->pi_getLL('selectPage', '', TRUE).'</label><select id="'.$uniqId.'" name="'.$this->prefixId.'[page]" onchange="javascript:this.form.submit();"'.($this->doc->numPages < 1 ? ' disabled="disabled"' : '').'>';
88
+		$output .= '<label for="'.$uniqId.'">'.$this->pi_getLL('selectPage', '', TRUE).'</label><select id="'.$uniqId.'" name="'.$this->prefixId.'[page]" onchange="javascript:this.form.submit();"'.($this->doc->numPages < 1 ? ' disabled="disabled"' : '').'>';
89 89
 
90
-        for ($i = 1; $i <= $this->doc->numPages; $i++) {
90
+		for ($i = 1; $i <= $this->doc->numPages; $i++) {
91 91
 
92
-            $output .= '<option value="'.$i.'"'.($this->piVars['page'] == $i ? ' selected="selected"' : '').'>['.$i.']'.($this->doc->physicalStructureInfo[$this->doc->physicalStructure[$i]]['orderlabel'] ? ' - '.htmlspecialchars($this->doc->physicalStructureInfo[$this->doc->physicalStructure[$i]]['orderlabel']) : '').'</option>';
92
+			$output .= '<option value="'.$i.'"'.($this->piVars['page'] == $i ? ' selected="selected"' : '').'>['.$i.']'.($this->doc->physicalStructureInfo[$this->doc->physicalStructure[$i]]['orderlabel'] ? ' - '.htmlspecialchars($this->doc->physicalStructureInfo[$this->doc->physicalStructure[$i]]['orderlabel']) : '').'</option>';
93 93
 
94
-        }
94
+		}
95 95
 
96
-        $output .= '</select></div></form>';
96
+		$output .= '</select></div></form>';
97 97
 
98
-        return $output;
98
+		return $output;
99 99
 
100
-    }
100
+	}
101 101
 
102
-    /**
103
-     * The main method of the PlugIn
104
-     *
105
-     * @access	public
106
-     *
107
-     * @param	string		$content: The PlugIn content
108
-     * @param	array		$conf: The PlugIn configuration
109
-     *
110
-     * @return	string		The content that is displayed on the website
111
-     */
112
-    public function main($content, $conf) {
102
+	/**
103
+	 * The main method of the PlugIn
104
+	 *
105
+	 * @access	public
106
+	 *
107
+	 * @param	string		$content: The PlugIn content
108
+	 * @param	array		$conf: The PlugIn configuration
109
+	 *
110
+	 * @return	string		The content that is displayed on the website
111
+	 */
112
+	public function main($content, $conf) {
113 113
 
114
-        $this->init($conf);
114
+		$this->init($conf);
115 115
 
116
-        // Turn cache on.
117
-        $this->setCache(TRUE);
116
+		// Turn cache on.
117
+		$this->setCache(TRUE);
118 118
 
119
-        // Load current document.
120
-        $this->loadDocument();
119
+		// Load current document.
120
+		$this->loadDocument();
121 121
 
122
-        if ($this->doc === NULL) {
122
+		if ($this->doc === NULL) {
123 123
 
124
-            // Quit without doing anything if required variables are not set.
125
-            return $content;
124
+			// Quit without doing anything if required variables are not set.
125
+			return $content;
126 126
 
127
-        } else {
127
+		} else {
128 128
 
129
-            // Set default values if not set.
130
-            if ($this->doc->numPages > 0) {
129
+			// Set default values if not set.
130
+			if ($this->doc->numPages > 0) {
131 131
 
132
-                if (!empty($this->piVars['logicalPage'])) {
132
+				if (!empty($this->piVars['logicalPage'])) {
133 133
 
134
-                    $this->piVars['page'] = $this->doc->getPhysicalPage($this->piVars['logicalPage']);
135
-                    // The logical page parameter should not appear
136
-                    unset($this->piVars['logicalPage']);
134
+					$this->piVars['page'] = $this->doc->getPhysicalPage($this->piVars['logicalPage']);
135
+					// The logical page parameter should not appear
136
+					unset($this->piVars['logicalPage']);
137 137
 
138
-                }
138
+				}
139 139
 
140
-                // Set default values if not set.
141
-                // $this->piVars['page'] may be integer or string (physical structure @ID)
142
-                if ((int) $this->piVars['page'] > 0 || empty($this->piVars['page'])) {
140
+				// Set default values if not set.
141
+				// $this->piVars['page'] may be integer or string (physical structure @ID)
142
+				if ((int) $this->piVars['page'] > 0 || empty($this->piVars['page'])) {
143 143
 
144
-                    $this->piVars['page'] = \TYPO3\CMS\Core\Utility\MathUtility::forceIntegerInRange((int) $this->piVars['page'], 1, $this->doc->numPages, 1);
144
+					$this->piVars['page'] = \TYPO3\CMS\Core\Utility\MathUtility::forceIntegerInRange((int) $this->piVars['page'], 1, $this->doc->numPages, 1);
145 145
 
146
-                } else {
146
+				} else {
147 147
 
148
-                    $this->piVars['page'] = array_search($this->piVars['page'], $this->doc->physicalStructure);
148
+					$this->piVars['page'] = array_search($this->piVars['page'], $this->doc->physicalStructure);
149 149
 
150
-                }
150
+				}
151 151
 
152
-                $this->piVars['double'] = \TYPO3\CMS\Core\Utility\MathUtility::forceIntegerInRange($this->piVars['double'], 0, 1, 0);
152
+				$this->piVars['double'] = \TYPO3\CMS\Core\Utility\MathUtility::forceIntegerInRange($this->piVars['double'], 0, 1, 0);
153 153
 
154
-            } else {
154
+			} else {
155 155
 
156
-                $this->piVars['page'] = 0;
156
+				$this->piVars['page'] = 0;
157 157
 
158
-                $this->piVars['double'] = 0;
158
+				$this->piVars['double'] = 0;
159 159
 
160
-            }
160
+			}
161 161
 
162
-        }
162
+		}
163 163
 
164
-        // Load template file.
165
-        if (!empty($this->conf['templateFile'])) {
164
+		// Load template file.
165
+		if (!empty($this->conf['templateFile'])) {
166 166
 
167
-            $this->template = $this->cObj->getSubpart($this->cObj->fileResource($this->conf['templateFile']), '###TEMPLATE###');
167
+			$this->template = $this->cObj->getSubpart($this->cObj->fileResource($this->conf['templateFile']), '###TEMPLATE###');
168 168
 
169
-        } else {
169
+		} else {
170 170
 
171
-            $this->template = $this->cObj->getSubpart($this->cObj->fileResource('EXT:dlf/plugins/navigation/template.tmpl'), '###TEMPLATE###');
171
+			$this->template = $this->cObj->getSubpart($this->cObj->fileResource('EXT:dlf/plugins/navigation/template.tmpl'), '###TEMPLATE###');
172 172
 
173
-        }
173
+		}
174 174
 
175
-        // Steps for X pages backward / forward. Double page view uses double steps.
176
-        $pageSteps = $this->conf['pageStep'] * ($this->piVars['double'] + 1);
175
+		// Steps for X pages backward / forward. Double page view uses double steps.
176
+		$pageSteps = $this->conf['pageStep'] * ($this->piVars['double'] + 1);
177 177
 
178
-        // Link to first page.
179
-        if ($this->piVars['page'] > 1) {
178
+		// Link to first page.
179
+		if ($this->piVars['page'] > 1) {
180 180
 
181
-            $markerArray['###FIRST###'] = $this->makeLink($this->pi_getLL('firstPage', '', TRUE), array ('page' => 1));
181
+			$markerArray['###FIRST###'] = $this->makeLink($this->pi_getLL('firstPage', '', TRUE), array ('page' => 1));
182 182
 
183
-        } else {
183
+		} else {
184 184
 
185
-            $markerArray['###FIRST###'] = '<span>'.$this->pi_getLL('firstPage', '', TRUE).'</span>';
185
+			$markerArray['###FIRST###'] = '<span>'.$this->pi_getLL('firstPage', '', TRUE).'</span>';
186 186
 
187
-        }
187
+		}
188 188
 
189
-        // Link back X pages.
190
-        if ($this->piVars['page'] > $pageSteps) {
189
+		// Link back X pages.
190
+		if ($this->piVars['page'] > $pageSteps) {
191 191
 
192
-            $markerArray['###BACK###'] = $this->makeLink(sprintf($this->pi_getLL('backXPages', '', TRUE), $pageSteps), array ('page' => $this->piVars['page'] - $pageSteps));
192
+			$markerArray['###BACK###'] = $this->makeLink(sprintf($this->pi_getLL('backXPages', '', TRUE), $pageSteps), array ('page' => $this->piVars['page'] - $pageSteps));
193 193
 
194
-        } else {
194
+		} else {
195 195
 
196
-            $markerArray['###BACK###'] = '<span>'.sprintf($this->pi_getLL('backXPages', '', TRUE), $pageSteps).'</span>';
196
+			$markerArray['###BACK###'] = '<span>'.sprintf($this->pi_getLL('backXPages', '', TRUE), $pageSteps).'</span>';
197 197
 
198
-        }
198
+		}
199 199
 
200
-        // Link to previous page.
201
-        if ($this->piVars['page'] > (1 + $this->piVars['double'])) {
200
+		// Link to previous page.
201
+		if ($this->piVars['page'] > (1 + $this->piVars['double'])) {
202 202
 
203
-            $markerArray['###PREVIOUS###'] = $this->makeLink($this->pi_getLL('prevPage', '', TRUE), array ('page' => $this->piVars['page'] - (1 + $this->piVars['double'])));
203
+			$markerArray['###PREVIOUS###'] = $this->makeLink($this->pi_getLL('prevPage', '', TRUE), array ('page' => $this->piVars['page'] - (1 + $this->piVars['double'])));
204 204
 
205
-        } else {
205
+		} else {
206 206
 
207
-            $markerArray['###PREVIOUS###'] = '<span>'.$this->pi_getLL('prevPage', '', TRUE).'</span>';
207
+			$markerArray['###PREVIOUS###'] = '<span>'.$this->pi_getLL('prevPage', '', TRUE).'</span>';
208 208
 
209
-        }
209
+		}
210 210
 
211
-        // Link to next page.
212
-        if ($this->piVars['page'] < ($this->doc->numPages - $this->piVars['double'])) {
211
+		// Link to next page.
212
+		if ($this->piVars['page'] < ($this->doc->numPages - $this->piVars['double'])) {
213 213
 
214
-            $markerArray['###NEXT###'] = $this->makeLink($this->pi_getLL('nextPage', '', TRUE), array ('page' => $this->piVars['page'] + (1 + $this->piVars['double'])));
214
+			$markerArray['###NEXT###'] = $this->makeLink($this->pi_getLL('nextPage', '', TRUE), array ('page' => $this->piVars['page'] + (1 + $this->piVars['double'])));
215 215
 
216
-        } else {
216
+		} else {
217 217
 
218
-            $markerArray['###NEXT###'] = '<span>'.$this->pi_getLL('nextPage', '', TRUE).'</span>';
218
+			$markerArray['###NEXT###'] = '<span>'.$this->pi_getLL('nextPage', '', TRUE).'</span>';
219 219
 
220
-        }
220
+		}
221 221
 
222
-        // Link forward X pages.
223
-        if ($this->piVars['page'] <= ($this->doc->numPages - $pageSteps)) {
222
+		// Link forward X pages.
223
+		if ($this->piVars['page'] <= ($this->doc->numPages - $pageSteps)) {
224 224
 
225
-            $markerArray['###FORWARD###'] = $this->makeLink(sprintf($this->pi_getLL('forwardXPages', '', TRUE), $pageSteps), array ('page' => $this->piVars['page'] + $pageSteps));
225
+			$markerArray['###FORWARD###'] = $this->makeLink(sprintf($this->pi_getLL('forwardXPages', '', TRUE), $pageSteps), array ('page' => $this->piVars['page'] + $pageSteps));
226 226
 
227
-        } else {
227
+		} else {
228 228
 
229
-            $markerArray['###FORWARD###'] = '<span>'.sprintf($this->pi_getLL('forwardXPages', '', TRUE), $pageSteps).'</span>';
229
+			$markerArray['###FORWARD###'] = '<span>'.sprintf($this->pi_getLL('forwardXPages', '', TRUE), $pageSteps).'</span>';
230 230
 
231
-        }
231
+		}
232 232
 
233
-        // Link to last page.
234
-        if ($this->piVars['page'] < $this->doc->numPages) {
233
+		// Link to last page.
234
+		if ($this->piVars['page'] < $this->doc->numPages) {
235 235
 
236
-            $markerArray['###LAST###'] = $this->makeLink($this->pi_getLL('lastPage', '', TRUE), array ('page' => $this->doc->numPages));
236
+			$markerArray['###LAST###'] = $this->makeLink($this->pi_getLL('lastPage', '', TRUE), array ('page' => $this->doc->numPages));
237 237
 
238
-        } else {
238
+		} else {
239 239
 
240
-            $markerArray['###LAST###'] = '<span>'.$this->pi_getLL('lastPage', '', TRUE).'</span>';
240
+			$markerArray['###LAST###'] = '<span>'.$this->pi_getLL('lastPage', '', TRUE).'</span>';
241 241
 
242
-        }
242
+		}
243 243
 
244
-        // Add double page switcher.
245
-        if ($this->doc->numPages > 0) {
244
+		// Add double page switcher.
245
+		if ($this->doc->numPages > 0) {
246 246
 
247
-            if (!$this->piVars['double']) {
247
+			if (!$this->piVars['double']) {
248 248
 
249
-                $markerArray['###DOUBLEPAGE###'] = $this->makeLink($this->pi_getLL('doublePageOn', '', TRUE), array ('double' => 1), 'class="tx-dlf-navigation-doubleOn"');
249
+				$markerArray['###DOUBLEPAGE###'] = $this->makeLink($this->pi_getLL('doublePageOn', '', TRUE), array ('double' => 1), 'class="tx-dlf-navigation-doubleOn"');
250 250
 
251
-            } else {
251
+			} else {
252 252
 
253
-                $markerArray['###DOUBLEPAGE###'] = $this->makeLink($this->pi_getLL('doublePageOff', '', TRUE), array ('double' => 0), 'class="tx-dlf-navigation-doubleOff"');
253
+				$markerArray['###DOUBLEPAGE###'] = $this->makeLink($this->pi_getLL('doublePageOff', '', TRUE), array ('double' => 0), 'class="tx-dlf-navigation-doubleOff"');
254 254
 
255
-            }
255
+			}
256 256
 
257
-            if ($this->piVars['double'] && $this->piVars['page'] < $this->doc->numPages) {
257
+			if ($this->piVars['double'] && $this->piVars['page'] < $this->doc->numPages) {
258 258
 
259
-                $markerArray['###DOUBLEPAGE+1###'] = $this->makeLink($this->pi_getLL('doublePage+1', '', TRUE), array ('page' => $this->piVars['page'] + 1));
259
+				$markerArray['###DOUBLEPAGE+1###'] = $this->makeLink($this->pi_getLL('doublePage+1', '', TRUE), array ('page' => $this->piVars['page'] + 1));
260 260
 
261
-            } else {
261
+			} else {
262 262
 
263
-                $markerArray['###DOUBLEPAGE+1###'] = '<span>'.$this->pi_getLL('doublePage+1', '', TRUE).'</span>';
263
+				$markerArray['###DOUBLEPAGE+1###'] = '<span>'.$this->pi_getLL('doublePage+1', '', TRUE).'</span>';
264 264
 
265
-            }
265
+			}
266 266
 
267
-        } else {
267
+		} else {
268 268
 
269
-            $markerArray['###DOUBLEPAGE###'] = '<span>'.$this->pi_getLL('doublePageOn', '', TRUE).'</span>';
269
+			$markerArray['###DOUBLEPAGE###'] = '<span>'.$this->pi_getLL('doublePageOn', '', TRUE).'</span>';
270 270
 
271
-            $markerArray['###DOUBLEPAGE+1###'] = '<span>'.$this->pi_getLL('doublePage+1', '', TRUE).'</span>';
271
+			$markerArray['###DOUBLEPAGE+1###'] = '<span>'.$this->pi_getLL('doublePage+1', '', TRUE).'</span>';
272 272
 
273
-        }
273
+		}
274 274
 
275
-        // Add page selector.
276
-        $markerArray['###PAGESELECT###'] = $this->getPageSelector();
275
+		// Add page selector.
276
+		$markerArray['###PAGESELECT###'] = $this->getPageSelector();
277 277
 
278
-        // Add link to listview if applicable.
279
-        $markerArray['###LINKLISTVIEW###'] = $this->getLinkToListview();
278
+		// Add link to listview if applicable.
279
+		$markerArray['###LINKLISTVIEW###'] = $this->getLinkToListview();
280 280
 
281
-        // fill some language labels if available
282
-        $markerArray['###ZOOM_IN###'] = $this->pi_getLL('zoom-in', '', TRUE);
283
-        $markerArray['###ZOOM_OUT###'] = $this->pi_getLL('zoom-out', '', TRUE);
284
-        $markerArray['###ZOOM_FULLSCREEN###'] = $this->pi_getLL('zoom-fullscreen', '', TRUE);
281
+		// fill some language labels if available
282
+		$markerArray['###ZOOM_IN###'] = $this->pi_getLL('zoom-in', '', TRUE);
283
+		$markerArray['###ZOOM_OUT###'] = $this->pi_getLL('zoom-out', '', TRUE);
284
+		$markerArray['###ZOOM_FULLSCREEN###'] = $this->pi_getLL('zoom-fullscreen', '', TRUE);
285 285
 
286
-        $markerArray['###ROTATE_LEFT###'] = $this->pi_getLL('rotate-left', '', TRUE);
287
-        $markerArray['###ROTATE_RIGHT###'] = $this->pi_getLL('rotate-right', '', TRUE);
288
-        $markerArray['###ROTATE_RESET###'] = $this->pi_getLL('rotate-reset', '', TRUE);
286
+		$markerArray['###ROTATE_LEFT###'] = $this->pi_getLL('rotate-left', '', TRUE);
287
+		$markerArray['###ROTATE_RIGHT###'] = $this->pi_getLL('rotate-right', '', TRUE);
288
+		$markerArray['###ROTATE_RESET###'] = $this->pi_getLL('rotate-reset', '', TRUE);
289 289
 
290
-            $content .= $this->cObj->substituteMarkerArray($this->template, $markerArray);
290
+			$content .= $this->cObj->substituteMarkerArray($this->template, $markerArray);
291 291
 
292
-        return $this->pi_wrapInBaseClass($content);
292
+		return $this->pi_wrapInBaseClass($content);
293 293
 
294
-    }
294
+	}
295 295
 
296
-    /**
297
-     * Generates a navigation link
298
-     *
299
-     * @access	protected
300
-     *
301
-     * @param	string		$label: The link's text
302
-     * @param	array		$overrulePIvars: The new set of plugin variables
303
-     * @param	string		$aTagParams: Additional HTML attributes for link tag
304
-     *
305
-     * @return	string		Typolink ready to output
306
-     */
307
-    protected function makeLink($label, array $overrulePIvars = array (), $aTagParams = '') {
296
+	/**
297
+	 * Generates a navigation link
298
+	 *
299
+	 * @access	protected
300
+	 *
301
+	 * @param	string		$label: The link's text
302
+	 * @param	array		$overrulePIvars: The new set of plugin variables
303
+	 * @param	string		$aTagParams: Additional HTML attributes for link tag
304
+	 *
305
+	 * @return	string		Typolink ready to output
306
+	 */
307
+	protected function makeLink($label, array $overrulePIvars = array (), $aTagParams = '') {
308 308
 
309
-        // Merge plugin variables with new set of values.
310
-        if (is_array($this->piVars)) {
309
+		// Merge plugin variables with new set of values.
310
+		if (is_array($this->piVars)) {
311 311
 
312
-            $piVars = $this->piVars;
312
+			$piVars = $this->piVars;
313 313
 
314
-            unset($piVars['DATA']);
314
+			unset($piVars['DATA']);
315 315
 
316
-            $overrulePIvars = tx_dlf_helper::array_merge_recursive_overrule($piVars, $overrulePIvars);
316
+			$overrulePIvars = tx_dlf_helper::array_merge_recursive_overrule($piVars, $overrulePIvars);
317 317
 
318
-        }
318
+		}
319 319
 
320
-        // Build typolink configuration array.
321
-        $conf = array (
322
-            'useCacheHash' => 1,
323
-            'parameter' => $GLOBALS['TSFE']->id,
324
-            'ATagParams' => $aTagParams,
325
-            'additionalParams' => \TYPO3\CMS\Core\Utility\GeneralUtility::implodeArrayForUrl($this->prefixId, $overrulePIvars, '', TRUE, FALSE),
326
-            'title' => $label
327
-        );
320
+		// Build typolink configuration array.
321
+		$conf = array (
322
+			'useCacheHash' => 1,
323
+			'parameter' => $GLOBALS['TSFE']->id,
324
+			'ATagParams' => $aTagParams,
325
+			'additionalParams' => \TYPO3\CMS\Core\Utility\GeneralUtility::implodeArrayForUrl($this->prefixId, $overrulePIvars, '', TRUE, FALSE),
326
+			'title' => $label
327
+		);
328 328
 
329
-        return $this->cObj->typoLink($label, $conf);
329
+		return $this->cObj->typoLink($label, $conf);
330 330
 
331
-    }
331
+	}
332 332
 
333 333
 }
Please login to merge, or discard this patch.
plugins/listview/class.tx_dlf_listview.php 1 patch
Indentation   +417 added lines, -417 removed lines patch added patch discarded remove patch
@@ -20,689 +20,689 @@
 block discarded – undo
20 20
  */
21 21
 class tx_dlf_listview extends tx_dlf_plugin {
22 22
 
23
-    public $scriptRelPath = 'plugins/listview/class.tx_dlf_listview.php';
23
+	public $scriptRelPath = 'plugins/listview/class.tx_dlf_listview.php';
24 24
 
25
-    /**
26
-     * This holds the list
27
-     *
28
-     * @var	tx_dlf_list
29
-     * @access	protected
30
-     */
31
-    protected $list;
25
+	/**
26
+	 * This holds the list
27
+	 *
28
+	 * @var	tx_dlf_list
29
+	 * @access	protected
30
+	 */
31
+	protected $list;
32 32
 
33
-    /**
34
-     * Array of sorted metadata
35
-     *
36
-     * @var	array
37
-     * @access	protected
38
-     */
39
-    protected $metadata = array ();
33
+	/**
34
+	 * Array of sorted metadata
35
+	 *
36
+	 * @var	array
37
+	 * @access	protected
38
+	 */
39
+	protected $metadata = array ();
40 40
 
41
-    /**
42
-     * Array of sortable metadata
43
-     *
44
-     * @var	array
45
-     * @access	protected
46
-     */
47
-    protected $sortables = array ();
41
+	/**
42
+	 * Array of sortable metadata
43
+	 *
44
+	 * @var	array
45
+	 * @access	protected
46
+	 */
47
+	protected $sortables = array ();
48 48
 
49
-    /**
50
-     * Renders the page browser
51
-     *
52
-     * @access	protected
53
-     *
54
-     * @return	string		The rendered page browser ready for output
55
-     */
56
-    protected function getPageBrowser() {
49
+	/**
50
+	 * Renders the page browser
51
+	 *
52
+	 * @access	protected
53
+	 *
54
+	 * @return	string		The rendered page browser ready for output
55
+	 */
56
+	protected function getPageBrowser() {
57 57
 
58
-        // Get overall number of pages.
59
-        $maxPages = intval(ceil(count($this->list) / $this->conf['limit']));
58
+		// Get overall number of pages.
59
+		$maxPages = intval(ceil(count($this->list) / $this->conf['limit']));
60 60
 
61
-        // Return empty pagebrowser if there is just one page.
62
-        if ($maxPages < 2) {
61
+		// Return empty pagebrowser if there is just one page.
62
+		if ($maxPages < 2) {
63 63
 
64
-            return '';
64
+			return '';
65 65
 
66
-        }
66
+		}
67 67
 
68
-        // Get separator.
69
-        $separator = $this->pi_getLL('separator', ' - ', TRUE);
68
+		// Get separator.
69
+		$separator = $this->pi_getLL('separator', ' - ', TRUE);
70 70
 
71
-        // Add link to previous page.
72
-        if ($this->piVars['pointer'] > 0) {
71
+		// Add link to previous page.
72
+		if ($this->piVars['pointer'] > 0) {
73 73
 
74
-            $output = $this->pi_linkTP_keepPIvars($this->pi_getLL('prevPage', '&lt;', TRUE), array ('pointer' => $this->piVars['pointer'] - 1), TRUE).$separator;
74
+			$output = $this->pi_linkTP_keepPIvars($this->pi_getLL('prevPage', '&lt;', TRUE), array ('pointer' => $this->piVars['pointer'] - 1), TRUE).$separator;
75 75
 
76
-        } else {
76
+		} else {
77 77
 
78
-            $output = $this->pi_getLL('prevPage', '&lt;', TRUE).$separator;
78
+			$output = $this->pi_getLL('prevPage', '&lt;', TRUE).$separator;
79 79
 
80
-        }
80
+		}
81 81
 
82
-        $i = 0;
82
+		$i = 0;
83 83
 
84
-        $skip = NULL;
84
+		$skip = NULL;
85 85
 
86
-        // Add links to pages.
87
-        while ($i < $maxPages) {
86
+		// Add links to pages.
87
+		while ($i < $maxPages) {
88 88
 
89
-            if ($i < 3 || ($i > $this->piVars['pointer'] - 3 && $i < $this->piVars['pointer'] + 3) || $i > $maxPages - 4) {
89
+			if ($i < 3 || ($i > $this->piVars['pointer'] - 3 && $i < $this->piVars['pointer'] + 3) || $i > $maxPages - 4) {
90 90
 
91
-                if ($this->piVars['pointer'] != $i) {
91
+				if ($this->piVars['pointer'] != $i) {
92 92
 
93
-                    $output .= $this->pi_linkTP_keepPIvars(sprintf($this->pi_getLL('page', '%d', TRUE), $i + 1), array ('pointer' => $i), TRUE).$separator;
93
+					$output .= $this->pi_linkTP_keepPIvars(sprintf($this->pi_getLL('page', '%d', TRUE), $i + 1), array ('pointer' => $i), TRUE).$separator;
94 94
 
95
-                } else {
95
+				} else {
96 96
 
97
-                    $output .= sprintf($this->pi_getLL('page', '%d', TRUE), $i + 1).$separator;
97
+					$output .= sprintf($this->pi_getLL('page', '%d', TRUE), $i + 1).$separator;
98 98
 
99
-                }
99
+				}
100 100
 
101
-                $skip = TRUE;
101
+				$skip = TRUE;
102 102
 
103
-            } elseif ($skip === TRUE) {
103
+			} elseif ($skip === TRUE) {
104 104
 
105
-                $output .= $this->pi_getLL('skip', '...', TRUE).$separator;
105
+				$output .= $this->pi_getLL('skip', '...', TRUE).$separator;
106 106
 
107
-                $skip = FALSE;
107
+				$skip = FALSE;
108 108
 
109
-            }
109
+			}
110 110
 
111
-            $i++;
111
+			$i++;
112 112
 
113
-        }
113
+		}
114 114
 
115
-        // Add link to next page.
116
-        if ($this->piVars['pointer'] < $maxPages - 1) {
115
+		// Add link to next page.
116
+		if ($this->piVars['pointer'] < $maxPages - 1) {
117 117
 
118
-            $output .= $this->pi_linkTP_keepPIvars($this->pi_getLL('nextPage', '&gt;', TRUE), array ('pointer' => $this->piVars['pointer'] + 1), TRUE);
118
+			$output .= $this->pi_linkTP_keepPIvars($this->pi_getLL('nextPage', '&gt;', TRUE), array ('pointer' => $this->piVars['pointer'] + 1), TRUE);
119 119
 
120
-        } else {
120
+		} else {
121 121
 
122
-            $output .= $this->pi_getLL('nextPage', '&gt;', TRUE);
122
+			$output .= $this->pi_getLL('nextPage', '&gt;', TRUE);
123 123
 
124
-        }
124
+		}
125 125
 
126
-        return $output;
126
+		return $output;
127 127
 
128
-    }
128
+	}
129 129
 
130
-    /**
131
-     * Renders one entry of the list
132
-     *
133
-     * @access	protected
134
-     *
135
-     * @param	integer		$number: The number of the entry
136
-     * @param	string		$template: Parsed template subpart
137
-     *
138
-     * @return	string		The rendered entry ready for output
139
-     */
140
-    protected function getEntry($number, $template) {
130
+	/**
131
+	 * Renders one entry of the list
132
+	 *
133
+	 * @access	protected
134
+	 *
135
+	 * @param	integer		$number: The number of the entry
136
+	 * @param	string		$template: Parsed template subpart
137
+	 *
138
+	 * @return	string		The rendered entry ready for output
139
+	 */
140
+	protected function getEntry($number, $template) {
141 141
 
142
-        $markerArray['###NUMBER###'] = $number + 1;
142
+		$markerArray['###NUMBER###'] = $number + 1;
143 143
 
144
-        $markerArray['###METADATA###'] = '';
144
+		$markerArray['###METADATA###'] = '';
145 145
 
146
-        $markerArray['###THUMBNAIL###'] = '';
146
+		$markerArray['###THUMBNAIL###'] = '';
147 147
 
148
-        $markerArray['###PREVIEW###'] = '';
148
+		$markerArray['###PREVIEW###'] = '';
149 149
 
150
-        $subpart = '';
150
+		$subpart = '';
151 151
 
152
-        $imgAlt = '';
152
+		$imgAlt = '';
153 153
 
154
-        $metadata = $this->list[$number]['metadata'];
154
+		$metadata = $this->list[$number]['metadata'];
155 155
 
156
-        foreach ($this->metadata as $index_name => $metaConf) {
156
+		foreach ($this->metadata as $index_name => $metaConf) {
157 157
 
158
-            $parsedValue = '';
158
+			$parsedValue = '';
159 159
 
160
-            $fieldwrap = $this->parseTS($metaConf['wrap']);
160
+			$fieldwrap = $this->parseTS($metaConf['wrap']);
161 161
 
162
-            do {
162
+			do {
163 163
 
164
-                $value = @array_shift($metadata[$index_name]);
164
+				$value = @array_shift($metadata[$index_name]);
165 165
 
166
-                // Link title to pageview.
167
-                if ($index_name == 'title') {
166
+				// Link title to pageview.
167
+				if ($index_name == 'title') {
168 168
 
169
-                    // Get title of parent document if needed.
170
-                    if (empty($value) && $this->conf['getTitle']) {
169
+					// Get title of parent document if needed.
170
+					if (empty($value) && $this->conf['getTitle']) {
171 171
 
172
-                        $superiorTitle = tx_dlf_document::getTitle($this->list[$number]['uid'], TRUE);
172
+						$superiorTitle = tx_dlf_document::getTitle($this->list[$number]['uid'], TRUE);
173 173
 
174
-                        if (!empty($superiorTitle)) {
174
+						if (!empty($superiorTitle)) {
175 175
 
176
-                            $value = '['.$superiorTitle.']';
176
+							$value = '['.$superiorTitle.']';
177 177
 
178
-                        }
178
+						}
179 179
 
180
-                    }
180
+					}
181 181
 
182
-                    // Set fake title if still not present.
183
-                    if (empty($value)) {
182
+					// Set fake title if still not present.
183
+					if (empty($value)) {
184 184
 
185
-                        $value = $this->pi_getLL('noTitle');
185
+						$value = $this->pi_getLL('noTitle');
186 186
 
187
-                    }
187
+					}
188 188
 
189
-                    $imgAlt = htmlspecialchars($value);
189
+					$imgAlt = htmlspecialchars($value);
190 190
 
191
-                    $additionalParams = array (
192
-                        'id' => $this->list[$number]['uid'],
193
-                        'page' => $this->list[$number]['page']
194
-                    );
191
+					$additionalParams = array (
192
+						'id' => $this->list[$number]['uid'],
193
+						'page' => $this->list[$number]['page']
194
+					);
195 195
 
196
-                    if (!empty($this->piVars['logicalPage'])) {
196
+					if (!empty($this->piVars['logicalPage'])) {
197 197
 
198
-                        $additionalParams['logicalPage'] = $this->piVars['logicalPage'];
198
+						$additionalParams['logicalPage'] = $this->piVars['logicalPage'];
199 199
 
200
-                    }
200
+					}
201 201
 
202
-                    $conf = array (
203
-                        'useCacheHash' => 1,
204
-                        'parameter' => $this->conf['targetPid'],
205
-                        'additionalParams' => \TYPO3\CMS\Core\Utility\GeneralUtility::implodeArrayForUrl($this->prefixId, $additionalParams, '', TRUE, FALSE)
206
-                    );
202
+					$conf = array (
203
+						'useCacheHash' => 1,
204
+						'parameter' => $this->conf['targetPid'],
205
+						'additionalParams' => \TYPO3\CMS\Core\Utility\GeneralUtility::implodeArrayForUrl($this->prefixId, $additionalParams, '', TRUE, FALSE)
206
+					);
207 207
 
208
-                    $value = $this->cObj->typoLink(htmlspecialchars($value), $conf);
208
+					$value = $this->cObj->typoLink(htmlspecialchars($value), $conf);
209 209
 
210
-                // Translate name of holding library.
211
-                } elseif ($index_name == 'owner' && !empty($value)) {
210
+				// Translate name of holding library.
211
+				} elseif ($index_name == 'owner' && !empty($value)) {
212 212
 
213
-                    $value = htmlspecialchars(tx_dlf_helper::translate($value, 'tx_dlf_libraries', $this->conf['pages']));
213
+					$value = htmlspecialchars(tx_dlf_helper::translate($value, 'tx_dlf_libraries', $this->conf['pages']));
214 214
 
215
-                // Translate document type.
216
-                } elseif ($index_name == 'type' && !empty($value)) {
215
+				// Translate document type.
216
+				} elseif ($index_name == 'type' && !empty($value)) {
217 217
 
218
-                    $value = htmlspecialchars(tx_dlf_helper::translate($value, 'tx_dlf_structures', $this->conf['pages']));
218
+					$value = htmlspecialchars(tx_dlf_helper::translate($value, 'tx_dlf_structures', $this->conf['pages']));
219 219
 
220
-                // Translate ISO 639 language code.
221
-                } elseif ($index_name == 'language' && !empty($value)) {
220
+				// Translate ISO 639 language code.
221
+				} elseif ($index_name == 'language' && !empty($value)) {
222 222
 
223
-                    $value = htmlspecialchars(tx_dlf_helper::getLanguageName($value));
223
+					$value = htmlspecialchars(tx_dlf_helper::getLanguageName($value));
224 224
 
225
-                } elseif (!empty($value)) {
225
+				} elseif (!empty($value)) {
226 226
 
227
-                    $value = htmlspecialchars($value);
227
+					$value = htmlspecialchars($value);
228 228
 
229
-                }
229
+				}
230 230
 
231
-                $value = $this->cObj->stdWrap($value, $fieldwrap['value.']);
231
+				$value = $this->cObj->stdWrap($value, $fieldwrap['value.']);
232 232
 
233
-                if (!empty($value)) {
233
+				if (!empty($value)) {
234 234
 
235
-                    $parsedValue .= $value;
235
+					$parsedValue .= $value;
236 236
 
237
-                }
237
+				}
238 238
 
239
-            } while (count($metadata[$index_name]));
239
+			} while (count($metadata[$index_name]));
240 240
 
241
-            if (!empty($parsedValue)) {
241
+			if (!empty($parsedValue)) {
242 242
 
243
-                $field = $this->cObj->stdWrap(htmlspecialchars($metaConf['label']), $fieldwrap['key.']);
243
+				$field = $this->cObj->stdWrap(htmlspecialchars($metaConf['label']), $fieldwrap['key.']);
244 244
 
245
-                $field .= $parsedValue;
245
+				$field .= $parsedValue;
246 246
 
247
-                $markerArray['###METADATA###'] .= $this->cObj->stdWrap($field, $fieldwrap['all.']);
247
+				$markerArray['###METADATA###'] .= $this->cObj->stdWrap($field, $fieldwrap['all.']);
248 248
 
249
-            }
249
+			}
250 250
 
251
-        }
251
+		}
252 252
 
253
-        // Add thumbnail.
254
-        if (!empty($this->list[$number]['thumbnail'])) {
253
+		// Add thumbnail.
254
+		if (!empty($this->list[$number]['thumbnail'])) {
255 255
 
256
-            $markerArray['###THUMBNAIL###'] = '<img alt="'.$imgAlt.'" src="'.$this->list[$number]['thumbnail'].'" />';
256
+			$markerArray['###THUMBNAIL###'] = '<img alt="'.$imgAlt.'" src="'.$this->list[$number]['thumbnail'].'" />';
257 257
 
258
-        }
258
+		}
259 259
 
260
-        // Add preview.
261
-        if (!empty($this->list[$number]['preview'])) {
260
+		// Add preview.
261
+		if (!empty($this->list[$number]['preview'])) {
262 262
 
263
-            $markerArray['###PREVIEW###'] = $this->list[$number]['preview'];
263
+			$markerArray['###PREVIEW###'] = $this->list[$number]['preview'];
264 264
 
265
-        }
265
+		}
266 266
 
267
-        if (!empty($this->list[$number]['subparts'])) {
267
+		if (!empty($this->list[$number]['subparts'])) {
268 268
 
269
-            $subpart = $this->getSubEntries($number, $template);
269
+			$subpart = $this->getSubEntries($number, $template);
270 270
 
271
-        }
271
+		}
272 272
 
273
-        // basket button
274
-        $markerArray['###BASKETBUTTON###'] = '';
273
+		// basket button
274
+		$markerArray['###BASKETBUTTON###'] = '';
275 275
 
276
-        if (!empty($this->conf['basketButton']) && !empty($this->conf['targetBasket'])) {
276
+		if (!empty($this->conf['basketButton']) && !empty($this->conf['targetBasket'])) {
277 277
 
278
-            $additionalParams = array ('id' => $this->list[$number]['uid'], 'startpage' => $this->list[$number]['page'], 'addToBasket' => 'list');
278
+			$additionalParams = array ('id' => $this->list[$number]['uid'], 'startpage' => $this->list[$number]['page'], 'addToBasket' => 'list');
279 279
 
280
-            $conf = array (
281
-                'useCacheHash' => 1,
282
-                'parameter' => $this->conf['targetBasket'],
283
-                'additionalParams' => \TYPO3\CMS\Core\Utility\GeneralUtility::implodeArrayForUrl($this->prefixId, $additionalParams, '', TRUE, FALSE)
284
-            );
280
+			$conf = array (
281
+				'useCacheHash' => 1,
282
+				'parameter' => $this->conf['targetBasket'],
283
+				'additionalParams' => \TYPO3\CMS\Core\Utility\GeneralUtility::implodeArrayForUrl($this->prefixId, $additionalParams, '', TRUE, FALSE)
284
+			);
285 285
 
286
-            $link = $this->cObj->typoLink($this->pi_getLL('addBasket', '', TRUE), $conf);
286
+			$link = $this->cObj->typoLink($this->pi_getLL('addBasket', '', TRUE), $conf);
287 287
 
288
-            $markerArray['###BASKETBUTTON###'] = $link;
288
+			$markerArray['###BASKETBUTTON###'] = $link;
289 289
 
290
-        }
290
+		}
291 291
 
292
-        return $this->cObj->substituteMarkerArray($this->cObj->substituteSubpart($template['entry'], '###SUBTEMPLATE###', $subpart, TRUE), $markerArray);
292
+		return $this->cObj->substituteMarkerArray($this->cObj->substituteSubpart($template['entry'], '###SUBTEMPLATE###', $subpart, TRUE), $markerArray);
293 293
 
294
-    }
294
+	}
295 295
 
296
-    /**
297
-     * Renders sorting dialog
298
-     *
299
-     * @access	protected
300
-     *
301
-     * @return	string		The rendered sorting dialog ready for output
302
-     */
303
-    protected function getSortingForm() {
296
+	/**
297
+	 * Renders sorting dialog
298
+	 *
299
+	 * @access	protected
300
+	 *
301
+	 * @return	string		The rendered sorting dialog ready for output
302
+	 */
303
+	protected function getSortingForm() {
304 304
 
305
-        // Return nothing if there are no sortable metadata fields.
306
-        if (!count($this->sortables)) {
305
+		// Return nothing if there are no sortable metadata fields.
306
+		if (!count($this->sortables)) {
307 307
 
308
-            return '';
308
+			return '';
309 309
 
310
-        }
310
+		}
311 311
 
312
-        // Set class prefix.
313
-        $prefix = str_replace('_', '-', get_class($this));
312
+		// Set class prefix.
313
+		$prefix = str_replace('_', '-', get_class($this));
314 314
 
315
-        // Configure @action URL for form.
316
-        $linkConf = array (
317
-            'parameter' => $GLOBALS['TSFE']->id,
318
-            'forceAbsoluteUrl' => 1
319
-        );
315
+		// Configure @action URL for form.
316
+		$linkConf = array (
317
+			'parameter' => $GLOBALS['TSFE']->id,
318
+			'forceAbsoluteUrl' => 1
319
+		);
320 320
 
321
-        if (!empty($this->piVars['logicalPage'])) {
321
+		if (!empty($this->piVars['logicalPage'])) {
322 322
 
323
-            $linkConf['additionalParams'] = \TYPO3\CMS\Core\Utility\GeneralUtility::implodeArrayForUrl($this->prefixId, array ('logicalPage' => $this->piVars['logicalPage']), '', TRUE, FALSE);
323
+			$linkConf['additionalParams'] = \TYPO3\CMS\Core\Utility\GeneralUtility::implodeArrayForUrl($this->prefixId, array ('logicalPage' => $this->piVars['logicalPage']), '', TRUE, FALSE);
324 324
 
325
-        }
325
+		}
326 326
 
327
-        // Build HTML form.
328
-        $sorting = '<form action="'.$this->cObj->typoLink_URL($linkConf).'" method="get"><div><input type="hidden" name="id" value="'.$GLOBALS['TSFE']->id.'" />';
327
+		// Build HTML form.
328
+		$sorting = '<form action="'.$this->cObj->typoLink_URL($linkConf).'" method="get"><div><input type="hidden" name="id" value="'.$GLOBALS['TSFE']->id.'" />';
329 329
 
330
-        foreach ($this->piVars as $piVar => $value) {
330
+		foreach ($this->piVars as $piVar => $value) {
331 331
 
332
-            if ($piVar != 'order' && $piVar != 'DATA' && !empty($value)) {
332
+			if ($piVar != 'order' && $piVar != 'DATA' && !empty($value)) {
333 333
 
334
-                $sorting .= '<input type="hidden" name="'.$this->prefixId.'['.$piVar.']" value="'.$value.'" />';
334
+				$sorting .= '<input type="hidden" name="'.$this->prefixId.'['.$piVar.']" value="'.$value.'" />';
335 335
 
336
-            }
336
+			}
337 337
 
338
-        }
338
+		}
339 339
 
340
-        // Select sort field.
341
-        $uniqId = uniqid($prefix.'-');
340
+		// Select sort field.
341
+		$uniqId = uniqid($prefix.'-');
342 342
 
343
-        $sorting .= '<label for="'.$uniqId.'">'.$this->pi_getLL('orderBy', '', TRUE).'</label><select id="'.$uniqId.'" name="'.$this->prefixId.'[order]" onchange="javascript:this.form.submit();">';
343
+		$sorting .= '<label for="'.$uniqId.'">'.$this->pi_getLL('orderBy', '', TRUE).'</label><select id="'.$uniqId.'" name="'.$this->prefixId.'[order]" onchange="javascript:this.form.submit();">';
344 344
 
345
-        // Add relevance sorting if this is a search result list.
346
-        if ($this->list->metadata['options']['source'] == 'search') {
345
+		// Add relevance sorting if this is a search result list.
346
+		if ($this->list->metadata['options']['source'] == 'search') {
347 347
 
348
-            $sorting .= '<option value="relevance"'.(($this->list->metadata['options']['order'] == 'relevance') ? ' selected="selected"' : '').'>'.$this->pi_getLL('relevance', '', TRUE).'</option>';
348
+			$sorting .= '<option value="relevance"'.(($this->list->metadata['options']['order'] == 'relevance') ? ' selected="selected"' : '').'>'.$this->pi_getLL('relevance', '', TRUE).'</option>';
349 349
 
350
-        }
350
+		}
351 351
 
352
-        foreach ($this->sortables as $index_name => $label) {
352
+		foreach ($this->sortables as $index_name => $label) {
353 353
 
354
-            $sorting .= '<option value="'.$index_name.'"'.(($this->list->metadata['options']['order'] == $index_name) ? ' selected="selected"' : '').'>'.htmlspecialchars($label).'</option>';
354
+			$sorting .= '<option value="'.$index_name.'"'.(($this->list->metadata['options']['order'] == $index_name) ? ' selected="selected"' : '').'>'.htmlspecialchars($label).'</option>';
355 355
 
356
-        }
356
+		}
357 357
 
358
-        $sorting .= '</select>';
358
+		$sorting .= '</select>';
359 359
 
360
-        // Select sort direction.
361
-        $uniqId = uniqid($prefix.'-');
360
+		// Select sort direction.
361
+		$uniqId = uniqid($prefix.'-');
362 362
 
363
-        $sorting .= '<label for="'.$uniqId.'">'.$this->pi_getLL('direction', '', TRUE).'</label><select id="'.$uniqId.'" name="'.$this->prefixId.'[asc]" onchange="javascript:this.form.submit();">';
363
+		$sorting .= '<label for="'.$uniqId.'">'.$this->pi_getLL('direction', '', TRUE).'</label><select id="'.$uniqId.'" name="'.$this->prefixId.'[asc]" onchange="javascript:this.form.submit();">';
364 364
 
365
-        $sorting .= '<option value="1" '.($this->list->metadata['options']['order.asc'] ? ' selected="selected"' : '').'>'.$this->pi_getLL('direction.asc', '', TRUE).'</option>';
365
+		$sorting .= '<option value="1" '.($this->list->metadata['options']['order.asc'] ? ' selected="selected"' : '').'>'.$this->pi_getLL('direction.asc', '', TRUE).'</option>';
366 366
 
367
-        $sorting .= '<option value="0" '.(!$this->list->metadata['options']['order.asc'] ? ' selected="selected"' : '').'>'.$this->pi_getLL('direction.desc', '', TRUE).'</option>';
367
+		$sorting .= '<option value="0" '.(!$this->list->metadata['options']['order.asc'] ? ' selected="selected"' : '').'>'.$this->pi_getLL('direction.desc', '', TRUE).'</option>';
368 368
 
369
-        $sorting .= '</select></div></form>';
369
+		$sorting .= '</select></div></form>';
370 370
 
371
-        return $sorting;
371
+		return $sorting;
372 372
 
373
-    }
373
+	}
374 374
 
375
-    /**
376
-     * Renders all sub-entries of one entry
377
-     *
378
-     * @access	protected
379
-     *
380
-     * @param	integer		$number: The number of the entry
381
-     * @param	string		$template: Parsed template subpart
382
-     *
383
-     * @return	string		The rendered entries ready for output
384
-     */
385
-    protected function getSubEntries($number, $template) {
375
+	/**
376
+	 * Renders all sub-entries of one entry
377
+	 *
378
+	 * @access	protected
379
+	 *
380
+	 * @param	integer		$number: The number of the entry
381
+	 * @param	string		$template: Parsed template subpart
382
+	 *
383
+	 * @return	string		The rendered entries ready for output
384
+	 */
385
+	protected function getSubEntries($number, $template) {
386 386
 
387
-        $content = '';
387
+		$content = '';
388 388
 
389
-        foreach ($this->list[$number]['subparts'] as $subpart) {
389
+		foreach ($this->list[$number]['subparts'] as $subpart) {
390 390
 
391
-            $markerArray['###SUBMETADATA###'] = '';
391
+			$markerArray['###SUBMETADATA###'] = '';
392 392
 
393
-            $markerArray['###SUBTHUMBNAIL###'] = '';
393
+			$markerArray['###SUBTHUMBNAIL###'] = '';
394 394
 
395
-            $markerArray['###SUBPREVIEW###'] = '';
395
+			$markerArray['###SUBPREVIEW###'] = '';
396 396
 
397
-            $imgAlt = '';
397
+			$imgAlt = '';
398 398
 
399
-            foreach ($this->metadata as $index_name => $metaConf) {
399
+			foreach ($this->metadata as $index_name => $metaConf) {
400 400
 
401
-                $parsedValue = '';
401
+				$parsedValue = '';
402 402
 
403
-                $fieldwrap = $this->parseTS($metaConf['wrap']);
403
+				$fieldwrap = $this->parseTS($metaConf['wrap']);
404 404
 
405
-                do {
405
+				do {
406 406
 
407
-                    $value = @array_shift($subpart['metadata'][$index_name]);
407
+					$value = @array_shift($subpart['metadata'][$index_name]);
408 408
 
409
-                    // Link title to pageview.
410
-                    if ($index_name == 'title') {
409
+					// Link title to pageview.
410
+					if ($index_name == 'title') {
411 411
 
412
-                        // Get title of parent document if needed.
413
-                        if (empty($value) && $this->conf['getTitle']) {
412
+						// Get title of parent document if needed.
413
+						if (empty($value) && $this->conf['getTitle']) {
414 414
 
415
-                            $superiorTitle = tx_dlf_document::getTitle($subpart['uid'], TRUE);
415
+							$superiorTitle = tx_dlf_document::getTitle($subpart['uid'], TRUE);
416 416
 
417
-                            if (!empty($superiorTitle)) {
417
+							if (!empty($superiorTitle)) {
418 418
 
419
-                                $value = '['.$superiorTitle.']';
419
+								$value = '['.$superiorTitle.']';
420 420
 
421
-                            }
421
+							}
422 422
 
423
-                        }
423
+						}
424 424
 
425
-                        // Set fake title if still not present.
426
-                        if (empty($value)) {
425
+						// Set fake title if still not present.
426
+						if (empty($value)) {
427 427
 
428
-                            $value = $this->pi_getLL('noTitle');
428
+							$value = $this->pi_getLL('noTitle');
429 429
 
430
-                        }
430
+						}
431 431
 
432
-                        $imgAlt = htmlspecialchars($value);
432
+						$imgAlt = htmlspecialchars($value);
433 433
 
434
-                        $additionalParams = array (
435
-                            'id' => $subpart['uid'],
436
-                            'page' => $subpart['page'],
437
-                            'highlight_word' => preg_replace('/\s\s+/', ';', $this->list->metadata['searchString'])
438
-                        );
434
+						$additionalParams = array (
435
+							'id' => $subpart['uid'],
436
+							'page' => $subpart['page'],
437
+							'highlight_word' => preg_replace('/\s\s+/', ';', $this->list->metadata['searchString'])
438
+						);
439 439
 
440
-                        if (!empty($this->piVars['logicalPage'])) {
440
+						if (!empty($this->piVars['logicalPage'])) {
441 441
 
442
-                            $additionalParams['logicalPage'] = $this->piVars['logicalPage'];
442
+							$additionalParams['logicalPage'] = $this->piVars['logicalPage'];
443 443
 
444
-                        }
444
+						}
445 445
 
446
-                        $conf = array (
447
-                            // we don't want cHash in case of search parameters
448
-                            'useCacheHash' => empty($this->list->metadata['searchString']) ? 1 : 0,
449
-                            'parameter' => $this->conf['targetPid'],
450
-                            'additionalParams' => \TYPO3\CMS\Core\Utility\GeneralUtility::implodeArrayForUrl($this->prefixId, $additionalParams, '', TRUE, FALSE)
451
-                        );
446
+						$conf = array (
447
+							// we don't want cHash in case of search parameters
448
+							'useCacheHash' => empty($this->list->metadata['searchString']) ? 1 : 0,
449
+							'parameter' => $this->conf['targetPid'],
450
+							'additionalParams' => \TYPO3\CMS\Core\Utility\GeneralUtility::implodeArrayForUrl($this->prefixId, $additionalParams, '', TRUE, FALSE)
451
+						);
452 452
 
453
-                        $value = $this->cObj->typoLink(htmlspecialchars($value), $conf);
453
+						$value = $this->cObj->typoLink(htmlspecialchars($value), $conf);
454 454
 
455
-                    // Translate name of holding library.
456
-                    } elseif ($index_name == 'owner' && !empty($value)) {
455
+					// Translate name of holding library.
456
+					} elseif ($index_name == 'owner' && !empty($value)) {
457 457
 
458
-                        $value = htmlspecialchars(tx_dlf_helper::translate($value, 'tx_dlf_libraries', $this->conf['pages']));
458
+						$value = htmlspecialchars(tx_dlf_helper::translate($value, 'tx_dlf_libraries', $this->conf['pages']));
459 459
 
460
-                    // Translate document type.
461
-                    } elseif ($index_name == 'type' && !empty($value)) {
460
+					// Translate document type.
461
+					} elseif ($index_name == 'type' && !empty($value)) {
462 462
 
463
-                        $_value = $value;
463
+						$_value = $value;
464 464
 
465
-                        $value = htmlspecialchars(tx_dlf_helper::translate($value, 'tx_dlf_structures', $this->conf['pages']));
465
+						$value = htmlspecialchars(tx_dlf_helper::translate($value, 'tx_dlf_structures', $this->conf['pages']));
466 466
 
467
-                        // Add page number for single pages.
468
-                        if ($_value == 'page') {
467
+						// Add page number for single pages.
468
+						if ($_value == 'page') {
469 469
 
470
-                            $value .= ' '.intval($subpart['page']);
470
+							$value .= ' '.intval($subpart['page']);
471 471
 
472
-                        }
472
+						}
473 473
 
474
-                    // Translate ISO 639 language code.
475
-                    } elseif ($index_name == 'language' && !empty($value)) {
474
+					// Translate ISO 639 language code.
475
+					} elseif ($index_name == 'language' && !empty($value)) {
476 476
 
477
-                        $value = htmlspecialchars(tx_dlf_helper::getLanguageName($value));
477
+						$value = htmlspecialchars(tx_dlf_helper::getLanguageName($value));
478 478
 
479
-                    } elseif (!empty($value)) {
479
+					} elseif (!empty($value)) {
480 480
 
481
-                        $value = htmlspecialchars($value);
481
+						$value = htmlspecialchars($value);
482 482
 
483
-                    }
483
+					}
484 484
 
485
-                    $value = $this->cObj->stdWrap($value, $fieldwrap['value.']);
485
+					$value = $this->cObj->stdWrap($value, $fieldwrap['value.']);
486 486
 
487
-                    if (!empty($value)) {
487
+					if (!empty($value)) {
488 488
 
489
-                        $parsedValue .= $value;
489
+						$parsedValue .= $value;
490 490
 
491
-                    }
491
+					}
492 492
 
493
-                } while (count($subpart['metadata'][$index_name]));
493
+				} while (count($subpart['metadata'][$index_name]));
494 494
 
495
-                if (!empty($parsedValue)) {
495
+				if (!empty($parsedValue)) {
496 496
 
497
-                    $field = $this->cObj->stdWrap(htmlspecialchars($metaConf['label']), $fieldwrap['key.']);
497
+					$field = $this->cObj->stdWrap(htmlspecialchars($metaConf['label']), $fieldwrap['key.']);
498 498
 
499
-                    $field .= $parsedValue;
499
+					$field .= $parsedValue;
500 500
 
501
-                    $markerArray['###SUBMETADATA###'] .= $this->cObj->stdWrap($field, $fieldwrap['all.']);
501
+					$markerArray['###SUBMETADATA###'] .= $this->cObj->stdWrap($field, $fieldwrap['all.']);
502 502
 
503
-                }
503
+				}
504 504
 
505
-            }
505
+			}
506 506
 
507
-            // Add thumbnail.
508
-            if (!empty($subpart['thumbnail'])) {
507
+			// Add thumbnail.
508
+			if (!empty($subpart['thumbnail'])) {
509 509
 
510
-                $markerArray['###SUBTHUMBNAIL###'] = '<img alt="'.$imgAlt.'" src="'.$subpart['thumbnail'].'" />';
510
+				$markerArray['###SUBTHUMBNAIL###'] = '<img alt="'.$imgAlt.'" src="'.$subpart['thumbnail'].'" />';
511 511
 
512
-            }
512
+			}
513 513
 
514
-            // Add preview.
515
-            if (!empty($subpart['preview'])) {
514
+			// Add preview.
515
+			if (!empty($subpart['preview'])) {
516 516
 
517
-                $markerArray['###SUBPREVIEW###'] = $subpart['preview'];
517
+				$markerArray['###SUBPREVIEW###'] = $subpart['preview'];
518 518
 
519
-            }
519
+			}
520 520
 
521
-            // basket button
522
-            $markerArray['###SUBBASKETBUTTON###'] = '';
521
+			// basket button
522
+			$markerArray['###SUBBASKETBUTTON###'] = '';
523 523
 
524
-            if (!empty($this->conf['basketButton']) && !empty($this->conf['targetBasket'])) {
524
+			if (!empty($this->conf['basketButton']) && !empty($this->conf['targetBasket'])) {
525 525
 
526
-                $additionalParams = array ('id' => $this->list[$number]['uid'], 'startpage' => $subpart['page'], 'endpage' => $subpart['page'], 'logId' => $subpart['sid'], 'addToBasket' => 'subentry');
526
+				$additionalParams = array ('id' => $this->list[$number]['uid'], 'startpage' => $subpart['page'], 'endpage' => $subpart['page'], 'logId' => $subpart['sid'], 'addToBasket' => 'subentry');
527 527
 
528
-                $conf = array (
529
-                    'useCacheHash' => 1,
530
-                    'parameter' => $this->conf['targetBasket'],
531
-                    'additionalParams' => \TYPO3\CMS\Core\Utility\GeneralUtility::implodeArrayForUrl($this->prefixId, $additionalParams, '', TRUE, FALSE)
532
-                );
528
+				$conf = array (
529
+					'useCacheHash' => 1,
530
+					'parameter' => $this->conf['targetBasket'],
531
+					'additionalParams' => \TYPO3\CMS\Core\Utility\GeneralUtility::implodeArrayForUrl($this->prefixId, $additionalParams, '', TRUE, FALSE)
532
+				);
533 533
 
534
-                $link = $this->cObj->typoLink($this->pi_getLL('addBasket', '', TRUE), $conf);
534
+				$link = $this->cObj->typoLink($this->pi_getLL('addBasket', '', TRUE), $conf);
535 535
 
536
-                $markerArray['###SUBBASKETBUTTON###'] = $link;
536
+				$markerArray['###SUBBASKETBUTTON###'] = $link;
537 537
 
538
-            }
538
+			}
539 539
 
540
-            $content .= $this->cObj->substituteMarkerArray($template['subentry'], $markerArray);
540
+			$content .= $this->cObj->substituteMarkerArray($template['subentry'], $markerArray);
541 541
 
542
-        }
542
+		}
543 543
 
544
-        return $this->cObj->substituteSubpart($this->cObj->getSubpart($this->template, '###SUBTEMPLATE###'), '###SUBENTRY###', $content, TRUE);
544
+		return $this->cObj->substituteSubpart($this->cObj->getSubpart($this->template, '###SUBTEMPLATE###'), '###SUBENTRY###', $content, TRUE);
545 545
 
546
-    }
546
+	}
547 547
 
548
-    /**
549
-     * Get metadata configuration from database
550
-     *
551
-     * @access	protected
552
-     *
553
-     * @return	void
554
-     */
555
-    protected function loadConfig() {
548
+	/**
549
+	 * Get metadata configuration from database
550
+	 *
551
+	 * @access	protected
552
+	 *
553
+	 * @return	void
554
+	 */
555
+	protected function loadConfig() {
556 556
 
557
-        $result = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
558
-            'tx_dlf_metadata.index_name AS index_name,tx_dlf_metadata.wrap AS wrap,tx_dlf_metadata.is_listed AS is_listed,tx_dlf_metadata.is_sortable AS is_sortable',
559
-            'tx_dlf_metadata',
560
-            '(tx_dlf_metadata.is_listed=1 OR tx_dlf_metadata.is_sortable=1) AND tx_dlf_metadata.pid='.intval($this->conf['pages']).tx_dlf_helper::whereClause('tx_dlf_metadata'),
561
-            '',
562
-            'tx_dlf_metadata.sorting ASC',
563
-            ''
564
-        );
557
+		$result = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
558
+			'tx_dlf_metadata.index_name AS index_name,tx_dlf_metadata.wrap AS wrap,tx_dlf_metadata.is_listed AS is_listed,tx_dlf_metadata.is_sortable AS is_sortable',
559
+			'tx_dlf_metadata',
560
+			'(tx_dlf_metadata.is_listed=1 OR tx_dlf_metadata.is_sortable=1) AND tx_dlf_metadata.pid='.intval($this->conf['pages']).tx_dlf_helper::whereClause('tx_dlf_metadata'),
561
+			'',
562
+			'tx_dlf_metadata.sorting ASC',
563
+			''
564
+		);
565 565
 
566
-        while ($resArray = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($result)) {
566
+		while ($resArray = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($result)) {
567 567
 
568
-            if ($resArray['is_listed']) {
568
+			if ($resArray['is_listed']) {
569 569
 
570
-                $this->metadata[$resArray['index_name']] = array (
571
-                    'wrap' => $resArray['wrap'],
572
-                    'label' => tx_dlf_helper::translate($resArray['index_name'], 'tx_dlf_metadata', $this->conf['pages'])
573
-                );
570
+				$this->metadata[$resArray['index_name']] = array (
571
+					'wrap' => $resArray['wrap'],
572
+					'label' => tx_dlf_helper::translate($resArray['index_name'], 'tx_dlf_metadata', $this->conf['pages'])
573
+				);
574 574
 
575
-            }
575
+			}
576 576
 
577
-            if ($resArray['is_sortable']) {
577
+			if ($resArray['is_sortable']) {
578 578
 
579
-                $this->sortables[$resArray['index_name']] = tx_dlf_helper::translate($resArray['index_name'], 'tx_dlf_metadata', $this->conf['pages']);
579
+				$this->sortables[$resArray['index_name']] = tx_dlf_helper::translate($resArray['index_name'], 'tx_dlf_metadata', $this->conf['pages']);
580 580
 
581
-            }
581
+			}
582 582
 
583
-        }
583
+		}
584 584
 
585
-    }
585
+	}
586 586
 
587
-    /**
588
-     * The main method of the PlugIn
589
-     *
590
-     * @access	public
591
-     *
592
-     * @param	string		$content: The PlugIn content
593
-     * @param	array		$conf: The PlugIn configuration
594
-     *
595
-     * @return	string		The content that is displayed on the website
596
-     */
597
-    public function main($content, $conf) {
587
+	/**
588
+	 * The main method of the PlugIn
589
+	 *
590
+	 * @access	public
591
+	 *
592
+	 * @param	string		$content: The PlugIn content
593
+	 * @param	array		$conf: The PlugIn configuration
594
+	 *
595
+	 * @return	string		The content that is displayed on the website
596
+	 */
597
+	public function main($content, $conf) {
598 598
 
599
-        $this->init($conf);
599
+		$this->init($conf);
600 600
 
601
-        // Don't cache the output.
602
-        $this->setCache(FALSE);
601
+		// Don't cache the output.
602
+		$this->setCache(FALSE);
603 603
 
604
-        // Load the list.
605
-        $this->list = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('tx_dlf_list');
604
+		// Load the list.
605
+		$this->list = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('tx_dlf_list');
606 606
 
607
-        // Sort the list if applicable.
608
-        if ((!empty($this->piVars['order']) && $this->piVars['order'] != $this->list->metadata['options']['order'])
609
-            || (isset($this->piVars['asc']) && $this->piVars['asc'] != $this->list->metadata['options']['order.asc'])) {
607
+		// Sort the list if applicable.
608
+		if ((!empty($this->piVars['order']) && $this->piVars['order'] != $this->list->metadata['options']['order'])
609
+			|| (isset($this->piVars['asc']) && $this->piVars['asc'] != $this->list->metadata['options']['order.asc'])) {
610 610
 
611
-            // Order list by given field.
612
-            $this->list->sort($this->piVars['order'], (boolean) $this->piVars['asc']);
611
+			// Order list by given field.
612
+			$this->list->sort($this->piVars['order'], (boolean) $this->piVars['asc']);
613 613
 
614
-            // Update list's metadata.
615
-            $listMetadata = $this->list->metadata;
614
+			// Update list's metadata.
615
+			$listMetadata = $this->list->metadata;
616 616
 
617
-            $listMetadata['options']['order'] = $this->piVars['order'];
617
+			$listMetadata['options']['order'] = $this->piVars['order'];
618 618
 
619
-            $listMetadata['options']['order.asc'] = (boolean) $this->piVars['asc'];
619
+			$listMetadata['options']['order.asc'] = (boolean) $this->piVars['asc'];
620 620
 
621
-            $this->list->metadata = $listMetadata;
621
+			$this->list->metadata = $listMetadata;
622 622
 
623
-            // Save updated list.
624
-            $this->list->save();
623
+			// Save updated list.
624
+			$this->list->save();
625 625
 
626
-            // Reset pointer.
627
-            $this->piVars['pointer'] = 0;
626
+			// Reset pointer.
627
+			$this->piVars['pointer'] = 0;
628 628
 
629
-        }
629
+		}
630 630
 
631
-        // Load template file.
632
-        if (!empty($this->conf['templateFile'])) {
631
+		// Load template file.
632
+		if (!empty($this->conf['templateFile'])) {
633 633
 
634
-            $this->template = $this->cObj->getSubpart($this->cObj->fileResource($this->conf['templateFile']), '###TEMPLATE###');
634
+			$this->template = $this->cObj->getSubpart($this->cObj->fileResource($this->conf['templateFile']), '###TEMPLATE###');
635 635
 
636
-        } else {
636
+		} else {
637 637
 
638
-            $this->template = $this->cObj->getSubpart($this->cObj->fileResource('EXT:dlf/plugins/listview/template.tmpl'), '###TEMPLATE###');
638
+			$this->template = $this->cObj->getSubpart($this->cObj->fileResource('EXT:dlf/plugins/listview/template.tmpl'), '###TEMPLATE###');
639 639
 
640
-        }
640
+		}
641 641
 
642
-        $subpartArray['entry'] = $this->cObj->getSubpart($this->template, '###ENTRY###');
642
+		$subpartArray['entry'] = $this->cObj->getSubpart($this->template, '###ENTRY###');
643 643
 
644
-        $subpartArray['subentry'] = $this->cObj->getSubpart($this->template, '###SUBENTRY###');
644
+		$subpartArray['subentry'] = $this->cObj->getSubpart($this->template, '###SUBENTRY###');
645 645
 
646
-        // Set some variable defaults.
647
-        if (!empty($this->piVars['pointer']) && (($this->piVars['pointer'] * $this->conf['limit']) + 1) <= count($this->list)) {
646
+		// Set some variable defaults.
647
+		if (!empty($this->piVars['pointer']) && (($this->piVars['pointer'] * $this->conf['limit']) + 1) <= count($this->list)) {
648 648
 
649
-            $this->piVars['pointer'] = max(intval($this->piVars['pointer']), 0);
649
+			$this->piVars['pointer'] = max(intval($this->piVars['pointer']), 0);
650 650
 
651
-        } else {
651
+		} else {
652 652
 
653
-            $this->piVars['pointer'] = 0;
653
+			$this->piVars['pointer'] = 0;
654 654
 
655
-        }
655
+		}
656 656
 
657
-        // Load metadata configuration.
658
-        $this->loadConfig();
657
+		// Load metadata configuration.
658
+		$this->loadConfig();
659 659
 
660
-        for ($i = $this->piVars['pointer'] * $this->conf['limit'], $j = ($this->piVars['pointer'] + 1) * $this->conf['limit']; $i < $j; $i++) {
660
+		for ($i = $this->piVars['pointer'] * $this->conf['limit'], $j = ($this->piVars['pointer'] + 1) * $this->conf['limit']; $i < $j; $i++) {
661 661
 
662
-            if (empty($this->list[$i])) {
662
+			if (empty($this->list[$i])) {
663 663
 
664
-                break;
664
+				break;
665 665
 
666
-            } else {
666
+			} else {
667 667
 
668
-                $content .= $this->getEntry($i, $subpartArray);
668
+				$content .= $this->getEntry($i, $subpartArray);
669 669
 
670
-            }
670
+			}
671 671
 
672
-        }
672
+		}
673 673
 
674
-        $markerArray['###LISTTITLE###'] = $this->list->metadata['label'];
674
+		$markerArray['###LISTTITLE###'] = $this->list->metadata['label'];
675 675
 
676
-        $markerArray['###LISTDESCRIPTION###'] = $this->list->metadata['description'];
676
+		$markerArray['###LISTDESCRIPTION###'] = $this->list->metadata['description'];
677 677
 
678
-        if (!empty($this->list->metadata['thumbnail'])) {
678
+		if (!empty($this->list->metadata['thumbnail'])) {
679 679
 
680
-            $markerArray['###LISTTHUMBNAIL###'] = '<img alt="" src="'.$this->list->metadata['thumbnail'].'" />';
680
+			$markerArray['###LISTTHUMBNAIL###'] = '<img alt="" src="'.$this->list->metadata['thumbnail'].'" />';
681 681
 
682
-        } else {
682
+		} else {
683 683
 
684
-            $markerArray['###LISTTHUMBNAIL###'] = '';
684
+			$markerArray['###LISTTHUMBNAIL###'] = '';
685 685
 
686
-        }
686
+		}
687 687
 
688
-        if ($i) {
688
+		if ($i) {
689 689
 
690
-            $markerArray['###COUNT###'] = htmlspecialchars(sprintf($this->pi_getLL('count'), ($this->piVars['pointer'] * $this->conf['limit']) + 1, $i, count($this->list)));
690
+			$markerArray['###COUNT###'] = htmlspecialchars(sprintf($this->pi_getLL('count'), ($this->piVars['pointer'] * $this->conf['limit']) + 1, $i, count($this->list)));
691 691
 
692
-        } else {
692
+		} else {
693 693
 
694
-            $markerArray['###COUNT###'] = $this->pi_getLL('nohits', '', TRUE);
694
+			$markerArray['###COUNT###'] = $this->pi_getLL('nohits', '', TRUE);
695 695
 
696
-        }
696
+		}
697 697
 
698
-        $markerArray['###PAGEBROWSER###'] = $this->getPageBrowser();
698
+		$markerArray['###PAGEBROWSER###'] = $this->getPageBrowser();
699 699
 
700
-        $markerArray['###SORTING###'] = $this->getSortingForm();
700
+		$markerArray['###SORTING###'] = $this->getSortingForm();
701 701
 
702
-        $content = $this->cObj->substituteMarkerArray($this->cObj->substituteSubpart($this->template, '###ENTRY###', $content, TRUE), $markerArray);
702
+		$content = $this->cObj->substituteMarkerArray($this->cObj->substituteSubpart($this->template, '###ENTRY###', $content, TRUE), $markerArray);
703 703
 
704
-        return $this->pi_wrapInBaseClass($content);
704
+		return $this->pi_wrapInBaseClass($content);
705 705
 
706
-    }
706
+	}
707 707
 
708 708
 }
Please login to merge, or discard this patch.
plugins/toolbox/tools/fulltext/class.tx_dlf_toolsFulltext.php 1 patch
Indentation   +52 added lines, -52 removed lines patch added patch discarded remove patch
@@ -20,85 +20,85 @@
 block discarded – undo
20 20
  */
21 21
 class tx_dlf_toolsFulltext extends tx_dlf_plugin {
22 22
 
23
-    public $scriptRelPath = 'plugins/toolbox/tools/fulltext/class.tx_dlf_toolsFulltext.php';
23
+	public $scriptRelPath = 'plugins/toolbox/tools/fulltext/class.tx_dlf_toolsFulltext.php';
24 24
 
25
-    /**
26
-     * The main method of the PlugIn
27
-     *
28
-     * @access	public
29
-     *
30
-     * @param	string		$content: The PlugIn content
31
-     * @param	array		$conf: The PlugIn configuration
32
-     *
33
-     * @return	string		The content that is displayed on the website
34
-     */
35
-    public function main($content, $conf) {
25
+	/**
26
+	 * The main method of the PlugIn
27
+	 *
28
+	 * @access	public
29
+	 *
30
+	 * @param	string		$content: The PlugIn content
31
+	 * @param	array		$conf: The PlugIn configuration
32
+	 *
33
+	 * @return	string		The content that is displayed on the website
34
+	 */
35
+	public function main($content, $conf) {
36 36
 
37
-        $this->init($conf);
37
+		$this->init($conf);
38 38
 
39
-        // Merge configuration with conf array of toolbox.
40
-        $this->conf = tx_dlf_helper::array_merge_recursive_overrule($this->cObj->data['conf'], $this->conf);
39
+		// Merge configuration with conf array of toolbox.
40
+		$this->conf = tx_dlf_helper::array_merge_recursive_overrule($this->cObj->data['conf'], $this->conf);
41 41
 
42
-        // Load current document.
43
-        $this->loadDocument();
42
+		// Load current document.
43
+		$this->loadDocument();
44 44
 
45
-        if ($this->doc === NULL || $this->doc->numPages < 1 || empty($this->conf['fileGrpFulltext'])) {
45
+		if ($this->doc === NULL || $this->doc->numPages < 1 || empty($this->conf['fileGrpFulltext'])) {
46 46
 
47
-            // Quit without doing anything if required variables are not set.
48
-            return $content;
47
+			// Quit without doing anything if required variables are not set.
48
+			return $content;
49 49
 
50
-        } else {
50
+		} else {
51 51
 
52
-            if (!empty($this->piVars['logicalPage'])) {
52
+			if (!empty($this->piVars['logicalPage'])) {
53 53
 
54
-                $this->piVars['page'] = $this->doc->getPhysicalPage($this->piVars['logicalPage']);
55
-                // The logical page parameter should not appear again
56
-                unset($this->piVars['logicalPage']);
54
+				$this->piVars['page'] = $this->doc->getPhysicalPage($this->piVars['logicalPage']);
55
+				// The logical page parameter should not appear again
56
+				unset($this->piVars['logicalPage']);
57 57
 
58
-            }
58
+			}
59 59
 
60
-            // Set default values if not set.
61
-            // $this->piVars['page'] may be integer or string (physical structure @ID)
62
-            if ((int) $this->piVars['page'] > 0 || empty($this->piVars['page'])) {
60
+			// Set default values if not set.
61
+			// $this->piVars['page'] may be integer or string (physical structure @ID)
62
+			if ((int) $this->piVars['page'] > 0 || empty($this->piVars['page'])) {
63 63
 
64
-                $this->piVars['page'] = \TYPO3\CMS\Core\Utility\MathUtility::forceIntegerInRange((int) $this->piVars['page'], 1, $this->doc->numPages, 1);
64
+				$this->piVars['page'] = \TYPO3\CMS\Core\Utility\MathUtility::forceIntegerInRange((int) $this->piVars['page'], 1, $this->doc->numPages, 1);
65 65
 
66
-            } else {
66
+			} else {
67 67
 
68
-                $this->piVars['page'] = array_search($this->piVars['page'], $this->doc->physicalStructure);
68
+				$this->piVars['page'] = array_search($this->piVars['page'], $this->doc->physicalStructure);
69 69
 
70
-            }
70
+			}
71 71
 
72
-            $this->piVars['double'] = \TYPO3\CMS\Core\Utility\MathUtility::forceIntegerInRange($this->piVars['double'], 0, 1, 0);
72
+			$this->piVars['double'] = \TYPO3\CMS\Core\Utility\MathUtility::forceIntegerInRange($this->piVars['double'], 0, 1, 0);
73 73
 
74
-        }
74
+		}
75 75
 
76
-        // Load template file.
77
-        if (!empty($this->conf['toolTemplateFile'])) {
76
+		// Load template file.
77
+		if (!empty($this->conf['toolTemplateFile'])) {
78 78
 
79
-            $this->template = $this->cObj->getSubpart($this->cObj->fileResource($this->conf['toolTemplateFile']), '###TEMPLATE###');
79
+			$this->template = $this->cObj->getSubpart($this->cObj->fileResource($this->conf['toolTemplateFile']), '###TEMPLATE###');
80 80
 
81
-        } else {
81
+		} else {
82 82
 
83
-            $this->template = $this->cObj->getSubpart($this->cObj->fileResource('EXT:dlf/plugins/toolbox/tools/fulltext/template.tmpl'), '###TEMPLATE###');
83
+			$this->template = $this->cObj->getSubpart($this->cObj->fileResource('EXT:dlf/plugins/toolbox/tools/fulltext/template.tmpl'), '###TEMPLATE###');
84 84
 
85
-        }
85
+		}
86 86
 
87 87
 
88
-        $fullTextFile = $this->doc->physicalStructureInfo[$this->doc->physicalStructure[$this->piVars['page']]]['files'][$this->conf['fileGrpFulltext']];
88
+		$fullTextFile = $this->doc->physicalStructureInfo[$this->doc->physicalStructure[$this->piVars['page']]]['files'][$this->conf['fileGrpFulltext']];
89 89
 
90
-        if (!empty($fullTextFile)) {
91
-            $markerArray['###FULLTEXT_SELECT###'] = '<a class="select switchoff" id="tx-dlf-tools-fulltext" title="" data-dic="fulltext-on:'
92
-                    .$this->pi_getLL('fulltext-on', '', TRUE).';fulltext-off:'
93
-                    .$this->pi_getLL('fulltext-off', '', TRUE).'">&nbsp;</a>';
94
-        } else {
95
-            $markerArray['###FULLTEXT_SELECT###'] = '<span class="no-fulltext">'.$this->pi_getLL('fulltext-not-available', '', TRUE).'</span>';
96
-        }
90
+		if (!empty($fullTextFile)) {
91
+			$markerArray['###FULLTEXT_SELECT###'] = '<a class="select switchoff" id="tx-dlf-tools-fulltext" title="" data-dic="fulltext-on:'
92
+					.$this->pi_getLL('fulltext-on', '', TRUE).';fulltext-off:'
93
+					.$this->pi_getLL('fulltext-off', '', TRUE).'">&nbsp;</a>';
94
+		} else {
95
+			$markerArray['###FULLTEXT_SELECT###'] = '<span class="no-fulltext">'.$this->pi_getLL('fulltext-not-available', '', TRUE).'</span>';
96
+		}
97 97
 
98
-        $content .= $this->cObj->substituteMarkerArray($this->template, $markerArray);
98
+		$content .= $this->cObj->substituteMarkerArray($this->template, $markerArray);
99 99
 
100
-        return $this->pi_wrapInBaseClass($content);
100
+		return $this->pi_wrapInBaseClass($content);
101 101
 
102
-    }
102
+	}
103 103
 
104 104
 }
Please login to merge, or discard this patch.
toolbox/tools/imagemanipulation/class.tx_dlf_toolsImagemanipulation.php 1 patch
Indentation   +36 added lines, -36 removed lines patch added patch discarded remove patch
@@ -19,54 +19,54 @@
 block discarded – undo
19 19
  */
20 20
 class tx_dlf_toolsImagemanipulation extends tx_dlf_plugin {
21 21
 
22
-    public $scriptRelPath = 'plugins/toolbox/tools/imagemanipulation/class.tx_dlf_toolsImagemanipulation.php';
22
+	public $scriptRelPath = 'plugins/toolbox/tools/imagemanipulation/class.tx_dlf_toolsImagemanipulation.php';
23 23
 
24
-    /**
25
-     * The main method of the PlugIn
26
-     *
27
-     * @access	public
28
-     *
29
-     * @param	string		$content: The PlugIn content
30
-     * @param	array		$conf: The PlugIn configuration
31
-     *
32
-     * @return	string		The content that is displayed on the website
33
-     */
34
-    public function main($content, $conf) {
24
+	/**
25
+	 * The main method of the PlugIn
26
+	 *
27
+	 * @access	public
28
+	 *
29
+	 * @param	string		$content: The PlugIn content
30
+	 * @param	array		$conf: The PlugIn configuration
31
+	 *
32
+	 * @return	string		The content that is displayed on the website
33
+	 */
34
+	public function main($content, $conf) {
35 35
 
36
-        $this->init($conf);
36
+		$this->init($conf);
37 37
 
38
-        // Merge configuration with conf array of toolbox.
39
-        $this->conf = tx_dlf_helper::array_merge_recursive_overrule($this->cObj->data['conf'], $this->conf);
38
+		// Merge configuration with conf array of toolbox.
39
+		$this->conf = tx_dlf_helper::array_merge_recursive_overrule($this->cObj->data['conf'], $this->conf);
40 40
 
41
-        // Load current document.
42
-        $this->loadDocument();
41
+		// Load current document.
42
+		$this->loadDocument();
43 43
 
44
-        // Load template file.
45
-        if (!empty($this->conf['toolTemplateFile'])) {
44
+		// Load template file.
45
+		if (!empty($this->conf['toolTemplateFile'])) {
46 46
 
47
-            $this->template = $this->cObj->getSubpart($this->cObj->fileResource($this->conf['toolTemplateFile']), '###TEMPLATE###');
47
+			$this->template = $this->cObj->getSubpart($this->cObj->fileResource($this->conf['toolTemplateFile']), '###TEMPLATE###');
48 48
 
49
-        } else {
49
+		} else {
50 50
 
51
-            $this->template = $this->cObj->getSubpart($this->cObj->fileResource('EXT:dlf/plugins/toolbox/tools/imagemanipulation/template.tmpl'), '###TEMPLATE###');
51
+			$this->template = $this->cObj->getSubpart($this->cObj->fileResource('EXT:dlf/plugins/toolbox/tools/imagemanipulation/template.tmpl'), '###TEMPLATE###');
52 52
 
53
-        }
53
+		}
54 54
 
55
-        $markerArray['###IMAGEMANIPULATION_SELECT###'] = '<span class="tx-dlf-tools-imagetools" id="tx-dlf-tools-imagetools" data-dic="imagemanipulation-on:'
56
-            .$this->pi_getLL('imagemanipulation-on', '', TRUE).';imagemanipulation-off:'
57
-            .$this->pi_getLL('imagemanipulation-off', '', TRUE).';reset:'
58
-            .$this->pi_getLL('reset', '', TRUE).';saturation:'
59
-            .$this->pi_getLL('saturation', '', TRUE).';hue:'
60
-            .$this->pi_getLL('hue', '', TRUE).';contrast:'
61
-            .$this->pi_getLL('contrast', '', TRUE).';brightness:'
62
-            .$this->pi_getLL('brightness', '', TRUE).';invert:'
63
-            .$this->pi_getLL('invert', '', TRUE).'" title="'
64
-            .$this->pi_getLL('no-support', '', TRUE).'"></span>';
55
+		$markerArray['###IMAGEMANIPULATION_SELECT###'] = '<span class="tx-dlf-tools-imagetools" id="tx-dlf-tools-imagetools" data-dic="imagemanipulation-on:'
56
+			.$this->pi_getLL('imagemanipulation-on', '', TRUE).';imagemanipulation-off:'
57
+			.$this->pi_getLL('imagemanipulation-off', '', TRUE).';reset:'
58
+			.$this->pi_getLL('reset', '', TRUE).';saturation:'
59
+			.$this->pi_getLL('saturation', '', TRUE).';hue:'
60
+			.$this->pi_getLL('hue', '', TRUE).';contrast:'
61
+			.$this->pi_getLL('contrast', '', TRUE).';brightness:'
62
+			.$this->pi_getLL('brightness', '', TRUE).';invert:'
63
+			.$this->pi_getLL('invert', '', TRUE).'" title="'
64
+			.$this->pi_getLL('no-support', '', TRUE).'"></span>';
65 65
 
66
-        $content .= $this->cObj->substituteMarkerArray($this->template, $markerArray);
66
+		$content .= $this->cObj->substituteMarkerArray($this->template, $markerArray);
67 67
 
68
-        return $this->pi_wrapInBaseClass($content);
68
+		return $this->pi_wrapInBaseClass($content);
69 69
 
70
-    }
70
+	}
71 71
 
72 72
 }
Please login to merge, or discard this patch.
plugins/toolbox/tools/pdf/class.tx_dlf_toolsPdf.php 1 patch
Indentation   +124 added lines, -124 removed lines patch added patch discarded remove patch
@@ -20,182 +20,182 @@
 block discarded – undo
20 20
  */
21 21
 class tx_dlf_toolsPdf extends tx_dlf_plugin {
22 22
 
23
-    public $scriptRelPath = 'plugins/toolbox/tools/pdf/class.tx_dlf_toolsPdf.php';
23
+	public $scriptRelPath = 'plugins/toolbox/tools/pdf/class.tx_dlf_toolsPdf.php';
24 24
 
25
-    /**
26
-     * The main method of the PlugIn
27
-     *
28
-     * @access	public
29
-     *
30
-     * @param	string		$content: The PlugIn content
31
-     * @param	array		$conf: The PlugIn configuration
32
-     *
33
-     * @return	string		The content that is displayed on the website
34
-     */
35
-    public function main($content, $conf) {
25
+	/**
26
+	 * The main method of the PlugIn
27
+	 *
28
+	 * @access	public
29
+	 *
30
+	 * @param	string		$content: The PlugIn content
31
+	 * @param	array		$conf: The PlugIn configuration
32
+	 *
33
+	 * @return	string		The content that is displayed on the website
34
+	 */
35
+	public function main($content, $conf) {
36 36
 
37
-        $this->init($conf);
37
+		$this->init($conf);
38 38
 
39
-        // Merge configuration with conf array of toolbox.
40
-        $this->conf = tx_dlf_helper::array_merge_recursive_overrule($this->cObj->data['conf'], $this->conf);
39
+		// Merge configuration with conf array of toolbox.
40
+		$this->conf = tx_dlf_helper::array_merge_recursive_overrule($this->cObj->data['conf'], $this->conf);
41 41
 
42
-        // Load current document.
43
-        $this->loadDocument();
42
+		// Load current document.
43
+		$this->loadDocument();
44 44
 
45
-        if ($this->doc === NULL || $this->doc->numPages < 1 || empty($this->conf['fileGrpDownload'])) {
45
+		if ($this->doc === NULL || $this->doc->numPages < 1 || empty($this->conf['fileGrpDownload'])) {
46 46
 
47
-            // Quit without doing anything if required variables are not set.
48
-            return $content;
47
+			// Quit without doing anything if required variables are not set.
48
+			return $content;
49 49
 
50
-        } else {
50
+		} else {
51 51
 
52
-            if (!empty($this->piVars['logicalPage'])) {
52
+			if (!empty($this->piVars['logicalPage'])) {
53 53
 
54
-                $this->piVars['page'] = $this->doc->getPhysicalPage($this->piVars['logicalPage']);
55
-                // The logical page parameter should not appear again
56
-                unset($this->piVars['logicalPage']);
54
+				$this->piVars['page'] = $this->doc->getPhysicalPage($this->piVars['logicalPage']);
55
+				// The logical page parameter should not appear again
56
+				unset($this->piVars['logicalPage']);
57 57
 
58
-            }
58
+			}
59 59
 
60
-            // Set default values if not set.
61
-            // $this->piVars['page'] may be integer or string (physical structure @ID)
62
-            if ((int) $this->piVars['page'] > 0 || empty($this->piVars['page'])) {
60
+			// Set default values if not set.
61
+			// $this->piVars['page'] may be integer or string (physical structure @ID)
62
+			if ((int) $this->piVars['page'] > 0 || empty($this->piVars['page'])) {
63 63
 
64
-                $this->piVars['page'] = \TYPO3\CMS\Core\Utility\MathUtility::forceIntegerInRange((int) $this->piVars['page'], 1, $this->doc->numPages, 1);
64
+				$this->piVars['page'] = \TYPO3\CMS\Core\Utility\MathUtility::forceIntegerInRange((int) $this->piVars['page'], 1, $this->doc->numPages, 1);
65 65
 
66
-            } else {
66
+			} else {
67 67
 
68
-                $this->piVars['page'] = array_search($this->piVars['page'], $this->doc->physicalStructure);
68
+				$this->piVars['page'] = array_search($this->piVars['page'], $this->doc->physicalStructure);
69 69
 
70
-            }
70
+			}
71 71
 
72
-            $this->piVars['double'] = \TYPO3\CMS\Core\Utility\MathUtility::forceIntegerInRange($this->piVars['double'], 0, 1, 0);
72
+			$this->piVars['double'] = \TYPO3\CMS\Core\Utility\MathUtility::forceIntegerInRange($this->piVars['double'], 0, 1, 0);
73 73
 
74
-        }
74
+		}
75 75
 
76
-        // Load template file.
77
-        if (!empty($this->conf['toolTemplateFile'])) {
76
+		// Load template file.
77
+		if (!empty($this->conf['toolTemplateFile'])) {
78 78
 
79
-            $this->template = $this->cObj->getSubpart($this->cObj->fileResource($this->conf['toolTemplateFile']), '###TEMPLATE###');
79
+			$this->template = $this->cObj->getSubpart($this->cObj->fileResource($this->conf['toolTemplateFile']), '###TEMPLATE###');
80 80
 
81
-        } else {
81
+		} else {
82 82
 
83
-            $this->template = $this->cObj->getSubpart($this->cObj->fileResource('EXT:dlf/plugins/toolbox/tools/pdf/template.tmpl'), '###TEMPLATE###');
83
+			$this->template = $this->cObj->getSubpart($this->cObj->fileResource('EXT:dlf/plugins/toolbox/tools/pdf/template.tmpl'), '###TEMPLATE###');
84 84
 
85
-        }
85
+		}
86 86
 
87
-        // Get single page downloads.
88
-        $markerArray['###PAGE###'] = $this->getPageLink();
87
+		// Get single page downloads.
88
+		$markerArray['###PAGE###'] = $this->getPageLink();
89 89
 
90
-        // Get work download.
91
-        $markerArray['###WORK###'] = $this->getWorkLink();
90
+		// Get work download.
91
+		$markerArray['###WORK###'] = $this->getWorkLink();
92 92
 
93
-        $content .= $this->cObj->substituteMarkerArray($this->template, $markerArray);
93
+		$content .= $this->cObj->substituteMarkerArray($this->template, $markerArray);
94 94
 
95
-        return $this->pi_wrapInBaseClass($content);
95
+		return $this->pi_wrapInBaseClass($content);
96 96
 
97
-    }
97
+	}
98 98
 
99
-    /**
100
-     * Get page's download link
101
-     *
102
-     * @access	protected
103
-     *
104
-     * @return	string		Link to downloadable page
105
-     */
106
-    protected function getPageLink() {
99
+	/**
100
+	 * Get page's download link
101
+	 *
102
+	 * @access	protected
103
+	 *
104
+	 * @return	string		Link to downloadable page
105
+	 */
106
+	protected function getPageLink() {
107 107
 
108
-        $page1Link = '';
109
-        $page2Link = '';
110
-        $pageNumber = $this->piVars['page'];
108
+		$page1Link = '';
109
+		$page2Link = '';
110
+		$pageNumber = $this->piVars['page'];
111 111
 
112
-        // Get image link.
113
-        $details = $this->doc->physicalStructureInfo[$this->doc->physicalStructure[$pageNumber]];
114
-        $file = $details['files'][$this->conf['fileGrpDownload']];
115
-        if (!empty($file)) {
116
-            $page1Link = $this->doc->getFileLocation($file);
117
-        }
112
+		// Get image link.
113
+		$details = $this->doc->physicalStructureInfo[$this->doc->physicalStructure[$pageNumber]];
114
+		$file = $details['files'][$this->conf['fileGrpDownload']];
115
+		if (!empty($file)) {
116
+			$page1Link = $this->doc->getFileLocation($file);
117
+		}
118 118
 
119
-        // Get second page, too, if double page view is activated.
120
-        if ($this->piVars['double'] && $pageNumber < $this->doc->numPages) {
121
-            $details = $this->doc->physicalStructureInfo[$this->doc->physicalStructure[$pageNumber + 1]];
122
-            $file = $details['files'][$this->conf['fileGrpDownload']];
123
-            if (!empty($file)) {
124
-                $page2Link = $this->doc->getFileLocation($file);
125
-            }
126
-        }
119
+		// Get second page, too, if double page view is activated.
120
+		if ($this->piVars['double'] && $pageNumber < $this->doc->numPages) {
121
+			$details = $this->doc->physicalStructureInfo[$this->doc->physicalStructure[$pageNumber + 1]];
122
+			$file = $details['files'][$this->conf['fileGrpDownload']];
123
+			if (!empty($file)) {
124
+				$page2Link = $this->doc->getFileLocation($file);
125
+			}
126
+		}
127 127
 
128
-        if (TYPO3_DLOG && empty($page1Link) && empty($page2Link)) {
129
-            \TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[tx_dlf_toolsPdf->getPageLink()] '.
130
-                        'File not found in fileGrp "'.
131
-                        $this->conf['fileGrpDownload'].'"',
132
-                        $this->extKey,
133
-                        SYSLOG_SEVERITY_WARNING);
134
-        }
128
+		if (TYPO3_DLOG && empty($page1Link) && empty($page2Link)) {
129
+			\TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[tx_dlf_toolsPdf->getPageLink()] '.
130
+						'File not found in fileGrp "'.
131
+						$this->conf['fileGrpDownload'].'"',
132
+						$this->extKey,
133
+						SYSLOG_SEVERITY_WARNING);
134
+		}
135 135
 
136
-        // Wrap URLs with HTML.
137
-        if (!empty($page1Link)) {
138
-            if ($this->piVars['double']) {
139
-                $page1Link = $this->cObj->typoLink($this->pi_getLL('leftPage', ''),
140
-                    array ('parameter' => $page1Link, 'title' => $this->pi_getLL('leftPage', '')));
141
-            } else {
142
-                $page1Link = $this->cObj->typoLink($this->pi_getLL('singlePage', ''),
143
-                    array ('parameter' => $page1Link, 'title' => $this->pi_getLL('singlePage', '')));
144
-            }
145
-        }
146
-        if (!empty($page2Link)) {
147
-            $page2Link = $this->cObj->typoLink($this->pi_getLL('rightPage', ''),
148
-                array ('parameter' => $page2Link, 'title' => $this->pi_getLL('rightPage', '')));
149
-        }
136
+		// Wrap URLs with HTML.
137
+		if (!empty($page1Link)) {
138
+			if ($this->piVars['double']) {
139
+				$page1Link = $this->cObj->typoLink($this->pi_getLL('leftPage', ''),
140
+					array ('parameter' => $page1Link, 'title' => $this->pi_getLL('leftPage', '')));
141
+			} else {
142
+				$page1Link = $this->cObj->typoLink($this->pi_getLL('singlePage', ''),
143
+					array ('parameter' => $page1Link, 'title' => $this->pi_getLL('singlePage', '')));
144
+			}
145
+		}
146
+		if (!empty($page2Link)) {
147
+			$page2Link = $this->cObj->typoLink($this->pi_getLL('rightPage', ''),
148
+				array ('parameter' => $page2Link, 'title' => $this->pi_getLL('rightPage', '')));
149
+		}
150 150
 
151
-        return $page1Link.$page2Link;
152
-    }
151
+		return $page1Link.$page2Link;
152
+	}
153 153
 
154
-    /**
155
-     * Get work's download link
156
-     *
157
-     * @access	protected
158
-     *
159
-     * @return	string		Link to downloadable work
160
-     */
161
-    protected function getWorkLink() {
154
+	/**
155
+	 * Get work's download link
156
+	 *
157
+	 * @access	protected
158
+	 *
159
+	 * @return	string		Link to downloadable work
160
+	 */
161
+	protected function getWorkLink() {
162 162
 
163
-        $workLink = '';
163
+		$workLink = '';
164 164
 
165
-        // Get work link.
166
-        if (!empty($this->doc->physicalStructureInfo[$this->doc->physicalStructure[0]]['files'][$this->conf['fileGrpDownload']])) {
165
+		// Get work link.
166
+		if (!empty($this->doc->physicalStructureInfo[$this->doc->physicalStructure[0]]['files'][$this->conf['fileGrpDownload']])) {
167 167
 
168
-            $workLink = $this->doc->getFileLocation($this->doc->physicalStructureInfo[$this->doc->physicalStructure[0]]['files'][$this->conf['fileGrpDownload']]);
168
+			$workLink = $this->doc->getFileLocation($this->doc->physicalStructureInfo[$this->doc->physicalStructure[0]]['files'][$this->conf['fileGrpDownload']]);
169 169
 
170
-        } else {
170
+		} else {
171 171
 
172
-            $details = $this->doc->getLogicalStructure($this->doc->toplevelId);
172
+			$details = $this->doc->getLogicalStructure($this->doc->toplevelId);
173 173
 
174
-            if (!empty($details['files'][$this->conf['fileGrpDownload']])) {
174
+			if (!empty($details['files'][$this->conf['fileGrpDownload']])) {
175 175
 
176
-                $workLink = $this->doc->getFileLocation($details['files'][$this->conf['fileGrpDownload']]);
176
+				$workLink = $this->doc->getFileLocation($details['files'][$this->conf['fileGrpDownload']]);
177 177
 
178
-            }
178
+			}
179 179
 
180
-        }
180
+		}
181 181
 
182
-        // Wrap URLs with HTML.
183
-        if (!empty($workLink)) {
182
+		// Wrap URLs with HTML.
183
+		if (!empty($workLink)) {
184 184
 
185
-            $workLink = $this->cObj->typoLink($this->pi_getLL('work', ''), array ('parameter' => $workLink, 'title' => $this->pi_getLL('work', '')));
185
+			$workLink = $this->cObj->typoLink($this->pi_getLL('work', ''), array ('parameter' => $workLink, 'title' => $this->pi_getLL('work', '')));
186 186
 
187
-        } else {
187
+		} else {
188 188
 
189
-            if (TYPO3_DLOG) {
189
+			if (TYPO3_DLOG) {
190 190
 
191
-                \TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[tx_dlf_toolsPdf->getWorkLink()] File not found in fileGrp "'.$this->conf['fileGrpDownload'].'"', $this->extKey, SYSLOG_SEVERITY_WARNING);
191
+				\TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[tx_dlf_toolsPdf->getWorkLink()] File not found in fileGrp "'.$this->conf['fileGrpDownload'].'"', $this->extKey, SYSLOG_SEVERITY_WARNING);
192 192
 
193
-            }
193
+			}
194 194
 
195
-        }
195
+		}
196 196
 
197
-        return $workLink;
197
+		return $workLink;
198 198
 
199
-    }
199
+	}
200 200
 
201 201
 }
Please login to merge, or discard this patch.
plugins/toolbox/tools/imagedownload/class.tx_dlf_toolsImagedownload.php 1 patch
Indentation   +89 added lines, -89 removed lines patch added patch discarded remove patch
@@ -19,140 +19,140 @@
 block discarded – undo
19 19
  */
20 20
 class tx_dlf_toolsImagedownload extends tx_dlf_plugin {
21 21
 
22
-    public $scriptRelPath = 'plugins/toolbox/tools/imagedownload/class.tx_dlf_toolsImagedownload.php';
22
+	public $scriptRelPath = 'plugins/toolbox/tools/imagedownload/class.tx_dlf_toolsImagedownload.php';
23 23
 
24
-    /**
25
-     * The main method of the PlugIn
26
-     *
27
-     * @access	public
28
-     *
29
-     * @param	string		$content: The PlugIn content
30
-     * @param	array		$conf: The PlugIn configuration
31
-     *
32
-     * @return	string		The content that is displayed on the website
33
-     */
34
-    public function main($content, $conf) {
24
+	/**
25
+	 * The main method of the PlugIn
26
+	 *
27
+	 * @access	public
28
+	 *
29
+	 * @param	string		$content: The PlugIn content
30
+	 * @param	array		$conf: The PlugIn configuration
31
+	 *
32
+	 * @return	string		The content that is displayed on the website
33
+	 */
34
+	public function main($content, $conf) {
35 35
 
36
-        $this->init($conf);
36
+		$this->init($conf);
37 37
 
38
-        // Merge configuration with conf array of toolbox.
39
-        $this->conf = tx_dlf_helper::array_merge_recursive_overrule($this->cObj->data['conf'], $this->conf);
38
+		// Merge configuration with conf array of toolbox.
39
+		$this->conf = tx_dlf_helper::array_merge_recursive_overrule($this->cObj->data['conf'], $this->conf);
40 40
 
41
-        // Load current document.
42
-        $this->loadDocument();
41
+		// Load current document.
42
+		$this->loadDocument();
43 43
 
44
-        if ($this->doc === NULL || $this->doc->numPages < 1 || empty($this->conf['fileGrpsImageDownload'])) {
44
+		if ($this->doc === NULL || $this->doc->numPages < 1 || empty($this->conf['fileGrpsImageDownload'])) {
45 45
 
46
-            // Quit without doing anything if required variables are not set.
47
-            return $content;
46
+			// Quit without doing anything if required variables are not set.
47
+			return $content;
48 48
 
49
-        } else {
49
+		} else {
50 50
 
51
-            if (!empty($this->piVars['logicalPage'])) {
51
+			if (!empty($this->piVars['logicalPage'])) {
52 52
 
53
-                $this->piVars['page'] = $this->doc->getPhysicalPage($this->piVars['logicalPage']);
54
-                // The logical page parameter should not appear again
55
-                unset($this->piVars['logicalPage']);
53
+				$this->piVars['page'] = $this->doc->getPhysicalPage($this->piVars['logicalPage']);
54
+				// The logical page parameter should not appear again
55
+				unset($this->piVars['logicalPage']);
56 56
 
57
-            }
57
+			}
58 58
 
59
-            // Set default values if not set.
60
-            // $this->piVars['page'] may be integer or string (physical structure @ID)
61
-            if ((int) $this->piVars['page'] > 0 || empty($this->piVars['page'])) {
59
+			// Set default values if not set.
60
+			// $this->piVars['page'] may be integer or string (physical structure @ID)
61
+			if ((int) $this->piVars['page'] > 0 || empty($this->piVars['page'])) {
62 62
 
63
-                $this->piVars['page'] = \TYPO3\CMS\Core\Utility\MathUtility::forceIntegerInRange((int) $this->piVars['page'], 1, $this->doc->numPages, 1);
63
+				$this->piVars['page'] = \TYPO3\CMS\Core\Utility\MathUtility::forceIntegerInRange((int) $this->piVars['page'], 1, $this->doc->numPages, 1);
64 64
 
65
-            } else {
65
+			} else {
66 66
 
67
-                $this->piVars['page'] = array_search($this->piVars['page'], $this->doc->physicalStructure);
67
+				$this->piVars['page'] = array_search($this->piVars['page'], $this->doc->physicalStructure);
68 68
 
69
-            }
69
+			}
70 70
 
71
-            $this->piVars['double'] = \TYPO3\CMS\Core\Utility\MathUtility::forceIntegerInRange($this->piVars['double'], 0, 1, 0);
71
+			$this->piVars['double'] = \TYPO3\CMS\Core\Utility\MathUtility::forceIntegerInRange($this->piVars['double'], 0, 1, 0);
72 72
 
73
-        }
73
+		}
74 74
 
75
-        // Load template file.
76
-        if (!empty($this->conf['toolTemplateFile'])) {
75
+		// Load template file.
76
+		if (!empty($this->conf['toolTemplateFile'])) {
77 77
 
78
-            $this->template = $this->cObj->getSubpart($this->cObj->fileResource($this->conf['toolTemplateFile']), '###TEMPLATE###');
78
+			$this->template = $this->cObj->getSubpart($this->cObj->fileResource($this->conf['toolTemplateFile']), '###TEMPLATE###');
79 79
 
80
-        } else {
80
+		} else {
81 81
 
82
-            $this->template = $this->cObj->getSubpart($this->cObj->fileResource('EXT:dlf/plugins/toolbox/tools/imagedownload/template.tmpl'), '###TEMPLATE###');
82
+			$this->template = $this->cObj->getSubpart($this->cObj->fileResource('EXT:dlf/plugins/toolbox/tools/imagedownload/template.tmpl'), '###TEMPLATE###');
83 83
 
84
-        }
84
+		}
85 85
 
86
-        // Get left or single page download.
87
-        $markerArray['###IMAGE_LEFT###'] = $this->piVars['double'] == 1 ? $this->getImage($this->piVars['page'], $this->pi_getLL('leftPage', '')) : $this->getImage($this->piVars['page'], $this->pi_getLL('singlePage', ''));
86
+		// Get left or single page download.
87
+		$markerArray['###IMAGE_LEFT###'] = $this->piVars['double'] == 1 ? $this->getImage($this->piVars['page'], $this->pi_getLL('leftPage', '')) : $this->getImage($this->piVars['page'], $this->pi_getLL('singlePage', ''));
88 88
 
89
-        // Get right page download.
90
-        $markerArray['###IMAGE_RIGHT###'] = $this->piVars['double'] == 1 ? $this->getImage($this->piVars['page'] + 1, $this->pi_getLL('rightPage', '')) : '';
89
+		// Get right page download.
90
+		$markerArray['###IMAGE_RIGHT###'] = $this->piVars['double'] == 1 ? $this->getImage($this->piVars['page'] + 1, $this->pi_getLL('rightPage', '')) : '';
91 91
 
92
-        $content .= $this->cObj->substituteMarkerArray($this->template, $markerArray);
92
+		$content .= $this->cObj->substituteMarkerArray($this->template, $markerArray);
93 93
 
94
-        return $this->pi_wrapInBaseClass($content);
94
+		return $this->pi_wrapInBaseClass($content);
95 95
 
96
-    }
96
+	}
97 97
 
98 98
 
99
-    /**
100
-     * Get image's URL and MIME type
101
-     *
102
-     * @access	protected
103
-     *
104
-     * @param	integer		$page: Page number
105
-     * @param	string		$label: Link title and label
106
-     *
107
-     * @return	string	linkt to image file with given label
108
-     */
109
-    protected function getImage($page, $label) {
99
+	/**
100
+	 * Get image's URL and MIME type
101
+	 *
102
+	 * @access	protected
103
+	 *
104
+	 * @param	integer		$page: Page number
105
+	 * @param	string		$label: Link title and label
106
+	 *
107
+	 * @return	string	linkt to image file with given label
108
+	 */
109
+	protected function getImage($page, $label) {
110 110
 
111
-        $image = array ();
111
+		$image = array ();
112 112
 
113
-        // Get @USE value of METS fileGrp.
114
-        $fileGrps = \TYPO3\CMS\Core\Utility\GeneralUtility::trimExplode(',', $this->conf['fileGrpsImageDownload']);
113
+		// Get @USE value of METS fileGrp.
114
+		$fileGrps = \TYPO3\CMS\Core\Utility\GeneralUtility::trimExplode(',', $this->conf['fileGrpsImageDownload']);
115 115
 
116
-        while ($fileGrp = @array_pop($fileGrps)) {
116
+		while ($fileGrp = @array_pop($fileGrps)) {
117 117
 
118
-            // Get image link.
119
-            if (!empty($this->doc->physicalStructureInfo[$this->doc->physicalStructure[$page]]['files'][$fileGrp])) {
118
+			// Get image link.
119
+			if (!empty($this->doc->physicalStructureInfo[$this->doc->physicalStructure[$page]]['files'][$fileGrp])) {
120 120
 
121
-                $image['url'] = $this->doc->getFileLocation($this->doc->physicalStructureInfo[$this->doc->physicalStructure[$page]]['files'][$fileGrp]);
121
+				$image['url'] = $this->doc->getFileLocation($this->doc->physicalStructureInfo[$this->doc->physicalStructure[$page]]['files'][$fileGrp]);
122 122
 
123
-                $image['mimetype'] = $this->doc->getFileMimeType($this->doc->physicalStructureInfo[$this->doc->physicalStructure[$page]]['files'][$fileGrp]);
123
+				$image['mimetype'] = $this->doc->getFileMimeType($this->doc->physicalStructureInfo[$this->doc->physicalStructure[$page]]['files'][$fileGrp]);
124 124
 
125
-                switch ($image['mimetype']) {
126
-                    case 'image/jpeg': 	$mimetypeLabel = '(JPG)';
127
-                        break;
128
-                    case 'image/tiff': 	$mimetypeLabel = '(TIFF)';
129
-                            break;
130
-                    default:	$mimetypeLabel = '';
131
-                }
132
-                $linkConf = array (
133
-                    'parameter' => $image['url'],
134
-                    'title' => $label.' '.$mimetypeLabel,
135
-                    'additionalParams' => '',
136
-                );
125
+				switch ($image['mimetype']) {
126
+					case 'image/jpeg': 	$mimetypeLabel = '(JPG)';
127
+						break;
128
+					case 'image/tiff': 	$mimetypeLabel = '(TIFF)';
129
+							break;
130
+					default:	$mimetypeLabel = '';
131
+				}
132
+				$linkConf = array (
133
+					'parameter' => $image['url'],
134
+					'title' => $label.' '.$mimetypeLabel,
135
+					'additionalParams' => '',
136
+				);
137 137
 
138
-                $imageLink = $this->cObj->typoLink($label.' '.$mimetypeLabel, $linkConf);
138
+				$imageLink = $this->cObj->typoLink($label.' '.$mimetypeLabel, $linkConf);
139 139
 
140
-                break;
140
+				break;
141 141
 
142
-            } else {
142
+			} else {
143 143
 
144
-                if (TYPO3_DLOG) {
144
+				if (TYPO3_DLOG) {
145 145
 
146
-                    \TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[tx_dlf_toolsImagedownload->getImage('.$page.')] File not found in fileGrp "'.$fileGrp.'"', $this->extKey, SYSLOG_SEVERITY_WARNING);
146
+					\TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[tx_dlf_toolsImagedownload->getImage('.$page.')] File not found in fileGrp "'.$fileGrp.'"', $this->extKey, SYSLOG_SEVERITY_WARNING);
147 147
 
148
-                }
148
+				}
149 149
 
150
-            }
150
+			}
151 151
 
152
-        }
152
+		}
153 153
 
154
-        return $imageLink;
154
+		return $imageLink;
155 155
 
156
-    }
156
+	}
157 157
 
158 158
 }
Please login to merge, or discard this patch.