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