We could not synchronize checks via GitHub's checks API since Scrutinizer's GitHub App is not installed for this repository.
@@ -20,711 +20,711 @@ |
||
20 | 20 | */ |
21 | 21 | class tx_dlf_solr { |
22 | 22 | |
23 | - /** |
|
24 | - * This holds the core name |
|
25 | - * |
|
26 | - * @var string |
|
27 | - * @access protected |
|
28 | - */ |
|
29 | - protected $core = ''; |
|
30 | - |
|
31 | - /** |
|
32 | - * This holds the PID for the configuration |
|
33 | - * |
|
34 | - * @var integer |
|
35 | - * @access protected |
|
36 | - */ |
|
37 | - protected $cPid = 0; |
|
38 | - |
|
39 | - /** |
|
40 | - * The extension key |
|
41 | - * |
|
42 | - * @var string |
|
43 | - * @access public |
|
44 | - */ |
|
45 | - public static $extKey = 'dlf'; |
|
46 | - |
|
47 | - /** |
|
48 | - * This holds the max results |
|
49 | - * |
|
50 | - * @var integer |
|
51 | - * @access protected |
|
52 | - */ |
|
53 | - protected $limit = 50000; |
|
54 | - |
|
55 | - /** |
|
56 | - * This holds the number of hits for last search |
|
57 | - * |
|
58 | - * @var integer |
|
59 | - * @access protected |
|
60 | - */ |
|
61 | - protected $numberOfHits = 0; |
|
62 | - |
|
63 | - /** |
|
64 | - * This holds the additional query parameters |
|
65 | - * |
|
66 | - * @var array |
|
67 | - * @access protected |
|
68 | - */ |
|
69 | - protected $params = array (); |
|
70 | - |
|
71 | - /** |
|
72 | - * Is the search instantiated successfully? |
|
73 | - * |
|
74 | - * @var boolean |
|
75 | - * @access protected |
|
76 | - */ |
|
77 | - protected $ready = FALSE; |
|
78 | - |
|
79 | - /** |
|
80 | - * This holds the singleton search objects with their core as array key |
|
81 | - * |
|
82 | - * @var array(tx_dlf_solr) |
|
83 | - * @access protected |
|
84 | - */ |
|
85 | - protected static $registry = array (); |
|
86 | - |
|
87 | - /** |
|
88 | - * This holds the Solr service object |
|
89 | - * |
|
90 | - * @var Apache_Solr_Service |
|
91 | - * @access protected |
|
92 | - */ |
|
93 | - protected $service; |
|
94 | - |
|
95 | - /** |
|
96 | - * Escape all special characters in a query string |
|
97 | - * |
|
98 | - * @access public |
|
99 | - * |
|
100 | - * @param string $query: The query string |
|
101 | - * |
|
102 | - * @return string The escaped query string |
|
103 | - */ |
|
104 | - public static function escapeQuery($query) { |
|
105 | - |
|
106 | - // Load class. |
|
107 | - if (!class_exists('Apache_Solr_Service')) { |
|
108 | - |
|
109 | - require_once(\TYPO3\CMS\Core\Utility\GeneralUtility::getFileAbsFileName('EXT:'.self::$extKey.'/lib/SolrPhpClient/Apache/Solr/Service.php')); |
|
110 | - |
|
111 | - } |
|
112 | - |
|
113 | - // Escape query phrase or term. |
|
114 | - if (preg_match('/^".*"$/', $query)) { |
|
115 | - |
|
116 | - return '"'.Apache_Solr_Service::escapePhrase(trim($query, '"')).'"'; |
|
23 | + /** |
|
24 | + * This holds the core name |
|
25 | + * |
|
26 | + * @var string |
|
27 | + * @access protected |
|
28 | + */ |
|
29 | + protected $core = ''; |
|
30 | + |
|
31 | + /** |
|
32 | + * This holds the PID for the configuration |
|
33 | + * |
|
34 | + * @var integer |
|
35 | + * @access protected |
|
36 | + */ |
|
37 | + protected $cPid = 0; |
|
38 | + |
|
39 | + /** |
|
40 | + * The extension key |
|
41 | + * |
|
42 | + * @var string |
|
43 | + * @access public |
|
44 | + */ |
|
45 | + public static $extKey = 'dlf'; |
|
46 | + |
|
47 | + /** |
|
48 | + * This holds the max results |
|
49 | + * |
|
50 | + * @var integer |
|
51 | + * @access protected |
|
52 | + */ |
|
53 | + protected $limit = 50000; |
|
54 | + |
|
55 | + /** |
|
56 | + * This holds the number of hits for last search |
|
57 | + * |
|
58 | + * @var integer |
|
59 | + * @access protected |
|
60 | + */ |
|
61 | + protected $numberOfHits = 0; |
|
62 | + |
|
63 | + /** |
|
64 | + * This holds the additional query parameters |
|
65 | + * |
|
66 | + * @var array |
|
67 | + * @access protected |
|
68 | + */ |
|
69 | + protected $params = array (); |
|
70 | + |
|
71 | + /** |
|
72 | + * Is the search instantiated successfully? |
|
73 | + * |
|
74 | + * @var boolean |
|
75 | + * @access protected |
|
76 | + */ |
|
77 | + protected $ready = FALSE; |
|
78 | + |
|
79 | + /** |
|
80 | + * This holds the singleton search objects with their core as array key |
|
81 | + * |
|
82 | + * @var array(tx_dlf_solr) |
|
83 | + * @access protected |
|
84 | + */ |
|
85 | + protected static $registry = array (); |
|
86 | + |
|
87 | + /** |
|
88 | + * This holds the Solr service object |
|
89 | + * |
|
90 | + * @var Apache_Solr_Service |
|
91 | + * @access protected |
|
92 | + */ |
|
93 | + protected $service; |
|
94 | + |
|
95 | + /** |
|
96 | + * Escape all special characters in a query string |
|
97 | + * |
|
98 | + * @access public |
|
99 | + * |
|
100 | + * @param string $query: The query string |
|
101 | + * |
|
102 | + * @return string The escaped query string |
|
103 | + */ |
|
104 | + public static function escapeQuery($query) { |
|
105 | + |
|
106 | + // Load class. |
|
107 | + if (!class_exists('Apache_Solr_Service')) { |
|
108 | + |
|
109 | + require_once(\TYPO3\CMS\Core\Utility\GeneralUtility::getFileAbsFileName('EXT:'.self::$extKey.'/lib/SolrPhpClient/Apache/Solr/Service.php')); |
|
110 | + |
|
111 | + } |
|
112 | + |
|
113 | + // Escape query phrase or term. |
|
114 | + if (preg_match('/^".*"$/', $query)) { |
|
115 | + |
|
116 | + return '"'.Apache_Solr_Service::escapePhrase(trim($query, '"')).'"'; |
|
117 | 117 | |
118 | - } else { |
|
118 | + } else { |
|
119 | 119 | |
120 | - return Apache_Solr_Service::escape($query); |
|
120 | + return Apache_Solr_Service::escape($query); |
|
121 | 121 | |
122 | - } |
|
122 | + } |
|
123 | 123 | |
124 | - } |
|
124 | + } |
|
125 | 125 | |
126 | - /** |
|
127 | - * Escape all special characters in a query string while retaining valid field queries |
|
128 | - * |
|
129 | - * @access public |
|
130 | - * |
|
131 | - * @param string $query: The query string |
|
132 | - * @param integer $pid: The PID for the field configuration |
|
133 | - * |
|
134 | - * @return string The escaped query string |
|
135 | - */ |
|
136 | - public static function escapeQueryKeepField($query, $pid) { |
|
126 | + /** |
|
127 | + * Escape all special characters in a query string while retaining valid field queries |
|
128 | + * |
|
129 | + * @access public |
|
130 | + * |
|
131 | + * @param string $query: The query string |
|
132 | + * @param integer $pid: The PID for the field configuration |
|
133 | + * |
|
134 | + * @return string The escaped query string |
|
135 | + */ |
|
136 | + public static function escapeQueryKeepField($query, $pid) { |
|
137 | 137 | |
138 | - // Is there a field query? |
|
139 | - if (preg_match('/^[[:alnum:]]+_[tu][su]i:\(.*\)$/', $query)) { |
|
138 | + // Is there a field query? |
|
139 | + if (preg_match('/^[[:alnum:]]+_[tu][su]i:\(.*\)$/', $query)) { |
|
140 | 140 | |
141 | - // Get all indexed fields. |
|
142 | - $fields = array(); |
|
141 | + // Get all indexed fields. |
|
142 | + $fields = array(); |
|
143 | 143 | |
144 | - $result = $GLOBALS['TYPO3_DB']->exec_SELECTquery( |
|
145 | - 'tx_dlf_metadata.index_name,tx_dlf_metadata.index_tokenized,tx_dlf_metadata.index_stored', |
|
146 | - 'tx_dlf_metadata', |
|
147 | - 'tx_dlf_metadata.index_indexed=1 AND tx_dlf_metadata.pid=' . intval($pid) . ' AND (tx_dlf_metadata.sys_language_uid IN (-1,0) OR tx_dlf_metadata.l18n_parent=0)' . tx_dlf_helper::whereClause('tx_dlf_metadata'), |
|
148 | - '', |
|
149 | - '', |
|
150 | - '' |
|
151 | - ); |
|
144 | + $result = $GLOBALS['TYPO3_DB']->exec_SELECTquery( |
|
145 | + 'tx_dlf_metadata.index_name,tx_dlf_metadata.index_tokenized,tx_dlf_metadata.index_stored', |
|
146 | + 'tx_dlf_metadata', |
|
147 | + 'tx_dlf_metadata.index_indexed=1 AND tx_dlf_metadata.pid=' . intval($pid) . ' AND (tx_dlf_metadata.sys_language_uid IN (-1,0) OR tx_dlf_metadata.l18n_parent=0)' . tx_dlf_helper::whereClause('tx_dlf_metadata'), |
|
148 | + '', |
|
149 | + '', |
|
150 | + '' |
|
151 | + ); |
|
152 | 152 | |
153 | - if ($GLOBALS['TYPO3_DB']->sql_num_rows($result) > 0) { |
|
153 | + if ($GLOBALS['TYPO3_DB']->sql_num_rows($result) > 0) { |
|
154 | 154 | |
155 | - while ($resArray = $GLOBALS['TYPO3_DB']->sql_fetch_row($result)) { |
|
155 | + while ($resArray = $GLOBALS['TYPO3_DB']->sql_fetch_row($result)) { |
|
156 | 156 | |
157 | - $fields[] = $resArray[0].'_'.($resArray[1] ? 't' : 'u').($resArray[2] ? 's' : 'u').'i'; |
|
157 | + $fields[] = $resArray[0].'_'.($resArray[1] ? 't' : 'u').($resArray[2] ? 's' : 'u').'i'; |
|
158 | 158 | |
159 | - } |
|
159 | + } |
|
160 | 160 | |
161 | - } |
|
161 | + } |
|
162 | 162 | |
163 | - // Check if queried field is valid. |
|
164 | - $splitQuery = explode(':', $query, 2); |
|
163 | + // Check if queried field is valid. |
|
164 | + $splitQuery = explode(':', $query, 2); |
|
165 | 165 | |
166 | - if (in_array($splitQuery[0], $fields)) { |
|
166 | + if (in_array($splitQuery[0], $fields)) { |
|
167 | 167 | |
168 | - $query = $splitQuery[0].':('.self::escapeQuery(trim($splitQuery[1], '()')).')'; |
|
168 | + $query = $splitQuery[0].':('.self::escapeQuery(trim($splitQuery[1], '()')).')'; |
|
169 | 169 | |
170 | - } else { |
|
170 | + } else { |
|
171 | 171 | |
172 | - $query = self::escapeQuery($query); |
|
172 | + $query = self::escapeQuery($query); |
|
173 | 173 | |
174 | - } |
|
174 | + } |
|
175 | 175 | |
176 | - } elseif (!empty($query) && $query !== '*') { |
|
176 | + } elseif (!empty($query) && $query !== '*') { |
|
177 | 177 | |
178 | - // Don't escape plain asterisk search. |
|
179 | - $query = self::escapeQuery($query); |
|
178 | + // Don't escape plain asterisk search. |
|
179 | + $query = self::escapeQuery($query); |
|
180 | 180 | |
181 | - } |
|
181 | + } |
|
182 | 182 | |
183 | - return $query; |
|
183 | + return $query; |
|
184 | 184 | |
185 | - } |
|
185 | + } |
|
186 | 186 | |
187 | - /** |
|
188 | - * This is a singleton class, thus instances must be created by this method |
|
189 | - * |
|
190 | - * @access public |
|
191 | - * |
|
192 | - * @param mixed $core: Name or UID of the core to load |
|
193 | - * |
|
194 | - * @return tx_dlf_solr Instance of this class |
|
195 | - */ |
|
196 | - public static function getInstance($core) { |
|
187 | + /** |
|
188 | + * This is a singleton class, thus instances must be created by this method |
|
189 | + * |
|
190 | + * @access public |
|
191 | + * |
|
192 | + * @param mixed $core: Name or UID of the core to load |
|
193 | + * |
|
194 | + * @return tx_dlf_solr Instance of this class |
|
195 | + */ |
|
196 | + public static function getInstance($core) { |
|
197 | 197 | |
198 | - // Save parameter for logging purposes. |
|
199 | - $_core = $core; |
|
198 | + // Save parameter for logging purposes. |
|
199 | + $_core = $core; |
|
200 | 200 | |
201 | - // Get core name if UID is given. |
|
202 | - if (\TYPO3\CMS\Core\Utility\MathUtility::canBeInterpretedAsInteger($core)) { |
|
201 | + // Get core name if UID is given. |
|
202 | + if (\TYPO3\CMS\Core\Utility\MathUtility::canBeInterpretedAsInteger($core)) { |
|
203 | 203 | |
204 | - $core = tx_dlf_helper::getIndexName($core, 'tx_dlf_solrcores'); |
|
204 | + $core = tx_dlf_helper::getIndexName($core, 'tx_dlf_solrcores'); |
|
205 | 205 | |
206 | - } |
|
206 | + } |
|
207 | 207 | |
208 | - // Check if core is set. |
|
209 | - if (empty($core)) { |
|
208 | + // Check if core is set. |
|
209 | + if (empty($core)) { |
|
210 | 210 | |
211 | - if (TYPO3_DLOG) { |
|
211 | + if (TYPO3_DLOG) { |
|
212 | 212 | |
213 | - \TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[tx_dlf_solr->getInstance('.$_core.')] Invalid core name "'.$core.'" for Apache Solr', self::$extKey, SYSLOG_SEVERITY_ERROR); |
|
213 | + \TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[tx_dlf_solr->getInstance('.$_core.')] Invalid core name "'.$core.'" for Apache Solr', self::$extKey, SYSLOG_SEVERITY_ERROR); |
|
214 | 214 | |
215 | - } |
|
215 | + } |
|
216 | 216 | |
217 | - return; |
|
217 | + return; |
|
218 | 218 | |
219 | - } |
|
219 | + } |
|
220 | 220 | |
221 | - // Check if there is an instance in the registry already. |
|
222 | - if (is_object(self::$registry[$core]) && self::$registry[$core] instanceof self) { |
|
221 | + // Check if there is an instance in the registry already. |
|
222 | + if (is_object(self::$registry[$core]) && self::$registry[$core] instanceof self) { |
|
223 | 223 | |
224 | - // Return singleton instance if available. |
|
225 | - return self::$registry[$core]; |
|
224 | + // Return singleton instance if available. |
|
225 | + return self::$registry[$core]; |
|
226 | 226 | |
227 | - } |
|
227 | + } |
|
228 | 228 | |
229 | - // Create new instance... |
|
230 | - $instance = new self($core); |
|
229 | + // Create new instance... |
|
230 | + $instance = new self($core); |
|
231 | 231 | |
232 | - // ...and save it to registry. |
|
233 | - if ($instance->ready) { |
|
232 | + // ...and save it to registry. |
|
233 | + if ($instance->ready) { |
|
234 | 234 | |
235 | - self::$registry[$core] = $instance; |
|
235 | + self::$registry[$core] = $instance; |
|
236 | 236 | |
237 | - // Return new instance. |
|
238 | - return $instance; |
|
237 | + // Return new instance. |
|
238 | + return $instance; |
|
239 | 239 | |
240 | - } else { |
|
240 | + } else { |
|
241 | 241 | |
242 | - if (TYPO3_DLOG) { |
|
242 | + if (TYPO3_DLOG) { |
|
243 | 243 | |
244 | - \TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[tx_dlf_solr->getInstance('.$_core.')] Could not connect to Apache Solr server', self::$extKey, SYSLOG_SEVERITY_ERROR); |
|
244 | + \TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[tx_dlf_solr->getInstance('.$_core.')] Could not connect to Apache Solr server', self::$extKey, SYSLOG_SEVERITY_ERROR); |
|
245 | 245 | |
246 | - } |
|
246 | + } |
|
247 | 247 | |
248 | - return; |
|
248 | + return; |
|
249 | 249 | |
250 | - } |
|
250 | + } |
|
251 | 251 | |
252 | - } |
|
252 | + } |
|
253 | 253 | |
254 | - /** |
|
255 | - * Returns the connection information a specific Solr core |
|
256 | - * |
|
257 | - * @access public |
|
258 | - * |
|
259 | - * @param string $core: Name of the core to load |
|
260 | - * |
|
261 | - * @return string The connection parameters for a specific Solr core |
|
262 | - */ |
|
263 | - public static function getSolrConnectionInfo($core = '') { |
|
254 | + /** |
|
255 | + * Returns the connection information a specific Solr core |
|
256 | + * |
|
257 | + * @access public |
|
258 | + * |
|
259 | + * @param string $core: Name of the core to load |
|
260 | + * |
|
261 | + * @return string The connection parameters for a specific Solr core |
|
262 | + */ |
|
263 | + public static function getSolrConnectionInfo($core = '') { |
|
264 | 264 | |
265 | - $solrInfo = array (); |
|
265 | + $solrInfo = array (); |
|
266 | 266 | |
267 | - // Extract extension configuration. |
|
268 | - $conf = unserialize($GLOBALS['TYPO3_CONF_VARS']['EXT']['extConf'][self::$extKey]); |
|
267 | + // Extract extension configuration. |
|
268 | + $conf = unserialize($GLOBALS['TYPO3_CONF_VARS']['EXT']['extConf'][self::$extKey]); |
|
269 | 269 | |
270 | - // Derive Solr host name. |
|
271 | - $solrInfo['host'] = ($conf['solrHost'] ? $conf['solrHost'] : '127.0.0.1'); |
|
270 | + // Derive Solr host name. |
|
271 | + $solrInfo['host'] = ($conf['solrHost'] ? $conf['solrHost'] : '127.0.0.1'); |
|
272 | 272 | |
273 | - // Prepend username and password to hostname. |
|
274 | - if ($conf['solrUser'] && $conf['solrPass']) { |
|
273 | + // Prepend username and password to hostname. |
|
274 | + if ($conf['solrUser'] && $conf['solrPass']) { |
|
275 | 275 | |
276 | - $solrInfo['host'] = $conf['solrUser'].':'.$conf['solrPass'].'@'.$solrInfo['host']; |
|
276 | + $solrInfo['host'] = $conf['solrUser'].':'.$conf['solrPass'].'@'.$solrInfo['host']; |
|
277 | 277 | |
278 | - } |
|
278 | + } |
|
279 | 279 | |
280 | - // Set port if not set. |
|
281 | - $solrInfo['port'] = \TYPO3\CMS\Core\Utility\MathUtility::forceIntegerInRange($conf['solrPort'], 1, 65535, 8180); |
|
280 | + // Set port if not set. |
|
281 | + $solrInfo['port'] = \TYPO3\CMS\Core\Utility\MathUtility::forceIntegerInRange($conf['solrPort'], 1, 65535, 8180); |
|
282 | 282 | |
283 | - // Append core name to path. |
|
284 | - $solrInfo['path'] = trim($conf['solrPath'], '/').'/'.$core; |
|
283 | + // Append core name to path. |
|
284 | + $solrInfo['path'] = trim($conf['solrPath'], '/').'/'.$core; |
|
285 | 285 | |
286 | - return $solrInfo; |
|
286 | + return $solrInfo; |
|
287 | 287 | |
288 | - } |
|
288 | + } |
|
289 | 289 | |
290 | - /** |
|
291 | - * Returns the request URL for a specific Solr core |
|
292 | - * |
|
293 | - * @access public |
|
294 | - * |
|
295 | - * @param string $core: Name of the core to load |
|
296 | - * |
|
297 | - * @return string The request URL for a specific Solr core |
|
298 | - */ |
|
299 | - public static function getSolrUrl($core = '') { |
|
290 | + /** |
|
291 | + * Returns the request URL for a specific Solr core |
|
292 | + * |
|
293 | + * @access public |
|
294 | + * |
|
295 | + * @param string $core: Name of the core to load |
|
296 | + * |
|
297 | + * @return string The request URL for a specific Solr core |
|
298 | + */ |
|
299 | + public static function getSolrUrl($core = '') { |
|
300 | 300 | |
301 | - // Get Solr connection information. |
|
302 | - $solrInfo = self::getSolrConnectionInfo($core); |
|
301 | + // Get Solr connection information. |
|
302 | + $solrInfo = self::getSolrConnectionInfo($core); |
|
303 | 303 | |
304 | - // Return entire request URL. |
|
305 | - return 'http://'.$solrInfo['host'].':'.$solrInfo['port'].'/'.$solrInfo['path']; |
|
304 | + // Return entire request URL. |
|
305 | + return 'http://'.$solrInfo['host'].':'.$solrInfo['port'].'/'.$solrInfo['path']; |
|
306 | 306 | |
307 | - } |
|
307 | + } |
|
308 | 308 | |
309 | - /** |
|
310 | - * Get next unused Solr core number |
|
311 | - * |
|
312 | - * @access public |
|
313 | - * |
|
314 | - * @param integer $start: Number to start with |
|
315 | - * |
|
316 | - * @return integer First unused core number found |
|
317 | - */ |
|
318 | - public static function solrGetCoreNumber($start = 0) { |
|
309 | + /** |
|
310 | + * Get next unused Solr core number |
|
311 | + * |
|
312 | + * @access public |
|
313 | + * |
|
314 | + * @param integer $start: Number to start with |
|
315 | + * |
|
316 | + * @return integer First unused core number found |
|
317 | + */ |
|
318 | + public static function solrGetCoreNumber($start = 0) { |
|
319 | 319 | |
320 | - $start = max(intval($start), 0); |
|
320 | + $start = max(intval($start), 0); |
|
321 | 321 | |
322 | - // Check if core already exists. |
|
323 | - if (self::getInstance('dlfCore'.$start) === NULL) { |
|
322 | + // Check if core already exists. |
|
323 | + if (self::getInstance('dlfCore'.$start) === NULL) { |
|
324 | 324 | |
325 | - return $start; |
|
325 | + return $start; |
|
326 | 326 | |
327 | - } else { |
|
327 | + } else { |
|
328 | 328 | |
329 | - return self::solrGetCoreNumber($start + 1); |
|
329 | + return self::solrGetCoreNumber($start + 1); |
|
330 | 330 | |
331 | - } |
|
331 | + } |
|
332 | 332 | |
333 | - } |
|
333 | + } |
|
334 | 334 | |
335 | - /** |
|
336 | - * Processes a search request. |
|
337 | - * |
|
338 | - * @access public |
|
339 | - * |
|
340 | - * @param string $query: The search query |
|
341 | - * |
|
342 | - * @return tx_dlf_list The result list |
|
343 | - */ |
|
344 | - public function search($query = '') { |
|
335 | + /** |
|
336 | + * Processes a search request. |
|
337 | + * |
|
338 | + * @access public |
|
339 | + * |
|
340 | + * @param string $query: The search query |
|
341 | + * |
|
342 | + * @return tx_dlf_list The result list |
|
343 | + */ |
|
344 | + public function search($query = '') { |
|
345 | 345 | |
346 | - // Perform search. |
|
347 | - $results = $this->service->search((string) $query, 0, $this->limit, $this->params); |
|
346 | + // Perform search. |
|
347 | + $results = $this->service->search((string) $query, 0, $this->limit, $this->params); |
|
348 | 348 | |
349 | - $this->numberOfHits = count($results->response->docs); |
|
349 | + $this->numberOfHits = count($results->response->docs); |
|
350 | 350 | |
351 | - $toplevel = array (); |
|
351 | + $toplevel = array (); |
|
352 | 352 | |
353 | - $checks = array (); |
|
353 | + $checks = array (); |
|
354 | 354 | |
355 | - // Get metadata configuration. |
|
356 | - if ($this->numberOfHits > 0) { |
|
355 | + // Get metadata configuration. |
|
356 | + if ($this->numberOfHits > 0) { |
|
357 | 357 | |
358 | - $result = $GLOBALS['TYPO3_DB']->exec_SELECTquery( |
|
359 | - 'tx_dlf_metadata.index_name AS index_name', |
|
360 | - 'tx_dlf_metadata', |
|
361 | - 'tx_dlf_metadata.is_sortable=1 AND tx_dlf_metadata.pid='.intval($this->cPid).tx_dlf_helper::whereClause('tx_dlf_metadata'), |
|
362 | - '', |
|
363 | - '', |
|
364 | - '' |
|
365 | - ); |
|
358 | + $result = $GLOBALS['TYPO3_DB']->exec_SELECTquery( |
|
359 | + 'tx_dlf_metadata.index_name AS index_name', |
|
360 | + 'tx_dlf_metadata', |
|
361 | + 'tx_dlf_metadata.is_sortable=1 AND tx_dlf_metadata.pid='.intval($this->cPid).tx_dlf_helper::whereClause('tx_dlf_metadata'), |
|
362 | + '', |
|
363 | + '', |
|
364 | + '' |
|
365 | + ); |
|
366 | 366 | |
367 | - $sorting = array (); |
|
367 | + $sorting = array (); |
|
368 | 368 | |
369 | - while ($resArray = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($result)) { |
|
369 | + while ($resArray = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($result)) { |
|
370 | 370 | |
371 | - $sorting[$resArray['index_name']] = $resArray['index_name'].'_sorting'; |
|
371 | + $sorting[$resArray['index_name']] = $resArray['index_name'].'_sorting'; |
|
372 | 372 | |
373 | - } |
|
373 | + } |
|
374 | 374 | |
375 | - } |
|
375 | + } |
|
376 | 376 | |
377 | - // Keep track of relevance. |
|
378 | - $i = 0; |
|
377 | + // Keep track of relevance. |
|
378 | + $i = 0; |
|
379 | 379 | |
380 | - // Process results. |
|
381 | - foreach ($results->response->docs as $doc) { |
|
380 | + // Process results. |
|
381 | + foreach ($results->response->docs as $doc) { |
|
382 | 382 | |
383 | - // Split toplevel documents from subparts. |
|
384 | - if ($doc->toplevel == 1) { |
|
383 | + // Split toplevel documents from subparts. |
|
384 | + if ($doc->toplevel == 1) { |
|
385 | 385 | |
386 | - // Prepare document's metadata for sorting. |
|
387 | - $docSorting = array (); |
|
386 | + // Prepare document's metadata for sorting. |
|
387 | + $docSorting = array (); |
|
388 | 388 | |
389 | - foreach ($sorting as $index_name => $solr_name) { |
|
389 | + foreach ($sorting as $index_name => $solr_name) { |
|
390 | 390 | |
391 | - if (!empty($doc->$solr_name)) { |
|
391 | + if (!empty($doc->$solr_name)) { |
|
392 | 392 | |
393 | - $docSorting[$index_name] = (is_array($doc->$solr_name) ? $doc->$solr_name[0] : $doc->$solr_name); |
|
393 | + $docSorting[$index_name] = (is_array($doc->$solr_name) ? $doc->$solr_name[0] : $doc->$solr_name); |
|
394 | 394 | |
395 | - } |
|
395 | + } |
|
396 | 396 | |
397 | - } |
|
397 | + } |
|
398 | 398 | |
399 | - // Preserve relevance ranking. |
|
400 | - if (!empty($toplevel[$doc->uid]['s']['relevance'])) { |
|
399 | + // Preserve relevance ranking. |
|
400 | + if (!empty($toplevel[$doc->uid]['s']['relevance'])) { |
|
401 | 401 | |
402 | - $docSorting['relevance'] = $toplevel[$doc->uid]['s']['relevance']; |
|
402 | + $docSorting['relevance'] = $toplevel[$doc->uid]['s']['relevance']; |
|
403 | 403 | |
404 | - } |
|
404 | + } |
|
405 | 405 | |
406 | - $toplevel[$doc->uid] = array ( |
|
407 | - 'u' => $doc->uid, |
|
408 | - 'h' => '', |
|
409 | - 's' => $docSorting, |
|
410 | - 'p' => (!empty($toplevel[$doc->uid]['p']) ? $toplevel[$doc->uid]['p'] : array ()) |
|
411 | - ); |
|
406 | + $toplevel[$doc->uid] = array ( |
|
407 | + 'u' => $doc->uid, |
|
408 | + 'h' => '', |
|
409 | + 's' => $docSorting, |
|
410 | + 'p' => (!empty($toplevel[$doc->uid]['p']) ? $toplevel[$doc->uid]['p'] : array ()) |
|
411 | + ); |
|
412 | 412 | |
413 | - } else { |
|
413 | + } else { |
|
414 | 414 | |
415 | - $toplevel[$doc->uid]['p'][] = array ( |
|
416 | - 'u' => $doc->id, |
|
417 | - 'h' => (!empty($results->highlighting->{$doc->id}->fulltext) ? $results->highlighting->{$doc->id}->fulltext[0] : '') |
|
418 | - ); |
|
415 | + $toplevel[$doc->uid]['p'][] = array ( |
|
416 | + 'u' => $doc->id, |
|
417 | + 'h' => (!empty($results->highlighting->{$doc->id}->fulltext) ? $results->highlighting->{$doc->id}->fulltext[0] : '') |
|
418 | + ); |
|
419 | 419 | |
420 | - if (!in_array($doc->uid, $checks)) { |
|
420 | + if (!in_array($doc->uid, $checks)) { |
|
421 | 421 | |
422 | - $checks[] = $doc->uid; |
|
422 | + $checks[] = $doc->uid; |
|
423 | 423 | |
424 | - } |
|
424 | + } |
|
425 | 425 | |
426 | - } |
|
426 | + } |
|
427 | 427 | |
428 | - // Add relevance to sorting values. |
|
429 | - if (empty($toplevel[$doc->uid]['s']['relevance'])) { |
|
428 | + // Add relevance to sorting values. |
|
429 | + if (empty($toplevel[$doc->uid]['s']['relevance'])) { |
|
430 | 430 | |
431 | - $toplevel[$doc->uid]['s']['relevance'] = str_pad($i, 6, '0', STR_PAD_LEFT); |
|
431 | + $toplevel[$doc->uid]['s']['relevance'] = str_pad($i, 6, '0', STR_PAD_LEFT); |
|
432 | 432 | |
433 | - } |
|
433 | + } |
|
434 | 434 | |
435 | - $i++; |
|
435 | + $i++; |
|
436 | 436 | |
437 | - } |
|
437 | + } |
|
438 | 438 | |
439 | - // Check if the toplevel documents have metadata. |
|
440 | - foreach ($checks as $check) { |
|
439 | + // Check if the toplevel documents have metadata. |
|
440 | + foreach ($checks as $check) { |
|
441 | 441 | |
442 | - if (empty($toplevel[$check]['u'])) { |
|
442 | + if (empty($toplevel[$check]['u'])) { |
|
443 | 443 | |
444 | - // Get information for toplevel document. |
|
445 | - $result = $GLOBALS['TYPO3_DB']->exec_SELECTquery( |
|
446 | - 'tx_dlf_documents.uid AS uid,tx_dlf_documents.metadata_sorting AS metadata_sorting', |
|
447 | - 'tx_dlf_documents', |
|
448 | - 'tx_dlf_documents.uid='.intval($check).tx_dlf_helper::whereClause('tx_dlf_documents'), |
|
449 | - '', |
|
450 | - '', |
|
451 | - '1' |
|
452 | - ); |
|
444 | + // Get information for toplevel document. |
|
445 | + $result = $GLOBALS['TYPO3_DB']->exec_SELECTquery( |
|
446 | + 'tx_dlf_documents.uid AS uid,tx_dlf_documents.metadata_sorting AS metadata_sorting', |
|
447 | + 'tx_dlf_documents', |
|
448 | + 'tx_dlf_documents.uid='.intval($check).tx_dlf_helper::whereClause('tx_dlf_documents'), |
|
449 | + '', |
|
450 | + '', |
|
451 | + '1' |
|
452 | + ); |
|
453 | 453 | |
454 | - // Process results. |
|
455 | - if ($GLOBALS['TYPO3_DB']->sql_num_rows($result)) { |
|
454 | + // Process results. |
|
455 | + if ($GLOBALS['TYPO3_DB']->sql_num_rows($result)) { |
|
456 | 456 | |
457 | - $resArray = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($result); |
|
457 | + $resArray = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($result); |
|
458 | 458 | |
459 | - // Prepare document's metadata for sorting. |
|
460 | - $sorting = unserialize($resArray['metadata_sorting']); |
|
459 | + // Prepare document's metadata for sorting. |
|
460 | + $sorting = unserialize($resArray['metadata_sorting']); |
|
461 | 461 | |
462 | - if (!empty($sorting['type']) && \TYPO3\CMS\Core\Utility\MathUtility::canBeInterpretedAsInteger($sorting['type'])) { |
|
462 | + if (!empty($sorting['type']) && \TYPO3\CMS\Core\Utility\MathUtility::canBeInterpretedAsInteger($sorting['type'])) { |
|
463 | 463 | |
464 | - $sorting['type'] = tx_dlf_helper::getIndexName($sorting['type'], 'tx_dlf_structures', $this->cPid); |
|
464 | + $sorting['type'] = tx_dlf_helper::getIndexName($sorting['type'], 'tx_dlf_structures', $this->cPid); |
|
465 | 465 | |
466 | - } |
|
466 | + } |
|
467 | 467 | |
468 | - if (!empty($sorting['owner']) && \TYPO3\CMS\Core\Utility\MathUtility::canBeInterpretedAsInteger($sorting['owner'])) { |
|
468 | + if (!empty($sorting['owner']) && \TYPO3\CMS\Core\Utility\MathUtility::canBeInterpretedAsInteger($sorting['owner'])) { |
|
469 | 469 | |
470 | - $sorting['owner'] = tx_dlf_helper::getIndexName($sorting['owner'], 'tx_dlf_libraries', $this->cPid); |
|
470 | + $sorting['owner'] = tx_dlf_helper::getIndexName($sorting['owner'], 'tx_dlf_libraries', $this->cPid); |
|
471 | 471 | |
472 | - } |
|
472 | + } |
|
473 | 473 | |
474 | - if (!empty($sorting['collection']) && \TYPO3\CMS\Core\Utility\MathUtility::canBeInterpretedAsInteger($sorting['collection'])) { |
|
474 | + if (!empty($sorting['collection']) && \TYPO3\CMS\Core\Utility\MathUtility::canBeInterpretedAsInteger($sorting['collection'])) { |
|
475 | 475 | |
476 | - $sorting['collection'] = tx_dlf_helper::getIndexName($sorting['collection'], 'tx_dlf_collections', $this->cPid); |
|
476 | + $sorting['collection'] = tx_dlf_helper::getIndexName($sorting['collection'], 'tx_dlf_collections', $this->cPid); |
|
477 | 477 | |
478 | - } |
|
478 | + } |
|
479 | 479 | |
480 | - // Preserve relevance ranking. |
|
481 | - if (!empty($toplevel[$check]['s']['relevance'])) { |
|
480 | + // Preserve relevance ranking. |
|
481 | + if (!empty($toplevel[$check]['s']['relevance'])) { |
|
482 | 482 | |
483 | - $sorting['relevance'] = $toplevel[$check]['s']['relevance']; |
|
483 | + $sorting['relevance'] = $toplevel[$check]['s']['relevance']; |
|
484 | 484 | |
485 | - } |
|
485 | + } |
|
486 | 486 | |
487 | - $toplevel[$check] = array ( |
|
488 | - 'u' => $resArray['uid'], |
|
489 | - 'h' => '', |
|
490 | - 's' => $sorting, |
|
491 | - 'p' => $toplevel[$check]['p'] |
|
492 | - ); |
|
487 | + $toplevel[$check] = array ( |
|
488 | + 'u' => $resArray['uid'], |
|
489 | + 'h' => '', |
|
490 | + 's' => $sorting, |
|
491 | + 'p' => $toplevel[$check]['p'] |
|
492 | + ); |
|
493 | 493 | |
494 | - } else { |
|
494 | + } else { |
|
495 | 495 | |
496 | - // Clear entry if there is no (accessible) toplevel document. |
|
497 | - unset ($toplevel[$check]); |
|
496 | + // Clear entry if there is no (accessible) toplevel document. |
|
497 | + unset ($toplevel[$check]); |
|
498 | 498 | |
499 | - } |
|
499 | + } |
|
500 | 500 | |
501 | - } |
|
501 | + } |
|
502 | 502 | |
503 | - } |
|
503 | + } |
|
504 | 504 | |
505 | - // Save list of documents. |
|
506 | - $list = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('tx_dlf_list'); |
|
505 | + // Save list of documents. |
|
506 | + $list = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('tx_dlf_list'); |
|
507 | 507 | |
508 | - $list->reset(); |
|
508 | + $list->reset(); |
|
509 | 509 | |
510 | - $list->add(array_values($toplevel)); |
|
510 | + $list->add(array_values($toplevel)); |
|
511 | 511 | |
512 | - // Set metadata for search. |
|
513 | - $list->metadata = array ( |
|
514 | - 'label' => '', |
|
515 | - 'description' => '', |
|
516 | - 'options' => array ( |
|
517 | - 'source' => 'search', |
|
518 | - 'engine' => 'solr', |
|
519 | - 'select' => $query, |
|
520 | - 'userid' => 0, |
|
521 | - 'params' => $this->params, |
|
522 | - 'core' => $this->core, |
|
523 | - 'pid' => $this->cPid, |
|
524 | - 'order' => 'relevance', |
|
525 | - 'order.asc' => TRUE, |
|
526 | - ) |
|
527 | - ); |
|
512 | + // Set metadata for search. |
|
513 | + $list->metadata = array ( |
|
514 | + 'label' => '', |
|
515 | + 'description' => '', |
|
516 | + 'options' => array ( |
|
517 | + 'source' => 'search', |
|
518 | + 'engine' => 'solr', |
|
519 | + 'select' => $query, |
|
520 | + 'userid' => 0, |
|
521 | + 'params' => $this->params, |
|
522 | + 'core' => $this->core, |
|
523 | + 'pid' => $this->cPid, |
|
524 | + 'order' => 'relevance', |
|
525 | + 'order.asc' => TRUE, |
|
526 | + ) |
|
527 | + ); |
|
528 | 528 | |
529 | - return $list; |
|
529 | + return $list; |
|
530 | 530 | |
531 | - } |
|
531 | + } |
|
532 | 532 | |
533 | - /** |
|
534 | - * This returns $this->limit via __get() |
|
535 | - * |
|
536 | - * @access protected |
|
537 | - * |
|
538 | - * @return integer The max number of results |
|
539 | - */ |
|
540 | - protected function _getLimit() { |
|
533 | + /** |
|
534 | + * This returns $this->limit via __get() |
|
535 | + * |
|
536 | + * @access protected |
|
537 | + * |
|
538 | + * @return integer The max number of results |
|
539 | + */ |
|
540 | + protected function _getLimit() { |
|
541 | 541 | |
542 | - return $this->limit; |
|
542 | + return $this->limit; |
|
543 | 543 | |
544 | - } |
|
544 | + } |
|
545 | 545 | |
546 | - /** |
|
547 | - * This returns $this->numberOfHits via __get() |
|
548 | - * |
|
549 | - * @access protected |
|
550 | - * |
|
551 | - * @return integer Total number of hits for last search |
|
552 | - */ |
|
553 | - protected function _getNumberOfHits() { |
|
546 | + /** |
|
547 | + * This returns $this->numberOfHits via __get() |
|
548 | + * |
|
549 | + * @access protected |
|
550 | + * |
|
551 | + * @return integer Total number of hits for last search |
|
552 | + */ |
|
553 | + protected function _getNumberOfHits() { |
|
554 | 554 | |
555 | - return $this->numberOfHits; |
|
555 | + return $this->numberOfHits; |
|
556 | 556 | |
557 | - } |
|
557 | + } |
|
558 | 558 | |
559 | - /** |
|
560 | - * This returns $this->ready via __get() |
|
561 | - * |
|
562 | - * @access protected |
|
563 | - * |
|
564 | - * @return boolean Is the search instantiated successfully? |
|
565 | - */ |
|
566 | - protected function _getReady() { |
|
559 | + /** |
|
560 | + * This returns $this->ready via __get() |
|
561 | + * |
|
562 | + * @access protected |
|
563 | + * |
|
564 | + * @return boolean Is the search instantiated successfully? |
|
565 | + */ |
|
566 | + protected function _getReady() { |
|
567 | 567 | |
568 | - return $this->ready; |
|
568 | + return $this->ready; |
|
569 | 569 | |
570 | - } |
|
570 | + } |
|
571 | 571 | |
572 | - /** |
|
573 | - * This returns $this->service via __get() |
|
574 | - * |
|
575 | - * @access protected |
|
576 | - * |
|
577 | - * @return Apache_Solr_Service Apache Solr service object |
|
578 | - */ |
|
579 | - protected function _getService() { |
|
572 | + /** |
|
573 | + * This returns $this->service via __get() |
|
574 | + * |
|
575 | + * @access protected |
|
576 | + * |
|
577 | + * @return Apache_Solr_Service Apache Solr service object |
|
578 | + */ |
|
579 | + protected function _getService() { |
|
580 | 580 | |
581 | - return $this->service; |
|
581 | + return $this->service; |
|
582 | 582 | |
583 | - } |
|
583 | + } |
|
584 | 584 | |
585 | - /** |
|
586 | - * This sets $this->cPid via __set() |
|
587 | - * |
|
588 | - * @access protected |
|
589 | - * |
|
590 | - * @param integer $value: The new PID for the metadata definitions |
|
591 | - * |
|
592 | - * @return void |
|
593 | - */ |
|
594 | - protected function _setCPid($value) { |
|
585 | + /** |
|
586 | + * This sets $this->cPid via __set() |
|
587 | + * |
|
588 | + * @access protected |
|
589 | + * |
|
590 | + * @param integer $value: The new PID for the metadata definitions |
|
591 | + * |
|
592 | + * @return void |
|
593 | + */ |
|
594 | + protected function _setCPid($value) { |
|
595 | 595 | |
596 | - $this->cPid = max(intval($value), 0); |
|
596 | + $this->cPid = max(intval($value), 0); |
|
597 | 597 | |
598 | - } |
|
598 | + } |
|
599 | 599 | |
600 | - /** |
|
601 | - * This sets $this->limit via __set() |
|
602 | - * |
|
603 | - * @access protected |
|
604 | - * |
|
605 | - * @param integer $value: The max number of results |
|
606 | - * |
|
607 | - * @return void |
|
608 | - */ |
|
609 | - protected function _setLimit($value) { |
|
600 | + /** |
|
601 | + * This sets $this->limit via __set() |
|
602 | + * |
|
603 | + * @access protected |
|
604 | + * |
|
605 | + * @param integer $value: The max number of results |
|
606 | + * |
|
607 | + * @return void |
|
608 | + */ |
|
609 | + protected function _setLimit($value) { |
|
610 | 610 | |
611 | - $this->limit = max(intval($value), 0); |
|
611 | + $this->limit = max(intval($value), 0); |
|
612 | 612 | |
613 | - } |
|
613 | + } |
|
614 | 614 | |
615 | - /** |
|
616 | - * This sets $this->params via __set() |
|
617 | - * |
|
618 | - * @access protected |
|
619 | - * |
|
620 | - * @param array $value: The query parameters |
|
621 | - * |
|
622 | - * @return void |
|
623 | - */ |
|
624 | - protected function _setParams(array $value) { |
|
615 | + /** |
|
616 | + * This sets $this->params via __set() |
|
617 | + * |
|
618 | + * @access protected |
|
619 | + * |
|
620 | + * @param array $value: The query parameters |
|
621 | + * |
|
622 | + * @return void |
|
623 | + */ |
|
624 | + protected function _setParams(array $value) { |
|
625 | 625 | |
626 | - $this->params = $value; |
|
626 | + $this->params = $value; |
|
627 | 627 | |
628 | - } |
|
628 | + } |
|
629 | 629 | |
630 | - /** |
|
631 | - * This magic method is called each time an invisible property is referenced from the object |
|
632 | - * |
|
633 | - * @access public |
|
634 | - * |
|
635 | - * @param string $var: Name of variable to get |
|
636 | - * |
|
637 | - * @return mixed Value of $this->$var |
|
638 | - */ |
|
639 | - public function __get($var) { |
|
630 | + /** |
|
631 | + * This magic method is called each time an invisible property is referenced from the object |
|
632 | + * |
|
633 | + * @access public |
|
634 | + * |
|
635 | + * @param string $var: Name of variable to get |
|
636 | + * |
|
637 | + * @return mixed Value of $this->$var |
|
638 | + */ |
|
639 | + public function __get($var) { |
|
640 | 640 | |
641 | - $method = '_get'.ucfirst($var); |
|
641 | + $method = '_get'.ucfirst($var); |
|
642 | 642 | |
643 | - if (!property_exists($this, $var) || !method_exists($this, $method)) { |
|
643 | + if (!property_exists($this, $var) || !method_exists($this, $method)) { |
|
644 | 644 | |
645 | - if (TYPO3_DLOG) { |
|
645 | + if (TYPO3_DLOG) { |
|
646 | 646 | |
647 | - \TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[tx_dlf_solr->__get('.$var.')] There is no getter function for property "'.$var.'"', self::$extKey, SYSLOG_SEVERITY_WARNING); |
|
647 | + \TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[tx_dlf_solr->__get('.$var.')] There is no getter function for property "'.$var.'"', self::$extKey, SYSLOG_SEVERITY_WARNING); |
|
648 | 648 | |
649 | - } |
|
649 | + } |
|
650 | 650 | |
651 | - return; |
|
651 | + return; |
|
652 | 652 | |
653 | - } else { |
|
653 | + } else { |
|
654 | 654 | |
655 | - return $this->$method(); |
|
655 | + return $this->$method(); |
|
656 | 656 | |
657 | - } |
|
657 | + } |
|
658 | 658 | |
659 | - } |
|
659 | + } |
|
660 | 660 | |
661 | - /** |
|
662 | - * This magic method is called each time an invisible property is referenced from the object |
|
663 | - * |
|
664 | - * @access public |
|
665 | - * |
|
666 | - * @param string $var: Name of variable to set |
|
667 | - * @param mixed $value: New value of variable |
|
668 | - * |
|
669 | - * @return void |
|
670 | - */ |
|
671 | - public function __set($var, $value) { |
|
661 | + /** |
|
662 | + * This magic method is called each time an invisible property is referenced from the object |
|
663 | + * |
|
664 | + * @access public |
|
665 | + * |
|
666 | + * @param string $var: Name of variable to set |
|
667 | + * @param mixed $value: New value of variable |
|
668 | + * |
|
669 | + * @return void |
|
670 | + */ |
|
671 | + public function __set($var, $value) { |
|
672 | 672 | |
673 | - $method = '_set'.ucfirst($var); |
|
673 | + $method = '_set'.ucfirst($var); |
|
674 | 674 | |
675 | - if (!property_exists($this, $var) || !method_exists($this, $method)) { |
|
675 | + if (!property_exists($this, $var) || !method_exists($this, $method)) { |
|
676 | 676 | |
677 | - if (TYPO3_DLOG) { |
|
677 | + if (TYPO3_DLOG) { |
|
678 | 678 | |
679 | - \TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[tx_dlf_solr->__set('.$var.', [data])] There is no setter function for property "'.$var.'"', self::$extKey, SYSLOG_SEVERITY_WARNING, $value); |
|
679 | + \TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[tx_dlf_solr->__set('.$var.', [data])] There is no setter function for property "'.$var.'"', self::$extKey, SYSLOG_SEVERITY_WARNING, $value); |
|
680 | 680 | |
681 | - } |
|
681 | + } |
|
682 | 682 | |
683 | - } else { |
|
683 | + } else { |
|
684 | 684 | |
685 | - $this->$method($value); |
|
685 | + $this->$method($value); |
|
686 | 686 | |
687 | - } |
|
687 | + } |
|
688 | 688 | |
689 | - } |
|
689 | + } |
|
690 | 690 | |
691 | - /** |
|
692 | - * This is a singleton class, thus the constructor should be private/protected |
|
693 | - * |
|
694 | - * @access protected |
|
695 | - * |
|
696 | - * @param string $core: The name of the core to use |
|
697 | - * |
|
698 | - * @return void |
|
699 | - */ |
|
700 | - protected function __construct($core) { |
|
691 | + /** |
|
692 | + * This is a singleton class, thus the constructor should be private/protected |
|
693 | + * |
|
694 | + * @access protected |
|
695 | + * |
|
696 | + * @param string $core: The name of the core to use |
|
697 | + * |
|
698 | + * @return void |
|
699 | + */ |
|
700 | + protected function __construct($core) { |
|
701 | 701 | |
702 | - // Load class. |
|
703 | - if (!class_exists('Apache_Solr_Service')) { |
|
702 | + // Load class. |
|
703 | + if (!class_exists('Apache_Solr_Service')) { |
|
704 | 704 | |
705 | - require_once(\TYPO3\CMS\Core\Utility\GeneralUtility::getFileAbsFileName('EXT:'.self::$extKey.'/lib/SolrPhpClient/Apache/Solr/Service.php')); |
|
705 | + require_once(\TYPO3\CMS\Core\Utility\GeneralUtility::getFileAbsFileName('EXT:'.self::$extKey.'/lib/SolrPhpClient/Apache/Solr/Service.php')); |
|
706 | 706 | |
707 | - } |
|
707 | + } |
|
708 | 708 | |
709 | - $solrInfo = self::getSolrConnectionInfo($core); |
|
709 | + $solrInfo = self::getSolrConnectionInfo($core); |
|
710 | 710 | |
711 | - // Instantiate Apache_Solr_Service class. |
|
712 | - $this->service = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('Apache_Solr_Service', $solrInfo['host'], $solrInfo['port'], $solrInfo['path']); |
|
711 | + // Instantiate Apache_Solr_Service class. |
|
712 | + $this->service = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('Apache_Solr_Service', $solrInfo['host'], $solrInfo['port'], $solrInfo['path']); |
|
713 | 713 | |
714 | - // Check if connection is established. |
|
715 | - if ($this->service->ping() !== FALSE) { |
|
714 | + // Check if connection is established. |
|
715 | + if ($this->service->ping() !== FALSE) { |
|
716 | 716 | |
717 | - // Do not collapse single value arrays. |
|
718 | - $this->service->setCollapseSingleValueArrays = FALSE; |
|
717 | + // Do not collapse single value arrays. |
|
718 | + $this->service->setCollapseSingleValueArrays = FALSE; |
|
719 | 719 | |
720 | - // Set core name. |
|
721 | - $this->core = $core; |
|
720 | + // Set core name. |
|
721 | + $this->core = $core; |
|
722 | 722 | |
723 | - // Instantiation successful! |
|
724 | - $this->ready = TRUE; |
|
723 | + // Instantiation successful! |
|
724 | + $this->ready = TRUE; |
|
725 | 725 | |
726 | - } |
|
726 | + } |
|
727 | 727 | |
728 | - } |
|
728 | + } |
|
729 | 729 | |
730 | 730 | } |
@@ -19,159 +19,159 @@ |
||
19 | 19 | */ |
20 | 20 | class tx_dlf_mods implements tx_dlf_format { |
21 | 21 | |
22 | - /** |
|
23 | - * This extracts the essential MODS metadata from XML |
|
24 | - * |
|
25 | - * @access public |
|
26 | - * |
|
27 | - * @param SimpleXMLElement $xml: The XML to extract the metadata from |
|
28 | - * @param array &$metadata: The metadata array to fill |
|
29 | - * |
|
30 | - * @return void |
|
31 | - */ |
|
32 | - public function extractMetadata(SimpleXMLElement $xml, array &$metadata) { |
|
22 | + /** |
|
23 | + * This extracts the essential MODS metadata from XML |
|
24 | + * |
|
25 | + * @access public |
|
26 | + * |
|
27 | + * @param SimpleXMLElement $xml: The XML to extract the metadata from |
|
28 | + * @param array &$metadata: The metadata array to fill |
|
29 | + * |
|
30 | + * @return void |
|
31 | + */ |
|
32 | + public function extractMetadata(SimpleXMLElement $xml, array &$metadata) { |
|
33 | 33 | |
34 | - $xml->registerXPathNamespace('mods', 'http://www.loc.gov/mods/v3'); |
|
34 | + $xml->registerXPathNamespace('mods', 'http://www.loc.gov/mods/v3'); |
|
35 | 35 | |
36 | - // Get "author" and "author_sorting". |
|
37 | - $authors = $xml->xpath('./mods:name[./mods:role/mods:roleTerm[@type="code" and @authority="marcrelator"]="aut"]'); |
|
36 | + // Get "author" and "author_sorting". |
|
37 | + $authors = $xml->xpath('./mods:name[./mods:role/mods:roleTerm[@type="code" and @authority="marcrelator"]="aut"]'); |
|
38 | 38 | |
39 | - // Get "author" and "author_sorting" again if that was to sophisticated. |
|
40 | - if (!$authors) { |
|
39 | + // Get "author" and "author_sorting" again if that was to sophisticated. |
|
40 | + if (!$authors) { |
|
41 | 41 | |
42 | - // Get all names which do not have any role term assigned and assume these are authors. |
|
43 | - $authors = $xml->xpath('./mods:name[not(./mods:role)]'); |
|
42 | + // Get all names which do not have any role term assigned and assume these are authors. |
|
43 | + $authors = $xml->xpath('./mods:name[not(./mods:role)]'); |
|
44 | 44 | |
45 | - } |
|
45 | + } |
|
46 | 46 | |
47 | - if (is_array($authors)) { |
|
47 | + if (is_array($authors)) { |
|
48 | 48 | |
49 | - for ($i = 0, $j = count($authors); $i < $j; $i++) { |
|
49 | + for ($i = 0, $j = count($authors); $i < $j; $i++) { |
|
50 | 50 | |
51 | - $authors[$i]->registerXPathNamespace('mods', 'http://www.loc.gov/mods/v3'); |
|
51 | + $authors[$i]->registerXPathNamespace('mods', 'http://www.loc.gov/mods/v3'); |
|
52 | 52 | |
53 | - // Check if there is a display form. |
|
54 | - if (($displayForm = $authors[$i]->xpath('./mods:displayForm'))) { |
|
53 | + // Check if there is a display form. |
|
54 | + if (($displayForm = $authors[$i]->xpath('./mods:displayForm'))) { |
|
55 | 55 | |
56 | - $metadata['author'][$i] = (string) $displayForm[0]; |
|
56 | + $metadata['author'][$i] = (string) $displayForm[0]; |
|
57 | 57 | |
58 | - } elseif (($nameParts = $authors[$i]->xpath('./mods:namePart'))) { |
|
58 | + } elseif (($nameParts = $authors[$i]->xpath('./mods:namePart'))) { |
|
59 | 59 | |
60 | - $name = array (); |
|
60 | + $name = array (); |
|
61 | 61 | |
62 | - $k = 4; |
|
62 | + $k = 4; |
|
63 | 63 | |
64 | - foreach ($nameParts as $namePart) { |
|
64 | + foreach ($nameParts as $namePart) { |
|
65 | 65 | |
66 | - if (isset($namePart['type']) && (string) $namePart['type'] == 'family') { |
|
66 | + if (isset($namePart['type']) && (string) $namePart['type'] == 'family') { |
|
67 | 67 | |
68 | - $name[0] = (string) $namePart; |
|
68 | + $name[0] = (string) $namePart; |
|
69 | 69 | |
70 | - } elseif (isset($namePart['type']) && (string) $namePart['type'] == 'given') { |
|
70 | + } elseif (isset($namePart['type']) && (string) $namePart['type'] == 'given') { |
|
71 | 71 | |
72 | - $name[1] = (string) $namePart; |
|
72 | + $name[1] = (string) $namePart; |
|
73 | 73 | |
74 | - } elseif (isset($namePart['type']) && (string) $namePart['type'] == 'termsOfAddress') { |
|
74 | + } elseif (isset($namePart['type']) && (string) $namePart['type'] == 'termsOfAddress') { |
|
75 | 75 | |
76 | - $name[2] = (string) $namePart; |
|
76 | + $name[2] = (string) $namePart; |
|
77 | 77 | |
78 | - } elseif (isset($namePart['type']) && (string) $namePart['type'] == 'date') { |
|
78 | + } elseif (isset($namePart['type']) && (string) $namePart['type'] == 'date') { |
|
79 | 79 | |
80 | - $name[3] = (string) $namePart; |
|
80 | + $name[3] = (string) $namePart; |
|
81 | 81 | |
82 | - } else { |
|
82 | + } else { |
|
83 | 83 | |
84 | - $name[$k] = (string) $namePart; |
|
84 | + $name[$k] = (string) $namePart; |
|
85 | 85 | |
86 | - } |
|
86 | + } |
|
87 | 87 | |
88 | - $k++; |
|
88 | + $k++; |
|
89 | 89 | |
90 | - } |
|
90 | + } |
|
91 | 91 | |
92 | - ksort($name); |
|
92 | + ksort($name); |
|
93 | 93 | |
94 | - $metadata['author'][$i] = trim(implode(', ', $name)); |
|
94 | + $metadata['author'][$i] = trim(implode(', ', $name)); |
|
95 | 95 | |
96 | - } |
|
96 | + } |
|
97 | 97 | |
98 | - } |
|
98 | + } |
|
99 | 99 | |
100 | - } |
|
100 | + } |
|
101 | 101 | |
102 | - // Get "place" and "place_sorting". |
|
103 | - $places = $xml->xpath('./mods:originInfo[not(./mods:edition="[Electronic ed.]")]/mods:place/mods:placeTerm'); |
|
102 | + // Get "place" and "place_sorting". |
|
103 | + $places = $xml->xpath('./mods:originInfo[not(./mods:edition="[Electronic ed.]")]/mods:place/mods:placeTerm'); |
|
104 | 104 | |
105 | - // Get "place" and "place_sorting" again if that was to sophisticated. |
|
106 | - if (!$places) { |
|
105 | + // Get "place" and "place_sorting" again if that was to sophisticated. |
|
106 | + if (!$places) { |
|
107 | 107 | |
108 | - // Get all places and assume these are places of publication. |
|
109 | - $places = $xml->xpath('./mods:originInfo/mods:place/mods:placeTerm'); |
|
108 | + // Get all places and assume these are places of publication. |
|
109 | + $places = $xml->xpath('./mods:originInfo/mods:place/mods:placeTerm'); |
|
110 | 110 | |
111 | - } |
|
111 | + } |
|
112 | 112 | |
113 | - if (is_array($places)) { |
|
113 | + if (is_array($places)) { |
|
114 | 114 | |
115 | - foreach ($places as $place) { |
|
115 | + foreach ($places as $place) { |
|
116 | 116 | |
117 | - $metadata['place'][] = (string) $place; |
|
117 | + $metadata['place'][] = (string) $place; |
|
118 | 118 | |
119 | - if (!$metadata['place_sorting'][0]) { |
|
119 | + if (!$metadata['place_sorting'][0]) { |
|
120 | 120 | |
121 | - $metadata['place_sorting'][0] = preg_replace('/[[:punct:]]/', '', (string) $place); |
|
121 | + $metadata['place_sorting'][0] = preg_replace('/[[:punct:]]/', '', (string) $place); |
|
122 | 122 | |
123 | - } |
|
123 | + } |
|
124 | 124 | |
125 | - } |
|
125 | + } |
|
126 | 126 | |
127 | - } |
|
127 | + } |
|
128 | 128 | |
129 | - // Get "year_sorting". |
|
130 | - if (($years_sorting = $xml->xpath('./mods:originInfo[not(./mods:edition="[Electronic ed.]")]/mods:dateOther[@type="order" and @encoding="w3cdtf"]'))) { |
|
129 | + // Get "year_sorting". |
|
130 | + if (($years_sorting = $xml->xpath('./mods:originInfo[not(./mods:edition="[Electronic ed.]")]/mods:dateOther[@type="order" and @encoding="w3cdtf"]'))) { |
|
131 | 131 | |
132 | - foreach ($years_sorting as $year_sorting) { |
|
132 | + foreach ($years_sorting as $year_sorting) { |
|
133 | 133 | |
134 | - $metadata['year_sorting'][0] = intval($year_sorting); |
|
134 | + $metadata['year_sorting'][0] = intval($year_sorting); |
|
135 | 135 | |
136 | - } |
|
136 | + } |
|
137 | 137 | |
138 | - } |
|
138 | + } |
|
139 | 139 | |
140 | - // Get "year" and "year_sorting" if not specified separately. |
|
141 | - $years = $xml->xpath('./mods:originInfo[not(./mods:edition="[Electronic ed.]")]/mods:dateIssued[@keyDate="yes"]'); |
|
140 | + // Get "year" and "year_sorting" if not specified separately. |
|
141 | + $years = $xml->xpath('./mods:originInfo[not(./mods:edition="[Electronic ed.]")]/mods:dateIssued[@keyDate="yes"]'); |
|
142 | 142 | |
143 | - // Get "year" and "year_sorting" again if that was to sophisticated. |
|
144 | - if (!$years) { |
|
143 | + // Get "year" and "year_sorting" again if that was to sophisticated. |
|
144 | + if (!$years) { |
|
145 | 145 | |
146 | - // Get all dates and assume these are dates of publication. |
|
147 | - $years = $xml->xpath('./mods:originInfo/mods:dateIssued'); |
|
146 | + // Get all dates and assume these are dates of publication. |
|
147 | + $years = $xml->xpath('./mods:originInfo/mods:dateIssued'); |
|
148 | 148 | |
149 | - } |
|
149 | + } |
|
150 | 150 | |
151 | - if (is_array($years)) { |
|
151 | + if (is_array($years)) { |
|
152 | 152 | |
153 | - foreach ($years as $year) { |
|
153 | + foreach ($years as $year) { |
|
154 | 154 | |
155 | - $metadata['year'][] = (string) $year; |
|
155 | + $metadata['year'][] = (string) $year; |
|
156 | 156 | |
157 | - if (!$metadata['year_sorting'][0]) { |
|
157 | + if (!$metadata['year_sorting'][0]) { |
|
158 | 158 | |
159 | - $year_sorting = str_ireplace('x', '5', preg_replace('/[^\d.x]/i', '', (string) $year)); |
|
159 | + $year_sorting = str_ireplace('x', '5', preg_replace('/[^\d.x]/i', '', (string) $year)); |
|
160 | 160 | |
161 | - if (strpos($year_sorting, '.') || strlen($year_sorting) < 3) { |
|
161 | + if (strpos($year_sorting, '.') || strlen($year_sorting) < 3) { |
|
162 | 162 | |
163 | - $year_sorting = ((intval(trim($year_sorting, '.')) - 1) * 100) + 50; |
|
163 | + $year_sorting = ((intval(trim($year_sorting, '.')) - 1) * 100) + 50; |
|
164 | 164 | |
165 | - } |
|
165 | + } |
|
166 | 166 | |
167 | - $metadata['year_sorting'][0] = intval($year_sorting); |
|
167 | + $metadata['year_sorting'][0] = intval($year_sorting); |
|
168 | 168 | |
169 | - } |
|
169 | + } |
|
170 | 170 | |
171 | - } |
|
171 | + } |
|
172 | 172 | |
173 | - } |
|
173 | + } |
|
174 | 174 | |
175 | - } |
|
175 | + } |
|
176 | 176 | |
177 | 177 | } |
@@ -19,893 +19,893 @@ |
||
19 | 19 | */ |
20 | 20 | class tx_dlf_list implements ArrayAccess, Countable, Iterator, \TYPO3\CMS\Core\SingletonInterface { |
21 | 21 | |
22 | - /** |
|
23 | - * This holds the number of documents in the list |
|
24 | - * @see Countable |
|
25 | - * |
|
26 | - * @var integer |
|
27 | - * @access protected |
|
28 | - */ |
|
29 | - protected $count = 0; |
|
30 | - |
|
31 | - /** |
|
32 | - * This holds the list entries in sorted order |
|
33 | - * @see ArrayAccess |
|
34 | - * |
|
35 | - * @var array() |
|
36 | - * @access protected |
|
37 | - */ |
|
38 | - protected $elements = array (); |
|
39 | - |
|
40 | - /** |
|
41 | - * This holds the list's metadata |
|
42 | - * |
|
43 | - * @var array |
|
44 | - * @access protected |
|
45 | - */ |
|
46 | - protected $metadata = array (); |
|
47 | - |
|
48 | - /** |
|
49 | - * This holds the current list position |
|
50 | - * @see Iterator |
|
51 | - * |
|
52 | - * @var integer |
|
53 | - * @access protected |
|
54 | - */ |
|
55 | - protected $position = 0; |
|
56 | - |
|
57 | - /** |
|
58 | - * This holds the full records of already processed list elements |
|
59 | - * |
|
60 | - * @var array() |
|
61 | - * @access protected |
|
62 | - */ |
|
63 | - protected $records = array (); |
|
64 | - |
|
65 | - /** |
|
66 | - * Instance of Apache_Solr_Service class |
|
67 | - * |
|
68 | - * @var Apache_Solr_Service |
|
69 | - * @access protected |
|
70 | - */ |
|
71 | - protected $solr; |
|
72 | - |
|
73 | - /** |
|
74 | - * This holds the Solr metadata configuration |
|
75 | - * |
|
76 | - * @var array |
|
77 | - * @access protected |
|
78 | - */ |
|
79 | - protected $solrConfig = array (); |
|
80 | - |
|
81 | - /** |
|
82 | - * This adds an array of elements at the given position to the list |
|
83 | - * |
|
84 | - * @access public |
|
85 | - * |
|
86 | - * @param array $elements: Array of elements to add to list |
|
87 | - * @param integer $position: Numeric position for including |
|
88 | - * |
|
89 | - * @return void |
|
90 | - */ |
|
91 | - public function add(array $elements, $position = -1) { |
|
92 | - |
|
93 | - $position = \TYPO3\CMS\Core\Utility\MathUtility::forceIntegerInRange($position, 0, $this->count, $this->count); |
|
94 | - |
|
95 | - if (!empty($elements)) { |
|
96 | - |
|
97 | - array_splice($this->elements, $position, 0, $elements); |
|
98 | - |
|
99 | - $this->count = count($this->elements); |
|
100 | - |
|
101 | - } |
|
102 | - |
|
103 | - } |
|
104 | - |
|
105 | - /** |
|
106 | - * This counts the elements |
|
107 | - * @see Countable::count() |
|
108 | - * |
|
109 | - * @access public |
|
110 | - * |
|
111 | - * @return integer The number of elements in the list |
|
112 | - */ |
|
113 | - public function count() { |
|
22 | + /** |
|
23 | + * This holds the number of documents in the list |
|
24 | + * @see Countable |
|
25 | + * |
|
26 | + * @var integer |
|
27 | + * @access protected |
|
28 | + */ |
|
29 | + protected $count = 0; |
|
30 | + |
|
31 | + /** |
|
32 | + * This holds the list entries in sorted order |
|
33 | + * @see ArrayAccess |
|
34 | + * |
|
35 | + * @var array() |
|
36 | + * @access protected |
|
37 | + */ |
|
38 | + protected $elements = array (); |
|
39 | + |
|
40 | + /** |
|
41 | + * This holds the list's metadata |
|
42 | + * |
|
43 | + * @var array |
|
44 | + * @access protected |
|
45 | + */ |
|
46 | + protected $metadata = array (); |
|
47 | + |
|
48 | + /** |
|
49 | + * This holds the current list position |
|
50 | + * @see Iterator |
|
51 | + * |
|
52 | + * @var integer |
|
53 | + * @access protected |
|
54 | + */ |
|
55 | + protected $position = 0; |
|
56 | + |
|
57 | + /** |
|
58 | + * This holds the full records of already processed list elements |
|
59 | + * |
|
60 | + * @var array() |
|
61 | + * @access protected |
|
62 | + */ |
|
63 | + protected $records = array (); |
|
64 | + |
|
65 | + /** |
|
66 | + * Instance of Apache_Solr_Service class |
|
67 | + * |
|
68 | + * @var Apache_Solr_Service |
|
69 | + * @access protected |
|
70 | + */ |
|
71 | + protected $solr; |
|
72 | + |
|
73 | + /** |
|
74 | + * This holds the Solr metadata configuration |
|
75 | + * |
|
76 | + * @var array |
|
77 | + * @access protected |
|
78 | + */ |
|
79 | + protected $solrConfig = array (); |
|
80 | + |
|
81 | + /** |
|
82 | + * This adds an array of elements at the given position to the list |
|
83 | + * |
|
84 | + * @access public |
|
85 | + * |
|
86 | + * @param array $elements: Array of elements to add to list |
|
87 | + * @param integer $position: Numeric position for including |
|
88 | + * |
|
89 | + * @return void |
|
90 | + */ |
|
91 | + public function add(array $elements, $position = -1) { |
|
92 | + |
|
93 | + $position = \TYPO3\CMS\Core\Utility\MathUtility::forceIntegerInRange($position, 0, $this->count, $this->count); |
|
94 | + |
|
95 | + if (!empty($elements)) { |
|
96 | + |
|
97 | + array_splice($this->elements, $position, 0, $elements); |
|
98 | + |
|
99 | + $this->count = count($this->elements); |
|
100 | + |
|
101 | + } |
|
102 | + |
|
103 | + } |
|
104 | + |
|
105 | + /** |
|
106 | + * This counts the elements |
|
107 | + * @see Countable::count() |
|
108 | + * |
|
109 | + * @access public |
|
110 | + * |
|
111 | + * @return integer The number of elements in the list |
|
112 | + */ |
|
113 | + public function count() { |
|
114 | 114 | |
115 | - return $this->count; |
|
115 | + return $this->count; |
|
116 | 116 | |
117 | - } |
|
117 | + } |
|
118 | 118 | |
119 | - /** |
|
120 | - * This returns the current element |
|
121 | - * @see Iterator::current() |
|
122 | - * |
|
123 | - * @access public |
|
124 | - * |
|
125 | - * @return array The current element |
|
126 | - */ |
|
127 | - public function current() { |
|
119 | + /** |
|
120 | + * This returns the current element |
|
121 | + * @see Iterator::current() |
|
122 | + * |
|
123 | + * @access public |
|
124 | + * |
|
125 | + * @return array The current element |
|
126 | + */ |
|
127 | + public function current() { |
|
128 | 128 | |
129 | - if ($this->valid()) { |
|
129 | + if ($this->valid()) { |
|
130 | 130 | |
131 | - return $this->getRecord($this->elements[$this->position]); |
|
131 | + return $this->getRecord($this->elements[$this->position]); |
|
132 | 132 | |
133 | - } else { |
|
133 | + } else { |
|
134 | 134 | |
135 | - if (TYPO3_DLOG) { |
|
135 | + if (TYPO3_DLOG) { |
|
136 | 136 | |
137 | - \TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[tx_dlf_list->current()] Invalid position "'.$this->position.'" for list element', $this->extKey, SYSLOG_SEVERITY_NOTICE); |
|
137 | + \TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[tx_dlf_list->current()] Invalid position "'.$this->position.'" for list element', $this->extKey, SYSLOG_SEVERITY_NOTICE); |
|
138 | 138 | |
139 | - } |
|
139 | + } |
|
140 | 140 | |
141 | - return; |
|
141 | + return; |
|
142 | 142 | |
143 | - } |
|
143 | + } |
|
144 | 144 | |
145 | - } |
|
145 | + } |
|
146 | 146 | |
147 | - /** |
|
148 | - * This returns the full record of any list element |
|
149 | - * |
|
150 | - * @access protected |
|
151 | - * |
|
152 | - * @param mixed $element: The list element |
|
153 | - * |
|
154 | - * @return mixed The element's full record |
|
155 | - */ |
|
156 | - protected function getRecord($element) { |
|
147 | + /** |
|
148 | + * This returns the full record of any list element |
|
149 | + * |
|
150 | + * @access protected |
|
151 | + * |
|
152 | + * @param mixed $element: The list element |
|
153 | + * |
|
154 | + * @return mixed The element's full record |
|
155 | + */ |
|
156 | + protected function getRecord($element) { |
|
157 | 157 | |
158 | - if (is_array($element) && array_keys($element) == array ('u', 'h', 's', 'p')) { |
|
158 | + if (is_array($element) && array_keys($element) == array ('u', 'h', 's', 'p')) { |
|
159 | 159 | |
160 | - // Return already processed record if possible. |
|
161 | - if (!empty($this->records[$element['u']])) { |
|
160 | + // Return already processed record if possible. |
|
161 | + if (!empty($this->records[$element['u']])) { |
|
162 | 162 | |
163 | - return $this->records[$element['u']]; |
|
163 | + return $this->records[$element['u']]; |
|
164 | 164 | |
165 | - } |
|
165 | + } |
|
166 | 166 | |
167 | - $record = array ( |
|
168 | - 'uid' => $element['u'], |
|
169 | - 'page' => 1, |
|
170 | - 'preview' => '', |
|
171 | - 'subparts' => $element['p'] |
|
172 | - ); |
|
167 | + $record = array ( |
|
168 | + 'uid' => $element['u'], |
|
169 | + 'page' => 1, |
|
170 | + 'preview' => '', |
|
171 | + 'subparts' => $element['p'] |
|
172 | + ); |
|
173 | 173 | |
174 | - // Check if it's a list of database records or Solr documents. |
|
175 | - if (!empty($this->metadata['options']['source']) && $this->metadata['options']['source'] == 'collection') { |
|
174 | + // Check if it's a list of database records or Solr documents. |
|
175 | + if (!empty($this->metadata['options']['source']) && $this->metadata['options']['source'] == 'collection') { |
|
176 | 176 | |
177 | - // Get document's thumbnail and metadata from database. |
|
178 | - $result = $GLOBALS['TYPO3_DB']->exec_SELECTquery( |
|
179 | - 'tx_dlf_documents.uid AS uid,tx_dlf_documents.thumbnail AS thumbnail,tx_dlf_documents.metadata AS metadata', |
|
180 | - 'tx_dlf_documents', |
|
181 | - '(tx_dlf_documents.uid='.intval($record['uid']).' OR tx_dlf_documents.partof='.intval($record['uid']).')'.tx_dlf_helper::whereClause('tx_dlf_documents'), |
|
182 | - '', |
|
183 | - '', |
|
184 | - '' |
|
185 | - ); |
|
177 | + // Get document's thumbnail and metadata from database. |
|
178 | + $result = $GLOBALS['TYPO3_DB']->exec_SELECTquery( |
|
179 | + 'tx_dlf_documents.uid AS uid,tx_dlf_documents.thumbnail AS thumbnail,tx_dlf_documents.metadata AS metadata', |
|
180 | + 'tx_dlf_documents', |
|
181 | + '(tx_dlf_documents.uid='.intval($record['uid']).' OR tx_dlf_documents.partof='.intval($record['uid']).')'.tx_dlf_helper::whereClause('tx_dlf_documents'), |
|
182 | + '', |
|
183 | + '', |
|
184 | + '' |
|
185 | + ); |
|
186 | 186 | |
187 | - // Process results. |
|
188 | - while ($resArray = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($result)) { |
|
187 | + // Process results. |
|
188 | + while ($resArray = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($result)) { |
|
189 | 189 | |
190 | - // Prepare document's metadata. |
|
191 | - $metadata = unserialize($resArray['metadata']); |
|
190 | + // Prepare document's metadata. |
|
191 | + $metadata = unserialize($resArray['metadata']); |
|
192 | 192 | |
193 | - if (!empty($metadata['type'][0]) && \TYPO3\CMS\Core\Utility\MathUtility::canBeInterpretedAsInteger($metadata['type'][0])) { |
|
193 | + if (!empty($metadata['type'][0]) && \TYPO3\CMS\Core\Utility\MathUtility::canBeInterpretedAsInteger($metadata['type'][0])) { |
|
194 | 194 | |
195 | - $metadata['type'][0] = tx_dlf_helper::getIndexName($metadata['type'][0], 'tx_dlf_structures', $this->metadata['options']['pid']); |
|
195 | + $metadata['type'][0] = tx_dlf_helper::getIndexName($metadata['type'][0], 'tx_dlf_structures', $this->metadata['options']['pid']); |
|
196 | 196 | |
197 | - } |
|
197 | + } |
|
198 | 198 | |
199 | - if (!empty($metadata['owner'][0]) && \TYPO3\CMS\Core\Utility\MathUtility::canBeInterpretedAsInteger($metadata['owner'][0])) { |
|
199 | + if (!empty($metadata['owner'][0]) && \TYPO3\CMS\Core\Utility\MathUtility::canBeInterpretedAsInteger($metadata['owner'][0])) { |
|
200 | 200 | |
201 | - $metadata['owner'][0] = tx_dlf_helper::getIndexName($metadata['owner'][0], 'tx_dlf_libraries', $this->metadata['options']['pid']); |
|
201 | + $metadata['owner'][0] = tx_dlf_helper::getIndexName($metadata['owner'][0], 'tx_dlf_libraries', $this->metadata['options']['pid']); |
|
202 | 202 | |
203 | - } |
|
203 | + } |
|
204 | 204 | |
205 | - if (!empty($metadata['collection']) && is_array($metadata['collection'])) { |
|
205 | + if (!empty($metadata['collection']) && is_array($metadata['collection'])) { |
|
206 | 206 | |
207 | - foreach ($metadata['collection'] as $i => $collection) { |
|
207 | + foreach ($metadata['collection'] as $i => $collection) { |
|
208 | 208 | |
209 | - if (\TYPO3\CMS\Core\Utility\MathUtility::canBeInterpretedAsInteger($collection)) { |
|
209 | + if (\TYPO3\CMS\Core\Utility\MathUtility::canBeInterpretedAsInteger($collection)) { |
|
210 | 210 | |
211 | - $metadata['collection'][$i] = tx_dlf_helper::getIndexName($metadata['collection'][$i], 'tx_dlf_collections', $this->metadata['options']['pid']); |
|
211 | + $metadata['collection'][$i] = tx_dlf_helper::getIndexName($metadata['collection'][$i], 'tx_dlf_collections', $this->metadata['options']['pid']); |
|
212 | 212 | |
213 | - } |
|
213 | + } |
|
214 | 214 | |
215 | - } |
|
215 | + } |
|
216 | 216 | |
217 | - } |
|
217 | + } |
|
218 | 218 | |
219 | - // Add metadata to list element. |
|
220 | - if ($resArray['uid'] == $record['uid']) { |
|
219 | + // Add metadata to list element. |
|
220 | + if ($resArray['uid'] == $record['uid']) { |
|
221 | 221 | |
222 | - $record['thumbnail'] = $resArray['thumbnail']; |
|
222 | + $record['thumbnail'] = $resArray['thumbnail']; |
|
223 | 223 | |
224 | - $record['metadata'] = $metadata; |
|
224 | + $record['metadata'] = $metadata; |
|
225 | 225 | |
226 | - } elseif (($key = tx_dlf_helper::array_search_recursive($resArray['uid'], $record['subparts'], TRUE)) !== FALSE) { |
|
226 | + } elseif (($key = tx_dlf_helper::array_search_recursive($resArray['uid'], $record['subparts'], TRUE)) !== FALSE) { |
|
227 | 227 | |
228 | - $record['subparts'][$key] = array ( |
|
229 | - 'uid' => $resArray['uid'], |
|
230 | - 'page' => 1, |
|
231 | - 'preview' => (!empty($record['subparts'][$key]['h']) ? $record['subparts'][$key]['h'] : ''), |
|
232 | - 'thumbnail' => $resArray['thumbnail'], |
|
233 | - 'metadata' => $metadata |
|
234 | - ); |
|
228 | + $record['subparts'][$key] = array ( |
|
229 | + 'uid' => $resArray['uid'], |
|
230 | + 'page' => 1, |
|
231 | + 'preview' => (!empty($record['subparts'][$key]['h']) ? $record['subparts'][$key]['h'] : ''), |
|
232 | + 'thumbnail' => $resArray['thumbnail'], |
|
233 | + 'metadata' => $metadata |
|
234 | + ); |
|
235 | 235 | |
236 | - } |
|
236 | + } |
|
237 | 237 | |
238 | - } |
|
238 | + } |
|
239 | 239 | |
240 | - } elseif (!empty($this->metadata['options']['source']) && $this->metadata['options']['source'] == 'search') { |
|
240 | + } elseif (!empty($this->metadata['options']['source']) && $this->metadata['options']['source'] == 'search') { |
|
241 | 241 | |
242 | - if ($this->solrConnect()) { |
|
242 | + if ($this->solrConnect()) { |
|
243 | 243 | |
244 | - // Get document's thumbnail and metadata from Solr index. |
|
245 | - $result = $this->solr->service->search('uid:'.tx_dlf_solr::escapeQuery($record['uid']), 0, $this->solr->limit); |
|
244 | + // Get document's thumbnail and metadata from Solr index. |
|
245 | + $result = $this->solr->service->search('uid:'.tx_dlf_solr::escapeQuery($record['uid']), 0, $this->solr->limit); |
|
246 | 246 | |
247 | - // Process results. |
|
248 | - foreach ($result->response->docs as $resArray) { |
|
247 | + // Process results. |
|
248 | + foreach ($result->response->docs as $resArray) { |
|
249 | 249 | |
250 | - // Prepare document's metadata. |
|
251 | - $metadata = array (); |
|
250 | + // Prepare document's metadata. |
|
251 | + $metadata = array (); |
|
252 | 252 | |
253 | - foreach ($this->solrConfig as $index_name => $solr_name) { |
|
253 | + foreach ($this->solrConfig as $index_name => $solr_name) { |
|
254 | 254 | |
255 | - if (!empty($resArray->$solr_name)) { |
|
255 | + if (!empty($resArray->$solr_name)) { |
|
256 | 256 | |
257 | - $metadata[$index_name] = (is_array($resArray->$solr_name) ? $resArray->$solr_name : array ($resArray->$solr_name)); |
|
257 | + $metadata[$index_name] = (is_array($resArray->$solr_name) ? $resArray->$solr_name : array ($resArray->$solr_name)); |
|
258 | 258 | |
259 | - } |
|
259 | + } |
|
260 | 260 | |
261 | - } |
|
261 | + } |
|
262 | 262 | |
263 | - // Add metadata to list elements. |
|
264 | - if ($resArray->toplevel) { |
|
263 | + // Add metadata to list elements. |
|
264 | + if ($resArray->toplevel) { |
|
265 | 265 | |
266 | - $record['thumbnail'] = $resArray->thumbnail; |
|
266 | + $record['thumbnail'] = $resArray->thumbnail; |
|
267 | 267 | |
268 | - $record['metadata'] = $metadata; |
|
268 | + $record['metadata'] = $metadata; |
|
269 | 269 | |
270 | - } elseif (($key = tx_dlf_helper::array_search_recursive($resArray->id, $record['subparts'], TRUE)) !== FALSE) { |
|
270 | + } elseif (($key = tx_dlf_helper::array_search_recursive($resArray->id, $record['subparts'], TRUE)) !== FALSE) { |
|
271 | 271 | |
272 | - $record['subparts'][$key] = array ( |
|
273 | - 'uid' => $resArray->uid, |
|
274 | - 'page' => $resArray->page, |
|
275 | - 'preview' => (!empty($record['subparts'][$key]['h']) ? $record['subparts'][$key]['h'] : ''), |
|
276 | - 'thumbnail' => $resArray->thumbnail, |
|
277 | - 'metadata' => $metadata |
|
278 | - ); |
|
272 | + $record['subparts'][$key] = array ( |
|
273 | + 'uid' => $resArray->uid, |
|
274 | + 'page' => $resArray->page, |
|
275 | + 'preview' => (!empty($record['subparts'][$key]['h']) ? $record['subparts'][$key]['h'] : ''), |
|
276 | + 'thumbnail' => $resArray->thumbnail, |
|
277 | + 'metadata' => $metadata |
|
278 | + ); |
|
279 | 279 | |
280 | - } |
|
280 | + } |
|
281 | 281 | |
282 | - } |
|
282 | + } |
|
283 | 283 | |
284 | - } |
|
284 | + } |
|
285 | 285 | |
286 | - } |
|
286 | + } |
|
287 | 287 | |
288 | - // Save record for later usage. |
|
289 | - $this->records[$element['u']] = $record; |
|
288 | + // Save record for later usage. |
|
289 | + $this->records[$element['u']] = $record; |
|
290 | 290 | |
291 | - } else { |
|
291 | + } else { |
|
292 | 292 | |
293 | - if (TYPO3_DLOG) { |
|
293 | + if (TYPO3_DLOG) { |
|
294 | 294 | |
295 | - \TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[tx_dlf_list->getRecord([data])] No UID of list element to fetch full record', $this->extKey, SYSLOG_SEVERITY_NOTICE, $element); |
|
295 | + \TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[tx_dlf_list->getRecord([data])] No UID of list element to fetch full record', $this->extKey, SYSLOG_SEVERITY_NOTICE, $element); |
|
296 | 296 | |
297 | - } |
|
297 | + } |
|
298 | 298 | |
299 | - $record = $element; |
|
299 | + $record = $element; |
|
300 | 300 | |
301 | - } |
|
301 | + } |
|
302 | 302 | |
303 | - return $record; |
|
303 | + return $record; |
|
304 | 304 | |
305 | - } |
|
305 | + } |
|
306 | 306 | |
307 | - /** |
|
308 | - * This returns the current position |
|
309 | - * @see Iterator::key() |
|
310 | - * |
|
311 | - * @access public |
|
312 | - * |
|
313 | - * @return integer The current position |
|
314 | - */ |
|
315 | - public function key() { |
|
307 | + /** |
|
308 | + * This returns the current position |
|
309 | + * @see Iterator::key() |
|
310 | + * |
|
311 | + * @access public |
|
312 | + * |
|
313 | + * @return integer The current position |
|
314 | + */ |
|
315 | + public function key() { |
|
316 | 316 | |
317 | - return $this->position; |
|
317 | + return $this->position; |
|
318 | 318 | |
319 | - } |
|
319 | + } |
|
320 | 320 | |
321 | 321 | |
322 | 322 | |
323 | - /** |
|
324 | - * This moves the element at the given position up or down |
|
325 | - * |
|
326 | - * @access public |
|
327 | - * |
|
328 | - * @param integer $position: Numeric position for moving |
|
329 | - * @param integer $steps: Amount of steps to move up or down |
|
330 | - * |
|
331 | - * @return void |
|
332 | - */ |
|
333 | - public function move($position, $steps) { |
|
323 | + /** |
|
324 | + * This moves the element at the given position up or down |
|
325 | + * |
|
326 | + * @access public |
|
327 | + * |
|
328 | + * @param integer $position: Numeric position for moving |
|
329 | + * @param integer $steps: Amount of steps to move up or down |
|
330 | + * |
|
331 | + * @return void |
|
332 | + */ |
|
333 | + public function move($position, $steps) { |
|
334 | 334 | |
335 | - // Save parameters for logging purposes. |
|
336 | - $_position = $position; |
|
335 | + // Save parameters for logging purposes. |
|
336 | + $_position = $position; |
|
337 | 337 | |
338 | - $_steps = $steps; |
|
338 | + $_steps = $steps; |
|
339 | 339 | |
340 | - $position = intval($position); |
|
340 | + $position = intval($position); |
|
341 | 341 | |
342 | - // Check if list position is valid. |
|
343 | - if ($position < 0 || $position >= $this->count) { |
|
342 | + // Check if list position is valid. |
|
343 | + if ($position < 0 || $position >= $this->count) { |
|
344 | 344 | |
345 | - if (TYPO3_DLOG) { |
|
345 | + if (TYPO3_DLOG) { |
|
346 | 346 | |
347 | - \TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[tx_dlf_list->move('.$_position.', '.$_steps.')] Invalid position "'.$position.'" for element moving', $this->extKey, SYSLOG_SEVERITY_WARNING); |
|
347 | + \TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[tx_dlf_list->move('.$_position.', '.$_steps.')] Invalid position "'.$position.'" for element moving', $this->extKey, SYSLOG_SEVERITY_WARNING); |
|
348 | 348 | |
349 | - } |
|
349 | + } |
|
350 | 350 | |
351 | - return; |
|
351 | + return; |
|
352 | 352 | |
353 | - } |
|
353 | + } |
|
354 | 354 | |
355 | - $steps = intval($steps); |
|
355 | + $steps = intval($steps); |
|
356 | 356 | |
357 | - // Check if moving given amount of steps is possible. |
|
358 | - if (($position + $steps) < 0 || ($position + $steps) >= $this->count) { |
|
357 | + // Check if moving given amount of steps is possible. |
|
358 | + if (($position + $steps) < 0 || ($position + $steps) >= $this->count) { |
|
359 | 359 | |
360 | - if (TYPO3_DLOG) { |
|
360 | + if (TYPO3_DLOG) { |
|
361 | 361 | |
362 | - \TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[tx_dlf_list->move('.$_position.', '.$_steps.')] Invalid steps "'.$steps.'" for moving element at position "'.$position.'"', $this->extKey, SYSLOG_SEVERITY_WARNING); |
|
362 | + \TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[tx_dlf_list->move('.$_position.', '.$_steps.')] Invalid steps "'.$steps.'" for moving element at position "'.$position.'"', $this->extKey, SYSLOG_SEVERITY_WARNING); |
|
363 | 363 | |
364 | - } |
|
364 | + } |
|
365 | 365 | |
366 | - return; |
|
366 | + return; |
|
367 | 367 | |
368 | - } |
|
368 | + } |
|
369 | 369 | |
370 | - $element = $this->remove($position); |
|
370 | + $element = $this->remove($position); |
|
371 | 371 | |
372 | - $this->add(array ($element), $position + $steps); |
|
372 | + $this->add(array ($element), $position + $steps); |
|
373 | 373 | |
374 | - } |
|
374 | + } |
|
375 | 375 | |
376 | - /** |
|
377 | - * This moves the element at the given position up |
|
378 | - * |
|
379 | - * @access public |
|
380 | - * |
|
381 | - * @param integer $position: Numeric position for moving |
|
382 | - * |
|
383 | - * @return void |
|
384 | - */ |
|
385 | - public function moveUp($position) { |
|
376 | + /** |
|
377 | + * This moves the element at the given position up |
|
378 | + * |
|
379 | + * @access public |
|
380 | + * |
|
381 | + * @param integer $position: Numeric position for moving |
|
382 | + * |
|
383 | + * @return void |
|
384 | + */ |
|
385 | + public function moveUp($position) { |
|
386 | 386 | |
387 | - $this->move($position, -1); |
|
387 | + $this->move($position, -1); |
|
388 | 388 | |
389 | - } |
|
389 | + } |
|
390 | 390 | |
391 | - /** |
|
392 | - * This moves the element at the given position down |
|
393 | - * |
|
394 | - * @access public |
|
395 | - * |
|
396 | - * @param integer $position: Numeric position for moving |
|
397 | - * |
|
398 | - * @return void |
|
399 | - */ |
|
400 | - public function moveDown($position) { |
|
391 | + /** |
|
392 | + * This moves the element at the given position down |
|
393 | + * |
|
394 | + * @access public |
|
395 | + * |
|
396 | + * @param integer $position: Numeric position for moving |
|
397 | + * |
|
398 | + * @return void |
|
399 | + */ |
|
400 | + public function moveDown($position) { |
|
401 | 401 | |
402 | - $this->move($position, 1); |
|
402 | + $this->move($position, 1); |
|
403 | 403 | |
404 | - } |
|
404 | + } |
|
405 | 405 | |
406 | - /** |
|
407 | - * This increments the current list position |
|
408 | - * @see Iterator::next() |
|
409 | - * |
|
410 | - * @access public |
|
411 | - * |
|
412 | - * @return void |
|
413 | - */ |
|
414 | - public function next() { |
|
406 | + /** |
|
407 | + * This increments the current list position |
|
408 | + * @see Iterator::next() |
|
409 | + * |
|
410 | + * @access public |
|
411 | + * |
|
412 | + * @return void |
|
413 | + */ |
|
414 | + public function next() { |
|
415 | 415 | |
416 | - $this->position++; |
|
416 | + $this->position++; |
|
417 | 417 | |
418 | - } |
|
418 | + } |
|
419 | 419 | |
420 | - /** |
|
421 | - * This checks if an offset exists |
|
422 | - * @see ArrayAccess::offsetExists() |
|
423 | - * |
|
424 | - * @access public |
|
425 | - * |
|
426 | - * @param mixed $offset: The offset to check |
|
427 | - * |
|
428 | - * @return boolean Does the given offset exist? |
|
429 | - */ |
|
430 | - public function offsetExists($offset) { |
|
420 | + /** |
|
421 | + * This checks if an offset exists |
|
422 | + * @see ArrayAccess::offsetExists() |
|
423 | + * |
|
424 | + * @access public |
|
425 | + * |
|
426 | + * @param mixed $offset: The offset to check |
|
427 | + * |
|
428 | + * @return boolean Does the given offset exist? |
|
429 | + */ |
|
430 | + public function offsetExists($offset) { |
|
431 | 431 | |
432 | - return isset($this->elements[$offset]); |
|
432 | + return isset($this->elements[$offset]); |
|
433 | 433 | |
434 | - } |
|
434 | + } |
|
435 | 435 | |
436 | - /** |
|
437 | - * This returns the element at the given offset |
|
438 | - * @see ArrayAccess::offsetGet() |
|
439 | - * |
|
440 | - * @access public |
|
441 | - * |
|
442 | - * @param mixed $offset: The offset to return |
|
443 | - * |
|
444 | - * @return array The element at the given offset |
|
445 | - */ |
|
446 | - public function offsetGet($offset) { |
|
436 | + /** |
|
437 | + * This returns the element at the given offset |
|
438 | + * @see ArrayAccess::offsetGet() |
|
439 | + * |
|
440 | + * @access public |
|
441 | + * |
|
442 | + * @param mixed $offset: The offset to return |
|
443 | + * |
|
444 | + * @return array The element at the given offset |
|
445 | + */ |
|
446 | + public function offsetGet($offset) { |
|
447 | 447 | |
448 | - if ($this->offsetExists($offset)) { |
|
448 | + if ($this->offsetExists($offset)) { |
|
449 | 449 | |
450 | - return $this->getRecord($this->elements[$offset]); |
|
450 | + return $this->getRecord($this->elements[$offset]); |
|
451 | 451 | |
452 | - } else { |
|
452 | + } else { |
|
453 | 453 | |
454 | - if (TYPO3_DLOG) { |
|
454 | + if (TYPO3_DLOG) { |
|
455 | 455 | |
456 | - \TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[tx_dlf_list->offsetGet('.$offset.')] Invalid offset "'.$offset.'" for list element', $this->extKey, SYSLOG_SEVERITY_NOTICE); |
|
456 | + \TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[tx_dlf_list->offsetGet('.$offset.')] Invalid offset "'.$offset.'" for list element', $this->extKey, SYSLOG_SEVERITY_NOTICE); |
|
457 | 457 | |
458 | - } |
|
458 | + } |
|
459 | 459 | |
460 | - return; |
|
460 | + return; |
|
461 | 461 | |
462 | - } |
|
462 | + } |
|
463 | 463 | |
464 | - } |
|
464 | + } |
|
465 | 465 | |
466 | - /** |
|
467 | - * This sets the element at the given offset |
|
468 | - * @see ArrayAccess::offsetSet() |
|
469 | - * |
|
470 | - * @access public |
|
471 | - * |
|
472 | - * @param mixed $offset: The offset to set (non-integer offsets will be appended) |
|
473 | - * @param mixed $value: The value to set |
|
474 | - * |
|
475 | - * @return void |
|
476 | - */ |
|
477 | - public function offsetSet($offset, $value) { |
|
466 | + /** |
|
467 | + * This sets the element at the given offset |
|
468 | + * @see ArrayAccess::offsetSet() |
|
469 | + * |
|
470 | + * @access public |
|
471 | + * |
|
472 | + * @param mixed $offset: The offset to set (non-integer offsets will be appended) |
|
473 | + * @param mixed $value: The value to set |
|
474 | + * |
|
475 | + * @return void |
|
476 | + */ |
|
477 | + public function offsetSet($offset, $value) { |
|
478 | 478 | |
479 | - if (\TYPO3\CMS\Core\Utility\MathUtility::canBeInterpretedAsInteger($offset)) { |
|
479 | + if (\TYPO3\CMS\Core\Utility\MathUtility::canBeInterpretedAsInteger($offset)) { |
|
480 | 480 | |
481 | - $this->elements[$offset] = $value; |
|
481 | + $this->elements[$offset] = $value; |
|
482 | 482 | |
483 | - } else { |
|
483 | + } else { |
|
484 | 484 | |
485 | - $this->elements[] = $value; |
|
485 | + $this->elements[] = $value; |
|
486 | 486 | |
487 | - } |
|
487 | + } |
|
488 | 488 | |
489 | - // Re-number the elements. |
|
490 | - $this->elements = array_values($this->elements); |
|
489 | + // Re-number the elements. |
|
490 | + $this->elements = array_values($this->elements); |
|
491 | 491 | |
492 | - $this->count = count($this->elements); |
|
492 | + $this->count = count($this->elements); |
|
493 | 493 | |
494 | - } |
|
494 | + } |
|
495 | 495 | |
496 | - /** |
|
497 | - * This removes the element at the given position from the list |
|
498 | - * |
|
499 | - * @access public |
|
500 | - * |
|
501 | - * @param integer $position: Numeric position for removing |
|
502 | - * |
|
503 | - * @return array The removed element |
|
504 | - */ |
|
505 | - public function remove($position) { |
|
496 | + /** |
|
497 | + * This removes the element at the given position from the list |
|
498 | + * |
|
499 | + * @access public |
|
500 | + * |
|
501 | + * @param integer $position: Numeric position for removing |
|
502 | + * |
|
503 | + * @return array The removed element |
|
504 | + */ |
|
505 | + public function remove($position) { |
|
506 | 506 | |
507 | - // Save parameter for logging purposes. |
|
508 | - $_position = $position; |
|
507 | + // Save parameter for logging purposes. |
|
508 | + $_position = $position; |
|
509 | 509 | |
510 | - $position = intval($position); |
|
510 | + $position = intval($position); |
|
511 | 511 | |
512 | - if ($position < 0 || $position >= $this->count) { |
|
512 | + if ($position < 0 || $position >= $this->count) { |
|
513 | 513 | |
514 | - if (TYPO3_DLOG) { |
|
514 | + if (TYPO3_DLOG) { |
|
515 | 515 | |
516 | - \TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[tx_dlf_list->remove('.$_position.')] Invalid position "'.$position.'" for element removing', $this->extKey, SYSLOG_SEVERITY_WARNING); |
|
516 | + \TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[tx_dlf_list->remove('.$_position.')] Invalid position "'.$position.'" for element removing', $this->extKey, SYSLOG_SEVERITY_WARNING); |
|
517 | 517 | |
518 | - } |
|
518 | + } |
|
519 | 519 | |
520 | - return; |
|
520 | + return; |
|
521 | 521 | |
522 | - } |
|
522 | + } |
|
523 | 523 | |
524 | - $removed = array_splice($this->elements, $position, 1); |
|
524 | + $removed = array_splice($this->elements, $position, 1); |
|
525 | 525 | |
526 | - $this->count = count($this->elements); |
|
526 | + $this->count = count($this->elements); |
|
527 | 527 | |
528 | - return $this->getRecord($removed[0]); |
|
528 | + return $this->getRecord($removed[0]); |
|
529 | 529 | |
530 | - } |
|
530 | + } |
|
531 | 531 | |
532 | - /** |
|
533 | - * This clears the current list |
|
534 | - * |
|
535 | - * @access public |
|
536 | - * |
|
537 | - * @return void |
|
538 | - */ |
|
539 | - public function reset() { |
|
532 | + /** |
|
533 | + * This clears the current list |
|
534 | + * |
|
535 | + * @access public |
|
536 | + * |
|
537 | + * @return void |
|
538 | + */ |
|
539 | + public function reset() { |
|
540 | 540 | |
541 | - $this->elements = array (); |
|
541 | + $this->elements = array (); |
|
542 | 542 | |
543 | - $this->records = array (); |
|
543 | + $this->records = array (); |
|
544 | 544 | |
545 | - $this->metadata = array (); |
|
545 | + $this->metadata = array (); |
|
546 | 546 | |
547 | - $this->count = 0; |
|
547 | + $this->count = 0; |
|
548 | 548 | |
549 | - $this->position = 0; |
|
549 | + $this->position = 0; |
|
550 | 550 | |
551 | - } |
|
551 | + } |
|
552 | 552 | |
553 | - /** |
|
554 | - * This resets the list position |
|
555 | - * @see Iterator::rewind() |
|
556 | - * |
|
557 | - * @access public |
|
558 | - * |
|
559 | - * @return void |
|
560 | - */ |
|
561 | - public function rewind() { |
|
553 | + /** |
|
554 | + * This resets the list position |
|
555 | + * @see Iterator::rewind() |
|
556 | + * |
|
557 | + * @access public |
|
558 | + * |
|
559 | + * @return void |
|
560 | + */ |
|
561 | + public function rewind() { |
|
562 | 562 | |
563 | - $this->position = 0; |
|
563 | + $this->position = 0; |
|
564 | 564 | |
565 | - } |
|
565 | + } |
|
566 | 566 | |
567 | - /** |
|
568 | - * This saves the current list |
|
569 | - * |
|
570 | - * @access public |
|
571 | - * |
|
572 | - * @param integer $pid: PID for saving in database |
|
573 | - * |
|
574 | - * @return void |
|
575 | - */ |
|
576 | - public function save($pid = 0) { |
|
567 | + /** |
|
568 | + * This saves the current list |
|
569 | + * |
|
570 | + * @access public |
|
571 | + * |
|
572 | + * @param integer $pid: PID for saving in database |
|
573 | + * |
|
574 | + * @return void |
|
575 | + */ |
|
576 | + public function save($pid = 0) { |
|
577 | 577 | |
578 | - $pid = max(intval($pid), 0); |
|
578 | + $pid = max(intval($pid), 0); |
|
579 | 579 | |
580 | - // If no PID is given, save to the user's session instead |
|
581 | - if ($pid > 0) { |
|
580 | + // If no PID is given, save to the user's session instead |
|
581 | + if ($pid > 0) { |
|
582 | 582 | |
583 | - // TODO: Liste in Datenbank speichern (inkl. Sichtbarkeit, Beschreibung, etc.) |
|
583 | + // TODO: Liste in Datenbank speichern (inkl. Sichtbarkeit, Beschreibung, etc.) |
|
584 | 584 | |
585 | - } else { |
|
585 | + } else { |
|
586 | 586 | |
587 | - tx_dlf_helper::saveToSession(array ($this->elements, $this->metadata), get_class($this)); |
|
587 | + tx_dlf_helper::saveToSession(array ($this->elements, $this->metadata), get_class($this)); |
|
588 | 588 | |
589 | - } |
|
589 | + } |
|
590 | 590 | |
591 | - } |
|
591 | + } |
|
592 | 592 | |
593 | - /** |
|
594 | - * Connects to Solr server. |
|
595 | - * |
|
596 | - * @access protected |
|
597 | - * |
|
598 | - * @return boolean TRUE on success or FALSE on failure |
|
599 | - */ |
|
600 | - protected function solrConnect() { |
|
593 | + /** |
|
594 | + * Connects to Solr server. |
|
595 | + * |
|
596 | + * @access protected |
|
597 | + * |
|
598 | + * @return boolean TRUE on success or FALSE on failure |
|
599 | + */ |
|
600 | + protected function solrConnect() { |
|
601 | 601 | |
602 | - // Get Solr instance. |
|
603 | - if (!$this->solr) { |
|
602 | + // Get Solr instance. |
|
603 | + if (!$this->solr) { |
|
604 | 604 | |
605 | - // Connect to Solr server. |
|
606 | - if ($this->solr = tx_dlf_solr::getInstance($this->metadata['options']['core'])) { |
|
605 | + // Connect to Solr server. |
|
606 | + if ($this->solr = tx_dlf_solr::getInstance($this->metadata['options']['core'])) { |
|
607 | 607 | |
608 | - // Load index configuration. |
|
609 | - $result = $GLOBALS['TYPO3_DB']->exec_SELECTquery( |
|
610 | - 'tx_dlf_metadata.index_name AS index_name,tx_dlf_metadata.index_tokenized AS index_tokenized,tx_dlf_metadata.index_indexed AS index_indexed', |
|
611 | - 'tx_dlf_metadata', |
|
612 | - 'tx_dlf_metadata.is_listed=1 AND tx_dlf_metadata.pid='.intval($this->metadata['options']['pid']).tx_dlf_helper::whereClause('tx_dlf_metadata'), |
|
613 | - '', |
|
614 | - 'tx_dlf_metadata.sorting ASC', |
|
615 | - '' |
|
616 | - ); |
|
608 | + // Load index configuration. |
|
609 | + $result = $GLOBALS['TYPO3_DB']->exec_SELECTquery( |
|
610 | + 'tx_dlf_metadata.index_name AS index_name,tx_dlf_metadata.index_tokenized AS index_tokenized,tx_dlf_metadata.index_indexed AS index_indexed', |
|
611 | + 'tx_dlf_metadata', |
|
612 | + 'tx_dlf_metadata.is_listed=1 AND tx_dlf_metadata.pid='.intval($this->metadata['options']['pid']).tx_dlf_helper::whereClause('tx_dlf_metadata'), |
|
613 | + '', |
|
614 | + 'tx_dlf_metadata.sorting ASC', |
|
615 | + '' |
|
616 | + ); |
|
617 | 617 | |
618 | - while ($resArray = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($result)) { |
|
618 | + while ($resArray = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($result)) { |
|
619 | 619 | |
620 | - $this->solrConfig[$resArray['index_name']] = $resArray['index_name'].'_'.($resArray['index_tokenized'] ? 't' : 'u').'s'.($resArray['index_indexed'] ? 'i' : 'u'); |
|
620 | + $this->solrConfig[$resArray['index_name']] = $resArray['index_name'].'_'.($resArray['index_tokenized'] ? 't' : 'u').'s'.($resArray['index_indexed'] ? 'i' : 'u'); |
|
621 | 621 | |
622 | - } |
|
622 | + } |
|
623 | 623 | |
624 | - // Add static fields. |
|
625 | - $this->solrConfig['type'] = 'type'; |
|
624 | + // Add static fields. |
|
625 | + $this->solrConfig['type'] = 'type'; |
|
626 | 626 | |
627 | - } else { |
|
627 | + } else { |
|
628 | 628 | |
629 | - return FALSE; |
|
629 | + return FALSE; |
|
630 | 630 | |
631 | - } |
|
631 | + } |
|
632 | 632 | |
633 | - } |
|
633 | + } |
|
634 | 634 | |
635 | - return TRUE; |
|
635 | + return TRUE; |
|
636 | 636 | |
637 | - } |
|
637 | + } |
|
638 | 638 | |
639 | - /** |
|
640 | - * This sorts the current list by the given field |
|
641 | - * |
|
642 | - * @access public |
|
643 | - * |
|
644 | - * @param string $by: Sort the list by this field |
|
645 | - * @param boolean $asc: Sort ascending? |
|
646 | - * |
|
647 | - * @return void |
|
648 | - */ |
|
649 | - public function sort($by, $asc = TRUE) { |
|
639 | + /** |
|
640 | + * This sorts the current list by the given field |
|
641 | + * |
|
642 | + * @access public |
|
643 | + * |
|
644 | + * @param string $by: Sort the list by this field |
|
645 | + * @param boolean $asc: Sort ascending? |
|
646 | + * |
|
647 | + * @return void |
|
648 | + */ |
|
649 | + public function sort($by, $asc = TRUE) { |
|
650 | 650 | |
651 | - $newOrder = array (); |
|
651 | + $newOrder = array (); |
|
652 | 652 | |
653 | - $nonSortable = array (); |
|
653 | + $nonSortable = array (); |
|
654 | 654 | |
655 | - foreach ($this->elements as $num => $element) { |
|
655 | + foreach ($this->elements as $num => $element) { |
|
656 | 656 | |
657 | - // Is this element sortable? |
|
658 | - if (!empty($element['s'][$by])) { |
|
657 | + // Is this element sortable? |
|
658 | + if (!empty($element['s'][$by])) { |
|
659 | 659 | |
660 | - $newOrder[$element['s'][$by].str_pad($num, 6, '0', STR_PAD_LEFT)] = $element; |
|
660 | + $newOrder[$element['s'][$by].str_pad($num, 6, '0', STR_PAD_LEFT)] = $element; |
|
661 | 661 | |
662 | - } else { |
|
662 | + } else { |
|
663 | 663 | |
664 | - $nonSortable[] = $element; |
|
664 | + $nonSortable[] = $element; |
|
665 | 665 | |
666 | - } |
|
666 | + } |
|
667 | 667 | |
668 | - } |
|
668 | + } |
|
669 | 669 | |
670 | - // Reorder elements. |
|
671 | - if ($asc) { |
|
670 | + // Reorder elements. |
|
671 | + if ($asc) { |
|
672 | 672 | |
673 | - ksort($newOrder, SORT_LOCALE_STRING); |
|
673 | + ksort($newOrder, SORT_LOCALE_STRING); |
|
674 | 674 | |
675 | - } else { |
|
675 | + } else { |
|
676 | 676 | |
677 | - krsort($newOrder, SORT_LOCALE_STRING); |
|
677 | + krsort($newOrder, SORT_LOCALE_STRING); |
|
678 | 678 | |
679 | - } |
|
679 | + } |
|
680 | 680 | |
681 | - // Add non sortable elements to the end of the list. |
|
682 | - $newOrder = array_merge(array_values($newOrder), $nonSortable); |
|
681 | + // Add non sortable elements to the end of the list. |
|
682 | + $newOrder = array_merge(array_values($newOrder), $nonSortable); |
|
683 | 683 | |
684 | - // Check if something is missing. |
|
685 | - if ($this->count == count($newOrder)) { |
|
684 | + // Check if something is missing. |
|
685 | + if ($this->count == count($newOrder)) { |
|
686 | 686 | |
687 | - $this->elements = $newOrder; |
|
687 | + $this->elements = $newOrder; |
|
688 | 688 | |
689 | - } else { |
|
689 | + } else { |
|
690 | 690 | |
691 | - if (TYPO3_DLOG) { |
|
691 | + if (TYPO3_DLOG) { |
|
692 | 692 | |
693 | - \TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[tx_dlf_list->sort('.$by.', ['.($asc ? 'TRUE' : 'FALSE').'])] Sorted list elements do not match unsorted elements', $this->extKey, SYSLOG_SEVERITY_ERROR); |
|
693 | + \TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[tx_dlf_list->sort('.$by.', ['.($asc ? 'TRUE' : 'FALSE').'])] Sorted list elements do not match unsorted elements', $this->extKey, SYSLOG_SEVERITY_ERROR); |
|
694 | 694 | |
695 | - } |
|
695 | + } |
|
696 | 696 | |
697 | - } |
|
697 | + } |
|
698 | 698 | |
699 | - } |
|
699 | + } |
|
700 | 700 | |
701 | - /** |
|
702 | - * This unsets the element at the given offset |
|
703 | - * @see ArrayAccess::offsetUnset() |
|
704 | - * |
|
705 | - * @access public |
|
706 | - * |
|
707 | - * @param mixed $offset: The offset to unset |
|
708 | - * |
|
709 | - * @return void |
|
710 | - */ |
|
711 | - public function offsetUnset($offset) { |
|
701 | + /** |
|
702 | + * This unsets the element at the given offset |
|
703 | + * @see ArrayAccess::offsetUnset() |
|
704 | + * |
|
705 | + * @access public |
|
706 | + * |
|
707 | + * @param mixed $offset: The offset to unset |
|
708 | + * |
|
709 | + * @return void |
|
710 | + */ |
|
711 | + public function offsetUnset($offset) { |
|
712 | 712 | |
713 | - unset ($this->elements[$offset]); |
|
713 | + unset ($this->elements[$offset]); |
|
714 | 714 | |
715 | - // Re-number the elements. |
|
716 | - $this->elements = array_values($this->elements); |
|
715 | + // Re-number the elements. |
|
716 | + $this->elements = array_values($this->elements); |
|
717 | 717 | |
718 | - $this->count = count($this->elements); |
|
718 | + $this->count = count($this->elements); |
|
719 | 719 | |
720 | - } |
|
720 | + } |
|
721 | 721 | |
722 | - /** |
|
723 | - * This checks if the current list position is valid |
|
724 | - * @see Iterator::valid() |
|
725 | - * |
|
726 | - * @access public |
|
727 | - * |
|
728 | - * @return boolean Is the current list position valid? |
|
729 | - */ |
|
730 | - public function valid() { |
|
722 | + /** |
|
723 | + * This checks if the current list position is valid |
|
724 | + * @see Iterator::valid() |
|
725 | + * |
|
726 | + * @access public |
|
727 | + * |
|
728 | + * @return boolean Is the current list position valid? |
|
729 | + */ |
|
730 | + public function valid() { |
|
731 | 731 | |
732 | - return isset($this->elements[$this->position]); |
|
732 | + return isset($this->elements[$this->position]); |
|
733 | 733 | |
734 | - } |
|
734 | + } |
|
735 | 735 | |
736 | - /** |
|
737 | - * This returns $this->metadata via __get() |
|
738 | - * |
|
739 | - * @access protected |
|
740 | - * |
|
741 | - * @return array The list's metadata |
|
742 | - */ |
|
743 | - protected function _getMetadata() { |
|
736 | + /** |
|
737 | + * This returns $this->metadata via __get() |
|
738 | + * |
|
739 | + * @access protected |
|
740 | + * |
|
741 | + * @return array The list's metadata |
|
742 | + */ |
|
743 | + protected function _getMetadata() { |
|
744 | 744 | |
745 | - return $this->metadata; |
|
745 | + return $this->metadata; |
|
746 | 746 | |
747 | - } |
|
747 | + } |
|
748 | 748 | |
749 | - /** |
|
750 | - * This sets $this->metadata via __set() |
|
751 | - * |
|
752 | - * @access protected |
|
753 | - * |
|
754 | - * @param array $metadata: Array of new metadata |
|
755 | - * |
|
756 | - * @return void |
|
757 | - */ |
|
758 | - protected function _setMetadata(array $metadata = array ()) { |
|
749 | + /** |
|
750 | + * This sets $this->metadata via __set() |
|
751 | + * |
|
752 | + * @access protected |
|
753 | + * |
|
754 | + * @param array $metadata: Array of new metadata |
|
755 | + * |
|
756 | + * @return void |
|
757 | + */ |
|
758 | + protected function _setMetadata(array $metadata = array ()) { |
|
759 | 759 | |
760 | - $this->metadata = $metadata; |
|
760 | + $this->metadata = $metadata; |
|
761 | 761 | |
762 | - } |
|
762 | + } |
|
763 | 763 | |
764 | - /** |
|
765 | - * This is the constructor |
|
766 | - * |
|
767 | - * @access public |
|
768 | - * |
|
769 | - * @param array $elements: Array of documents initially setting up the list |
|
770 | - * @param array $metadata: Array of initial metadata |
|
771 | - * |
|
772 | - * @return void |
|
773 | - */ |
|
774 | - public function __construct(array $elements = array (), array $metadata = array ()) { |
|
764 | + /** |
|
765 | + * This is the constructor |
|
766 | + * |
|
767 | + * @access public |
|
768 | + * |
|
769 | + * @param array $elements: Array of documents initially setting up the list |
|
770 | + * @param array $metadata: Array of initial metadata |
|
771 | + * |
|
772 | + * @return void |
|
773 | + */ |
|
774 | + public function __construct(array $elements = array (), array $metadata = array ()) { |
|
775 | 775 | |
776 | - if (empty($elements) && empty($metadata)) { |
|
776 | + if (empty($elements) && empty($metadata)) { |
|
777 | 777 | |
778 | - // Let's check the user's session. |
|
779 | - $sessionData = tx_dlf_helper::loadFromSession(get_class($this)); |
|
778 | + // Let's check the user's session. |
|
779 | + $sessionData = tx_dlf_helper::loadFromSession(get_class($this)); |
|
780 | 780 | |
781 | - // Restore list from session data. |
|
782 | - if (is_array($sessionData)) { |
|
781 | + // Restore list from session data. |
|
782 | + if (is_array($sessionData)) { |
|
783 | 783 | |
784 | - if (is_array($sessionData[0])) { |
|
784 | + if (is_array($sessionData[0])) { |
|
785 | 785 | |
786 | - $this->elements = $sessionData[0]; |
|
786 | + $this->elements = $sessionData[0]; |
|
787 | 787 | |
788 | - } |
|
788 | + } |
|
789 | 789 | |
790 | - if (is_array($sessionData[1])) { |
|
790 | + if (is_array($sessionData[1])) { |
|
791 | 791 | |
792 | - $this->metadata = $sessionData[1]; |
|
792 | + $this->metadata = $sessionData[1]; |
|
793 | 793 | |
794 | - } |
|
794 | + } |
|
795 | 795 | |
796 | - } |
|
796 | + } |
|
797 | 797 | |
798 | - } else { |
|
798 | + } else { |
|
799 | 799 | |
800 | - // Add metadata to the list. |
|
801 | - $this->metadata = $metadata; |
|
800 | + // Add metadata to the list. |
|
801 | + $this->metadata = $metadata; |
|
802 | 802 | |
803 | - // Add initial set of elements to the list. |
|
804 | - $this->elements = $elements; |
|
803 | + // Add initial set of elements to the list. |
|
804 | + $this->elements = $elements; |
|
805 | 805 | |
806 | - } |
|
806 | + } |
|
807 | 807 | |
808 | - $this->count = count($this->elements); |
|
808 | + $this->count = count($this->elements); |
|
809 | 809 | |
810 | - } |
|
810 | + } |
|
811 | 811 | |
812 | - /** |
|
813 | - * This magic method is invoked each time a clone is called on the object variable |
|
814 | - * (This method is defined as private/protected because singleton objects should not be cloned) |
|
815 | - * |
|
816 | - * @access protected |
|
817 | - * |
|
818 | - * @return void |
|
819 | - */ |
|
820 | - protected function __clone() {} |
|
812 | + /** |
|
813 | + * This magic method is invoked each time a clone is called on the object variable |
|
814 | + * (This method is defined as private/protected because singleton objects should not be cloned) |
|
815 | + * |
|
816 | + * @access protected |
|
817 | + * |
|
818 | + * @return void |
|
819 | + */ |
|
820 | + protected function __clone() {} |
|
821 | 821 | |
822 | - /** |
|
823 | - * This magic method is called each time an invisible property is referenced from the object |
|
824 | - * |
|
825 | - * @access public |
|
826 | - * |
|
827 | - * @param string $var: Name of variable to get |
|
828 | - * |
|
829 | - * @return mixed Value of $this->$var |
|
830 | - */ |
|
831 | - public function __get($var) { |
|
822 | + /** |
|
823 | + * This magic method is called each time an invisible property is referenced from the object |
|
824 | + * |
|
825 | + * @access public |
|
826 | + * |
|
827 | + * @param string $var: Name of variable to get |
|
828 | + * |
|
829 | + * @return mixed Value of $this->$var |
|
830 | + */ |
|
831 | + public function __get($var) { |
|
832 | 832 | |
833 | - $method = '_get'.ucfirst($var); |
|
833 | + $method = '_get'.ucfirst($var); |
|
834 | 834 | |
835 | - if (!property_exists($this, $var) || !method_exists($this, $method)) { |
|
835 | + if (!property_exists($this, $var) || !method_exists($this, $method)) { |
|
836 | 836 | |
837 | - if (TYPO3_DLOG) { |
|
837 | + if (TYPO3_DLOG) { |
|
838 | 838 | |
839 | - \TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[tx_dlf_list->__get('.$var.')] There is no getter function for property "'.$var.'"', $this->extKey, SYSLOG_SEVERITY_WARNING); |
|
839 | + \TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[tx_dlf_list->__get('.$var.')] There is no getter function for property "'.$var.'"', $this->extKey, SYSLOG_SEVERITY_WARNING); |
|
840 | 840 | |
841 | - } |
|
841 | + } |
|
842 | 842 | |
843 | - return; |
|
843 | + return; |
|
844 | 844 | |
845 | - } else { |
|
845 | + } else { |
|
846 | 846 | |
847 | - return $this->$method(); |
|
847 | + return $this->$method(); |
|
848 | 848 | |
849 | - } |
|
849 | + } |
|
850 | 850 | |
851 | - } |
|
851 | + } |
|
852 | 852 | |
853 | - /** |
|
854 | - * This magic method is called each time an invisible property is referenced from the object |
|
855 | - * |
|
856 | - * @access public |
|
857 | - * |
|
858 | - * @param string $var: Name of variable to set |
|
859 | - * @param mixed $value: New value of variable |
|
860 | - * |
|
861 | - * @return void |
|
862 | - */ |
|
863 | - public function __set($var, $value) { |
|
853 | + /** |
|
854 | + * This magic method is called each time an invisible property is referenced from the object |
|
855 | + * |
|
856 | + * @access public |
|
857 | + * |
|
858 | + * @param string $var: Name of variable to set |
|
859 | + * @param mixed $value: New value of variable |
|
860 | + * |
|
861 | + * @return void |
|
862 | + */ |
|
863 | + public function __set($var, $value) { |
|
864 | 864 | |
865 | - $method = '_set'.ucfirst($var); |
|
865 | + $method = '_set'.ucfirst($var); |
|
866 | 866 | |
867 | - if (!property_exists($this, $var) || !method_exists($this, $method)) { |
|
867 | + if (!property_exists($this, $var) || !method_exists($this, $method)) { |
|
868 | 868 | |
869 | - if (TYPO3_DLOG) { |
|
869 | + if (TYPO3_DLOG) { |
|
870 | 870 | |
871 | - \TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[tx_dlf_list->__set('.$var.', [data])] There is no setter function for property "'.$var.'"', $this->extKey, SYSLOG_SEVERITY_WARNING, $value); |
|
871 | + \TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[tx_dlf_list->__set('.$var.', [data])] There is no setter function for property "'.$var.'"', $this->extKey, SYSLOG_SEVERITY_WARNING, $value); |
|
872 | 872 | |
873 | - } |
|
873 | + } |
|
874 | 874 | |
875 | - } else { |
|
875 | + } else { |
|
876 | 876 | |
877 | - $this->$method($value); |
|
877 | + $this->$method($value); |
|
878 | 878 | |
879 | - } |
|
879 | + } |
|
880 | 880 | |
881 | - } |
|
881 | + } |
|
882 | 882 | |
883 | - /** |
|
884 | - * This magic method is executed prior to any serialization of the object |
|
885 | - * @see __wakeup() |
|
886 | - * |
|
887 | - * @access public |
|
888 | - * |
|
889 | - * @return array Properties to be serialized |
|
890 | - */ |
|
891 | - public function __sleep() { |
|
883 | + /** |
|
884 | + * This magic method is executed prior to any serialization of the object |
|
885 | + * @see __wakeup() |
|
886 | + * |
|
887 | + * @access public |
|
888 | + * |
|
889 | + * @return array Properties to be serialized |
|
890 | + */ |
|
891 | + public function __sleep() { |
|
892 | 892 | |
893 | - return array ('elements', 'metadata'); |
|
893 | + return array ('elements', 'metadata'); |
|
894 | 894 | |
895 | - } |
|
895 | + } |
|
896 | 896 | |
897 | - /** |
|
898 | - * This magic method is executed after the object is deserialized |
|
899 | - * @see __sleep() |
|
900 | - * |
|
901 | - * @access public |
|
902 | - * |
|
903 | - * @return void |
|
904 | - */ |
|
905 | - public function __wakeup() { |
|
897 | + /** |
|
898 | + * This magic method is executed after the object is deserialized |
|
899 | + * @see __sleep() |
|
900 | + * |
|
901 | + * @access public |
|
902 | + * |
|
903 | + * @return void |
|
904 | + */ |
|
905 | + public function __wakeup() { |
|
906 | 906 | |
907 | - $this->count = count($this->elements); |
|
907 | + $this->count = count($this->elements); |
|
908 | 908 | |
909 | - } |
|
909 | + } |
|
910 | 910 | |
911 | 911 | } |
@@ -20,320 +20,320 @@ |
||
20 | 20 | */ |
21 | 21 | abstract class tx_dlf_plugin extends \TYPO3\CMS\Frontend\Plugin\AbstractPlugin { |
22 | 22 | |
23 | - public $extKey = 'dlf'; |
|
23 | + public $extKey = 'dlf'; |
|
24 | 24 | |
25 | - public $prefixId = 'tx_dlf'; |
|
25 | + public $prefixId = 'tx_dlf'; |
|
26 | 26 | |
27 | - public $scriptRelPath = 'common/class.tx_dlf_plugin.php'; |
|
27 | + public $scriptRelPath = 'common/class.tx_dlf_plugin.php'; |
|
28 | 28 | |
29 | - // Plugins are cached by default (@see setCache()). |
|
30 | - public $pi_USER_INT_obj = FALSE; |
|
29 | + // Plugins are cached by default (@see setCache()). |
|
30 | + public $pi_USER_INT_obj = FALSE; |
|
31 | 31 | |
32 | - public $pi_checkCHash = TRUE; |
|
32 | + public $pi_checkCHash = TRUE; |
|
33 | 33 | |
34 | - /** |
|
35 | - * This holds the current document |
|
36 | - * |
|
37 | - * @var tx_dlf_document |
|
38 | - * @access protected |
|
39 | - */ |
|
40 | - protected $doc; |
|
34 | + /** |
|
35 | + * This holds the current document |
|
36 | + * |
|
37 | + * @var tx_dlf_document |
|
38 | + * @access protected |
|
39 | + */ |
|
40 | + protected $doc; |
|
41 | 41 | |
42 | - /** |
|
43 | - * This holds the plugin's parsed template |
|
44 | - * |
|
45 | - * @var string |
|
46 | - * @access protected |
|
47 | - */ |
|
48 | - protected $template = ''; |
|
42 | + /** |
|
43 | + * This holds the plugin's parsed template |
|
44 | + * |
|
45 | + * @var string |
|
46 | + * @access protected |
|
47 | + */ |
|
48 | + protected $template = ''; |
|
49 | 49 | |
50 | - /** |
|
51 | - * All the needed configuration values are stored in class variables |
|
52 | - * Priority: Flexforms > TS-Templates > Extension Configuration > ext_localconf.php |
|
53 | - * |
|
54 | - * @access protected |
|
55 | - * |
|
56 | - * @param array $conf: configuration array from TS-Template |
|
57 | - * |
|
58 | - * @return void |
|
59 | - */ |
|
60 | - protected function init(array $conf) { |
|
50 | + /** |
|
51 | + * All the needed configuration values are stored in class variables |
|
52 | + * Priority: Flexforms > TS-Templates > Extension Configuration > ext_localconf.php |
|
53 | + * |
|
54 | + * @access protected |
|
55 | + * |
|
56 | + * @param array $conf: configuration array from TS-Template |
|
57 | + * |
|
58 | + * @return void |
|
59 | + */ |
|
60 | + protected function init(array $conf) { |
|
61 | 61 | |
62 | - // Read FlexForm configuration. |
|
63 | - $flexFormConf = array (); |
|
62 | + // Read FlexForm configuration. |
|
63 | + $flexFormConf = array (); |
|
64 | 64 | |
65 | - $this->cObj->readFlexformIntoConf($this->cObj->data['pi_flexform'], $flexFormConf); |
|
65 | + $this->cObj->readFlexformIntoConf($this->cObj->data['pi_flexform'], $flexFormConf); |
|
66 | 66 | |
67 | - if (!empty($flexFormConf)) { |
|
67 | + if (!empty($flexFormConf)) { |
|
68 | 68 | |
69 | - $conf = tx_dlf_helper::array_merge_recursive_overrule($flexFormConf, $conf); |
|
69 | + $conf = tx_dlf_helper::array_merge_recursive_overrule($flexFormConf, $conf); |
|
70 | 70 | |
71 | - } |
|
71 | + } |
|
72 | 72 | |
73 | - // Read plugin TS configuration. |
|
74 | - $pluginConf = $GLOBALS['TSFE']->tmpl->setup['plugin.'][get_class($this).'.']; |
|
73 | + // Read plugin TS configuration. |
|
74 | + $pluginConf = $GLOBALS['TSFE']->tmpl->setup['plugin.'][get_class($this).'.']; |
|
75 | 75 | |
76 | - if (is_array($pluginConf)) { |
|
76 | + if (is_array($pluginConf)) { |
|
77 | 77 | |
78 | - $conf = tx_dlf_helper::array_merge_recursive_overrule($pluginConf, $conf); |
|
78 | + $conf = tx_dlf_helper::array_merge_recursive_overrule($pluginConf, $conf); |
|
79 | 79 | |
80 | - } |
|
80 | + } |
|
81 | 81 | |
82 | - // Read general TS configuration. |
|
83 | - $generalConf = $GLOBALS['TSFE']->tmpl->setup['plugin.'][$this->prefixId.'.']; |
|
82 | + // Read general TS configuration. |
|
83 | + $generalConf = $GLOBALS['TSFE']->tmpl->setup['plugin.'][$this->prefixId.'.']; |
|
84 | 84 | |
85 | - if (is_array($generalConf)) { |
|
85 | + if (is_array($generalConf)) { |
|
86 | 86 | |
87 | - $conf = tx_dlf_helper::array_merge_recursive_overrule($generalConf, $conf); |
|
87 | + $conf = tx_dlf_helper::array_merge_recursive_overrule($generalConf, $conf); |
|
88 | 88 | |
89 | - } |
|
89 | + } |
|
90 | 90 | |
91 | - // Read extension configuration. |
|
92 | - $extConf = unserialize($GLOBALS['TYPO3_CONF_VARS']['EXT']['extConf'][$this->extKey]); |
|
91 | + // Read extension configuration. |
|
92 | + $extConf = unserialize($GLOBALS['TYPO3_CONF_VARS']['EXT']['extConf'][$this->extKey]); |
|
93 | 93 | |
94 | - if (is_array($extConf)) { |
|
94 | + if (is_array($extConf)) { |
|
95 | 95 | |
96 | - $conf = tx_dlf_helper::array_merge_recursive_overrule($extConf, $conf); |
|
96 | + $conf = tx_dlf_helper::array_merge_recursive_overrule($extConf, $conf); |
|
97 | 97 | |
98 | - } |
|
98 | + } |
|
99 | 99 | |
100 | - // Read TYPO3_CONF_VARS configuration. |
|
101 | - $varsConf = $GLOBALS['TYPO3_CONF_VARS']['EXTCONF'][$this->extKey]; |
|
100 | + // Read TYPO3_CONF_VARS configuration. |
|
101 | + $varsConf = $GLOBALS['TYPO3_CONF_VARS']['EXTCONF'][$this->extKey]; |
|
102 | 102 | |
103 | - if (is_array($varsConf)) { |
|
103 | + if (is_array($varsConf)) { |
|
104 | 104 | |
105 | - $conf = tx_dlf_helper::array_merge_recursive_overrule($varsConf, $conf); |
|
105 | + $conf = tx_dlf_helper::array_merge_recursive_overrule($varsConf, $conf); |
|
106 | 106 | |
107 | - } |
|
107 | + } |
|
108 | 108 | |
109 | - $this->conf = $conf; |
|
109 | + $this->conf = $conf; |
|
110 | 110 | |
111 | - // Set default plugin variables. |
|
112 | - $this->pi_setPiVarDefaults(); |
|
111 | + // Set default plugin variables. |
|
112 | + $this->pi_setPiVarDefaults(); |
|
113 | 113 | |
114 | - // Load translation files. |
|
115 | - $this->pi_loadLL(); |
|
114 | + // Load translation files. |
|
115 | + $this->pi_loadLL(); |
|
116 | 116 | |
117 | - } |
|
117 | + } |
|
118 | 118 | |
119 | - /** |
|
120 | - * Loads the current document into $this->doc |
|
121 | - * |
|
122 | - * @access protected |
|
123 | - * |
|
124 | - * @return void |
|
125 | - */ |
|
126 | - protected function loadDocument() { |
|
119 | + /** |
|
120 | + * Loads the current document into $this->doc |
|
121 | + * |
|
122 | + * @access protected |
|
123 | + * |
|
124 | + * @return void |
|
125 | + */ |
|
126 | + protected function loadDocument() { |
|
127 | 127 | |
128 | - // Check for required variable. |
|
129 | - if (!empty($this->piVars['id']) && !empty($this->conf['pages'])) { |
|
128 | + // Check for required variable. |
|
129 | + if (!empty($this->piVars['id']) && !empty($this->conf['pages'])) { |
|
130 | 130 | |
131 | - // Should we exclude documents from other pages than $this->conf['pages']? |
|
132 | - $pid = (!empty($this->conf['excludeOther']) ? intval($this->conf['pages']) : 0); |
|
131 | + // Should we exclude documents from other pages than $this->conf['pages']? |
|
132 | + $pid = (!empty($this->conf['excludeOther']) ? intval($this->conf['pages']) : 0); |
|
133 | 133 | |
134 | - // Get instance of tx_dlf_document. |
|
135 | - $this->doc =& tx_dlf_document::getInstance($this->piVars['id'], $pid); |
|
134 | + // Get instance of tx_dlf_document. |
|
135 | + $this->doc =& tx_dlf_document::getInstance($this->piVars['id'], $pid); |
|
136 | 136 | |
137 | - if (!$this->doc->ready) { |
|
137 | + if (!$this->doc->ready) { |
|
138 | 138 | |
139 | - // Destroy the incomplete object. |
|
140 | - $this->doc = NULL; |
|
139 | + // Destroy the incomplete object. |
|
140 | + $this->doc = NULL; |
|
141 | 141 | |
142 | - if (TYPO3_DLOG) { |
|
142 | + if (TYPO3_DLOG) { |
|
143 | 143 | |
144 | - \TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[tx_dlf_plugin->loadDocument()] Failed to load document with UID "'.$this->piVars['id'].'"', $this->extKey, SYSLOG_SEVERITY_ERROR); |
|
144 | + \TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[tx_dlf_plugin->loadDocument()] Failed to load document with UID "'.$this->piVars['id'].'"', $this->extKey, SYSLOG_SEVERITY_ERROR); |
|
145 | 145 | |
146 | - } |
|
146 | + } |
|
147 | 147 | |
148 | - } else { |
|
148 | + } else { |
|
149 | 149 | |
150 | - // Set configuration PID. |
|
151 | - $this->doc->cPid = $this->conf['pages']; |
|
150 | + // Set configuration PID. |
|
151 | + $this->doc->cPid = $this->conf['pages']; |
|
152 | 152 | |
153 | - } |
|
153 | + } |
|
154 | 154 | |
155 | - } elseif (!empty($this->piVars['recordId'])) { |
|
155 | + } elseif (!empty($this->piVars['recordId'])) { |
|
156 | 156 | |
157 | - // Get UID of document with given record identifier. |
|
158 | - $result = $GLOBALS['TYPO3_DB']->exec_SELECTquery( |
|
159 | - 'tx_dlf_documents.uid', |
|
160 | - 'tx_dlf_documents', |
|
161 | - 'tx_dlf_documents.record_id='.$GLOBALS['TYPO3_DB']->fullQuoteStr($this->piVars['recordId'], 'tx_dlf_documents').tx_dlf_helper::whereClause('tx_dlf_documents'), |
|
162 | - '', |
|
163 | - '', |
|
164 | - '1' |
|
165 | - ); |
|
157 | + // Get UID of document with given record identifier. |
|
158 | + $result = $GLOBALS['TYPO3_DB']->exec_SELECTquery( |
|
159 | + 'tx_dlf_documents.uid', |
|
160 | + 'tx_dlf_documents', |
|
161 | + 'tx_dlf_documents.record_id='.$GLOBALS['TYPO3_DB']->fullQuoteStr($this->piVars['recordId'], 'tx_dlf_documents').tx_dlf_helper::whereClause('tx_dlf_documents'), |
|
162 | + '', |
|
163 | + '', |
|
164 | + '1' |
|
165 | + ); |
|
166 | 166 | |
167 | - if ($GLOBALS['TYPO3_DB']->sql_num_rows($result) == 1) { |
|
167 | + if ($GLOBALS['TYPO3_DB']->sql_num_rows($result) == 1) { |
|
168 | 168 | |
169 | - list ($this->piVars['id']) = $GLOBALS['TYPO3_DB']->sql_fetch_row($result); |
|
169 | + list ($this->piVars['id']) = $GLOBALS['TYPO3_DB']->sql_fetch_row($result); |
|
170 | 170 | |
171 | - // Set superglobal $_GET array. |
|
172 | - $_GET[$this->prefixId]['id'] = $this->piVars['id']; |
|
171 | + // Set superglobal $_GET array. |
|
172 | + $_GET[$this->prefixId]['id'] = $this->piVars['id']; |
|
173 | 173 | |
174 | - // Unset variable to avoid infinite looping. |
|
175 | - unset ($this->piVars['recordId'], $_GET[$this->prefixId]['recordId']); |
|
174 | + // Unset variable to avoid infinite looping. |
|
175 | + unset ($this->piVars['recordId'], $_GET[$this->prefixId]['recordId']); |
|
176 | 176 | |
177 | - // Try to load document. |
|
178 | - $this->loadDocument(); |
|
177 | + // Try to load document. |
|
178 | + $this->loadDocument(); |
|
179 | 179 | |
180 | - } else { |
|
180 | + } else { |
|
181 | 181 | |
182 | - if (TYPO3_DLOG) { |
|
182 | + if (TYPO3_DLOG) { |
|
183 | 183 | |
184 | - \TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[tx_dlf_plugin->loadDocument()] Failed to load document with record ID "'.$this->piVars['recordId'].'"', $this->extKey, SYSLOG_SEVERITY_ERROR); |
|
184 | + \TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[tx_dlf_plugin->loadDocument()] Failed to load document with record ID "'.$this->piVars['recordId'].'"', $this->extKey, SYSLOG_SEVERITY_ERROR); |
|
185 | 185 | |
186 | - } |
|
186 | + } |
|
187 | 187 | |
188 | - } |
|
188 | + } |
|
189 | 189 | |
190 | - } else { |
|
190 | + } else { |
|
191 | 191 | |
192 | - if (TYPO3_DLOG) { |
|
192 | + if (TYPO3_DLOG) { |
|
193 | 193 | |
194 | - \TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[tx_dlf_plugin->loadDocument()] Invalid UID "'.$this->piVars['id'].'" or PID "'.$this->conf['pages'].'" for document loading', $this->extKey, SYSLOG_SEVERITY_ERROR); |
|
194 | + \TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[tx_dlf_plugin->loadDocument()] Invalid UID "'.$this->piVars['id'].'" or PID "'.$this->conf['pages'].'" for document loading', $this->extKey, SYSLOG_SEVERITY_ERROR); |
|
195 | 195 | |
196 | - } |
|
196 | + } |
|
197 | 197 | |
198 | - } |
|
198 | + } |
|
199 | 199 | |
200 | - } |
|
200 | + } |
|
201 | 201 | |
202 | - /** |
|
203 | - * The main method of the PlugIn |
|
204 | - * |
|
205 | - * @access public |
|
206 | - * |
|
207 | - * @param string $content: The PlugIn content |
|
208 | - * @param array $conf: The PlugIn configuration |
|
209 | - * |
|
210 | - * @abstract |
|
211 | - * |
|
212 | - * @return string The content that is displayed on the website |
|
213 | - */ |
|
214 | - abstract public function main($content, $conf); |
|
202 | + /** |
|
203 | + * The main method of the PlugIn |
|
204 | + * |
|
205 | + * @access public |
|
206 | + * |
|
207 | + * @param string $content: The PlugIn content |
|
208 | + * @param array $conf: The PlugIn configuration |
|
209 | + * |
|
210 | + * @abstract |
|
211 | + * |
|
212 | + * @return string The content that is displayed on the website |
|
213 | + */ |
|
214 | + abstract public function main($content, $conf); |
|
215 | 215 | |
216 | - /** |
|
217 | - * Sets default plugin variables from Typoscript |
|
218 | - * (stdWrap backport from TYPO3 6.2) |
|
219 | - * @see http://forge.typo3.org/issues/22045 |
|
220 | - * |
|
221 | - * @access public |
|
222 | - * |
|
223 | - * @return void |
|
224 | - */ |
|
225 | - public function pi_setPiVarDefaults() { |
|
216 | + /** |
|
217 | + * Sets default plugin variables from Typoscript |
|
218 | + * (stdWrap backport from TYPO3 6.2) |
|
219 | + * @see http://forge.typo3.org/issues/22045 |
|
220 | + * |
|
221 | + * @access public |
|
222 | + * |
|
223 | + * @return void |
|
224 | + */ |
|
225 | + public function pi_setPiVarDefaults() { |
|
226 | 226 | |
227 | - if (is_array($this->conf['_DEFAULT_PI_VARS.'])) { |
|
227 | + if (is_array($this->conf['_DEFAULT_PI_VARS.'])) { |
|
228 | 228 | |
229 | - foreach ($this->conf['_DEFAULT_PI_VARS.'] as $GPkey => $GPval) { |
|
229 | + foreach ($this->conf['_DEFAULT_PI_VARS.'] as $GPkey => $GPval) { |
|
230 | 230 | |
231 | - if (strpos($GPkey,'.')) { |
|
231 | + if (strpos($GPkey,'.')) { |
|
232 | 232 | |
233 | - $GPkey = substr($GPkey, 0, -1); |
|
233 | + $GPkey = substr($GPkey, 0, -1); |
|
234 | 234 | |
235 | - } |
|
235 | + } |
|
236 | 236 | |
237 | - if (is_array($this->conf['_DEFAULT_PI_VARS.'][$GPkey.'.']['stdWrap.'])) { |
|
237 | + if (is_array($this->conf['_DEFAULT_PI_VARS.'][$GPkey.'.']['stdWrap.'])) { |
|
238 | 238 | |
239 | - $GPval = $GPval ? $GPval : ''; |
|
239 | + $GPval = $GPval ? $GPval : ''; |
|
240 | 240 | |
241 | - $this->conf['_DEFAULT_PI_VARS.'][$GPkey] = $this->cObj->stdWrap($GPval, $this->conf['_DEFAULT_PI_VARS.'][$GPkey.'.']['stdWrap.']); |
|
241 | + $this->conf['_DEFAULT_PI_VARS.'][$GPkey] = $this->cObj->stdWrap($GPval, $this->conf['_DEFAULT_PI_VARS.'][$GPkey.'.']['stdWrap.']); |
|
242 | 242 | |
243 | - unset ($this->conf['_DEFAULT_PI_VARS.'][$GPkey.'.']['stdWrap.']); |
|
243 | + unset ($this->conf['_DEFAULT_PI_VARS.'][$GPkey.'.']['stdWrap.']); |
|
244 | 244 | |
245 | - } |
|
245 | + } |
|
246 | 246 | |
247 | - } |
|
247 | + } |
|
248 | 248 | |
249 | - $this->piVars = tx_dlf_helper::array_merge_recursive_overrule($this->conf['_DEFAULT_PI_VARS.'], is_array($this->piVars) ? $this->piVars : array()); |
|
249 | + $this->piVars = tx_dlf_helper::array_merge_recursive_overrule($this->conf['_DEFAULT_PI_VARS.'], is_array($this->piVars) ? $this->piVars : array()); |
|
250 | 250 | |
251 | - } |
|
251 | + } |
|
252 | 252 | |
253 | - } |
|
253 | + } |
|
254 | 254 | |
255 | - /** |
|
256 | - * Wraps the input string in a tag with the class attribute set to the class name |
|
257 | - * |
|
258 | - * @access public |
|
259 | - * |
|
260 | - * @param string $content: HTML content to wrap in the div-tags with the "main class" of the plugin |
|
261 | - * |
|
262 | - * @return string HTML content wrapped, ready to return to the parent object. |
|
263 | - */ |
|
264 | - public function pi_wrapInBaseClass($content) { |
|
255 | + /** |
|
256 | + * Wraps the input string in a tag with the class attribute set to the class name |
|
257 | + * |
|
258 | + * @access public |
|
259 | + * |
|
260 | + * @param string $content: HTML content to wrap in the div-tags with the "main class" of the plugin |
|
261 | + * |
|
262 | + * @return string HTML content wrapped, ready to return to the parent object. |
|
263 | + */ |
|
264 | + public function pi_wrapInBaseClass($content) { |
|
265 | 265 | |
266 | - if (!$GLOBALS['TSFE']->config['config']['disableWrapInBaseClass']) { |
|
267 | - // Use get_class($this) instead of $this->prefixId for content wrapping because $this->prefixId is the same for all plugins. |
|
268 | - $content = '<div class="'.str_replace('_', '-', get_class($this)).'">'.$content.'</div>'; |
|
266 | + if (!$GLOBALS['TSFE']->config['config']['disableWrapInBaseClass']) { |
|
267 | + // Use get_class($this) instead of $this->prefixId for content wrapping because $this->prefixId is the same for all plugins. |
|
268 | + $content = '<div class="'.str_replace('_', '-', get_class($this)).'">'.$content.'</div>'; |
|
269 | 269 | |
270 | - if (!$GLOBALS['TSFE']->config['config']['disablePrefixComment']) { |
|
270 | + if (!$GLOBALS['TSFE']->config['config']['disablePrefixComment']) { |
|
271 | 271 | |
272 | - $content = "\n\n<!-- BEGIN: Content of extension '".$this->extKey."', plugin '".get_class($this)."' -->\n\n".$content."\n\n<!-- END: Content of extension '".$this->extKey."', plugin '".get_class($this)."' -->\n\n"; |
|
272 | + $content = "\n\n<!-- BEGIN: Content of extension '".$this->extKey."', plugin '".get_class($this)."' -->\n\n".$content."\n\n<!-- END: Content of extension '".$this->extKey."', plugin '".get_class($this)."' -->\n\n"; |
|
273 | 273 | |
274 | - } |
|
275 | - } |
|
274 | + } |
|
275 | + } |
|
276 | 276 | |
277 | - return $content; |
|
277 | + return $content; |
|
278 | 278 | |
279 | - } |
|
279 | + } |
|
280 | 280 | |
281 | - /** |
|
282 | - * Parses a string into a Typoscript array |
|
283 | - * |
|
284 | - * @access protected |
|
285 | - * |
|
286 | - * @param string $string: The string to parse |
|
287 | - * |
|
288 | - * @return array The resulting typoscript array |
|
289 | - */ |
|
290 | - protected function parseTS($string = '') { |
|
281 | + /** |
|
282 | + * Parses a string into a Typoscript array |
|
283 | + * |
|
284 | + * @access protected |
|
285 | + * |
|
286 | + * @param string $string: The string to parse |
|
287 | + * |
|
288 | + * @return array The resulting typoscript array |
|
289 | + */ |
|
290 | + protected function parseTS($string = '') { |
|
291 | 291 | |
292 | - $parser = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\TypoScript\\Parser\\TypoScriptParser'); |
|
292 | + $parser = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\TypoScript\\Parser\\TypoScriptParser'); |
|
293 | 293 | |
294 | - $parser->parse($string); |
|
294 | + $parser->parse($string); |
|
295 | 295 | |
296 | - return $parser->setup; |
|
296 | + return $parser->setup; |
|
297 | 297 | |
298 | - } |
|
298 | + } |
|
299 | 299 | |
300 | - /** |
|
301 | - * Sets some configuration variables if the plugin is cached. |
|
302 | - * |
|
303 | - * @access protected |
|
304 | - * |
|
305 | - * @param boolean $cache: Should the plugin be cached? |
|
306 | - * |
|
307 | - * @return void |
|
308 | - */ |
|
309 | - protected function setCache($cache = TRUE) { |
|
300 | + /** |
|
301 | + * Sets some configuration variables if the plugin is cached. |
|
302 | + * |
|
303 | + * @access protected |
|
304 | + * |
|
305 | + * @param boolean $cache: Should the plugin be cached? |
|
306 | + * |
|
307 | + * @return void |
|
308 | + */ |
|
309 | + protected function setCache($cache = TRUE) { |
|
310 | 310 | |
311 | - if ($cache) { |
|
311 | + if ($cache) { |
|
312 | 312 | |
313 | - // Set cObject type to "USER" (default). |
|
314 | - $this->pi_USER_INT_obj = FALSE; |
|
313 | + // Set cObject type to "USER" (default). |
|
314 | + $this->pi_USER_INT_obj = FALSE; |
|
315 | 315 | |
316 | - $this->pi_checkCHash = TRUE; |
|
316 | + $this->pi_checkCHash = TRUE; |
|
317 | 317 | |
318 | - if (count($this->piVars)) { |
|
318 | + if (count($this->piVars)) { |
|
319 | 319 | |
320 | - // Check cHash or disable caching. |
|
321 | - $GLOBALS['TSFE']->reqCHash(); |
|
320 | + // Check cHash or disable caching. |
|
321 | + $GLOBALS['TSFE']->reqCHash(); |
|
322 | 322 | |
323 | - } |
|
323 | + } |
|
324 | 324 | |
325 | - } else { |
|
325 | + } else { |
|
326 | 326 | |
327 | - // Set cObject type to "USER_INT". |
|
328 | - $this->pi_USER_INT_obj = TRUE; |
|
327 | + // Set cObject type to "USER_INT". |
|
328 | + $this->pi_USER_INT_obj = TRUE; |
|
329 | 329 | |
330 | - $this->pi_checkCHash = FALSE; |
|
330 | + $this->pi_checkCHash = FALSE; |
|
331 | 331 | |
332 | - // Plugins are of type "USER" by default, so convert it to "USER_INT". |
|
333 | - $this->cObj->convertToUserIntObject(); |
|
332 | + // Plugins are of type "USER" by default, so convert it to "USER_INT". |
|
333 | + $this->cObj->convertToUserIntObject(); |
|
334 | 334 | |
335 | - } |
|
335 | + } |
|
336 | 336 | |
337 | - } |
|
337 | + } |
|
338 | 338 | |
339 | 339 | } |
@@ -19,860 +19,860 @@ |
||
19 | 19 | */ |
20 | 20 | class tx_dlf_indexing { |
21 | 21 | |
22 | - /** |
|
23 | - * The extension key |
|
24 | - * |
|
25 | - * @var string |
|
26 | - * @access public |
|
27 | - */ |
|
28 | - public static $extKey = 'dlf'; |
|
29 | - |
|
30 | - /** |
|
31 | - * Array of metadata fields' configuration |
|
32 | - * @see loadIndexConf() |
|
33 | - * |
|
34 | - * @var array |
|
35 | - * @access protected |
|
36 | - */ |
|
37 | - protected static $fields = array ( |
|
38 | - 'autocomplete' => array (), |
|
39 | - 'facets' => array (), |
|
40 | - 'sortables' => array (), |
|
41 | - 'indexed' => array (), |
|
42 | - 'stored' => array (), |
|
43 | - 'tokenized' => array (), |
|
44 | - 'fieldboost' => array () |
|
45 | - ); |
|
22 | + /** |
|
23 | + * The extension key |
|
24 | + * |
|
25 | + * @var string |
|
26 | + * @access public |
|
27 | + */ |
|
28 | + public static $extKey = 'dlf'; |
|
29 | + |
|
30 | + /** |
|
31 | + * Array of metadata fields' configuration |
|
32 | + * @see loadIndexConf() |
|
33 | + * |
|
34 | + * @var array |
|
35 | + * @access protected |
|
36 | + */ |
|
37 | + protected static $fields = array ( |
|
38 | + 'autocomplete' => array (), |
|
39 | + 'facets' => array (), |
|
40 | + 'sortables' => array (), |
|
41 | + 'indexed' => array (), |
|
42 | + 'stored' => array (), |
|
43 | + 'tokenized' => array (), |
|
44 | + 'fieldboost' => array () |
|
45 | + ); |
|
46 | 46 | |
47 | - /** |
|
48 | - * Is the index configuration loaded? |
|
49 | - * @see $fields |
|
50 | - * |
|
51 | - * @var boolean |
|
52 | - * @access protected |
|
53 | - */ |
|
54 | - protected static $fieldsLoaded = FALSE; |
|
47 | + /** |
|
48 | + * Is the index configuration loaded? |
|
49 | + * @see $fields |
|
50 | + * |
|
51 | + * @var boolean |
|
52 | + * @access protected |
|
53 | + */ |
|
54 | + protected static $fieldsLoaded = FALSE; |
|
55 | 55 | |
56 | - /** |
|
57 | - * List of already processed documents |
|
58 | - * |
|
59 | - * @var array |
|
60 | - * @access protected |
|
61 | - */ |
|
62 | - protected static $processedDocs = array (); |
|
56 | + /** |
|
57 | + * List of already processed documents |
|
58 | + * |
|
59 | + * @var array |
|
60 | + * @access protected |
|
61 | + */ |
|
62 | + protected static $processedDocs = array (); |
|
63 | 63 | |
64 | - /** |
|
65 | - * Instance of Apache_Solr_Service class |
|
66 | - * |
|
67 | - * @var Apache_Solr_Service |
|
68 | - * @access protected |
|
69 | - */ |
|
70 | - protected static $solr; |
|
64 | + /** |
|
65 | + * Instance of Apache_Solr_Service class |
|
66 | + * |
|
67 | + * @var Apache_Solr_Service |
|
68 | + * @access protected |
|
69 | + */ |
|
70 | + protected static $solr; |
|
71 | 71 | |
72 | - /** |
|
73 | - * Array of toplevel structure elements |
|
74 | - * @see loadIndexConf() |
|
75 | - * |
|
76 | - * @var array |
|
77 | - * @access protected |
|
78 | - */ |
|
79 | - protected static $toplevel = array (); |
|
72 | + /** |
|
73 | + * Array of toplevel structure elements |
|
74 | + * @see loadIndexConf() |
|
75 | + * |
|
76 | + * @var array |
|
77 | + * @access protected |
|
78 | + */ |
|
79 | + protected static $toplevel = array (); |
|
80 | 80 | |
81 | - /** |
|
82 | - * Insert given document into Solr index |
|
83 | - * |
|
84 | - * @access public |
|
85 | - * |
|
86 | - * @param tx_dlf_document &$doc: The document to add |
|
87 | - * @param integer $core: UID of the Solr core to use |
|
88 | - * |
|
89 | - * @return integer 0 on success or 1 on failure |
|
90 | - */ |
|
91 | - public static function add(tx_dlf_document &$doc, $core = 0) { |
|
81 | + /** |
|
82 | + * Insert given document into Solr index |
|
83 | + * |
|
84 | + * @access public |
|
85 | + * |
|
86 | + * @param tx_dlf_document &$doc: The document to add |
|
87 | + * @param integer $core: UID of the Solr core to use |
|
88 | + * |
|
89 | + * @return integer 0 on success or 1 on failure |
|
90 | + */ |
|
91 | + public static function add(tx_dlf_document &$doc, $core = 0) { |
|
92 | 92 | |
93 | - if (in_array($doc->uid, self::$processedDocs)) { |
|
93 | + if (in_array($doc->uid, self::$processedDocs)) { |
|
94 | 94 | |
95 | - return 0; |
|
95 | + return 0; |
|
96 | 96 | |
97 | - } elseif (self::solrConnect($core, $doc->pid)) { |
|
97 | + } elseif (self::solrConnect($core, $doc->pid)) { |
|
98 | 98 | |
99 | - $errors = 0; |
|
99 | + $errors = 0; |
|
100 | 100 | |
101 | - // Handle multi-volume documents. |
|
102 | - if ($doc->parentId) { |
|
101 | + // Handle multi-volume documents. |
|
102 | + if ($doc->parentId) { |
|
103 | 103 | |
104 | - $parent =& tx_dlf_document::getInstance($doc->parentId, 0, TRUE); |
|
104 | + $parent =& tx_dlf_document::getInstance($doc->parentId, 0, TRUE); |
|
105 | 105 | |
106 | - if ($parent->ready) { |
|
106 | + if ($parent->ready) { |
|
107 | 107 | |
108 | - $errors = self::add($parent, $core); |
|
108 | + $errors = self::add($parent, $core); |
|
109 | 109 | |
110 | - } else { |
|
110 | + } else { |
|
111 | 111 | |
112 | - if (TYPO3_DLOG) { |
|
112 | + if (TYPO3_DLOG) { |
|
113 | 113 | |
114 | - \TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[tx_dlf_indexing->add(['.$doc->uid.'], '.$core.')] Could not load parent document with UID "'.$doc->parentId.'"', self::$extKey, SYSLOG_SEVERITY_ERROR); |
|
114 | + \TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[tx_dlf_indexing->add(['.$doc->uid.'], '.$core.')] Could not load parent document with UID "'.$doc->parentId.'"', self::$extKey, SYSLOG_SEVERITY_ERROR); |
|
115 | 115 | |
116 | - } |
|
116 | + } |
|
117 | 117 | |
118 | - return 1; |
|
118 | + return 1; |
|
119 | 119 | |
120 | - } |
|
120 | + } |
|
121 | 121 | |
122 | - } |
|
122 | + } |
|
123 | 123 | |
124 | - try { |
|
124 | + try { |
|
125 | 125 | |
126 | - // Add document to list of processed documents. |
|
127 | - self::$processedDocs[] = $doc->uid; |
|
126 | + // Add document to list of processed documents. |
|
127 | + self::$processedDocs[] = $doc->uid; |
|
128 | 128 | |
129 | - // Delete old Solr documents. |
|
130 | - self::$solr->service->deleteByQuery('uid:'.$doc->uid); |
|
129 | + // Delete old Solr documents. |
|
130 | + self::$solr->service->deleteByQuery('uid:'.$doc->uid); |
|
131 | 131 | |
132 | - // Index every logical unit as separate Solr document. |
|
133 | - foreach ($doc->tableOfContents as $logicalUnit) { |
|
132 | + // Index every logical unit as separate Solr document. |
|
133 | + foreach ($doc->tableOfContents as $logicalUnit) { |
|
134 | 134 | |
135 | - if (!$errors) { |
|
135 | + if (!$errors) { |
|
136 | 136 | |
137 | - $errors = self::processLogical($doc, $logicalUnit); |
|
137 | + $errors = self::processLogical($doc, $logicalUnit); |
|
138 | 138 | |
139 | - } else { |
|
139 | + } else { |
|
140 | 140 | |
141 | - break; |
|
141 | + break; |
|
142 | 142 | |
143 | - } |
|
143 | + } |
|
144 | 144 | |
145 | - } |
|
145 | + } |
|
146 | 146 | |
147 | - // Index fulltext files if available. |
|
148 | - if ($doc->hasFulltext) { |
|
147 | + // Index fulltext files if available. |
|
148 | + if ($doc->hasFulltext) { |
|
149 | 149 | |
150 | - foreach ($doc->physicalStructure as $pageNumber => $xmlId) { |
|
150 | + foreach ($doc->physicalStructure as $pageNumber => $xmlId) { |
|
151 | 151 | |
152 | - if (!$errors) { |
|
152 | + if (!$errors) { |
|
153 | 153 | |
154 | - $errors = self::processPhysical($doc, $pageNumber, $doc->physicalStructureInfo[$xmlId]); |
|
154 | + $errors = self::processPhysical($doc, $pageNumber, $doc->physicalStructureInfo[$xmlId]); |
|
155 | 155 | |
156 | - } else { |
|
156 | + } else { |
|
157 | 157 | |
158 | - break; |
|
158 | + break; |
|
159 | 159 | |
160 | - } |
|
160 | + } |
|
161 | 161 | |
162 | - } |
|
162 | + } |
|
163 | 163 | |
164 | - } |
|
164 | + } |
|
165 | 165 | |
166 | - self::$solr->service->commit(); |
|
166 | + self::$solr->service->commit(); |
|
167 | 167 | |
168 | - // Get document title from database. |
|
169 | - $result = $GLOBALS['TYPO3_DB']->exec_SELECTquery( |
|
170 | - 'tx_dlf_documents.title AS title', |
|
171 | - 'tx_dlf_documents', |
|
172 | - 'tx_dlf_documents.uid='.intval($doc->uid).tx_dlf_helper::whereClause('tx_dlf_documents'), |
|
173 | - '', |
|
174 | - '', |
|
175 | - '1' |
|
176 | - ); |
|
168 | + // Get document title from database. |
|
169 | + $result = $GLOBALS['TYPO3_DB']->exec_SELECTquery( |
|
170 | + 'tx_dlf_documents.title AS title', |
|
171 | + 'tx_dlf_documents', |
|
172 | + 'tx_dlf_documents.uid='.intval($doc->uid).tx_dlf_helper::whereClause('tx_dlf_documents'), |
|
173 | + '', |
|
174 | + '', |
|
175 | + '1' |
|
176 | + ); |
|
177 | 177 | |
178 | - $resArray = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($result); |
|
178 | + $resArray = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($result); |
|
179 | 179 | |
180 | - if (!defined('TYPO3_cliMode')) { |
|
180 | + if (!defined('TYPO3_cliMode')) { |
|
181 | 181 | |
182 | - if (!$errors) { |
|
182 | + if (!$errors) { |
|
183 | 183 | |
184 | - $message = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance( |
|
185 | - 'TYPO3\\CMS\\Core\\Messaging\\FlashMessage', |
|
186 | - htmlspecialchars(sprintf(tx_dlf_helper::getLL('flash.documentIndexed'), $resArray['title'], $doc->uid)), |
|
187 | - tx_dlf_helper::getLL('flash.done', TRUE), |
|
188 | - \TYPO3\CMS\Core\Messaging\FlashMessage::OK, |
|
189 | - TRUE |
|
190 | - ); |
|
184 | + $message = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance( |
|
185 | + 'TYPO3\\CMS\\Core\\Messaging\\FlashMessage', |
|
186 | + htmlspecialchars(sprintf(tx_dlf_helper::getLL('flash.documentIndexed'), $resArray['title'], $doc->uid)), |
|
187 | + tx_dlf_helper::getLL('flash.done', TRUE), |
|
188 | + \TYPO3\CMS\Core\Messaging\FlashMessage::OK, |
|
189 | + TRUE |
|
190 | + ); |
|
191 | 191 | |
192 | - } else { |
|
192 | + } else { |
|
193 | 193 | |
194 | - $message = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance( |
|
195 | - 'TYPO3\\CMS\\Core\\Messaging\\FlashMessage', |
|
196 | - htmlspecialchars(sprintf(tx_dlf_helper::getLL('flash.documentNotIndexed'), $resArray['title'], $doc->uid)), |
|
197 | - tx_dlf_helper::getLL('flash.error', TRUE), |
|
198 | - \TYPO3\CMS\Core\Messaging\FlashMessage::ERROR, |
|
199 | - TRUE |
|
200 | - ); |
|
194 | + $message = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance( |
|
195 | + 'TYPO3\\CMS\\Core\\Messaging\\FlashMessage', |
|
196 | + htmlspecialchars(sprintf(tx_dlf_helper::getLL('flash.documentNotIndexed'), $resArray['title'], $doc->uid)), |
|
197 | + tx_dlf_helper::getLL('flash.error', TRUE), |
|
198 | + \TYPO3\CMS\Core\Messaging\FlashMessage::ERROR, |
|
199 | + TRUE |
|
200 | + ); |
|
201 | 201 | |
202 | - } |
|
202 | + } |
|
203 | 203 | |
204 | - tx_dlf_helper::addMessage($message); |
|
204 | + tx_dlf_helper::addMessage($message); |
|
205 | 205 | |
206 | - } |
|
206 | + } |
|
207 | 207 | |
208 | - return $errors; |
|
208 | + return $errors; |
|
209 | 209 | |
210 | - } catch (Exception $e) { |
|
210 | + } catch (Exception $e) { |
|
211 | 211 | |
212 | - if (!defined('TYPO3_cliMode')) { |
|
212 | + if (!defined('TYPO3_cliMode')) { |
|
213 | 213 | |
214 | - $message = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance( |
|
215 | - 'TYPO3\\CMS\\Core\\Messaging\\FlashMessage', |
|
216 | - tx_dlf_helper::getLL('flash.solrException', TRUE).'<br />'.htmlspecialchars($e->getMessage()), |
|
217 | - tx_dlf_helper::getLL('flash.error', TRUE), |
|
218 | - \TYPO3\CMS\Core\Messaging\FlashMessage::ERROR, |
|
219 | - TRUE |
|
220 | - ); |
|
214 | + $message = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance( |
|
215 | + 'TYPO3\\CMS\\Core\\Messaging\\FlashMessage', |
|
216 | + tx_dlf_helper::getLL('flash.solrException', TRUE).'<br />'.htmlspecialchars($e->getMessage()), |
|
217 | + tx_dlf_helper::getLL('flash.error', TRUE), |
|
218 | + \TYPO3\CMS\Core\Messaging\FlashMessage::ERROR, |
|
219 | + TRUE |
|
220 | + ); |
|
221 | 221 | |
222 | - tx_dlf_helper::addMessage($message); |
|
222 | + tx_dlf_helper::addMessage($message); |
|
223 | 223 | |
224 | - } |
|
224 | + } |
|
225 | 225 | |
226 | - if (TYPO3_DLOG) { |
|
226 | + if (TYPO3_DLOG) { |
|
227 | 227 | |
228 | - \TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[tx_dlf_indexing->add(['.$doc->uid.'], '.$core.')] Apache Solr threw exception: "'.$e->getMessage().'"', self::$extKey, SYSLOG_SEVERITY_ERROR); |
|
228 | + \TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[tx_dlf_indexing->add(['.$doc->uid.'], '.$core.')] Apache Solr threw exception: "'.$e->getMessage().'"', self::$extKey, SYSLOG_SEVERITY_ERROR); |
|
229 | 229 | |
230 | - } |
|
230 | + } |
|
231 | 231 | |
232 | - return 1; |
|
232 | + return 1; |
|
233 | 233 | |
234 | - } |
|
234 | + } |
|
235 | 235 | |
236 | - } else { |
|
236 | + } else { |
|
237 | 237 | |
238 | - if (!defined('TYPO3_cliMode')) { |
|
238 | + if (!defined('TYPO3_cliMode')) { |
|
239 | 239 | |
240 | - $message = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance( |
|
241 | - 'TYPO3\\CMS\\Core\\Messaging\\FlashMessage', |
|
242 | - tx_dlf_helper::getLL('flash.solrNoConnection', TRUE), |
|
243 | - tx_dlf_helper::getLL('flash.warning', TRUE), |
|
244 | - \TYPO3\CMS\Core\Messaging\FlashMessage::WARNING, |
|
245 | - TRUE |
|
246 | - ); |
|
240 | + $message = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance( |
|
241 | + 'TYPO3\\CMS\\Core\\Messaging\\FlashMessage', |
|
242 | + tx_dlf_helper::getLL('flash.solrNoConnection', TRUE), |
|
243 | + tx_dlf_helper::getLL('flash.warning', TRUE), |
|
244 | + \TYPO3\CMS\Core\Messaging\FlashMessage::WARNING, |
|
245 | + TRUE |
|
246 | + ); |
|
247 | 247 | |
248 | - tx_dlf_helper::addMessage($message); |
|
248 | + tx_dlf_helper::addMessage($message); |
|
249 | 249 | |
250 | - } |
|
250 | + } |
|
251 | 251 | |
252 | - if (TYPO3_DLOG) { |
|
252 | + if (TYPO3_DLOG) { |
|
253 | 253 | |
254 | - \TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[tx_dlf_indexing->add(['.$doc->uid.'], '.$core.')] Could not connect to Apache Solr server', self::$extKey, SYSLOG_SEVERITY_ERROR); |
|
254 | + \TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[tx_dlf_indexing->add(['.$doc->uid.'], '.$core.')] Could not connect to Apache Solr server', self::$extKey, SYSLOG_SEVERITY_ERROR); |
|
255 | 255 | |
256 | - } |
|
256 | + } |
|
257 | 257 | |
258 | - return 1; |
|
258 | + return 1; |
|
259 | 259 | |
260 | - } |
|
260 | + } |
|
261 | 261 | |
262 | - } |
|
262 | + } |
|
263 | 263 | |
264 | - /** |
|
265 | - * Delete document from Solr index |
|
266 | - * |
|
267 | - * @access public |
|
268 | - * |
|
269 | - * @param integer $uid: UID of the document to delete |
|
270 | - * |
|
271 | - * @return integer 0 on success or 1 on failure |
|
272 | - */ |
|
273 | - public static function delete($uid) { |
|
264 | + /** |
|
265 | + * Delete document from Solr index |
|
266 | + * |
|
267 | + * @access public |
|
268 | + * |
|
269 | + * @param integer $uid: UID of the document to delete |
|
270 | + * |
|
271 | + * @return integer 0 on success or 1 on failure |
|
272 | + */ |
|
273 | + public static function delete($uid) { |
|
274 | 274 | |
275 | - // Save parameter for logging purposes. |
|
276 | - $_uid = $uid; |
|
275 | + // Save parameter for logging purposes. |
|
276 | + $_uid = $uid; |
|
277 | 277 | |
278 | - // Sanitize input. |
|
279 | - $uid = max(intval($uid), 0); |
|
278 | + // Sanitize input. |
|
279 | + $uid = max(intval($uid), 0); |
|
280 | 280 | |
281 | - // Get Solr core for document. |
|
282 | - $result = $GLOBALS['TYPO3_DB']->exec_SELECTquery( |
|
283 | - 'tx_dlf_solrcores.uid AS uid,tx_dlf_documents.title AS title', |
|
284 | - 'tx_dlf_solrcores,tx_dlf_documents', |
|
285 | - 'tx_dlf_solrcores.uid=tx_dlf_documents.solrcore AND tx_dlf_documents.uid='.$uid.tx_dlf_helper::whereClause('tx_dlf_solrcores'), |
|
286 | - '', |
|
287 | - '', |
|
288 | - '1' |
|
289 | - ); |
|
281 | + // Get Solr core for document. |
|
282 | + $result = $GLOBALS['TYPO3_DB']->exec_SELECTquery( |
|
283 | + 'tx_dlf_solrcores.uid AS uid,tx_dlf_documents.title AS title', |
|
284 | + 'tx_dlf_solrcores,tx_dlf_documents', |
|
285 | + 'tx_dlf_solrcores.uid=tx_dlf_documents.solrcore AND tx_dlf_documents.uid='.$uid.tx_dlf_helper::whereClause('tx_dlf_solrcores'), |
|
286 | + '', |
|
287 | + '', |
|
288 | + '1' |
|
289 | + ); |
|
290 | 290 | |
291 | - if ($GLOBALS['TYPO3_DB']->sql_num_rows($result)) { |
|
291 | + if ($GLOBALS['TYPO3_DB']->sql_num_rows($result)) { |
|
292 | 292 | |
293 | - list ($core, $title) = $GLOBALS['TYPO3_DB']->sql_fetch_row($result); |
|
293 | + list ($core, $title) = $GLOBALS['TYPO3_DB']->sql_fetch_row($result); |
|
294 | 294 | |
295 | - // Establish Solr connection. |
|
296 | - if (self::solrConnect($core)) { |
|
295 | + // Establish Solr connection. |
|
296 | + if (self::solrConnect($core)) { |
|
297 | 297 | |
298 | - try { |
|
298 | + try { |
|
299 | 299 | |
300 | - // Delete Solr document. |
|
301 | - self::$solr->service->deleteByQuery('uid:'.$uid); |
|
300 | + // Delete Solr document. |
|
301 | + self::$solr->service->deleteByQuery('uid:'.$uid); |
|
302 | 302 | |
303 | - self::$solr->service->commit(); |
|
303 | + self::$solr->service->commit(); |
|
304 | 304 | |
305 | - } catch (Exception $e) { |
|
305 | + } catch (Exception $e) { |
|
306 | 306 | |
307 | - if (!defined('TYPO3_cliMode')) { |
|
307 | + if (!defined('TYPO3_cliMode')) { |
|
308 | 308 | |
309 | - $message = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance( |
|
310 | - 'TYPO3\\CMS\\Core\\Messaging\\FlashMessage', |
|
311 | - tx_dlf_helper::getLL('flash.solrException', TRUE).'<br />'.htmlspecialchars($e->getMessage()), |
|
312 | - tx_dlf_helper::getLL('flash.error', TRUE), |
|
313 | - \TYPO3\CMS\Core\Messaging\FlashMessage::ERROR, |
|
314 | - TRUE |
|
315 | - ); |
|
309 | + $message = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance( |
|
310 | + 'TYPO3\\CMS\\Core\\Messaging\\FlashMessage', |
|
311 | + tx_dlf_helper::getLL('flash.solrException', TRUE).'<br />'.htmlspecialchars($e->getMessage()), |
|
312 | + tx_dlf_helper::getLL('flash.error', TRUE), |
|
313 | + \TYPO3\CMS\Core\Messaging\FlashMessage::ERROR, |
|
314 | + TRUE |
|
315 | + ); |
|
316 | 316 | |
317 | - tx_dlf_helper::addMessage($message); |
|
317 | + tx_dlf_helper::addMessage($message); |
|
318 | 318 | |
319 | - } |
|
319 | + } |
|
320 | 320 | |
321 | - if (TYPO3_DLOG) { |
|
321 | + if (TYPO3_DLOG) { |
|
322 | 322 | |
323 | - \TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[tx_dlf_indexing->delete('.$_uid.')] Apache Solr threw exception: "'.$e->getMessage().'"', self::$extKey, SYSLOG_SEVERITY_ERROR); |
|
323 | + \TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[tx_dlf_indexing->delete('.$_uid.')] Apache Solr threw exception: "'.$e->getMessage().'"', self::$extKey, SYSLOG_SEVERITY_ERROR); |
|
324 | 324 | |
325 | - } |
|
325 | + } |
|
326 | 326 | |
327 | - return 1; |
|
327 | + return 1; |
|
328 | 328 | |
329 | - } |
|
329 | + } |
|
330 | 330 | |
331 | - } else { |
|
331 | + } else { |
|
332 | 332 | |
333 | - if (!defined('TYPO3_cliMode')) { |
|
333 | + if (!defined('TYPO3_cliMode')) { |
|
334 | 334 | |
335 | - $message = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance( |
|
336 | - 'TYPO3\\CMS\\Core\\Messaging\\FlashMessage', |
|
337 | - tx_dlf_helper::getLL('flash.solrNoConnection', TRUE), |
|
338 | - tx_dlf_helper::getLL('flash.error', TRUE), |
|
339 | - \TYPO3\CMS\Core\Messaging\FlashMessage::ERROR, |
|
340 | - TRUE |
|
341 | - ); |
|
335 | + $message = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance( |
|
336 | + 'TYPO3\\CMS\\Core\\Messaging\\FlashMessage', |
|
337 | + tx_dlf_helper::getLL('flash.solrNoConnection', TRUE), |
|
338 | + tx_dlf_helper::getLL('flash.error', TRUE), |
|
339 | + \TYPO3\CMS\Core\Messaging\FlashMessage::ERROR, |
|
340 | + TRUE |
|
341 | + ); |
|
342 | 342 | |
343 | - tx_dlf_helper::addMessage($message); |
|
343 | + tx_dlf_helper::addMessage($message); |
|
344 | 344 | |
345 | - } |
|
345 | + } |
|
346 | 346 | |
347 | - if (TYPO3_DLOG) { |
|
347 | + if (TYPO3_DLOG) { |
|
348 | 348 | |
349 | - \TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[tx_dlf_indexing->delete('.$_uid.')] Could not connect to Apache Solr server', self::$extKey, SYSLOG_SEVERITY_ERROR); |
|
349 | + \TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[tx_dlf_indexing->delete('.$_uid.')] Could not connect to Apache Solr server', self::$extKey, SYSLOG_SEVERITY_ERROR); |
|
350 | 350 | |
351 | - } |
|
351 | + } |
|
352 | 352 | |
353 | - return 1; |
|
353 | + return 1; |
|
354 | 354 | |
355 | - } |
|
355 | + } |
|
356 | 356 | |
357 | - if (!defined('TYPO3_cliMode')) { |
|
357 | + if (!defined('TYPO3_cliMode')) { |
|
358 | 358 | |
359 | - $message = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance( |
|
360 | - 'TYPO3\\CMS\\Core\\Messaging\\FlashMessage', |
|
361 | - htmlspecialchars(sprintf(tx_dlf_helper::getLL('flash.documentDeleted'), $title, $uid)), |
|
362 | - tx_dlf_helper::getLL('flash.done', TRUE), |
|
363 | - \TYPO3\CMS\Core\Messaging\FlashMessage::OK, |
|
364 | - TRUE |
|
365 | - ); |
|
359 | + $message = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance( |
|
360 | + 'TYPO3\\CMS\\Core\\Messaging\\FlashMessage', |
|
361 | + htmlspecialchars(sprintf(tx_dlf_helper::getLL('flash.documentDeleted'), $title, $uid)), |
|
362 | + tx_dlf_helper::getLL('flash.done', TRUE), |
|
363 | + \TYPO3\CMS\Core\Messaging\FlashMessage::OK, |
|
364 | + TRUE |
|
365 | + ); |
|
366 | 366 | |
367 | - tx_dlf_helper::addMessage($message); |
|
367 | + tx_dlf_helper::addMessage($message); |
|
368 | 368 | |
369 | - } |
|
369 | + } |
|
370 | 370 | |
371 | - return 0; |
|
371 | + return 0; |
|
372 | 372 | |
373 | - } else { |
|
373 | + } else { |
|
374 | 374 | |
375 | - if (TYPO3_DLOG) { |
|
375 | + if (TYPO3_DLOG) { |
|
376 | 376 | |
377 | - \TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[tx_dlf_indexing->delete('.$_uid.')] Invalid UID "'.$uid.'" for document deletion', self::$extKey, SYSLOG_SEVERITY_ERROR); |
|
377 | + \TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[tx_dlf_indexing->delete('.$_uid.')] Invalid UID "'.$uid.'" for document deletion', self::$extKey, SYSLOG_SEVERITY_ERROR); |
|
378 | 378 | |
379 | - } |
|
379 | + } |
|
380 | 380 | |
381 | - return 1; |
|
381 | + return 1; |
|
382 | 382 | |
383 | - } |
|
383 | + } |
|
384 | 384 | |
385 | - } |
|
385 | + } |
|
386 | 386 | |
387 | - /** |
|
388 | - * Returns the dynamic index field name for the given metadata field. |
|
389 | - * |
|
390 | - * @access public |
|
391 | - * |
|
392 | - * @param string $index_name: The metadata field's name in database |
|
393 | - * @param integer $pid: UID of the configuration page |
|
394 | - * |
|
395 | - * @return string The field's dynamic index name |
|
396 | - */ |
|
397 | - public static function getIndexFieldName($index_name, $pid = 0) { |
|
387 | + /** |
|
388 | + * Returns the dynamic index field name for the given metadata field. |
|
389 | + * |
|
390 | + * @access public |
|
391 | + * |
|
392 | + * @param string $index_name: The metadata field's name in database |
|
393 | + * @param integer $pid: UID of the configuration page |
|
394 | + * |
|
395 | + * @return string The field's dynamic index name |
|
396 | + */ |
|
397 | + public static function getIndexFieldName($index_name, $pid = 0) { |
|
398 | 398 | |
399 | - // Save parameter for logging purposes. |
|
400 | - $_pid = $pid; |
|
399 | + // Save parameter for logging purposes. |
|
400 | + $_pid = $pid; |
|
401 | 401 | |
402 | - // Sanitize input. |
|
403 | - $pid = max(intval($pid), 0); |
|
402 | + // Sanitize input. |
|
403 | + $pid = max(intval($pid), 0); |
|
404 | 404 | |
405 | - if (!$pid) { |
|
405 | + if (!$pid) { |
|
406 | 406 | |
407 | - if (TYPO3_DLOG) { |
|
407 | + if (TYPO3_DLOG) { |
|
408 | 408 | |
409 | - \TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[tx_dlf_indexing->getIndexFieldName('.$index_name.', '.$_pid.')] Invalid PID "'.$pid.'" for metadata configuration', self::$extKey, SYSLOG_SEVERITY_ERROR); |
|
409 | + \TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[tx_dlf_indexing->getIndexFieldName('.$index_name.', '.$_pid.')] Invalid PID "'.$pid.'" for metadata configuration', self::$extKey, SYSLOG_SEVERITY_ERROR); |
|
410 | 410 | |
411 | - } |
|
411 | + } |
|
412 | 412 | |
413 | - return ''; |
|
413 | + return ''; |
|
414 | 414 | |
415 | - } |
|
415 | + } |
|
416 | 416 | |
417 | - // Load metadata configuration. |
|
418 | - self::loadIndexConf($pid); |
|
417 | + // Load metadata configuration. |
|
418 | + self::loadIndexConf($pid); |
|
419 | 419 | |
420 | - // Build field's suffix. |
|
421 | - $suffix = (in_array($index_name, self::$fields['tokenized']) ? 't' : 'u'); |
|
420 | + // Build field's suffix. |
|
421 | + $suffix = (in_array($index_name, self::$fields['tokenized']) ? 't' : 'u'); |
|
422 | 422 | |
423 | - $suffix .= (in_array($index_name, self::$fields['stored']) ? 's' : 'u'); |
|
423 | + $suffix .= (in_array($index_name, self::$fields['stored']) ? 's' : 'u'); |
|
424 | 424 | |
425 | - $suffix .= (in_array($index_name, self::$fields['indexed']) ? 'i' : 'u'); |
|
425 | + $suffix .= (in_array($index_name, self::$fields['indexed']) ? 'i' : 'u'); |
|
426 | 426 | |
427 | - $index_name .= '_'.$suffix; |
|
427 | + $index_name .= '_'.$suffix; |
|
428 | 428 | |
429 | - return $index_name; |
|
429 | + return $index_name; |
|
430 | 430 | |
431 | - } |
|
431 | + } |
|
432 | 432 | |
433 | - /** |
|
434 | - * Load indexing configuration |
|
435 | - * |
|
436 | - * @access protected |
|
437 | - * |
|
438 | - * @param integer $pid: The configuration page's UID |
|
439 | - * |
|
440 | - * @return void |
|
441 | - */ |
|
442 | - protected static function loadIndexConf($pid) { |
|
433 | + /** |
|
434 | + * Load indexing configuration |
|
435 | + * |
|
436 | + * @access protected |
|
437 | + * |
|
438 | + * @param integer $pid: The configuration page's UID |
|
439 | + * |
|
440 | + * @return void |
|
441 | + */ |
|
442 | + protected static function loadIndexConf($pid) { |
|
443 | 443 | |
444 | - if (!self::$fieldsLoaded) { |
|
444 | + if (!self::$fieldsLoaded) { |
|
445 | 445 | |
446 | - // Get the list of toplevel structures. |
|
447 | - $result = $GLOBALS['TYPO3_DB']->exec_SELECTquery( |
|
448 | - 'tx_dlf_structures.index_name AS index_name', |
|
449 | - 'tx_dlf_structures', |
|
450 | - 'tx_dlf_structures.toplevel=1 AND tx_dlf_structures.pid='.intval($pid).tx_dlf_helper::whereClause('tx_dlf_structures'), |
|
451 | - '', |
|
452 | - '', |
|
453 | - '' |
|
454 | - ); |
|
446 | + // Get the list of toplevel structures. |
|
447 | + $result = $GLOBALS['TYPO3_DB']->exec_SELECTquery( |
|
448 | + 'tx_dlf_structures.index_name AS index_name', |
|
449 | + 'tx_dlf_structures', |
|
450 | + 'tx_dlf_structures.toplevel=1 AND tx_dlf_structures.pid='.intval($pid).tx_dlf_helper::whereClause('tx_dlf_structures'), |
|
451 | + '', |
|
452 | + '', |
|
453 | + '' |
|
454 | + ); |
|
455 | 455 | |
456 | - while ($toplevel = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($result)) { |
|
456 | + while ($toplevel = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($result)) { |
|
457 | 457 | |
458 | - self::$toplevel[] = $toplevel['index_name']; |
|
458 | + self::$toplevel[] = $toplevel['index_name']; |
|
459 | 459 | |
460 | - } |
|
460 | + } |
|
461 | 461 | |
462 | - // Get the metadata indexing options. |
|
463 | - $result = $GLOBALS['TYPO3_DB']->exec_SELECTquery( |
|
464 | - 'tx_dlf_metadata.index_name AS index_name,tx_dlf_metadata.index_tokenized AS index_tokenized,tx_dlf_metadata.index_stored AS index_stored,tx_dlf_metadata.index_indexed AS index_indexed,tx_dlf_metadata.is_sortable AS is_sortable,tx_dlf_metadata.is_facet AS is_facet,tx_dlf_metadata.is_listed AS is_listed,tx_dlf_metadata.index_autocomplete AS index_autocomplete,tx_dlf_metadata.index_boost AS index_boost', |
|
465 | - 'tx_dlf_metadata', |
|
466 | - 'tx_dlf_metadata.pid='.intval($pid).tx_dlf_helper::whereClause('tx_dlf_metadata'), |
|
467 | - '', |
|
468 | - '', |
|
469 | - '' |
|
470 | - ); |
|
462 | + // Get the metadata indexing options. |
|
463 | + $result = $GLOBALS['TYPO3_DB']->exec_SELECTquery( |
|
464 | + 'tx_dlf_metadata.index_name AS index_name,tx_dlf_metadata.index_tokenized AS index_tokenized,tx_dlf_metadata.index_stored AS index_stored,tx_dlf_metadata.index_indexed AS index_indexed,tx_dlf_metadata.is_sortable AS is_sortable,tx_dlf_metadata.is_facet AS is_facet,tx_dlf_metadata.is_listed AS is_listed,tx_dlf_metadata.index_autocomplete AS index_autocomplete,tx_dlf_metadata.index_boost AS index_boost', |
|
465 | + 'tx_dlf_metadata', |
|
466 | + 'tx_dlf_metadata.pid='.intval($pid).tx_dlf_helper::whereClause('tx_dlf_metadata'), |
|
467 | + '', |
|
468 | + '', |
|
469 | + '' |
|
470 | + ); |
|
471 | 471 | |
472 | - while ($indexing = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($result)) { |
|
472 | + while ($indexing = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($result)) { |
|
473 | 473 | |
474 | - if ($indexing['index_tokenized']) { |
|
474 | + if ($indexing['index_tokenized']) { |
|
475 | 475 | |
476 | - self::$fields['tokenized'][] = $indexing['index_name']; |
|
476 | + self::$fields['tokenized'][] = $indexing['index_name']; |
|
477 | 477 | |
478 | - } |
|
478 | + } |
|
479 | 479 | |
480 | - if ($indexing['index_stored'] || $indexing['is_listed']) { |
|
480 | + if ($indexing['index_stored'] || $indexing['is_listed']) { |
|
481 | 481 | |
482 | - self::$fields['stored'][] = $indexing['index_name']; |
|
482 | + self::$fields['stored'][] = $indexing['index_name']; |
|
483 | 483 | |
484 | - } |
|
484 | + } |
|
485 | 485 | |
486 | - if ($indexing['index_indexed'] || $indexing['index_autocomplete']) { |
|
486 | + if ($indexing['index_indexed'] || $indexing['index_autocomplete']) { |
|
487 | 487 | |
488 | - self::$fields['indexed'][] = $indexing['index_name']; |
|
488 | + self::$fields['indexed'][] = $indexing['index_name']; |
|
489 | 489 | |
490 | - } |
|
490 | + } |
|
491 | 491 | |
492 | - if ($indexing['is_sortable']) { |
|
492 | + if ($indexing['is_sortable']) { |
|
493 | 493 | |
494 | - self::$fields['sortables'][] = $indexing['index_name']; |
|
494 | + self::$fields['sortables'][] = $indexing['index_name']; |
|
495 | 495 | |
496 | - } |
|
496 | + } |
|
497 | 497 | |
498 | - if ($indexing['is_facet']) { |
|
498 | + if ($indexing['is_facet']) { |
|
499 | 499 | |
500 | - self::$fields['facets'][] = $indexing['index_name']; |
|
500 | + self::$fields['facets'][] = $indexing['index_name']; |
|
501 | 501 | |
502 | - } |
|
502 | + } |
|
503 | 503 | |
504 | - if ($indexing['index_autocomplete']) { |
|
504 | + if ($indexing['index_autocomplete']) { |
|
505 | 505 | |
506 | - self::$fields['autocomplete'][] = $indexing['index_name']; |
|
506 | + self::$fields['autocomplete'][] = $indexing['index_name']; |
|
507 | 507 | |
508 | - } |
|
508 | + } |
|
509 | 509 | |
510 | - if ($indexing['index_boost'] > 0.0) { |
|
510 | + if ($indexing['index_boost'] > 0.0) { |
|
511 | 511 | |
512 | - self::$fields['fieldboost'][$indexing['index_name']] = floatval($indexing['index_boost']); |
|
512 | + self::$fields['fieldboost'][$indexing['index_name']] = floatval($indexing['index_boost']); |
|
513 | 513 | |
514 | - } else { |
|
514 | + } else { |
|
515 | 515 | |
516 | - self::$fields['fieldboost'][$indexing['index_name']] = FALSE; |
|
516 | + self::$fields['fieldboost'][$indexing['index_name']] = FALSE; |
|
517 | 517 | |
518 | - } |
|
518 | + } |
|
519 | 519 | |
520 | - } |
|
520 | + } |
|
521 | 521 | |
522 | - self::$fieldsLoaded = TRUE; |
|
522 | + self::$fieldsLoaded = TRUE; |
|
523 | 523 | |
524 | - } |
|
524 | + } |
|
525 | 525 | |
526 | - } |
|
526 | + } |
|
527 | 527 | |
528 | - /** |
|
529 | - * Processes a logical unit (and its children) for the Solr index |
|
530 | - * |
|
531 | - * @access protected |
|
532 | - * |
|
533 | - * @param tx_dlf_document &$doc: The METS document |
|
534 | - * @param array $logicalUnit: Array of the logical unit to process |
|
535 | - * |
|
536 | - * @return integer 0 on success or 1 on failure |
|
537 | - */ |
|
538 | - protected static function processLogical(tx_dlf_document &$doc, array $logicalUnit) { |
|
528 | + /** |
|
529 | + * Processes a logical unit (and its children) for the Solr index |
|
530 | + * |
|
531 | + * @access protected |
|
532 | + * |
|
533 | + * @param tx_dlf_document &$doc: The METS document |
|
534 | + * @param array $logicalUnit: Array of the logical unit to process |
|
535 | + * |
|
536 | + * @return integer 0 on success or 1 on failure |
|
537 | + */ |
|
538 | + protected static function processLogical(tx_dlf_document &$doc, array $logicalUnit) { |
|
539 | 539 | |
540 | - $errors = 0; |
|
540 | + $errors = 0; |
|
541 | 541 | |
542 | - // Get metadata for logical unit. |
|
543 | - $metadata = $doc->metadataArray[$logicalUnit['id']]; |
|
542 | + // Get metadata for logical unit. |
|
543 | + $metadata = $doc->metadataArray[$logicalUnit['id']]; |
|
544 | 544 | |
545 | - if (!empty($metadata)) { |
|
545 | + if (!empty($metadata)) { |
|
546 | 546 | |
547 | - // Load class. |
|
548 | - if (!class_exists('Apache_Solr_Document')) { |
|
547 | + // Load class. |
|
548 | + if (!class_exists('Apache_Solr_Document')) { |
|
549 | 549 | |
550 | - require_once(\TYPO3\CMS\Core\Utility\GeneralUtility::getFileAbsFileName('EXT:'.self::$extKey.'/lib/SolrPhpClient/Apache/Solr/Document.php')); |
|
550 | + require_once(\TYPO3\CMS\Core\Utility\GeneralUtility::getFileAbsFileName('EXT:'.self::$extKey.'/lib/SolrPhpClient/Apache/Solr/Document.php')); |
|
551 | 551 | |
552 | - } |
|
552 | + } |
|
553 | 553 | |
554 | - // Create new Solr document. |
|
555 | - $solrDoc = new Apache_Solr_Document(); |
|
554 | + // Create new Solr document. |
|
555 | + $solrDoc = new Apache_Solr_Document(); |
|
556 | 556 | |
557 | - // Create unique identifier from document's UID and unit's XML ID. |
|
558 | - $solrDoc->setField('id', $doc->uid.$logicalUnit['id']); |
|
557 | + // Create unique identifier from document's UID and unit's XML ID. |
|
558 | + $solrDoc->setField('id', $doc->uid.$logicalUnit['id']); |
|
559 | 559 | |
560 | - $solrDoc->setField('uid', $doc->uid); |
|
560 | + $solrDoc->setField('uid', $doc->uid); |
|
561 | 561 | |
562 | - $solrDoc->setField('pid', $doc->pid); |
|
562 | + $solrDoc->setField('pid', $doc->pid); |
|
563 | 563 | |
564 | - if (\TYPO3\CMS\Core\Utility\MathUtility::canBeInterpretedAsInteger($logicalUnit['points'])) { |
|
564 | + if (\TYPO3\CMS\Core\Utility\MathUtility::canBeInterpretedAsInteger($logicalUnit['points'])) { |
|
565 | 565 | |
566 | - $solrDoc->setField('page', $logicalUnit['points']); |
|
566 | + $solrDoc->setField('page', $logicalUnit['points']); |
|
567 | 567 | |
568 | - } |
|
568 | + } |
|
569 | 569 | |
570 | - if ($logicalUnit['id'] == $doc->toplevelId) { |
|
570 | + if ($logicalUnit['id'] == $doc->toplevelId) { |
|
571 | 571 | |
572 | - $solrDoc->setField('thumbnail', $doc->thumbnail); |
|
572 | + $solrDoc->setField('thumbnail', $doc->thumbnail); |
|
573 | 573 | |
574 | - } elseif (!empty($logicalUnit['thumbnailId'])) { |
|
574 | + } elseif (!empty($logicalUnit['thumbnailId'])) { |
|
575 | 575 | |
576 | - $solrDoc->setField('thumbnail', $doc->getFileLocation($logicalUnit['thumbnailId'])); |
|
576 | + $solrDoc->setField('thumbnail', $doc->getFileLocation($logicalUnit['thumbnailId'])); |
|
577 | 577 | |
578 | - } |
|
578 | + } |
|
579 | 579 | |
580 | - $solrDoc->setField('partof', $doc->parentId); |
|
580 | + $solrDoc->setField('partof', $doc->parentId); |
|
581 | 581 | |
582 | - $solrDoc->setField('root', $doc->rootId); |
|
582 | + $solrDoc->setField('root', $doc->rootId); |
|
583 | 583 | |
584 | - $solrDoc->setField('sid', $logicalUnit['id']); |
|
584 | + $solrDoc->setField('sid', $logicalUnit['id']); |
|
585 | 585 | |
586 | - $solrDoc->setField('toplevel', in_array($logicalUnit['type'], self::$toplevel)); |
|
586 | + $solrDoc->setField('toplevel', in_array($logicalUnit['type'], self::$toplevel)); |
|
587 | 587 | |
588 | - $solrDoc->setField('type', $logicalUnit['type'], self::$fields['fieldboost']['type']); |
|
588 | + $solrDoc->setField('type', $logicalUnit['type'], self::$fields['fieldboost']['type']); |
|
589 | 589 | |
590 | - $solrDoc->setField('title', $metadata['title'][0], self::$fields['fieldboost']['title']); |
|
590 | + $solrDoc->setField('title', $metadata['title'][0], self::$fields['fieldboost']['title']); |
|
591 | 591 | |
592 | - $solrDoc->setField('volume', $metadata['volume'][0], self::$fields['fieldboost']['volume']); |
|
592 | + $solrDoc->setField('volume', $metadata['volume'][0], self::$fields['fieldboost']['volume']); |
|
593 | 593 | |
594 | - $autocomplete = array (); |
|
594 | + $autocomplete = array (); |
|
595 | 595 | |
596 | - foreach ($metadata as $index_name => $data) { |
|
596 | + foreach ($metadata as $index_name => $data) { |
|
597 | 597 | |
598 | - if (!empty($data) && substr($index_name, -8) !== '_sorting') { |
|
598 | + if (!empty($data) && substr($index_name, -8) !== '_sorting') { |
|
599 | 599 | |
600 | - $solrDoc->setField(self::getIndexFieldName($index_name, $doc->pid), $data, self::$fields['fieldboost'][$index_name]); |
|
600 | + $solrDoc->setField(self::getIndexFieldName($index_name, $doc->pid), $data, self::$fields['fieldboost'][$index_name]); |
|
601 | 601 | |
602 | - if (in_array($index_name, self::$fields['sortables'])) { |
|
602 | + if (in_array($index_name, self::$fields['sortables'])) { |
|
603 | 603 | |
604 | - // Add sortable fields to index. |
|
605 | - $solrDoc->setField($index_name.'_sorting', $metadata[$index_name.'_sorting'][0]); |
|
604 | + // Add sortable fields to index. |
|
605 | + $solrDoc->setField($index_name.'_sorting', $metadata[$index_name.'_sorting'][0]); |
|
606 | 606 | |
607 | - } |
|
607 | + } |
|
608 | 608 | |
609 | - if (in_array($index_name, self::$fields['facets'])) { |
|
609 | + if (in_array($index_name, self::$fields['facets'])) { |
|
610 | 610 | |
611 | - // Add facets to index. |
|
612 | - $solrDoc->setField($index_name.'_faceting', $data); |
|
611 | + // Add facets to index. |
|
612 | + $solrDoc->setField($index_name.'_faceting', $data); |
|
613 | 613 | |
614 | - } |
|
614 | + } |
|
615 | 615 | |
616 | - if (in_array($index_name, self::$fields['autocomplete'])) { |
|
616 | + if (in_array($index_name, self::$fields['autocomplete'])) { |
|
617 | 617 | |
618 | - $autocomplete = array_merge($autocomplete, $data); |
|
618 | + $autocomplete = array_merge($autocomplete, $data); |
|
619 | 619 | |
620 | - } |
|
620 | + } |
|
621 | 621 | |
622 | - } |
|
622 | + } |
|
623 | 623 | |
624 | - } |
|
624 | + } |
|
625 | 625 | |
626 | - // Add autocomplete values to index. |
|
627 | - if (!empty($autocomplete)) { |
|
626 | + // Add autocomplete values to index. |
|
627 | + if (!empty($autocomplete)) { |
|
628 | 628 | |
629 | - $solrDoc->setField('autocomplete', $autocomplete); |
|
629 | + $solrDoc->setField('autocomplete', $autocomplete); |
|
630 | 630 | |
631 | - } |
|
631 | + } |
|
632 | 632 | |
633 | - // Add collection information to logical sub-elements if applicable. |
|
634 | - if (in_array('collection', self::$fields['facets']) |
|
635 | - && empty($metadata['collection']) |
|
636 | - && !empty($doc->metadataArray[$doc->toplevelId]['collection'])) { |
|
633 | + // Add collection information to logical sub-elements if applicable. |
|
634 | + if (in_array('collection', self::$fields['facets']) |
|
635 | + && empty($metadata['collection']) |
|
636 | + && !empty($doc->metadataArray[$doc->toplevelId]['collection'])) { |
|
637 | 637 | |
638 | - $solrDoc->setField('collection_faceting', $doc->metadataArray[$doc->toplevelId]['collection']); |
|
638 | + $solrDoc->setField('collection_faceting', $doc->metadataArray[$doc->toplevelId]['collection']); |
|
639 | 639 | |
640 | - } |
|
640 | + } |
|
641 | 641 | |
642 | - try { |
|
642 | + try { |
|
643 | 643 | |
644 | - self::$solr->service->addDocument($solrDoc); |
|
644 | + self::$solr->service->addDocument($solrDoc); |
|
645 | 645 | |
646 | - } catch (Exception $e) { |
|
646 | + } catch (Exception $e) { |
|
647 | 647 | |
648 | - if (!defined('TYPO3_cliMode')) { |
|
648 | + if (!defined('TYPO3_cliMode')) { |
|
649 | 649 | |
650 | - $message = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance( |
|
651 | - 'TYPO3\\CMS\\Core\\Messaging\\FlashMessage', |
|
652 | - tx_dlf_helper::getLL('flash.solrException', TRUE).'<br />'.htmlspecialchars($e->getMessage()), |
|
653 | - tx_dlf_helper::getLL('flash.error', TRUE), |
|
654 | - \TYPO3\CMS\Core\Messaging\FlashMessage::ERROR, |
|
655 | - TRUE |
|
656 | - ); |
|
650 | + $message = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance( |
|
651 | + 'TYPO3\\CMS\\Core\\Messaging\\FlashMessage', |
|
652 | + tx_dlf_helper::getLL('flash.solrException', TRUE).'<br />'.htmlspecialchars($e->getMessage()), |
|
653 | + tx_dlf_helper::getLL('flash.error', TRUE), |
|
654 | + \TYPO3\CMS\Core\Messaging\FlashMessage::ERROR, |
|
655 | + TRUE |
|
656 | + ); |
|
657 | 657 | |
658 | - tx_dlf_helper::addMessage($message); |
|
658 | + tx_dlf_helper::addMessage($message); |
|
659 | 659 | |
660 | - } |
|
660 | + } |
|
661 | 661 | |
662 | - return 1; |
|
662 | + return 1; |
|
663 | 663 | |
664 | - } |
|
664 | + } |
|
665 | 665 | |
666 | - } |
|
666 | + } |
|
667 | 667 | |
668 | - // Check for child elements... |
|
669 | - if (!empty($logicalUnit['children'])) { |
|
668 | + // Check for child elements... |
|
669 | + if (!empty($logicalUnit['children'])) { |
|
670 | 670 | |
671 | - foreach ($logicalUnit['children'] as $child) { |
|
671 | + foreach ($logicalUnit['children'] as $child) { |
|
672 | 672 | |
673 | - if (!$errors) { |
|
673 | + if (!$errors) { |
|
674 | 674 | |
675 | - // ...and process them, too. |
|
676 | - $errors = self::processLogical($doc, $child); |
|
675 | + // ...and process them, too. |
|
676 | + $errors = self::processLogical($doc, $child); |
|
677 | 677 | |
678 | - } else { |
|
678 | + } else { |
|
679 | 679 | |
680 | - break; |
|
680 | + break; |
|
681 | 681 | |
682 | - } |
|
682 | + } |
|
683 | 683 | |
684 | - } |
|
684 | + } |
|
685 | 685 | |
686 | - } |
|
686 | + } |
|
687 | 687 | |
688 | - return $errors; |
|
688 | + return $errors; |
|
689 | 689 | |
690 | - } |
|
690 | + } |
|
691 | 691 | |
692 | - /** |
|
693 | - * Processes a physical unit for the Solr index |
|
694 | - * |
|
695 | - * @access protected |
|
696 | - * |
|
697 | - * @param tx_dlf_document &$doc: The METS document |
|
698 | - * @param integer $page: The page number |
|
699 | - * @param array $physicalUnit: Array of the physical unit to process |
|
700 | - * |
|
701 | - * @return integer 0 on success or 1 on failure |
|
702 | - */ |
|
703 | - protected static function processPhysical(tx_dlf_document &$doc, $page, array $physicalUnit) { |
|
692 | + /** |
|
693 | + * Processes a physical unit for the Solr index |
|
694 | + * |
|
695 | + * @access protected |
|
696 | + * |
|
697 | + * @param tx_dlf_document &$doc: The METS document |
|
698 | + * @param integer $page: The page number |
|
699 | + * @param array $physicalUnit: Array of the physical unit to process |
|
700 | + * |
|
701 | + * @return integer 0 on success or 1 on failure |
|
702 | + */ |
|
703 | + protected static function processPhysical(tx_dlf_document &$doc, $page, array $physicalUnit) { |
|
704 | 704 | |
705 | - $errors = 0; |
|
705 | + $errors = 0; |
|
706 | 706 | |
707 | - // Read extension configuration. |
|
708 | - $extConf = unserialize($GLOBALS['TYPO3_CONF_VARS']['EXT']['extConf'][self::$extKey]); |
|
707 | + // Read extension configuration. |
|
708 | + $extConf = unserialize($GLOBALS['TYPO3_CONF_VARS']['EXT']['extConf'][self::$extKey]); |
|
709 | 709 | |
710 | - if (!empty($physicalUnit['files'][$extConf['fileGrpFulltext']])) { |
|
710 | + if (!empty($physicalUnit['files'][$extConf['fileGrpFulltext']])) { |
|
711 | 711 | |
712 | - $file = $doc->getFileLocation($physicalUnit['files'][$extConf['fileGrpFulltext']]); |
|
712 | + $file = $doc->getFileLocation($physicalUnit['files'][$extConf['fileGrpFulltext']]); |
|
713 | 713 | |
714 | - // Load XML file. |
|
715 | - if (\TYPO3\CMS\Core\Utility\GeneralUtility::isValidUrl($file)) { |
|
714 | + // Load XML file. |
|
715 | + if (\TYPO3\CMS\Core\Utility\GeneralUtility::isValidUrl($file)) { |
|
716 | 716 | |
717 | - // Set user-agent to identify self when fetching XML data. |
|
718 | - if (!empty($extConf['useragent'])) { |
|
717 | + // Set user-agent to identify self when fetching XML data. |
|
718 | + if (!empty($extConf['useragent'])) { |
|
719 | 719 | |
720 | - @ini_set('user_agent', $extConf['useragent']); |
|
720 | + @ini_set('user_agent', $extConf['useragent']); |
|
721 | 721 | |
722 | - } |
|
722 | + } |
|
723 | 723 | |
724 | - // Turn off libxml's error logging. |
|
725 | - $libxmlErrors = libxml_use_internal_errors(TRUE); |
|
724 | + // Turn off libxml's error logging. |
|
725 | + $libxmlErrors = libxml_use_internal_errors(TRUE); |
|
726 | 726 | |
727 | - // disable entity loading |
|
728 | - $previousValueOfEntityLoader = libxml_disable_entity_loader(TRUE); |
|
727 | + // disable entity loading |
|
728 | + $previousValueOfEntityLoader = libxml_disable_entity_loader(TRUE); |
|
729 | 729 | |
730 | - // Load XML from file. |
|
731 | - $xml = simplexml_load_string(\TYPO3\CMS\Core\Utility\GeneralUtility::getUrl($file)); |
|
730 | + // Load XML from file. |
|
731 | + $xml = simplexml_load_string(\TYPO3\CMS\Core\Utility\GeneralUtility::getUrl($file)); |
|
732 | 732 | |
733 | - // reset entity loader setting |
|
734 | - libxml_disable_entity_loader($previousValueOfEntityLoader); |
|
733 | + // reset entity loader setting |
|
734 | + libxml_disable_entity_loader($previousValueOfEntityLoader); |
|
735 | 735 | |
736 | - // Reset libxml's error logging. |
|
737 | - libxml_use_internal_errors($libxmlErrors); |
|
736 | + // Reset libxml's error logging. |
|
737 | + libxml_use_internal_errors($libxmlErrors); |
|
738 | 738 | |
739 | - if ($xml === FALSE) { |
|
739 | + if ($xml === FALSE) { |
|
740 | 740 | |
741 | - return 1; |
|
741 | + return 1; |
|
742 | 742 | |
743 | - } |
|
743 | + } |
|
744 | 744 | |
745 | - } else { |
|
745 | + } else { |
|
746 | 746 | |
747 | - return 1; |
|
747 | + return 1; |
|
748 | 748 | |
749 | - } |
|
749 | + } |
|
750 | 750 | |
751 | - // Load class. |
|
752 | - if (!class_exists('Apache_Solr_Document')) { |
|
751 | + // Load class. |
|
752 | + if (!class_exists('Apache_Solr_Document')) { |
|
753 | 753 | |
754 | - require_once(\TYPO3\CMS\Core\Utility\GeneralUtility::getFileAbsFileName('EXT:'.self::$extKey.'/lib/SolrPhpClient/Apache/Solr/Document.php')); |
|
754 | + require_once(\TYPO3\CMS\Core\Utility\GeneralUtility::getFileAbsFileName('EXT:'.self::$extKey.'/lib/SolrPhpClient/Apache/Solr/Document.php')); |
|
755 | 755 | |
756 | - } |
|
756 | + } |
|
757 | 757 | |
758 | - // Create new Solr document. |
|
759 | - $solrDoc = new Apache_Solr_Document(); |
|
758 | + // Create new Solr document. |
|
759 | + $solrDoc = new Apache_Solr_Document(); |
|
760 | 760 | |
761 | - // Create unique identifier from document's UID and unit's XML ID. |
|
762 | - $solrDoc->setField('id', $doc->uid.$physicalUnit['id']); |
|
761 | + // Create unique identifier from document's UID and unit's XML ID. |
|
762 | + $solrDoc->setField('id', $doc->uid.$physicalUnit['id']); |
|
763 | 763 | |
764 | - $solrDoc->setField('uid', $doc->uid); |
|
764 | + $solrDoc->setField('uid', $doc->uid); |
|
765 | 765 | |
766 | - $solrDoc->setField('pid', $doc->pid); |
|
766 | + $solrDoc->setField('pid', $doc->pid); |
|
767 | 767 | |
768 | - $solrDoc->setField('page', $page); |
|
768 | + $solrDoc->setField('page', $page); |
|
769 | 769 | |
770 | - if (!empty($physicalUnit['files'][$extConf['fileGrpThumbs']])) { |
|
770 | + if (!empty($physicalUnit['files'][$extConf['fileGrpThumbs']])) { |
|
771 | 771 | |
772 | - $solrDoc->setField('thumbnail', $doc->getFileLocation($physicalUnit['files'][$extConf['fileGrpThumbs']])); |
|
772 | + $solrDoc->setField('thumbnail', $doc->getFileLocation($physicalUnit['files'][$extConf['fileGrpThumbs']])); |
|
773 | 773 | |
774 | - } |
|
774 | + } |
|
775 | 775 | |
776 | - $solrDoc->setField('partof', $doc->parentId); |
|
776 | + $solrDoc->setField('partof', $doc->parentId); |
|
777 | 777 | |
778 | - $solrDoc->setField('root', $doc->rootId); |
|
778 | + $solrDoc->setField('root', $doc->rootId); |
|
779 | 779 | |
780 | - $solrDoc->setField('sid', $physicalUnit['id']); |
|
780 | + $solrDoc->setField('sid', $physicalUnit['id']); |
|
781 | 781 | |
782 | - $solrDoc->setField('toplevel', FALSE); |
|
782 | + $solrDoc->setField('toplevel', FALSE); |
|
783 | 783 | |
784 | - $solrDoc->setField('type', $physicalUnit['type'], self::$fields['fieldboost']['type']); |
|
784 | + $solrDoc->setField('type', $physicalUnit['type'], self::$fields['fieldboost']['type']); |
|
785 | 785 | |
786 | - $solrDoc->setField('fulltext', tx_dlf_alto::getRawText($xml)); |
|
786 | + $solrDoc->setField('fulltext', tx_dlf_alto::getRawText($xml)); |
|
787 | 787 | |
788 | - // Add faceting information to physical sub-elements if applicable. |
|
789 | - foreach ($doc->metadataArray[$doc->toplevelId] as $index_name => $data) { |
|
788 | + // Add faceting information to physical sub-elements if applicable. |
|
789 | + foreach ($doc->metadataArray[$doc->toplevelId] as $index_name => $data) { |
|
790 | 790 | |
791 | - if (!empty($data) && substr($index_name, -8) !== '_sorting') { |
|
791 | + if (!empty($data) && substr($index_name, -8) !== '_sorting') { |
|
792 | 792 | |
793 | - if (in_array($index_name, self::$fields['facets'])) { |
|
793 | + if (in_array($index_name, self::$fields['facets'])) { |
|
794 | 794 | |
795 | - // Add facets to index. |
|
796 | - $solrDoc->setField($index_name.'_faceting', $data); |
|
795 | + // Add facets to index. |
|
796 | + $solrDoc->setField($index_name.'_faceting', $data); |
|
797 | 797 | |
798 | - } |
|
798 | + } |
|
799 | 799 | |
800 | - } |
|
800 | + } |
|
801 | 801 | |
802 | - } |
|
802 | + } |
|
803 | 803 | |
804 | - try { |
|
804 | + try { |
|
805 | 805 | |
806 | - self::$solr->service->addDocument($solrDoc); |
|
806 | + self::$solr->service->addDocument($solrDoc); |
|
807 | 807 | |
808 | - } catch (Exception $e) { |
|
808 | + } catch (Exception $e) { |
|
809 | 809 | |
810 | - if (!defined('TYPO3_cliMode')) { |
|
810 | + if (!defined('TYPO3_cliMode')) { |
|
811 | 811 | |
812 | - $message = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance( |
|
813 | - 'TYPO3\\CMS\\Core\\Messaging\\FlashMessage', |
|
814 | - tx_dlf_helper::getLL('flash.solrException', TRUE).'<br />'.htmlspecialchars($e->getMessage()), |
|
815 | - tx_dlf_helper::getLL('flash.error', TRUE), |
|
816 | - \TYPO3\CMS\Core\Messaging\FlashMessage::ERROR, |
|
817 | - TRUE |
|
818 | - ); |
|
812 | + $message = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance( |
|
813 | + 'TYPO3\\CMS\\Core\\Messaging\\FlashMessage', |
|
814 | + tx_dlf_helper::getLL('flash.solrException', TRUE).'<br />'.htmlspecialchars($e->getMessage()), |
|
815 | + tx_dlf_helper::getLL('flash.error', TRUE), |
|
816 | + \TYPO3\CMS\Core\Messaging\FlashMessage::ERROR, |
|
817 | + TRUE |
|
818 | + ); |
|
819 | 819 | |
820 | - tx_dlf_helper::addMessage($message); |
|
820 | + tx_dlf_helper::addMessage($message); |
|
821 | 821 | |
822 | - } |
|
822 | + } |
|
823 | 823 | |
824 | - return 1; |
|
824 | + return 1; |
|
825 | 825 | |
826 | - } |
|
826 | + } |
|
827 | 827 | |
828 | - } |
|
828 | + } |
|
829 | 829 | |
830 | - return $errors; |
|
830 | + return $errors; |
|
831 | 831 | |
832 | - } |
|
832 | + } |
|
833 | 833 | |
834 | - /** |
|
835 | - * Connects to Solr server. |
|
836 | - * |
|
837 | - * @access protected |
|
838 | - * |
|
839 | - * @param integer $core: UID of the Solr core |
|
840 | - * @param integer $pid: UID of the configuration page |
|
841 | - * |
|
842 | - * @return boolean TRUE on success or FALSE on failure |
|
843 | - */ |
|
844 | - protected static function solrConnect($core, $pid = 0) { |
|
834 | + /** |
|
835 | + * Connects to Solr server. |
|
836 | + * |
|
837 | + * @access protected |
|
838 | + * |
|
839 | + * @param integer $core: UID of the Solr core |
|
840 | + * @param integer $pid: UID of the configuration page |
|
841 | + * |
|
842 | + * @return boolean TRUE on success or FALSE on failure |
|
843 | + */ |
|
844 | + protected static function solrConnect($core, $pid = 0) { |
|
845 | 845 | |
846 | - // Get Solr instance. |
|
847 | - if (!self::$solr) { |
|
846 | + // Get Solr instance. |
|
847 | + if (!self::$solr) { |
|
848 | 848 | |
849 | - // Connect to Solr server. |
|
850 | - if (self::$solr = tx_dlf_solr::getInstance($core)) { |
|
849 | + // Connect to Solr server. |
|
850 | + if (self::$solr = tx_dlf_solr::getInstance($core)) { |
|
851 | 851 | |
852 | - // Load indexing configuration if needed. |
|
853 | - if ($pid) { |
|
852 | + // Load indexing configuration if needed. |
|
853 | + if ($pid) { |
|
854 | 854 | |
855 | - self::loadIndexConf($pid); |
|
855 | + self::loadIndexConf($pid); |
|
856 | 856 | |
857 | - } |
|
857 | + } |
|
858 | 858 | |
859 | - } else { |
|
859 | + } else { |
|
860 | 860 | |
861 | - return FALSE; |
|
861 | + return FALSE; |
|
862 | 862 | |
863 | - } |
|
863 | + } |
|
864 | 864 | |
865 | - } |
|
865 | + } |
|
866 | 866 | |
867 | - return TRUE; |
|
867 | + return TRUE; |
|
868 | 868 | |
869 | - } |
|
869 | + } |
|
870 | 870 | |
871 | - /** |
|
872 | - * This is a static class, thus no instances should be created |
|
873 | - * |
|
874 | - * @access private |
|
875 | - */ |
|
876 | - private function __construct() {} |
|
871 | + /** |
|
872 | + * This is a static class, thus no instances should be created |
|
873 | + * |
|
874 | + * @access private |
|
875 | + */ |
|
876 | + private function __construct() {} |
|
877 | 877 | |
878 | 878 | } |
@@ -10,155 +10,155 @@ |
||
10 | 10 | */ |
11 | 11 | |
12 | 12 | return array ( |
13 | - 'ctrl' => array ( |
|
14 | - 'title' => 'LLL:EXT:dlf/locallang.xml:tx_dlf_structures', |
|
15 | - 'label' => 'label', |
|
16 | - 'tstamp' => 'tstamp', |
|
17 | - 'crdate' => 'crdate', |
|
18 | - 'cruser_id' => 'cruser_id', |
|
19 | - 'languageField' => 'sys_language_uid', |
|
20 | - 'transOrigPointerField' => 'l18n_parent', |
|
21 | - 'transOrigDiffSourceField' => 'l18n_diffsource', |
|
22 | - 'default_sortby' => 'ORDER BY label', |
|
23 | - 'delete' => 'deleted', |
|
24 | - 'enablecolumns' => array ( |
|
25 | - 'disabled' => 'hidden', |
|
26 | - ), |
|
27 | - 'iconfile' => \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extRelPath('dlf').'res/icons/txdlfstructures.png', |
|
28 | - 'rootLevel' => 0, |
|
29 | - 'dividers2tabs' => 2, |
|
30 | - 'searchFields' => 'label,index_name,oai_name', |
|
31 | - 'requestUpdate' => 'toplevel', |
|
32 | - ), |
|
33 | - 'feInterface' => array ( |
|
34 | - 'fe_admin_fieldList' => '', |
|
35 | - ), |
|
36 | - 'interface' => array ( |
|
37 | - 'showRecordFieldList' => 'label,index_name,oai_name,toplevel', |
|
38 | - ), |
|
39 | - 'columns' => array ( |
|
40 | - 'sys_language_uid' => array ( |
|
41 | - 'exclude' => 1, |
|
42 | - 'label' => 'LLL:EXT:lang/locallang_general.xml:LGL.language', |
|
43 | - 'config' => array ( |
|
44 | - 'type' => 'select', |
|
45 | - 'renderType' => 'selectSingle', |
|
46 | - 'foreign_table' => 'sys_language', |
|
47 | - 'foreign_table_where' => 'ORDER BY sys_language.title', |
|
48 | - 'items' => array ( |
|
49 | - array ('LLL:EXT:lang/locallang_general.xml:LGL.allLanguages', -1), |
|
50 | - array ('LLL:EXT:lang/locallang_general.xml:LGL.default_value', 0), |
|
51 | - ), |
|
52 | - 'default' => 0 |
|
53 | - ), |
|
54 | - ), |
|
55 | - 'l18n_parent' => array ( |
|
56 | - 'displayCond' => 'FIELD:sys_language_uid:>:0', |
|
57 | - 'exclude' => 1, |
|
58 | - 'label' => 'LLL:EXT:lang/locallang_general.xml:LGL.l18n_parent', |
|
59 | - 'config' => array ( |
|
60 | - 'type' => 'select', |
|
61 | - 'renderType' => 'selectSingle', |
|
62 | - 'items' => array ( |
|
63 | - array ('', 0), |
|
64 | - ), |
|
65 | - 'foreign_table' => 'tx_dlf_structures', |
|
66 | - 'foreign_table_where' => 'AND tx_dlf_structures.pid=###CURRENT_PID### AND tx_dlf_structures.sys_language_uid IN (-1,0) ORDER BY label ASC', |
|
67 | - ), |
|
68 | - ), |
|
69 | - 'l18n_diffsource' => array ( |
|
70 | - 'config' => array ( |
|
71 | - 'type' => 'passthrough', |
|
72 | - ), |
|
73 | - ), |
|
74 | - 'hidden' => array ( |
|
75 | - 'exclude' => 1, |
|
76 | - 'label' => 'LLL:EXT:lang/locallang_general.xml:LGL.hidden', |
|
77 | - 'config' => array ( |
|
78 | - 'type' => 'check', |
|
79 | - 'default' => 0, |
|
80 | - ), |
|
81 | - ), |
|
82 | - 'toplevel' => array ( |
|
83 | - 'exclude' => 1, |
|
84 | - 'l10n_mode' => 'exclude', |
|
85 | - 'label' => 'LLL:EXT:dlf/locallang.xml:tx_dlf_structures.toplevel', |
|
86 | - 'config' => array ( |
|
87 | - 'type' => 'check', |
|
88 | - 'default' => 0, |
|
89 | - ), |
|
90 | - ), |
|
91 | - 'label' => array ( |
|
92 | - 'exclude' => 1, |
|
93 | - 'label' => 'LLL:EXT:dlf/locallang.xml:tx_dlf_structures.label', |
|
94 | - 'config' => array ( |
|
95 | - 'type' => 'input', |
|
96 | - 'size' => 30, |
|
97 | - 'max' => 255, |
|
98 | - 'eval' => 'required,trim', |
|
99 | - ), |
|
100 | - ), |
|
101 | - 'index_name' => array ( |
|
102 | - 'exclude' => 1, |
|
103 | - 'l10n_mode' => 'exclude', |
|
104 | - 'label' => 'LLL:EXT:dlf/locallang.xml:tx_dlf_structures.index_name', |
|
105 | - 'config' => array ( |
|
106 | - 'type' => 'input', |
|
107 | - 'size' => 30, |
|
108 | - 'max' => 255, |
|
109 | - 'eval' => 'required,nospace,alphanum_x,uniqueInPid', |
|
110 | - ), |
|
111 | - ), |
|
112 | - 'oai_name' => array ( |
|
113 | - 'exclude' => 1, |
|
114 | - 'l10n_mode' => 'exclude', |
|
115 | - 'label' => 'LLL:EXT:dlf/locallang.xml:tx_dlf_structures.oai_name', |
|
116 | - 'config' => array ( |
|
117 | - 'type' => 'input', |
|
118 | - 'size' => 30, |
|
119 | - 'max' => 255, |
|
120 | - 'eval' => 'trim', |
|
121 | - ), |
|
122 | - ), |
|
123 | - 'thumbnail' => array ( |
|
124 | - 'exclude' => 1, |
|
125 | - 'l10n_mode' => 'exclude', |
|
126 | - 'displayCond' => 'FIELD:toplevel:REQ:true', |
|
127 | - 'label' => 'LLL:EXT:dlf/locallang.xml:tx_dlf_structures.thumbnail', |
|
128 | - 'config' => array ( |
|
129 | - 'type' => 'select', |
|
130 | - 'renderType' => 'selectSingle', |
|
131 | - 'items' => array ( |
|
132 | - array ('LLL:EXT:dlf/locallang.xml:tx_dlf_structures.thumbnail.self', 0), |
|
133 | - ), |
|
134 | - 'foreign_table' => 'tx_dlf_structures', |
|
135 | - 'foreign_table_where' => 'AND tx_dlf_structures.pid=###CURRENT_PID### AND tx_dlf_structures.toplevel=0 AND tx_dlf_structures.sys_language_uid IN (-1,0) ORDER BY tx_dlf_structures.label', |
|
136 | - 'size' => 1, |
|
137 | - 'minitems' => 0, |
|
138 | - 'maxitems' => 1, |
|
139 | - 'default' => 0, |
|
140 | - ), |
|
141 | - ), |
|
142 | - 'status' => array ( |
|
143 | - 'exclude' => 1, |
|
144 | - 'label' => 'LLL:EXT:dlf/locallang.xml:tx_dlf_structures.status', |
|
145 | - 'config' => array ( |
|
146 | - 'type' => 'select', |
|
147 | - 'renderType' => 'selectSingle', |
|
148 | - 'items' => array ( |
|
149 | - array ('LLL:EXT:dlf/locallang.xml:tx_dlf_structures.status.default', 0), |
|
150 | - ), |
|
151 | - 'size' => 1, |
|
152 | - 'minitems' => 1, |
|
153 | - 'maxitems' => 1, |
|
154 | - 'default' => 0, |
|
155 | - ), |
|
156 | - ), |
|
157 | - ), |
|
158 | - 'types' => array ( |
|
159 | - '0' => array ('showitem' => '--div--;LLL:EXT:dlf/locallang.xml:tx_dlf_structures.tab1, toplevel;;;;1-1-1, label,--palette--;;1, thumbnail, --div--;LLL:EXT:dlf/locallang.xml:tx_dlf_structures.tab2, sys_language_uid;;;;1-1-1, l18n_parent, l18n_diffsource, --div--;LLL:EXT:dlf/locallang.xml:tx_dlf_structures.tab3, hidden;;;;1-1-1, status;;;;2-2-2'), |
|
160 | - ), |
|
161 | - 'palettes' => array ( |
|
162 | - '1' => array ('showitem' => 'index_name, --linebreak--, oai_name', 'canNotCollapse' => 1), |
|
163 | - ), |
|
13 | + 'ctrl' => array ( |
|
14 | + 'title' => 'LLL:EXT:dlf/locallang.xml:tx_dlf_structures', |
|
15 | + 'label' => 'label', |
|
16 | + 'tstamp' => 'tstamp', |
|
17 | + 'crdate' => 'crdate', |
|
18 | + 'cruser_id' => 'cruser_id', |
|
19 | + 'languageField' => 'sys_language_uid', |
|
20 | + 'transOrigPointerField' => 'l18n_parent', |
|
21 | + 'transOrigDiffSourceField' => 'l18n_diffsource', |
|
22 | + 'default_sortby' => 'ORDER BY label', |
|
23 | + 'delete' => 'deleted', |
|
24 | + 'enablecolumns' => array ( |
|
25 | + 'disabled' => 'hidden', |
|
26 | + ), |
|
27 | + 'iconfile' => \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extRelPath('dlf').'res/icons/txdlfstructures.png', |
|
28 | + 'rootLevel' => 0, |
|
29 | + 'dividers2tabs' => 2, |
|
30 | + 'searchFields' => 'label,index_name,oai_name', |
|
31 | + 'requestUpdate' => 'toplevel', |
|
32 | + ), |
|
33 | + 'feInterface' => array ( |
|
34 | + 'fe_admin_fieldList' => '', |
|
35 | + ), |
|
36 | + 'interface' => array ( |
|
37 | + 'showRecordFieldList' => 'label,index_name,oai_name,toplevel', |
|
38 | + ), |
|
39 | + 'columns' => array ( |
|
40 | + 'sys_language_uid' => array ( |
|
41 | + 'exclude' => 1, |
|
42 | + 'label' => 'LLL:EXT:lang/locallang_general.xml:LGL.language', |
|
43 | + 'config' => array ( |
|
44 | + 'type' => 'select', |
|
45 | + 'renderType' => 'selectSingle', |
|
46 | + 'foreign_table' => 'sys_language', |
|
47 | + 'foreign_table_where' => 'ORDER BY sys_language.title', |
|
48 | + 'items' => array ( |
|
49 | + array ('LLL:EXT:lang/locallang_general.xml:LGL.allLanguages', -1), |
|
50 | + array ('LLL:EXT:lang/locallang_general.xml:LGL.default_value', 0), |
|
51 | + ), |
|
52 | + 'default' => 0 |
|
53 | + ), |
|
54 | + ), |
|
55 | + 'l18n_parent' => array ( |
|
56 | + 'displayCond' => 'FIELD:sys_language_uid:>:0', |
|
57 | + 'exclude' => 1, |
|
58 | + 'label' => 'LLL:EXT:lang/locallang_general.xml:LGL.l18n_parent', |
|
59 | + 'config' => array ( |
|
60 | + 'type' => 'select', |
|
61 | + 'renderType' => 'selectSingle', |
|
62 | + 'items' => array ( |
|
63 | + array ('', 0), |
|
64 | + ), |
|
65 | + 'foreign_table' => 'tx_dlf_structures', |
|
66 | + 'foreign_table_where' => 'AND tx_dlf_structures.pid=###CURRENT_PID### AND tx_dlf_structures.sys_language_uid IN (-1,0) ORDER BY label ASC', |
|
67 | + ), |
|
68 | + ), |
|
69 | + 'l18n_diffsource' => array ( |
|
70 | + 'config' => array ( |
|
71 | + 'type' => 'passthrough', |
|
72 | + ), |
|
73 | + ), |
|
74 | + 'hidden' => array ( |
|
75 | + 'exclude' => 1, |
|
76 | + 'label' => 'LLL:EXT:lang/locallang_general.xml:LGL.hidden', |
|
77 | + 'config' => array ( |
|
78 | + 'type' => 'check', |
|
79 | + 'default' => 0, |
|
80 | + ), |
|
81 | + ), |
|
82 | + 'toplevel' => array ( |
|
83 | + 'exclude' => 1, |
|
84 | + 'l10n_mode' => 'exclude', |
|
85 | + 'label' => 'LLL:EXT:dlf/locallang.xml:tx_dlf_structures.toplevel', |
|
86 | + 'config' => array ( |
|
87 | + 'type' => 'check', |
|
88 | + 'default' => 0, |
|
89 | + ), |
|
90 | + ), |
|
91 | + 'label' => array ( |
|
92 | + 'exclude' => 1, |
|
93 | + 'label' => 'LLL:EXT:dlf/locallang.xml:tx_dlf_structures.label', |
|
94 | + 'config' => array ( |
|
95 | + 'type' => 'input', |
|
96 | + 'size' => 30, |
|
97 | + 'max' => 255, |
|
98 | + 'eval' => 'required,trim', |
|
99 | + ), |
|
100 | + ), |
|
101 | + 'index_name' => array ( |
|
102 | + 'exclude' => 1, |
|
103 | + 'l10n_mode' => 'exclude', |
|
104 | + 'label' => 'LLL:EXT:dlf/locallang.xml:tx_dlf_structures.index_name', |
|
105 | + 'config' => array ( |
|
106 | + 'type' => 'input', |
|
107 | + 'size' => 30, |
|
108 | + 'max' => 255, |
|
109 | + 'eval' => 'required,nospace,alphanum_x,uniqueInPid', |
|
110 | + ), |
|
111 | + ), |
|
112 | + 'oai_name' => array ( |
|
113 | + 'exclude' => 1, |
|
114 | + 'l10n_mode' => 'exclude', |
|
115 | + 'label' => 'LLL:EXT:dlf/locallang.xml:tx_dlf_structures.oai_name', |
|
116 | + 'config' => array ( |
|
117 | + 'type' => 'input', |
|
118 | + 'size' => 30, |
|
119 | + 'max' => 255, |
|
120 | + 'eval' => 'trim', |
|
121 | + ), |
|
122 | + ), |
|
123 | + 'thumbnail' => array ( |
|
124 | + 'exclude' => 1, |
|
125 | + 'l10n_mode' => 'exclude', |
|
126 | + 'displayCond' => 'FIELD:toplevel:REQ:true', |
|
127 | + 'label' => 'LLL:EXT:dlf/locallang.xml:tx_dlf_structures.thumbnail', |
|
128 | + 'config' => array ( |
|
129 | + 'type' => 'select', |
|
130 | + 'renderType' => 'selectSingle', |
|
131 | + 'items' => array ( |
|
132 | + array ('LLL:EXT:dlf/locallang.xml:tx_dlf_structures.thumbnail.self', 0), |
|
133 | + ), |
|
134 | + 'foreign_table' => 'tx_dlf_structures', |
|
135 | + 'foreign_table_where' => 'AND tx_dlf_structures.pid=###CURRENT_PID### AND tx_dlf_structures.toplevel=0 AND tx_dlf_structures.sys_language_uid IN (-1,0) ORDER BY tx_dlf_structures.label', |
|
136 | + 'size' => 1, |
|
137 | + 'minitems' => 0, |
|
138 | + 'maxitems' => 1, |
|
139 | + 'default' => 0, |
|
140 | + ), |
|
141 | + ), |
|
142 | + 'status' => array ( |
|
143 | + 'exclude' => 1, |
|
144 | + 'label' => 'LLL:EXT:dlf/locallang.xml:tx_dlf_structures.status', |
|
145 | + 'config' => array ( |
|
146 | + 'type' => 'select', |
|
147 | + 'renderType' => 'selectSingle', |
|
148 | + 'items' => array ( |
|
149 | + array ('LLL:EXT:dlf/locallang.xml:tx_dlf_structures.status.default', 0), |
|
150 | + ), |
|
151 | + 'size' => 1, |
|
152 | + 'minitems' => 1, |
|
153 | + 'maxitems' => 1, |
|
154 | + 'default' => 0, |
|
155 | + ), |
|
156 | + ), |
|
157 | + ), |
|
158 | + 'types' => array ( |
|
159 | + '0' => array ('showitem' => '--div--;LLL:EXT:dlf/locallang.xml:tx_dlf_structures.tab1, toplevel;;;;1-1-1, label,--palette--;;1, thumbnail, --div--;LLL:EXT:dlf/locallang.xml:tx_dlf_structures.tab2, sys_language_uid;;;;1-1-1, l18n_parent, l18n_diffsource, --div--;LLL:EXT:dlf/locallang.xml:tx_dlf_structures.tab3, hidden;;;;1-1-1, status;;;;2-2-2'), |
|
160 | + ), |
|
161 | + 'palettes' => array ( |
|
162 | + '1' => array ('showitem' => 'index_name, --linebreak--, oai_name', 'canNotCollapse' => 1), |
|
163 | + ), |
|
164 | 164 | ); |
@@ -13,7 +13,7 @@ |
||
13 | 13 | 'ctrl' => array ( |
14 | 14 | 'title' => 'LLL:EXT:dlf/locallang.xml:tx_dlf_mail', |
15 | 15 | 'label' => 'label', |
16 | - 'sortby' => 'sorting', |
|
16 | + 'sortby' => 'sorting', |
|
17 | 17 | 'delete' => 'deleted', |
18 | 18 | 'iconfile' => \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extRelPath('dlf').'res/icons/txdlfemail.png', |
19 | 19 | 'rootLevel' => 0, |
@@ -10,328 +10,328 @@ |
||
10 | 10 | */ |
11 | 11 | |
12 | 12 | return array ( |
13 | - 'ctrl' => array ( |
|
14 | - 'title' => 'LLL:EXT:dlf/locallang.xml:tx_dlf_documents', |
|
15 | - 'label' => 'title', |
|
16 | - 'tstamp' => 'tstamp', |
|
17 | - 'crdate' => 'crdate', |
|
18 | - 'cruser_id' => 'cruser_id', |
|
19 | - 'default_sortby' => 'ORDER BY title_sorting', |
|
20 | - 'delete' => 'deleted', |
|
21 | - 'enablecolumns' => array ( |
|
22 | - 'disabled' => 'hidden', |
|
23 | - 'starttime' => 'starttime', |
|
24 | - 'endtime' => 'endtime', |
|
25 | - 'fe_group' => 'fe_group', |
|
26 | - ), |
|
27 | - 'iconfile' => \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extRelPath('dlf').'res/icons/txdlfdocuments.png', |
|
28 | - 'rootLevel' => 0, |
|
29 | - 'dividers2tabs' => 2, |
|
30 | - 'searchFields' => 'title,volume,author,year,place,uid,prod_id,location,oai_id,opac_id,union_id,urn', |
|
31 | - ), |
|
32 | - 'feInterface' => array ( |
|
33 | - 'fe_admin_fieldList' => '', |
|
34 | - ), |
|
35 | - 'interface' => array ( |
|
36 | - 'showRecordFieldList' => 'title,volume,author,year,place,uid,prod_id,location,oai_id,opac_id,union_id,urn', |
|
37 | - 'maxDBListItems' => 25, |
|
38 | - 'maxSingleDBListItems' => 50, |
|
39 | - ), |
|
40 | - 'columns' => array ( |
|
41 | - 'hidden' => array ( |
|
42 | - 'exclude' => 1, |
|
43 | - 'label' => 'LLL:EXT:lang/locallang_general.xml:LGL.hidden', |
|
44 | - 'config' => array ( |
|
45 | - 'type' => 'check', |
|
46 | - 'default' => 0, |
|
47 | - ), |
|
48 | - ), |
|
49 | - 'starttime' => array ( |
|
50 | - 'exclude' => 1, |
|
51 | - 'label' => 'LLL:EXT:lang/locallang_general.xml:LGL.starttime', |
|
52 | - 'config' => array ( |
|
53 | - 'type' => 'input', |
|
54 | - 'size' => '13', |
|
55 | - 'max' => '20', |
|
56 | - 'eval' => 'datetime', |
|
57 | - 'default' => '0', |
|
58 | - ), |
|
59 | - ), |
|
60 | - 'endtime' => array ( |
|
61 | - 'exclude' => 1, |
|
62 | - 'label' => 'LLL:EXT:lang/locallang_general.xml:LGL.endtime', |
|
63 | - 'config' => array ( |
|
64 | - 'type' => 'input', |
|
65 | - 'size' => '13', |
|
66 | - 'max' => '20', |
|
67 | - 'eval' => 'datetime', |
|
68 | - 'default' => '0', |
|
69 | - ), |
|
70 | - ), |
|
71 | - 'fe_group' => array ( |
|
72 | - 'exclude' => 1, |
|
73 | - 'label' => 'LLL:EXT:lang/locallang_general.xml:LGL.fe_group', |
|
74 | - 'config' => array ( |
|
75 | - 'type' => 'select', |
|
76 | - 'renderType' => 'selectMultipleSideBySide', |
|
77 | - 'items' => array ( |
|
78 | - array ('LLL:EXT:lang/locallang_general.xml:LGL.hide_at_login', -1), |
|
79 | - array ('LLL:EXT:lang/locallang_general.xml:LGL.any_login', -2), |
|
80 | - array ('LLL:EXT:lang/locallang_general.xml:LGL.usergroups', '--div--'), |
|
81 | - ), |
|
82 | - 'foreign_table' => 'fe_groups', |
|
83 | - 'size' => 5, |
|
84 | - 'autoSizeMax' => 15, |
|
85 | - 'minitems' => 0, |
|
86 | - 'maxitems' => 20, |
|
87 | - 'exclusiveKeys' => '-1,-2', |
|
88 | - ), |
|
89 | - ), |
|
90 | - 'prod_id' => array ( |
|
91 | - 'exclude' => 1, |
|
92 | - 'label' => 'LLL:EXT:dlf/locallang.xml:tx_dlf_documents.prod_id', |
|
93 | - 'config' => array ( |
|
94 | - 'type' => 'input', |
|
95 | - 'size' => 30, |
|
96 | - 'max' => 255, |
|
97 | - 'eval' => 'nospace', |
|
98 | - ), |
|
99 | - ), |
|
100 | - 'location' => array ( |
|
101 | - 'exclude' => 1, |
|
102 | - 'label' => 'LLL:EXT:dlf/locallang.xml:tx_dlf_documents.location', |
|
103 | - 'config' => array ( |
|
104 | - 'type' => 'input', |
|
105 | - 'size' => 30, |
|
106 | - 'max' => 1024, |
|
107 | - 'eval' => 'required,uniqueInPid', |
|
108 | - ), |
|
109 | - ), |
|
110 | - 'record_id' => array ( |
|
111 | - 'exclude' => 1, |
|
112 | - 'label' => 'LLL:EXT:dlf/locallang.xml:tx_dlf_documents.record_id', |
|
113 | - 'config' => array ( |
|
114 | - 'type' => 'input', |
|
115 | - 'size' => 30, |
|
116 | - 'max' => 255, |
|
117 | - 'eval' => 'nospace,uniqueInPid', |
|
118 | - ), |
|
119 | - ), |
|
120 | - 'opac_id' => array ( |
|
121 | - 'exclude' => 1, |
|
122 | - 'label' => 'LLL:EXT:dlf/locallang.xml:tx_dlf_documents.opac_id', |
|
123 | - 'config' => array ( |
|
124 | - 'type' => 'input', |
|
125 | - 'size' => 30, |
|
126 | - 'max' => 255, |
|
127 | - 'eval' => 'nospace', |
|
128 | - ), |
|
129 | - ), |
|
130 | - 'union_id' => array ( |
|
131 | - 'exclude' => 1, |
|
132 | - 'label' => 'LLL:EXT:dlf/locallang.xml:tx_dlf_documents.union_id', |
|
133 | - 'config' => array ( |
|
134 | - 'type' => 'input', |
|
135 | - 'size' => 30, |
|
136 | - 'max' => 255, |
|
137 | - 'eval' => 'nospace', |
|
138 | - ), |
|
139 | - ), |
|
140 | - 'urn' => array ( |
|
141 | - 'exclude' => 1, |
|
142 | - 'label' => 'LLL:EXT:dlf/locallang.xml:tx_dlf_documents.urn', |
|
143 | - 'config' => array ( |
|
144 | - 'type' => 'input', |
|
145 | - 'size' => 30, |
|
146 | - 'max' => 255, |
|
147 | - 'eval' => 'nospace', |
|
148 | - ), |
|
149 | - ), |
|
150 | - 'purl' => array ( |
|
151 | - 'exclude' => 1, |
|
152 | - 'label' => 'LLL:EXT:dlf/locallang.xml:tx_dlf_documents.purl', |
|
153 | - 'config' => array ( |
|
154 | - 'type' => 'input', |
|
155 | - 'size' => 30, |
|
156 | - 'max' => 255, |
|
157 | - 'eval' => 'nospace', |
|
158 | - ), |
|
159 | - ), |
|
160 | - 'title' => array ( |
|
161 | - 'exclude' => 1, |
|
162 | - 'label' => 'LLL:EXT:dlf/locallang.xml:tx_dlf_documents.title', |
|
163 | - 'config' => array ( |
|
164 | - 'type' => 'input', |
|
165 | - 'size' => 30, |
|
166 | - 'max' => 1024, |
|
167 | - 'eval' => 'trim', |
|
168 | - ), |
|
169 | - ), |
|
170 | - 'title_sorting' => array ( |
|
171 | - 'exclude' => 1, |
|
172 | - 'label' => 'LLL:EXT:dlf/locallang.xml:tx_dlf_documents.title_sorting', |
|
173 | - 'config' => array ( |
|
174 | - 'type' => 'input', |
|
175 | - 'size' => 30, |
|
176 | - 'max' => 1024, |
|
177 | - 'eval' => 'trim', |
|
178 | - ), |
|
179 | - ), |
|
180 | - 'author' => array ( |
|
181 | - 'exclude' => 1, |
|
182 | - 'label' => 'LLL:EXT:dlf/locallang.xml:tx_dlf_documents.author', |
|
183 | - 'config' => array ( |
|
184 | - 'type' => 'input', |
|
185 | - 'size' => 30, |
|
186 | - 'max' => 255, |
|
187 | - 'eval' => 'trim', |
|
188 | - ), |
|
189 | - ), |
|
190 | - 'year' => array ( |
|
191 | - 'exclude' => 1, |
|
192 | - 'label' => 'LLL:EXT:dlf/locallang.xml:tx_dlf_documents.year', |
|
193 | - 'config' => array ( |
|
194 | - 'type' => 'input', |
|
195 | - 'size' => 30, |
|
196 | - 'max' => 255, |
|
197 | - 'eval' => 'trim', |
|
198 | - ), |
|
199 | - ), |
|
200 | - 'place' => array ( |
|
201 | - 'exclude' => 1, |
|
202 | - 'label' => 'LLL:EXT:dlf/locallang.xml:tx_dlf_documents.place', |
|
203 | - 'config' => array ( |
|
204 | - 'type' => 'input', |
|
205 | - 'size' => 30, |
|
206 | - 'max' => 255, |
|
207 | - 'eval' => 'trim', |
|
208 | - ), |
|
209 | - ), |
|
210 | - 'thumbnail' => array ( |
|
211 | - 'exclude' => 1, |
|
212 | - 'label' => 'LLL:EXT:dlf/locallang.xml:tx_dlf_documents.thumbnail', |
|
213 | - 'config' => array ( |
|
214 | - 'type' => 'user', |
|
215 | - 'userFunc' => 'EXT:dlf/hooks/class.tx_dlf_tceforms.php:tx_dlf_tceforms->displayThumbnail', |
|
216 | - ), |
|
217 | - ), |
|
218 | - 'metadata' => array ( |
|
219 | - 'config' => array ( |
|
220 | - 'type' => 'passthrough', |
|
221 | - ), |
|
222 | - ), |
|
223 | - 'metadata_sorting' => array ( |
|
224 | - 'config' => array ( |
|
225 | - 'type' => 'passthrough', |
|
226 | - ), |
|
227 | - ), |
|
228 | - 'structure' => array ( |
|
229 | - 'exclude' => 1, |
|
230 | - 'label' => 'LLL:EXT:dlf/locallang.xml:tx_dlf_documents.structure', |
|
231 | - 'config' => array ( |
|
232 | - 'type' => 'select', |
|
233 | - 'renderType' => 'selectSingle', |
|
234 | - 'foreign_table' => 'tx_dlf_structures', |
|
235 | - 'foreign_table_where' => 'AND tx_dlf_structures.pid=###CURRENT_PID### AND tx_dlf_structures.sys_language_uid IN (-1,0) AND tx_dlf_structures.toplevel=1 ORDER BY tx_dlf_structures.label', |
|
236 | - 'size' => 1, |
|
237 | - 'minitems' => 1, |
|
238 | - 'maxitems' => 1, |
|
239 | - ), |
|
240 | - ), |
|
241 | - 'partof' => array ( |
|
242 | - 'label' => 'LLL:EXT:dlf/locallang.xml:tx_dlf_documents.partof', |
|
243 | - 'config' => array ( |
|
244 | - 'type' => 'group', |
|
245 | - 'internal_type' => 'db', |
|
246 | - 'allowed' => 'tx_dlf_documents', |
|
247 | - 'prepend_tname' => 0, |
|
248 | - 'size' => 1, |
|
249 | - 'selectedListStyle' => 'width:400px;', |
|
250 | - 'minitems' => 0, |
|
251 | - 'maxitems' => 1, |
|
252 | - 'disable_controls' => 'browser,delete', |
|
253 | - 'default' => 0, |
|
254 | - 'readOnly' => 1, |
|
255 | - ), |
|
256 | - ), |
|
257 | - 'volume' => array ( |
|
258 | - 'exclude' => 1, |
|
259 | - 'label' => 'LLL:EXT:dlf/locallang.xml:tx_dlf_documents.volume', |
|
260 | - 'config' => array ( |
|
261 | - 'type' => 'input', |
|
262 | - 'size' => 30, |
|
263 | - 'max' => 255, |
|
264 | - 'eval' => 'trim', |
|
265 | - ), |
|
266 | - ), |
|
267 | - 'volume_sorting' => array ( |
|
268 | - 'exclude' => 1, |
|
269 | - 'label' => 'LLL:EXT:dlf/locallang.xml:tx_dlf_documents.volume_sorting', |
|
270 | - 'config' => array ( |
|
271 | - 'type' => 'input', |
|
272 | - 'size' => 30, |
|
273 | - 'max' => 255, |
|
274 | - 'eval' => 'trim', |
|
275 | - ), |
|
276 | - ), |
|
277 | - 'collections' => array ( |
|
278 | - 'exclude' => 1, |
|
279 | - 'label' => 'LLL:EXT:dlf/locallang.xml:tx_dlf_documents.collections', |
|
280 | - 'config' => array ( |
|
281 | - 'type' => 'select', |
|
282 | - 'renderType' => 'selectMultipleSideBySide', |
|
283 | - 'foreign_table' => 'tx_dlf_collections', |
|
284 | - 'foreign_table_where' => 'AND tx_dlf_collections.pid=###CURRENT_PID### AND tx_dlf_collections.sys_language_uid IN (-1,0) ORDER BY tx_dlf_collections.label', |
|
285 | - 'size' => 5, |
|
286 | - 'autoSizeMax' => 15, |
|
287 | - 'minitems' => 1, |
|
288 | - 'maxitems' => 1024, |
|
289 | - 'MM' => 'tx_dlf_relations', |
|
290 | - 'MM_match_fields' => array ( |
|
291 | - 'ident' => 'docs_colls', |
|
292 | - ), |
|
293 | - ), |
|
294 | - ), |
|
295 | - 'owner' => array ( |
|
296 | - 'exclude' => 1, |
|
297 | - 'label' => 'LLL:EXT:dlf/locallang.xml:tx_dlf_documents.owner', |
|
298 | - 'config' => array ( |
|
299 | - 'type' => 'select', |
|
300 | - 'renderType' => 'selectSingle', |
|
301 | - 'foreign_table' => 'tx_dlf_libraries', |
|
302 | - 'foreign_table_where' => 'AND tx_dlf_libraries.sys_language_uid IN (-1,0) ORDER BY tx_dlf_libraries.label', |
|
303 | - 'size' => 1, |
|
304 | - 'minitems' => 0, |
|
305 | - 'maxitems' => 1, |
|
306 | - ), |
|
307 | - ), |
|
308 | - 'solrcore' => array ( |
|
309 | - 'config' => array ( |
|
310 | - 'type' => 'passthrough', |
|
311 | - ), |
|
312 | - ), |
|
313 | - 'status' => array ( |
|
314 | - 'exclude' => 1, |
|
315 | - 'label' => 'LLL:EXT:dlf/locallang.xml:tx_dlf_documents.status', |
|
316 | - 'config' => array ( |
|
317 | - 'type' => 'select', |
|
318 | - 'renderType' => 'selectSingle', |
|
319 | - 'items' => array ( |
|
320 | - array ('LLL:EXT:dlf/locallang.xml:tx_dlf_documents.status.default', 0), |
|
321 | - ), |
|
322 | - 'size' => 1, |
|
323 | - 'minitems' => 1, |
|
324 | - 'maxitems' => 1, |
|
325 | - 'default' => 0, |
|
326 | - ), |
|
327 | - ), |
|
328 | - ), |
|
329 | - 'types' => array ( |
|
330 | - '0' => array ('showitem' => '--div--;LLL:EXT:dlf/locallang.xml:tx_dlf_documents.tab1, title,--palette--;;1;;1-1-1, author, year, place, structure,--palette--;;2;;2-2-2, collections;;;;3-3-3, --div--;LLL:EXT:dlf/locallang.xml:tx_dlf_documents.tab2, location;;;;1-1-1, record_id, prod_id;;;;2-2-2, oai_id;;;;3-3-3, opac_id, union_id, urn, purl;;;;4-4-4, --div--;LLL:EXT:dlf/locallang.xml:tx_dlf_documents.tab3, hidden,--palette--;;3;;1-1-1, fe_group;;;;2-2-2, status;;;;3-3-3, owner;;;;4-4-4'), |
|
331 | - ), |
|
332 | - 'palettes' => array ( |
|
333 | - '1' => array ('showitem' => 'title_sorting', 'canNotCollapse' => 1), |
|
334 | - '2' => array ('showitem' => 'partof, thumbnail, --linebreak--, volume, volume_sorting', 'canNotCollapse' => 1), |
|
335 | - '3' => array ('showitem' => 'starttime, endtime', 'canNotCollapse' => 1), |
|
336 | - ) |
|
13 | + 'ctrl' => array ( |
|
14 | + 'title' => 'LLL:EXT:dlf/locallang.xml:tx_dlf_documents', |
|
15 | + 'label' => 'title', |
|
16 | + 'tstamp' => 'tstamp', |
|
17 | + 'crdate' => 'crdate', |
|
18 | + 'cruser_id' => 'cruser_id', |
|
19 | + 'default_sortby' => 'ORDER BY title_sorting', |
|
20 | + 'delete' => 'deleted', |
|
21 | + 'enablecolumns' => array ( |
|
22 | + 'disabled' => 'hidden', |
|
23 | + 'starttime' => 'starttime', |
|
24 | + 'endtime' => 'endtime', |
|
25 | + 'fe_group' => 'fe_group', |
|
26 | + ), |
|
27 | + 'iconfile' => \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extRelPath('dlf').'res/icons/txdlfdocuments.png', |
|
28 | + 'rootLevel' => 0, |
|
29 | + 'dividers2tabs' => 2, |
|
30 | + 'searchFields' => 'title,volume,author,year,place,uid,prod_id,location,oai_id,opac_id,union_id,urn', |
|
31 | + ), |
|
32 | + 'feInterface' => array ( |
|
33 | + 'fe_admin_fieldList' => '', |
|
34 | + ), |
|
35 | + 'interface' => array ( |
|
36 | + 'showRecordFieldList' => 'title,volume,author,year,place,uid,prod_id,location,oai_id,opac_id,union_id,urn', |
|
37 | + 'maxDBListItems' => 25, |
|
38 | + 'maxSingleDBListItems' => 50, |
|
39 | + ), |
|
40 | + 'columns' => array ( |
|
41 | + 'hidden' => array ( |
|
42 | + 'exclude' => 1, |
|
43 | + 'label' => 'LLL:EXT:lang/locallang_general.xml:LGL.hidden', |
|
44 | + 'config' => array ( |
|
45 | + 'type' => 'check', |
|
46 | + 'default' => 0, |
|
47 | + ), |
|
48 | + ), |
|
49 | + 'starttime' => array ( |
|
50 | + 'exclude' => 1, |
|
51 | + 'label' => 'LLL:EXT:lang/locallang_general.xml:LGL.starttime', |
|
52 | + 'config' => array ( |
|
53 | + 'type' => 'input', |
|
54 | + 'size' => '13', |
|
55 | + 'max' => '20', |
|
56 | + 'eval' => 'datetime', |
|
57 | + 'default' => '0', |
|
58 | + ), |
|
59 | + ), |
|
60 | + 'endtime' => array ( |
|
61 | + 'exclude' => 1, |
|
62 | + 'label' => 'LLL:EXT:lang/locallang_general.xml:LGL.endtime', |
|
63 | + 'config' => array ( |
|
64 | + 'type' => 'input', |
|
65 | + 'size' => '13', |
|
66 | + 'max' => '20', |
|
67 | + 'eval' => 'datetime', |
|
68 | + 'default' => '0', |
|
69 | + ), |
|
70 | + ), |
|
71 | + 'fe_group' => array ( |
|
72 | + 'exclude' => 1, |
|
73 | + 'label' => 'LLL:EXT:lang/locallang_general.xml:LGL.fe_group', |
|
74 | + 'config' => array ( |
|
75 | + 'type' => 'select', |
|
76 | + 'renderType' => 'selectMultipleSideBySide', |
|
77 | + 'items' => array ( |
|
78 | + array ('LLL:EXT:lang/locallang_general.xml:LGL.hide_at_login', -1), |
|
79 | + array ('LLL:EXT:lang/locallang_general.xml:LGL.any_login', -2), |
|
80 | + array ('LLL:EXT:lang/locallang_general.xml:LGL.usergroups', '--div--'), |
|
81 | + ), |
|
82 | + 'foreign_table' => 'fe_groups', |
|
83 | + 'size' => 5, |
|
84 | + 'autoSizeMax' => 15, |
|
85 | + 'minitems' => 0, |
|
86 | + 'maxitems' => 20, |
|
87 | + 'exclusiveKeys' => '-1,-2', |
|
88 | + ), |
|
89 | + ), |
|
90 | + 'prod_id' => array ( |
|
91 | + 'exclude' => 1, |
|
92 | + 'label' => 'LLL:EXT:dlf/locallang.xml:tx_dlf_documents.prod_id', |
|
93 | + 'config' => array ( |
|
94 | + 'type' => 'input', |
|
95 | + 'size' => 30, |
|
96 | + 'max' => 255, |
|
97 | + 'eval' => 'nospace', |
|
98 | + ), |
|
99 | + ), |
|
100 | + 'location' => array ( |
|
101 | + 'exclude' => 1, |
|
102 | + 'label' => 'LLL:EXT:dlf/locallang.xml:tx_dlf_documents.location', |
|
103 | + 'config' => array ( |
|
104 | + 'type' => 'input', |
|
105 | + 'size' => 30, |
|
106 | + 'max' => 1024, |
|
107 | + 'eval' => 'required,uniqueInPid', |
|
108 | + ), |
|
109 | + ), |
|
110 | + 'record_id' => array ( |
|
111 | + 'exclude' => 1, |
|
112 | + 'label' => 'LLL:EXT:dlf/locallang.xml:tx_dlf_documents.record_id', |
|
113 | + 'config' => array ( |
|
114 | + 'type' => 'input', |
|
115 | + 'size' => 30, |
|
116 | + 'max' => 255, |
|
117 | + 'eval' => 'nospace,uniqueInPid', |
|
118 | + ), |
|
119 | + ), |
|
120 | + 'opac_id' => array ( |
|
121 | + 'exclude' => 1, |
|
122 | + 'label' => 'LLL:EXT:dlf/locallang.xml:tx_dlf_documents.opac_id', |
|
123 | + 'config' => array ( |
|
124 | + 'type' => 'input', |
|
125 | + 'size' => 30, |
|
126 | + 'max' => 255, |
|
127 | + 'eval' => 'nospace', |
|
128 | + ), |
|
129 | + ), |
|
130 | + 'union_id' => array ( |
|
131 | + 'exclude' => 1, |
|
132 | + 'label' => 'LLL:EXT:dlf/locallang.xml:tx_dlf_documents.union_id', |
|
133 | + 'config' => array ( |
|
134 | + 'type' => 'input', |
|
135 | + 'size' => 30, |
|
136 | + 'max' => 255, |
|
137 | + 'eval' => 'nospace', |
|
138 | + ), |
|
139 | + ), |
|
140 | + 'urn' => array ( |
|
141 | + 'exclude' => 1, |
|
142 | + 'label' => 'LLL:EXT:dlf/locallang.xml:tx_dlf_documents.urn', |
|
143 | + 'config' => array ( |
|
144 | + 'type' => 'input', |
|
145 | + 'size' => 30, |
|
146 | + 'max' => 255, |
|
147 | + 'eval' => 'nospace', |
|
148 | + ), |
|
149 | + ), |
|
150 | + 'purl' => array ( |
|
151 | + 'exclude' => 1, |
|
152 | + 'label' => 'LLL:EXT:dlf/locallang.xml:tx_dlf_documents.purl', |
|
153 | + 'config' => array ( |
|
154 | + 'type' => 'input', |
|
155 | + 'size' => 30, |
|
156 | + 'max' => 255, |
|
157 | + 'eval' => 'nospace', |
|
158 | + ), |
|
159 | + ), |
|
160 | + 'title' => array ( |
|
161 | + 'exclude' => 1, |
|
162 | + 'label' => 'LLL:EXT:dlf/locallang.xml:tx_dlf_documents.title', |
|
163 | + 'config' => array ( |
|
164 | + 'type' => 'input', |
|
165 | + 'size' => 30, |
|
166 | + 'max' => 1024, |
|
167 | + 'eval' => 'trim', |
|
168 | + ), |
|
169 | + ), |
|
170 | + 'title_sorting' => array ( |
|
171 | + 'exclude' => 1, |
|
172 | + 'label' => 'LLL:EXT:dlf/locallang.xml:tx_dlf_documents.title_sorting', |
|
173 | + 'config' => array ( |
|
174 | + 'type' => 'input', |
|
175 | + 'size' => 30, |
|
176 | + 'max' => 1024, |
|
177 | + 'eval' => 'trim', |
|
178 | + ), |
|
179 | + ), |
|
180 | + 'author' => array ( |
|
181 | + 'exclude' => 1, |
|
182 | + 'label' => 'LLL:EXT:dlf/locallang.xml:tx_dlf_documents.author', |
|
183 | + 'config' => array ( |
|
184 | + 'type' => 'input', |
|
185 | + 'size' => 30, |
|
186 | + 'max' => 255, |
|
187 | + 'eval' => 'trim', |
|
188 | + ), |
|
189 | + ), |
|
190 | + 'year' => array ( |
|
191 | + 'exclude' => 1, |
|
192 | + 'label' => 'LLL:EXT:dlf/locallang.xml:tx_dlf_documents.year', |
|
193 | + 'config' => array ( |
|
194 | + 'type' => 'input', |
|
195 | + 'size' => 30, |
|
196 | + 'max' => 255, |
|
197 | + 'eval' => 'trim', |
|
198 | + ), |
|
199 | + ), |
|
200 | + 'place' => array ( |
|
201 | + 'exclude' => 1, |
|
202 | + 'label' => 'LLL:EXT:dlf/locallang.xml:tx_dlf_documents.place', |
|
203 | + 'config' => array ( |
|
204 | + 'type' => 'input', |
|
205 | + 'size' => 30, |
|
206 | + 'max' => 255, |
|
207 | + 'eval' => 'trim', |
|
208 | + ), |
|
209 | + ), |
|
210 | + 'thumbnail' => array ( |
|
211 | + 'exclude' => 1, |
|
212 | + 'label' => 'LLL:EXT:dlf/locallang.xml:tx_dlf_documents.thumbnail', |
|
213 | + 'config' => array ( |
|
214 | + 'type' => 'user', |
|
215 | + 'userFunc' => 'EXT:dlf/hooks/class.tx_dlf_tceforms.php:tx_dlf_tceforms->displayThumbnail', |
|
216 | + ), |
|
217 | + ), |
|
218 | + 'metadata' => array ( |
|
219 | + 'config' => array ( |
|
220 | + 'type' => 'passthrough', |
|
221 | + ), |
|
222 | + ), |
|
223 | + 'metadata_sorting' => array ( |
|
224 | + 'config' => array ( |
|
225 | + 'type' => 'passthrough', |
|
226 | + ), |
|
227 | + ), |
|
228 | + 'structure' => array ( |
|
229 | + 'exclude' => 1, |
|
230 | + 'label' => 'LLL:EXT:dlf/locallang.xml:tx_dlf_documents.structure', |
|
231 | + 'config' => array ( |
|
232 | + 'type' => 'select', |
|
233 | + 'renderType' => 'selectSingle', |
|
234 | + 'foreign_table' => 'tx_dlf_structures', |
|
235 | + 'foreign_table_where' => 'AND tx_dlf_structures.pid=###CURRENT_PID### AND tx_dlf_structures.sys_language_uid IN (-1,0) AND tx_dlf_structures.toplevel=1 ORDER BY tx_dlf_structures.label', |
|
236 | + 'size' => 1, |
|
237 | + 'minitems' => 1, |
|
238 | + 'maxitems' => 1, |
|
239 | + ), |
|
240 | + ), |
|
241 | + 'partof' => array ( |
|
242 | + 'label' => 'LLL:EXT:dlf/locallang.xml:tx_dlf_documents.partof', |
|
243 | + 'config' => array ( |
|
244 | + 'type' => 'group', |
|
245 | + 'internal_type' => 'db', |
|
246 | + 'allowed' => 'tx_dlf_documents', |
|
247 | + 'prepend_tname' => 0, |
|
248 | + 'size' => 1, |
|
249 | + 'selectedListStyle' => 'width:400px;', |
|
250 | + 'minitems' => 0, |
|
251 | + 'maxitems' => 1, |
|
252 | + 'disable_controls' => 'browser,delete', |
|
253 | + 'default' => 0, |
|
254 | + 'readOnly' => 1, |
|
255 | + ), |
|
256 | + ), |
|
257 | + 'volume' => array ( |
|
258 | + 'exclude' => 1, |
|
259 | + 'label' => 'LLL:EXT:dlf/locallang.xml:tx_dlf_documents.volume', |
|
260 | + 'config' => array ( |
|
261 | + 'type' => 'input', |
|
262 | + 'size' => 30, |
|
263 | + 'max' => 255, |
|
264 | + 'eval' => 'trim', |
|
265 | + ), |
|
266 | + ), |
|
267 | + 'volume_sorting' => array ( |
|
268 | + 'exclude' => 1, |
|
269 | + 'label' => 'LLL:EXT:dlf/locallang.xml:tx_dlf_documents.volume_sorting', |
|
270 | + 'config' => array ( |
|
271 | + 'type' => 'input', |
|
272 | + 'size' => 30, |
|
273 | + 'max' => 255, |
|
274 | + 'eval' => 'trim', |
|
275 | + ), |
|
276 | + ), |
|
277 | + 'collections' => array ( |
|
278 | + 'exclude' => 1, |
|
279 | + 'label' => 'LLL:EXT:dlf/locallang.xml:tx_dlf_documents.collections', |
|
280 | + 'config' => array ( |
|
281 | + 'type' => 'select', |
|
282 | + 'renderType' => 'selectMultipleSideBySide', |
|
283 | + 'foreign_table' => 'tx_dlf_collections', |
|
284 | + 'foreign_table_where' => 'AND tx_dlf_collections.pid=###CURRENT_PID### AND tx_dlf_collections.sys_language_uid IN (-1,0) ORDER BY tx_dlf_collections.label', |
|
285 | + 'size' => 5, |
|
286 | + 'autoSizeMax' => 15, |
|
287 | + 'minitems' => 1, |
|
288 | + 'maxitems' => 1024, |
|
289 | + 'MM' => 'tx_dlf_relations', |
|
290 | + 'MM_match_fields' => array ( |
|
291 | + 'ident' => 'docs_colls', |
|
292 | + ), |
|
293 | + ), |
|
294 | + ), |
|
295 | + 'owner' => array ( |
|
296 | + 'exclude' => 1, |
|
297 | + 'label' => 'LLL:EXT:dlf/locallang.xml:tx_dlf_documents.owner', |
|
298 | + 'config' => array ( |
|
299 | + 'type' => 'select', |
|
300 | + 'renderType' => 'selectSingle', |
|
301 | + 'foreign_table' => 'tx_dlf_libraries', |
|
302 | + 'foreign_table_where' => 'AND tx_dlf_libraries.sys_language_uid IN (-1,0) ORDER BY tx_dlf_libraries.label', |
|
303 | + 'size' => 1, |
|
304 | + 'minitems' => 0, |
|
305 | + 'maxitems' => 1, |
|
306 | + ), |
|
307 | + ), |
|
308 | + 'solrcore' => array ( |
|
309 | + 'config' => array ( |
|
310 | + 'type' => 'passthrough', |
|
311 | + ), |
|
312 | + ), |
|
313 | + 'status' => array ( |
|
314 | + 'exclude' => 1, |
|
315 | + 'label' => 'LLL:EXT:dlf/locallang.xml:tx_dlf_documents.status', |
|
316 | + 'config' => array ( |
|
317 | + 'type' => 'select', |
|
318 | + 'renderType' => 'selectSingle', |
|
319 | + 'items' => array ( |
|
320 | + array ('LLL:EXT:dlf/locallang.xml:tx_dlf_documents.status.default', 0), |
|
321 | + ), |
|
322 | + 'size' => 1, |
|
323 | + 'minitems' => 1, |
|
324 | + 'maxitems' => 1, |
|
325 | + 'default' => 0, |
|
326 | + ), |
|
327 | + ), |
|
328 | + ), |
|
329 | + 'types' => array ( |
|
330 | + '0' => array ('showitem' => '--div--;LLL:EXT:dlf/locallang.xml:tx_dlf_documents.tab1, title,--palette--;;1;;1-1-1, author, year, place, structure,--palette--;;2;;2-2-2, collections;;;;3-3-3, --div--;LLL:EXT:dlf/locallang.xml:tx_dlf_documents.tab2, location;;;;1-1-1, record_id, prod_id;;;;2-2-2, oai_id;;;;3-3-3, opac_id, union_id, urn, purl;;;;4-4-4, --div--;LLL:EXT:dlf/locallang.xml:tx_dlf_documents.tab3, hidden,--palette--;;3;;1-1-1, fe_group;;;;2-2-2, status;;;;3-3-3, owner;;;;4-4-4'), |
|
331 | + ), |
|
332 | + 'palettes' => array ( |
|
333 | + '1' => array ('showitem' => 'title_sorting', 'canNotCollapse' => 1), |
|
334 | + '2' => array ('showitem' => 'partof, thumbnail, --linebreak--, volume, volume_sorting', 'canNotCollapse' => 1), |
|
335 | + '3' => array ('showitem' => 'starttime, endtime', 'canNotCollapse' => 1), |
|
336 | + ) |
|
337 | 337 | ); |
@@ -10,67 +10,67 @@ |
||
10 | 10 | */ |
11 | 11 | |
12 | 12 | return array ( |
13 | - 'ctrl' => array ( |
|
14 | - 'title' => 'LLL:EXT:dlf/locallang.xml:tx_dlf_formats', |
|
15 | - 'label' => 'type', |
|
16 | - 'tstamp' => 'tstamp', |
|
17 | - 'crdate' => 'crdate', |
|
18 | - 'cruser_id' => 'cruser_id', |
|
19 | - 'default_sortby' => 'ORDER BY type', |
|
20 | - 'delete' => 'deleted', |
|
21 | - 'iconfile' => \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extRelPath('dlf').'res/icons/txdlfformats.png', |
|
22 | - 'rootLevel' => 1, |
|
23 | - 'dividers2tabs' => 2, |
|
24 | - 'searchFields' => 'type,class', |
|
25 | - ), |
|
26 | - 'feInterface' => array ( |
|
27 | - 'fe_admin_fieldList' => '', |
|
28 | - ), |
|
29 | - 'interface' => array ( |
|
30 | - 'showRecordFieldList' => 'type,class', |
|
31 | - ), |
|
32 | - 'columns' => array ( |
|
33 | - 'type' => array ( |
|
34 | - 'label' => 'LLL:EXT:dlf/locallang.xml:tx_dlf_formats.type', |
|
35 | - 'config' => array ( |
|
36 | - 'type' => 'input', |
|
37 | - 'size' => 30, |
|
38 | - 'max' => 255, |
|
39 | - 'eval' => 'required,nospace,alphanum_x,unique', |
|
40 | - ), |
|
41 | - ), |
|
42 | - 'root' => array ( |
|
43 | - 'label' => 'LLL:EXT:dlf/locallang.xml:tx_dlf_formats.root', |
|
44 | - 'config' => array ( |
|
45 | - 'type' => 'input', |
|
46 | - 'size' => 30, |
|
47 | - 'max' => 255, |
|
48 | - 'eval' => 'required,nospace,alphanum_x,unique', |
|
49 | - ), |
|
50 | - ), |
|
51 | - 'namespace' => array ( |
|
52 | - 'label' => 'LLL:EXT:dlf/locallang.xml:tx_dlf_formats.namespace', |
|
53 | - 'config' => array ( |
|
54 | - 'type' => 'input', |
|
55 | - 'size' => 30, |
|
56 | - 'max' => 1024, |
|
57 | - 'eval' => 'required,nospace,unique', |
|
58 | - ), |
|
59 | - ), |
|
60 | - 'class' => array ( |
|
61 | - 'label' => 'LLL:EXT:dlf/locallang.xml:tx_dlf_formats.class', |
|
62 | - 'config' => array ( |
|
63 | - 'type' => 'input', |
|
64 | - 'size' => 30, |
|
65 | - 'max' => 1024, |
|
66 | - 'eval' => 'nospace,alphanum_x,unique', |
|
67 | - ), |
|
68 | - ), |
|
69 | - ), |
|
70 | - 'types' => array ( |
|
71 | - '0' => array ('showitem' => '--div--;LLL:EXT:dlf/locallang.xml:tx_dlf_formats.tab1, type;;;;1-1-1, root;;;;2-2-2, namespace, class;;;;3-3-3'), |
|
72 | - ), |
|
73 | - 'palettes' => array ( |
|
74 | - '1' => array ('showitem' => ''), |
|
75 | - ), |
|
13 | + 'ctrl' => array ( |
|
14 | + 'title' => 'LLL:EXT:dlf/locallang.xml:tx_dlf_formats', |
|
15 | + 'label' => 'type', |
|
16 | + 'tstamp' => 'tstamp', |
|
17 | + 'crdate' => 'crdate', |
|
18 | + 'cruser_id' => 'cruser_id', |
|
19 | + 'default_sortby' => 'ORDER BY type', |
|
20 | + 'delete' => 'deleted', |
|
21 | + 'iconfile' => \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extRelPath('dlf').'res/icons/txdlfformats.png', |
|
22 | + 'rootLevel' => 1, |
|
23 | + 'dividers2tabs' => 2, |
|
24 | + 'searchFields' => 'type,class', |
|
25 | + ), |
|
26 | + 'feInterface' => array ( |
|
27 | + 'fe_admin_fieldList' => '', |
|
28 | + ), |
|
29 | + 'interface' => array ( |
|
30 | + 'showRecordFieldList' => 'type,class', |
|
31 | + ), |
|
32 | + 'columns' => array ( |
|
33 | + 'type' => array ( |
|
34 | + 'label' => 'LLL:EXT:dlf/locallang.xml:tx_dlf_formats.type', |
|
35 | + 'config' => array ( |
|
36 | + 'type' => 'input', |
|
37 | + 'size' => 30, |
|
38 | + 'max' => 255, |
|
39 | + 'eval' => 'required,nospace,alphanum_x,unique', |
|
40 | + ), |
|
41 | + ), |
|
42 | + 'root' => array ( |
|
43 | + 'label' => 'LLL:EXT:dlf/locallang.xml:tx_dlf_formats.root', |
|
44 | + 'config' => array ( |
|
45 | + 'type' => 'input', |
|
46 | + 'size' => 30, |
|
47 | + 'max' => 255, |
|
48 | + 'eval' => 'required,nospace,alphanum_x,unique', |
|
49 | + ), |
|
50 | + ), |
|
51 | + 'namespace' => array ( |
|
52 | + 'label' => 'LLL:EXT:dlf/locallang.xml:tx_dlf_formats.namespace', |
|
53 | + 'config' => array ( |
|
54 | + 'type' => 'input', |
|
55 | + 'size' => 30, |
|
56 | + 'max' => 1024, |
|
57 | + 'eval' => 'required,nospace,unique', |
|
58 | + ), |
|
59 | + ), |
|
60 | + 'class' => array ( |
|
61 | + 'label' => 'LLL:EXT:dlf/locallang.xml:tx_dlf_formats.class', |
|
62 | + 'config' => array ( |
|
63 | + 'type' => 'input', |
|
64 | + 'size' => 30, |
|
65 | + 'max' => 1024, |
|
66 | + 'eval' => 'nospace,alphanum_x,unique', |
|
67 | + ), |
|
68 | + ), |
|
69 | + ), |
|
70 | + 'types' => array ( |
|
71 | + '0' => array ('showitem' => '--div--;LLL:EXT:dlf/locallang.xml:tx_dlf_formats.tab1, type;;;;1-1-1, root;;;;2-2-2, namespace, class;;;;3-3-3'), |
|
72 | + ), |
|
73 | + 'palettes' => array ( |
|
74 | + '1' => array ('showitem' => ''), |
|
75 | + ), |
|
76 | 76 | ); |