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