@@ -20,391 +20,391 @@ |
||
20 | 20 | */ |
21 | 21 | class tx_dlf_metadata extends tx_dlf_plugin { |
22 | 22 | |
23 | - public $scriptRelPath = 'plugins/metadata/class.tx_dlf_metadata.php'; |
|
23 | + public $scriptRelPath = 'plugins/metadata/class.tx_dlf_metadata.php'; |
|
24 | 24 | |
25 | - /** |
|
26 | - * This holds the hook objects |
|
27 | - * |
|
28 | - * @var array |
|
29 | - * @access protected |
|
30 | - */ |
|
31 | - protected $hookObjects = array (); |
|
25 | + /** |
|
26 | + * This holds the hook objects |
|
27 | + * |
|
28 | + * @var array |
|
29 | + * @access protected |
|
30 | + */ |
|
31 | + protected $hookObjects = array (); |
|
32 | 32 | |
33 | - /** |
|
34 | - * The main method of the PlugIn |
|
35 | - * |
|
36 | - * @access public |
|
37 | - * |
|
38 | - * @param string $content: The PlugIn content |
|
39 | - * @param array $conf: The PlugIn configuration |
|
40 | - * |
|
41 | - * @return string The content that is displayed on the website |
|
42 | - */ |
|
43 | - public function main($content, $conf) { |
|
33 | + /** |
|
34 | + * The main method of the PlugIn |
|
35 | + * |
|
36 | + * @access public |
|
37 | + * |
|
38 | + * @param string $content: The PlugIn content |
|
39 | + * @param array $conf: The PlugIn configuration |
|
40 | + * |
|
41 | + * @return string The content that is displayed on the website |
|
42 | + */ |
|
43 | + public function main($content, $conf) { |
|
44 | 44 | |
45 | - $this->init($conf); |
|
45 | + $this->init($conf); |
|
46 | 46 | |
47 | - // Turn cache on. |
|
48 | - $this->setCache(TRUE); |
|
47 | + // Turn cache on. |
|
48 | + $this->setCache(TRUE); |
|
49 | 49 | |
50 | - // Load current document. |
|
51 | - $this->loadDocument(); |
|
50 | + // Load current document. |
|
51 | + $this->loadDocument(); |
|
52 | 52 | |
53 | - if ($this->doc === NULL) { |
|
53 | + if ($this->doc === NULL) { |
|
54 | 54 | |
55 | - // Quit without doing anything if required variables are not set. |
|
56 | - return $content; |
|
55 | + // Quit without doing anything if required variables are not set. |
|
56 | + return $content; |
|
57 | 57 | |
58 | - } else { |
|
58 | + } else { |
|
59 | 59 | |
60 | - // Set default values if not set. |
|
61 | - if (!isset($this->conf['rootline'])) { |
|
60 | + // Set default values if not set. |
|
61 | + if (!isset($this->conf['rootline'])) { |
|
62 | 62 | |
63 | - $this->conf['rootline'] = 0; |
|
63 | + $this->conf['rootline'] = 0; |
|
64 | 64 | |
65 | - } |
|
65 | + } |
|
66 | 66 | |
67 | - } |
|
67 | + } |
|
68 | 68 | |
69 | - $metadata = array (); |
|
69 | + $metadata = array (); |
|
70 | 70 | |
71 | - if ($this->conf['rootline'] < 2) { |
|
71 | + if ($this->conf['rootline'] < 2) { |
|
72 | 72 | |
73 | - // Get current structure's @ID. |
|
74 | - $ids = array (); |
|
73 | + // Get current structure's @ID. |
|
74 | + $ids = array (); |
|
75 | 75 | |
76 | - if (!empty($this->doc->physicalStructure[$this->piVars['page']]) && !empty($this->doc->smLinks['p2l'][$this->doc->physicalStructure[$this->piVars['page']]])) { |
|
76 | + if (!empty($this->doc->physicalStructure[$this->piVars['page']]) && !empty($this->doc->smLinks['p2l'][$this->doc->physicalStructure[$this->piVars['page']]])) { |
|
77 | 77 | |
78 | - foreach ($this->doc->smLinks['p2l'][$this->doc->physicalStructure[$this->piVars['page']]] as $logId) { |
|
78 | + foreach ($this->doc->smLinks['p2l'][$this->doc->physicalStructure[$this->piVars['page']]] as $logId) { |
|
79 | 79 | |
80 | - $count = count($this->doc->mets->xpath('./mets:structMap[@TYPE="LOGICAL"]//mets:div[@ID="'.$logId.'"]/ancestor::*')); |
|
80 | + $count = count($this->doc->mets->xpath('./mets:structMap[@TYPE="LOGICAL"]//mets:div[@ID="'.$logId.'"]/ancestor::*')); |
|
81 | 81 | |
82 | - $ids[$count][] = $logId; |
|
82 | + $ids[$count][] = $logId; |
|
83 | 83 | |
84 | - } |
|
84 | + } |
|
85 | 85 | |
86 | - } |
|
86 | + } |
|
87 | 87 | |
88 | - ksort($ids); |
|
88 | + ksort($ids); |
|
89 | 89 | |
90 | - reset($ids); |
|
90 | + reset($ids); |
|
91 | 91 | |
92 | - // Check if we should display all metadata up to the root. |
|
93 | - if ($this->conf['rootline'] == 1) { |
|
92 | + // Check if we should display all metadata up to the root. |
|
93 | + if ($this->conf['rootline'] == 1) { |
|
94 | 94 | |
95 | - foreach ($ids as $id) { |
|
95 | + foreach ($ids as $id) { |
|
96 | 96 | |
97 | - foreach ($id as $sid) { |
|
97 | + foreach ($id as $sid) { |
|
98 | 98 | |
99 | - $data = $this->doc->getMetadata($sid, $this->conf['pages']); |
|
99 | + $data = $this->doc->getMetadata($sid, $this->conf['pages']); |
|
100 | 100 | |
101 | - if (!empty($data)) { |
|
101 | + if (!empty($data)) { |
|
102 | 102 | |
103 | - $data['_id'] = $sid; |
|
103 | + $data['_id'] = $sid; |
|
104 | 104 | |
105 | - $metadata[] = $data; |
|
105 | + $metadata[] = $data; |
|
106 | 106 | |
107 | - } |
|
107 | + } |
|
108 | 108 | |
109 | - } |
|
109 | + } |
|
110 | 110 | |
111 | - } |
|
111 | + } |
|
112 | 112 | |
113 | - } else { |
|
113 | + } else { |
|
114 | 114 | |
115 | - $id = array_pop($ids); |
|
115 | + $id = array_pop($ids); |
|
116 | 116 | |
117 | - if (is_array($id)) { |
|
117 | + if (is_array($id)) { |
|
118 | 118 | |
119 | - foreach ($id as $sid) { |
|
119 | + foreach ($id as $sid) { |
|
120 | 120 | |
121 | - $data = $this->doc->getMetadata($sid, $this->conf['pages']); |
|
121 | + $data = $this->doc->getMetadata($sid, $this->conf['pages']); |
|
122 | 122 | |
123 | - if (!empty($data)) { |
|
123 | + if (!empty($data)) { |
|
124 | 124 | |
125 | - $data['_id'] = $sid; |
|
125 | + $data['_id'] = $sid; |
|
126 | 126 | |
127 | - $metadata[] = $data; |
|
127 | + $metadata[] = $data; |
|
128 | 128 | |
129 | - } |
|
129 | + } |
|
130 | 130 | |
131 | - } |
|
131 | + } |
|
132 | 132 | |
133 | - } |
|
133 | + } |
|
134 | 134 | |
135 | - } |
|
135 | + } |
|
136 | 136 | |
137 | - } |
|
137 | + } |
|
138 | 138 | |
139 | - // Get titledata? |
|
140 | - if (empty($metadata) || ($this->conf['rootline'] == 1 && $metadata[0]['_id'] != $this->doc->toplevelId)) { |
|
139 | + // Get titledata? |
|
140 | + if (empty($metadata) || ($this->conf['rootline'] == 1 && $metadata[0]['_id'] != $this->doc->toplevelId)) { |
|
141 | 141 | |
142 | - $data = $this->doc->getTitleData($this->conf['pages']); |
|
142 | + $data = $this->doc->getTitleData($this->conf['pages']); |
|
143 | 143 | |
144 | - $data['_id'] = $this->doc->toplevelId; |
|
144 | + $data['_id'] = $this->doc->toplevelId; |
|
145 | 145 | |
146 | - array_unshift($metadata, $data); |
|
146 | + array_unshift($metadata, $data); |
|
147 | 147 | |
148 | - } |
|
148 | + } |
|
149 | 149 | |
150 | - if (empty($metadata)) { |
|
150 | + if (empty($metadata)) { |
|
151 | 151 | |
152 | - if (TYPO3_DLOG) { |
|
152 | + if (TYPO3_DLOG) { |
|
153 | 153 | |
154 | - \TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[tx_dlf_metadata->main('.$content.', [data])] No metadata found for document with UID "'.$this->doc->uid.'"', $this->extKey, SYSLOG_SEVERITY_WARNING, $conf); |
|
154 | + \TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[tx_dlf_metadata->main('.$content.', [data])] No metadata found for document with UID "'.$this->doc->uid.'"', $this->extKey, SYSLOG_SEVERITY_WARNING, $conf); |
|
155 | 155 | |
156 | - } |
|
156 | + } |
|
157 | 157 | |
158 | - return $content; |
|
158 | + return $content; |
|
159 | 159 | |
160 | - } |
|
160 | + } |
|
161 | 161 | |
162 | - ksort($metadata); |
|
162 | + ksort($metadata); |
|
163 | 163 | |
164 | - // Get hook objects. |
|
165 | - $this->hookObjects = tx_dlf_helper::getHookObjects($this->scriptRelPath); |
|
164 | + // Get hook objects. |
|
165 | + $this->hookObjects = tx_dlf_helper::getHookObjects($this->scriptRelPath); |
|
166 | 166 | |
167 | - // Hook for getting a customized title bar (requested by SBB). |
|
168 | - foreach ($this->hookObjects as $hookObj) { |
|
167 | + // Hook for getting a customized title bar (requested by SBB). |
|
168 | + foreach ($this->hookObjects as $hookObj) { |
|
169 | 169 | |
170 | - if (method_exists($hookObj, 'main_customizeTitleBarGetCustomTemplate')) { |
|
170 | + if (method_exists($hookObj, 'main_customizeTitleBarGetCustomTemplate')) { |
|
171 | 171 | |
172 | - $hookObj->main_customizeTitleBarGetCustomTemplate($this, $metadata); |
|
172 | + $hookObj->main_customizeTitleBarGetCustomTemplate($this, $metadata); |
|
173 | 173 | |
174 | - } |
|
174 | + } |
|
175 | 175 | |
176 | - } |
|
176 | + } |
|
177 | 177 | |
178 | - $content .= $this->printMetadata($metadata); |
|
178 | + $content .= $this->printMetadata($metadata); |
|
179 | 179 | |
180 | - return $this->pi_wrapInBaseClass($content); |
|
180 | + return $this->pi_wrapInBaseClass($content); |
|
181 | 181 | |
182 | - } |
|
182 | + } |
|
183 | 183 | |
184 | - /** |
|
185 | - * Prepares the metadata array for output |
|
186 | - * |
|
187 | - * @access protected |
|
188 | - * |
|
189 | - * @param array $metadataArray: The metadata array |
|
190 | - * |
|
191 | - * @return string The metadata array ready for output |
|
192 | - */ |
|
193 | - protected function printMetadata(array $metadataArray) { |
|
184 | + /** |
|
185 | + * Prepares the metadata array for output |
|
186 | + * |
|
187 | + * @access protected |
|
188 | + * |
|
189 | + * @param array $metadataArray: The metadata array |
|
190 | + * |
|
191 | + * @return string The metadata array ready for output |
|
192 | + */ |
|
193 | + protected function printMetadata(array $metadataArray) { |
|
194 | 194 | |
195 | - // Load template file. |
|
196 | - if (!empty($this->conf['templateFile'])) { |
|
195 | + // Load template file. |
|
196 | + if (!empty($this->conf['templateFile'])) { |
|
197 | 197 | |
198 | - $this->template = $this->cObj->getSubpart($this->cObj->fileResource($this->conf['templateFile']), '###TEMPLATE###'); |
|
198 | + $this->template = $this->cObj->getSubpart($this->cObj->fileResource($this->conf['templateFile']), '###TEMPLATE###'); |
|
199 | 199 | |
200 | - } else { |
|
200 | + } else { |
|
201 | 201 | |
202 | - $this->template = $this->cObj->getSubpart($this->cObj->fileResource('EXT:dlf/plugins/metadata/template.tmpl'), '###TEMPLATE###'); |
|
202 | + $this->template = $this->cObj->getSubpart($this->cObj->fileResource('EXT:dlf/plugins/metadata/template.tmpl'), '###TEMPLATE###'); |
|
203 | 203 | |
204 | - } |
|
204 | + } |
|
205 | 205 | |
206 | - $output = ''; |
|
206 | + $output = ''; |
|
207 | 207 | |
208 | - $subpart['block'] = $this->cObj->getSubpart($this->template, '###BLOCK###'); |
|
208 | + $subpart['block'] = $this->cObj->getSubpart($this->template, '###BLOCK###'); |
|
209 | 209 | |
210 | - // Get list of metadata to show. |
|
211 | - $metaList = array (); |
|
210 | + // Get list of metadata to show. |
|
211 | + $metaList = array (); |
|
212 | 212 | |
213 | - $result = $GLOBALS['TYPO3_DB']->exec_SELECTquery( |
|
214 | - 'tx_dlf_metadata.index_name AS index_name,tx_dlf_metadata.is_listed AS is_listed,tx_dlf_metadata.wrap AS wrap', |
|
215 | - 'tx_dlf_metadata', |
|
216 | - 'tx_dlf_metadata.pid='.intval($this->conf['pages']).tx_dlf_helper::whereClause('tx_dlf_metadata').' AND (sys_language_uid IN (-1,0) OR (sys_language_uid = '.$GLOBALS['TSFE']->sys_language_uid.' AND l18n_parent = 0))', |
|
217 | - '', |
|
218 | - 'tx_dlf_metadata.sorting', |
|
219 | - '' |
|
220 | - ); |
|
213 | + $result = $GLOBALS['TYPO3_DB']->exec_SELECTquery( |
|
214 | + 'tx_dlf_metadata.index_name AS index_name,tx_dlf_metadata.is_listed AS is_listed,tx_dlf_metadata.wrap AS wrap', |
|
215 | + 'tx_dlf_metadata', |
|
216 | + 'tx_dlf_metadata.pid='.intval($this->conf['pages']).tx_dlf_helper::whereClause('tx_dlf_metadata').' AND (sys_language_uid IN (-1,0) OR (sys_language_uid = '.$GLOBALS['TSFE']->sys_language_uid.' AND l18n_parent = 0))', |
|
217 | + '', |
|
218 | + 'tx_dlf_metadata.sorting', |
|
219 | + '' |
|
220 | + ); |
|
221 | 221 | |
222 | - while ($resArray = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($result)) { |
|
222 | + while ($resArray = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($result)) { |
|
223 | 223 | |
224 | - if (is_array($resArray) && $resArray['sys_language_uid'] != $GLOBALS['TSFE']->sys_language_content && $GLOBALS['TSFE']->sys_language_contentOL) { |
|
224 | + if (is_array($resArray) && $resArray['sys_language_uid'] != $GLOBALS['TSFE']->sys_language_content && $GLOBALS['TSFE']->sys_language_contentOL) { |
|
225 | 225 | |
226 | - $resArray = $GLOBALS['TSFE']->sys_page->getRecordOverlay('tx_dlf_metadata', $resArray, $GLOBALS['TSFE']->sys_language_content, $GLOBALS['TSFE']->sys_language_contentOL); |
|
226 | + $resArray = $GLOBALS['TSFE']->sys_page->getRecordOverlay('tx_dlf_metadata', $resArray, $GLOBALS['TSFE']->sys_language_content, $GLOBALS['TSFE']->sys_language_contentOL); |
|
227 | 227 | |
228 | - } |
|
228 | + } |
|
229 | 229 | |
230 | - if ($resArray) { |
|
231 | - // get correct language uid for translated realurl link |
|
232 | - $link_uid = ($resArray['_LOCALIZED_UID']) ? $resArray['_LOCALIZED_UID'] : $resArray['uid']; |
|
230 | + if ($resArray) { |
|
231 | + // get correct language uid for translated realurl link |
|
232 | + $link_uid = ($resArray['_LOCALIZED_UID']) ? $resArray['_LOCALIZED_UID'] : $resArray['uid']; |
|
233 | 233 | |
234 | - // do stuff with the row entry data like built HTML or prepare further usage |
|
235 | - if ($this->conf['showFull'] || $resArray['is_listed']) { |
|
234 | + // do stuff with the row entry data like built HTML or prepare further usage |
|
235 | + if ($this->conf['showFull'] || $resArray['is_listed']) { |
|
236 | 236 | |
237 | - $metaList[$resArray['index_name']] = array ( |
|
238 | - 'wrap' => $resArray['wrap'], |
|
239 | - 'label' => tx_dlf_helper::translate($resArray['index_name'], 'tx_dlf_metadata', $this->conf['pages']) |
|
240 | - ); |
|
237 | + $metaList[$resArray['index_name']] = array ( |
|
238 | + 'wrap' => $resArray['wrap'], |
|
239 | + 'label' => tx_dlf_helper::translate($resArray['index_name'], 'tx_dlf_metadata', $this->conf['pages']) |
|
240 | + ); |
|
241 | 241 | |
242 | - } |
|
242 | + } |
|
243 | 243 | |
244 | - } |
|
244 | + } |
|
245 | 245 | |
246 | - } |
|
246 | + } |
|
247 | 247 | |
248 | - // Get list of collections to show. |
|
249 | - $collList = array (); |
|
248 | + // Get list of collections to show. |
|
249 | + $collList = array (); |
|
250 | 250 | |
251 | - $result = $GLOBALS['TYPO3_DB']->exec_SELECTquery( |
|
252 | - 'tx_dlf_collections.index_name AS index_name', |
|
253 | - 'tx_dlf_collections', |
|
254 | - 'tx_dlf_collections.pid='.intval($this->conf['pages']).tx_dlf_helper::whereClause('tx_dlf_collections'), |
|
255 | - '', |
|
256 | - '', |
|
257 | - '' |
|
258 | - ); |
|
251 | + $result = $GLOBALS['TYPO3_DB']->exec_SELECTquery( |
|
252 | + 'tx_dlf_collections.index_name AS index_name', |
|
253 | + 'tx_dlf_collections', |
|
254 | + 'tx_dlf_collections.pid='.intval($this->conf['pages']).tx_dlf_helper::whereClause('tx_dlf_collections'), |
|
255 | + '', |
|
256 | + '', |
|
257 | + '' |
|
258 | + ); |
|
259 | 259 | |
260 | - while ($resArray = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($result)) { |
|
260 | + while ($resArray = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($result)) { |
|
261 | 261 | |
262 | - $collList[] = $resArray['index_name']; |
|
262 | + $collList[] = $resArray['index_name']; |
|
263 | 263 | |
264 | - } |
|
264 | + } |
|
265 | 265 | |
266 | - // Save original data array. |
|
267 | - $cObjData = $this->cObj->data; |
|
266 | + // Save original data array. |
|
267 | + $cObjData = $this->cObj->data; |
|
268 | 268 | |
269 | - // Parse the metadata arrays. |
|
270 | - foreach ($metadataArray as $metadata) { |
|
269 | + // Parse the metadata arrays. |
|
270 | + foreach ($metadataArray as $metadata) { |
|
271 | 271 | |
272 | - $markerArray['###METADATA###'] = ''; |
|
272 | + $markerArray['###METADATA###'] = ''; |
|
273 | 273 | |
274 | - // Reset content object's data array. |
|
275 | - $this->cObj->data = $cObjData; |
|
274 | + // Reset content object's data array. |
|
275 | + $this->cObj->data = $cObjData; |
|
276 | 276 | |
277 | - // Load all the metadata values into the content object's data array. |
|
278 | - foreach ($metadata as $index_name => $value) { |
|
277 | + // Load all the metadata values into the content object's data array. |
|
278 | + foreach ($metadata as $index_name => $value) { |
|
279 | 279 | |
280 | - if (is_array($value)) { |
|
280 | + if (is_array($value)) { |
|
281 | 281 | |
282 | - $this->cObj->data[$index_name] = implode($this->conf['separator'], $value); |
|
282 | + $this->cObj->data[$index_name] = implode($this->conf['separator'], $value); |
|
283 | 283 | |
284 | - } else { |
|
284 | + } else { |
|
285 | 285 | |
286 | - $this->cObj->data[$index_name] = $value; |
|
286 | + $this->cObj->data[$index_name] = $value; |
|
287 | 287 | |
288 | - } |
|
288 | + } |
|
289 | 289 | |
290 | - } |
|
290 | + } |
|
291 | 291 | |
292 | - // Process each metadate. |
|
293 | - foreach ($metaList as $index_name => $metaConf) { |
|
292 | + // Process each metadate. |
|
293 | + foreach ($metaList as $index_name => $metaConf) { |
|
294 | 294 | |
295 | - $parsedValue = ''; |
|
295 | + $parsedValue = ''; |
|
296 | 296 | |
297 | - $fieldwrap = $this->parseTS($metaConf['wrap']); |
|
297 | + $fieldwrap = $this->parseTS($metaConf['wrap']); |
|
298 | 298 | |
299 | - do { |
|
299 | + do { |
|
300 | 300 | |
301 | - $value = @array_shift($metadata[$index_name]); |
|
301 | + $value = @array_shift($metadata[$index_name]); |
|
302 | 302 | |
303 | - if ($index_name == 'title') { |
|
303 | + if ($index_name == 'title') { |
|
304 | 304 | |
305 | - // Get title of parent document if needed. |
|
306 | - if (empty($value) && $this->conf['getTitle'] && $this->doc->parentId) { |
|
305 | + // Get title of parent document if needed. |
|
306 | + if (empty($value) && $this->conf['getTitle'] && $this->doc->parentId) { |
|
307 | 307 | |
308 | - $superiorTitle = tx_dlf_document::getTitle($this->doc->parentId, TRUE); |
|
308 | + $superiorTitle = tx_dlf_document::getTitle($this->doc->parentId, TRUE); |
|
309 | 309 | |
310 | - if (!empty($superiorTitle)) { |
|
310 | + if (!empty($superiorTitle)) { |
|
311 | 311 | |
312 | - $value = '['.$superiorTitle.']'; |
|
312 | + $value = '['.$superiorTitle.']'; |
|
313 | 313 | |
314 | - } |
|
314 | + } |
|
315 | 315 | |
316 | - } |
|
316 | + } |
|
317 | 317 | |
318 | - if (!empty($value)) { |
|
318 | + if (!empty($value)) { |
|
319 | 319 | |
320 | - $value = htmlspecialchars($value); |
|
320 | + $value = htmlspecialchars($value); |
|
321 | 321 | |
322 | - // Link title to pageview. |
|
323 | - if ($this->conf['linkTitle'] && $metadata['_id']) { |
|
322 | + // Link title to pageview. |
|
323 | + if ($this->conf['linkTitle'] && $metadata['_id']) { |
|
324 | 324 | |
325 | - $details = $this->doc->getLogicalStructure($metadata['_id']); |
|
325 | + $details = $this->doc->getLogicalStructure($metadata['_id']); |
|
326 | 326 | |
327 | - $value = $this->pi_linkTP($value, array ($this->prefixId => array ('id' => $this->doc->uid, 'page' => (!empty($details['points']) ? intval($details['points']) : 1))), TRUE, $this->conf['targetPid']); |
|
327 | + $value = $this->pi_linkTP($value, array ($this->prefixId => array ('id' => $this->doc->uid, 'page' => (!empty($details['points']) ? intval($details['points']) : 1))), TRUE, $this->conf['targetPid']); |
|
328 | 328 | |
329 | - } |
|
329 | + } |
|
330 | 330 | |
331 | - } |
|
331 | + } |
|
332 | 332 | |
333 | - } elseif ($index_name == 'owner' && !empty($value)) { |
|
333 | + } elseif ($index_name == 'owner' && !empty($value)) { |
|
334 | 334 | |
335 | - // Translate name of holding library. |
|
336 | - $value = htmlspecialchars(tx_dlf_helper::translate($value, 'tx_dlf_libraries', $this->conf['pages'])); |
|
335 | + // Translate name of holding library. |
|
336 | + $value = htmlspecialchars(tx_dlf_helper::translate($value, 'tx_dlf_libraries', $this->conf['pages'])); |
|
337 | 337 | |
338 | - } elseif ($index_name == 'type' && !empty($value)) { |
|
338 | + } elseif ($index_name == 'type' && !empty($value)) { |
|
339 | 339 | |
340 | - // Translate document type. |
|
341 | - $value = htmlspecialchars(tx_dlf_helper::translate($value, 'tx_dlf_structures', $this->conf['pages'])); |
|
340 | + // Translate document type. |
|
341 | + $value = htmlspecialchars(tx_dlf_helper::translate($value, 'tx_dlf_structures', $this->conf['pages'])); |
|
342 | 342 | |
343 | - } elseif ($index_name == 'collection' && !empty($value)) { |
|
343 | + } elseif ($index_name == 'collection' && !empty($value)) { |
|
344 | 344 | |
345 | - // Check if collections isn't hidden. |
|
346 | - if (in_array($value, $collList)) { |
|
345 | + // Check if collections isn't hidden. |
|
346 | + if (in_array($value, $collList)) { |
|
347 | 347 | |
348 | - // Translate collection. |
|
349 | - $value = htmlspecialchars(tx_dlf_helper::translate($value, 'tx_dlf_collections', $this->conf['pages'])); |
|
348 | + // Translate collection. |
|
349 | + $value = htmlspecialchars(tx_dlf_helper::translate($value, 'tx_dlf_collections', $this->conf['pages'])); |
|
350 | 350 | |
351 | - } else { |
|
351 | + } else { |
|
352 | 352 | |
353 | - $value = ''; |
|
353 | + $value = ''; |
|
354 | 354 | |
355 | - } |
|
355 | + } |
|
356 | 356 | |
357 | - } elseif ($index_name == 'language' && !empty($value)) { |
|
357 | + } elseif ($index_name == 'language' && !empty($value)) { |
|
358 | 358 | |
359 | - // Translate ISO 639 language code. |
|
360 | - $value = htmlspecialchars(tx_dlf_helper::getLanguageName($value)); |
|
359 | + // Translate ISO 639 language code. |
|
360 | + $value = htmlspecialchars(tx_dlf_helper::getLanguageName($value)); |
|
361 | 361 | |
362 | - } elseif (!empty($value)) { |
|
362 | + } elseif (!empty($value)) { |
|
363 | 363 | |
364 | - // Sanitize value for output. |
|
365 | - $value = htmlspecialchars($value); |
|
364 | + // Sanitize value for output. |
|
365 | + $value = htmlspecialchars($value); |
|
366 | 366 | |
367 | - } |
|
367 | + } |
|
368 | 368 | |
369 | - // Hook for getting a customized value (requested by SBB). |
|
370 | - foreach ($this->hookObjects as $hookObj) { |
|
369 | + // Hook for getting a customized value (requested by SBB). |
|
370 | + foreach ($this->hookObjects as $hookObj) { |
|
371 | 371 | |
372 | - if (method_exists($hookObj, 'printMetadata_customizeMetadata')) { |
|
372 | + if (method_exists($hookObj, 'printMetadata_customizeMetadata')) { |
|
373 | 373 | |
374 | - $hookObj->printMetadata_customizeMetadata($value); |
|
374 | + $hookObj->printMetadata_customizeMetadata($value); |
|
375 | 375 | |
376 | - } |
|
376 | + } |
|
377 | 377 | |
378 | - } |
|
378 | + } |
|
379 | 379 | |
380 | - $value = $this->cObj->stdWrap($value, $fieldwrap['value.']); |
|
380 | + $value = $this->cObj->stdWrap($value, $fieldwrap['value.']); |
|
381 | 381 | |
382 | - if (!empty($value)) { |
|
382 | + if (!empty($value)) { |
|
383 | 383 | |
384 | - $parsedValue .= $value; |
|
384 | + $parsedValue .= $value; |
|
385 | 385 | |
386 | - } |
|
386 | + } |
|
387 | 387 | |
388 | - } while (count($metadata[$index_name])); |
|
388 | + } while (count($metadata[$index_name])); |
|
389 | 389 | |
390 | - if (!empty($parsedValue)) { |
|
390 | + if (!empty($parsedValue)) { |
|
391 | 391 | |
392 | - $field = $this->cObj->stdWrap(htmlspecialchars($metaConf['label']), $fieldwrap['key.']); |
|
392 | + $field = $this->cObj->stdWrap(htmlspecialchars($metaConf['label']), $fieldwrap['key.']); |
|
393 | 393 | |
394 | - $field .= $parsedValue; |
|
394 | + $field .= $parsedValue; |
|
395 | 395 | |
396 | - $markerArray['###METADATA###'] .= $this->cObj->stdWrap($field, $fieldwrap['all.']); |
|
396 | + $markerArray['###METADATA###'] .= $this->cObj->stdWrap($field, $fieldwrap['all.']); |
|
397 | 397 | |
398 | - } |
|
398 | + } |
|
399 | 399 | |
400 | - } |
|
400 | + } |
|
401 | 401 | |
402 | - $output .= $this->cObj->substituteMarkerArray($subpart['block'], $markerArray); |
|
402 | + $output .= $this->cObj->substituteMarkerArray($subpart['block'], $markerArray); |
|
403 | 403 | |
404 | - } |
|
404 | + } |
|
405 | 405 | |
406 | - return $this->cObj->substituteSubpart($this->template, '###BLOCK###', $output, TRUE); |
|
406 | + return $this->cObj->substituteSubpart($this->template, '###BLOCK###', $output, TRUE); |
|
407 | 407 | |
408 | - } |
|
408 | + } |
|
409 | 409 | |
410 | 410 | } |
@@ -28,7 +28,7 @@ discard block |
||
28 | 28 | * @var array |
29 | 29 | * @access protected |
30 | 30 | */ |
31 | - protected $hookObjects = array (); |
|
31 | + protected $hookObjects = array(); |
|
32 | 32 | |
33 | 33 | /** |
34 | 34 | * The main method of the PlugIn |
@@ -66,12 +66,12 @@ discard block |
||
66 | 66 | |
67 | 67 | } |
68 | 68 | |
69 | - $metadata = array (); |
|
69 | + $metadata = array(); |
|
70 | 70 | |
71 | 71 | if ($this->conf['rootline'] < 2) { |
72 | 72 | |
73 | 73 | // Get current structure's @ID. |
74 | - $ids = array (); |
|
74 | + $ids = array(); |
|
75 | 75 | |
76 | 76 | if (!empty($this->doc->physicalStructure[$this->piVars['page']]) && !empty($this->doc->smLinks['p2l'][$this->doc->physicalStructure[$this->piVars['page']]])) { |
77 | 77 | |
@@ -208,7 +208,7 @@ discard block |
||
208 | 208 | $subpart['block'] = $this->cObj->getSubpart($this->template, '###BLOCK###'); |
209 | 209 | |
210 | 210 | // Get list of metadata to show. |
211 | - $metaList = array (); |
|
211 | + $metaList = array(); |
|
212 | 212 | |
213 | 213 | $result = $GLOBALS['TYPO3_DB']->exec_SELECTquery( |
214 | 214 | 'tx_dlf_metadata.index_name AS index_name,tx_dlf_metadata.is_listed AS is_listed,tx_dlf_metadata.wrap AS wrap', |
@@ -234,7 +234,7 @@ discard block |
||
234 | 234 | // do stuff with the row entry data like built HTML or prepare further usage |
235 | 235 | if ($this->conf['showFull'] || $resArray['is_listed']) { |
236 | 236 | |
237 | - $metaList[$resArray['index_name']] = array ( |
|
237 | + $metaList[$resArray['index_name']] = array( |
|
238 | 238 | 'wrap' => $resArray['wrap'], |
239 | 239 | 'label' => tx_dlf_helper::translate($resArray['index_name'], 'tx_dlf_metadata', $this->conf['pages']) |
240 | 240 | ); |
@@ -246,7 +246,7 @@ discard block |
||
246 | 246 | } |
247 | 247 | |
248 | 248 | // Get list of collections to show. |
249 | - $collList = array (); |
|
249 | + $collList = array(); |
|
250 | 250 | |
251 | 251 | $result = $GLOBALS['TYPO3_DB']->exec_SELECTquery( |
252 | 252 | 'tx_dlf_collections.index_name AS index_name', |
@@ -324,7 +324,7 @@ discard block |
||
324 | 324 | |
325 | 325 | $details = $this->doc->getLogicalStructure($metadata['_id']); |
326 | 326 | |
327 | - $value = $this->pi_linkTP($value, array ($this->prefixId => array ('id' => $this->doc->uid, 'page' => (!empty($details['points']) ? intval($details['points']) : 1))), TRUE, $this->conf['targetPid']); |
|
327 | + $value = $this->pi_linkTP($value, array($this->prefixId => array('id' => $this->doc->uid, 'page' => (!empty($details['points']) ? intval($details['points']) : 1))), TRUE, $this->conf['targetPid']); |
|
328 | 328 | |
329 | 329 | } |
330 | 330 |
@@ -19,111 +19,111 @@ |
||
19 | 19 | */ |
20 | 20 | class tx_dlf_statistics extends tx_dlf_plugin { |
21 | 21 | |
22 | - public $scriptRelPath = 'plugins/statistics/class.tx_dlf_statistics.php'; |
|
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) { |
|
35 | - |
|
36 | - $this->init($conf); |
|
37 | - |
|
38 | - // Turn cache on. |
|
39 | - $this->setCache(TRUE); |
|
40 | - |
|
41 | - // Quit without doing anything if required configuration variables are not set. |
|
42 | - if (empty($this->conf['pages'])) { |
|
43 | - |
|
44 | - if (TYPO3_DLOG) { |
|
45 | - |
|
46 | - \TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[tx_dlf_statistics->main('.$content.', [data])] Incomplete plugin configuration', $this->extKey, SYSLOG_SEVERITY_WARNING, $conf); |
|
47 | - |
|
48 | - } |
|
49 | - |
|
50 | - return $content; |
|
51 | - |
|
52 | - } |
|
53 | - |
|
54 | - // Get description. |
|
55 | - $content .= $this->pi_RTEcssText($this->conf['description']); |
|
56 | - |
|
57 | - // Check for selected collections. |
|
58 | - if ($this->conf['collections']) { |
|
59 | - |
|
60 | - // Include only selected collections. |
|
61 | - $resultTitles = $GLOBALS['TYPO3_DB']->exec_SELECT_mm_query( |
|
62 | - 'tx_dlf_documents.uid AS uid', |
|
63 | - 'tx_dlf_documents', |
|
64 | - 'tx_dlf_relations', |
|
65 | - 'tx_dlf_collections', |
|
66 | - 'AND tx_dlf_documents.pid='.intval($this->conf['pages']).' AND tx_dlf_collections.pid='.intval($this->conf['pages']).' AND tx_dlf_documents.partof=0 AND tx_dlf_collections.uid IN ('.$GLOBALS['TYPO3_DB']->cleanIntList($this->conf['collections']).') AND tx_dlf_relations.ident='.$GLOBALS['TYPO3_DB']->fullQuoteStr('docs_colls', 'tx_dlf_relations').tx_dlf_helper::whereClause('tx_dlf_documents').tx_dlf_helper::whereClause('tx_dlf_collections'), |
|
67 | - 'tx_dlf_documents.uid', |
|
68 | - '', |
|
69 | - '' |
|
70 | - ); |
|
71 | - |
|
72 | - $resultVolumes = $GLOBALS['TYPO3_DB']->exec_SELECT_mm_query( |
|
73 | - 'tx_dlf_documents.uid AS uid', |
|
74 | - 'tx_dlf_documents', |
|
75 | - 'tx_dlf_relations', |
|
76 | - 'tx_dlf_collections', |
|
77 | - 'AND tx_dlf_documents.pid='.intval($this->conf['pages']).' AND tx_dlf_collections.pid='.intval($this->conf['pages']).' AND NOT tx_dlf_documents.uid IN (SELECT DISTINCT tx_dlf_documents.partof FROM tx_dlf_documents WHERE NOT tx_dlf_documents.partof=0'.tx_dlf_helper::whereClause('tx_dlf_documents').') AND tx_dlf_collections.uid IN ('.$GLOBALS['TYPO3_DB']->cleanIntList($this->conf['collections']).') AND tx_dlf_relations.ident='.$GLOBALS['TYPO3_DB']->fullQuoteStr('docs_colls', 'tx_dlf_relations').tx_dlf_helper::whereClause('tx_dlf_documents').tx_dlf_helper::whereClause('tx_dlf_collections'), |
|
78 | - 'tx_dlf_documents.uid', |
|
79 | - '', |
|
80 | - '' |
|
81 | - ); |
|
82 | - |
|
83 | - } else { |
|
84 | - |
|
85 | - // Include all collections. |
|
86 | - $resultTitles = $GLOBALS['TYPO3_DB']->exec_SELECTquery( |
|
87 | - 'tx_dlf_documents.uid AS uid', |
|
88 | - 'tx_dlf_documents', |
|
89 | - 'tx_dlf_documents.pid='.intval($this->conf['pages']).' AND tx_dlf_documents.partof=0'.tx_dlf_helper::whereClause('tx_dlf_documents'), |
|
90 | - '', |
|
91 | - '', |
|
92 | - '' |
|
93 | - ); |
|
94 | - |
|
95 | - $resultVolumes = $GLOBALS['TYPO3_DB']->exec_SELECTquery( |
|
96 | - 'tx_dlf_documents.uid AS uid', |
|
97 | - 'tx_dlf_documents', |
|
98 | - 'tx_dlf_documents.pid='.intval($this->conf['pages']).' AND NOT tx_dlf_documents.uid IN (SELECT DISTINCT tx_dlf_documents.partof FROM tx_dlf_documents WHERE NOT tx_dlf_documents.partof=0'.tx_dlf_helper::whereClause('tx_dlf_documents').')'.tx_dlf_helper::whereClause('tx_dlf_documents'), |
|
99 | - '', |
|
100 | - '', |
|
101 | - '' |
|
102 | - ); |
|
103 | - |
|
104 | - } |
|
105 | - |
|
106 | - $countTitles = $GLOBALS['TYPO3_DB']->sql_num_rows($resultTitles); |
|
107 | - |
|
108 | - $countVolumes = $GLOBALS['TYPO3_DB']->sql_num_rows($resultVolumes); |
|
109 | - |
|
110 | - // Set replacements. |
|
111 | - $replace = array ( |
|
112 | - 'key' => array ( |
|
113 | - '###TITLES###', |
|
114 | - '###VOLUMES###' |
|
115 | - ), |
|
116 | - 'value' => array ( |
|
117 | - $countTitles.($countTitles > 1 ? $this->pi_getLL('titles', '', TRUE) : $this->pi_getLL('title', '', TRUE)), |
|
118 | - $countVolumes.($countVolumes > 1 ? $this->pi_getLL('volumes', '', TRUE) : $this->pi_getLL('volume', '', TRUE)) |
|
119 | - ) |
|
120 | - ); |
|
121 | - |
|
122 | - // Apply replacements. |
|
123 | - $content = str_replace($replace['key'], $replace['value'], $content); |
|
124 | - |
|
125 | - return $this->pi_wrapInBaseClass($content); |
|
126 | - |
|
127 | - } |
|
22 | + public $scriptRelPath = 'plugins/statistics/class.tx_dlf_statistics.php'; |
|
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) { |
|
35 | + |
|
36 | + $this->init($conf); |
|
37 | + |
|
38 | + // Turn cache on. |
|
39 | + $this->setCache(TRUE); |
|
40 | + |
|
41 | + // Quit without doing anything if required configuration variables are not set. |
|
42 | + if (empty($this->conf['pages'])) { |
|
43 | + |
|
44 | + if (TYPO3_DLOG) { |
|
45 | + |
|
46 | + \TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[tx_dlf_statistics->main('.$content.', [data])] Incomplete plugin configuration', $this->extKey, SYSLOG_SEVERITY_WARNING, $conf); |
|
47 | + |
|
48 | + } |
|
49 | + |
|
50 | + return $content; |
|
51 | + |
|
52 | + } |
|
53 | + |
|
54 | + // Get description. |
|
55 | + $content .= $this->pi_RTEcssText($this->conf['description']); |
|
56 | + |
|
57 | + // Check for selected collections. |
|
58 | + if ($this->conf['collections']) { |
|
59 | + |
|
60 | + // Include only selected collections. |
|
61 | + $resultTitles = $GLOBALS['TYPO3_DB']->exec_SELECT_mm_query( |
|
62 | + 'tx_dlf_documents.uid AS uid', |
|
63 | + 'tx_dlf_documents', |
|
64 | + 'tx_dlf_relations', |
|
65 | + 'tx_dlf_collections', |
|
66 | + 'AND tx_dlf_documents.pid='.intval($this->conf['pages']).' AND tx_dlf_collections.pid='.intval($this->conf['pages']).' AND tx_dlf_documents.partof=0 AND tx_dlf_collections.uid IN ('.$GLOBALS['TYPO3_DB']->cleanIntList($this->conf['collections']).') AND tx_dlf_relations.ident='.$GLOBALS['TYPO3_DB']->fullQuoteStr('docs_colls', 'tx_dlf_relations').tx_dlf_helper::whereClause('tx_dlf_documents').tx_dlf_helper::whereClause('tx_dlf_collections'), |
|
67 | + 'tx_dlf_documents.uid', |
|
68 | + '', |
|
69 | + '' |
|
70 | + ); |
|
71 | + |
|
72 | + $resultVolumes = $GLOBALS['TYPO3_DB']->exec_SELECT_mm_query( |
|
73 | + 'tx_dlf_documents.uid AS uid', |
|
74 | + 'tx_dlf_documents', |
|
75 | + 'tx_dlf_relations', |
|
76 | + 'tx_dlf_collections', |
|
77 | + 'AND tx_dlf_documents.pid='.intval($this->conf['pages']).' AND tx_dlf_collections.pid='.intval($this->conf['pages']).' AND NOT tx_dlf_documents.uid IN (SELECT DISTINCT tx_dlf_documents.partof FROM tx_dlf_documents WHERE NOT tx_dlf_documents.partof=0'.tx_dlf_helper::whereClause('tx_dlf_documents').') AND tx_dlf_collections.uid IN ('.$GLOBALS['TYPO3_DB']->cleanIntList($this->conf['collections']).') AND tx_dlf_relations.ident='.$GLOBALS['TYPO3_DB']->fullQuoteStr('docs_colls', 'tx_dlf_relations').tx_dlf_helper::whereClause('tx_dlf_documents').tx_dlf_helper::whereClause('tx_dlf_collections'), |
|
78 | + 'tx_dlf_documents.uid', |
|
79 | + '', |
|
80 | + '' |
|
81 | + ); |
|
82 | + |
|
83 | + } else { |
|
84 | + |
|
85 | + // Include all collections. |
|
86 | + $resultTitles = $GLOBALS['TYPO3_DB']->exec_SELECTquery( |
|
87 | + 'tx_dlf_documents.uid AS uid', |
|
88 | + 'tx_dlf_documents', |
|
89 | + 'tx_dlf_documents.pid='.intval($this->conf['pages']).' AND tx_dlf_documents.partof=0'.tx_dlf_helper::whereClause('tx_dlf_documents'), |
|
90 | + '', |
|
91 | + '', |
|
92 | + '' |
|
93 | + ); |
|
94 | + |
|
95 | + $resultVolumes = $GLOBALS['TYPO3_DB']->exec_SELECTquery( |
|
96 | + 'tx_dlf_documents.uid AS uid', |
|
97 | + 'tx_dlf_documents', |
|
98 | + 'tx_dlf_documents.pid='.intval($this->conf['pages']).' AND NOT tx_dlf_documents.uid IN (SELECT DISTINCT tx_dlf_documents.partof FROM tx_dlf_documents WHERE NOT tx_dlf_documents.partof=0'.tx_dlf_helper::whereClause('tx_dlf_documents').')'.tx_dlf_helper::whereClause('tx_dlf_documents'), |
|
99 | + '', |
|
100 | + '', |
|
101 | + '' |
|
102 | + ); |
|
103 | + |
|
104 | + } |
|
105 | + |
|
106 | + $countTitles = $GLOBALS['TYPO3_DB']->sql_num_rows($resultTitles); |
|
107 | + |
|
108 | + $countVolumes = $GLOBALS['TYPO3_DB']->sql_num_rows($resultVolumes); |
|
109 | + |
|
110 | + // Set replacements. |
|
111 | + $replace = array ( |
|
112 | + 'key' => array ( |
|
113 | + '###TITLES###', |
|
114 | + '###VOLUMES###' |
|
115 | + ), |
|
116 | + 'value' => array ( |
|
117 | + $countTitles.($countTitles > 1 ? $this->pi_getLL('titles', '', TRUE) : $this->pi_getLL('title', '', TRUE)), |
|
118 | + $countVolumes.($countVolumes > 1 ? $this->pi_getLL('volumes', '', TRUE) : $this->pi_getLL('volume', '', TRUE)) |
|
119 | + ) |
|
120 | + ); |
|
121 | + |
|
122 | + // Apply replacements. |
|
123 | + $content = str_replace($replace['key'], $replace['value'], $content); |
|
124 | + |
|
125 | + return $this->pi_wrapInBaseClass($content); |
|
126 | + |
|
127 | + } |
|
128 | 128 | |
129 | 129 | } |
@@ -108,12 +108,12 @@ |
||
108 | 108 | $countVolumes = $GLOBALS['TYPO3_DB']->sql_num_rows($resultVolumes); |
109 | 109 | |
110 | 110 | // Set replacements. |
111 | - $replace = array ( |
|
112 | - 'key' => array ( |
|
111 | + $replace = array( |
|
112 | + 'key' => array( |
|
113 | 113 | '###TITLES###', |
114 | 114 | '###VOLUMES###' |
115 | 115 | ), |
116 | - 'value' => array ( |
|
116 | + 'value' => array( |
|
117 | 117 | $countTitles.($countTitles > 1 ? $this->pi_getLL('titles', '', TRUE) : $this->pi_getLL('title', '', TRUE)), |
118 | 118 | $countVolumes.($countVolumes > 1 ? $this->pi_getLL('volumes', '', TRUE) : $this->pi_getLL('volume', '', TRUE)) |
119 | 119 | ) |
@@ -19,69 +19,69 @@ discard block |
||
19 | 19 | */ |
20 | 20 | class tx_dlf_pageview extends tx_dlf_plugin { |
21 | 21 | |
22 | - public $scriptRelPath = 'plugins/pageview/class.tx_dlf_pageview.php'; |
|
22 | + public $scriptRelPath = 'plugins/pageview/class.tx_dlf_pageview.php'; |
|
23 | 23 | |
24 | - /** |
|
25 | - * Holds the controls to add to the map |
|
26 | - * |
|
27 | - * @var array |
|
28 | - * @access protected |
|
29 | - */ |
|
30 | - protected $controls = array (); |
|
24 | + /** |
|
25 | + * Holds the controls to add to the map |
|
26 | + * |
|
27 | + * @var array |
|
28 | + * @access protected |
|
29 | + */ |
|
30 | + protected $controls = array (); |
|
31 | 31 | |
32 | - /** |
|
33 | - * Holds the current images' URLs and MIME types |
|
34 | - * |
|
35 | - * @var array |
|
36 | - * @access protected |
|
37 | - */ |
|
38 | - protected $images = array (); |
|
32 | + /** |
|
33 | + * Holds the current images' URLs and MIME types |
|
34 | + * |
|
35 | + * @var array |
|
36 | + * @access protected |
|
37 | + */ |
|
38 | + protected $images = array (); |
|
39 | 39 | |
40 | - /** |
|
41 | - * Holds the current fulltexts' URLs |
|
42 | - * |
|
43 | - * @var array |
|
44 | - * @access protected |
|
45 | - */ |
|
46 | - protected $fulltexts = array (); |
|
40 | + /** |
|
41 | + * Holds the current fulltexts' URLs |
|
42 | + * |
|
43 | + * @var array |
|
44 | + * @access protected |
|
45 | + */ |
|
46 | + protected $fulltexts = array (); |
|
47 | 47 | |
48 | - /** |
|
49 | - * Adds Viewer javascript |
|
50 | - * |
|
51 | - * @access protected |
|
52 | - * |
|
53 | - * @return string Viewer script tags ready for output |
|
54 | - */ |
|
55 | - protected function addViewerJS() { |
|
48 | + /** |
|
49 | + * Adds Viewer javascript |
|
50 | + * |
|
51 | + * @access protected |
|
52 | + * |
|
53 | + * @return string Viewer script tags ready for output |
|
54 | + */ |
|
55 | + protected function addViewerJS() { |
|
56 | 56 | |
57 | - $output = array (); |
|
57 | + $output = array (); |
|
58 | 58 | |
59 | - // Add OpenLayers library. |
|
60 | - $output[] = '<link type="text/css" rel="stylesheet" href="'.\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::siteRelPath($this->extKey).'lib/OpenLayers/ol3.css">'; |
|
59 | + // Add OpenLayers library. |
|
60 | + $output[] = '<link type="text/css" rel="stylesheet" href="'.\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::siteRelPath($this->extKey).'lib/OpenLayers/ol3.css">'; |
|
61 | 61 | |
62 | - $output[] = '<script type="text/javascript" src="'.\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::siteRelPath($this->extKey).'lib/OpenLayers/glif.min.js"></script>'; |
|
62 | + $output[] = '<script type="text/javascript" src="'.\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::siteRelPath($this->extKey).'lib/OpenLayers/glif.min.js"></script>'; |
|
63 | 63 | |
64 | - $output[] = '<script type="text/javascript" src="'.\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::siteRelPath($this->extKey).'lib/OpenLayers/ol3-dlf.js"></script>'; |
|
64 | + $output[] = '<script type="text/javascript" src="'.\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::siteRelPath($this->extKey).'lib/OpenLayers/ol3-dlf.js"></script>'; |
|
65 | 65 | |
66 | - // Add viewer library. |
|
67 | - $output[] = '<script type="text/javascript" src="'.\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::siteRelPath($this->extKey).'plugins/pageview/tx_dlf_utils.js"></script>'; |
|
66 | + // Add viewer library. |
|
67 | + $output[] = '<script type="text/javascript" src="'.\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::siteRelPath($this->extKey).'plugins/pageview/tx_dlf_utils.js"></script>'; |
|
68 | 68 | |
69 | - $output[] = '<script type="text/javascript" src="'.\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::siteRelPath($this->extKey).'plugins/pageview/tx_dlf_ol3.js"></script>'; |
|
69 | + $output[] = '<script type="text/javascript" src="'.\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::siteRelPath($this->extKey).'plugins/pageview/tx_dlf_ol3.js"></script>'; |
|
70 | 70 | |
71 | - $output[] = '<script type="text/javascript" src="'.\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::siteRelPath($this->extKey).'plugins/pageview/tx_dlf_ol3_styles.js"></script>'; |
|
71 | + $output[] = '<script type="text/javascript" src="'.\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::siteRelPath($this->extKey).'plugins/pageview/tx_dlf_ol3_styles.js"></script>'; |
|
72 | 72 | |
73 | - $output[] = '<script type="text/javascript" src="'.\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::siteRelPath($this->extKey).'plugins/pageview/tx_dlf_ol3_source.js"></script>'; |
|
73 | + $output[] = '<script type="text/javascript" src="'.\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::siteRelPath($this->extKey).'plugins/pageview/tx_dlf_ol3_source.js"></script>'; |
|
74 | 74 | |
75 | - $output[] = '<script type="text/javascript" src="'.\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::siteRelPath($this->extKey).'plugins/pageview/tx_dlf_altoparser.js"></script>'; |
|
75 | + $output[] = '<script type="text/javascript" src="'.\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::siteRelPath($this->extKey).'plugins/pageview/tx_dlf_altoparser.js"></script>'; |
|
76 | 76 | |
77 | - $output[] = '<script type="text/javascript" src="'.\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::siteRelPath($this->extKey).'plugins/pageview/tx_dlf_pageview_imagemanipulation_control.js"></script>'; |
|
77 | + $output[] = '<script type="text/javascript" src="'.\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::siteRelPath($this->extKey).'plugins/pageview/tx_dlf_pageview_imagemanipulation_control.js"></script>'; |
|
78 | 78 | |
79 | - $output[] = '<script type="text/javascript" src="'.\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::siteRelPath($this->extKey).'plugins/pageview/tx_dlf_pageview_fulltext_control.js"></script>'; |
|
79 | + $output[] = '<script type="text/javascript" src="'.\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::siteRelPath($this->extKey).'plugins/pageview/tx_dlf_pageview_fulltext_control.js"></script>'; |
|
80 | 80 | |
81 | - $output[] = '<script type="text/javascript" src="'.\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::siteRelPath($this->extKey).'plugins/pageview/tx_dlf_pageview.js"></script>'; |
|
81 | + $output[] = '<script type="text/javascript" src="'.\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::siteRelPath($this->extKey).'plugins/pageview/tx_dlf_pageview.js"></script>'; |
|
82 | 82 | |
83 | - // Add viewer configuration. |
|
84 | - $output[] = ' |
|
83 | + // Add viewer configuration. |
|
84 | + $output[] = ' |
|
85 | 85 | <script id="tx-dlf-pageview-initViewer" type="text/javascript"> |
86 | 86 | window.onload = function() { |
87 | 87 | if (dlfUtils.exists(dlfViewer)) { |
@@ -96,312 +96,312 @@ discard block |
||
96 | 96 | } |
97 | 97 | </script>'; |
98 | 98 | |
99 | - return implode("\n", $output); |
|
99 | + return implode("\n", $output); |
|
100 | 100 | |
101 | - } |
|
101 | + } |
|
102 | 102 | |
103 | - /** |
|
104 | - * Adds pageview interaction (crop, magnifier and rotation) |
|
105 | - * |
|
106 | - * @access protected |
|
107 | - * |
|
108 | - * @return array Marker array |
|
109 | - */ |
|
110 | - protected function addInteraction() { |
|
103 | + /** |
|
104 | + * Adds pageview interaction (crop, magnifier and rotation) |
|
105 | + * |
|
106 | + * @access protected |
|
107 | + * |
|
108 | + * @return array Marker array |
|
109 | + */ |
|
110 | + protected function addInteraction() { |
|
111 | 111 | |
112 | - $markerArray = array (); |
|
112 | + $markerArray = array (); |
|
113 | 113 | |
114 | - if ($this->piVars['id']) { |
|
114 | + if ($this->piVars['id']) { |
|
115 | 115 | |
116 | - if (empty($this->piVars['page'])) { |
|
116 | + if (empty($this->piVars['page'])) { |
|
117 | 117 | |
118 | - $params['page'] = 1; |
|
118 | + $params['page'] = 1; |
|
119 | 119 | |
120 | - } |
|
120 | + } |
|
121 | 121 | |
122 | - if ($this->conf['crop']) { |
|
122 | + if ($this->conf['crop']) { |
|
123 | 123 | |
124 | - $markerArray['###EDITBUTTON###'] = '<a href="javascript: tx_dlf_viewer.activateSelection();">'.$this->pi_getLL('editMode', '', TRUE).'</a>'; |
|
124 | + $markerArray['###EDITBUTTON###'] = '<a href="javascript: tx_dlf_viewer.activateSelection();">'.$this->pi_getLL('editMode', '', TRUE).'</a>'; |
|
125 | 125 | |
126 | - $markerArray['###EDITREMOVE###'] = '<a href="javascript: tx_dlf_viewer.resetCropSelection();">'.$this->pi_getLL('editRemove', '', TRUE).'</a>'; |
|
126 | + $markerArray['###EDITREMOVE###'] = '<a href="javascript: tx_dlf_viewer.resetCropSelection();">'.$this->pi_getLL('editRemove', '', TRUE).'</a>'; |
|
127 | 127 | |
128 | - } else { |
|
128 | + } else { |
|
129 | 129 | |
130 | - $markerArray['###EDITBUTTON###'] = ''; |
|
130 | + $markerArray['###EDITBUTTON###'] = ''; |
|
131 | 131 | |
132 | - $markerArray['###EDITREMOVE###'] = ''; |
|
132 | + $markerArray['###EDITREMOVE###'] = ''; |
|
133 | 133 | |
134 | - } |
|
134 | + } |
|
135 | 135 | |
136 | - if ($this->conf['magnifier']) { |
|
136 | + if ($this->conf['magnifier']) { |
|
137 | 137 | |
138 | - $markerArray['###MAGNIFIER###'] = '<a href="javascript: tx_dlf_viewer.activateMagnifier();">'.$this->pi_getLL('magnifier', '', TRUE).'</a>'; |
|
138 | + $markerArray['###MAGNIFIER###'] = '<a href="javascript: tx_dlf_viewer.activateMagnifier();">'.$this->pi_getLL('magnifier', '', TRUE).'</a>'; |
|
139 | 139 | |
140 | - } else { |
|
140 | + } else { |
|
141 | 141 | |
142 | - $markerArray['###MAGNIFIER###'] = ''; |
|
142 | + $markerArray['###MAGNIFIER###'] = ''; |
|
143 | 143 | |
144 | - } |
|
144 | + } |
|
145 | 145 | |
146 | - } |
|
146 | + } |
|
147 | 147 | |
148 | - return $markerArray; |
|
149 | - } |
|
148 | + return $markerArray; |
|
149 | + } |
|
150 | 150 | |
151 | - /** |
|
152 | - * Adds form to save cropping data to basket |
|
153 | - * |
|
154 | - * @access protected |
|
155 | - * |
|
156 | - * @return array Marker array |
|
157 | - */ |
|
158 | - protected function addBasketForm() { |
|
151 | + /** |
|
152 | + * Adds form to save cropping data to basket |
|
153 | + * |
|
154 | + * @access protected |
|
155 | + * |
|
156 | + * @return array Marker array |
|
157 | + */ |
|
158 | + protected function addBasketForm() { |
|
159 | 159 | |
160 | - $markerArray = array (); |
|
160 | + $markerArray = array (); |
|
161 | 161 | |
162 | - // Add basket button |
|
163 | - if ($this->conf['basketButton'] && $this->conf['targetBasket'] && $this->piVars['id']) { |
|
162 | + // Add basket button |
|
163 | + if ($this->conf['basketButton'] && $this->conf['targetBasket'] && $this->piVars['id']) { |
|
164 | 164 | |
165 | - $label = $this->pi_getLL('addBasket', '', TRUE); |
|
165 | + $label = $this->pi_getLL('addBasket', '', TRUE); |
|
166 | 166 | |
167 | - $params = array ( |
|
168 | - 'id' => $this->piVars['id'], |
|
169 | - 'addToBasket' => TRUE |
|
170 | - ); |
|
167 | + $params = array ( |
|
168 | + 'id' => $this->piVars['id'], |
|
169 | + 'addToBasket' => TRUE |
|
170 | + ); |
|
171 | 171 | |
172 | - if (empty($this->piVars['page'])) { |
|
172 | + if (empty($this->piVars['page'])) { |
|
173 | 173 | |
174 | - $params['page'] = 1; |
|
174 | + $params['page'] = 1; |
|
175 | 175 | |
176 | - } |
|
176 | + } |
|
177 | 177 | |
178 | - $basketConf = array ( |
|
179 | - 'parameter' => $this->conf['targetBasket'], |
|
180 | - 'additionalParams' => \TYPO3\CMS\Core\Utility\GeneralUtility::implodeArrayForUrl($this->prefixId, $params, '', TRUE, FALSE), |
|
181 | - 'title' => $label |
|
182 | - ); |
|
178 | + $basketConf = array ( |
|
179 | + 'parameter' => $this->conf['targetBasket'], |
|
180 | + 'additionalParams' => \TYPO3\CMS\Core\Utility\GeneralUtility::implodeArrayForUrl($this->prefixId, $params, '', TRUE, FALSE), |
|
181 | + 'title' => $label |
|
182 | + ); |
|
183 | 183 | |
184 | - $output = '<form id="addToBasketForm" action="'.$this->cObj->typoLink_URL($basketConf).'" method="post">'; |
|
184 | + $output = '<form id="addToBasketForm" action="'.$this->cObj->typoLink_URL($basketConf).'" method="post">'; |
|
185 | 185 | |
186 | - $output .= '<input type="hidden" name="tx_dlf[startpage]" id="startpage" value="'.$this->piVars['page'].'">'; |
|
186 | + $output .= '<input type="hidden" name="tx_dlf[startpage]" id="startpage" value="'.$this->piVars['page'].'">'; |
|
187 | 187 | |
188 | - $output .= '<input type="hidden" name="tx_dlf[endpage]" id="endpage" value="'.$this->piVars['page'].'">'; |
|
188 | + $output .= '<input type="hidden" name="tx_dlf[endpage]" id="endpage" value="'.$this->piVars['page'].'">'; |
|
189 | 189 | |
190 | - $output .= '<input type="hidden" name="tx_dlf[startX]" id="startX">'; |
|
190 | + $output .= '<input type="hidden" name="tx_dlf[startX]" id="startX">'; |
|
191 | 191 | |
192 | - $output .= '<input type="hidden" name="tx_dlf[startY]" id="startY">'; |
|
192 | + $output .= '<input type="hidden" name="tx_dlf[startY]" id="startY">'; |
|
193 | 193 | |
194 | - $output .= '<input type="hidden" name="tx_dlf[endX]" id="endX">'; |
|
194 | + $output .= '<input type="hidden" name="tx_dlf[endX]" id="endX">'; |
|
195 | 195 | |
196 | - $output .= '<input type="hidden" name="tx_dlf[endY]" id="endY">'; |
|
196 | + $output .= '<input type="hidden" name="tx_dlf[endY]" id="endY">'; |
|
197 | 197 | |
198 | - $output .= '<input type="hidden" name="tx_dlf[rotation]" id="rotation">'; |
|
198 | + $output .= '<input type="hidden" name="tx_dlf[rotation]" id="rotation">'; |
|
199 | 199 | |
200 | - $output .= '<button id="submitBasketForm" onclick="this.form.submit()">'.$label.'</button>'; |
|
200 | + $output .= '<button id="submitBasketForm" onclick="this.form.submit()">'.$label.'</button>'; |
|
201 | 201 | |
202 | - $output .= '</form>'; |
|
202 | + $output .= '</form>'; |
|
203 | 203 | |
204 | - $output .= '<script>'; |
|
204 | + $output .= '<script>'; |
|
205 | 205 | |
206 | - $output .= ' |
|
206 | + $output .= ' |
|
207 | 207 | $(document).ready(function() { |
208 | 208 | $("#submitBasketForm").click(function() { |
209 | 209 | $("#addToBasketForm").submit(); |
210 | 210 | }); |
211 | 211 | });'; |
212 | 212 | |
213 | - $output .= '</script>'; |
|
213 | + $output .= '</script>'; |
|
214 | 214 | |
215 | - $markerArray['###BASKETBUTTON###'] = $output; |
|
215 | + $markerArray['###BASKETBUTTON###'] = $output; |
|
216 | 216 | |
217 | - } else { |
|
217 | + } else { |
|
218 | 218 | |
219 | - $markerArray['###BASKETBUTTON###'] = ''; |
|
219 | + $markerArray['###BASKETBUTTON###'] = ''; |
|
220 | 220 | |
221 | - } |
|
221 | + } |
|
222 | 222 | |
223 | - return $markerArray; |
|
224 | - } |
|
223 | + return $markerArray; |
|
224 | + } |
|
225 | 225 | |
226 | - /** |
|
227 | - * Get image's URL and MIME type |
|
228 | - * |
|
229 | - * @access protected |
|
230 | - * |
|
231 | - * @param integer $page: Page number |
|
232 | - * |
|
233 | - * @return array URL and MIME type of image file |
|
234 | - */ |
|
235 | - protected function getImage($page) { |
|
226 | + /** |
|
227 | + * Get image's URL and MIME type |
|
228 | + * |
|
229 | + * @access protected |
|
230 | + * |
|
231 | + * @param integer $page: Page number |
|
232 | + * |
|
233 | + * @return array URL and MIME type of image file |
|
234 | + */ |
|
235 | + protected function getImage($page) { |
|
236 | 236 | |
237 | - $image = array (); |
|
237 | + $image = array (); |
|
238 | 238 | |
239 | - // Get @USE value of METS fileGrp. |
|
240 | - $fileGrps = \TYPO3\CMS\Core\Utility\GeneralUtility::trimExplode(',', $this->conf['fileGrps']); |
|
239 | + // Get @USE value of METS fileGrp. |
|
240 | + $fileGrps = \TYPO3\CMS\Core\Utility\GeneralUtility::trimExplode(',', $this->conf['fileGrps']); |
|
241 | 241 | |
242 | - while ($fileGrp = @array_pop($fileGrps)) { |
|
242 | + while ($fileGrp = @array_pop($fileGrps)) { |
|
243 | 243 | |
244 | - // Get image link. |
|
245 | - if (!empty($this->doc->physicalStructureInfo[$this->doc->physicalStructure[$page]]['files'][$fileGrp])) { |
|
244 | + // Get image link. |
|
245 | + if (!empty($this->doc->physicalStructureInfo[$this->doc->physicalStructure[$page]]['files'][$fileGrp])) { |
|
246 | 246 | |
247 | - $image['url'] = $this->doc->getFileLocation($this->doc->physicalStructureInfo[$this->doc->physicalStructure[$page]]['files'][$fileGrp]); |
|
247 | + $image['url'] = $this->doc->getFileLocation($this->doc->physicalStructureInfo[$this->doc->physicalStructure[$page]]['files'][$fileGrp]); |
|
248 | 248 | |
249 | - if ($this->conf['useInternalProxy']) { |
|
250 | - // Configure @action URL for form. |
|
251 | - $linkConf = array ( |
|
252 | - 'parameter' => $GLOBALS['TSFE']->id, |
|
253 | - 'additionalParams' => '&eID=tx_dlf_geturl_eid&url='.urlencode($image['url']), |
|
254 | - ); |
|
249 | + if ($this->conf['useInternalProxy']) { |
|
250 | + // Configure @action URL for form. |
|
251 | + $linkConf = array ( |
|
252 | + 'parameter' => $GLOBALS['TSFE']->id, |
|
253 | + 'additionalParams' => '&eID=tx_dlf_geturl_eid&url='.urlencode($image['url']), |
|
254 | + ); |
|
255 | 255 | |
256 | - $image['url'] = $this->cObj->typoLink_URL($linkConf); |
|
257 | - } |
|
256 | + $image['url'] = $this->cObj->typoLink_URL($linkConf); |
|
257 | + } |
|
258 | 258 | |
259 | - $image['mimetype'] = $this->doc->getFileMimeType($this->doc->physicalStructureInfo[$this->doc->physicalStructure[$page]]['files'][$fileGrp]); |
|
259 | + $image['mimetype'] = $this->doc->getFileMimeType($this->doc->physicalStructureInfo[$this->doc->physicalStructure[$page]]['files'][$fileGrp]); |
|
260 | 260 | |
261 | - break; |
|
261 | + break; |
|
262 | 262 | |
263 | - } else { |
|
263 | + } else { |
|
264 | 264 | |
265 | - if (TYPO3_DLOG) { |
|
265 | + if (TYPO3_DLOG) { |
|
266 | 266 | |
267 | - \TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[tx_dlf_pageview->getImage('.$page.')] File not found in fileGrp "'.$fileGrp.'"', $this->extKey, SYSLOG_SEVERITY_WARNING); |
|
267 | + \TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[tx_dlf_pageview->getImage('.$page.')] File not found in fileGrp "'.$fileGrp.'"', $this->extKey, SYSLOG_SEVERITY_WARNING); |
|
268 | 268 | |
269 | - } |
|
269 | + } |
|
270 | 270 | |
271 | - } |
|
271 | + } |
|
272 | 272 | |
273 | - } |
|
273 | + } |
|
274 | 274 | |
275 | - return $image; |
|
275 | + return $image; |
|
276 | 276 | |
277 | - } |
|
277 | + } |
|
278 | 278 | |
279 | - /** |
|
280 | - * Get fulltext URL and MIME type |
|
281 | - * |
|
282 | - * @access protected |
|
283 | - * |
|
284 | - * @param integer $page: Page number |
|
285 | - * |
|
286 | - * @return array URL and MIME type of fulltext file |
|
287 | - */ |
|
288 | - protected function getFulltext($page) { |
|
279 | + /** |
|
280 | + * Get fulltext URL and MIME type |
|
281 | + * |
|
282 | + * @access protected |
|
283 | + * |
|
284 | + * @param integer $page: Page number |
|
285 | + * |
|
286 | + * @return array URL and MIME type of fulltext file |
|
287 | + */ |
|
288 | + protected function getFulltext($page) { |
|
289 | 289 | |
290 | - $fulltext = array (); |
|
290 | + $fulltext = array (); |
|
291 | 291 | |
292 | - // Get fulltext link. |
|
293 | - if (!empty($this->doc->physicalStructureInfo[$this->doc->physicalStructure[$page]]['files'][$this->conf['fileGrpFulltext']])) { |
|
292 | + // Get fulltext link. |
|
293 | + if (!empty($this->doc->physicalStructureInfo[$this->doc->physicalStructure[$page]]['files'][$this->conf['fileGrpFulltext']])) { |
|
294 | 294 | |
295 | - $fulltext['url'] = $this->doc->getFileLocation($this->doc->physicalStructureInfo[$this->doc->physicalStructure[$page]]['files'][$this->conf['fileGrpFulltext']]); |
|
295 | + $fulltext['url'] = $this->doc->getFileLocation($this->doc->physicalStructureInfo[$this->doc->physicalStructure[$page]]['files'][$this->conf['fileGrpFulltext']]); |
|
296 | 296 | |
297 | - // Configure @action URL for form. |
|
298 | - $linkConf = array ( |
|
299 | - 'parameter' => $GLOBALS['TSFE']->id, |
|
300 | - 'additionalParams' => '&eID=tx_dlf_geturl_eid&url='.urlencode($fulltext['url']), |
|
301 | - ); |
|
297 | + // Configure @action URL for form. |
|
298 | + $linkConf = array ( |
|
299 | + 'parameter' => $GLOBALS['TSFE']->id, |
|
300 | + 'additionalParams' => '&eID=tx_dlf_geturl_eid&url='.urlencode($fulltext['url']), |
|
301 | + ); |
|
302 | 302 | |
303 | - $fulltext['url'] = $this->cObj->typoLink_URL($linkConf); |
|
303 | + $fulltext['url'] = $this->cObj->typoLink_URL($linkConf); |
|
304 | 304 | |
305 | - $fulltext['mimetype'] = $this->doc->getFileMimeType($this->doc->physicalStructureInfo[$this->doc->physicalStructure[$page]]['files'][$this->conf['fileGrpFulltext']]); |
|
305 | + $fulltext['mimetype'] = $this->doc->getFileMimeType($this->doc->physicalStructureInfo[$this->doc->physicalStructure[$page]]['files'][$this->conf['fileGrpFulltext']]); |
|
306 | 306 | |
307 | - } else { |
|
307 | + } else { |
|
308 | 308 | |
309 | - if (TYPO3_DLOG) { |
|
309 | + if (TYPO3_DLOG) { |
|
310 | 310 | |
311 | - \TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[tx_dlf_pageview->getFulltext('.$page.')] File not found in fileGrp "'.$this->conf['fileGrpFulltext'].'"', $this->extKey, SYSLOG_SEVERITY_WARNING); |
|
311 | + \TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[tx_dlf_pageview->getFulltext('.$page.')] File not found in fileGrp "'.$this->conf['fileGrpFulltext'].'"', $this->extKey, SYSLOG_SEVERITY_WARNING); |
|
312 | 312 | |
313 | - } |
|
313 | + } |
|
314 | 314 | |
315 | - } |
|
315 | + } |
|
316 | 316 | |
317 | - return $fulltext; |
|
317 | + return $fulltext; |
|
318 | 318 | |
319 | - } |
|
319 | + } |
|
320 | 320 | |
321 | - /** |
|
322 | - * The main method of the PlugIn |
|
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 main($content, $conf) { |
|
321 | + /** |
|
322 | + * The main method of the PlugIn |
|
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 main($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 || $this->doc->numPages < 1) { |
|
338 | + if ($this->doc === NULL || $this->doc->numPages < 1) { |
|
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 | - } else { |
|
343 | + } else { |
|
344 | 344 | |
345 | - if (!empty($this->piVars['logicalPage'])) { |
|
345 | + if (!empty($this->piVars['logicalPage'])) { |
|
346 | 346 | |
347 | - $this->piVars['page'] = $this->doc->getPhysicalPage($this->piVars['logicalPage']); |
|
348 | - // The logical page parameter should not appear again |
|
349 | - unset($this->piVars['logicalPage']); |
|
347 | + $this->piVars['page'] = $this->doc->getPhysicalPage($this->piVars['logicalPage']); |
|
348 | + // The logical page parameter should not appear again |
|
349 | + unset($this->piVars['logicalPage']); |
|
350 | 350 | |
351 | - } |
|
351 | + } |
|
352 | 352 | |
353 | - // Set default values if not set. |
|
354 | - // $this->piVars['page'] may be integer or string (physical structure @ID) |
|
355 | - if ((int) $this->piVars['page'] > 0 || empty($this->piVars['page'])) { |
|
353 | + // Set default values if not set. |
|
354 | + // $this->piVars['page'] may be integer or string (physical structure @ID) |
|
355 | + if ((int) $this->piVars['page'] > 0 || empty($this->piVars['page'])) { |
|
356 | 356 | |
357 | - $this->piVars['page'] = \TYPO3\CMS\Core\Utility\MathUtility::forceIntegerInRange((int) $this->piVars['page'], 1, $this->doc->numPages, 1); |
|
357 | + $this->piVars['page'] = \TYPO3\CMS\Core\Utility\MathUtility::forceIntegerInRange((int) $this->piVars['page'], 1, $this->doc->numPages, 1); |
|
358 | 358 | |
359 | - } else { |
|
359 | + } else { |
|
360 | 360 | |
361 | - $this->piVars['page'] = array_search($this->piVars['page'], $this->doc->physicalStructure); |
|
361 | + $this->piVars['page'] = array_search($this->piVars['page'], $this->doc->physicalStructure); |
|
362 | 362 | |
363 | - } |
|
363 | + } |
|
364 | 364 | |
365 | - $this->piVars['double'] = \TYPO3\CMS\Core\Utility\MathUtility::forceIntegerInRange($this->piVars['double'], 0, 1, 0); |
|
365 | + $this->piVars['double'] = \TYPO3\CMS\Core\Utility\MathUtility::forceIntegerInRange($this->piVars['double'], 0, 1, 0); |
|
366 | 366 | |
367 | - } |
|
367 | + } |
|
368 | 368 | |
369 | - // Load template file. |
|
370 | - if (!empty($this->conf['templateFile'])) { |
|
369 | + // Load template file. |
|
370 | + if (!empty($this->conf['templateFile'])) { |
|
371 | 371 | |
372 | - $this->template = $this->cObj->getSubpart($this->cObj->fileResource($this->conf['templateFile']), '###TEMPLATE###'); |
|
372 | + $this->template = $this->cObj->getSubpart($this->cObj->fileResource($this->conf['templateFile']), '###TEMPLATE###'); |
|
373 | 373 | |
374 | - } else { |
|
374 | + } else { |
|
375 | 375 | |
376 | - $this->template = $this->cObj->getSubpart($this->cObj->fileResource('EXT:dlf/plugins/pageview/template.tmpl'), '###TEMPLATE###'); |
|
376 | + $this->template = $this->cObj->getSubpart($this->cObj->fileResource('EXT:dlf/plugins/pageview/template.tmpl'), '###TEMPLATE###'); |
|
377 | 377 | |
378 | - } |
|
378 | + } |
|
379 | 379 | |
380 | - // Get image data. |
|
381 | - $this->images[0] = $this->getImage($this->piVars['page']); |
|
382 | - $this->fulltexts[0] = $this->getFulltext($this->piVars['page']); |
|
380 | + // Get image data. |
|
381 | + $this->images[0] = $this->getImage($this->piVars['page']); |
|
382 | + $this->fulltexts[0] = $this->getFulltext($this->piVars['page']); |
|
383 | 383 | |
384 | - if ($this->piVars['double'] && $this->piVars['page'] < $this->doc->numPages) { |
|
384 | + if ($this->piVars['double'] && $this->piVars['page'] < $this->doc->numPages) { |
|
385 | 385 | |
386 | - $this->images[1] = $this->getImage($this->piVars['page'] + 1); |
|
387 | - $this->fulltexts[1] = $this->getFulltext($this->piVars['page'] + 1); |
|
386 | + $this->images[1] = $this->getImage($this->piVars['page'] + 1); |
|
387 | + $this->fulltexts[1] = $this->getFulltext($this->piVars['page'] + 1); |
|
388 | 388 | |
389 | - } |
|
389 | + } |
|
390 | 390 | |
391 | - // Get the controls for the map. |
|
392 | - $this->controls = explode(',', $this->conf['features']); |
|
391 | + // Get the controls for the map. |
|
392 | + $this->controls = explode(',', $this->conf['features']); |
|
393 | 393 | |
394 | - // Fill in the template markers. |
|
395 | - $markerArray = array ( |
|
396 | - '###VIEWER_JS###' => $this->addViewerJS() |
|
397 | - ); |
|
394 | + // Fill in the template markers. |
|
395 | + $markerArray = array ( |
|
396 | + '###VIEWER_JS###' => $this->addViewerJS() |
|
397 | + ); |
|
398 | 398 | |
399 | - $markerArray = array_merge($markerArray, $this->addInteraction(), $this->addBasketForm()); |
|
399 | + $markerArray = array_merge($markerArray, $this->addInteraction(), $this->addBasketForm()); |
|
400 | 400 | |
401 | - $content .= $this->cObj->substituteMarkerArray($this->template, $markerArray); |
|
401 | + $content .= $this->cObj->substituteMarkerArray($this->template, $markerArray); |
|
402 | 402 | |
403 | - return $this->pi_wrapInBaseClass($content); |
|
403 | + return $this->pi_wrapInBaseClass($content); |
|
404 | 404 | |
405 | - } |
|
405 | + } |
|
406 | 406 | |
407 | 407 | } |
@@ -27,7 +27,7 @@ discard block |
||
27 | 27 | * @var array |
28 | 28 | * @access protected |
29 | 29 | */ |
30 | - protected $controls = array (); |
|
30 | + protected $controls = array(); |
|
31 | 31 | |
32 | 32 | /** |
33 | 33 | * Holds the current images' URLs and MIME types |
@@ -35,7 +35,7 @@ discard block |
||
35 | 35 | * @var array |
36 | 36 | * @access protected |
37 | 37 | */ |
38 | - protected $images = array (); |
|
38 | + protected $images = array(); |
|
39 | 39 | |
40 | 40 | /** |
41 | 41 | * Holds the current fulltexts' URLs |
@@ -43,7 +43,7 @@ discard block |
||
43 | 43 | * @var array |
44 | 44 | * @access protected |
45 | 45 | */ |
46 | - protected $fulltexts = array (); |
|
46 | + protected $fulltexts = array(); |
|
47 | 47 | |
48 | 48 | /** |
49 | 49 | * Adds Viewer javascript |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | */ |
55 | 55 | protected function addViewerJS() { |
56 | 56 | |
57 | - $output = array (); |
|
57 | + $output = array(); |
|
58 | 58 | |
59 | 59 | // Add OpenLayers library. |
60 | 60 | $output[] = '<link type="text/css" rel="stylesheet" href="'.\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::siteRelPath($this->extKey).'lib/OpenLayers/ol3.css">'; |
@@ -109,7 +109,7 @@ discard block |
||
109 | 109 | */ |
110 | 110 | protected function addInteraction() { |
111 | 111 | |
112 | - $markerArray = array (); |
|
112 | + $markerArray = array(); |
|
113 | 113 | |
114 | 114 | if ($this->piVars['id']) { |
115 | 115 | |
@@ -157,14 +157,14 @@ discard block |
||
157 | 157 | */ |
158 | 158 | protected function addBasketForm() { |
159 | 159 | |
160 | - $markerArray = array (); |
|
160 | + $markerArray = array(); |
|
161 | 161 | |
162 | 162 | // Add basket button |
163 | 163 | if ($this->conf['basketButton'] && $this->conf['targetBasket'] && $this->piVars['id']) { |
164 | 164 | |
165 | 165 | $label = $this->pi_getLL('addBasket', '', TRUE); |
166 | 166 | |
167 | - $params = array ( |
|
167 | + $params = array( |
|
168 | 168 | 'id' => $this->piVars['id'], |
169 | 169 | 'addToBasket' => TRUE |
170 | 170 | ); |
@@ -175,7 +175,7 @@ discard block |
||
175 | 175 | |
176 | 176 | } |
177 | 177 | |
178 | - $basketConf = array ( |
|
178 | + $basketConf = array( |
|
179 | 179 | 'parameter' => $this->conf['targetBasket'], |
180 | 180 | 'additionalParams' => \TYPO3\CMS\Core\Utility\GeneralUtility::implodeArrayForUrl($this->prefixId, $params, '', TRUE, FALSE), |
181 | 181 | 'title' => $label |
@@ -234,7 +234,7 @@ discard block |
||
234 | 234 | */ |
235 | 235 | protected function getImage($page) { |
236 | 236 | |
237 | - $image = array (); |
|
237 | + $image = array(); |
|
238 | 238 | |
239 | 239 | // Get @USE value of METS fileGrp. |
240 | 240 | $fileGrps = \TYPO3\CMS\Core\Utility\GeneralUtility::trimExplode(',', $this->conf['fileGrps']); |
@@ -248,7 +248,7 @@ discard block |
||
248 | 248 | |
249 | 249 | if ($this->conf['useInternalProxy']) { |
250 | 250 | // Configure @action URL for form. |
251 | - $linkConf = array ( |
|
251 | + $linkConf = array( |
|
252 | 252 | 'parameter' => $GLOBALS['TSFE']->id, |
253 | 253 | 'additionalParams' => '&eID=tx_dlf_geturl_eid&url='.urlencode($image['url']), |
254 | 254 | ); |
@@ -287,7 +287,7 @@ discard block |
||
287 | 287 | */ |
288 | 288 | protected function getFulltext($page) { |
289 | 289 | |
290 | - $fulltext = array (); |
|
290 | + $fulltext = array(); |
|
291 | 291 | |
292 | 292 | // Get fulltext link. |
293 | 293 | if (!empty($this->doc->physicalStructureInfo[$this->doc->physicalStructure[$page]]['files'][$this->conf['fileGrpFulltext']])) { |
@@ -295,7 +295,7 @@ discard block |
||
295 | 295 | $fulltext['url'] = $this->doc->getFileLocation($this->doc->physicalStructureInfo[$this->doc->physicalStructure[$page]]['files'][$this->conf['fileGrpFulltext']]); |
296 | 296 | |
297 | 297 | // Configure @action URL for form. |
298 | - $linkConf = array ( |
|
298 | + $linkConf = array( |
|
299 | 299 | 'parameter' => $GLOBALS['TSFE']->id, |
300 | 300 | 'additionalParams' => '&eID=tx_dlf_geturl_eid&url='.urlencode($fulltext['url']), |
301 | 301 | ); |
@@ -392,7 +392,7 @@ discard block |
||
392 | 392 | $this->controls = explode(',', $this->conf['features']); |
393 | 393 | |
394 | 394 | // Fill in the template markers. |
395 | - $markerArray = array ( |
|
395 | + $markerArray = array( |
|
396 | 396 | '###VIEWER_JS###' => $this->addViewerJS() |
397 | 397 | ); |
398 | 398 |
@@ -22,65 +22,65 @@ |
||
22 | 22 | */ |
23 | 23 | class tx_dlf_geturl_eid extends \TYPO3\CMS\Frontend\Plugin\AbstractPlugin { |
24 | 24 | |
25 | - /** |
|
26 | - * |
|
27 | - */ |
|
28 | - public $cObj; |
|
25 | + /** |
|
26 | + * |
|
27 | + */ |
|
28 | + public $cObj; |
|
29 | 29 | |
30 | 30 | |
31 | - /** |
|
32 | - * The main method of the eID-Script |
|
33 | - * |
|
34 | - * @access public |
|
35 | - * |
|
36 | - * @param string $content: The PlugIn content |
|
37 | - * @param array $conf: The PlugIn configuration |
|
38 | - * |
|
39 | - * @return void |
|
40 | - */ |
|
41 | - public function main($content = '', $conf = array ()) { |
|
31 | + /** |
|
32 | + * The main method of the eID-Script |
|
33 | + * |
|
34 | + * @access public |
|
35 | + * |
|
36 | + * @param string $content: The PlugIn content |
|
37 | + * @param array $conf: The PlugIn configuration |
|
38 | + * |
|
39 | + * @return void |
|
40 | + */ |
|
41 | + public function main($content = '', $conf = array ()) { |
|
42 | 42 | |
43 | - $this->cObj = GeneralUtility::makeInstance('TYPO3\\CMS\\Frontend\\ContentObject\\ContentObjectRenderer'); |
|
43 | + $this->cObj = GeneralUtility::makeInstance('TYPO3\\CMS\\Frontend\\ContentObject\\ContentObjectRenderer'); |
|
44 | 44 | |
45 | - $this->extKey = 'dlf'; |
|
45 | + $this->extKey = 'dlf'; |
|
46 | 46 | |
47 | - $this->scriptRelPath = 'plugins/pageview/class.tx_dlf_geturl_eid.php'; |
|
47 | + $this->scriptRelPath = 'plugins/pageview/class.tx_dlf_geturl_eid.php'; |
|
48 | 48 | |
49 | - $url = GeneralUtility::_GP('url'); |
|
50 | - $includeHeader = \TYPO3\CMS\Core\Utility\MathUtility::forceIntegerInRange(GeneralUtility::_GP('header'), 0, 2, 0); |
|
49 | + $url = GeneralUtility::_GP('url'); |
|
50 | + $includeHeader = \TYPO3\CMS\Core\Utility\MathUtility::forceIntegerInRange(GeneralUtility::_GP('header'), 0, 2, 0); |
|
51 | 51 | |
52 | - // first we fetch header separately |
|
53 | - $fetchedHeader = GeneralUtility::getUrl($url, 2); |
|
52 | + // first we fetch header separately |
|
53 | + $fetchedHeader = GeneralUtility::getUrl($url, 2); |
|
54 | 54 | |
55 | - if ($includeHeader == 0) { |
|
55 | + if ($includeHeader == 0) { |
|
56 | 56 | |
57 | - $fetchedData = GeneralUtility::getUrl($url, $includeHeader); |
|
57 | + $fetchedData = GeneralUtility::getUrl($url, $includeHeader); |
|
58 | 58 | |
59 | - } else { |
|
59 | + } else { |
|
60 | 60 | |
61 | - $fetchedData = $fetchedHeader; |
|
61 | + $fetchedData = $fetchedHeader; |
|
62 | 62 | |
63 | - } |
|
63 | + } |
|
64 | 64 | |
65 | - // add some self calculated header tags |
|
66 | - header('Last-Modified: '.gmdate("D, d M Y H:i:s").'GMT'); |
|
67 | - header('Cache-Control: max-age=3600, must-revalidate'); |
|
68 | - header('Content-Length: '.strlen($fetchedData)); |
|
69 | - $fi = finfo_open(FILEINFO_MIME); |
|
70 | - header('Content-Type: '.finfo_buffer($fi, $fetchedData)); |
|
65 | + // add some self calculated header tags |
|
66 | + header('Last-Modified: '.gmdate("D, d M Y H:i:s").'GMT'); |
|
67 | + header('Cache-Control: max-age=3600, must-revalidate'); |
|
68 | + header('Content-Length: '.strlen($fetchedData)); |
|
69 | + $fi = finfo_open(FILEINFO_MIME); |
|
70 | + header('Content-Type: '.finfo_buffer($fi, $fetchedData)); |
|
71 | 71 | |
72 | - // take some tags from request header and overwrite in case already set |
|
73 | - $fetchedHeader = explode("\n", GeneralUtility::getUrl($url, 2)); |
|
72 | + // take some tags from request header and overwrite in case already set |
|
73 | + $fetchedHeader = explode("\n", GeneralUtility::getUrl($url, 2)); |
|
74 | 74 | |
75 | - foreach ($fetchedHeader as $headerline) { |
|
76 | - if (stripos($headerline, 'Last-Modified:') !== FALSE) { |
|
77 | - header($headerline); |
|
78 | - } |
|
79 | - } |
|
75 | + foreach ($fetchedHeader as $headerline) { |
|
76 | + if (stripos($headerline, 'Last-Modified:') !== FALSE) { |
|
77 | + header($headerline); |
|
78 | + } |
|
79 | + } |
|
80 | 80 | |
81 | - echo $fetchedData; |
|
81 | + echo $fetchedData; |
|
82 | 82 | |
83 | - } |
|
83 | + } |
|
84 | 84 | |
85 | 85 | } |
86 | 86 |
@@ -38,7 +38,7 @@ |
||
38 | 38 | * |
39 | 39 | * @return void |
40 | 40 | */ |
41 | - public function main($content = '', $conf = array ()) { |
|
41 | + public function main($content = '', $conf = array()) { |
|
42 | 42 | |
43 | 43 | $this->cObj = GeneralUtility::makeInstance('TYPO3\\CMS\\Frontend\\ContentObject\\ContentObjectRenderer'); |
44 | 44 |
@@ -19,35 +19,35 @@ discard block |
||
19 | 19 | */ |
20 | 20 | class tx_dlf_audioplayer extends tx_dlf_plugin { |
21 | 21 | |
22 | - public $scriptRelPath = 'plugins/audioplayer/class.tx_dlf_audioplayer.php'; |
|
22 | + public $scriptRelPath = 'plugins/audioplayer/class.tx_dlf_audioplayer.php'; |
|
23 | 23 | |
24 | - /** |
|
25 | - * Holds the current audio file's URL, MIME type and optional label |
|
26 | - * |
|
27 | - * @var array |
|
28 | - * @access protected |
|
29 | - */ |
|
30 | - protected $audio = array (); |
|
24 | + /** |
|
25 | + * Holds the current audio file's URL, MIME type and optional label |
|
26 | + * |
|
27 | + * @var array |
|
28 | + * @access protected |
|
29 | + */ |
|
30 | + protected $audio = array (); |
|
31 | 31 | |
32 | - /** |
|
33 | - * Adds Player javascript |
|
34 | - * |
|
35 | - * @access protected |
|
36 | - * |
|
37 | - * @return string Player script tags ready for output |
|
38 | - */ |
|
39 | - protected function addPlayerJS() { |
|
32 | + /** |
|
33 | + * Adds Player javascript |
|
34 | + * |
|
35 | + * @access protected |
|
36 | + * |
|
37 | + * @return string Player script tags ready for output |
|
38 | + */ |
|
39 | + protected function addPlayerJS() { |
|
40 | 40 | |
41 | - $output = array (); |
|
41 | + $output = array (); |
|
42 | 42 | |
43 | - $output[] = '<link type="text/css" rel="stylesheet" href="'.\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::siteRelPath($this->extKey).'lib/jPlayer/blue.monday/css/jplayer.blue.monday.min.css">'; |
|
43 | + $output[] = '<link type="text/css" rel="stylesheet" href="'.\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::siteRelPath($this->extKey).'lib/jPlayer/blue.monday/css/jplayer.blue.monday.min.css">'; |
|
44 | 44 | |
45 | - $output[] = '<script type="text/javascript" src="'.\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::siteRelPath($this->extKey).'lib/jPlayer/jquery.jplayer.min.js"></script>'; |
|
45 | + $output[] = '<script type="text/javascript" src="'.\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::siteRelPath($this->extKey).'lib/jPlayer/jquery.jplayer.min.js"></script>'; |
|
46 | 46 | |
47 | - $output[] = '<script type="text/javascript" src="'.\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::siteRelPath($this->extKey).'plugins/audioplayer/js/tx_dlf_audioplayer.js"></script>'; |
|
47 | + $output[] = '<script type="text/javascript" src="'.\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::siteRelPath($this->extKey).'plugins/audioplayer/js/tx_dlf_audioplayer.js"></script>'; |
|
48 | 48 | |
49 | - // Add player configuration. |
|
50 | - $output[] = ' |
|
49 | + // Add player configuration. |
|
50 | + $output[] = ' |
|
51 | 51 | <style> |
52 | 52 | #tx-dlf-audio { width: 100px; height: 100px }; |
53 | 53 | </style> |
@@ -65,87 +65,87 @@ discard block |
||
65 | 65 | }); |
66 | 66 | </script>'; |
67 | 67 | |
68 | - return implode("\n", $output); |
|
68 | + return implode("\n", $output); |
|
69 | 69 | |
70 | - } |
|
70 | + } |
|
71 | 71 | |
72 | - /** |
|
73 | - * The main method of the PlugIn |
|
74 | - * |
|
75 | - * @access public |
|
76 | - * |
|
77 | - * @param string $content: The PlugIn content |
|
78 | - * @param array $conf: The PlugIn configuration |
|
79 | - * |
|
80 | - * @return string The content that is displayed on the website |
|
81 | - */ |
|
82 | - public function main($content, $conf) { |
|
72 | + /** |
|
73 | + * The main method of the PlugIn |
|
74 | + * |
|
75 | + * @access public |
|
76 | + * |
|
77 | + * @param string $content: The PlugIn content |
|
78 | + * @param array $conf: The PlugIn configuration |
|
79 | + * |
|
80 | + * @return string The content that is displayed on the website |
|
81 | + */ |
|
82 | + public function main($content, $conf) { |
|
83 | 83 | |
84 | - $this->init($conf); |
|
84 | + $this->init($conf); |
|
85 | 85 | |
86 | - // Load current document. |
|
87 | - $this->loadDocument(); |
|
86 | + // Load current document. |
|
87 | + $this->loadDocument(); |
|
88 | 88 | |
89 | - if ($this->doc === NULL || $this->doc->numPages < 1) { |
|
89 | + if ($this->doc === NULL || $this->doc->numPages < 1) { |
|
90 | 90 | |
91 | - // Quit without doing anything if required variables are not set. |
|
92 | - return $content; |
|
91 | + // Quit without doing anything if required variables are not set. |
|
92 | + return $content; |
|
93 | 93 | |
94 | - } else { |
|
94 | + } else { |
|
95 | 95 | |
96 | - // Set default values if not set. |
|
97 | - // $this->piVars['page'] may be integer or string (physical structure @ID) |
|
98 | - if ((int) $this->piVars['page'] > 0 || empty($this->piVars['page'])) { |
|
96 | + // Set default values if not set. |
|
97 | + // $this->piVars['page'] may be integer or string (physical structure @ID) |
|
98 | + if ((int) $this->piVars['page'] > 0 || empty($this->piVars['page'])) { |
|
99 | 99 | |
100 | - $this->piVars['page'] = \TYPO3\CMS\Core\Utility\MathUtility::forceIntegerInRange((int) $this->piVars['page'], 1, $this->doc->numPages, 1); |
|
100 | + $this->piVars['page'] = \TYPO3\CMS\Core\Utility\MathUtility::forceIntegerInRange((int) $this->piVars['page'], 1, $this->doc->numPages, 1); |
|
101 | 101 | |
102 | - } else { |
|
102 | + } else { |
|
103 | 103 | |
104 | - $this->piVars['page'] = array_search($this->piVars['page'], $this->doc->physicalStructure); |
|
104 | + $this->piVars['page'] = array_search($this->piVars['page'], $this->doc->physicalStructure); |
|
105 | 105 | |
106 | - } |
|
106 | + } |
|
107 | 107 | |
108 | - $this->piVars['double'] = \TYPO3\CMS\Core\Utility\MathUtility::forceIntegerInRange($this->piVars['double'], 0, 1, 0); |
|
108 | + $this->piVars['double'] = \TYPO3\CMS\Core\Utility\MathUtility::forceIntegerInRange($this->piVars['double'], 0, 1, 0); |
|
109 | 109 | |
110 | - } |
|
110 | + } |
|
111 | 111 | |
112 | - // Check if there are any audio files available. |
|
113 | - if (!empty($this->doc->physicalStructureInfo[$this->doc->physicalStructure[$this->piVars['page']]]['files'][$this->conf['fileGrpAudio']])) { |
|
112 | + // Check if there are any audio files available. |
|
113 | + if (!empty($this->doc->physicalStructureInfo[$this->doc->physicalStructure[$this->piVars['page']]]['files'][$this->conf['fileGrpAudio']])) { |
|
114 | 114 | |
115 | - // Get audio data. |
|
116 | - $this->audio['url'] = $this->doc->getFileLocation($this->doc->physicalStructureInfo[$this->doc->physicalStructure[$this->piVars['page']]]['files'][$this->conf['fileGrpAudio']]); |
|
115 | + // Get audio data. |
|
116 | + $this->audio['url'] = $this->doc->getFileLocation($this->doc->physicalStructureInfo[$this->doc->physicalStructure[$this->piVars['page']]]['files'][$this->conf['fileGrpAudio']]); |
|
117 | 117 | |
118 | - $this->audio['label'] = $this->doc->physicalStructureInfo[$this->doc->physicalStructure[$this->piVars['page']]]['label']; |
|
118 | + $this->audio['label'] = $this->doc->physicalStructureInfo[$this->doc->physicalStructure[$this->piVars['page']]]['label']; |
|
119 | 119 | |
120 | - $this->audio['mimetype'] = $this->doc->getFileMimeType($this->doc->physicalStructureInfo[$this->doc->physicalStructure[$this->piVars['page']]]['files'][$this->conf['fileGrpAudio']]); |
|
120 | + $this->audio['mimetype'] = $this->doc->getFileMimeType($this->doc->physicalStructureInfo[$this->doc->physicalStructure[$this->piVars['page']]]['files'][$this->conf['fileGrpAudio']]); |
|
121 | 121 | |
122 | - } else { |
|
122 | + } else { |
|
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 | - } |
|
127 | + } |
|
128 | 128 | |
129 | - // Load template file. |
|
130 | - if (!empty($this->conf['templateFile'])) { |
|
129 | + // Load template file. |
|
130 | + if (!empty($this->conf['templateFile'])) { |
|
131 | 131 | |
132 | - $this->template = $this->cObj->getSubpart($this->cObj->fileResource($this->conf['templateFile']), '###TEMPLATE###'); |
|
132 | + $this->template = $this->cObj->getSubpart($this->cObj->fileResource($this->conf['templateFile']), '###TEMPLATE###'); |
|
133 | 133 | |
134 | - } else { |
|
134 | + } else { |
|
135 | 135 | |
136 | - $this->template = $this->cObj->getSubpart($this->cObj->fileResource('EXT:dlf/plugins/audioplayer/template.tmpl'), '###TEMPLATE###'); |
|
136 | + $this->template = $this->cObj->getSubpart($this->cObj->fileResource('EXT:dlf/plugins/audioplayer/template.tmpl'), '###TEMPLATE###'); |
|
137 | 137 | |
138 | - } |
|
138 | + } |
|
139 | 139 | |
140 | - // Fill in the template markers. |
|
141 | - $markerArray = array ( |
|
142 | - '###PLAYER_JS###' => $this->addPlayerJS() |
|
143 | - ); |
|
140 | + // Fill in the template markers. |
|
141 | + $markerArray = array ( |
|
142 | + '###PLAYER_JS###' => $this->addPlayerJS() |
|
143 | + ); |
|
144 | 144 | |
145 | - $content .= $this->cObj->substituteMarkerArray($this->template, $markerArray); |
|
145 | + $content .= $this->cObj->substituteMarkerArray($this->template, $markerArray); |
|
146 | 146 | |
147 | - return $this->pi_wrapInBaseClass($content); |
|
147 | + return $this->pi_wrapInBaseClass($content); |
|
148 | 148 | |
149 | - } |
|
149 | + } |
|
150 | 150 | |
151 | 151 | } |
@@ -27,7 +27,7 @@ discard block |
||
27 | 27 | * @var array |
28 | 28 | * @access protected |
29 | 29 | */ |
30 | - protected $audio = array (); |
|
30 | + protected $audio = array(); |
|
31 | 31 | |
32 | 32 | /** |
33 | 33 | * Adds Player javascript |
@@ -38,7 +38,7 @@ discard block |
||
38 | 38 | */ |
39 | 39 | protected function addPlayerJS() { |
40 | 40 | |
41 | - $output = array (); |
|
41 | + $output = array(); |
|
42 | 42 | |
43 | 43 | $output[] = '<link type="text/css" rel="stylesheet" href="'.\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::siteRelPath($this->extKey).'lib/jPlayer/blue.monday/css/jplayer.blue.monday.min.css">'; |
44 | 44 | |
@@ -138,7 +138,7 @@ discard block |
||
138 | 138 | } |
139 | 139 | |
140 | 140 | // Fill in the template markers. |
141 | - $markerArray = array ( |
|
141 | + $markerArray = array( |
|
142 | 142 | '###PLAYER_JS###' => $this->addPlayerJS() |
143 | 143 | ); |
144 | 144 |
@@ -19,61 +19,61 @@ |
||
19 | 19 | */ |
20 | 20 | class tx_dlf_validator extends tx_dlf_plugin { |
21 | 21 | |
22 | - public $scriptRelPath = 'plugins/validator/class.tx_dlf_validator.php'; |
|
22 | + public $scriptRelPath = 'plugins/validator/class.tx_dlf_validator.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 | - // Disable caching for this plugin. |
|
39 | - $this->setCache(FALSE); |
|
38 | + // Disable caching for this plugin. |
|
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/validator/template.tmpl'), '###TEMPLATE###'); |
|
48 | + $this->template = $this->cObj->getSubpart($this->cObj->fileResource('EXT:dlf/plugins/validator/template.tmpl'), '###TEMPLATE###'); |
|
49 | 49 | |
50 | - } |
|
50 | + } |
|
51 | 51 | |
52 | - // Load current document. |
|
53 | - $this->loadDocument(); |
|
52 | + // Load current document. |
|
53 | + $this->loadDocument(); |
|
54 | 54 | |
55 | - if ($this->doc === NULL) { |
|
55 | + if ($this->doc === NULL) { |
|
56 | 56 | |
57 | - // Document could not be loaded. |
|
58 | - // Check: |
|
59 | - // - if document location is valid URL |
|
60 | - // - if document location is reachable |
|
61 | - // - if document is well-formed XML |
|
62 | - // - if document has METS node |
|
57 | + // Document could not be loaded. |
|
58 | + // Check: |
|
59 | + // - if document location is valid URL |
|
60 | + // - if document location is reachable |
|
61 | + // - if document is well-formed XML |
|
62 | + // - if document has METS node |
|
63 | 63 | |
64 | - } else { |
|
64 | + } else { |
|
65 | 65 | |
66 | - // Document loaded. |
|
67 | - // Check: |
|
68 | - // - if document is valid METS document |
|
69 | - // - if document contains supported metadata schema |
|
70 | - // - if document's metadata are valid |
|
71 | - // - if document provides configured mandatory fields |
|
66 | + // Document loaded. |
|
67 | + // Check: |
|
68 | + // - if document is valid METS document |
|
69 | + // - if document contains supported metadata schema |
|
70 | + // - if document's metadata are valid |
|
71 | + // - if document provides configured mandatory fields |
|
72 | 72 | |
73 | - } |
|
73 | + } |
|
74 | 74 | |
75 | - return $this->pi_wrapInBaseClass($content); |
|
75 | + return $this->pi_wrapInBaseClass($content); |
|
76 | 76 | |
77 | - } |
|
77 | + } |
|
78 | 78 | |
79 | 79 | } |
@@ -20,834 +20,834 @@ |
||
20 | 20 | */ |
21 | 21 | class tx_dlf_search extends tx_dlf_plugin { |
22 | 22 | |
23 | - public $scriptRelPath = 'plugins/search/class.tx_dlf_search.php'; |
|
23 | + public $scriptRelPath = 'plugins/search/class.tx_dlf_search.php'; |
|
24 | 24 | |
25 | - /** |
|
26 | - * Adds the JS files necessary for search suggestions |
|
27 | - * |
|
28 | - * @access protected |
|
29 | - * |
|
30 | - * @return void |
|
31 | - */ |
|
32 | - protected function addAutocompleteJS() { |
|
25 | + /** |
|
26 | + * Adds the JS files necessary for search suggestions |
|
27 | + * |
|
28 | + * @access protected |
|
29 | + * |
|
30 | + * @return void |
|
31 | + */ |
|
32 | + protected function addAutocompleteJS() { |
|
33 | 33 | |
34 | - // Check if there are any metadata to suggest. |
|
35 | - $result = $GLOBALS['TYPO3_DB']->exec_SELECTquery( |
|
36 | - 'tx_dlf_metadata.*', |
|
37 | - 'tx_dlf_metadata', |
|
38 | - 'tx_dlf_metadata.index_autocomplete=1 AND tx_dlf_metadata.pid='.intval($this->conf['pages']).tx_dlf_helper::whereClause('tx_dlf_metadata'), |
|
39 | - '', |
|
40 | - '', |
|
41 | - '1' |
|
42 | - ); |
|
34 | + // Check if there are any metadata to suggest. |
|
35 | + $result = $GLOBALS['TYPO3_DB']->exec_SELECTquery( |
|
36 | + 'tx_dlf_metadata.*', |
|
37 | + 'tx_dlf_metadata', |
|
38 | + 'tx_dlf_metadata.index_autocomplete=1 AND tx_dlf_metadata.pid='.intval($this->conf['pages']).tx_dlf_helper::whereClause('tx_dlf_metadata'), |
|
39 | + '', |
|
40 | + '', |
|
41 | + '1' |
|
42 | + ); |
|
43 | 43 | |
44 | 44 | |
45 | - if ($GLOBALS['TYPO3_DB']->sql_num_rows($result)) { |
|
45 | + if ($GLOBALS['TYPO3_DB']->sql_num_rows($result)) { |
|
46 | 46 | |
47 | - $GLOBALS['TSFE']->additionalHeaderData[$this->prefixId.'_search_suggest'] = '<script type="text/javascript" src="'.\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::siteRelPath($this->extKey).'plugins/search/tx_dlf_search_suggest.js"></script>'; |
|
47 | + $GLOBALS['TSFE']->additionalHeaderData[$this->prefixId.'_search_suggest'] = '<script type="text/javascript" src="'.\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::siteRelPath($this->extKey).'plugins/search/tx_dlf_search_suggest.js"></script>'; |
|
48 | 48 | |
49 | - } else { |
|
49 | + } else { |
|
50 | 50 | |
51 | - if (TYPO3_DLOG) { |
|
51 | + if (TYPO3_DLOG) { |
|
52 | 52 | |
53 | - \TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[tx_dlf_search->addAutocompleteJS()] No metadata fields configured for search suggestions', $this->extKey, SYSLOG_SEVERITY_WARNING); |
|
53 | + \TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[tx_dlf_search->addAutocompleteJS()] No metadata fields configured for search suggestions', $this->extKey, SYSLOG_SEVERITY_WARNING); |
|
54 | 54 | |
55 | - } |
|
55 | + } |
|
56 | 56 | |
57 | - } |
|
57 | + } |
|
58 | 58 | |
59 | - } |
|
59 | + } |
|
60 | 60 | |
61 | - /** |
|
62 | - * Adds the current collection's UID to the search form |
|
63 | - * |
|
64 | - * @access protected |
|
65 | - * |
|
66 | - * @return string HTML input fields with current document's UID and parent ID |
|
67 | - */ |
|
68 | - protected function addCurrentCollection() { |
|
61 | + /** |
|
62 | + * Adds the current collection's UID to the search form |
|
63 | + * |
|
64 | + * @access protected |
|
65 | + * |
|
66 | + * @return string HTML input fields with current document's UID and parent ID |
|
67 | + */ |
|
68 | + protected function addCurrentCollection() { |
|
69 | 69 | |
70 | - // Load current collection. |
|
71 | - $list = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('tx_dlf_list'); |
|
70 | + // Load current collection. |
|
71 | + $list = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('tx_dlf_list'); |
|
72 | 72 | |
73 | - if (!empty($list->metadata['options']['source']) && $list->metadata['options']['source'] == 'collection') { |
|
73 | + if (!empty($list->metadata['options']['source']) && $list->metadata['options']['source'] == 'collection') { |
|
74 | 74 | |
75 | - // Get collection's UID. |
|
76 | - return '<input type="hidden" name="'.$this->prefixId.'[collection]" value="'.$list->metadata['options']['select'].'" />'; |
|
75 | + // Get collection's UID. |
|
76 | + return '<input type="hidden" name="'.$this->prefixId.'[collection]" value="'.$list->metadata['options']['select'].'" />'; |
|
77 | 77 | |
78 | - } elseif (!empty($list->metadata['options']['params']['fq'])) { |
|
78 | + } elseif (!empty($list->metadata['options']['params']['fq'])) { |
|
79 | 79 | |
80 | - // Get collection's UID from search metadata. |
|
81 | - foreach ($list->metadata['options']['params']['fq'] as $id => $facet) { |
|
80 | + // Get collection's UID from search metadata. |
|
81 | + foreach ($list->metadata['options']['params']['fq'] as $id => $facet) { |
|
82 | 82 | |
83 | - $facetKeyVal = explode(':', $facet, 2); |
|
83 | + $facetKeyVal = explode(':', $facet, 2); |
|
84 | 84 | |
85 | - if ($facetKeyVal[0] == 'collection_faceting' && !strpos($facetKeyVal[1], '" OR "')) { |
|
85 | + if ($facetKeyVal[0] == 'collection_faceting' && !strpos($facetKeyVal[1], '" OR "')) { |
|
86 | 86 | |
87 | - $collectionId = tx_dlf_helper::getIdFromIndexName(trim($facetKeyVal[1], '(")'), 'tx_dlf_collections'); |
|
87 | + $collectionId = tx_dlf_helper::getIdFromIndexName(trim($facetKeyVal[1], '(")'), 'tx_dlf_collections'); |
|
88 | 88 | |
89 | - } |
|
89 | + } |
|
90 | 90 | |
91 | - } |
|
91 | + } |
|
92 | 92 | |
93 | - return '<input type="hidden" name="'.$this->prefixId.'[collection]" value="'.$collectionId.'" />'; |
|
93 | + return '<input type="hidden" name="'.$this->prefixId.'[collection]" value="'.$collectionId.'" />'; |
|
94 | 94 | |
95 | - } |
|
95 | + } |
|
96 | 96 | |
97 | - return ''; |
|
97 | + return ''; |
|
98 | 98 | |
99 | - } |
|
99 | + } |
|
100 | 100 | |
101 | - /** |
|
102 | - * Adds the current document's UID or parent ID to the search form |
|
103 | - * |
|
104 | - * @access protected |
|
105 | - * |
|
106 | - * @return string HTML input fields with current document's UID and parent ID |
|
107 | - */ |
|
108 | - protected function addCurrentDocument() { |
|
101 | + /** |
|
102 | + * Adds the current document's UID or parent ID to the search form |
|
103 | + * |
|
104 | + * @access protected |
|
105 | + * |
|
106 | + * @return string HTML input fields with current document's UID and parent ID |
|
107 | + */ |
|
108 | + protected function addCurrentDocument() { |
|
109 | 109 | |
110 | - // Load current list object. |
|
111 | - $list = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('tx_dlf_list'); |
|
110 | + // Load current list object. |
|
111 | + $list = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('tx_dlf_list'); |
|
112 | 112 | |
113 | - // Load current document. |
|
114 | - if (!empty($this->piVars['id']) && \TYPO3\CMS\Core\Utility\MathUtility::canBeInterpretedAsInteger($this->piVars['id'])) { |
|
113 | + // Load current document. |
|
114 | + if (!empty($this->piVars['id']) && \TYPO3\CMS\Core\Utility\MathUtility::canBeInterpretedAsInteger($this->piVars['id'])) { |
|
115 | 115 | |
116 | - $this->loadDocument(); |
|
116 | + $this->loadDocument(); |
|
117 | 117 | |
118 | - // Get document's UID or parent ID. |
|
119 | - if ($this->doc->ready) { |
|
118 | + // Get document's UID or parent ID. |
|
119 | + if ($this->doc->ready) { |
|
120 | 120 | |
121 | - return '<input type="hidden" name="'.$this->prefixId.'[id]" value="'.($this->doc->parentId > 0 ? $this->doc->parentId : $this->doc->uid).'" />'; |
|
121 | + return '<input type="hidden" name="'.$this->prefixId.'[id]" value="'.($this->doc->parentId > 0 ? $this->doc->parentId : $this->doc->uid).'" />'; |
|
122 | 122 | |
123 | - } |
|
123 | + } |
|
124 | 124 | |
125 | - } elseif (!empty($list->metadata['options']['params']['fq'])) { |
|
125 | + } elseif (!empty($list->metadata['options']['params']['fq'])) { |
|
126 | 126 | |
127 | - // Get document's UID from search metadata. |
|
128 | - foreach ($list->metadata['options']['params']['fq'] as $id => $facet) { |
|
127 | + // Get document's UID from search metadata. |
|
128 | + foreach ($list->metadata['options']['params']['fq'] as $id => $facet) { |
|
129 | 129 | |
130 | - $facetKeyVal = explode(':', $facet); |
|
130 | + $facetKeyVal = explode(':', $facet); |
|
131 | 131 | |
132 | - if ($facetKeyVal[0] == 'uid') { |
|
132 | + if ($facetKeyVal[0] == 'uid') { |
|
133 | 133 | |
134 | - $documentId = (int) substr($facetKeyVal[1], 1, strpos($facetKeyVal[1], ')')); |
|
134 | + $documentId = (int) substr($facetKeyVal[1], 1, strpos($facetKeyVal[1], ')')); |
|
135 | 135 | |
136 | - } |
|
136 | + } |
|
137 | 137 | |
138 | - } |
|
138 | + } |
|
139 | 139 | |
140 | - return '<input type="hidden" name="'.$this->prefixId.'[id]" value="'.$documentId.'" />'; |
|
140 | + return '<input type="hidden" name="'.$this->prefixId.'[id]" value="'.$documentId.'" />'; |
|
141 | 141 | |
142 | - } |
|
142 | + } |
|
143 | 143 | |
144 | - return ''; |
|
144 | + return ''; |
|
145 | 145 | |
146 | - } |
|
146 | + } |
|
147 | 147 | |
148 | - /** |
|
149 | - * Adds the encrypted Solr core name to the search form |
|
150 | - * |
|
151 | - * @access protected |
|
152 | - * |
|
153 | - * @return string HTML input fields with encrypted core name and hash |
|
154 | - */ |
|
155 | - protected function addEncryptedCoreName() { |
|
148 | + /** |
|
149 | + * Adds the encrypted Solr core name to the search form |
|
150 | + * |
|
151 | + * @access protected |
|
152 | + * |
|
153 | + * @return string HTML input fields with encrypted core name and hash |
|
154 | + */ |
|
155 | + protected function addEncryptedCoreName() { |
|
156 | 156 | |
157 | - // Get core name. |
|
158 | - $name = tx_dlf_helper::getIndexName($this->conf['solrcore'], 'tx_dlf_solrcores'); |
|
157 | + // Get core name. |
|
158 | + $name = tx_dlf_helper::getIndexName($this->conf['solrcore'], 'tx_dlf_solrcores'); |
|
159 | 159 | |
160 | - // Encrypt core name. |
|
161 | - if (!empty($name)) { |
|
160 | + // Encrypt core name. |
|
161 | + if (!empty($name)) { |
|
162 | 162 | |
163 | - $name = tx_dlf_helper::encrypt($name); |
|
163 | + $name = tx_dlf_helper::encrypt($name); |
|
164 | 164 | |
165 | - } |
|
165 | + } |
|
166 | 166 | |
167 | - // Add encrypted fields to search form. |
|
168 | - if (is_array($name)) { |
|
167 | + // Add encrypted fields to search form. |
|
168 | + if (is_array($name)) { |
|
169 | 169 | |
170 | - return '<input type="hidden" name="'.$this->prefixId.'[encrypted]" value="'.$name['encrypted'].'" /><input type="hidden" name="'.$this->prefixId.'[hashed]" value="'.$name['hash'].'" />'; |
|
170 | + return '<input type="hidden" name="'.$this->prefixId.'[encrypted]" value="'.$name['encrypted'].'" /><input type="hidden" name="'.$this->prefixId.'[hashed]" value="'.$name['hash'].'" />'; |
|
171 | 171 | |
172 | - } else { |
|
172 | + } else { |
|
173 | 173 | |
174 | - return ''; |
|
174 | + return ''; |
|
175 | 175 | |
176 | - } |
|
176 | + } |
|
177 | 177 | |
178 | - } |
|
178 | + } |
|
179 | 179 | |
180 | - /** |
|
181 | - * Returns the extended search form and adds the JS files necessary for extended search. |
|
182 | - * |
|
183 | - * @access protected |
|
184 | - * |
|
185 | - * @return string The extended search form or an empty string |
|
186 | - */ |
|
187 | - protected function addExtendedSearch() { |
|
180 | + /** |
|
181 | + * Returns the extended search form and adds the JS files necessary for extended search. |
|
182 | + * |
|
183 | + * @access protected |
|
184 | + * |
|
185 | + * @return string The extended search form or an empty string |
|
186 | + */ |
|
187 | + protected function addExtendedSearch() { |
|
188 | 188 | |
189 | - $extendedSearch = ''; |
|
189 | + $extendedSearch = ''; |
|
190 | 190 | |
191 | - // Quit without doing anything if no fields for extended search are selected. |
|
192 | - if (empty($this->conf['extendedSlotCount']) || empty($this->conf['extendedFields'])) { |
|
191 | + // Quit without doing anything if no fields for extended search are selected. |
|
192 | + if (empty($this->conf['extendedSlotCount']) || empty($this->conf['extendedFields'])) { |
|
193 | 193 | |
194 | - return $extendedSearch; |
|
194 | + return $extendedSearch; |
|
195 | 195 | |
196 | - } |
|
196 | + } |
|
197 | 197 | |
198 | - // Get operator options. |
|
199 | - $operatorOptions = ''; |
|
198 | + // Get operator options. |
|
199 | + $operatorOptions = ''; |
|
200 | 200 | |
201 | - foreach (array ('AND', 'OR', 'NOT') as $operator) { |
|
201 | + foreach (array ('AND', 'OR', 'NOT') as $operator) { |
|
202 | 202 | |
203 | - $operatorOptions .= '<option class="tx-dlf-search-operator-option tx-dlf-search-operator-'.$operator.'" value="'.$operator.'">'.$this->pi_getLL($operator, '', TRUE).'</option>'; |
|
203 | + $operatorOptions .= '<option class="tx-dlf-search-operator-option tx-dlf-search-operator-'.$operator.'" value="'.$operator.'">'.$this->pi_getLL($operator, '', TRUE).'</option>'; |
|
204 | 204 | |
205 | - } |
|
205 | + } |
|
206 | 206 | |
207 | - // Get field selector options. |
|
208 | - $fieldSelectorOptions = ''; |
|
207 | + // Get field selector options. |
|
208 | + $fieldSelectorOptions = ''; |
|
209 | 209 | |
210 | - $searchFields = \TYPO3\CMS\Core\Utility\GeneralUtility::trimExplode(',', $this->conf['extendedFields'], TRUE); |
|
210 | + $searchFields = \TYPO3\CMS\Core\Utility\GeneralUtility::trimExplode(',', $this->conf['extendedFields'], TRUE); |
|
211 | 211 | |
212 | - foreach ($searchFields as $searchField) { |
|
212 | + foreach ($searchFields as $searchField) { |
|
213 | 213 | |
214 | - $fieldSelectorOptions .= '<option class="tx-dlf-search-field-option tx-dlf-search-field-'.$searchField.'" value="'.$searchField.'">'.tx_dlf_helper::translate($searchField, 'tx_dlf_metadata', $this->conf['pages']).'</option>'; |
|
214 | + $fieldSelectorOptions .= '<option class="tx-dlf-search-field-option tx-dlf-search-field-'.$searchField.'" value="'.$searchField.'">'.tx_dlf_helper::translate($searchField, 'tx_dlf_metadata', $this->conf['pages']).'</option>'; |
|
215 | 215 | |
216 | - } |
|
216 | + } |
|
217 | 217 | |
218 | - for ($i = 0; $i < $this->conf['extendedSlotCount']; $i++) { |
|
218 | + for ($i = 0; $i < $this->conf['extendedSlotCount']; $i++) { |
|
219 | 219 | |
220 | - $markerArray = array ( |
|
221 | - '###EXT_SEARCH_OPERATOR###' => '<select class="tx-dlf-search-operator tx-dlf-search-operator-'.$i.'" name="'.$this->prefixId.'[extOperator]['.$i.']">'.$operatorOptions.'</select>', |
|
222 | - '###EXT_SEARCH_FIELDSELECTOR###' => '<select class="tx-dlf-search-field tx-dlf-search-field-'.$i.'" name="'.$this->prefixId.'[extField]['.$i.']">'.$fieldSelectorOptions.'</select>', |
|
223 | - '###EXT_SEARCH_FIELDQUERY###' => '<input class="tx-dlf-search-query tx-dlf-search-query-'.$i.'" type="text" name="'.$this->prefixId.'[extQuery]['.$i.']" />' |
|
224 | - ); |
|
220 | + $markerArray = array ( |
|
221 | + '###EXT_SEARCH_OPERATOR###' => '<select class="tx-dlf-search-operator tx-dlf-search-operator-'.$i.'" name="'.$this->prefixId.'[extOperator]['.$i.']">'.$operatorOptions.'</select>', |
|
222 | + '###EXT_SEARCH_FIELDSELECTOR###' => '<select class="tx-dlf-search-field tx-dlf-search-field-'.$i.'" name="'.$this->prefixId.'[extField]['.$i.']">'.$fieldSelectorOptions.'</select>', |
|
223 | + '###EXT_SEARCH_FIELDQUERY###' => '<input class="tx-dlf-search-query tx-dlf-search-query-'.$i.'" type="text" name="'.$this->prefixId.'[extQuery]['.$i.']" />' |
|
224 | + ); |
|
225 | 225 | |
226 | - $extendedSearch .= $this->cObj->substituteMarkerArray($this->cObj->getSubpart($this->template, '###EXT_SEARCH_ENTRY###'), $markerArray); |
|
226 | + $extendedSearch .= $this->cObj->substituteMarkerArray($this->cObj->getSubpart($this->template, '###EXT_SEARCH_ENTRY###'), $markerArray); |
|
227 | 227 | |
228 | - } |
|
228 | + } |
|
229 | 229 | |
230 | - return $extendedSearch; |
|
230 | + return $extendedSearch; |
|
231 | 231 | |
232 | - } |
|
232 | + } |
|
233 | 233 | |
234 | - /** |
|
235 | - * Adds the facets menu to the search form |
|
236 | - * |
|
237 | - * @access protected |
|
238 | - * |
|
239 | - * @return string HTML output of facets menu |
|
240 | - */ |
|
241 | - protected function addFacetsMenu() { |
|
234 | + /** |
|
235 | + * Adds the facets menu to the search form |
|
236 | + * |
|
237 | + * @access protected |
|
238 | + * |
|
239 | + * @return string HTML output of facets menu |
|
240 | + */ |
|
241 | + protected function addFacetsMenu() { |
|
242 | 242 | |
243 | - // Check for typoscript configuration to prevent fatal error. |
|
244 | - if (empty($this->conf['facetsConf.'])) { |
|
243 | + // Check for typoscript configuration to prevent fatal error. |
|
244 | + if (empty($this->conf['facetsConf.'])) { |
|
245 | 245 | |
246 | - if (TYPO3_DLOG) { |
|
246 | + if (TYPO3_DLOG) { |
|
247 | 247 | |
248 | - \TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[tx_dlf_search->addFacetsMenu()] Incomplete plugin configuration', $this->extKey, SYSLOG_SEVERITY_WARNING); |
|
248 | + \TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[tx_dlf_search->addFacetsMenu()] Incomplete plugin configuration', $this->extKey, SYSLOG_SEVERITY_WARNING); |
|
249 | 249 | |
250 | - } |
|
250 | + } |
|
251 | 251 | |
252 | - return ''; |
|
252 | + return ''; |
|
253 | 253 | |
254 | - } |
|
254 | + } |
|
255 | 255 | |
256 | - // Quit without doing anything if no facets are selected. |
|
257 | - if (empty($this->conf['facets'])) { |
|
256 | + // Quit without doing anything if no facets are selected. |
|
257 | + if (empty($this->conf['facets'])) { |
|
258 | 258 | |
259 | - return ''; |
|
259 | + return ''; |
|
260 | 260 | |
261 | - } |
|
261 | + } |
|
262 | 262 | |
263 | - // Get facets from plugin configuration. |
|
264 | - $facets = array (); |
|
263 | + // Get facets from plugin configuration. |
|
264 | + $facets = array (); |
|
265 | 265 | |
266 | - foreach (\TYPO3\CMS\Core\Utility\GeneralUtility::trimExplode(',', $this->conf['facets'], TRUE) as $facet) { |
|
266 | + foreach (\TYPO3\CMS\Core\Utility\GeneralUtility::trimExplode(',', $this->conf['facets'], TRUE) as $facet) { |
|
267 | 267 | |
268 | - $facets[$facet.'_faceting'] = tx_dlf_helper::translate($facet, 'tx_dlf_metadata', $this->conf['pages']); |
|
268 | + $facets[$facet.'_faceting'] = tx_dlf_helper::translate($facet, 'tx_dlf_metadata', $this->conf['pages']); |
|
269 | 269 | |
270 | - } |
|
270 | + } |
|
271 | 271 | |
272 | - // Render facets menu. |
|
273 | - $TSconfig = array (); |
|
272 | + // Render facets menu. |
|
273 | + $TSconfig = array (); |
|
274 | 274 | |
275 | - $TSconfig['special'] = 'userfunction'; |
|
275 | + $TSconfig['special'] = 'userfunction'; |
|
276 | 276 | |
277 | - $TSconfig['special.']['userFunc'] = 'tx_dlf_search->makeFacetsMenuArray'; |
|
277 | + $TSconfig['special.']['userFunc'] = 'tx_dlf_search->makeFacetsMenuArray'; |
|
278 | 278 | |
279 | - $TSconfig['special.']['facets'] = $facets; |
|
279 | + $TSconfig['special.']['facets'] = $facets; |
|
280 | 280 | |
281 | - $TSconfig['special.']['limit'] = max(intval($this->conf['limitFacets']), 1); |
|
281 | + $TSconfig['special.']['limit'] = max(intval($this->conf['limitFacets']), 1); |
|
282 | 282 | |
283 | - $TSconfig = tx_dlf_helper::array_merge_recursive_overrule($this->conf['facetsConf.'], $TSconfig); |
|
283 | + $TSconfig = tx_dlf_helper::array_merge_recursive_overrule($this->conf['facetsConf.'], $TSconfig); |
|
284 | 284 | |
285 | - return $this->cObj->HMENU($TSconfig); |
|
285 | + return $this->cObj->HMENU($TSconfig); |
|
286 | 286 | |
287 | - } |
|
287 | + } |
|
288 | 288 | |
289 | - /** |
|
290 | - * Adds the fulltext switch to the search form |
|
291 | - * |
|
292 | - * @access protected |
|
293 | - * |
|
294 | - * @param int $isFulltextSearch |
|
295 | - * |
|
296 | - * @return string HTML output of fulltext switch |
|
297 | - */ |
|
298 | - protected function addFulltextSwitch($isFulltextSearch = 0) { |
|
289 | + /** |
|
290 | + * Adds the fulltext switch to the search form |
|
291 | + * |
|
292 | + * @access protected |
|
293 | + * |
|
294 | + * @param int $isFulltextSearch |
|
295 | + * |
|
296 | + * @return string HTML output of fulltext switch |
|
297 | + */ |
|
298 | + protected function addFulltextSwitch($isFulltextSearch = 0) { |
|
299 | 299 | |
300 | - $output = ''; |
|
300 | + $output = ''; |
|
301 | 301 | |
302 | - // Check for plugin configuration. |
|
303 | - if (!empty($this->conf['fulltext'])) { |
|
302 | + // Check for plugin configuration. |
|
303 | + if (!empty($this->conf['fulltext'])) { |
|
304 | 304 | |
305 | - $output .= ' <input class="tx-dlf-search-fulltext" id="tx-dlf-search-fulltext-no" type="radio" name="'.$this->prefixId.'[fulltext]" value="0" '.($isFulltextSearch == 0 ? 'checked="checked"' : '').' />'; |
|
305 | + $output .= ' <input class="tx-dlf-search-fulltext" id="tx-dlf-search-fulltext-no" type="radio" name="'.$this->prefixId.'[fulltext]" value="0" '.($isFulltextSearch == 0 ? 'checked="checked"' : '').' />'; |
|
306 | 306 | |
307 | - $output .= ' <label for="tx-dlf-search-fulltext-no">'.$this->pi_getLL('label.inMetadata', '').'</label>'; |
|
307 | + $output .= ' <label for="tx-dlf-search-fulltext-no">'.$this->pi_getLL('label.inMetadata', '').'</label>'; |
|
308 | 308 | |
309 | - $output .= ' <input class="tx-dlf-search-fulltext" id="tx-dlf-search-fulltext-yes" type="radio" name="'.$this->prefixId.'[fulltext]" value="1" '.($isFulltextSearch == 1 ? 'checked="checked"' : '').'/>'; |
|
309 | + $output .= ' <input class="tx-dlf-search-fulltext" id="tx-dlf-search-fulltext-yes" type="radio" name="'.$this->prefixId.'[fulltext]" value="1" '.($isFulltextSearch == 1 ? 'checked="checked"' : '').'/>'; |
|
310 | 310 | |
311 | - $output .= ' <label for="tx-dlf-search-fulltext-yes">'.$this->pi_getLL('label.inFulltext', '').'</label>'; |
|
311 | + $output .= ' <label for="tx-dlf-search-fulltext-yes">'.$this->pi_getLL('label.inFulltext', '').'</label>'; |
|
312 | 312 | |
313 | - } |
|
313 | + } |
|
314 | 314 | |
315 | - return $output; |
|
315 | + return $output; |
|
316 | 316 | |
317 | - } |
|
317 | + } |
|
318 | 318 | |
319 | - /** |
|
320 | - * Adds the logical page field to the search form |
|
321 | - * |
|
322 | - * @access protected |
|
323 | - * |
|
324 | - * @return string HTML output of logical page field |
|
325 | - */ |
|
326 | - protected function addLogicalPage() { |
|
319 | + /** |
|
320 | + * Adds the logical page field to the search form |
|
321 | + * |
|
322 | + * @access protected |
|
323 | + * |
|
324 | + * @return string HTML output of logical page field |
|
325 | + */ |
|
326 | + protected function addLogicalPage() { |
|
327 | 327 | |
328 | - $output = ''; |
|
328 | + $output = ''; |
|
329 | 329 | |
330 | - // Check for plugin configuration. |
|
331 | - if (!empty($this->conf['showLogicalPageField'])) { |
|
330 | + // Check for plugin configuration. |
|
331 | + if (!empty($this->conf['showLogicalPageField'])) { |
|
332 | 332 | |
333 | - $output .= ' <label for="tx-dlf-search-logical-page">'.$this->pi_getLL('label.logicalPage', '').': </label>'; |
|
333 | + $output .= ' <label for="tx-dlf-search-logical-page">'.$this->pi_getLL('label.logicalPage', '').': </label>'; |
|
334 | 334 | |
335 | - $output .= ' <input class="tx-dlf-search-logical-page" id="tx-dlf-search-logical-page" type="text" name="'.$this->prefixId.'[logicalPage]" />'; |
|
335 | + $output .= ' <input class="tx-dlf-search-logical-page" id="tx-dlf-search-logical-page" type="text" name="'.$this->prefixId.'[logicalPage]" />'; |
|
336 | 336 | |
337 | - } |
|
337 | + } |
|
338 | 338 | |
339 | - return $output; |
|
339 | + return $output; |
|
340 | 340 | |
341 | - } |
|
341 | + } |
|
342 | 342 | |
343 | - /** |
|
344 | - * Creates an array for a HMENU entry of a facet value. |
|
345 | - * |
|
346 | - * @param string $field: The facet's index_name |
|
347 | - * @param string $value: The facet's value |
|
348 | - * @param integer $count: Number of hits for this facet |
|
349 | - * @param array $search: The parameters of the current search query |
|
350 | - * @param string &$state: The state of the parent item |
|
351 | - * |
|
352 | - * @return array The array for the facet's menu entry |
|
353 | - */ |
|
354 | - protected function getFacetsMenuEntry($field, $value, $count, $search, &$state) { |
|
343 | + /** |
|
344 | + * Creates an array for a HMENU entry of a facet value. |
|
345 | + * |
|
346 | + * @param string $field: The facet's index_name |
|
347 | + * @param string $value: The facet's value |
|
348 | + * @param integer $count: Number of hits for this facet |
|
349 | + * @param array $search: The parameters of the current search query |
|
350 | + * @param string &$state: The state of the parent item |
|
351 | + * |
|
352 | + * @return array The array for the facet's menu entry |
|
353 | + */ |
|
354 | + protected function getFacetsMenuEntry($field, $value, $count, $search, &$state) { |
|
355 | 355 | |
356 | - $entryArray = array (); |
|
356 | + $entryArray = array (); |
|
357 | 357 | |
358 | - // Translate value. |
|
359 | - if ($field == 'owner_faceting') { |
|
358 | + // Translate value. |
|
359 | + if ($field == 'owner_faceting') { |
|
360 | 360 | |
361 | - // Translate name of holding library. |
|
362 | - $entryArray['title'] = htmlspecialchars(tx_dlf_helper::translate($value, 'tx_dlf_libraries', $this->conf['pages'])); |
|
361 | + // Translate name of holding library. |
|
362 | + $entryArray['title'] = htmlspecialchars(tx_dlf_helper::translate($value, 'tx_dlf_libraries', $this->conf['pages'])); |
|
363 | 363 | |
364 | - } elseif ($field == 'type_faceting') { |
|
364 | + } elseif ($field == 'type_faceting') { |
|
365 | 365 | |
366 | - // Translate document type. |
|
367 | - $entryArray['title'] = htmlspecialchars(tx_dlf_helper::translate($value, 'tx_dlf_structures', $this->conf['pages'])); |
|
366 | + // Translate document type. |
|
367 | + $entryArray['title'] = htmlspecialchars(tx_dlf_helper::translate($value, 'tx_dlf_structures', $this->conf['pages'])); |
|
368 | 368 | |
369 | - } elseif ($field == 'collection_faceting') { |
|
369 | + } elseif ($field == 'collection_faceting') { |
|
370 | 370 | |
371 | - // Translate name of collection. |
|
372 | - $entryArray['title'] = htmlspecialchars(tx_dlf_helper::translate($value, 'tx_dlf_collections', $this->conf['pages'])); |
|
371 | + // Translate name of collection. |
|
372 | + $entryArray['title'] = htmlspecialchars(tx_dlf_helper::translate($value, 'tx_dlf_collections', $this->conf['pages'])); |
|
373 | 373 | |
374 | - } elseif ($field == 'language_faceting') { |
|
374 | + } elseif ($field == 'language_faceting') { |
|
375 | 375 | |
376 | - // Translate ISO 639 language code. |
|
377 | - $entryArray['title'] = htmlspecialchars(tx_dlf_helper::getLanguageName($value)); |
|
376 | + // Translate ISO 639 language code. |
|
377 | + $entryArray['title'] = htmlspecialchars(tx_dlf_helper::getLanguageName($value)); |
|
378 | 378 | |
379 | - } else { |
|
379 | + } else { |
|
380 | 380 | |
381 | - $entryArray['title'] = htmlspecialchars($value); |
|
381 | + $entryArray['title'] = htmlspecialchars($value); |
|
382 | 382 | |
383 | - } |
|
383 | + } |
|
384 | 384 | |
385 | - $entryArray['count'] = $count; |
|
385 | + $entryArray['count'] = $count; |
|
386 | 386 | |
387 | - $entryArray['doNotLinkIt'] = 0; |
|
387 | + $entryArray['doNotLinkIt'] = 0; |
|
388 | 388 | |
389 | - // Check if facet is already selected. |
|
390 | - $index = array_search($field.':("'.tx_dlf_solr::escapeQuery($value).'")', $search['params']['fq']); |
|
389 | + // Check if facet is already selected. |
|
390 | + $index = array_search($field.':("'.tx_dlf_solr::escapeQuery($value).'")', $search['params']['fq']); |
|
391 | 391 | |
392 | - if ($index !== FALSE) { |
|
392 | + if ($index !== FALSE) { |
|
393 | 393 | |
394 | - // Facet is selected, thus remove it from filter. |
|
395 | - unset($search['params']['fq'][$index]); |
|
394 | + // Facet is selected, thus remove it from filter. |
|
395 | + unset($search['params']['fq'][$index]); |
|
396 | 396 | |
397 | - $search['params']['fq'] = array_values($search['params']['fq']); |
|
397 | + $search['params']['fq'] = array_values($search['params']['fq']); |
|
398 | 398 | |
399 | - $entryArray['ITEM_STATE'] = 'CUR'; |
|
399 | + $entryArray['ITEM_STATE'] = 'CUR'; |
|
400 | 400 | |
401 | - $state = 'ACTIFSUB'; |
|
401 | + $state = 'ACTIFSUB'; |
|
402 | 402 | |
403 | - //Reset facets |
|
404 | - if ($this->conf['resetFacets']) { |
|
405 | - //remove ($count) for selected facet in template |
|
406 | - $entryArray['count'] = FALSE; |
|
407 | - //build link to delete selected facet |
|
408 | - $entryArray['_OVERRIDE_HREF'] = $this->pi_linkTP_keepPIvars_url(array ('query' => $search['query'], 'fq' => $search['params']['fq'])); |
|
409 | - $entryArray['title'] = sprintf($this->pi_getLL('resetFacet', ''), $entryArray['title']); |
|
410 | - } |
|
403 | + //Reset facets |
|
404 | + if ($this->conf['resetFacets']) { |
|
405 | + //remove ($count) for selected facet in template |
|
406 | + $entryArray['count'] = FALSE; |
|
407 | + //build link to delete selected facet |
|
408 | + $entryArray['_OVERRIDE_HREF'] = $this->pi_linkTP_keepPIvars_url(array ('query' => $search['query'], 'fq' => $search['params']['fq'])); |
|
409 | + $entryArray['title'] = sprintf($this->pi_getLL('resetFacet', ''), $entryArray['title']); |
|
410 | + } |
|
411 | 411 | |
412 | - } else { |
|
412 | + } else { |
|
413 | 413 | |
414 | - // Facet is not selected, thus add it to filter. |
|
415 | - $search['params']['fq'][] = $field.':("'.tx_dlf_solr::escapeQuery($value).'")'; |
|
414 | + // Facet is not selected, thus add it to filter. |
|
415 | + $search['params']['fq'][] = $field.':("'.tx_dlf_solr::escapeQuery($value).'")'; |
|
416 | 416 | |
417 | - $entryArray['ITEM_STATE'] = 'NO'; |
|
417 | + $entryArray['ITEM_STATE'] = 'NO'; |
|
418 | 418 | |
419 | - } |
|
419 | + } |
|
420 | 420 | |
421 | - $entryArray['_OVERRIDE_HREF'] = $this->pi_linkTP_keepPIvars_url(array ('query' => $search['query'], 'fq' => $search['params']['fq'])); |
|
421 | + $entryArray['_OVERRIDE_HREF'] = $this->pi_linkTP_keepPIvars_url(array ('query' => $search['query'], 'fq' => $search['params']['fq'])); |
|
422 | 422 | |
423 | - return $entryArray; |
|
423 | + return $entryArray; |
|
424 | 424 | |
425 | - } |
|
425 | + } |
|
426 | 426 | |
427 | - /** |
|
428 | - * The main method of the PlugIn |
|
429 | - * |
|
430 | - * @access public |
|
431 | - * |
|
432 | - * @param string $content: The PlugIn content |
|
433 | - * @param array $conf: The PlugIn configuration |
|
434 | - * |
|
435 | - * @return string The content that is displayed on the website |
|
436 | - */ |
|
437 | - public function main($content, $conf) { |
|
427 | + /** |
|
428 | + * The main method of the PlugIn |
|
429 | + * |
|
430 | + * @access public |
|
431 | + * |
|
432 | + * @param string $content: The PlugIn content |
|
433 | + * @param array $conf: The PlugIn configuration |
|
434 | + * |
|
435 | + * @return string The content that is displayed on the website |
|
436 | + */ |
|
437 | + public function main($content, $conf) { |
|
438 | 438 | |
439 | - $this->init($conf); |
|
439 | + $this->init($conf); |
|
440 | 440 | |
441 | - // Disable caching for this plugin. |
|
442 | - $this->setCache(FALSE); |
|
441 | + // Disable caching for this plugin. |
|
442 | + $this->setCache(FALSE); |
|
443 | 443 | |
444 | - // Quit without doing anything if required variables are not set. |
|
445 | - if (empty($this->conf['solrcore'])) { |
|
444 | + // Quit without doing anything if required variables are not set. |
|
445 | + if (empty($this->conf['solrcore'])) { |
|
446 | 446 | |
447 | - if (TYPO3_DLOG) { |
|
447 | + if (TYPO3_DLOG) { |
|
448 | 448 | |
449 | - \TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[tx_dlf_search->main('.$content.', [data])] Incomplete plugin configuration', $this->extKey, SYSLOG_SEVERITY_WARNING, $conf); |
|
449 | + \TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[tx_dlf_search->main('.$content.', [data])] Incomplete plugin configuration', $this->extKey, SYSLOG_SEVERITY_WARNING, $conf); |
|
450 | 450 | |
451 | - } |
|
451 | + } |
|
452 | 452 | |
453 | - return $content; |
|
453 | + return $content; |
|
454 | 454 | |
455 | - } |
|
455 | + } |
|
456 | 456 | |
457 | - if (!isset($this->piVars['query']) && empty($this->piVars['extQuery'])) { |
|
457 | + if (!isset($this->piVars['query']) && empty($this->piVars['extQuery'])) { |
|
458 | 458 | |
459 | - // Extract query and filter from last search. |
|
460 | - $list = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('tx_dlf_list'); |
|
459 | + // Extract query and filter from last search. |
|
460 | + $list = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('tx_dlf_list'); |
|
461 | 461 | |
462 | - if (!empty($list->metadata['searchString'])) { |
|
462 | + if (!empty($list->metadata['searchString'])) { |
|
463 | 463 | |
464 | - if ($list->metadata['options']['source'] == 'search') { |
|
464 | + if ($list->metadata['options']['source'] == 'search') { |
|
465 | 465 | |
466 | - $search['query'] = $list->metadata['searchString']; |
|
466 | + $search['query'] = $list->metadata['searchString']; |
|
467 | 467 | |
468 | - } |
|
468 | + } |
|
469 | 469 | |
470 | - $search['params'] = $list->metadata['options']['params']; |
|
470 | + $search['params'] = $list->metadata['options']['params']; |
|
471 | 471 | |
472 | - } |
|
472 | + } |
|
473 | 473 | |
474 | - // Add javascript for search suggestions if enabled and jQuery autocompletion is available. |
|
475 | - if (!empty($this->conf['suggest'])) { |
|
474 | + // Add javascript for search suggestions if enabled and jQuery autocompletion is available. |
|
475 | + if (!empty($this->conf['suggest'])) { |
|
476 | 476 | |
477 | - $this->addAutocompleteJS(); |
|
477 | + $this->addAutocompleteJS(); |
|
478 | 478 | |
479 | - } |
|
479 | + } |
|
480 | 480 | |
481 | - // Load template file. |
|
482 | - if (!empty($this->conf['templateFile'])) { |
|
481 | + // Load template file. |
|
482 | + if (!empty($this->conf['templateFile'])) { |
|
483 | 483 | |
484 | - $this->template = $this->cObj->getSubpart($this->cObj->fileResource($this->conf['templateFile']), '###TEMPLATE###'); |
|
484 | + $this->template = $this->cObj->getSubpart($this->cObj->fileResource($this->conf['templateFile']), '###TEMPLATE###'); |
|
485 | 485 | |
486 | - } else { |
|
486 | + } else { |
|
487 | 487 | |
488 | - $this->template = $this->cObj->getSubpart($this->cObj->fileResource('EXT:dlf/plugins/search/template.tmpl'), '###TEMPLATE###'); |
|
488 | + $this->template = $this->cObj->getSubpart($this->cObj->fileResource('EXT:dlf/plugins/search/template.tmpl'), '###TEMPLATE###'); |
|
489 | 489 | |
490 | - } |
|
490 | + } |
|
491 | 491 | |
492 | - // Configure @action URL for form. |
|
493 | - $linkConf = array ( |
|
494 | - 'parameter' => $GLOBALS['TSFE']->id, |
|
495 | - 'forceAbsoluteUrl' => 1 |
|
496 | - ); |
|
492 | + // Configure @action URL for form. |
|
493 | + $linkConf = array ( |
|
494 | + 'parameter' => $GLOBALS['TSFE']->id, |
|
495 | + 'forceAbsoluteUrl' => 1 |
|
496 | + ); |
|
497 | 497 | |
498 | - // Fill markers. |
|
499 | - $markerArray = array ( |
|
500 | - '###ACTION_URL###' => $this->cObj->typoLink_URL($linkConf), |
|
501 | - '###LABEL_QUERY###' => (!empty($search['query']) ? $search['query'] : $this->pi_getLL('label.query')), |
|
502 | - '###LABEL_SUBMIT###' => $this->pi_getLL('label.submit'), |
|
503 | - '###FIELD_QUERY###' => $this->prefixId.'[query]', |
|
504 | - '###QUERY###' => (!empty($search['query']) ? $search['query'] : ''), |
|
505 | - '###FULLTEXTSWITCH###' => $this->addFulltextSwitch($list->metadata['fulltextSearch']), |
|
506 | - '###FIELD_DOC###' => ($this->conf['searchIn'] == 'document' || $this->conf['searchIn'] == 'all' ? $this->addCurrentDocument() : ''), |
|
507 | - '###FIELD_COLL###' => ($this->conf['searchIn'] == 'collection' || $this->conf['searchIn'] == 'all' ? $this->addCurrentCollection() : ''), |
|
508 | - '###ADDITIONAL_INPUTS###' => $this->addEncryptedCoreName(), |
|
509 | - '###FACETS_MENU###' => $this->addFacetsMenu(), |
|
510 | - '###LOGICAL_PAGE###' => $this->addLogicalPage() |
|
511 | - ); |
|
498 | + // Fill markers. |
|
499 | + $markerArray = array ( |
|
500 | + '###ACTION_URL###' => $this->cObj->typoLink_URL($linkConf), |
|
501 | + '###LABEL_QUERY###' => (!empty($search['query']) ? $search['query'] : $this->pi_getLL('label.query')), |
|
502 | + '###LABEL_SUBMIT###' => $this->pi_getLL('label.submit'), |
|
503 | + '###FIELD_QUERY###' => $this->prefixId.'[query]', |
|
504 | + '###QUERY###' => (!empty($search['query']) ? $search['query'] : ''), |
|
505 | + '###FULLTEXTSWITCH###' => $this->addFulltextSwitch($list->metadata['fulltextSearch']), |
|
506 | + '###FIELD_DOC###' => ($this->conf['searchIn'] == 'document' || $this->conf['searchIn'] == 'all' ? $this->addCurrentDocument() : ''), |
|
507 | + '###FIELD_COLL###' => ($this->conf['searchIn'] == 'collection' || $this->conf['searchIn'] == 'all' ? $this->addCurrentCollection() : ''), |
|
508 | + '###ADDITIONAL_INPUTS###' => $this->addEncryptedCoreName(), |
|
509 | + '###FACETS_MENU###' => $this->addFacetsMenu(), |
|
510 | + '###LOGICAL_PAGE###' => $this->addLogicalPage() |
|
511 | + ); |
|
512 | 512 | |
513 | - // Get additional fields for extended search. |
|
514 | - $extendedSearch = $this->addExtendedSearch(); |
|
513 | + // Get additional fields for extended search. |
|
514 | + $extendedSearch = $this->addExtendedSearch(); |
|
515 | 515 | |
516 | - // Display search form. |
|
517 | - $content .= $this->cObj->substituteSubpart($this->cObj->substituteMarkerArray($this->template, $markerArray), '###EXT_SEARCH_ENTRY###', $extendedSearch); |
|
516 | + // Display search form. |
|
517 | + $content .= $this->cObj->substituteSubpart($this->cObj->substituteMarkerArray($this->template, $markerArray), '###EXT_SEARCH_ENTRY###', $extendedSearch); |
|
518 | 518 | |
519 | - return $this->pi_wrapInBaseClass($content); |
|
519 | + return $this->pi_wrapInBaseClass($content); |
|
520 | 520 | |
521 | - } else { |
|
521 | + } else { |
|
522 | 522 | |
523 | - // Instantiate search object. |
|
524 | - $solr = tx_dlf_solr::getInstance($this->conf['solrcore']); |
|
523 | + // Instantiate search object. |
|
524 | + $solr = tx_dlf_solr::getInstance($this->conf['solrcore']); |
|
525 | 525 | |
526 | - if (!$solr->ready) { |
|
526 | + if (!$solr->ready) { |
|
527 | 527 | |
528 | - if (TYPO3_DLOG) { |
|
528 | + if (TYPO3_DLOG) { |
|
529 | 529 | |
530 | - \TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[tx_dlf_search->main('.$content.', [data])] Apache Solr not available', $this->extKey, SYSLOG_SEVERITY_ERROR, $conf); |
|
530 | + \TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[tx_dlf_search->main('.$content.', [data])] Apache Solr not available', $this->extKey, SYSLOG_SEVERITY_ERROR, $conf); |
|
531 | 531 | |
532 | - } |
|
532 | + } |
|
533 | 533 | |
534 | - return $content; |
|
534 | + return $content; |
|
535 | 535 | |
536 | - } |
|
536 | + } |
|
537 | 537 | |
538 | - // Build label for result list. |
|
539 | - $label = $this->pi_getLL('search', '', TRUE); |
|
538 | + // Build label for result list. |
|
539 | + $label = $this->pi_getLL('search', '', TRUE); |
|
540 | 540 | |
541 | - if (!empty($this->piVars['query'])) { |
|
541 | + if (!empty($this->piVars['query'])) { |
|
542 | 542 | |
543 | - $label .= htmlspecialchars(sprintf($this->pi_getLL('for', ''), $this->piVars['query'])); |
|
543 | + $label .= htmlspecialchars(sprintf($this->pi_getLL('for', ''), $this->piVars['query'])); |
|
544 | 544 | |
545 | - } |
|
545 | + } |
|
546 | 546 | |
547 | - // Prepare query parameters. |
|
548 | - $params = array (); |
|
547 | + // Prepare query parameters. |
|
548 | + $params = array (); |
|
549 | 549 | |
550 | - $matches = array (); |
|
550 | + $matches = array (); |
|
551 | 551 | |
552 | - // Set search query. |
|
553 | - if ((!empty($this->conf['fulltext']) && !empty($this->piVars['fulltext'])) || preg_match('/fulltext:\((.*)\)/', $this->piVars['query'], $matches)) { |
|
552 | + // Set search query. |
|
553 | + if ((!empty($this->conf['fulltext']) && !empty($this->piVars['fulltext'])) || preg_match('/fulltext:\((.*)\)/', $this->piVars['query'], $matches)) { |
|
554 | 554 | |
555 | - // If the query already is a fulltext query e.g using the facets |
|
556 | - $this->piVars['query'] = empty($matches[1]) ? $this->piVars['query'] : $matches[1]; |
|
555 | + // If the query already is a fulltext query e.g using the facets |
|
556 | + $this->piVars['query'] = empty($matches[1]) ? $this->piVars['query'] : $matches[1]; |
|
557 | 557 | |
558 | - // Search in fulltext field if applicable. query must not be empty! |
|
559 | - if (!empty($this->piVars['query'])) { |
|
558 | + // Search in fulltext field if applicable. query must not be empty! |
|
559 | + if (!empty($this->piVars['query'])) { |
|
560 | 560 | |
561 | - $query = 'fulltext:('.tx_dlf_solr::escapeQuery($this->piVars['query']).')'; |
|
561 | + $query = 'fulltext:('.tx_dlf_solr::escapeQuery($this->piVars['query']).')'; |
|
562 | 562 | |
563 | - } |
|
563 | + } |
|
564 | 564 | |
565 | - // Add highlighting for fulltext. |
|
566 | - $params['hl'] = 'true'; |
|
565 | + // Add highlighting for fulltext. |
|
566 | + $params['hl'] = 'true'; |
|
567 | 567 | |
568 | - $params['hl.fl'] = 'fulltext'; |
|
568 | + $params['hl.fl'] = 'fulltext'; |
|
569 | 569 | |
570 | - } else { |
|
571 | - // Retain given search field if valid. |
|
572 | - $query = tx_dlf_solr::escapeQueryKeepField($this->piVars['query'], $this->conf['pages']); |
|
570 | + } else { |
|
571 | + // Retain given search field if valid. |
|
572 | + $query = tx_dlf_solr::escapeQueryKeepField($this->piVars['query'], $this->conf['pages']); |
|
573 | 573 | |
574 | - } |
|
574 | + } |
|
575 | 575 | |
576 | - // Add extended search query. |
|
577 | - if (!empty($this->piVars['extQuery']) && is_array($this->piVars['extQuery'])) { |
|
576 | + // Add extended search query. |
|
577 | + if (!empty($this->piVars['extQuery']) && is_array($this->piVars['extQuery'])) { |
|
578 | 578 | |
579 | - $allowedOperators = array ('AND', 'OR', 'NOT'); |
|
579 | + $allowedOperators = array ('AND', 'OR', 'NOT'); |
|
580 | 580 | |
581 | - $allowedFields = \TYPO3\CMS\Core\Utility\GeneralUtility::trimExplode(',', $this->conf['extendedFields'], TRUE); |
|
581 | + $allowedFields = \TYPO3\CMS\Core\Utility\GeneralUtility::trimExplode(',', $this->conf['extendedFields'], TRUE); |
|
582 | 582 | |
583 | - for ($i = 0; $i < count($this->piVars['extQuery']); $i++) { |
|
583 | + for ($i = 0; $i < count($this->piVars['extQuery']); $i++) { |
|
584 | 584 | |
585 | - if (!empty($this->piVars['extQuery'][$i])) { |
|
585 | + if (!empty($this->piVars['extQuery'][$i])) { |
|
586 | 586 | |
587 | - if (in_array($this->piVars['extOperator'][$i], $allowedOperators) && in_array($this->piVars['extField'][$i], $allowedFields)) { |
|
587 | + if (in_array($this->piVars['extOperator'][$i], $allowedOperators) && in_array($this->piVars['extField'][$i], $allowedFields)) { |
|
588 | 588 | |
589 | - if (!empty($query)) { |
|
589 | + if (!empty($query)) { |
|
590 | 590 | |
591 | - $query .= ' '.$this->piVars['extOperator'][$i].' '; |
|
591 | + $query .= ' '.$this->piVars['extOperator'][$i].' '; |
|
592 | 592 | |
593 | - } |
|
593 | + } |
|
594 | 594 | |
595 | - $query .= tx_dlf_indexing::getIndexFieldName($this->piVars['extField'][$i], $this->conf['pages']).':('.tx_dlf_solr::escapeQuery($this->piVars['extQuery'][$i]).')'; |
|
595 | + $query .= tx_dlf_indexing::getIndexFieldName($this->piVars['extField'][$i], $this->conf['pages']).':('.tx_dlf_solr::escapeQuery($this->piVars['extQuery'][$i]).')'; |
|
596 | 596 | |
597 | - } |
|
597 | + } |
|
598 | 598 | |
599 | - } |
|
599 | + } |
|
600 | 600 | |
601 | - } |
|
601 | + } |
|
602 | 602 | |
603 | - } |
|
603 | + } |
|
604 | 604 | |
605 | - // Add filter query for faceting. |
|
606 | - if (!empty($this->piVars['fq'])) { |
|
605 | + // Add filter query for faceting. |
|
606 | + if (!empty($this->piVars['fq'])) { |
|
607 | 607 | |
608 | - $params['fq'] = $this->piVars['fq']; |
|
608 | + $params['fq'] = $this->piVars['fq']; |
|
609 | 609 | |
610 | - } |
|
610 | + } |
|
611 | 611 | |
612 | - // Add filter query for in-document searching. |
|
613 | - if ($this->conf['searchIn'] == 'document' || $this->conf['searchIn'] == 'all') { |
|
612 | + // Add filter query for in-document searching. |
|
613 | + if ($this->conf['searchIn'] == 'document' || $this->conf['searchIn'] == 'all') { |
|
614 | 614 | |
615 | - if (!empty($this->piVars['id']) && \TYPO3\CMS\Core\Utility\MathUtility::canBeInterpretedAsInteger($this->piVars['id'])) { |
|
615 | + if (!empty($this->piVars['id']) && \TYPO3\CMS\Core\Utility\MathUtility::canBeInterpretedAsInteger($this->piVars['id'])) { |
|
616 | 616 | |
617 | - $params['fq'][] = 'uid:('.$this->piVars['id'].') OR partof:('.$this->piVars['id'].')'; |
|
617 | + $params['fq'][] = 'uid:('.$this->piVars['id'].') OR partof:('.$this->piVars['id'].')'; |
|
618 | 618 | |
619 | - $label .= htmlspecialchars(sprintf($this->pi_getLL('in', ''), tx_dlf_document::getTitle($this->piVars['id']))); |
|
619 | + $label .= htmlspecialchars(sprintf($this->pi_getLL('in', ''), tx_dlf_document::getTitle($this->piVars['id']))); |
|
620 | 620 | |
621 | - } |
|
621 | + } |
|
622 | 622 | |
623 | - } |
|
623 | + } |
|
624 | 624 | |
625 | - // Add filter query for in-collection searching. |
|
626 | - if ($this->conf['searchIn'] == 'collection' || $this->conf['searchIn'] == 'all') { |
|
625 | + // Add filter query for in-collection searching. |
|
626 | + if ($this->conf['searchIn'] == 'collection' || $this->conf['searchIn'] == 'all') { |
|
627 | 627 | |
628 | - if (!empty($this->piVars['collection']) && \TYPO3\CMS\Core\Utility\MathUtility::canBeInterpretedAsInteger($this->piVars['collection'])) { |
|
628 | + if (!empty($this->piVars['collection']) && \TYPO3\CMS\Core\Utility\MathUtility::canBeInterpretedAsInteger($this->piVars['collection'])) { |
|
629 | 629 | |
630 | - $index_name = tx_dlf_helper::getIndexName($this->piVars['collection'], 'tx_dlf_collections', $this->conf['pages']); |
|
630 | + $index_name = tx_dlf_helper::getIndexName($this->piVars['collection'], 'tx_dlf_collections', $this->conf['pages']); |
|
631 | 631 | |
632 | - $params['fq'][] = 'collection_faceting:("'.tx_dlf_solr::escapeQuery($index_name).'")'; |
|
632 | + $params['fq'][] = 'collection_faceting:("'.tx_dlf_solr::escapeQuery($index_name).'")'; |
|
633 | 633 | |
634 | - $label .= sprintf($this->pi_getLL('in', '', TRUE), tx_dlf_helper::translate($index_name, 'tx_dlf_collections', $this->conf['pages'])); |
|
634 | + $label .= sprintf($this->pi_getLL('in', '', TRUE), tx_dlf_helper::translate($index_name, 'tx_dlf_collections', $this->conf['pages'])); |
|
635 | 635 | |
636 | - } |
|
636 | + } |
|
637 | 637 | |
638 | - } |
|
638 | + } |
|
639 | 639 | |
640 | - // Add filter query for collection restrictions. |
|
641 | - if ($this->conf['collections']) { |
|
640 | + // Add filter query for collection restrictions. |
|
641 | + if ($this->conf['collections']) { |
|
642 | 642 | |
643 | - $collIds = explode(',', $this->conf['collections']); |
|
643 | + $collIds = explode(',', $this->conf['collections']); |
|
644 | 644 | |
645 | - $collIndexNames = array (); |
|
645 | + $collIndexNames = array (); |
|
646 | 646 | |
647 | - foreach ($collIds as $collId) { |
|
647 | + foreach ($collIds as $collId) { |
|
648 | 648 | |
649 | - $collIndexNames[] = tx_dlf_solr::escapeQuery(tx_dlf_helper::getIndexName(intval($collId), 'tx_dlf_collections', $this->conf['pages'])); |
|
649 | + $collIndexNames[] = tx_dlf_solr::escapeQuery(tx_dlf_helper::getIndexName(intval($collId), 'tx_dlf_collections', $this->conf['pages'])); |
|
650 | 650 | |
651 | - } |
|
651 | + } |
|
652 | 652 | |
653 | - // Last value is fake and used for distinction in $this->addCurrentCollection() |
|
654 | - $params['fq'][] = 'collection_faceting:("'.implode('" OR "', $collIndexNames).'" OR "FakeValueForDistinction")'; |
|
653 | + // Last value is fake and used for distinction in $this->addCurrentCollection() |
|
654 | + $params['fq'][] = 'collection_faceting:("'.implode('" OR "', $collIndexNames).'" OR "FakeValueForDistinction")'; |
|
655 | 655 | |
656 | - } |
|
656 | + } |
|
657 | 657 | |
658 | - // Set search parameters. |
|
659 | - $solr->limit = max(intval($this->conf['limit']), 1); |
|
658 | + // Set search parameters. |
|
659 | + $solr->limit = max(intval($this->conf['limit']), 1); |
|
660 | 660 | |
661 | - $solr->cPid = $this->conf['pages']; |
|
661 | + $solr->cPid = $this->conf['pages']; |
|
662 | 662 | |
663 | - $solr->params = $params; |
|
663 | + $solr->params = $params; |
|
664 | 664 | |
665 | - // Perform search. |
|
666 | - $results = $solr->search($query); |
|
665 | + // Perform search. |
|
666 | + $results = $solr->search($query); |
|
667 | 667 | |
668 | - $results->metadata = array ( |
|
669 | - 'label' => $label, |
|
670 | - 'description' => '<p class="tx-dlf-search-numHits">'.htmlspecialchars(sprintf($this->pi_getLL('hits', ''), $solr->numberOfHits, count($results))).'</p>', |
|
671 | - 'thumbnail' => '', |
|
672 | - 'searchString' => $this->piVars['query'], |
|
673 | - 'fulltextSearch' => (!empty($this->piVars['fulltext']) ? '1' : '0'), |
|
674 | - 'options' => $results->metadata['options'] |
|
675 | - ); |
|
668 | + $results->metadata = array ( |
|
669 | + 'label' => $label, |
|
670 | + 'description' => '<p class="tx-dlf-search-numHits">'.htmlspecialchars(sprintf($this->pi_getLL('hits', ''), $solr->numberOfHits, count($results))).'</p>', |
|
671 | + 'thumbnail' => '', |
|
672 | + 'searchString' => $this->piVars['query'], |
|
673 | + 'fulltextSearch' => (!empty($this->piVars['fulltext']) ? '1' : '0'), |
|
674 | + 'options' => $results->metadata['options'] |
|
675 | + ); |
|
676 | 676 | |
677 | - $results->save(); |
|
677 | + $results->save(); |
|
678 | 678 | |
679 | - // Clean output buffer. |
|
680 | - \TYPO3\CMS\Core\Utility\GeneralUtility::cleanOutputBuffers(); |
|
679 | + // Clean output buffer. |
|
680 | + \TYPO3\CMS\Core\Utility\GeneralUtility::cleanOutputBuffers(); |
|
681 | 681 | |
682 | - $additionalParams = array (); |
|
682 | + $additionalParams = array (); |
|
683 | 683 | |
684 | - if (!empty($this->piVars['logicalPage'])) { |
|
684 | + if (!empty($this->piVars['logicalPage'])) { |
|
685 | 685 | |
686 | - $additionalParams['logicalPage'] = $this->piVars['logicalPage']; |
|
686 | + $additionalParams['logicalPage'] = $this->piVars['logicalPage']; |
|
687 | 687 | |
688 | - } |
|
688 | + } |
|
689 | 689 | |
690 | - // Jump directly to the page view, if there is only one result and it is configured |
|
691 | - if ($results->count() == 1 && !empty($this->conf['showSingleResult'])) { |
|
690 | + // Jump directly to the page view, if there is only one result and it is configured |
|
691 | + if ($results->count() == 1 && !empty($this->conf['showSingleResult'])) { |
|
692 | 692 | |
693 | - $linkConf['parameter'] = $this->conf['targetPidPageView']; |
|
693 | + $linkConf['parameter'] = $this->conf['targetPidPageView']; |
|
694 | 694 | |
695 | - $additionalParams['id'] = $results->current()['uid']; |
|
696 | - $additionalParams['highlight_word'] = preg_replace('/\s\s+/', ';', $results->metadata['searchString']); |
|
697 | - $additionalParams['page'] = count($results[0]['subparts']) == 1 ? $results[0]['subparts'][0]['page'] : 1; |
|
695 | + $additionalParams['id'] = $results->current()['uid']; |
|
696 | + $additionalParams['highlight_word'] = preg_replace('/\s\s+/', ';', $results->metadata['searchString']); |
|
697 | + $additionalParams['page'] = count($results[0]['subparts']) == 1 ? $results[0]['subparts'][0]['page'] : 1; |
|
698 | 698 | |
699 | - } else { |
|
699 | + } else { |
|
700 | 700 | |
701 | - // Keep some plugin variables. |
|
702 | - $linkConf['parameter'] = $this->conf['targetPid']; |
|
701 | + // Keep some plugin variables. |
|
702 | + $linkConf['parameter'] = $this->conf['targetPid']; |
|
703 | 703 | |
704 | - if (!empty($this->piVars['order'])) { |
|
704 | + if (!empty($this->piVars['order'])) { |
|
705 | 705 | |
706 | - $additionalParams['order'] = $this->piVars['order']; |
|
707 | - $additionalParams['asc'] = !empty($this->piVars['asc']) ? '1' : '0'; |
|
706 | + $additionalParams['order'] = $this->piVars['order']; |
|
707 | + $additionalParams['asc'] = !empty($this->piVars['asc']) ? '1' : '0'; |
|
708 | 708 | |
709 | - } |
|
709 | + } |
|
710 | 710 | |
711 | - } |
|
711 | + } |
|
712 | 712 | |
713 | - $linkConf['additionalParams'] = \TYPO3\CMS\Core\Utility\GeneralUtility::implodeArrayForUrl($this->prefixId, $additionalParams, '', TRUE, FALSE); |
|
713 | + $linkConf['additionalParams'] = \TYPO3\CMS\Core\Utility\GeneralUtility::implodeArrayForUrl($this->prefixId, $additionalParams, '', TRUE, FALSE); |
|
714 | 714 | |
715 | - // Send headers. |
|
716 | - header('Location: '.\TYPO3\CMS\Core\Utility\GeneralUtility::locationHeaderUrl($this->cObj->typoLink_URL($linkConf))); |
|
715 | + // Send headers. |
|
716 | + header('Location: '.\TYPO3\CMS\Core\Utility\GeneralUtility::locationHeaderUrl($this->cObj->typoLink_URL($linkConf))); |
|
717 | 717 | |
718 | - // Flush output buffer and end script processing. |
|
719 | - ob_end_flush(); |
|
718 | + // Flush output buffer and end script processing. |
|
719 | + ob_end_flush(); |
|
720 | 720 | |
721 | - exit; |
|
721 | + exit; |
|
722 | 722 | |
723 | - } |
|
723 | + } |
|
724 | 724 | |
725 | - } |
|
725 | + } |
|
726 | 726 | |
727 | - /** |
|
728 | - * This builds a menu array for HMENU |
|
729 | - * |
|
730 | - * @access public |
|
731 | - * |
|
732 | - * @param string $content: The PlugIn content |
|
733 | - * @param array $conf: The PlugIn configuration |
|
734 | - * |
|
735 | - * @return array HMENU array |
|
736 | - */ |
|
737 | - public function makeFacetsMenuArray($content, $conf) { |
|
727 | + /** |
|
728 | + * This builds a menu array for HMENU |
|
729 | + * |
|
730 | + * @access public |
|
731 | + * |
|
732 | + * @param string $content: The PlugIn content |
|
733 | + * @param array $conf: The PlugIn configuration |
|
734 | + * |
|
735 | + * @return array HMENU array |
|
736 | + */ |
|
737 | + public function makeFacetsMenuArray($content, $conf) { |
|
738 | 738 | |
739 | - $this->init($conf); |
|
739 | + $this->init($conf); |
|
740 | 740 | |
741 | - $menuArray = array (); |
|
741 | + $menuArray = array (); |
|
742 | 742 | |
743 | - // Set default value for facet search. |
|
744 | - $search = array ( |
|
745 | - 'query' => '*', |
|
746 | - 'params' => array () |
|
747 | - ); |
|
743 | + // Set default value for facet search. |
|
744 | + $search = array ( |
|
745 | + 'query' => '*', |
|
746 | + 'params' => array () |
|
747 | + ); |
|
748 | 748 | |
749 | - // Extract query and filter from last search. |
|
750 | - $list = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('tx_dlf_list'); |
|
749 | + // Extract query and filter from last search. |
|
750 | + $list = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('tx_dlf_list'); |
|
751 | 751 | |
752 | - if (!empty($list->metadata['options']['source'])) { |
|
752 | + if (!empty($list->metadata['options']['source'])) { |
|
753 | 753 | |
754 | - if ($list->metadata['options']['source'] == 'search') { |
|
754 | + if ($list->metadata['options']['source'] == 'search') { |
|
755 | 755 | |
756 | - $search['query'] = $list->metadata['options']['select']; |
|
756 | + $search['query'] = $list->metadata['options']['select']; |
|
757 | 757 | |
758 | - } |
|
758 | + } |
|
759 | 759 | |
760 | - $search['params'] = $list->metadata['options']['params']; |
|
760 | + $search['params'] = $list->metadata['options']['params']; |
|
761 | 761 | |
762 | - } |
|
762 | + } |
|
763 | 763 | |
764 | - // Get applicable facets. |
|
765 | - $solr = tx_dlf_solr::getInstance($this->conf['solrcore']); |
|
764 | + // Get applicable facets. |
|
765 | + $solr = tx_dlf_solr::getInstance($this->conf['solrcore']); |
|
766 | 766 | |
767 | - if (!$solr->ready) { |
|
767 | + if (!$solr->ready) { |
|
768 | 768 | |
769 | - if (TYPO3_DLOG) { |
|
769 | + if (TYPO3_DLOG) { |
|
770 | 770 | |
771 | - \TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[tx_dlf_search->makeFacetsMenuArray('.$content.', [data])] Apache Solr not available', $this->extKey, SYSLOG_SEVERITY_ERROR, $conf); |
|
771 | + \TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[tx_dlf_search->makeFacetsMenuArray('.$content.', [data])] Apache Solr not available', $this->extKey, SYSLOG_SEVERITY_ERROR, $conf); |
|
772 | 772 | |
773 | - } |
|
773 | + } |
|
774 | 774 | |
775 | - return array (); |
|
775 | + return array (); |
|
776 | 776 | |
777 | - } |
|
777 | + } |
|
778 | 778 | |
779 | - // Set needed parameters for facet search. |
|
780 | - if (empty($search['params']['fq'])) { |
|
779 | + // Set needed parameters for facet search. |
|
780 | + if (empty($search['params']['fq'])) { |
|
781 | 781 | |
782 | - $search['params']['fq'] = array (); |
|
782 | + $search['params']['fq'] = array (); |
|
783 | 783 | |
784 | - } |
|
784 | + } |
|
785 | 785 | |
786 | - $search['params']['facet'] = 'true'; |
|
786 | + $search['params']['facet'] = 'true'; |
|
787 | 787 | |
788 | - $search['params']['facet.field'] = array_keys($this->conf['facets']); |
|
788 | + $search['params']['facet.field'] = array_keys($this->conf['facets']); |
|
789 | 789 | |
790 | - //override SOLR default value for facet.limit of 100 |
|
791 | - $search['params']['facet.limit'] = $this->conf['limitFacets']; |
|
790 | + //override SOLR default value for facet.limit of 100 |
|
791 | + $search['params']['facet.limit'] = $this->conf['limitFacets']; |
|
792 | 792 | |
793 | - // Perform search. |
|
794 | - $results = $solr->service->search($search['query'], 0, $this->conf['limit'], $search['params']); |
|
793 | + // Perform search. |
|
794 | + $results = $solr->service->search($search['query'], 0, $this->conf['limit'], $search['params']); |
|
795 | 795 | |
796 | - // Process results. |
|
797 | - foreach ($results->facet_counts->facet_fields as $field => $values) { |
|
796 | + // Process results. |
|
797 | + foreach ($results->facet_counts->facet_fields as $field => $values) { |
|
798 | 798 | |
799 | - $entryArray = array (); |
|
799 | + $entryArray = array (); |
|
800 | 800 | |
801 | - $entryArray['title'] = htmlspecialchars($this->conf['facets'][$field]); |
|
801 | + $entryArray['title'] = htmlspecialchars($this->conf['facets'][$field]); |
|
802 | 802 | |
803 | - $entryArray['count'] = 0; |
|
803 | + $entryArray['count'] = 0; |
|
804 | 804 | |
805 | - $entryArray['_OVERRIDE_HREF'] = ''; |
|
805 | + $entryArray['_OVERRIDE_HREF'] = ''; |
|
806 | 806 | |
807 | - $entryArray['doNotLinkIt'] = 1; |
|
807 | + $entryArray['doNotLinkIt'] = 1; |
|
808 | 808 | |
809 | - $entryArray['ITEM_STATE'] = 'NO'; |
|
809 | + $entryArray['ITEM_STATE'] = 'NO'; |
|
810 | 810 | |
811 | - // Count number of facet values. |
|
812 | - $i = 0; |
|
811 | + // Count number of facet values. |
|
812 | + $i = 0; |
|
813 | 813 | |
814 | - foreach ($values as $value => $count) { |
|
814 | + foreach ($values as $value => $count) { |
|
815 | 815 | |
816 | - if ($count > 0) { |
|
816 | + if ($count > 0) { |
|
817 | 817 | |
818 | - $hasValue = TRUE; |
|
818 | + $hasValue = TRUE; |
|
819 | 819 | |
820 | - $entryArray['count']++; |
|
820 | + $entryArray['count']++; |
|
821 | 821 | |
822 | - if ($entryArray['ITEM_STATE'] == 'NO') { |
|
822 | + if ($entryArray['ITEM_STATE'] == 'NO') { |
|
823 | 823 | |
824 | - $entryArray['ITEM_STATE'] = 'IFSUB'; |
|
824 | + $entryArray['ITEM_STATE'] = 'IFSUB'; |
|
825 | 825 | |
826 | - } |
|
826 | + } |
|
827 | 827 | |
828 | - $entryArray['_SUB_MENU'][] = $this->getFacetsMenuEntry($field, $value, $count, $search, $entryArray['ITEM_STATE']); |
|
828 | + $entryArray['_SUB_MENU'][] = $this->getFacetsMenuEntry($field, $value, $count, $search, $entryArray['ITEM_STATE']); |
|
829 | 829 | |
830 | - if (++$i == $this->conf['limit']) { |
|
830 | + if (++$i == $this->conf['limit']) { |
|
831 | 831 | |
832 | - break; |
|
832 | + break; |
|
833 | 833 | |
834 | - } |
|
834 | + } |
|
835 | 835 | |
836 | - } else { |
|
836 | + } else { |
|
837 | 837 | |
838 | - break; |
|
838 | + break; |
|
839 | 839 | |
840 | - } |
|
840 | + } |
|
841 | 841 | |
842 | - } |
|
842 | + } |
|
843 | 843 | |
844 | - $menuArray[] = $entryArray; |
|
844 | + $menuArray[] = $entryArray; |
|
845 | 845 | |
846 | - } |
|
846 | + } |
|
847 | 847 | |
848 | - return $menuArray; |
|
848 | + return $menuArray; |
|
849 | 849 | |
850 | 850 | |
851 | - } |
|
851 | + } |
|
852 | 852 | |
853 | 853 | } |
@@ -198,7 +198,7 @@ discard block |
||
198 | 198 | // Get operator options. |
199 | 199 | $operatorOptions = ''; |
200 | 200 | |
201 | - foreach (array ('AND', 'OR', 'NOT') as $operator) { |
|
201 | + foreach (array('AND', 'OR', 'NOT') as $operator) { |
|
202 | 202 | |
203 | 203 | $operatorOptions .= '<option class="tx-dlf-search-operator-option tx-dlf-search-operator-'.$operator.'" value="'.$operator.'">'.$this->pi_getLL($operator, '', TRUE).'</option>'; |
204 | 204 | |
@@ -217,7 +217,7 @@ discard block |
||
217 | 217 | |
218 | 218 | for ($i = 0; $i < $this->conf['extendedSlotCount']; $i++) { |
219 | 219 | |
220 | - $markerArray = array ( |
|
220 | + $markerArray = array( |
|
221 | 221 | '###EXT_SEARCH_OPERATOR###' => '<select class="tx-dlf-search-operator tx-dlf-search-operator-'.$i.'" name="'.$this->prefixId.'[extOperator]['.$i.']">'.$operatorOptions.'</select>', |
222 | 222 | '###EXT_SEARCH_FIELDSELECTOR###' => '<select class="tx-dlf-search-field tx-dlf-search-field-'.$i.'" name="'.$this->prefixId.'[extField]['.$i.']">'.$fieldSelectorOptions.'</select>', |
223 | 223 | '###EXT_SEARCH_FIELDQUERY###' => '<input class="tx-dlf-search-query tx-dlf-search-query-'.$i.'" type="text" name="'.$this->prefixId.'[extQuery]['.$i.']" />' |
@@ -261,7 +261,7 @@ discard block |
||
261 | 261 | } |
262 | 262 | |
263 | 263 | // Get facets from plugin configuration. |
264 | - $facets = array (); |
|
264 | + $facets = array(); |
|
265 | 265 | |
266 | 266 | foreach (\TYPO3\CMS\Core\Utility\GeneralUtility::trimExplode(',', $this->conf['facets'], TRUE) as $facet) { |
267 | 267 | |
@@ -270,7 +270,7 @@ discard block |
||
270 | 270 | } |
271 | 271 | |
272 | 272 | // Render facets menu. |
273 | - $TSconfig = array (); |
|
273 | + $TSconfig = array(); |
|
274 | 274 | |
275 | 275 | $TSconfig['special'] = 'userfunction'; |
276 | 276 | |
@@ -353,7 +353,7 @@ discard block |
||
353 | 353 | */ |
354 | 354 | protected function getFacetsMenuEntry($field, $value, $count, $search, &$state) { |
355 | 355 | |
356 | - $entryArray = array (); |
|
356 | + $entryArray = array(); |
|
357 | 357 | |
358 | 358 | // Translate value. |
359 | 359 | if ($field == 'owner_faceting') { |
@@ -405,7 +405,7 @@ discard block |
||
405 | 405 | //remove ($count) for selected facet in template |
406 | 406 | $entryArray['count'] = FALSE; |
407 | 407 | //build link to delete selected facet |
408 | - $entryArray['_OVERRIDE_HREF'] = $this->pi_linkTP_keepPIvars_url(array ('query' => $search['query'], 'fq' => $search['params']['fq'])); |
|
408 | + $entryArray['_OVERRIDE_HREF'] = $this->pi_linkTP_keepPIvars_url(array('query' => $search['query'], 'fq' => $search['params']['fq'])); |
|
409 | 409 | $entryArray['title'] = sprintf($this->pi_getLL('resetFacet', ''), $entryArray['title']); |
410 | 410 | } |
411 | 411 | |
@@ -418,7 +418,7 @@ discard block |
||
418 | 418 | |
419 | 419 | } |
420 | 420 | |
421 | - $entryArray['_OVERRIDE_HREF'] = $this->pi_linkTP_keepPIvars_url(array ('query' => $search['query'], 'fq' => $search['params']['fq'])); |
|
421 | + $entryArray['_OVERRIDE_HREF'] = $this->pi_linkTP_keepPIvars_url(array('query' => $search['query'], 'fq' => $search['params']['fq'])); |
|
422 | 422 | |
423 | 423 | return $entryArray; |
424 | 424 | |
@@ -490,13 +490,13 @@ discard block |
||
490 | 490 | } |
491 | 491 | |
492 | 492 | // Configure @action URL for form. |
493 | - $linkConf = array ( |
|
493 | + $linkConf = array( |
|
494 | 494 | 'parameter' => $GLOBALS['TSFE']->id, |
495 | 495 | 'forceAbsoluteUrl' => 1 |
496 | 496 | ); |
497 | 497 | |
498 | 498 | // Fill markers. |
499 | - $markerArray = array ( |
|
499 | + $markerArray = array( |
|
500 | 500 | '###ACTION_URL###' => $this->cObj->typoLink_URL($linkConf), |
501 | 501 | '###LABEL_QUERY###' => (!empty($search['query']) ? $search['query'] : $this->pi_getLL('label.query')), |
502 | 502 | '###LABEL_SUBMIT###' => $this->pi_getLL('label.submit'), |
@@ -545,9 +545,9 @@ discard block |
||
545 | 545 | } |
546 | 546 | |
547 | 547 | // Prepare query parameters. |
548 | - $params = array (); |
|
548 | + $params = array(); |
|
549 | 549 | |
550 | - $matches = array (); |
|
550 | + $matches = array(); |
|
551 | 551 | |
552 | 552 | // Set search query. |
553 | 553 | if ((!empty($this->conf['fulltext']) && !empty($this->piVars['fulltext'])) || preg_match('/fulltext:\((.*)\)/', $this->piVars['query'], $matches)) { |
@@ -576,7 +576,7 @@ discard block |
||
576 | 576 | // Add extended search query. |
577 | 577 | if (!empty($this->piVars['extQuery']) && is_array($this->piVars['extQuery'])) { |
578 | 578 | |
579 | - $allowedOperators = array ('AND', 'OR', 'NOT'); |
|
579 | + $allowedOperators = array('AND', 'OR', 'NOT'); |
|
580 | 580 | |
581 | 581 | $allowedFields = \TYPO3\CMS\Core\Utility\GeneralUtility::trimExplode(',', $this->conf['extendedFields'], TRUE); |
582 | 582 | |
@@ -642,7 +642,7 @@ discard block |
||
642 | 642 | |
643 | 643 | $collIds = explode(',', $this->conf['collections']); |
644 | 644 | |
645 | - $collIndexNames = array (); |
|
645 | + $collIndexNames = array(); |
|
646 | 646 | |
647 | 647 | foreach ($collIds as $collId) { |
648 | 648 | |
@@ -665,7 +665,7 @@ discard block |
||
665 | 665 | // Perform search. |
666 | 666 | $results = $solr->search($query); |
667 | 667 | |
668 | - $results->metadata = array ( |
|
668 | + $results->metadata = array( |
|
669 | 669 | 'label' => $label, |
670 | 670 | 'description' => '<p class="tx-dlf-search-numHits">'.htmlspecialchars(sprintf($this->pi_getLL('hits', ''), $solr->numberOfHits, count($results))).'</p>', |
671 | 671 | 'thumbnail' => '', |
@@ -679,7 +679,7 @@ discard block |
||
679 | 679 | // Clean output buffer. |
680 | 680 | \TYPO3\CMS\Core\Utility\GeneralUtility::cleanOutputBuffers(); |
681 | 681 | |
682 | - $additionalParams = array (); |
|
682 | + $additionalParams = array(); |
|
683 | 683 | |
684 | 684 | if (!empty($this->piVars['logicalPage'])) { |
685 | 685 | |
@@ -738,12 +738,12 @@ discard block |
||
738 | 738 | |
739 | 739 | $this->init($conf); |
740 | 740 | |
741 | - $menuArray = array (); |
|
741 | + $menuArray = array(); |
|
742 | 742 | |
743 | 743 | // Set default value for facet search. |
744 | - $search = array ( |
|
744 | + $search = array( |
|
745 | 745 | 'query' => '*', |
746 | - 'params' => array () |
|
746 | + 'params' => array() |
|
747 | 747 | ); |
748 | 748 | |
749 | 749 | // Extract query and filter from last search. |
@@ -772,14 +772,14 @@ discard block |
||
772 | 772 | |
773 | 773 | } |
774 | 774 | |
775 | - return array (); |
|
775 | + return array(); |
|
776 | 776 | |
777 | 777 | } |
778 | 778 | |
779 | 779 | // Set needed parameters for facet search. |
780 | 780 | if (empty($search['params']['fq'])) { |
781 | 781 | |
782 | - $search['params']['fq'] = array (); |
|
782 | + $search['params']['fq'] = array(); |
|
783 | 783 | |
784 | 784 | } |
785 | 785 | |
@@ -796,7 +796,7 @@ discard block |
||
796 | 796 | // Process results. |
797 | 797 | foreach ($results->facet_counts->facet_fields as $field => $values) { |
798 | 798 | |
799 | - $entryArray = array (); |
|
799 | + $entryArray = array(); |
|
800 | 800 | |
801 | 801 | $entryArray['title'] = htmlspecialchars($this->conf['facets'][$field]); |
802 | 802 |
@@ -20,43 +20,43 @@ |
||
20 | 20 | */ |
21 | 21 | class tx_dlf_search_suggest extends \TYPO3\CMS\Frontend\Plugin\AbstractPlugin { |
22 | 22 | |
23 | - public $scriptRelPath = 'plugins/search/class.tx_dlf_search_suggest.php'; |
|
23 | + public $scriptRelPath = 'plugins/search/class.tx_dlf_search_suggest.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 void |
|
34 | - */ |
|
35 | - public function main($content = '', $conf = array ()) { |
|
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 void |
|
34 | + */ |
|
35 | + public function main($content = '', $conf = array ()) { |
|
36 | 36 | |
37 | - if (\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('encrypted') != '' && \TYPO3\CMS\Core\Utility\GeneralUtility::_GP('hashed') != '') { |
|
37 | + if (\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('encrypted') != '' && \TYPO3\CMS\Core\Utility\GeneralUtility::_GP('hashed') != '') { |
|
38 | 38 | |
39 | - $core = tx_dlf_helper::decrypt(\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('encrypted'), \TYPO3\CMS\Core\Utility\GeneralUtility::_GP('hashed')); |
|
39 | + $core = tx_dlf_helper::decrypt(\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('encrypted'), \TYPO3\CMS\Core\Utility\GeneralUtility::_GP('hashed')); |
|
40 | 40 | |
41 | - } |
|
41 | + } |
|
42 | 42 | |
43 | - if (!empty($core)) { |
|
43 | + if (!empty($core)) { |
|
44 | 44 | |
45 | - $url = trim(tx_dlf_solr::getSolrUrl($core), '/').'/suggest/?q='.tx_dlf_solr::escapeQuery(\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('q')); |
|
45 | + $url = trim(tx_dlf_solr::getSolrUrl($core), '/').'/suggest/?q='.tx_dlf_solr::escapeQuery(\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('q')); |
|
46 | 46 | |
47 | - if ($stream = fopen($url, 'r')) { |
|
47 | + if ($stream = fopen($url, 'r')) { |
|
48 | 48 | |
49 | - $content .= stream_get_contents($stream); |
|
49 | + $content .= stream_get_contents($stream); |
|
50 | 50 | |
51 | - fclose($stream); |
|
51 | + fclose($stream); |
|
52 | 52 | |
53 | - } |
|
53 | + } |
|
54 | 54 | |
55 | - } |
|
55 | + } |
|
56 | 56 | |
57 | - echo $content; |
|
57 | + echo $content; |
|
58 | 58 | |
59 | - } |
|
59 | + } |
|
60 | 60 | |
61 | 61 | } |
62 | 62 |
@@ -32,7 +32,7 @@ |
||
32 | 32 | * |
33 | 33 | * @return void |
34 | 34 | */ |
35 | - public function main($content = '', $conf = array ()) { |
|
35 | + public function main($content = '', $conf = array()) { |
|
36 | 36 | |
37 | 37 | if (\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('encrypted') != '' && \TYPO3\CMS\Core\Utility\GeneralUtility::_GP('hashed') != '') { |
38 | 38 |
@@ -20,406 +20,406 @@ |
||
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###' => ' ', |
|
150 | - '###DAYTUE###' => ' ', |
|
151 | - '###DAYWED###' => ' ', |
|
152 | - '###DAYTHU###' => ' ', |
|
153 | - '###DAYFRI###' => ' ', |
|
154 | - '###DAYSAT###' => ' ', |
|
155 | - '###DAYSUN###' => ' ', |
|
156 | - ); |
|
148 | + $weekArray = array ( |
|
149 | + '###DAYMON###' => ' ', |
|
150 | + '###DAYTUE###' => ' ', |
|
151 | + '###DAYWED###' => ' ', |
|
152 | + '###DAYTHU###' => ' ', |
|
153 | + '###DAYFRI###' => ' ', |
|
154 | + '###DAYSAT###' => ' ', |
|
155 | + '###DAYSUN###' => ' ', |
|
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 | } |
@@ -89,7 +89,7 @@ discard block |
||
89 | 89 | // Process results. |
90 | 90 | while ($resArray = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($result)) { |
91 | 91 | |
92 | - $issues[] = array ( |
|
92 | + $issues[] = array( |
|
93 | 93 | 'uid' => $resArray['uid'], |
94 | 94 | 'title' => $resArray['title'], |
95 | 95 | 'year' => $resArray['year'] |
@@ -98,7 +98,7 @@ discard block |
||
98 | 98 | } |
99 | 99 | |
100 | 100 | // We need an array of issues with month number as key. |
101 | - $calendarIssues = array (); |
|
101 | + $calendarIssues = array(); |
|
102 | 102 | |
103 | 103 | foreach ($issues as $issue) { |
104 | 104 | |
@@ -106,7 +106,7 @@ discard block |
||
106 | 106 | |
107 | 107 | } |
108 | 108 | |
109 | - $allIssues = array (); |
|
109 | + $allIssues = array(); |
|
110 | 110 | |
111 | 111 | // Get subpart templates. |
112 | 112 | $subparts['list'] = $this->cObj->getSubpart($this->template, '###ISSUELIST###'); |
@@ -122,7 +122,7 @@ discard block |
||
122 | 122 | |
123 | 123 | for ($i = 0; $i <= 11; $i++) { |
124 | 124 | |
125 | - $markerArray = array ( |
|
125 | + $markerArray = array( |
|
126 | 126 | '###DAYMON_NAME###' => strftime('%a', strtotime('last Monday')), |
127 | 127 | '###DAYTUE_NAME###' => strftime('%a', strtotime('last Tuesday')), |
128 | 128 | '###DAYWED_NAME###' => strftime('%a', strtotime('last Wednesday')), |
@@ -145,7 +145,7 @@ discard block |
||
145 | 145 | |
146 | 146 | $firstDayOfWeek = strtotime('+ '.$j.' Week', $firstOfMonthStart); |
147 | 147 | |
148 | - $weekArray = array ( |
|
148 | + $weekArray = array( |
|
149 | 149 | '###DAYMON###' => ' ', |
150 | 150 | '###DAYTUE###' => ' ', |
151 | 151 | '###DAYWED###' => ' ', |
@@ -164,7 +164,7 @@ discard block |
||
164 | 164 | |
165 | 165 | $dayLinks = ''; |
166 | 166 | |
167 | - $dayLinksText = array (); |
|
167 | + $dayLinksText = array(); |
|
168 | 168 | |
169 | 169 | $dayLinksList = ''; |
170 | 170 | |
@@ -182,7 +182,7 @@ discard block |
||
182 | 182 | |
183 | 183 | $dayLinkLabel = empty($issue['title']) ? strftime('%x', $currentDayTime) : $issue['title']; |
184 | 184 | |
185 | - $linkConf = array ( |
|
185 | + $linkConf = array( |
|
186 | 186 | 'useCacheHash' => 1, |
187 | 187 | 'parameter' => $this->conf['targetPid'], |
188 | 188 | 'additionalParams' => '&'.$this->prefixId.'[id]='.urlencode($issue['uid']), |
@@ -257,7 +257,7 @@ discard block |
||
257 | 257 | } |
258 | 258 | |
259 | 259 | // Link to years overview |
260 | - $linkConf = array ( |
|
260 | + $linkConf = array( |
|
261 | 261 | 'useCacheHash' => 1, |
262 | 262 | 'parameter' => $this->conf['targetPid'], |
263 | 263 | 'additionalParams' => '&'.$this->prefixId.'[id]='.urlencode($this->doc->parentId), |
@@ -266,7 +266,7 @@ discard block |
||
266 | 266 | $allYearsLink = $this->cObj->typoLink($this->pi_getLL('allYears', '', TRUE).' '.$this->doc->getTitle($this->doc->parentId), $linkConf); |
267 | 267 | |
268 | 268 | // Link to current year. |
269 | - $linkConf = array ( |
|
269 | + $linkConf = array( |
|
270 | 270 | 'useCacheHash' => 1, |
271 | 271 | 'parameter' => $this->conf['targetPid'], |
272 | 272 | 'additionalParams' => '&'.$this->prefixId.'[id]='.urlencode($this->doc->uid), |
@@ -303,7 +303,7 @@ discard block |
||
303 | 303 | |
304 | 304 | } |
305 | 305 | |
306 | - $markerArray = array ( |
|
306 | + $markerArray = array( |
|
307 | 307 | '###CALENDARVIEWACTIVE###' => $listViewActive ? '' : 'active', |
308 | 308 | '###LISTVIEWACTIVE###' => $listViewActive ? 'active' : '', |
309 | 309 | '###CALYEAR###' => $yearLink, |
@@ -372,7 +372,7 @@ discard block |
||
372 | 372 | // Process results. |
373 | 373 | while ($resArray = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($result)) { |
374 | 374 | |
375 | - $years[] = array ( |
|
375 | + $years[] = array( |
|
376 | 376 | 'title' => $resArray['title'], |
377 | 377 | 'uid' => $resArray['uid'] |
378 | 378 | ); |
@@ -385,14 +385,14 @@ discard block |
||
385 | 385 | |
386 | 386 | foreach ($years as $id => $year) { |
387 | 387 | |
388 | - $linkConf = array ( |
|
388 | + $linkConf = array( |
|
389 | 389 | 'useCacheHash' => 1, |
390 | 390 | 'parameter' => $this->conf['targetPid'], |
391 | 391 | 'additionalParams' => '&'.$this->prefixId.'[id]='.urlencode($year['uid']), |
392 | 392 | 'title' => $titleAnchor.': '.$year['title'] |
393 | 393 | ); |
394 | 394 | |
395 | - $yearArray = array ( |
|
395 | + $yearArray = array( |
|
396 | 396 | '###YEARNAME###' => $this->cObj->typoLink($year['title'], $linkConf), |
397 | 397 | ); |
398 | 398 | |
@@ -402,7 +402,7 @@ discard block |
||
402 | 402 | } |
403 | 403 | |
404 | 404 | // link to years overview (should be itself here) |
405 | - $linkConf = array ( |
|
405 | + $linkConf = array( |
|
406 | 406 | 'useCacheHash' => 1, |
407 | 407 | 'parameter' => $this->conf['targetPid'], |
408 | 408 | 'additionalParams' => '&'.$this->prefixId.'[id]='.$this->doc->uid, |
@@ -410,7 +410,7 @@ discard block |
||
410 | 410 | $allYearsLink = $this->cObj->typoLink($this->pi_getLL('allYears', '', TRUE).' '.$this->doc->getTitle($this->doc->uid), $linkConf); |
411 | 411 | |
412 | 412 | // Fill markers. |
413 | - $markerArray = array ( |
|
413 | + $markerArray = array( |
|
414 | 414 | '###LABEL_CHOOSE_YEAR###' => $this->pi_getLL('label.please_choose_year'), |
415 | 415 | '###CALALLYEARS###' => $allYearsLink |
416 | 416 | ); |