Bitrix-D7 23.9
 
Загрузка...
Поиск...
Не найдено
input.php
1<?php
2
4
12
13Loc::loadMessages(__FILE__);
14
15// TODO integrate with input.js on adding multiple item
17{
18 static function initJs()
19 {
20 static $done = false;
21
22 if (! $done)
23 {
24 $done = true;
25
26 if (Loader::includeModule('location'))
27 {
28 \Bitrix\Main\UI\Extension::load('sale.address');
29 }
30
31 \CJSCore::RegisterExt('input', array(
32 'js' => [
33 '/bitrix/js/sale/input.js'
34 ],
35 'lang' => '/bitrix/modules/sale/lang/'.LANGUAGE_ID.'/lib/internals/input.php',
36 ));
37 \CJSCore::Init(array('input'));
38
39 print('<div style="display:none">');
40 $GLOBALS['APPLICATION']->IncludeComponent("bitrix:sale.location.selector.".\Bitrix\Sale\Location\Admin\LocationHelper::getWidgetAppearance(), "", array(
41 "ID" => '',
42 "CODE" => '',
43 "INPUT_NAME" => 'SALE_LOCATION_SELECTOR_RESOURCES',
44 "PROVIDE_LINK_BY" => 'code',
45
46 "FILTER_BY_SITE" => 'Y',
47
48 "SHOW_DEFAULT_LOCATIONS" => 'Y',
49 "SEARCH_BY_PRIMARY" => 'Y',
50
51 "JS_CONTROL_GLOBAL_ID" => 'SALE_LOCATION_SELECTOR_RESOURCES',
52 //"INITIALIZE_BY_GLOBAL_EVENT" => 'sale-event-never-happen',
53 "USE_JS_SPAWN" => 'Y'
54 ),
55 false,
56 array('HIDE_ICONS' => 'Y')
57 );
58 print('</div>');
59 }
60 }
61
62 protected static $types = array();
63
70 static function getViewHtml(array $input, $value = null)
71 {
72 if (! static::$initialized)
73 static::initialize();
74
75 if ($type = static::$types[$input['TYPE']])
76 return call_user_func(array($type['CLASS'], __FUNCTION__), $input, $value);
77 else
78 throw new SystemException('invalid input type in '.print_r($input, true), 0, __FILE__, __LINE__);
79 }
80
88 static function getEditHtml($name, array $input, $value = null)
89 {
90 if (! static::$initialized)
91 static::initialize();
92
93 if ($type = static::$types[$input['TYPE']])
94 return call_user_func(array($type['CLASS'], __FUNCTION__), $name, $input, $value);
95 else
96 throw new SystemException('invalid input type in '.print_r($input, true), 0, __FILE__, __LINE__);
97 }
98
106 static function getFilterEditHtml($name, array $input, $value = null)
107 {
108 if (! static::$initialized)
109 static::initialize();
110
111 if ($type = static::$types[$input['TYPE']])
112 return call_user_func(array($type['CLASS'], __FUNCTION__), $name, $input, $value);
113 else
114 throw new SystemException('invalid input type in '.print_r($input, true), 0, __FILE__, __LINE__);
115 }
116
123 static function getError(array $input, $value)
124 {
125 if (! static::$initialized)
126 static::initialize();
127
128 if ($type = static::$types[$input['TYPE']])
129 return call_user_func(array($type['CLASS'], __FUNCTION__), $input, $value);
130 else
131 throw new SystemException('invalid input type in '.print_r($input, true), 0, __FILE__, __LINE__);
132 }
133
141 static function getRequiredError(array $input, $value)
142 {
143 if (! static::$initialized)
144 static::initialize();
145
146 if ($type = static::$types[$input['TYPE']])
147 {
148 return call_user_func(array($type['CLASS'], __FUNCTION__), $input, $value);
149 }
150 else
151 {
152 throw new SystemException('invalid input type in '.print_r($input, true), 0, __FILE__, __LINE__);
153 }
154 }
155
163 static function getValue(array $input, $value)
164 {
165 if (! static::$initialized)
166 static::initialize();
167
168 if ($type = static::$types[$input['TYPE']])
169 return call_user_func(array($type['CLASS'], __FUNCTION__), $input, $value);
170 else
171 throw new SystemException('invalid input type in '.print_r($input, true), 0, __FILE__, __LINE__);
172 }
173
180 static function asMultiple(array $input, $value)
181 {
182 if (! static::$initialized)
183 static::initialize();
184
185 if ($type = static::$types[$input['TYPE']])
186 return call_user_func(array($type['CLASS'], __FUNCTION__), $value);
187 else
188 throw new SystemException('invalid input type in '.print_r($input, true), 0, __FILE__, __LINE__);
189 }
190
197 static function getSettings(array $input, $reload = null)
198 {
199 if (! static::$initialized)
200 static::initialize();
201
202 if ($type = static::$types[$input['TYPE']])
203 return call_user_func(array($type['CLASS'], __FUNCTION__), $input, $reload);
204 else
205 throw new SystemException('invalid input type in '.print_r($input, true), 0, __FILE__, __LINE__);
206 }
207
213 static function getCommonSettings(array $input, $reload = null)
214 {
215 if (! static::$initialized)
216 static::initialize();
217
218 $typeOptions = array();
219
220 foreach (static::$types as $k => $v)
221 {
222 if (in_array($k, ['PRODUCT_CATEGORIES', 'CONCRETE_PRODUCT']))
223 {
224 continue;
225 }
226
227 $typeOptions[$k] = $v['NAME']." [$k]";
228 }
229
230 $hasMultipleSupport = true;
231 if (isset(static::$types[$input['TYPE']]))
232 {
234 $typeClass = static::$types[$input['TYPE']]['CLASS'];
235
236 if (!$typeClass::hasMultipleValuesSupport())
237 {
238 $hasMultipleSupport = false;
239 }
240 }
241
242 $multiple = array('TYPE' => 'Y/N' , 'LABEL' => Loc::getMessage('INPUT_MULTIPLE'));
243
244 if (!$hasMultipleSupport)
245 {
246 $multiple['DISABLED_YN'] = 'N';
247 }
248 else
249 {
250 $multiple['ONCLICK'] = $reload;
251 }
252
253 $result = [
254 'TYPE' => array('TYPE' => 'ENUM', 'LABEL' => Loc::getMessage('INPUT_TYPE'), 'OPTIONS' => $typeOptions, 'REQUIRED' => 'Y', 'ONCHANGE' => $reload),
255 'REQUIRED' => array('TYPE' => 'Y/N' , 'LABEL' => Loc::getMessage('INPUT_REQUIRED')),
256 'MULTIPLE' => $multiple,
257 'VALUE' => array('LABEL' => Loc::getMessage('INPUT_VALUE'), 'REQUIRED' => 'N') + $input,
258 ];
259
260 return $result;
261 }
262
266 static function getTypes()
267 {
268 if (! static::$initialized)
269 static::initialize();
270
271 return static::$types;
272 }
273
282 static function register($name, array $type)
283 {
284 if (isset(static::$types[$name]))
285 {
286 throw new SystemException('duplicate type '.$name, 0, __FILE__, __LINE__);
287 }
288
289 if (! class_exists($type['CLASS']))
290 {
291 throw new SystemException('undefined CLASS in '.print_r($type, true), 0, __FILE__, __LINE__);
292 }
293
294 if (! is_subclass_of($type['CLASS'], __NAMESPACE__.'\Base'))
295 {
296 throw new SystemException($type['CLASS'].' does not implement Input\Base', 0, __FILE__, __LINE__);
297 }
298
299 static::$types[$name] = $type;
300 }
301
302 protected static $initialized;
303
304 protected static function initialize()
305 {
306 static::$initialized = true;
307
309 $event = new Event('sale', 'registerInputTypes', static::$types);
310 $event->send();
311
312 if ($event->getResults())
313 {
314 foreach($event->getResults() as $eventResult)
315 {
316 if ($eventResult->getType() != EventResult::SUCCESS)
317 continue;
318
319 if ($params = $eventResult->getParameters())
320 {
321 if(!empty($params) && is_array($params))
322 {
323 static::$types = array_merge(static::$types, $params);
324 }
325 }
326 }
327 }
328 }
329}
330
331abstract class Base
332{
333 const MULTITAG = 'div';
334
339 static function isMultiple($value)
340 {
341 return is_array($value);
342 }
343
348 static function asSingle($value)
349 {
350 if (static::isMultiple($value))
351 {
352 $v = null;
353
354 foreach ($value as $v)
355 if ($v) // !== null) TODO maybe??
356 break;
357
358 return $v;
359 }
360 else
361 {
362 return $value;
363 }
364 }
365
366 static function asMultiple($value)
367 {
368 if (static::isMultiple($value))
369 {
370 return array_diff($value, array("", NULL, false));
371 }
372 else
373 {
374 return $value === null ? array() : array($value);
375 }
376 }
377
378 public static function getViewHtml(array $input, $value = null)
379 {
380 if ($value === null && isset($input['VALUE']))
381 {
382 $value = $input['VALUE'];
383 }
384
385 if (isset($input['MULTIPLE']) && $input['MULTIPLE'] === 'Y')
386 {
387 $tag = isset($input['MULTITAG']) ? htmlspecialcharsbx($input['MULTITAG']) : static::MULTITAG;
388 [$startTag, $endTag] = $tag ? array("<$tag>", "</$tag>") : array('', '');
389
390 $html = '';
391
392 foreach (static::asMultiple($value) as $value)
393 $html .= $startTag.static::getViewHtmlSingle($input, $value).$endTag;
394
395 return $html;
396 }
397 else
398 {
399 return static::getViewHtmlSingle($input, static::asSingle($value));
400 }
401 }
402
403 public static function getViewHtmlSingle(array $input, $value)
404 {
405 $output = $valueText = htmlspecialcharsbx($value);
406 if (isset($input['IS_EMAIL']) && $input['IS_EMAIL'] === 'Y')
407 {
408 $output = '<a href="mailto:'.$valueText.'">'.$valueText.'</a>';
409 }
410
411 return $output;
412 }
413
414 public static function getEditHtml($name, array $input, $value = null)
415 {
416 $name = htmlspecialcharsbx($name);
417
418 $input['DISABLED'] ??= 'N';
419
420 if ($value === null && isset($input['VALUE']))
421 {
422 $value = $input['VALUE'];
423 }
424
425 $html = '';
426
427 if (isset($input['HIDDEN']) && ($input['HIDDEN'] === 'Y' || $input['HIDDEN'] === true))
428 {
429 $html .= static::getHiddenRecursive($name
430 , (isset($input['MULTIPLE']) && $input['MULTIPLE'] === 'Y') ? static::asMultiple($value) : static::asSingle($value)
431 , static::extractAttributes($input, array('DISABLED'=>''), array('FORM'=>''), false));
432 }
433 else
434 {
435 if (isset($input['MULTIPLE']) && $input['MULTIPLE'] === 'Y')
436 {
437 $tag = isset($input['MULTITAG']) ? htmlspecialcharsbx($input['MULTITAG']) : static::MULTITAG;
438 [$startTag, $endTag] = $tag ? array("<$tag>", "</$tag>") : array('', '');
439
440 $index = -1;
441
442 foreach (static::asMultiple($value) as $value)
443 {
444 $namix = $name.'['.(++$index).']';
445 $html .= $startTag
446 .static::getEditHtmlSingle($namix, $input, $value)
447 .static::getEditHtmlSingleDelete($namix, $input)
448 .$endTag;
449 }
450
451 $replace = '##INPUT##NAME##';
452
453 if ($input['DISABLED'] !== 'Y') // TODO
454 $html .= static::getEditHtmlInsert($tag, $replace, $name
455 , static::getEditHtmlSingle($replace, $input, null).static::getEditHtmlSingleDelete($replace, $input)
456 , static::getEditHtmlSingleAfterInsert());
457 }
458 else
459 {
460 $html .= static::getEditHtmlSingle($name, $input, static::asSingle($value));
461 }
462 }
463
464 if (isset($input['ADDITIONAL_HIDDEN']) && $input['ADDITIONAL_HIDDEN'] === 'Y')
465 {
466 $html .= static::getHiddenRecursive($name
467 , (isset($input['MULTIPLE']) && $input['MULTIPLE'] === 'Y') ? static::asMultiple($value) : static::asSingle($value)
468 , static::extractAttributes($input, array(), array('FORM'=>''), false));
469 }
470
471 return $html;
472 }
473
475 public static function getEditHtmlSingle($name, array $input, $value)
476 {
477 throw new SystemException("you must implement [getEditHtmlSingle] or override [getEditHtml] in yor class", 0, __FILE__, __LINE__);
478 }
479
480 public static function getEditHtmlSingleDelete($name, array $input)
481 {
482 return '<label> '.Loc::getMessage('INPUT_DELETE').' <input type="checkbox" onclick="'
483
484 ."this.parentNode.previousSibling.disabled = this.checked;"
485
486 .'"> </label>';
487 }
488
489 public static function getEditHtmlInsert($tag, $replace, $name, $sample, $after)
490 {
491 $name = \CUtil::JSEscape($name);
492 $sample = \CUtil::JSEscape(htmlspecialcharsbx($sample));
493
494 return '<input type="button" value="'.Loc::getMessage('INPUT_ADD').'" onclick="'
495
496 ."var parent = this.parentNode;"
497 ."var container = document.createElement('$tag');"
498 ."container.innerHTML = '$sample'.replace(/$replace/g, '{$name}['+parent.childNodes.length+']');"
499 ."parent.insertBefore(container, this);"
500
501 .$after.'">';
502 }
503
504 public static function getEditHtmlSingleAfterInsert()
505 {
506 return "container.firstChild.focus();";
507 }
508
509 public static function getError(array $input, $value)
510 {
511 $errors = array();
512 if ($value === null && isset($input['VALUE']))
513 {
514 $value = $input['VALUE'];
515 }
516
517 if (isset($input['MULTIPLE']) && $input['MULTIPLE'] === 'Y')
518 {
519
520 $index = -1;
521
522 foreach (static::asMultiple($value) as $value)
523 {
524 if (($value !== '' && $value !== null) && ($error = static::getErrorSingle($input, $value)))
525 {
526 $errors[++$index] = $error;
527 }
528 }
529 }
530 else
531 {
532 $value = static::asSingle($value);
533
534 if ($value !== '' && $value !== null)
535 {
536 return static::getErrorSingle($input, $value);
537 }
538 }
539
540 return $errors;
541 }
542
549 public static function getRequiredError(array $input, $value)
550 {
551 $errors = [];
552
553 $input['REQUIRED'] ??= 'N';
554 $input['MULTIPLE'] ??= 'N';
555
556 if ($value === null && isset($input['VALUE']))
557 {
558 $value = $input['VALUE'];
559 }
560
561 $requireError = [
562 'REQUIRED' => Loc::getMessage('INPUT_REQUIRED_ERROR'),
563 ];
564
565 if ($input['MULTIPLE'] === 'Y')
566 {
567 if ($input['REQUIRED'] === 'Y')
568 {
569 foreach (static::asMultiple($value) as $value)
570 {
571 if ($value === '' || $value === null)
572 {
573 $errors = $requireError;
574 break;
575 }
576 }
577 }
578 }
579 else
580 {
581 $value = static::asSingle($value);
582
583 if ($value === '' || $value === null)
584 {
585 if ($input['REQUIRED'] === 'Y')
586 {
587 $errors = $requireError;
588 }
589 }
590 }
591
592 return $errors;
593 }
594
601 public static function getErrorSingle(array $input, $value)
602 {
603 throw new SystemException("you must implement [getErrorSingle] or override [getError] in yor class", 0, __FILE__, __LINE__);
604 }
605
606 public static function getValue(array $input, $value)
607 {
608 if (isset($input['DISABLED']) && $input['DISABLED'] === 'Y')
609 {
610 return null; // TODO maybe??
611 }
612
613 if ($value === null)
614 {
615 $value = $input['VALUE'] ?? null;
616 }
617
618 if (isset($input['MULTIPLE']) && $input['MULTIPLE'] === 'Y')
619 {
620 $values = array();
621
622 foreach (static::asMultiple($value) as $value)
623 {
624 $value = static::getValueSingle($input, $value);
625 if ($value !== null)
626 $values []= $value;
627 }
628
629 return $values ? $values : null;
630 }
631 else
632 {
633 return static::getValueSingle($input, static::asSingle($value));
634 }
635 }
636
637 public static function getValueSingle(array $input, $value)
638 {
639 return $value;
640 }
641
642 public static function getSettings(array $input, $reload)
643 {
644 return array(); // no settings
645 }
646
647 // utils
648
649 protected static function getHiddenRecursive($name, $value, $attributes)
650 {
651 if (is_array($value))
652 {
653 $html = '';
654
655 foreach ($value as $k => $v)
656 $html .= self::getHiddenRecursive($name.'['.htmlspecialcharsbx($k).']', $v, $attributes);
657
658 return $html;
659 }
660 else
661 {
662 return '<input type="hidden" name="'.$name.'" value="'.htmlspecialcharsbx($value).'"'.$attributes.'>';
663 }
664 }
665
667 protected static function extractAttributes(array $input, array $boolean, array $other, $withGlobal = true)
668 {
669 $string = '';
670
671 // add boolean attributes with predefined values or no value
672
673 unset($boolean['REQUIRED']); // TODO remove with HTML5
674
675 static $globalBoolean = array('CONTENTEDITABLE'=>'', 'DRAGGABLE'=>'true', 'SPELLCHECK'=>'', 'TRANSLATE'=>'yes');
676
677 if ($withGlobal)
678 $boolean = $globalBoolean + $boolean;
679
680 foreach (array_intersect_key($input, $boolean) as $k => $v)
681 if ($v === 'Y' || $v === true)
682 $string .= ' '.mb_strtolower($k).($boolean[$k] ? '="'.$boolean[$k].'"' : '');
683
684 // add event attributes with values
685 if ($withGlobal)
686 {
687 static $globalEvents = array(
688 'ONABORT'=>1, 'ONBLUR'=>1, 'ONCANPLAY'=>1, 'ONCANPLAYTHROUGH'=>1, 'ONCHANGE'=>1, 'ONCLICK'=>1,
689 'ONCONTEXTMENU'=>1, 'ONDBLCLICK'=>1, 'ONDRAG'=>1, 'ONDRAGEND'=>1, 'ONDRAGENTER'=>1, 'ONDRAGLEAVE'=>1,
690 'ONDRAGOVER'=>1, 'ONDRAGSTART'=>1, 'ONDROP'=>1, 'ONDURATIONCHANGE'=>1, 'ONEMPTIED'=>1, 'ONENDED'=>1,
691 'ONERROR'=>1, 'ONFOCUS'=>1, 'ONINPUT'=>1, 'ONINVALID'=>1, 'ONKEYDOWN'=>1, 'ONKEYPRESS'=>1, 'ONKEYUP'=>1,
692 'ONLOAD'=>1, 'ONLOADEDDATA'=>1, 'ONLOADEDMETADATA'=>1, 'ONLOADSTART'=>1, 'ONMOUSEDOWN'=>1, 'ONMOUSEMOVE'=>1,
693 'ONMOUSEOUT'=>1, 'ONMOUSEOVER'=>1, 'ONMOUSEUP'=>1, 'ONMOUSEWHEEL'=>1, 'ONPAUSE'=>1, 'ONPLAY'=>1,
694 'ONPLAYING'=>1, 'ONPROGRESS'=>1, 'ONRATECHANGE'=>1, 'ONREADYSTATECHANGE'=>1, 'ONRESET'=>1, 'ONSCROLL'=>1,
695 'ONSEEKED'=>1, 'ONSEEKING'=>1, 'ONSELECT'=>1, 'ONSHOW'=>1, 'ONSTALLED'=>1, 'ONSUBMIT'=>1, 'ONSUSPEND'=>1,
696 'ONTIMEUPDATE'=>1, 'ONVOLUMECHANGE'=>1, 'ONWAITING'=>1,
697 );
698
699 $events = array_intersect_key($input, $globalEvents);
700 $other = array_diff_key($other, $events);
701
702 foreach ($events as $k => $v)
703 if ($v)
704 $string .= ' '.mb_strtolower($k).'="'.$v.'"';
705 }
706
707 // add other attributes with values
708
709 static $globalOther = array(
710 'ACCESSKEY'=>1, 'CLASS'=>1, 'CONTEXTMENU'=>1, 'DIR'=>1, 'DROPZONE'=>1, 'LANG'=>1, 'STYLE'=>1, 'TABINDEX'=>1,
711 'TITLE'=>1, 'ID' => 1,
712 'XML:LANG'=>1, 'XML:SPACE'=>1, 'XML:BASE'=>1
713 );
714
715 if ($withGlobal)
716 $other += $globalOther;
717
718 foreach (array_intersect_key($input, $other) as $k => $v)
719 if ($v)
720 $string .= ' '.mb_strtolower($k).'="'.htmlspecialcharsbx($v).'"';
721
722 // add data attributes
723 if ($withGlobal && isset($input['DATA']) && is_array($input['DATA']))
724 {
725 foreach ($input['DATA'] as $k => $v)
726 {
727 $string .= ' data-'.htmlspecialcharsbx($k).'="'.htmlspecialcharsbx($v).'"';
728 }
729 }
730
731 return $string;
732 }
733
737 public static function hasMultipleValuesSupport()
738 {
739 return true;
740 }
741}
742
746class StringInput extends Base // String reserved in php 7
747{
748 protected static $patternDelimiters = array('/', '#', '~');
749
750 public static function getEditHtmlSingle($name, array $input, $value)
751 {
752 $input = self::prepareIntFields($input);
753 if (isset($input['MULTILINE']) && $input['MULTILINE'] === 'Y')
754 {
755 $attributes = static::extractAttributes($input,
756 array('DISABLED'=>'', 'READONLY'=>'', 'AUTOFOCUS'=>'', 'REQUIRED'=>''),
757 array('FORM'=>1, 'MAXLENGTH'=>1, 'PLACEHOLDER'=>1, 'DIRNAME'=>1, 'ROWS'=>1, 'COLS'=>1, 'WRAP'=>1));
758
759 return '<textarea name="'.$name.'"'.$attributes.'>'.htmlspecialcharsbx($value).'</textarea>';
760 }
761 else
762 {
763 $attributes = static::extractAttributes($input,
764 array('DISABLED'=>'', 'READONLY'=>'', 'AUTOFOCUS'=>'', 'REQUIRED'=>'', 'AUTOCOMPLETE'=>'on'),
765 array('FORM'=>1, 'MAXLENGTH'=>1, 'PLACEHOLDER'=>1, 'DIRNAME'=>1, 'SIZE'=>1, 'LIST'=>1));
766
767 return '<input type="text" name="'.$name.'" value="'.htmlspecialcharsbx($value).'"'.$attributes.'>';
768 }
769 }
770
771 private static function prepareIntFields(array $input): array
772 {
773 $intFields = ['SIZE', 'ROWS', 'COLS'];
774 foreach ($intFields as $field)
775 {
776 $input[$field] = (int)($input[$field] ?? 0);
777 if ($input[$field] <= 0)
778 {
779 unset($input[$field]);
780 }
781 }
782
783 return $input;
784 }
785
792 public static function getFilterEditHtml($name, array $input, $value)
793 {
794 return static::getEditHtmlSingle($name, $input, $value);
795 }
796
797 public static function getErrorSingle(array $input, $value)
798 {
799 $errors = array();
800
801 $value = trim($value);
802
803 $minLength = isset($input['MINLENGTH']) && is_numeric($input['MINLENGTH']) ? (int)$input['MINLENGTH'] : 0;
804 if ($minLength > 0 && mb_strlen($value) < $minLength)
805 {
806 $errors['MINLENGTH'] = Loc::getMessage('INPUT_STRING_MINLENGTH_ERROR', ['#NUM#' => $minLength]);
807 }
808
809 $maxLength = isset($input['MAXLENGTH']) && is_numeric($input['MAXLENGTH']) ? (int)$input['MAXLENGTH'] : 0;
810 if ($maxLength > 0 && mb_strlen($value) > $maxLength)
811 {
812 $errors['MAXLENGTH'] = Loc::getMessage('INPUT_STRING_MAXLENGTH_ERROR', ['#NUM#' => $maxLength]);
813 }
814
815 $pattern = trim(
816 (string)($input['PATTERN'] ?? '')
817 );
818 if ($pattern !== "")
819 {
820 $issetDelimiter = false;
821
822 if (isset($pattern[0]) && in_array($pattern[0], static::$patternDelimiters) && mb_strrpos($pattern, $pattern[0]) !== false)
823 {
824 $issetDelimiter = true;
825 }
826
827 $matchPattern = $pattern;
828 if (!$issetDelimiter)
829 {
830 $matchPattern = "/".$pattern."/";
831 }
832
833 $pregMatchResult = null;
834 try
835 {
836 $pregMatchResult = preg_match($matchPattern, $value);
837 }
838 catch (\Exception $e)
839 {
840 }
841 finally
842 {
843 if (!$pregMatchResult)
844 {
845 $errors['PATTERN'] = Loc::getMessage('INPUT_STRING_PATTERN_ERROR');
846 }
847 }
848 }
849
850 return $errors;
851 }
852
853 static function getSettings(array $input, $reload)
854 {
855 $settings = array(
856 'MINLENGTH' => array('TYPE' => 'NUMBER', 'LABEL' => Loc::getMessage('INPUT_STRING_MINLENGTH'), 'MIN' => 0, 'STEP' => 1),
857 'MAXLENGTH' => array('TYPE' => 'NUMBER', 'LABEL' => Loc::getMessage('INPUT_STRING_MAXLENGTH'), 'MIN' => 0, 'STEP' => 1),
858 'PATTERN' => array('TYPE' => 'STRING', 'LABEL' => Loc::getMessage('INPUT_STRING_PATTERN' )),
859 'MULTILINE' => array('TYPE' => 'Y/N' , 'LABEL' => Loc::getMessage('INPUT_STRING_MULTILINE'), 'ONCLICK' => $reload),
860 );
861
862 if (isset($input['MULTILINE']) && $input['MULTILINE'] === 'Y')
863 {
864 $settings['COLS'] = array('TYPE' => 'NUMBER', 'LABEL' => Loc::getMessage('INPUT_STRING_SIZE'), 'MIN' => 0, 'STEP' => 1);
865 $settings['ROWS'] = array('TYPE' => 'NUMBER', 'LABEL' => Loc::getMessage('INPUT_STRING_ROWS'), 'MIN' => 0, 'STEP' => 1);
866 }
867 else
868 {
869 $settings['SIZE'] = array('TYPE' => 'NUMBER', 'LABEL' => Loc::getMessage('INPUT_STRING_SIZE'), 'MIN' => 0, 'STEP' => 1);
870 }
871
872 return $settings;
873 }
874
880 public static function isDeletedSingle($value)
881 {
882 return is_array($value) && isset($value['DELETE']);
883 }
884
885}
886
887Manager::register('STRING', array(
888 'CLASS' => __NAMESPACE__.'\StringInput',
889 'NAME' => Loc::getMessage('INPUT_STRING'),
890));
891
895class Number extends Base
896{
897 public static function getEditHtmlSingle($name, array $input, $value)
898 {
899 // TODO HTML5 from IE10: remove SIZE; Add MIN, MAX, STEP; Change type="number"
900
901 $size = 5;
902
903 $s = mb_strlen(
904 (string)($input['MIN'] ?? '')
905 );
906 if ($s > $size)
907 {
908 $size = $s;
909 }
910
911 $s = mb_strlen(
912 (string)($input['MAX'] ?? '')
913 );
914 if ($s > $size)
915 {
916 $size = $s;
917 }
918
919 $s = mb_strlen(
920 (string)($input['STEP'] ?? '')
921 );
922 if ($s > $size)
923 {
924 $size = $s;
925 }
926
927 $input['SIZE'] = $size;
928
929 $attributes = static::extractAttributes($input,
930 array('DISABLED'=>'', 'READONLY'=>'', 'AUTOFOCUS'=>'', 'REQUIRED'=>'', 'AUTOCOMPLETE'=>'on'),
931 array('FORM'=>1, 'LIST'=>1, 'PLACEHOLDER'=>1, 'SIZE'=>1));
932
933 return '<input type="text" name="'.$name.'" value="'.htmlspecialcharsbx($value).'"'.$attributes.'>';
934 }
935
942 public static function getFilterEditHtml($name, array $input, $value)
943 {
944 return static::getEditHtmlSingle($name, $input, $value);
945 }
946
947 public static function getErrorSingle(array $input, $value)
948 {
949 $errors = array();
950
951 if (is_numeric($value))
952 {
953 $value = (double) $value;
954
955 if (!empty($input['MIN']) && $value < $input['MIN'])
956 $errors['MIN'] = Loc::getMessage('INPUT_NUMBER_MIN_ERROR', array("#NUM#" => $input['MIN']));
957
958 if (!empty($input['MAX']) && $value > $input['MAX'])
959 $errors['MAX'] = Loc::getMessage('INPUT_NUMBER_MAX_ERROR', array("#NUM#" => $input['MAX']));
960
961 if (!empty($input['STEP']))
962 {
963 $step = (double) $input['STEP'];
964
965 $value = (double) abs($value - ($input['MIN'] ? $input['MIN'] : 0.0));
966
967 if (! ($value / pow(2.0, 53) > $step))
968 {
969 $remainder = (double) abs($value - $step * round($value / $step));
970 $acceptableError = (double) ($step / pow(2.0, 24));
971
972 if ($acceptableError < $remainder && ($step - $acceptableError) > $remainder)
973 $errors['STEP'] = Loc::getMessage('INPUT_NUMBER_STEP_ERROR', array("#NUM#" => $input['STEP']));
974 }
975 }
976 }
977 else
978 {
979 $errors['NUMERIC'] = Loc::getMessage('INPUT_NUMBER_NUMERIC_ERROR');
980 }
981
982 return $errors;
983 }
984
985 public static function getSettings(array $input, $reload)
986 {
987 return array(
988 'MIN' => array('TYPE' => 'NUMBER', 'LABEL' => Loc::getMessage('INPUT_NUMBER_MIN' )),
989 'MAX' => array('TYPE' => 'NUMBER', 'LABEL' => Loc::getMessage('INPUT_NUMBER_MAX' )),
990 'STEP' => array('TYPE' => 'NUMBER', 'LABEL' => Loc::getMessage('INPUT_NUMBER_STEP')),
991 );
992 }
993}
994
995Manager::register('NUMBER', array(
996 'CLASS' => __NAMESPACE__.'\Number',
997 'NAME' => Loc::getMessage('INPUT_NUMBER'),
998));
999
1003class EitherYN extends Base
1004{
1005 public static function getViewHtmlSingle(array $input, $value)
1006 {
1007 return $value == 'Y' ? Loc::getMessage('INPUT_EITHERYN_Y') : Loc::getMessage('INPUT_EITHERYN_N');
1008 }
1009
1010 public static function getEditHtmlSingle($name, array $input, $value)
1011 {
1012 $hiddenAttributes = static::extractAttributes($input, array('DISABLED'=>''), array('FORM'=>1), false);
1013 $checkboxAttributes = static::extractAttributes($input, array('DISABLED'=>'', 'AUTOFOCUS'=>'', 'REQUIRED'=>''), array('FORM'=>1));
1014
1015 if (isset($input['DISABLED_YN']))
1016 {
1017 return '<input type="hidden" name="'.$name.'" value="' . (($input['DISABLED_YN'] == 'Y') ? 'Y' : 'N') . '">'
1018 .'<input type="checkbox" '.($input['DISABLED_YN'] == 'Y' ? ' checked' : '').'disabled'.'>';
1019 }
1020 else
1021 {
1022 return '<input type="hidden" name="'.$name.'" value="N"'.$hiddenAttributes.'>'
1023 .'<input type="checkbox" name="'.$name.'" value="Y"'.($value == 'Y' ? ' checked' : '').$checkboxAttributes.'>';
1024 }
1025
1026 }
1027
1034 public static function getFilterEditHtml($name, array $input, $value)
1035 {
1036 $hiddenAttributes = static::extractAttributes($input, array('DISABLED'=>''), array('FORM'=>1), false);
1037
1038 $checkboxAttributes = static::extractAttributes($input, array('DISABLED'=>'', 'AUTOFOCUS'=>'', 'REQUIRED'=>''), array('FORM'=>1));
1039
1040 return '<select name="'.$name.'" '.$hiddenAttributes.'>
1041 <option value="">'.Loc::getMessage('INPUT_EITHERYN_ALL').'</option>
1042 <option value="Y"'.($value=="Y" ? " selected" : '').' '.$checkboxAttributes.'>'.Loc::getMessage('INPUT_EITHERYN_Y').'</option>
1043 <option value="N"'.($value=="N" ? " selected" : '').' '.$checkboxAttributes.'>'.Loc::getMessage('INPUT_EITHERYN_N').'</option>
1044 </select>';
1045 }
1046
1047 public static function getErrorSingle(array $input, $value)
1048 {
1049 $input['REQUIRED'] ??= 'N';
1050 if (
1051 $input['REQUIRED'] === 'Y'
1052 && ($value === '' || $value === null)
1053 )
1054 {
1055 return [
1056 'REQUIRED' => Loc::getMessage('INPUT_REQUIRED_ERROR'),
1057 ];
1058 }
1059
1060 return
1061 ($value === 'N' || $value === 'Y')
1062 ? []
1063 : ['INVALID' => Loc::getMessage('INPUT_INVALID_ERROR')]
1064 ;
1065 }
1066
1067 public static function getValueSingle(array $input, $value)
1068 {
1069 return $value == 'Y' ? 'Y' : 'N';
1070 }
1071
1072 public static function getRequiredError(array $input, $value)
1073 {
1074 $errors = parent::getRequiredError($input, $value);
1075 $input['REQUIRED'] ??= 'N';
1076 if (!$errors)
1077 {
1078 if (
1079 $value === 'N'
1080 && $input['REQUIRED'] === 'Y'
1081 )
1082 {
1083 $errors = ['REQUIRED' => Loc::getMessage('INPUT_REQUIRED_ERROR')];
1084 }
1085 }
1086 return $errors;
1087 }
1088}
1089
1090Manager::register('Y/N', array(
1091 'CLASS' => __NAMESPACE__.'\EitherYN',
1092 'NAME' => Loc::getMessage('INPUT_EITHERYN'),
1093));
1094
1098class Enum extends Base
1099{
1100 private static function flatten(array $array)
1101 {
1102 $result = array();
1103
1104 foreach ($array as $key => $value)
1105 {
1106 if (is_array($value))
1107 {
1108 $result = $result + $value;
1109 }
1110 else
1111 {
1112 $result[$key] = $value;
1113 }
1114 }
1115
1116 return $result;
1117 }
1118
1119 public static function getViewHtmlSingle(array $input, $value) // TODO optimize to getViewHtml
1120 {
1121 $options = $input['OPTIONS'] ?? [];
1122
1123 if (is_array($options))
1124 {
1125 $options = self::flatten($options);
1126
1127 if (isset($options[$value]))
1128 {
1129 $value = $options[$value];
1130 }
1131 }
1132
1133 return htmlspecialcharsbx($value);
1134 }
1135
1142 public static function getFilterEditHtml($name, array $input, $value)
1143 {
1144 return static::getEditHtml($name, $input, $value);
1145 }
1146
1147 public static function getEditHtml($name, array $input, $value = null)
1148 {
1149 $options = $input['OPTIONS'];
1150
1151 if (! is_array($options))
1152 return Loc::getMessage('INPUT_ENUM_OPTIONS_ERROR');
1153
1154 $multiple = isset($input['MULTIPLE']) && $input['MULTIPLE'] === 'Y';
1155
1156 $name = htmlspecialcharsbx($name);
1157
1158 if ($value === null && isset($input['VALUE']))
1159 {
1160 $value = $input['VALUE'];
1161 }
1162
1163 $originalValue = $value;
1164 $html = '';
1165
1166 if (isset($input['HIDDEN']) && ($input['HIDDEN'] === 'Y' || $input['HIDDEN'] === true))
1167 {
1168 $html .= static::getHiddenRecursive($name
1169 , $multiple ? static::asMultiple($value) : static::asSingle($value)
1170 , static::extractAttributes($input, array('DISABLED'=>''), array('FORM'=>1), false));
1171 }
1172 else
1173 {
1174 if ($value === null)
1175 $value = array();
1176 else
1177 $value = $multiple ? array_flip(static::asMultiple($value)) : array(static::asSingle($value) => true);
1178
1179 if (isset($input['MULTIELEMENT']) && $input['MULTIELEMENT'] === 'Y')
1180 {
1181 $tag = isset($input['MULTITAG']) ? htmlspecialcharsbx($input['MULTITAG']) : static::MULTITAG;
1182 [$startTag, $endTag] = $tag ? array("<$tag>", "</$tag>") : array('', '');
1183
1184 $attributes = static::extractAttributes($input, array('DISABLED'=>''), array('FORM'=>1), false);
1185
1186 $type = 'radio';
1187
1188 if ($multiple)
1189 {
1190 $type = 'checkbox';
1191 $name .= '[]';
1192 }
1193
1194 $html .= self::getEditOptionsHtml($options, $value, ' checked',
1195 '<fieldset><legend>{GROUP}</legend>{OPTIONS}</fieldset>',
1196 $startTag.'<label><input type="'.$type.'" name="'.$name.'" value="{VALUE}"{SELECTED}'.$attributes.'> {TEXT} </label>'.$endTag
1197 );
1198 }
1199 else // select
1200 {
1201 $attributes = static::extractAttributes($input, array('DISABLED'=>'', 'AUTOFOCUS'=>'', 'REQUIRED'=>''), array('FORM'=>1, 'SIZE'=>1));
1202
1203 $html .= '<select'.$attributes.' name="'.$name.($multiple ? '[]" multiple>' : '">');
1204
1205 $html .= self::getEditOptionsHtml($options, $value, ' selected',
1206 '<optgroup label="{GROUP}">{OPTIONS}</optgroup>',
1207 '<option value="{VALUE}"{SELECTED}>{TEXT}</option>'
1208 );
1209
1210 $html .= '</select>';
1211 }
1212 }
1213
1214 if (isset($input['ADDITIONAL_HIDDEN']) && $input['ADDITIONAL_HIDDEN'] === 'Y')
1215 {
1216 $html .= static::getHiddenRecursive($name
1217 , $multiple ? static::asMultiple($originalValue) : static::asSingle($originalValue)
1218 , static::extractAttributes($input, array(), array('FORM'=>1), false));
1219 }
1220
1221 return $html;
1222 }
1223
1224 private static function getEditOptionsHtml(array $options, array $selected, $selector, $group, $option)
1225 {
1226 $result = '';
1227
1228 foreach ($options as $key => $value)
1229 {
1230 $result .= is_array($value)
1231 ? str_replace(
1232 array('{GROUP}', '{OPTIONS}'),
1233 array(
1234 htmlspecialcharsEx($key),
1235 self::getEditOptionsHtml($value, $selected, $selector, $group, $option),
1236 ),
1237 $group
1238 )
1239 : str_replace(
1240 array('{VALUE}', '{SELECTED}', '{TEXT}'),
1241 array(
1242 htmlspecialcharsEx($key),
1243 isset($selected[$key]) ? $selector : '',
1244 htmlspecialcharsEx($value) ?: htmlspecialcharsEx($key),
1245 ),
1246 $option
1247 );
1248 }
1249
1250 return $result;
1251 }
1252
1253 public static function getErrorSingle(array $input, $value) // TODO optimize to getError
1254 {
1255 $options = $input['OPTIONS'];
1256
1257 if (is_array($options))
1258 {
1259 $options = self::flatten($options);
1260
1261 return isset($options[$value])
1262 ? array()
1263 : array('INVALID' => Loc::getMessage('INPUT_INVALID_ERROR'));
1264 }
1265 else
1266 {
1267 return array('OPTIONS' => Loc::getMessage('INPUT_ENUM_OPTIONS_ERROR'));
1268 }
1269 }
1270
1271 static function getSettings(array $input, $reload)
1272 {
1273 $settings = array(
1274 // TODO maybe??? 'OPTIONS' => array('TYPE' => 'TUPLE'),
1275 'MULTIELEMENT' => array('TYPE' => 'Y/N', 'LABEL' => Loc::getMessage('INPUT_ENUM_MULTIELEMENT'), 'ONCLICK' => $reload),
1276 );
1277
1278 if ($input['MULTIELEMENT'] != 'Y')
1279 $settings['SIZE'] = array('TYPE' => 'NUMBER', 'LABEL' => Loc::getMessage('INPUT_ENUM_SIZE'), 'MIN' => 0, 'STEP' => 1);
1280
1281 return $settings;
1282 }
1283}
1284
1285Manager::register('ENUM', array(
1286 'CLASS' => __NAMESPACE__.'\Enum',
1287 'NAME' => Loc::getMessage('INPUT_ENUM'),
1288));
1289
1294class File extends Base
1295{
1332 static function getPostWithFiles(array $post, array $files)
1333 {
1334 foreach ($files as $key => $file)
1335 {
1336 if (!isset($post[$key]) || !is_array($post[$key]))
1337 {
1338 $post[$key] = [];
1339 }
1340
1341 foreach ($file as $property => $value)
1342 {
1343 if (is_array($value))
1344 {
1345 self::getPostWithFilesRecursive($post[$key], $value, $property);
1346 }
1347 else
1348 {
1349 $post[$key][$property] = $value;
1350 }
1351 }
1352 }
1353
1354 return $post;
1355 }
1356
1357 private static function getPostWithFilesRecursive(array &$root, array $values, $property)
1358 {
1359 foreach ($values as $key => $value)
1360 {
1361 if (! is_array($root[$key]))
1362 $root[$key] = array();
1363
1364 if (is_array($value))
1365 self::getPostWithFilesRecursive($root[$key], $value, $property);
1366 else
1367 $root[$key][$property] = $value;
1368 }
1369 }
1370
1376 static function loadInfo($value)
1377 {
1378 if (! $multiple = static::isMultiple($value))
1379 $value = array($value);
1380
1381 foreach ($value as &$file)
1382 $file = self::loadInfoSingle($file);
1383
1384 return $multiple ? $value : reset($value);
1385 }
1386
1388 static function loadInfoSingle($file)
1389 {
1390 if (is_array($file))
1391 {
1392 if (isset($file['SRC']) && $file['SRC'])
1393 {
1394 return $file; // already loaded
1395 }
1396
1397
1398 $fileId = $file['ID'] ?? null;
1399 }
1400 else
1401 {
1402 $fileId = $file;
1403 }
1404
1405 if ($fileId && is_numeric($fileId) && ($row = \CFile::GetFileArray($fileId)))
1406 {
1407 $file = (is_array($file) ? $file : array('ID' => $fileId)) + $row;
1408 }
1409
1410 return $file;
1411 }
1412
1417 static function isDeletedSingle($value)
1418 {
1419 return is_array($value) && isset($value['DELETE']);
1420 }
1421
1426 static function isUploadedSingle($value)
1427 {
1428 return
1429 is_array($value)
1430 && isset($value['error'])
1431 && $value['error'] == UPLOAD_ERR_OK
1432 && isset($value['tmp_name'])
1433 && is_uploaded_file($value['tmp_name'])
1434 ;
1435 }
1436
1437 // input methods ///////////////////////////////////////////////////////////////////////////////////////////////////
1438
1439 static function isMultiple($value)
1440 {
1441 $isMultiple = false;
1442
1443 if (isset($value['ID']))
1444 {
1445 return $isMultiple;
1446 }
1447
1448 if (\is_array($value))
1449 {
1450 $file = current($value);
1451 if (\is_array($file) || ((int)$file > 0))
1452 {
1453 $isMultiple = true;
1454 }
1455 }
1456
1457 return $isMultiple;
1458 }
1459
1460 public static function getViewHtmlSingle(array $input, $value)
1461 {
1462 if (! is_array($value))
1463 $value = array('ID' => $value);
1464
1465 $src = $value['SRC'] ?? null;
1466 $originalName = $value['ORIGINAL_NAME'] ?? '';
1467
1468 if ($src)
1469 {
1470 $attributes = ' href="'.htmlspecialcharsbx($src).'" title="'.htmlspecialcharsbx(Loc::getMessage('INPUT_FILE_DOWNLOAD')).'"';
1471
1472 if (\CFile::IsImage($src, $value['CONTENT_TYPE']) && $value['FILE_SIZE'] > 100000)
1473 {
1474 $previewImage = \CFile::ResizeImageGet($value['ID'], array(200,200), BX_RESIZE_IMAGE_PROPORTIONAL);
1475 if (is_array($previewImage))
1476 $src = $previewImage['src'];
1477 }
1478
1479 $content = \CFile::IsImage($value['SRC'], $value['CONTENT_TYPE'])
1480 ? '<img src="'.$src.'" border="0" alt="" style="max-height:100px; max-width:100px">'
1481 : htmlspecialcharsbx($originalName);
1482 }
1483 else
1484 {
1485 $attributes = '';
1486 $content = htmlspecialcharsbx($originalName);
1487 }
1488
1489 if (!$content)
1490 {
1491 $content = $value['FILE_NAME'] ?? null;
1492 }
1493
1494 if (!$content)
1495 {
1496 $content = $value['ID'] ?? null;
1497 }
1498
1499 return "<a$attributes>$content</a>";
1500 }
1501
1508 public static function getFilterEditHtml($name, array $input, $value)
1509 {
1510 return static::getEditHtmlSingle($name, $input, $value);
1511 }
1512
1513 public static function getEditHtmlSingle($name, array $input, $value)
1514 {
1515 if (! is_array($value))
1516 {
1517 $value = array('ID' => $value);
1518 }
1519
1520 if (isset($value['DELETE']))
1521 {
1522 unset($value['ID']);
1523 }
1524
1525 $input['ONCHANGE'] =
1526 "var anchor = this.previousSibling.previousSibling;".
1527 "if (anchor.firstChild) anchor.removeChild(anchor.firstChild);".
1528 "anchor.appendChild(document.createTextNode(this.value.split(/(\\\\|\\/)/g).pop()));".
1529 $input['ONCHANGE'];
1530
1531 // TODO HTML5 add MULTIPLE
1532 $fileAttributes = static::extractAttributes($input,
1533 array('DISABLED'=>'', 'AUTOFOCUS'=>'', 'REQUIRED'=>''),
1534 array('FORM'=>1, 'ACCEPT'=>1));
1535
1536 $otherAttributes = static::extractAttributes($input, array('DISABLED'=>''), array('FORM'=>1), false);
1537
1538 return static::getViewHtmlSingle($input, $value)
1539 .'<input type="hidden" name="'.$name.'[ID]" value="'.htmlspecialcharsbx($value['ID']).'"'.$otherAttributes.'>'
1540 .'<input type="file" name="'.$name.'" style="position:absolute; visibility:hidden"'.$fileAttributes.'>'
1541 .'<input type="button" value="'.Loc::getMessage('INPUT_FILE_BROWSE').'" onclick="this.previousSibling.click()">'
1542 .(
1543 isset($input['NO_DELETE'])
1544 ? ''
1545 : '<label> '.Loc::getMessage('INPUT_DELETE').' <input type="checkbox" name="'.$name.'[DELETE]" onclick="'
1546
1547 ."var button = this.parentNode.previousSibling, file = button.previousSibling;"
1548 ."button.disabled = file.disabled = this.checked;"
1549
1550 .'"'.$otherAttributes.'> </label>'
1551 );
1552 }
1553
1554 public static function getEditHtmlSingleDelete($name, array $input)
1555 {
1556 return '';
1557 }
1558
1559 public static function getErrorSingle(array $input, $value)
1560 {
1561 $input['REQUIRED'] ??= 'N';
1562 if (is_array($value))
1563 {
1564 if (isset($value['DELETE']))
1565 {
1566 return $input['REQUIRED'] === 'Y'
1567 ? array('REQUIRED' => Loc::getMessage('INPUT_REQUIRED_ERROR'))
1568 : array();
1569 }
1570 elseif (isset($value['tmp_name']) && is_uploaded_file($value['tmp_name']))
1571 {
1572 $errors = array();
1573
1574 if ($input['MAXSIZE'] && $value['size'] > $input['MAXSIZE'])
1575 $errors['MAXSIZE'] = Loc::getMessage('INPUT_FILE_MAXSIZE_ERROR');
1576
1577 // TODO check: file name, mime type, extension
1578 //$info = pathinfo($value['name']);
1579
1580 if ($error = \CFile::CheckFile($value, 0, false, $input['ACCEPT']))
1581 $errors['CFILE'] = $error;
1582
1583 return $errors;
1584 }
1585 else if (isset($value['error']))
1586 {
1587 switch ($value['error'])
1588 {
1589 case UPLOAD_ERR_OK: return array(); //file uploaded successfully
1590
1591 case UPLOAD_ERR_INI_SIZE:
1592 case UPLOAD_ERR_FORM_SIZE: return array('MAXSIZE' => Loc::getMessage('INPUT_FILE_MAXSIZE_ERROR'));
1593
1594 case UPLOAD_ERR_PARTIAL: return array('PARTIAL' => Loc::getMessage('INPUT_FILE_PARTIAL_ERROR'));
1595
1596 case UPLOAD_ERR_NO_FILE:
1597
1598 return $input['REQUIRED'] === 'Y' && (! is_numeric($value['ID']) || isset($value['DELETE']))
1599 ? array('REQUIRED' => Loc::getMessage('INPUT_REQUIRED_ERROR'))
1600 : array();
1601
1602 // TODO case UPLOAD_ERR_NO_TMP_DIR UPLOAD_ERR_CANT_WRITE UPLOAD_ERR_EXTENSION
1603 default: return array('INVALID' => Loc::getMessage('INPUT_INVALID_ERROR'));
1604 }
1605 }
1606 }
1607 elseif (is_numeric($value))
1608 {
1609 // TODO check if file id exists maybe ???
1610 return array();
1611 }
1612 else
1613 {
1614 return array('INVALID' => Loc::getMessage('INPUT_INVALID_ERROR'));
1615 }
1616
1617 return [];
1618 }
1619
1620 public static function getValueSingle(array $input, $value)
1621 {
1622 if (is_array($value))
1623 {
1624 if (isset($value['DELETE']))
1625 {
1626 return null;
1627 }
1628
1629 $value = $value['ID'] ?? null;
1630 }
1631
1632 return is_numeric($value) ? $value : null;
1633 }
1634
1635 public static function getSettings(array $input, $reload)
1636 {
1637 return array(
1638 'MAXSIZE' => array('TYPE' => 'NUMBER', 'LABEL' => Loc::getMessage('INPUT_FILE_MAXSIZE'), 'MIN' => 0, 'STEP' => 1),
1639 'ACCEPT' => array('TYPE' => 'STRING', 'LABEL' => Loc::getMessage('INPUT_FILE_ACCEPT' ), 'PLACEHOLDER' => 'png, doc, zip'),
1640 );
1641 }
1642}
1643
1644Manager::register('FILE', array(
1645 'CLASS' => __NAMESPACE__.'\File',
1646 'NAME' => Loc::getMessage('INPUT_FILE'),
1647));
1648
1652class Date extends Base
1653{
1654 public static function getEditHtmlSingle($name, array $input, $value)
1655 {
1656 $showTime = $input['TIME'] == 'Y';
1657
1658 // TODO HTML5 input="date|datetime|datetime-local" & min & max & step(date:integer|datetime..:float)
1659
1660 $textAttributes = static::extractAttributes($input,
1661 array('DISABLED'=>'', 'AUTOCOMPLETE'=>'on', 'AUTOFOCUS'=>'', 'READONLY'=>'', 'REQUIRED'=>''),
1662 array('FORM'=>1, 'LIST'=>1));
1663
1664 $buttonAttributes = static::extractAttributes($input, array('DISABLED'=>''), array(), false);
1665
1666 return '<input type="text" name="'.$name.'" size="'.($showTime ? 20 : 10).'" value="'.htmlspecialcharsbx($value).'"'.$textAttributes.'>'
1667 .'<input type="button" value="'.Loc::getMessage('INPUT_DATE_SELECT').'"'.$buttonAttributes.' onclick="'
1668 ."BX.calendar({node:this, field:'$name', form:'', bTime:".($showTime ? 'true' : 'false').", bHideTime:false});"
1669 .'">';
1670 }
1671
1678 public static function getFilterEditHtml($name, array $input, $value)
1679 {
1680 return static::getEditHtmlSingle($name, $input, $value);
1681 }
1682
1683 public static function getEditHtmlSingleDelete($name, array $input)
1684 {
1685 return '<label> '.Loc::getMessage('INPUT_DELETE').' <input type="checkbox" onclick="'
1686
1687 ."var disabled = this.checked;"
1688 ."var button = this.parentNode.previousSibling;"
1689 ."button.disabled = disabled;"
1690 ."button.previousSibling.disabled = disabled;"
1691
1692 .'"> </label>';
1693 }
1694
1695 public static function getErrorSingle(array $input, $value)
1696 {
1697 return CheckDateTime($value, FORMAT_DATE)
1698 ? array()
1699 : array('INVALID' => Loc::getMessage('INPUT_INVALID_ERROR'));
1700 }
1701
1702 static function getSettings(array $input, $reload)
1703 {
1704 return array(
1705 'TIME' => array('TYPE' => 'Y/N', 'LABEL' => Loc::getMessage('INPUT_DATE_TIME'), 'ONCLICK' => $reload),
1706 // TODO min, max, step
1707 );
1708 }
1709}
1710
1711Manager::register('DATE', array(
1712 'CLASS' => __NAMESPACE__.'\Date',
1713 'NAME' => Loc::getMessage('INPUT_DATE'),
1714));
1715
1719class Location extends Base
1720{
1721 public static function getViewHtmlSingle(array $input, $value)
1722 {
1723 if((string) $value == '')
1724 return '';
1725
1726 try
1727 {
1728 $result = \Bitrix\Sale\Location\LocationTable::getPathToNodeByCode($value, array(
1729 'select' => array('CHAIN' => 'NAME.NAME'),
1730 'filter' => array('NAME.LANGUAGE_ID' => LANGUAGE_ID),
1731 ));
1732
1733 $path = array();
1734
1735 while($row = $result->fetch())
1736 $path[] = $row['CHAIN'];
1737
1738 return htmlspecialcharsbx(implode(', ', $path));
1739 }
1740 catch(\Bitrix\Main\SystemException $e)
1741 {
1742 return '';
1743 }
1744 }
1745
1752 public static function getFilterEditHtml($name, array $input, $value)
1753 {
1754 return static::getEditHtml($name, $input, $value);
1755 }
1756
1757 public static function getEditHtml($name, array $input, $value = null)
1758 {
1759 $name = htmlspecialcharsbx($name);
1760
1761 $input['DISABLED'] ??= 'N';
1762
1763 if ($value === null && isset($input['VALUE']))
1764 {
1765 $value = $input['VALUE'];
1766 }
1767
1768 $html = '';
1769
1770 if (isset($input['HIDDEN']) && ($input['HIDDEN'] === 'Y' || $input['HIDDEN'] === true))
1771 {
1772 $html .= static::getHiddenRecursive($name
1773 , (isset($input['MULTIPLE']) && $input['MULTIPLE'] === 'Y') ? static::asMultiple($value) : static::asSingle($value)
1774 , static::extractAttributes($input, array('DISABLED'=>''), array('FORM'=>1), false));
1775 }
1776 else
1777 {
1778 $selector = md5("location input selector $name");
1779 $input["LOCATION_SELECTOR"] = $selector;
1780
1781 if ($onChange = $input['ONCHANGE'])
1782 {
1783 $functionName = 'OnLocationChange'.$selector;
1784 $html .= "<script>function $functionName (){ $onChange }; BX.proxy($functionName, this);</script>";
1785 $input['JS_CALLBACK'] = $functionName;
1786 }
1787 else
1788 {
1789 $input['JS_CALLBACK'] = null;
1790 }
1791
1792 if (isset($input['MULTIPLE']) && $input['MULTIPLE'] === 'Y')
1793 {
1794 $tag = isset($input['MULTITAG']) ? htmlspecialcharsbx($input['MULTITAG']) : static::MULTITAG;
1795 [$startTag, $endTag] = $tag ? array("<$tag>", "</$tag>") : array('', '');
1796
1797 $index = -1;
1798
1799 $values = static::asMultiple($value);
1800 if (empty($value))
1801 {
1802 $values = array(null);
1803 }
1804 foreach ($values as $value)
1805 $html .= $startTag
1806 .static::getEditHtmlSingle($name.'['.(++$index).']', $input, $value)
1807 .$endTag;
1808
1809 $replace = '##INPUT##NAME##';
1810
1811 if ($input['DISABLED'] !== 'Y') // TODO
1812 $html .= static::getEditHtmlInsert($tag, $replace, $name
1813 , static::getEditHtmlSingle($replace, $input, null)
1814 , "var location = BX.locationSelectors['$selector'].spawn(container, {selectedItem: false, useSpawn: false});"
1815 ."location.clearSelected();"
1816 //."location.focus();" // TODO
1817 );
1818 }
1819 else
1820 {
1821 $html .= static::getEditHtmlSingle($name, $input, static::asSingle($value));
1822 }
1823 }
1824
1825 if (isset($input['ADDITIONAL_HIDDEN']) && $input['ADDITIONAL_HIDDEN'] === 'Y')
1826 {
1827 $html .= static::getHiddenRecursive($name
1828 , (isset($input['MULTIPLE']) && $input['MULTIPLE'] === 'Y') ? static::asMultiple($value) : static::asSingle($value)
1829 , static::extractAttributes($input, array(), array('FORM'=>1), false));
1830 }
1831
1832 return $html;
1833 }
1834
1835 public static function getEditHtmlSingle($name, array $input, $value)
1836 {
1837 $filterMode = isset($input['IS_FILTER_FIELD']) && $input['IS_FILTER_FIELD'] === true;
1838 $isSearchLine = isset($input['IS_SEARCH_LINE']) && $input['IS_SEARCH_LINE'] === true;
1839 $parameters = array(
1840 'CODE' => $value,
1841 'INPUT_NAME' => $name,
1842 'PROVIDE_LINK_BY' => 'code',
1843 'SELECT_WHEN_SINGLE' => 'N',
1844 'FILTER_BY_SITE' => 'N',
1845 'SHOW_DEFAULT_LOCATIONS' => 'N',
1846 'SEARCH_BY_PRIMARY' => 'N',
1847 'JS_CONTROL_GLOBAL_ID' => $input["LOCATION_SELECTOR"],
1848 'JS_CALLBACK' => $input['JS_CALLBACK']
1849 );
1850
1851 ob_start();
1852
1853 if($filterMode)
1854 {
1855 print('<div style="width: 100%; margin-left: 12px">');
1856 $parameters['INITIALIZE_BY_GLOBAL_EVENT'] = 'onAdminFilterInited'; // this allows js logic to be initialized after admin filter
1857 $parameters['GLOBAL_EVENT_SCOPE'] = 'window';
1858 }
1859
1860 $GLOBALS['APPLICATION']->IncludeComponent(
1861 'bitrix:sale.location.selector.'.($filterMode || $isSearchLine ? 'search' : \Bitrix\Sale\Location\Admin\Helper::getWidgetAppearance()),
1862 '',
1863 $parameters,
1864 false
1865 );
1866
1867 if($filterMode)
1868 {
1869 print('</div>');
1870 }
1871
1872 $html = ob_get_contents();
1873 ob_end_clean();
1874
1875 return $html;
1876 }
1877
1878 public static function getErrorSingle(array $input, $value)
1879 {
1880 return \Bitrix\Sale\Location\LocationTable::getByCode($value)->fetch()
1881 ? array()
1882 : array('INVALID' => Loc::getMessage('INPUT_INVALID_ERROR'));
1883 }
1884}
1885
1886Manager::register('LOCATION', array(
1887 'CLASS' => __NAMESPACE__.'\Location',
1888 'NAME' => Loc::getMessage('INPUT_LOCATION'),
1889));
1890
1895class Address extends Base
1896{
1900 static function isMultiple($value)
1901 {
1902 return false;
1903 }
1904
1908 public static function hasMultipleValuesSupport()
1909 {
1910 return false;
1911 }
1912
1918 public static function getViewHtml(array $input, $value = null)
1919 {
1920 if (!is_array($value) || !Loader::includeModule('location'))
1921 {
1922 return '';
1923 }
1924
1925 $address = \Bitrix\Location\Entity\Address::fromArray($value);
1926
1927 return $address->toString(
1928 FormatService::getInstance()->findDefault(LANGUAGE_ID)
1929 );
1930 }
1931
1935 public static function getFilterEditHtml($name, array $input, $value)
1936 {
1937 //not implemented
1938 return '';
1939 }
1940
1946 public static function getErrorSingle(array $input, $value)
1947 {
1948 $input['REQUIRED'] ??= 'N';
1949 if ($input['REQUIRED'] === 'Y')
1950 {
1951 if (!(is_array($value) && !empty($value)))
1952 {
1953 return ['REQUIRED' => Loc::getMessage('INPUT_REQUIRED_ERROR')];
1954 }
1955 }
1956
1957 return [];
1958 }
1959
1965 public static function getRequiredError(array $input, $value)
1966 {
1967 return static::getErrorSingle($input, $value);
1968 }
1969
1973 public static function getEditHtmlSingle($name, array $input, $value)
1974 {
1975 if (!Loader::includeModule('location'))
1976 {
1977 return '';
1978 }
1979
1980 $input['DISABLED'] ??= 'N';
1981
1982 \Bitrix\Main\UI\Extension::load('sale.address');
1983
1984 ob_start();
1985 ?>
1986 <script>
1987 if (BX.Sale.AddressControlConstructor)
1988 {
1989 new BX.Sale.AddressControlConstructor(
1990 {
1991 propsData: {
1992 name: '<?=$name?>',
1993 initValue: <?=(is_array($value)) ? ("'" . \Bitrix\Location\Entity\Address::fromArray($value)->toJson() . "'") : Json::encode(null)?>,
1994 isLocked: <?=($input['DISABLED'] === 'Y' ? 'true' : 'false'); ?>,
1995 onChangeCallback: function () {
1996 <?if (isset($input['ONCHANGE'])):?>
1997 <?=$input['ONCHANGE']?>
1998 <?endif;?>
1999 }
2000 }
2001 }
2002 ).$mount('#<?=$name?>');
2003 }
2004 </script>
2005 <?
2006 $script = ob_get_clean();
2007
2008 return '
2009 <div id="' . $name . '"></div>
2010 ' . $script . '
2011 ';
2012 }
2013}
2014
2015if (Loader::includeModule('location'))
2016{
2017 Manager::register('ADDRESS', array(
2018 'CLASS' => __NAMESPACE__.'\Address',
2019 'NAME' => Loc::getMessage('INPUT_ADDRESS'),
2020 ));
2021}
2022
2024{
2025
2032 public static function getViewHtml(array $input, $values = null) : string
2033 {
2034 if (!is_array($values))
2035 {
2036 return '';
2037 }
2038
2039 $result = '<br><br>';
2040 $catList = self::getCategoriesList($values);
2041
2042 foreach ($catList as $catName)
2043 {
2044 $result .= "<div> - {$catName}</div>";
2045 }
2046
2047 return $result;
2048 }
2049
2057 public static function getEditHtml($name, array $input, $values = null) : string
2058 {
2059 if (!is_array($values))
2060 {
2061 $values = [];
2062 }
2063
2064 $addInputTranslate = Loc::getMessage('SALE_PRODUCT_CATEGORY_INP_ADD');
2065 $deleteInputTranslate = Loc::getMessage('SALE_PRODUCT_CATEGORY_INP_DELETE');
2066
2067 $openFilterButtonId = $input['ID'];
2068
2069 $deprecatedSupport = isset($input['SCRIPT']) && isset($input['URL']);
2070 if ($deprecatedSupport)
2071 {
2072 $url = $input['URL'];
2073 $addCategoryScript = $input['SCRIPT'];
2074 $input['ID'] = 'sale-admin-delivery-restriction-cat';
2075 }
2076 else
2077 {
2078 $addCategoryScript = "window.InS".md5('SECTIONS_IDS')."=function(id, name){{$input['JS_HANDLER']}.addRestrictionProductSection(id, name, '{$input['ID']}', this);};";
2079 $url = 'cat_section_search.php?lang=ru&m=y&n=SECTIONS_IDS';
2080 }
2081
2082 $editSection = "
2083 <br>
2084 <a
2085 class='adm-s-restriction-open-dialog-link'
2086 href='javascript:void(0);'
2087 id='{$openFilterButtonId}'
2088 onclick=\"window.open('{$url}','choose category', 'width=850, height=600');\"
2089 >
2090 {$addInputTranslate}
2091 </a>
2092 <br><br>
2093 <script type='text/javascript'>
2094 {$addCategoryScript}
2095 BX.message({SALE_PRODUCT_CATEGORY_INP_DELETE: '{$deleteInputTranslate}'});
2096 </script>
2097 ";
2098
2099 $catList = self::getCategoriesList($values);
2100 $existCatHtml = "<table id='{$input['ID']}-content' width='100%'>";
2101
2102 foreach ($catList as $catId => $catName)
2103 {
2104 if ($deprecatedSupport)
2105 {
2106 $deleteNodeScript = "BX.Sale.Delivery.deleteRestrictionProductSection('{$catId}');";
2107 }
2108 else
2109 {
2110 $deleteNodeScript = "{$input['JS_HANDLER']}.deleteRestrictionProductSection('{$catId}', '{$input['ID']}');";
2111 }
2112
2113 $existCatHtml .= "
2114 <tr class='adm-s-product-category-restriction-delcat' id='{$input['ID']}-{$catId}'>
2115 <td>
2116 <span> - {$catName}</span>
2117 <input type='hidden' name='RESTRICTION[CATEGORIES][]' value='{$catId}'>
2118 </td>
2119 <td align='right'>
2120 &nbsp;
2121 <a
2122 class='adm-s-bus-morelinkqhsw'
2123 href='javascript:void(0);'
2124 onclick=\"{$deleteNodeScript}\"
2125 >
2126 {$deleteInputTranslate}
2127 </a>
2128 </td>
2129 </tr>
2130 ";
2131 }
2132
2133 $existCatHtml .= '</table>';
2134
2135 return $existCatHtml.$editSection;
2136 }
2137
2143 protected static function getCategoriesList($ids) : array
2144 {
2145 if(!\Bitrix\Main\Loader::includeModule('iblock'))
2146 return [];
2147
2148 $result = [];
2149
2150 $res = \Bitrix\Iblock\SectionTable::getList([
2151 'filter' => [
2152 'ID' => $ids,
2153 ],
2154 'select' => ['ID', 'NAME'],
2155 ]);
2156
2157 while($section = $res->fetch())
2158 $result[$section['ID']] = htmlspecialcharsbx($section['NAME']);
2159
2160 return $result;
2161 }
2162
2163 public static function getValueSingle(array $input, $userValue)
2164 {
2165 return $userValue;
2166 }
2167
2168 public static function getError(array $input, $values)
2169 {
2170 return self::getErrorSingle($input, $values);
2171 }
2172
2173 public static function getErrorSingle(array $input, $values)
2174 {
2175 return [];
2176 }
2177
2178 public static function getSettings(array $input, $reload)
2179 {
2180 return [];
2181 }
2182}
2183
2185 'PRODUCT_CATEGORIES',
2186 [
2187 'CLASS' => __NAMESPACE__.'\ProductCategories',
2188 'NAME' => Loc::getMessage('SALE_PRODUCT_CATEGORY_INP'),
2189 ]
2190);
2191
2193{
2199 public static function getViewHtml(array $input, $values = null) : string
2200 {
2201 if (!is_array($values))
2202 {
2203 return '';
2204 }
2205
2206 $result = '<br><br>';
2207
2208 $productList = self::getProductsList($values);
2209
2210 foreach ($productList as $productName)
2211 {
2212 $result .= "<div> - {$productName}</div>";
2213 }
2214
2215 return $result;
2216 }
2217
2225 public static function getEditHtml($name, array $input, $values = null) : string
2226 {
2227 if (!is_array($values))
2228 {
2229 $values = [];
2230 }
2231
2232 $nodeId = &$input['ID'];
2233
2234 $input['FORM_NAME'] = md5($input['FORM_NAME']);
2235 $url = "cat_product_search.php?func_name={$input['FORM_NAME']}&new_value=Y";
2236 $addProductScript = "window.".$input['FORM_NAME']."=function(id, name, url){".$input["JS_HANDLER"].".addRestrictionByConcreteProduct('".$nodeId."', id, name, this);};";
2237
2238 $addInputTranslate = Loc::getMessage('SALE_CONCRETE_PRODUCT_INP_ADD');
2239 $deleteInputTranslate = Loc::getMessage('SALE_CONCRETE_PRODUCT_INP_DELETE');
2240
2241 $editSection = "
2242 <br>
2243 <a
2244 class='adm-s-restriction-open-dialog-link'
2245 href='javascript:void(0);'
2246 id='{$input["ID"]}'
2247 onclick=\"window.open('{$url}', 'choose product', 'width=850,height=600');\"
2248 >
2249 {$addInputTranslate}
2250 </a>
2251 <br><br>
2252 <script type='text/javascript'>
2253 {$addProductScript}
2254 BX.message({SALE_CONCRETE_PRODUCT_INP_DELETE: '$deleteInputTranslate'});
2255 </script>";
2256
2257 $productsList = self::getProductsList($values);
2258 $existProductsHtml = "<table id='{$nodeId}-content' width='100%'>";
2259
2260 foreach ($productsList as $productId => $productName)
2261 {
2262 $existProductsHtml .= "
2263 <tr class='adm-s-concrete-product-restriction-delprod' id='{$nodeId}-{$productId}'>
2264 <td>
2265 <span> - {$productName}</span>
2266 <input type='hidden' name='RESTRICTION[PRODUCTS][]' value='{$productId}'>
2267 </td>
2268 <td align='right'>
2269 &nbsp;
2270 <a
2271 class='adm-s-bus-morelinkqhsw' href='javascript:void(0);'
2272 onclick=\"{$input["JS_HANDLER"]}.deleteRestrictionByConcreteProduct('{$nodeId}', '{$productId}');\"
2273 >
2274 {$deleteInputTranslate}
2275 </a>
2276 </td>
2277 </tr>
2278 ";
2279 }
2280
2281 $existProductsHtml .= "</table>";
2282
2283 return $existProductsHtml.$editSection;
2284 }
2285
2286 protected static function getProductsList($elementIds)
2287 {
2288 if (!\Bitrix\Main\Loader::includeModule('iblock'))
2289 {
2290 return [];
2291 }
2292
2293 $productsList = [];
2294
2295 $productsListSource = \Bitrix\Iblock\ElementTable::getList([
2296 'filter' => [
2297 'ID' => $elementIds,
2298 ],
2299 'select' => [
2300 'ID',
2301 'NAME',
2302 ],
2303 ]);
2304
2305 while ($productRow = $productsListSource->fetch())
2306 {
2307 $productsList[$productRow['ID']] = htmlspecialcharsbx($productRow['NAME']);
2308 }
2309
2310 return $productsList;
2311 }
2312
2313 public static function getValueSingle(array $input, $userValue)
2314 {
2315 return $userValue;
2316 }
2317
2318 public static function getError(array $input, $value)
2319 {
2320 return self::getErrorSingle($input, $value);
2321 }
2322
2323 public static function getErrorSingle(array $input, $value)
2324 {
2325 return [];
2326 }
2327
2328 public static function getSettings(array $input, $reload)
2329 {
2330 return [];
2331 }
2332}
2333
2335 'CONCRETE_PRODUCT',
2336 [
2337 'CLASS' => __NAMESPACE__.'\\ConcreteProduct',
2338 'NAME' => Loc::getMessage('SALE_CONCRETE_PRODUCT_INP'),
2339 ]
2340);
static fromArray(array $arrayData)
Definition address.php:298
static loadMessages($file)
Definition loc.php:64
static getMessage($code, $replace=null, $language=null)
Definition loc.php:29
static getRequiredError(array $input, $value)
Definition input.php:1965
static getEditHtmlSingle($name, array $input, $value)
Definition input.php:1973
static getFilterEditHtml($name, array $input, $value)
Definition input.php:1935
static getErrorSingle(array $input, $value)
Definition input.php:1946
static getViewHtml(array $input, $value=null)
Definition input.php:1918
static getValue(array $input, $value)
Definition input.php:606
static getSettings(array $input, $reload)
Definition input.php:642
static getViewHtmlSingle(array $input, $value)
Definition input.php:403
static getEditHtml($name, array $input, $value=null)
Definition input.php:414
static extractAttributes(array $input, array $boolean, array $other, $withGlobal=true)
Definition input.php:667
static getHiddenRecursive($name, $value, $attributes)
Definition input.php:649
static getRequiredError(array $input, $value)
Definition input.php:549
static getEditHtmlSingle($name, array $input, $value)
Definition input.php:475
static getEditHtmlSingleDelete($name, array $input)
Definition input.php:480
static getValueSingle(array $input, $value)
Definition input.php:637
static getErrorSingle(array $input, $value)
Definition input.php:601
static getError(array $input, $value)
Definition input.php:509
static getEditHtmlInsert($tag, $replace, $name, $sample, $after)
Definition input.php:489
static getViewHtml(array $input, $value=null)
Definition input.php:378
static getSettings(array $input, $reload)
Definition input.php:2328
static getViewHtml(array $input, $values=null)
Definition input.php:2199
static getValueSingle(array $input, $userValue)
Definition input.php:2313
static getEditHtml($name, array $input, $values=null)
Definition input.php:2225
static getErrorSingle(array $input, $value)
Definition input.php:2323
static getError(array $input, $value)
Definition input.php:2318
static getSettings(array $input, $reload)
Definition input.php:1702
static getEditHtmlSingle($name, array $input, $value)
Definition input.php:1654
static getEditHtmlSingleDelete($name, array $input)
Definition input.php:1683
static getFilterEditHtml($name, array $input, $value)
Definition input.php:1678
static getErrorSingle(array $input, $value)
Definition input.php:1695
static getViewHtmlSingle(array $input, $value)
Definition input.php:1005
static getRequiredError(array $input, $value)
Definition input.php:1072
static getEditHtmlSingle($name, array $input, $value)
Definition input.php:1010
static getValueSingle(array $input, $value)
Definition input.php:1067
static getFilterEditHtml($name, array $input, $value)
Definition input.php:1034
static getErrorSingle(array $input, $value)
Definition input.php:1047
static getSettings(array $input, $reload)
Definition input.php:1271
static getViewHtmlSingle(array $input, $value)
Definition input.php:1119
static getEditHtml($name, array $input, $value=null)
Definition input.php:1147
static getFilterEditHtml($name, array $input, $value)
Definition input.php:1142
static getErrorSingle(array $input, $value)
Definition input.php:1253
static getSettings(array $input, $reload)
Definition input.php:1635
static isUploadedSingle($value)
Definition input.php:1426
static getViewHtmlSingle(array $input, $value)
Definition input.php:1460
static getEditHtmlSingle($name, array $input, $value)
Definition input.php:1513
static getPostWithFiles(array $post, array $files)
Definition input.php:1332
static getEditHtmlSingleDelete($name, array $input)
Definition input.php:1554
static getValueSingle(array $input, $value)
Definition input.php:1620
static getFilterEditHtml($name, array $input, $value)
Definition input.php:1508
static getErrorSingle(array $input, $value)
Definition input.php:1559
static getViewHtmlSingle(array $input, $value)
Definition input.php:1721
static getEditHtml($name, array $input, $value=null)
Definition input.php:1757
static getEditHtmlSingle($name, array $input, $value)
Definition input.php:1835
static getFilterEditHtml($name, array $input, $value)
Definition input.php:1752
static getErrorSingle(array $input, $value)
Definition input.php:1878
static getValue(array $input, $value)
Definition input.php:163
static getSettings(array $input, $reload=null)
Definition input.php:197
static getEditHtml($name, array $input, $value=null)
Definition input.php:88
static asMultiple(array $input, $value)
Definition input.php:180
static register($name, array $type)
Definition input.php:282
static getRequiredError(array $input, $value)
Definition input.php:141
static getFilterEditHtml($name, array $input, $value=null)
Definition input.php:106
static getError(array $input, $value)
Definition input.php:123
static getViewHtml(array $input, $value=null)
Definition input.php:70
static getSettings(array $input, $reload)
Definition input.php:985
static getEditHtmlSingle($name, array $input, $value)
Definition input.php:897
static getFilterEditHtml($name, array $input, $value)
Definition input.php:942
static getErrorSingle(array $input, $value)
Definition input.php:947
static getSettings(array $input, $reload)
Definition input.php:2178
static getErrorSingle(array $input, $values)
Definition input.php:2173
static getViewHtml(array $input, $values=null)
Definition input.php:2032
static getValueSingle(array $input, $userValue)
Definition input.php:2163
static getEditHtml($name, array $input, $values=null)
Definition input.php:2057
static getError(array $input, $values)
Definition input.php:2168
static getSettings(array $input, $reload)
Definition input.php:853
static getEditHtmlSingle($name, array $input, $value)
Definition input.php:750
static getFilterEditHtml($name, array $input, $value)
Definition input.php:792
static getErrorSingle(array $input, $value)
Definition input.php:797
$GLOBALS['____1444769544']
Definition license.php:1