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