[BUGFIX] Use t3lib_cache_frontend_VariableFrontend as fallback frontend
[Packages/TYPO3.CMS.git] / t3lib / class.t3lib_querygenerator.php
1 <?php
2 /***************************************************************
3 * Copyright notice
4 *
5 * (c) 2001-2011 Christian Jul Jensen (christian@typo3.com)
6 * All rights reserved
7 *
8 * This script is part of the TYPO3 project. The TYPO3 project is
9 * free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
13 *
14 * The GNU General Public License can be found at
15 * http://www.gnu.org/copyleft/gpl.html.
16 * A copy is found in the textfile GPL.txt and important notices to the license
17 * from the author is found in LICENSE.txt distributed with these scripts.
18 *
19 *
20 * This script is distributed in the hope that it will be useful,
21 * but WITHOUT ANY WARRANTY; without even the implied warranty of
22 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23 * GNU General Public License for more details.
24 *
25 * This copyright notice MUST APPEAR in all copies of the script!
26 ***************************************************************/
27 /**
28 * Class for generating front end for building queries
29 *
30 * @author Christian Jul Jensen <christian@typo3.com>
31 * @author Kasper Skårhøj <kasperYYYY@typo3.com>
32 * @coauthor Jo Hasenau <info@cybercraft.de>
33 */
34 /**
35 * [CLASS/FUNCTION INDEX of SCRIPT]
36 *
37 *
38 *
39 * 98: class t3lib_queryGenerator
40 * 245: function makeFieldList()
41 * 273: function init($name,$table,$fieldList='')
42 * 410: function setAndCleanUpExternalLists($name,$list,$force='')
43 * 426: function procesData($qC='')
44 * 529: function cleanUpQueryConfig($queryConfig)
45 * 586: function getFormElements($subLevel=0,$queryConfig='',$parent='')
46 * 744: function makeOptionList($fN, $conf, $table)
47 * 953: function printCodeArray($codeArr,$l=0)
48 * 976: function formatQ($str)
49 * 989: function mkOperatorSelect($name,$op,$draw,$submit)
50 * 1011: function mkTypeSelect($name,$fieldName,$prepend='FIELD_')
51 * 1032: function verifyType($fieldName)
52 * 1049: function verifyComparison($comparison,$neg)
53 * 1068: function mkFieldToInputSelect($name,$fieldName)
54 * 1091: function mkTableSelect($name,$cur)
55 * 1113: function mkCompSelect($name,$comparison,$neg)
56 * 1131: function getSubscript($arr)
57 * 1146: function initUserDef()
58 * 1155: function userDef()
59 * 1164: function userDefCleanUp($queryConfig)
60 * 1175: function getQuery ($queryConfig,$pad='')
61 * 1205: function getQuerySingle($conf,$first)
62 * 1245: function cleanInputVal($conf,$suffix='')
63 * 1270: function getUserDefQuery ($qcArr)
64 * 1278: function updateIcon()
65 * 1287: function getLabelCol()
66 * 1299: function makeSelectorTable($modSettings,$enableList='table,fields,query,group,order,limit')
67 * 1431: function getTreeList($id, $depth, $begin=0, $perms_clause)
68 * 1465: function getSelectQuery($qString = '', $fN = '')
69 * 1504: function JSbottom($formname='forms[0]')
70 * 1510: function typo3FormFieldSet(theField, evallist, is_in, checkbox, checkboxValue)
71 * 1528: function typo3FormFieldGet(theField, evallist, is_in, checkbox, checkboxValue, checkbox_off)
72 *
73 * TOTAL FUNCTIONS: 32
74 * (This index is automatically created/updated by the extension "extdeveval")
75 *
76 */
77
78
79 /**
80 * Class for generating front end for building queries
81 *
82 * @author Christian Jul Jensen <christian@typo3.com>
83 * @author Kasper Skårhøj <kasperYYYY@typo3.com>
84 * @package TYPO3
85 * @subpackage t3lib
86 */
87 class t3lib_queryGenerator {
88 var $lang = array(
89 'OR' => 'or',
90 'AND' => 'and',
91 'comparison' => array(
92 // Type = text offset = 0
93 '0_' => 'contains',
94 '1_' => 'does not contain',
95 '2_' => 'starts with',
96 '3_' => 'does not start with',
97 '4_' => 'ends with',
98 '5_' => 'does not end with',
99 '6_' => 'equals',
100 '7_' => 'does not equal',
101 // Type = number , offset = 32
102 '32_' => 'equals',
103 '33_' => 'does not equal',
104 '34_' => 'is greater than',
105 '35_' => 'is less than',
106 '36_' => 'is between',
107 '37_' => 'is not between',
108 '38_' => 'is in list',
109 '39_' => 'is not in list',
110 '40_' => 'binary AND equals',
111 '41_' => 'binary AND does not equal',
112 '42_' => 'binary OR equals',
113 '43_' => 'binary OR does not equal',
114 // Type = multiple, relation, files , offset = 64
115 '64_' => 'equals',
116 '65_' => 'does not equal',
117 '66_' => 'contains',
118 '67_' => 'does not contain',
119 '68_' => 'is in list',
120 '69_' => 'is not in list',
121 '70_' => 'binary AND equals',
122 '71_' => 'binary AND does not equal',
123 '72_' => 'binary OR equals',
124 '73_' => 'binary OR does not equal',
125 // Type = date,time offset = 96
126 '96_' => 'equals',
127 '97_' => 'does not equal',
128 '98_' => 'is greater than',
129 '99_' => 'is less than',
130 '100_' => 'is between',
131 '101_' => 'is not between',
132 '102_' => 'binary AND equals',
133 '103_' => 'binary AND does not equal',
134 '104_' => 'binary OR equals',
135 '105_' => 'binary OR does not equal',
136 // Type = boolean, offset = 128
137 '128_' => 'is True',
138 '129_' => 'is False',
139 // Type = binary , offset = 160
140 '160_' => 'equals',
141 '161_' => 'does not equal',
142 '162_' => 'contains',
143 '163_' => 'does not contain'
144 )
145 );
146
147 var $compSQL = array(
148 // Type = text offset = 0
149 '0' => "#FIELD# LIKE '%#VALUE#%'",
150 '1' => "#FIELD# NOT LIKE '%#VALUE#%'",
151 '2' => "#FIELD# LIKE '#VALUE#%'",
152 '3' => "#FIELD# NOT LIKE '#VALUE#%'",
153 '4' => "#FIELD# LIKE '%#VALUE#'",
154 '5' => "#FIELD# NOT LIKE '%#VALUE#'",
155 '6' => "#FIELD# = '#VALUE#'",
156 '7' => "#FIELD# != '#VALUE#'",
157 // Type = number, offset = 32
158 '32' => "#FIELD# = '#VALUE#'",
159 '33' => "#FIELD# != '#VALUE#'",
160 '34' => '#FIELD# > #VALUE#',
161 '35' => '#FIELD# < #VALUE#',
162 '36' => '#FIELD# >= #VALUE# AND #FIELD# <= #VALUE1#',
163 '37' => 'NOT (#FIELD# >= #VALUE# AND #FIELD# <= #VALUE1#)',
164 '38' => '#FIELD# IN (#VALUE#)',
165 '39' => '#FIELD# NOT IN (#VALUE#)',
166 '40' => '(#FIELD# & #VALUE#)=#VALUE#',
167 '41' => '(#FIELD# & #VALUE#)!=#VALUE#',
168 '42' => '(#FIELD# | #VALUE#)=#VALUE#',
169 '43' => '(#FIELD# | #VALUE#)!=#VALUE#',
170 // Type = multiple, relation, files , offset = 64
171 '64' => "#FIELD# = '#VALUE#'",
172 '65' => "#FIELD# != '#VALUE#'",
173 '66' => "#FIELD# LIKE '%#VALUE#%' AND #FIELD# LIKE '%#VALUE1#%'",
174 '67' => "(#FIELD# NOT LIKE '%#VALUE#%' OR #FIELD# NOT LIKE '%#VALUE1#%')",
175 '68' => '#FIELD# IN (#VALUE#)',
176 '69' => '#FIELD# NOT IN (#VALUE#)',
177 '70' => '(#FIELD# & #VALUE#)=#VALUE#',
178 '71' => '(#FIELD# & #VALUE#)!=#VALUE#',
179 '72' => '(#FIELD# | #VALUE#)=#VALUE#',
180 '73' => '(#FIELD# | #VALUE#)!=#VALUE#',
181 // Type = date, offset = 32
182 '96' => "#FIELD# = '#VALUE#'",
183 '97' => "#FIELD# != '#VALUE#'",
184 '98' => '#FIELD# > #VALUE#',
185 '99' => '#FIELD# < #VALUE#',
186 '100' => '#FIELD# >= #VALUE# AND #FIELD# <= #VALUE1#',
187 '101' => 'NOT (#FIELD# >= #VALUE# AND #FIELD# <= #VALUE1#)',
188 '102' => '(#FIELD# & #VALUE#)=#VALUE#',
189 '103' => '(#FIELD# & #VALUE#)!=#VALUE#',
190 '104' => '(#FIELD# | #VALUE#)=#VALUE#',
191 '105' => '(#FIELD# | #VALUE#)!=#VALUE#',
192 // Type = boolean, offset = 128
193 '128' => "#FIELD# = '1'",
194 '129' => "#FIELD# != '1'",
195 // Type = binary = 160
196 '160' => "#FIELD# = '#VALUE#'",
197 '161' => "#FIELD# != '#VALUE#'",
198 '162' => '(#FIELD# & #VALUE#)=#VALUE#',
199 '163' => '(#FIELD# & #VALUE#)=0'
200 );
201
202 var $comp_offsets = array(
203 'text' => 0,
204 'number' => 1,
205 'multiple' => 2,
206 'relation' => 2,
207 'files' => 2,
208 'date' => 3,
209 'time' => 3,
210 'boolean' => 4,
211 'binary' => 5
212 );
213 var $noWrap = ' nowrap';
214
215 var $name; // Form data name prefix
216 var $table; // table for the query
217 var $fieldList; // field list
218 var $fields = array(); // Array of the fields possible
219 var $extFieldLists = array();
220 var $queryConfig = array(); // The query config
221 var $enablePrefix = 0;
222 var $enableQueryParts = 0;
223 var $extJSCODE = '';
224
225 protected $formName = '';
226
227
228 /**
229 * @return [type] ...
230 */
231 function makeFieldList() {
232 $fieldListArr = array();
233 if (is_array($GLOBALS['TCA'][$this->table])) {
234 t3lib_div::loadTCA($this->table);
235 foreach ($GLOBALS['TCA'][$this->table]['columns'] as $fN => $value) {
236 $fieldListArr[] = $fN;
237 }
238 $fieldListArr[] = 'uid';
239 $fieldListArr[] = 'pid';
240 $fieldListArr[] = 'deleted';
241 if ($GLOBALS['TCA'][$this->table]['ctrl']['tstamp']) {
242 $fieldListArr[] = $GLOBALS['TCA'][$this->table]['ctrl']['tstamp'];
243 }
244 if ($GLOBALS['TCA'][$this->table]['ctrl']['crdate']) {
245 $fieldListArr[] = $GLOBALS['TCA'][$this->table]['ctrl']['crdate'];
246 }
247 if ($GLOBALS['TCA'][$this->table]['ctrl']['cruser_id']) {
248 $fieldListArr[] = $GLOBALS['TCA'][$this->table]['ctrl']['cruser_id'];
249 }
250 if ($GLOBALS['TCA'][$this->table]['ctrl']['sortby']) {
251 $fieldListArr[] = $GLOBALS['TCA'][$this->table]['ctrl']['sortby'];
252 }
253 }
254 return implode(',', $fieldListArr);
255 }
256
257 /**
258 * [Describe function...]
259 *
260 * @param [type] $name: ...
261 * @param [type] $table: ...
262 * @param [type] $fieldList: ...
263 * @return [type] ...
264 */
265 function init($name, $table, $fieldList = '') {
266
267 // Analysing the fields in the table.
268 if (is_array($GLOBALS['TCA'][$table])) {
269 t3lib_div::loadTCA($table);
270 $this->name = $name;
271 $this->table = $table;
272 $this->fieldList = $fieldList ? $fieldList : $this->makeFieldList();
273
274 $fieldArr = t3lib_div::trimExplode(',', $this->fieldList, 1);
275 foreach ($fieldArr as $fN) {
276 $fC = $GLOBALS['TCA'][$this->table]['columns'][$fN];
277 $this->fields[$fN] = $fC['config'];
278 $this->fields[$fN]['exclude'] = $fC['exclude'];
279 if (is_array($fC) && $fC['label']) {
280 $this->fields[$fN]['label'] = rtrim(trim($GLOBALS['LANG']->sL($fC['label'])), ':');
281 switch ($this->fields[$fN]['type']) {
282 case 'input':
283 if (preg_match('/int|year/i', $this->fields[$fN]['eval'])) {
284 $this->fields[$fN]['type'] = 'number';
285 } elseif (preg_match('/time/i', $this->fields[$fN]['eval'])) {
286 $this->fields[$fN]['type'] = 'time';
287 } elseif (preg_match('/date/i', $this->fields[$fN]['eval'])) {
288 $this->fields[$fN]['type'] = 'date';
289 } else {
290 $this->fields[$fN]['type'] = 'text';
291 }
292 break;
293 case 'check':
294 if (!$this->fields[$fN]['items']) {
295 $this->fields[$fN]['type'] = 'boolean';
296 } else {
297 $this->fields[$fN]['type'] = 'binary';
298 }
299 break;
300 case 'radio':
301 $this->fields[$fN]['type'] = 'multiple';
302 break;
303 case 'select':
304 $this->fields[$fN]['type'] = 'multiple';
305 if ($this->fields[$fN]['foreign_table']) {
306 $this->fields[$fN]['type'] = 'relation';
307 }
308 if ($this->fields[$fN]['special']) {
309 $this->fields[$fN]['type'] = 'text';
310 }
311 break;
312 case 'group':
313 $this->fields[$fN]['type'] = 'files';
314 if ($this->fields[$fN]['internal_type'] == 'db') {
315 $this->fields[$fN]['type'] = 'relation';
316 }
317 break;
318 case 'user':
319 case 'flex':
320 case 'passthrough':
321 case 'none':
322 case 'text':
323 default:
324 $this->fields[$fN]['type'] = 'text';
325 break;
326 }
327
328 } else {
329 $this->fields[$fN]['label'] = '[FIELD: ' . $fN . ']';
330 switch ($fN) {
331 case 'pid':
332 $this->fields[$fN]['type'] = 'relation';
333 $this->fields[$fN]['allowed'] = 'pages';
334 break;
335 case 'cruser_id':
336 $this->fields[$fN]['type'] = 'relation';
337 $this->fields[$fN]['allowed'] = 'be_users';
338 break;
339 case 'tstamp':
340 case 'crdate':
341 $this->fields[$fN]['type'] = 'time';
342 break;
343 case 'deleted':
344 $this->fields[$fN]['type'] = 'boolean';
345 break;
346 default:
347 $this->fields[$fN]['type'] = 'number';
348 break;
349 }
350 }
351 }
352 }
353
354 /* // EXAMPLE:
355 $this->queryConfig = array(
356 array(
357 'operator' => 'AND',
358 'type' => 'FIELD_spaceBefore',
359 ),
360 array(
361 'operator' => 'AND',
362 'type' => 'FIELD_records',
363 'negate' => 1,
364 'inputValue' => 'foo foo'
365 ),
366 array(
367 'type' => 'newlevel',
368 'nl' => array(
369 array(
370 'operator' => 'AND',
371 'type' => 'FIELD_spaceBefore',
372 'negate' => 1,
373 'inputValue' => 'foo foo'
374 ),
375 array(
376 'operator' => 'AND',
377 'type' => 'FIELD_records',
378 'negate' => 1,
379 'inputValue' => 'foo foo'
380 )
381 )
382 ),
383 array(
384 'operator' => 'OR',
385 'type' => 'FIELD_maillist',
386 )
387 );
388 */
389 $this->initUserDef();
390 }
391
392 /**
393 * [Describe function...]
394 *
395 * @param [type] $name: ...
396 * @param [type] $list: ...
397 * @param [type] $force: ...
398 * @return [type] ...
399 */
400 function setAndCleanUpExternalLists($name, $list, $force = '') {
401 $fields = array_unique(t3lib_div::trimExplode(',', $list . ',' . $force, 1));
402 $reList = array();
403 foreach ($fields as $fN) {
404 if ($this->fields[$fN]) {
405 $reList[] = $fN;
406 }
407 }
408 $this->extFieldLists[$name] = implode(',', $reList);
409 }
410
411 /**
412 * [Describe function...]
413 *
414 * @param [type] $qC: ...
415 * @return [type] ...
416 */
417 function procesData($qC = '') {
418 $this->queryConfig = $qC;
419
420 $POST = t3lib_div::_POST();
421
422 // if delete...
423 if ($POST['qG_del']) {
424 //initialize array to work on, save special parameters
425 $ssArr = $this->getSubscript($POST['qG_del']);
426 $workArr =& $this->queryConfig;
427 for ($i = 0; $i < sizeof($ssArr) - 1; $i++) {
428 $workArr =& $workArr[$ssArr[$i]];
429 }
430 // delete the entry and move the other entries
431 unset($workArr[$ssArr[$i]]);
432 for ($j = $ssArr[$i]; $j < sizeof($workArr); $j++) {
433 $workArr[$j] = $workArr[$j + 1];
434 unset($workArr[$j + 1]);
435 }
436 }
437
438 // if insert...
439 if ($POST['qG_ins']) {
440 //initialize array to work on, save special parameters
441 $ssArr = $this->getSubscript($POST['qG_ins']);
442 $workArr =& $this->queryConfig;
443 for ($i = 0; $i < sizeof($ssArr) - 1; $i++) {
444 $workArr =& $workArr[$ssArr[$i]];
445 }
446 // move all entries above position where new entry is to be inserted
447 for ($j = sizeof($workArr); $j > $ssArr[$i]; $j--) {
448 $workArr[$j] = $workArr[$j - 1];
449 }
450 //clear new entry position
451 unset($workArr[$ssArr[$i] + 1]);
452 $workArr[$ssArr[$i] + 1]['type'] = 'FIELD_';
453 }
454
455 // if move up...
456 if ($POST['qG_up']) {
457 //initialize array to work on
458 $ssArr = $this->getSubscript($POST['qG_up']);
459 $workArr =& $this->queryConfig;
460 for ($i = 0; $i < sizeof($ssArr) - 1; $i++) {
461 $workArr =& $workArr[$ssArr[$i]];
462 }
463 //swap entries
464 $qG_tmp = $workArr[$ssArr[$i]];
465 $workArr[$ssArr[$i]] = $workArr[$ssArr[$i] - 1];
466 $workArr[$ssArr[$i] - 1] = $qG_tmp;
467 }
468
469 // if new level...
470 if ($POST['qG_nl']) {
471 //initialize array to work on
472 $ssArr = $this->getSubscript($POST['qG_nl']);
473 $workArr =& $this->queryConfig;
474 for ($i = 0; $i < sizeof($ssArr) - 1; $i++) {
475 $workArr =& $workArr[$ssArr[$i]];
476 }
477 // Do stuff:
478 $tempEl = $workArr[$ssArr[$i]];
479 if (is_array($tempEl)) {
480 if ($tempEl['type'] != 'newlevel') {
481 $workArr[$ssArr[$i]] = array(
482 'type' => 'newlevel',
483 'operator' => $tempEl['operator'],
484 'nl' => array($tempEl)
485 );
486 }
487 }
488 }
489
490 // if collapse level...
491 if ($POST['qG_remnl']) {
492 //initialize array to work on
493 $ssArr = $this->getSubscript($POST['qG_remnl']);
494 $workArr =& $this->queryConfig;
495 for ($i = 0; $i < sizeof($ssArr) - 1; $i++) {
496 $workArr =& $workArr[$ssArr[$i]];
497 }
498
499 // Do stuff:
500 $tempEl = $workArr[$ssArr[$i]];
501 if (is_array($tempEl)) {
502 if ($tempEl['type'] == 'newlevel') {
503 $a1 = array_slice($workArr, 0, $ssArr[$i]);
504 $a2 = array_slice($workArr, $ssArr[$i]);
505 array_shift($a2);
506 $a3 = $tempEl['nl'];
507 $a3[0]['operator'] = $tempEl['operator'];
508 $workArr = array_merge($a1, $a3, $a2);
509 }
510 }
511 }
512 }
513
514 /**
515 * [Describe function...]
516 *
517 * @param [type] $queryConfig: ...
518 * @return [type] ...
519 */
520 function cleanUpQueryConfig($queryConfig) {
521 //since we dont traverse the array using numeric keys in the upcoming whileloop make sure it's fresh and clean before displaying
522 if (is_array($queryConfig)) {
523 ksort($queryConfig);
524 } else {
525 //queryConfig should never be empty!
526 if (!$queryConfig[0] || !$queryConfig[0]['type']) {
527 $queryConfig[0] = array('type' => 'FIELD_');
528 }
529 }
530 // Traverse:
531 $c = 0;
532 $arrCount = 0;
533 foreach ($queryConfig as $key => $conf) {
534 if (substr($conf['type'], 0, 6) == 'FIELD_') {
535 $fName = substr($conf['type'], 6);
536 $fType = $this->fields[$fName]['type'];
537 } elseif ($conf['type'] == 'newlevel') {
538 $fType = $conf['type'];
539 } else {
540 $fType = 'ignore';
541 }
542 // debug($fType);
543 switch ($fType) {
544 case 'newlevel':
545 if (!$queryConfig[$key]['nl']) {
546 $queryConfig[$key]['nl'][0]['type'] = 'FIELD_';
547 }
548 $queryConfig[$key]['nl'] = $this->cleanUpQueryConfig($queryConfig[$key]['nl']);
549 break;
550 case 'userdef':
551 $queryConfig[$key] = $this->userDefCleanUp($queryConfig[$key]);
552 break;
553 case 'ignore':
554 default:
555 // debug($queryConfig[$key]);
556 $verifiedName = $this->verifyType($fName);
557 $queryConfig[$key]['type'] = 'FIELD_' . $this->verifyType($verifiedName);
558
559 if ($conf['comparison'] >> 5 != $this->comp_offsets[$fType]) {
560 $conf['comparison'] = $this->comp_offsets[$fType] << 5;
561 }
562 $queryConfig[$key]['comparison'] = $this->verifyComparison($conf['comparison'], $conf['negate'] ? 1 : 0);
563
564 $queryConfig[$key]['inputValue'] = $this->cleanInputVal($queryConfig[$key]);
565 $queryConfig[$key]['inputValue1'] = $this->cleanInputVal($queryConfig[$key], 1);
566
567 // debug($queryConfig[$key]);
568 break;
569 }
570 }
571 return $queryConfig;
572 }
573
574 /**
575 * [Describe function...]
576 *
577 * @param [type] $subLevel: ...
578 * @param [type] $queryConfig: ...
579 * @param [type] $parent: ...
580 * @return [type] ...
581 */
582 function getFormElements($subLevel = 0, $queryConfig = '', $parent = '') {
583 $codeArr = array();
584 if (!is_array($queryConfig)) {
585 $queryConfig = $this->queryConfig;
586 }
587
588 $c = 0;
589 $arrCount = 0;
590 $loopcount = 0;
591 foreach ($queryConfig as $key => $conf) {
592 $subscript = $parent . '[' . $key . ']';
593 $lineHTML = '';
594 $lineHTML .= $this->mkOperatorSelect($this->name . $subscript, $conf['operator'], $c, ($conf['type'] != 'FIELD_'));
595 if (substr($conf['type'], 0, 6) == 'FIELD_') {
596 $fName = substr($conf['type'], 6);
597 $this->fieldName = $fName;
598 $fType = $this->fields[$fName]['type'];
599 if ($conf['comparison'] >> 5 != $this->comp_offsets[$fType]) {
600 $conf['comparison'] = $this->comp_offsets[$fType] << 5;
601 }
602
603 //nasty nasty...
604 //make sure queryConfig contains _actual_ comparevalue.
605 //mkCompSelect don't care, but getQuery does.
606 $queryConfig[$key]['comparison'] += (isset($conf['negate']) - ($conf['comparison'] % 2));
607
608 } elseif ($conf['type'] == 'newlevel') {
609 $fType = $conf['type'];
610 } else {
611 $fType = 'ignore';
612 }
613 switch ($fType) {
614 case 'ignore':
615 break;
616 case 'newlevel':
617 if (!$queryConfig[$key]['nl']) {
618 $queryConfig[$key]['nl'][0]['type'] = 'FIELD_';
619 }
620 $lineHTML .= '<input type="hidden" name="' . $this->name . $subscript . '[type]" value="newlevel">';
621 $codeArr[$arrCount]['sub'] = $this->getFormElements($subLevel + 1, $queryConfig[$key]['nl'], $subscript . '[nl]');
622 break;
623 case 'userdef':
624 $lineHTML .= $this->userDef($this->name . $subscript, $conf, $fName, $fType);
625 break;
626 case 'date':
627 $lineHTML .= $this->mkTypeSelect($this->name . $subscript . '[type]', $fName);
628 $lineHTML .= $this->mkCompSelect($this->name . $subscript . '[comparison]', $conf['comparison'], $conf['negate'] ? 1 : 0);
629 $lineHTML .= '<input type="checkbox" class="checkbox"' . ($conf['negate'] ? ' checked' : '') . ' name="' . $this->name . $subscript . '[negate]' . '" onClick="submit();">';
630
631 if ($conf['comparison'] == 100 || $conf['comparison'] == 101) { // between
632 $lineHTML .= '<input type="text" name="' . $this->name . $subscript . '[inputValue]_hr' . '" value="' . strftime('%e-%m-%Y', $conf['inputValue']) . '" ' . $GLOBALS['TBE_TEMPLATE']->formWidth(10) . ' onChange="typo3form.fieldGet(\'' . $this->name . $subscript . '[inputValue]\', \'date\', \'\', 0,0);"><input type="hidden" value="' . htmlspecialchars($conf['inputValue']) . '" name="' . $this->name . $subscript . '[inputValue]' . '">';
633 $lineHTML .= '<input type="text" name="' . $this->name . $subscript . '[inputValue1]_hr' . '" value="' . strftime('%e-%m-%Y', $conf['inputValue1']) . '" ' . $GLOBALS['TBE_TEMPLATE']->formWidth(10) . ' onChange="typo3form.fieldGet(\'' . $this->name . $subscript . '[inputValue1]\', \'date\', \'\', 0,0);"><input type="hidden" value="' . htmlspecialchars($conf['inputValue1']) . '" name="' . $this->name . $subscript . '[inputValue1]' . '">';
634 $this->extJSCODE .= 'typo3form.fieldSet("' . $this->name . $subscript . '[inputValue]", "date", "", 0,0);';
635 $this->extJSCODE .= 'typo3form.fieldSet("' . $this->name . $subscript . '[inputValue1]", "date", "", 0,0);';
636 } else {
637 $lineHTML .= '<input type="text" name="' . $this->name . $subscript . '[inputValue]_hr' . '" value="' . strftime('%e-%m-%Y', $conf['inputValue']) . '" ' . $GLOBALS['TBE_TEMPLATE']->formWidth(10) . ' onChange="typo3form.fieldGet(\'' . $this->name . $subscript . '[inputValue]\', \'date\', \'\', 0,0);"><input type="hidden" value="' . htmlspecialchars($conf['inputValue']) . '" name="' . $this->name . $subscript . '[inputValue]' . '">';
638 $this->extJSCODE .= 'typo3form.fieldSet("' . $this->name . $subscript . '[inputValue]", "date", "", 0,0);';
639 }
640 break;
641 case 'time':
642 $lineHTML .= $this->mkTypeSelect($this->name . $subscript . '[type]', $fName);
643 $lineHTML .= $this->mkCompSelect($this->name . $subscript . '[comparison]', $conf['comparison'], $conf['negate'] ? 1 : 0);
644
645 $lineHTML .= '<input type="checkbox" class="checkbox"' . ($conf['negate'] ? ' checked' : '') . ' name="' . $this->name . $subscript . '[negate]' . '" onClick="submit();">';
646 if ($conf['comparison'] == 100 || $conf['comparison'] == 101) { // between:
647 $lineHTML .= '<input type="text" name="' . $this->name . $subscript . '[inputValue]_hr' . '" value="' . strftime('%H:%M %e-%m-%Y', $conf['inputValue']) . '" ' . $GLOBALS['TBE_TEMPLATE']->formWidth(10) . ' onChange="typo3form.fieldGet(\'' . $this->name . $subscript . '[inputValue]\', \'datetime\', \'\', 0,0);"><input type="hidden" value="' . htmlspecialchars($conf['inputValue']) . '" name="' . $this->name . $subscript . '[inputValue]' . '">';
648 $lineHTML .= '<input type="text" name="' . $this->name . $subscript . '[inputValue1]_hr' . '" value="' . strftime('%H:%M %e-%m-%Y', $conf['inputValue1']) . '" ' . $GLOBALS['TBE_TEMPLATE']->formWidth(10) . ' onChange="typo3form.fieldGet(\'' . $this->name . $subscript . '[inputValue1]\', \'datetime\', \'\', 0,0);"><input type="hidden" value="' . htmlspecialchars($conf['inputValue1']) . '" name="' . $this->name . $subscript . '[inputValue1]' . '">';
649 $this->extJSCODE .= 'typo3form.fieldSet("' . $this->name . $subscript . '[inputValue]", "datetime", "", 0,0);';
650 $this->extJSCODE .= 'typo3form.fieldSet("' . $this->name . $subscript . '[inputValue1]", "datetime", "", 0,0);';
651 } else {
652 $lineHTML .= '<input type="text" name="' . $this->name . $subscript . '[inputValue]_hr' . '" value="' . strftime('%H:%M %e-%m-%Y', intval($conf['inputValue'])) . '" ' . $GLOBALS['TBE_TEMPLATE']->formWidth(10) . ' onChange="typo3form.fieldGet(\'' . $this->name . $subscript . '[inputValue]\', \'datetime\', \'\', 0,0);"><input type="hidden" value="' . htmlspecialchars($conf['inputValue']) . '" name="' . $this->name . $subscript . '[inputValue]' . '">';
653 $this->extJSCODE .= 'typo3form.fieldSet("' . $this->name . $subscript . '[inputValue]", "datetime", "", 0,0);';
654 }
655 break;
656 case 'multiple':
657 case 'binary':
658 case 'relation':
659 $lineHTML .= $this->mkTypeSelect($this->name . $subscript . '[type]', $fName);
660 $lineHTML .= $this->mkCompSelect($this->name . $subscript . '[comparison]', $conf['comparison'], $conf['negate'] ? 1 : 0);
661 $lineHTML .= '<input type="checkbox" class="checkbox"' . ($conf['negate'] ? ' checked' : '') . ' name="' . $this->name . $subscript . '[negate]' . '" onClick="submit();">';
662 if ($conf['comparison'] == 68 || $conf['comparison'] == 69 || $conf['comparison'] == 162 || $conf['comparison'] == 163) {
663 $lineHTML .= '<select name="' . $this->name . $subscript . '[inputValue]' . '[]" style="vertical-align:top;" size="5" multiple>';
664 } elseif ($conf['comparison'] == 66 || $conf['comparison'] == 67) {
665 if (is_array($conf['inputValue'])) {
666 $conf['inputValue'] = implode(',', $conf['inputValue']);
667 }
668 $lineHTML .= '<input type="text" value="' . htmlspecialchars($conf['inputValue']) . '" name="' . $this->name . $subscript . '[inputValue]' . '"' . $GLOBALS['TBE_TEMPLATE']->formWidth(10) . '>';
669 } else {
670 $lineHTML .= '<select name="' . $this->name . $subscript . '[inputValue]' . '" style="vertical-align:top;" onChange="submit();">';
671 }
672 if ($conf['comparison'] != 66 && $conf['comparison'] != 67) {
673 $lineHTML .= $this->makeOptionList($fName, $conf, $this->table);
674 $lineHTML .= '</select>';
675 }
676 break;
677 case 'files':
678 $lineHTML .= $this->mkTypeSelect($this->name . $subscript . '[type]', $fName);
679 $lineHTML .= $this->mkCompSelect($this->name . $subscript . '[comparison]', $conf['comparison'], $conf['negate'] ? 1 : 0);
680 $lineHTML .= '<input type="checkbox" class="checkbox"' . ($conf['negate'] ? ' checked' : '') . ' name="' . $this->name . $subscript . '[negate]' . '" onClick="submit();">';
681 if ($conf['comparison'] == 68 || $conf['comparison'] == 69) {
682 $lineHTML .= '<select name="' . $this->name . $subscript . '[inputValue]' . '[]" style="vertical-align:top;" size="5" multiple>';
683 } else {
684 $lineHTML .= '<select name="' . $this->name . $subscript . '[inputValue]' . '" style="vertical-align:top;" onChange="submit();">';
685 }
686 $lineHTML .= '<option value=""></option>' . $this->makeOptionList($fName, $conf, $this->table);
687 $lineHTML .= '</select>';
688 if ($conf['comparison'] == 66 || $conf['comparison'] == 67) {
689 $lineHTML .= ' + <input type="text" value="' . htmlspecialchars($conf['inputValue1']) . '" name="' . $this->name . $subscript . '[inputValue1]' . '"' . $GLOBALS['TBE_TEMPLATE']->formWidth(10) . '>';
690 }
691 break;
692 case 'boolean':
693 $lineHTML .= $this->mkTypeSelect($this->name . $subscript . '[type]', $fName);
694 $lineHTML .= $this->mkCompSelect($this->name . $subscript . '[comparison]', $conf['comparison'], $conf['negate'] ? 1 : 0);
695 $lineHTML .= '<input type="checkbox" class="checkbox"' . ($conf['negate'] ? ' checked' : '') . ' name="' . $this->name . $subscript . '[negate]' . '" onClick="submit();">';
696 $lineHTML .= '<input type="hidden" value="1" name="' . $this->name . $subscript . '[inputValue]' . '"' . $GLOBALS['TBE_TEMPLATE']->formWidth(10) . '>';
697 break;
698 default:
699 $lineHTML .= $this->mkTypeSelect($this->name . $subscript . '[type]', $fName);
700 $lineHTML .= $this->mkCompSelect($this->name . $subscript . '[comparison]', $conf['comparison'], $conf['negate'] ? 1 : 0);
701 $lineHTML .= '<input type="checkbox" class="checkbox"' . ($conf['negate'] ? ' checked' : '') . ' name="' . $this->name . $subscript . '[negate]' . '" onClick="submit();">';
702 if ($conf['comparison'] == 37 || $conf['comparison'] == 36) { // between:
703 $lineHTML .= '<input type="text" value="' . htmlspecialchars($conf['inputValue']) . '" name="' . $this->name . $subscript . '[inputValue]' . '"' . $GLOBALS['TBE_TEMPLATE']->formWidth(5) . '>
704 <input type="text" value="' . htmlspecialchars($conf['inputValue1']) . '" name="' . $this->name . $subscript . '[inputValue1]' . '"' . $GLOBALS['TBE_TEMPLATE']->formWidth(5) . '>'; // onChange='submit();'
705 } else {
706 $lineHTML .= '<input type="text" value="' . htmlspecialchars($conf['inputValue']) . '" name="' . $this->name . $subscript . '[inputValue]' . '"' . $GLOBALS['TBE_TEMPLATE']->formWidth(10) . '>'; // onChange="submit();"
707 }
708 break;
709 }
710 if ($fType != 'ignore') {
711 $lineHTML .= $this->updateIcon();
712 if ($loopcount) {
713 $lineHTML .= '<input type="image" border="0" ' . t3lib_iconWorks::skinImg($GLOBALS['BACK_PATH'], 'gfx/garbage.gif', 'width="11" height="12"') . 'title="Remove condition" name="qG_del' . $subscript . '">';
714 }
715 $lineHTML .= '<input type="image" border="0" ' . t3lib_iconWorks::skinImg($GLOBALS['BACK_PATH'], 'gfx/add.gif', 'width="12" height="12"') . ' title="Add condition" name="qG_ins' . $subscript . '">';
716 if ($c != 0) {
717 $lineHTML .= '<input type="image" border="0" ' . t3lib_iconWorks::skinImg($GLOBALS['BACK_PATH'], 'gfx/pil2up.gif', 'width="12" height="7"') . ' title="Move up" name="qG_up' . $subscript . '">';
718 }
719
720 if ($c != 0 && $fType != 'newlevel') {
721 $lineHTML .= '<input type="image" border="0" ' . t3lib_iconWorks::skinImg($GLOBALS['BACK_PATH'], 'gfx/pil2right.gif', 'height="12" width="7"') . ' title="New level" name="qG_nl' . $subscript . '">';
722 }
723 if ($fType == 'newlevel') {
724 $lineHTML .= '<input type="image" border="0" ' . t3lib_iconWorks::skinImg($GLOBALS['BACK_PATH'], 'gfx/pil2left.gif', 'height="12" width="7"') . ' title="Collapse new level" name="qG_remnl' . $subscript . '">';
725 }
726
727 $codeArr[$arrCount]['html'] = $lineHTML;
728 $codeArr[$arrCount]['query'] = $this->getQuerySingle($conf, $c > 0 ? 0 : 1);
729 $arrCount++;
730 $c++;
731 }
732 $loopcount = 1;
733 }
734 $this->queryConfig = $queryConfig;
735
736 return $codeArr;
737 }
738
739 /**
740 * [Describe function...]
741 *
742 * @param [type] $codeArr: ...
743 * @param [type] $l: ...
744 * @param [type] $table: ...
745 * @return [type] ...
746 */
747 function makeOptionList($fN, $conf, $table) {
748 $out = '';
749 $fieldSetup = $this->fields[$fN];
750 if ($fieldSetup['type'] == 'files') {
751 if ($conf['comparison'] == 66 || $conf['comparison'] == 67) {
752 $fileExtArray = explode(',', $fieldSetup['allowed']);
753 natcasesort($fileExtArray);
754 foreach ($fileExtArray as $fileExt) {
755 if (t3lib_div::inList($conf['inputValue'], $fileExt)) {
756 $out .= '<option value="' . $fileExt . '" selected>.' . $fileExt . '</option>';
757 } else {
758 $out .= '<option value="' . $fileExt . '">.' . $fileExt . '</option>';
759 }
760 }
761 }
762 $d = dir(PATH_site . $fieldSetup['uploadfolder']);
763 while (FALSE !== ($entry = $d->read())) {
764 if ($entry == '.' || $entry == '..') {
765 continue;
766 }
767 $fileArray[] = $entry;
768 }
769 $d->close();
770 natcasesort($fileArray);
771 foreach ($fileArray as $fileName) {
772 if (t3lib_div::inList($conf['inputValue'], $fileName)) {
773 $out .= '<option value="' . $fileName . '" selected>' . $fileName . '</option>';
774 } else {
775 $out .= '<option value="' . $fileName . '">' . $fileName . '</option>';
776 }
777 }
778 }
779 if ($fieldSetup['type'] == 'multiple') {
780 foreach ($fieldSetup['items'] as $key => $val) {
781 if (substr($val[0], 0, 4) == 'LLL:') {
782 $value = $GLOBALS['LANG']->sL($val[0]);
783 } else {
784 $value = $val[0];
785 }
786 if (t3lib_div::inList($conf['inputValue'], $val[1])) {
787 $out .= '<option value="' . $val[1] . '" selected>' . $value . '</option>';
788 } else {
789 $out .= '<option value="' . $val[1] . '">' . $value . '</option>';
790 }
791 }
792 }
793 if ($fieldSetup['type'] == 'binary') {
794 foreach ($fieldSetup['items'] as $key => $val) {
795 if (substr($val[0], 0, 4) == 'LLL:') {
796 $value = $GLOBALS['LANG']->sL($val[0]);
797 } else {
798 $value = $val[0];
799 }
800 if (t3lib_div::inList($conf['inputValue'], pow(2, $key))) {
801 $out .= '<option value="' . pow(2, $key) . '" selected>' . $value . '</option>';
802 } else {
803 $out .= '<option value="' . pow(2, $key) . '">' . $value . '</option>';
804 }
805 }
806 }
807 if ($fieldSetup['type'] == 'relation') {
808 if ($fieldSetup['items']) {
809 foreach ($fieldSetup['items'] as $key => $val) {
810 if (substr($val[0], 0, 4) == 'LLL:') {
811 $value = $GLOBALS['LANG']->sL($val[0]);
812 } else {
813 $value = $val[0];
814 }
815 if (t3lib_div::inList($conf['inputValue'], $val[1])) {
816 $out .= '<option value="' . $val[1] . '" selected>' . $value . '</option>';
817 } else {
818 $out .= '<option value="' . $val[1] . '">' . $value . '</option>';
819 }
820 }
821 }
822 if (stristr($fieldSetup['allowed'], ',')) {
823 $from_table_Arr = explode(',', $fieldSetup['allowed']);
824 $useTablePrefix = 1;
825 if (!$fieldSetup['prepend_tname']) {
826 $checkres = $GLOBALS['TYPO3_DB']->exec_SELECTquery($fN, $table, t3lib_BEfunc::deleteClause($table), $groupBy = '', $orderBy = '', $limit = '');
827 if ($checkres) {
828 while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($checkres)) {
829 if (stristr($row[$fN], ',')) {
830 $checkContent = explode(',', $row[$fN]);
831 foreach ($checkContent as $singleValue) {
832 if (!stristr($singleValue, '_')) {
833 $dontPrefixFirstTable = 1;
834 }
835 }
836 } else {
837 $singleValue = $row[$fN];
838 if (strlen($singleValue) && !stristr($singleValue, '_')) {
839 $dontPrefixFirstTable = 1;
840 }
841 }
842 }
843 }
844 }
845 } else {
846 $from_table_Arr[0] = $fieldSetup['allowed'];
847 }
848 if ($fieldSetup['prepend_tname']) {
849 $useTablePrefix = 1;
850 }
851 if ($fieldSetup['foreign_table']) {
852 $from_table_Arr[0] = $fieldSetup['foreign_table'];
853 }
854 $counter = 0;
855 $webMountPageTree = '';
856 while (list(, $from_table) = each($from_table_Arr)) {
857 if (($useTablePrefix && !$dontPrefixFirstTable && $counter != 1) || $counter == 1) {
858 $tablePrefix = $from_table . '_';
859 }
860 $counter = 1;
861 if (is_array($GLOBALS['TCA'][$from_table])) {
862 t3lib_div::loadTCA($from_table);
863 $labelField = $GLOBALS['TCA'][$from_table]['ctrl']['label'];
864 $altLabelField = $GLOBALS['TCA'][$from_table]['ctrl']['label_alt'];
865 if ($GLOBALS['TCA'][$from_table]['columns'][$labelField]['config']['items']) {
866 foreach ($GLOBALS['TCA'][$from_table]['columns'][$labelField]['config']['items'] as $labelArray) {
867 if (substr($labelArray[0], 0, 4) == 'LLL:') {
868 $labelFieldSelect[$labelArray[1]] = $GLOBALS['LANG']->sL($labelArray[0]);
869 } else {
870 $labelFieldSelect[$labelArray[1]] = $labelArray[0];
871 }
872 }
873 $useSelectLabels = 1;
874 }
875 if ($GLOBALS['TCA'][$from_table]['columns'][$altLabelField]['config']['items']) {
876 foreach ($GLOBALS['TCA'][$from_table]['columns'][$altLabelField]['config']['items'] as $altLabelArray) {
877 if (substr($altLabelArray[0], 0, 4) == 'LLL:') {
878 $altLabelFieldSelect[$altLabelArray[1]] = $GLOBALS['LANG']->sL($altLabelArray[0]);
879 } else {
880 $altLabelFieldSelect[$altLabelArray[1]] = $altLabelArray[0];
881 }
882 }
883 $useAltSelectLabels = 1;
884 }
885 $altLabelFieldSelect = $altLabelField ? ',' . $altLabelField : '';
886 $select_fields = 'uid,' . $labelField . $altLabelFieldSelect;
887 if (!$GLOBALS['BE_USER']->isAdmin() && $GLOBALS['TYPO3_CONF_VARS']['BE']['lockBeUserToDBmounts']) {
888 $webMounts = $GLOBALS['BE_USER']->returnWebmounts();
889 $perms_clause = $GLOBALS['BE_USER']->getPagePermsClause(1);
890 foreach ($webMounts as $key => $val) {
891 if ($webMountPageTree) {
892 $webMountPageTreePrefix = ',';
893 }
894 $webMountPageTree .= $webMountPageTreePrefix . $this->getTreeList($val, 999, $begin = 0, $perms_clause);
895 }
896 if ($from_table == 'pages') {
897 $where_clause = 'uid IN (' . $webMountPageTree . ') ';
898 if (!$GLOBALS['SOBE']->MOD_SETTINGS['show_deleted']) {
899 $where_clause .= t3lib_BEfunc::deleteClause($from_table) . ' AND' . $perms_clause;
900 }
901 } else {
902 $where_clause = 'pid IN (' . $webMountPageTree . ') ';
903 if (!$GLOBALS['SOBE']->MOD_SETTINGS['show_deleted']) {
904 $where_clause .= t3lib_BEfunc::deleteClause($from_table);
905 }
906 }
907 } else {
908 $where_clause = 'uid';
909 if (!$GLOBALS['SOBE']->MOD_SETTINGS['show_deleted']) {
910 $where_clause .= t3lib_BEfunc::deleteClause($from_table);
911 }
912 }
913 $orderBy = 'uid';
914 if (!$this->tableArray[$from_table]) {
915 $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery($select_fields, $from_table, $where_clause, $groupBy = '', $orderBy, $limit = '');
916 }
917 if ($res) {
918 while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
919 $this->tableArray[$from_table][] = $row;
920 }
921 }
922 foreach ($this->tableArray[$from_table] as $key => $val) {
923 if ($useSelectLabels) {
924 $outArray[$tablePrefix . $val['uid']] = htmlspecialchars($labelFieldSelect[$val[$labelField]]);
925 } elseif ($val[$labelField]) {
926 $outArray[$tablePrefix . $val['uid']] = htmlspecialchars($val[$labelField]);
927 } elseif ($useAltSelectLabels) {
928 $outArray[$tablePrefix . $val['uid']] = htmlspecialchars($altLabelFieldSelect[$val[$altLabelField]]);
929 } else {
930 $outArray[$tablePrefix . $val['uid']] = htmlspecialchars($val[$altLabelField]);
931 }
932 }
933 if ($GLOBALS['SOBE']->MOD_SETTINGS['options_sortlabel'] && is_array($outArray)) {
934 natcasesort($outArray);
935 }
936 }
937 }
938 foreach ($outArray as $key2 => $val2) {
939 if (t3lib_div::inList($conf['inputValue'], $key2)) {
940 $out .= '<option value="' . $key2 . '" selected>[' . $key2 . '] ' . $val2 . '</option>';
941 } else {
942 $out .= '<option value="' . $key2 . '">[' . $key2 . '] ' . $val2 . '</option>';
943 }
944 }
945 }
946 return $out;
947 }
948
949
950 /**
951 * [Describe function...]
952 *
953 * @param [type] $codeArr: ...
954 * @param [type] $l: ...
955 * @return [type] ...
956 */
957 function printCodeArray($codeArr, $l = 0) {
958 $line = '';
959 if ($l) {
960 $indent = '<td style="vertical-align:top;"><img height="1" width="50"></td>';
961 }
962 $lf = $l * 30;
963 $bgColor = t3lib_div::modifyHTMLColor($GLOBALS['TBE_TEMPLATE']->bgColor2, $lf, $lf, $lf);
964 foreach ($codeArr as $k => $v) {
965 $line .= '<tr>' . $indent . '<td bgcolor="' . $bgColor . '"' . $this->noWrap . '>' . $v['html'] . '</td></tr>';
966 if ($this->enableQueryParts) {
967 $line .= '<tr>' . $indent . '<td>' . $this->formatQ($v['query']) . '</td></tr>';
968 }
969 if (is_array($v['sub'])) {
970 $line .= '<tr>' . $indent . '<td' . $this->noWrap . '>' . $this->printCodeArray($v['sub'], $l + 1) . '</td></tr>';
971 }
972 }
973 $out = '<table border="0" cellpadding="0" cellspacing="1">' . $line . '</table>';
974 return $out;
975 }
976
977 /**
978 * [Describe function...]
979 *
980 * @param [type] $str: ...
981 * @return [type] ...
982 */
983 function formatQ($str) {
984 return '<font size="1" face="verdana" color="maroon"><i>' . htmlspecialchars($str) . '</i></font>';
985 }
986
987 /**
988 * [Describe function...]
989 *
990 * @param [type] $name: ...
991 * @param [type] $op: ...
992 * @param [type] $draw: ...
993 * @param [type] $submit: ...
994 * @return [type] ...
995 */
996 function mkOperatorSelect($name, $op, $draw, $submit) {
997 if ($draw) {
998 $out = '<select name="' . $name . '[operator]"' . ($submit ? ' onChange="submit();"' : '') . '>'; //
999 $out .= '<option value="AND"' . (!$op || $op == "AND" ? ' selected' : '') . '>' . $this->lang["AND"] . '</option>';
1000 $out .= '<option value="OR"' . ($op == 'OR' ? ' selected' : '') . '>' . $this->lang['OR'] . '</option>';
1001 $out .= '</select>';
1002 } else {
1003 $out = '<input type="hidden" value="' . $op . '" name="' . $name . '[operator]">';
1004 $out .= '<img src="clear.gif" height="1" width="47">';
1005
1006 }
1007 return $out;
1008 }
1009
1010 /**
1011 * [Describe function...]
1012 *
1013 * @param [type] $name: ...
1014 * @param [type] $fieldName: ...
1015 * @param [type] $prepend: ...
1016 * @return [type] ...
1017 */
1018 function mkTypeSelect($name, $fieldName, $prepend = 'FIELD_') {
1019 $out = '<select name="' . $name . '" onChange="submit();">';
1020 $out .= '<option value=""></option>';
1021 foreach ($this->fields as $key => $value) {
1022 if (!$value['exclude'] || $GLOBALS['BE_USER']->check('non_exclude_fields', $this->table . ':' . $key)) {
1023 $label = $this->fields[$key]['label'];
1024 $label_alt = $this->fields[$key]['label_alt'];
1025 $out .= '<option value="' . $prepend . $key . '"' . ($key == $fieldName ? ' selected' : '') . '>' . $label . '</option>';
1026 }
1027 }
1028 $out .= '</select>';
1029 return $out;
1030 }
1031
1032 /**
1033 * [Describe function...]
1034 *
1035 * @param [type] $fieldName: ...
1036 * @return [type] ...
1037 */
1038 function verifyType($fieldName) {
1039 $first = '';
1040 foreach ($this->fields as $key => $value) {
1041 if (!$first) {
1042 $first = $key;
1043 }
1044 if ($key == $fieldName) {
1045 return $key;
1046 }
1047 }
1048 return $first;
1049 }
1050
1051 /**
1052 * [Describe function...]
1053 *
1054 * @param [type] $comparison: ...
1055 * @param [type] $neg: ...
1056 * @return [type] ...
1057 */
1058 function verifyComparison($comparison, $neg) {
1059 $compOffSet = $comparison >> 5;
1060 $first = -1;
1061 for ($i = 32 * $compOffSet + $neg; $i < 32 * ($compOffSet + 1); $i += 2) {
1062 if ($first == -1) {
1063 $first = $i;
1064 }
1065 if (($i >> 1) == ($comparison >> 1)) {
1066 return $i;
1067 }
1068 }
1069 return $first;
1070 }
1071
1072 /**
1073 * [Describe function...]
1074 *
1075 * @param [type] $name: ...
1076 * @param [type] $fieldName: ...
1077 * @return [type] ...
1078 */
1079 function mkFieldToInputSelect($name, $fieldName) {
1080 $out = '<input type="Text" value="' . htmlspecialchars($fieldName) . '" name="' . $name . '"' . $GLOBALS['TBE_TEMPLATE']->formWidth() . '>' . $this->updateIcon();
1081 $out .= '<a href="#" onClick="document.forms[0][\'' . $name . '\'].value=\'\';return false;">' . t3lib_iconWorks::getSpriteIcon('actions-edit-delete', array('title' => 'Clear list')) . '</a>';
1082 $out .= '<BR><select name="_fieldListDummy" size="5" onChange="document.forms[0][\'' . $name . '\'].value+=\',\'+this.value">';
1083 foreach ($this->fields as $key => $value) {
1084 if (!$value['exclude'] || $GLOBALS['BE_USER']->check('non_exclude_fields', $this->table . ':' . $key)) {
1085 $label = $this->fields[$key]['label'];
1086 $label_alt = $this->fields[$key]['label_alt'];
1087 $out .= '<option value="' . $key . '"' . ($key == $fieldName ? ' selected' : '') . '>' . $label . '</option>';
1088 }
1089 }
1090 $out .= '</select>';
1091 return $out;
1092 }
1093
1094 /**
1095 * [Describe function...]
1096 *
1097 * @param [type] $name: ...
1098 * @param [type] $cur: ...
1099 * @return [type] ...
1100 */
1101 function mkTableSelect($name, $cur) {
1102 $out = '<select name="' . $name . '" onChange="submit();">';
1103 $out .= '<option value=""></option>';
1104 foreach ($GLOBALS['TCA'] as $tN => $value) {
1105 if ($GLOBALS['BE_USER']->check('tables_select', $tN)) {
1106 $out .= '<option value="' . $tN . '"' . ($tN == $cur ? ' selected' : '') . '>' . $GLOBALS['LANG']->sl($GLOBALS['TCA'][$tN]['ctrl']['title']) . '</option>';
1107 }
1108 }
1109 $out .= '</select>';
1110 return $out;
1111 }
1112
1113 /**
1114 * [Describe function...]
1115 *
1116 * @param [type] $name: ...
1117 * @param [type] $comparison: ...
1118 * @param [type] $neg: ...
1119 * @return [type] ...
1120 */
1121 function mkCompSelect($name, $comparison, $neg) {
1122 $compOffSet = $comparison >> 5;
1123 $out = '<select name="' . $name . '" onChange="submit();">';
1124 for ($i = 32 * $compOffSet + $neg; $i < 32 * ($compOffSet + 1); $i += 2) {
1125 if ($this->lang['comparison'][$i . '_']) {
1126 $out .= '<option value="' . $i . '"' . (($i >> 1) == ($comparison >> 1) ? ' selected' : '') . '>' . $this->lang['comparison'][$i . '_'] . '</option>';
1127 }
1128 }
1129 $out .= '</select>';
1130 return $out;
1131 }
1132
1133 /**
1134 * [Describe function...]
1135 *
1136 * @param [type] $arr: ...
1137 * @return [type] ...
1138 */
1139 function getSubscript($arr) {
1140 while (is_array($arr)) {
1141 reset($arr);
1142 list($key,) = each($arr);
1143 $retArr[] = $key;
1144 $arr = $arr[$key];
1145 }
1146 return $retArr;
1147 }
1148
1149 /**
1150 * [Describe function...]
1151 *
1152 * @return [type] ...
1153 */
1154 function initUserDef() {
1155
1156 }
1157
1158 /**
1159 * [Describe function...]
1160 *
1161 * @return [type] ...
1162 */
1163 function userDef() {
1164 }
1165
1166 /**
1167 * [Describe function...]
1168 *
1169 * @param [type] $queryConfig: ...
1170 * @return [type] ...
1171 */
1172 function userDefCleanUp($queryConfig) {
1173 return $queryConfig;
1174 }
1175
1176 /**
1177 * [Describe function...]
1178 *
1179 * @param [type] $queryConfig: ...
1180 * @param [type] $pad: ...
1181 * @return [type] ...
1182 */
1183 function getQuery($queryConfig, $pad = '') {
1184 $qs = '';
1185 // Since we don't traverse the array using numeric keys in the upcoming whileloop make sure it's fresh and clean
1186 ksort($queryConfig);
1187 $first = 1;
1188 foreach ($queryConfig as $key => $conf) {
1189 switch ($conf['type']) {
1190 case 'newlevel':
1191 $qs .= LF . $pad . trim($conf['operator']) . ' (' . $this->getQuery($queryConfig[$key]['nl'], $pad . ' ') . LF . $pad . ')';
1192 break;
1193 case 'userdef':
1194 $qs .= LF . $pad . getUserDefQuery($conf, $first);
1195 break;
1196 default:
1197 $qs .= LF . $pad . $this->getQuerySingle($conf, $first);
1198 break;
1199 }
1200 $first = 0;
1201 }
1202 return $qs;
1203 }
1204
1205 /**
1206 * [Describe function...]
1207 *
1208 * @param [type] $conf: ...
1209 * @param [type] $first: ...
1210 * @return [type] ...
1211 */
1212 function getQuerySingle($conf, $first) {
1213 $qs = '';
1214 $prefix = $this->enablePrefix ? $this->table . '.' : '';
1215 if (!$first) {
1216 // Is it OK to insert the AND operator if none is set?
1217 $qs .= trim(($conf['operator'] ? $conf['operator'] : 'AND')) . ' ';
1218 }
1219 $qsTmp = str_replace('#FIELD#', $prefix . trim(substr($conf['type'], 6)), $this->compSQL[$conf['comparison']]);
1220 $inputVal = $this->cleanInputVal($conf);
1221 if ($conf['comparison'] == 68 || $conf['comparison'] == 69) {
1222 $inputVal = explode(',', $inputVal);
1223 foreach ($inputVal as $key => $fileName) {
1224 $inputVal[$key] = "'" . $fileName . "'";
1225 }
1226 $inputVal = implode(',', $inputVal);
1227 $qsTmp = str_replace('#VALUE#', $inputVal, $qsTmp);
1228 } elseif ($conf['comparison'] == 162 || $conf['comparison'] == 163) {
1229 $inputValArray = explode(',', $inputVal);
1230 $inputVal = 0;
1231 foreach ($inputValArray as $key => $fileName) {
1232 $inputVal += intval($fileName);
1233 }
1234 $qsTmp = str_replace('#VALUE#', $inputVal, $qsTmp);
1235 } else {
1236 $qsTmp = str_replace('#VALUE#', $GLOBALS['TYPO3_DB']->quoteStr($inputVal, $this->table), $qsTmp);
1237 }
1238 if ($conf['comparison'] == 37 || $conf['comparison'] == 36 || $conf['comparison'] == 66 || $conf['comparison'] == 67 || $conf['comparison'] == 100 || $conf['comparison'] == 101) { // between:
1239 $inputVal = $this->cleanInputVal($conf, '1');
1240 $qsTmp = str_replace('#VALUE1#', $GLOBALS['TYPO3_DB']->quoteStr($inputVal, $this->table), $qsTmp);
1241 }
1242 $qs .= trim($qsTmp);
1243 return $qs;
1244 }
1245
1246 /**
1247 * [Describe function...]
1248 *
1249 * @param [type] $conf: ...
1250 * @param [type] $suffix: ...
1251 * @return [type] ...
1252 */
1253 function cleanInputVal($conf, $suffix = '') {
1254 if (($conf['comparison'] >> 5 == 0) || ($conf['comparison'] == 32 || $conf['comparison'] == 33 || $conf['comparison'] == 64 || $conf['comparison'] == 65 || $conf['comparison'] == 66 || $conf['comparison'] == 67 || $conf['comparison'] == 96 || $conf['comparison'] == 97)) {
1255 $inputVal = $conf['inputValue' . $suffix];
1256 } elseif ($conf['comparison'] == 39 || $conf['comparison'] == 38) { // in list:
1257 $inputVal = implode(',', t3lib_div::intExplode(',', $conf['inputValue' . $suffix]));
1258 } elseif ($conf['comparison'] == 68 || $conf['comparison'] == 69 || $conf['comparison'] == 162 || $conf['comparison'] == 163) { // in list:
1259 if (is_array($conf['inputValue' . $suffix])) {
1260 $inputVal = implode(',', $conf['inputValue' . $suffix]);
1261 } elseif ($conf['inputValue' . $suffix]) {
1262 $inputVal = $conf['inputValue' . $suffix];
1263 } else {
1264 $inputVal = 0;
1265 }
1266 } else {
1267 $inputVal = doubleval($conf['inputValue' . $suffix]);
1268 }
1269 return $inputVal;
1270 }
1271
1272 /**
1273 * [Describe function...]
1274 *
1275 * @param [type] $qcArr: ...
1276 * @return [type] ...
1277 */
1278 function getUserDefQuery($qcArr) {
1279 }
1280
1281 /**
1282 * [Describe function...]
1283 *
1284 * @return [type] ...
1285 */
1286 function updateIcon() {
1287 return '<input type="image" border="0" ' . t3lib_iconWorks::skinImg($GLOBALS['BACK_PATH'], 'gfx/refresh_n.gif', 'width="14" height="14"') . ' title="Update" name="just_update">';
1288 }
1289
1290 /**
1291 * [Describe function...]
1292 *
1293 * @return [type] ...
1294 */
1295 function getLabelCol() {
1296 return $GLOBALS['TCA'][$this->table]['ctrl']['label'];
1297 }
1298
1299 /**
1300 * [Describe function...]
1301 *
1302 * @param [type] $modSettings: ...
1303 * @param [type] $enableList: ...
1304 * @return [type] ...
1305 */
1306 function makeSelectorTable($modSettings, $enableList = 'table,fields,query,group,order,limit') {
1307 $enableArr = explode(',', $enableList);
1308 // Make output
1309 $TDparams = ' class="bgColor5" nowrap';
1310
1311 if (in_array('table', $enableArr) && !$GLOBALS['BE_USER']->userTS['mod.']['dbint.']['disableSelectATable']) {
1312 $out = '
1313 <tr>
1314 <td' . $TDparams . '><strong>Select a table:</strong></td>
1315 <td' . $TDparams . '>' . $this->mkTableSelect('SET[queryTable]', $this->table) . '</td>
1316 </tr>';
1317 }
1318 if ($this->table) {
1319
1320 // Init fields:
1321 $this->setAndCleanUpExternalLists('queryFields', $modSettings['queryFields'], 'uid,' . $this->getLabelCol());
1322 $this->setAndCleanUpExternalLists('queryGroup', $modSettings['queryGroup']);
1323 $this->setAndCleanUpExternalLists('queryOrder', $modSettings['queryOrder'] . ',' . $modSettings['queryOrder2']);
1324
1325 // Limit:
1326 $this->extFieldLists['queryLimit'] = $modSettings['queryLimit'];
1327 if (!$this->extFieldLists['queryLimit']) {
1328 $this->extFieldLists['queryLimit'] = 100;
1329 }
1330 $parts = t3lib_div::intExplode(',', $this->extFieldLists['queryLimit']);
1331 if ($parts[1]) {
1332 $this->limitBegin = $parts[0];
1333 $this->limitLength = $parts[1];
1334 } else {
1335 $this->limitLength = $this->extFieldLists['queryLimit'];
1336 }
1337 $this->extFieldLists['queryLimit'] = implode(',', array_slice($parts, 0, 2));
1338
1339 // Insert Descending parts
1340 if ($this->extFieldLists['queryOrder']) {
1341 $descParts = explode(',', $modSettings['queryOrderDesc'] . ',' . $modSettings['queryOrder2Desc']);
1342 $orderParts = explode(',', $this->extFieldLists['queryOrder']);
1343 $reList = array();
1344 foreach ($orderParts as $kk => $vv) {
1345 $reList[] = $vv . ($descParts[$kk] ? ' DESC' : '');
1346 }
1347 $this->extFieldLists['queryOrder_SQL'] = implode(',', $reList);
1348 }
1349
1350 // Query Generator:
1351 $this->procesData($modSettings['queryConfig'] ? unserialize($modSettings['queryConfig']) : '');
1352 // debug($this->queryConfig);
1353 $this->queryConfig = $this->cleanUpQueryConfig($this->queryConfig);
1354 // debug($this->queryConfig);
1355 $this->enableQueryParts = $modSettings['search_query_smallparts'];
1356
1357 $codeArr = $this->getFormElements();
1358 $queryCode = $this->printCodeArray($codeArr);
1359
1360 if (in_array('fields', $enableArr) && !$GLOBALS['BE_USER']->userTS['mod.']['dbint.']['disableSelectFields']) {
1361 $out .= '
1362 <tr>
1363 <td' . $TDparams . '><strong>Select fields:</strong></td>
1364 <td' . $TDparams . '>' . $this->mkFieldToInputSelect('SET[queryFields]', $this->extFieldLists['queryFields']) . '</td>
1365 </tr>';
1366 }
1367 if (in_array('query', $enableArr) && !$GLOBALS['BE_USER']->userTS['mod.']['dbint.']['disableMakeQuery']) {
1368 $out .= '<tr>
1369 <td colspan="2"' . $TDparams . '><strong>Make Query:</strong></td>
1370 </tr>
1371 <tr>
1372 <td colspan="2">' . $queryCode . '</td>
1373 </tr>
1374 ';
1375 }
1376 if (in_array('group', $enableArr) && !$GLOBALS['BE_USER']->userTS['mod.']['dbint.']['disableGroupBy']) {
1377 $out .= '<tr>
1378 <td' . $TDparams . '><strong>Group By:</strong></td>
1379 <td' . $TDparams . '>' . $this->mkTypeSelect('SET[queryGroup]', $this->extFieldLists['queryGroup'], '') . '</td>
1380 </tr>';
1381 }
1382 if (in_array('order', $enableArr) && !$GLOBALS['BE_USER']->userTS['mod.']['dbint.']['disableOrderBy']) {
1383 $orderByArr = explode(',', $this->extFieldLists['queryOrder']);
1384 // debug($orderByArr);
1385 $orderBy = '';
1386 $orderBy .= $this->mkTypeSelect('SET[queryOrder]', $orderByArr[0], '') .
1387 '&nbsp;' . t3lib_BEfunc::getFuncCheck($GLOBALS['SOBE']->id, 'SET[queryOrderDesc]', $modSettings['queryOrderDesc'], '', '', 'id="checkQueryOrderDesc"') . '&nbsp;<label for="checkQueryOrderDesc">Descending</label>';
1388 if ($orderByArr[0]) {
1389 $orderBy .= '<BR>' . $this->mkTypeSelect('SET[queryOrder2]', $orderByArr[1], '') .
1390 '&nbsp;' . t3lib_BEfunc::getFuncCheck($GLOBALS['SOBE']->id, 'SET[queryOrder2Desc]', $modSettings['queryOrder2Desc'], '', '', 'id="checkQueryOrder2Desc"') . '&nbsp;<label for="checkQueryOrder2Desc">Descending</label>';
1391 }
1392 $out .= '<tr>
1393 <td' . $TDparams . '><strong>Order By:</strong></td>
1394 <td' . $TDparams . '>' . $orderBy . '</td>
1395 </tr>';
1396 }
1397 if (in_array('limit', $enableArr) && !$GLOBALS['BE_USER']->userTS['mod.']['dbint.']['disableLimit']) {
1398 $limit = '<input type="Text" value="' . htmlspecialchars($this->extFieldLists['queryLimit']) . '" name="SET[queryLimit]" id="queryLimit"' . $GLOBALS['TBE_TEMPLATE']->formWidth(10) . '>' . $this->updateIcon();
1399
1400 $prevLimit = ($this->limitBegin - $this->limitLength) < 0 ? 0 :
1401 $this->limitBegin - $this->limitLength;
1402 if ($this->limitBegin) {
1403 $prevButton = '<input type="button" value="previous ' . $this->limitLength . '" onclick=\'document.getElementById("queryLimit").value="' . $prevLimit . ',' . $this->limitLength . '";document.forms[0].submit();\'>';
1404 }
1405 if (!$this->limitLength) {
1406 $this->limitLength = 100;
1407 }
1408 $nextLimit = $this->limitBegin + $this->limitLength;
1409 if ($nextLimit < 0) {
1410 $nextLimit = 0;
1411 }
1412 if ($nextLimit) {
1413 $nextButton = '<input type="button" value="next ' . $this->limitLength . '" onclick=\'document.getElementById("queryLimit").value="' . $nextLimit . ',' . $this->limitLength . '";document.forms[0].submit();\'>';
1414 }
1415
1416 $numberButtons = '<input type="button" value="10" onclick=\'document.getElementById("queryLimit").value="10";document.forms[0].submit();\'>';
1417 $numberButtons .= '<input type="button" value="20" onclick=\'document.getElementById("queryLimit").value="20";document.forms[0].submit();\'>';
1418 $numberButtons .= '<input type="button" value="50" onclick=\'document.getElementById("queryLimit").value="50";document.forms[0].submit();\'>';
1419 $numberButtons .= '<input type="button" value="100" onclick=\'document.getElementById("queryLimit").value="100";document.forms[0].submit();\'>';
1420 $out .= '<tr>
1421 <td' . $TDparams . '><strong>Limit:</strong></td>
1422 <td' . $TDparams . '>' . $limit . $prevButton . $nextButton . '&nbsp;' . $numberButtons . '</td>
1423 </tr>
1424 ';
1425 }
1426 }
1427 $out = '<table border="0" cellpadding="3" cellspacing="1" class="qg-make-query">' . $out . '</table>';
1428 $out .= $this->JSbottom($this->formName);
1429 return $out;
1430 }
1431
1432 /**
1433 * [Describe function...]
1434 *
1435 * @param [type] $qString: ...
1436 * @param [type] $depth: ...
1437 * @param [type] $begin: ...
1438 * @param [type] $perms_clause: ...
1439 * @return [type] ...
1440 */
1441 function getTreeList($id, $depth, $begin = 0, $perms_clause) {
1442 $depth = intval($depth);
1443 $begin = intval($begin);
1444 $id = intval($id);
1445 if ($begin == 0) {
1446 $theList = $id;
1447 } else {
1448 $theList = '';
1449 }
1450 if ($id && $depth > 0) {
1451 $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
1452 'uid',
1453 'pages',
1454 'pid=' . $id . ' ' . t3lib_BEfunc::deleteClause('pages') . ' AND ' . $perms_clause
1455 );
1456 while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
1457 if ($begin <= 0) {
1458 $theList .= ',' . $row['uid'];
1459 }
1460 if ($depth > 1) {
1461 $theList .= $this->getTreeList($row['uid'], $depth - 1, $begin - 1, $perms_clause);
1462 }
1463 }
1464 }
1465 return $theList;
1466 }
1467
1468 /**
1469 * [Describe function...]
1470 *
1471 * @param [type] $qString: ...
1472 * @param [type] $fN: ...
1473 * @return [type] ...
1474 */
1475 function getSelectQuery($qString = '', $fN = '') {
1476 if (!$qString) {
1477 $qString = $this->getQuery($this->queryConfig);
1478 }
1479 $qString = '(' . $qString . ')';
1480 if (!$GLOBALS['BE_USER']->isAdmin() && $GLOBALS['TYPO3_CONF_VARS']['BE']['lockBeUserToDBmounts']) {
1481 $webMounts = $GLOBALS['BE_USER']->returnWebmounts();
1482 $perms_clause = $GLOBALS['BE_USER']->getPagePermsClause(1);
1483 $webMountPageTree = '';
1484 foreach ($webMounts as $key => $val) {
1485 if ($webMountPageTree) {
1486 $webMountPageTreePrefix = ',';
1487 }
1488 $webMountPageTree .= $webMountPageTreePrefix . $this->getTreeList($val, 999, $begin = 0, $perms_clause);
1489 }
1490 if ($this->table == 'pages') {
1491 $qString .= ' AND uid IN (' . $webMountPageTree . ')';
1492 } else {
1493 $qString .= ' AND pid IN (' . $webMountPageTree . ')';
1494 }
1495 }
1496 $fieldlist = $this->extFieldLists['queryFields'] .
1497 ',pid' .
1498 ($GLOBALS['TCA'][$this->table]['ctrl']['delete'] ? ',' . $GLOBALS['TCA'][$this->table]['ctrl']['delete'] : '');
1499 if (!$GLOBALS['SOBE']->MOD_SETTINGS['show_deleted']) {
1500 $qString .= t3lib_BEfunc::deleteClause($this->table);
1501 }
1502 $query = $GLOBALS['TYPO3_DB']->SELECTquery(
1503 $fieldlist,
1504 $this->table,
1505 $qString,
1506 trim($this->extFieldLists['queryGroup']),
1507 $this->extFieldLists['queryOrder'] ? trim($this->extFieldLists['queryOrder_SQL']) : '',
1508 $this->extFieldLists['queryLimit']
1509 );
1510 return $query;
1511 }
1512
1513 /**
1514 * [Describe function...]
1515 *
1516 * @param [type] $formname: ...
1517 * @return [type] ...
1518 */
1519 function JSbottom($formname) {
1520 $out = '';
1521 if ($this->extJSCODE) {
1522 $out .= '
1523 <script language="javascript" type="text/javascript" src="' . $GLOBALS['BACK_PATH'] . '../t3lib/jsfunc.evalfield.js"></script>
1524 <script language="javascript" type="text/javascript" src="' . $GLOBALS['BACK_PATH'] . 'jsfunc.tbe_editor.js"></script>
1525 <script language="javascript" type="text/javascript">
1526 TBE_EDITOR.formname = "' . $formname . '";
1527 TBE_EDITOR.formnameUENC = "' . rawurlencode($formname) . '";
1528 TBE_EDITOR.backend_interface = "' . $GLOBALS['BE_USER']->uc['interfaceSetup'] . '";
1529 ' . $this->extJSCODE . '
1530 </script>';
1531 }
1532 return $out;
1533 }
1534
1535 /**
1536 * Sets the current name of the input form.
1537 *
1538 * @param string $formName: The name of the form.
1539 * @return void
1540 */
1541 public function setFormName($formName) {
1542 $this->formName = trim($formName);
1543 }
1544 }
1545
1546
1547 if (defined('TYPO3_MODE') && isset($GLOBALS['TYPO3_CONF_VARS'][TYPO3_MODE]['XCLASS']['t3lib/class.t3lib_querygenerator.php'])) {
1548 include_once($GLOBALS['TYPO3_CONF_VARS'][TYPO3_MODE]['XCLASS']['t3lib/class.t3lib_querygenerator.php']);
1549 }
1550
1551 ?>