1C-Bitrix 25.700.0
Загрузка...
Поиск...
Не найдено
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
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 {
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 $input['NAME'] ??= $input['LABEL'];
556 $input['NAME'] ??= '';
557
558 if ($value === null && isset($input['VALUE']))
559 {
560 $value = $input['VALUE'];
561 }
562
563 if ($input['MULTIPLE'] === 'Y')
564 {
565 if ($input['REQUIRED'] === 'Y' || $input['REQUIRED'] === true)
566 {
567 foreach (static::asMultiple($value) as $value)
568 {
569 if ($value === '' || $value === null)
570 {
571 $errors['REQUIRED'] = isset($input['NAME'])
572 ? Loc::getMessage('INPUT_REQUIRED_ERROR_MSGVER_1', ['#NAME#' => $input['NAME']])
573 : Loc::getMessage('INPUT_REQUIRED_ERROR_WITHOUT_FIELD_TITLE');
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' || $input['REQUIRED'] === true)
586 {
587 $errors['REQUIRED'] = isset($input['NAME'])
588 ? Loc::getMessage('INPUT_REQUIRED_ERROR_MSGVER_1', ['#NAME#' => $input['NAME']])
589 : Loc::getMessage('INPUT_REQUIRED_ERROR_WITHOUT_FIELD_TITLE');
590 }
591 }
592 }
593
594 return $errors;
595 }
596
603 public static function getErrorSingle(array $input, $value)
604 {
605 throw new SystemException("you must implement [getErrorSingle] or override [getError] in yor class", 0, __FILE__, __LINE__);
606 }
607
608 public static function getValue(array $input, $value)
609 {
610 if (isset($input['DISABLED']) && $input['DISABLED'] === 'Y')
611 {
612 return null; // TODO maybe??
613 }
614
615 if ($value === null)
616 {
617 $value = $input['VALUE'] ?? null;
618 }
619
620 if (isset($input['MULTIPLE']) && $input['MULTIPLE'] === 'Y')
621 {
622 $values = array();
623
624 foreach (static::asMultiple($value) as $value)
625 {
626 $value = static::getValueSingle($input, $value);
627 if ($value !== null)
628 $values []= $value;
629 }
630
631 return $values ? $values : null;
632 }
633 else
634 {
635 return static::getValueSingle($input, static::asSingle($value));
636 }
637 }
638
639 public static function getValueSingle(array $input, $value)
640 {
641 return $value;
642 }
643
644 public static function getSettings(array $input, $reload)
645 {
646 return array(); // no settings
647 }
648
649 // utils
650
651 protected static function getHiddenRecursive($name, $value, $attributes)
652 {
653 if (is_array($value))
654 {
655 $html = '';
656
657 foreach ($value as $k => $v)
658 $html .= self::getHiddenRecursive($name.'['.htmlspecialcharsbx($k).']', $v, $attributes);
659
660 return $html;
661 }
662 else
663 {
664 return '<input type="hidden" name="'.$name.'" value="'.htmlspecialcharsbx($value).'"'.$attributes.'>';
665 }
666 }
667
669 protected static function extractAttributes(array $input, array $boolean, array $other, $withGlobal = true)
670 {
671 $string = '';
672
673 // add boolean attributes with predefined values or no value
674
675 unset($boolean['REQUIRED']); // TODO remove with HTML5
676
677 static $globalBoolean = array('CONTENTEDITABLE'=>'', 'DRAGGABLE'=>'true', 'SPELLCHECK'=>'', 'TRANSLATE'=>'yes');
678
679 if ($withGlobal)
680 $boolean = $globalBoolean + $boolean;
681
682 foreach (array_intersect_key($input, $boolean) as $k => $v)
683 if ($v === 'Y' || $v === true)
684 $string .= ' '.mb_strtolower($k).($boolean[$k] ? '="'.$boolean[$k].'"' : '');
685
686 // add event attributes with values
687 if ($withGlobal)
688 {
689 static $globalEvents = array(
690 'ONABORT'=>1, 'ONBLUR'=>1, 'ONCANPLAY'=>1, 'ONCANPLAYTHROUGH'=>1, 'ONCHANGE'=>1, 'ONCLICK'=>1,
691 'ONCONTEXTMENU'=>1, 'ONDBLCLICK'=>1, 'ONDRAG'=>1, 'ONDRAGEND'=>1, 'ONDRAGENTER'=>1, 'ONDRAGLEAVE'=>1,
692 'ONDRAGOVER'=>1, 'ONDRAGSTART'=>1, 'ONDROP'=>1, 'ONDURATIONCHANGE'=>1, 'ONEMPTIED'=>1, 'ONENDED'=>1,
693 'ONERROR'=>1, 'ONFOCUS'=>1, 'ONINPUT'=>1, 'ONINVALID'=>1, 'ONKEYDOWN'=>1, 'ONKEYPRESS'=>1, 'ONKEYUP'=>1,
694 'ONLOAD'=>1, 'ONLOADEDDATA'=>1, 'ONLOADEDMETADATA'=>1, 'ONLOADSTART'=>1, 'ONMOUSEDOWN'=>1, 'ONMOUSEMOVE'=>1,
695 'ONMOUSEOUT'=>1, 'ONMOUSEOVER'=>1, 'ONMOUSEUP'=>1, 'ONMOUSEWHEEL'=>1, 'ONPAUSE'=>1, 'ONPLAY'=>1,
696 'ONPLAYING'=>1, 'ONPROGRESS'=>1, 'ONRATECHANGE'=>1, 'ONREADYSTATECHANGE'=>1, 'ONRESET'=>1, 'ONSCROLL'=>1,
697 'ONSEEKED'=>1, 'ONSEEKING'=>1, 'ONSELECT'=>1, 'ONSHOW'=>1, 'ONSTALLED'=>1, 'ONSUBMIT'=>1, 'ONSUSPEND'=>1,
698 'ONTIMEUPDATE'=>1, 'ONVOLUMECHANGE'=>1, 'ONWAITING'=>1,
699 );
700
701 $events = array_intersect_key($input, $globalEvents);
702 $other = array_diff_key($other, $events);
703
704 foreach ($events as $k => $v)
705 if ($v)
706 $string .= ' '.mb_strtolower($k).'="'.$v.'"';
707 }
708
709 // add other attributes with values
710
711 static $globalOther = array(
712 'ACCESSKEY'=>1, 'CLASS'=>1, 'CONTEXTMENU'=>1, 'DIR'=>1, 'DROPZONE'=>1, 'LANG'=>1, 'STYLE'=>1, 'TABINDEX'=>1,
713 'TITLE'=>1, 'ID' => 1,
714 'XML:LANG'=>1, 'XML:SPACE'=>1, 'XML:BASE'=>1
715 );
716
717 if ($withGlobal)
718 $other += $globalOther;
719
720 foreach (array_intersect_key($input, $other) as $k => $v)
721 if ($v)
722 $string .= ' '.mb_strtolower($k).'="'.htmlspecialcharsbx($v).'"';
723
724 // add data attributes
725 if ($withGlobal && isset($input['DATA']) && is_array($input['DATA']))
726 {
727 foreach ($input['DATA'] as $k => $v)
728 {
729 $string .= ' data-'.htmlspecialcharsbx($k).'="'.htmlspecialcharsbx($v).'"';
730 }
731 }
732
733 return $string;
734 }
735
739 public static function hasMultipleValuesSupport()
740 {
741 return true;
742 }
743}
744
748class StringInput extends Base // String reserved in php 7
749{
750 protected static $patternDelimiters = array('/', '#', '~');
751
752 public static function getEditHtmlSingle($name, array $input, $value)
753 {
754 $input = self::prepareIntFields($input);
755 if (isset($input['MULTILINE']) && $input['MULTILINE'] === 'Y')
756 {
757 $attributes = static::extractAttributes($input,
758 array('DISABLED'=>'', 'READONLY'=>'', 'AUTOFOCUS'=>'', 'REQUIRED'=>''),
759 array('FORM'=>1, 'MAXLENGTH'=>1, 'PLACEHOLDER'=>1, 'DIRNAME'=>1, 'ROWS'=>1, 'COLS'=>1, 'WRAP'=>1));
760
761 return '<textarea name="'.$name.'"'.$attributes.'>'.htmlspecialcharsbx($value).'</textarea>';
762 }
763 else
764 {
765 $attributes = static::extractAttributes($input,
766 array('DISABLED'=>'', 'READONLY'=>'', 'AUTOFOCUS'=>'', 'REQUIRED'=>'', 'AUTOCOMPLETE'=>'on'),
767 array('FORM'=>1, 'MAXLENGTH'=>1, 'PLACEHOLDER'=>1, 'DIRNAME'=>1, 'SIZE'=>1, 'LIST'=>1));
768
769 return '<input type="text" name="'.$name.'" value="'.htmlspecialcharsbx($value).'"'.$attributes.'>';
770 }
771 }
772
773 private static function prepareIntFields(array $input): array
774 {
775 $intFields = ['SIZE', 'ROWS', 'COLS'];
776 foreach ($intFields as $field)
777 {
778 $input[$field] = (int)($input[$field] ?? 0);
779 if ($input[$field] <= 0)
780 {
781 unset($input[$field]);
782 }
783 }
784
785 return $input;
786 }
787
794 public static function getFilterEditHtml($name, array $input, $value)
795 {
796 return static::getEditHtmlSingle($name, $input, $value);
797 }
798
799 public static function getErrorSingle(array $input, $value)
800 {
801 $errors = array();
802
803 $value = trim($value);
804
805 $minLength = isset($input['MINLENGTH']) && is_numeric($input['MINLENGTH']) ? (int)$input['MINLENGTH'] : 0;
806 if ($minLength > 0 && mb_strlen($value) < $minLength)
807 {
808 $errors['MINLENGTH'] = Loc::getMessage('INPUT_STRING_MINLENGTH_ERROR', ['#NUM#' => $minLength]);
809 }
810
811 $maxLength = isset($input['MAXLENGTH']) && is_numeric($input['MAXLENGTH']) ? (int)$input['MAXLENGTH'] : 0;
812 if ($maxLength > 0 && mb_strlen($value) > $maxLength)
813 {
814 $errors['MAXLENGTH'] = Loc::getMessage('INPUT_STRING_MAXLENGTH_ERROR', ['#NUM#' => $maxLength]);
815 }
816
817 $pattern = trim(
818 (string)($input['PATTERN'] ?? '')
819 );
820 if ($pattern !== "")
821 {
822 $issetDelimiter = false;
823
824 if (isset($pattern[0]) && in_array($pattern[0], static::$patternDelimiters) && mb_strrpos($pattern, $pattern[0]) !== false)
825 {
826 $issetDelimiter = true;
827 }
828
829 $matchPattern = $pattern;
830 if (!$issetDelimiter)
831 {
832 $matchPattern = "/".$pattern."/";
833 }
834
835 $pregMatchResult = null;
836 try
837 {
838 $pregMatchResult = preg_match($matchPattern, $value);
839 }
840 catch (\Exception $e)
841 {
842 }
843 finally
844 {
845 if (!$pregMatchResult)
846 {
847 $errors['PATTERN'] = Loc::getMessage('INPUT_STRING_PATTERN_ERROR');
848 }
849 }
850 }
851
852 return $errors;
853 }
854
855 static function getSettings(array $input, $reload)
856 {
858 'MINLENGTH' => array('TYPE' => 'NUMBER', 'LABEL' => Loc::getMessage('INPUT_STRING_MINLENGTH'), 'MIN' => 0, 'STEP' => 1),
859 'MAXLENGTH' => array('TYPE' => 'NUMBER', 'LABEL' => Loc::getMessage('INPUT_STRING_MAXLENGTH'), 'MIN' => 0, 'STEP' => 1),
860 'PATTERN' => array('TYPE' => 'STRING', 'LABEL' => Loc::getMessage('INPUT_STRING_PATTERN' )),
861 'MULTILINE' => array('TYPE' => 'Y/N' , 'LABEL' => Loc::getMessage('INPUT_STRING_MULTILINE'), 'ONCLICK' => $reload),
862 );
863
864 if (isset($input['MULTILINE']) && $input['MULTILINE'] === 'Y')
865 {
866 $settings['COLS'] = array('TYPE' => 'NUMBER', 'LABEL' => Loc::getMessage('INPUT_STRING_SIZE'), 'MIN' => 0, 'STEP' => 1);
867 $settings['ROWS'] = array('TYPE' => 'NUMBER', 'LABEL' => Loc::getMessage('INPUT_STRING_ROWS'), 'MIN' => 0, 'STEP' => 1);
868 }
869 else
870 {
871 $settings['SIZE'] = array('TYPE' => 'NUMBER', 'LABEL' => Loc::getMessage('INPUT_STRING_SIZE'), 'MIN' => 0, 'STEP' => 1);
872 }
873
874 return $settings;
875 }
876
882 public static function isDeletedSingle($value)
883 {
884 return is_array($value) && isset($value['DELETE']);
885 }
886
887}
888
889Manager::register('STRING', array(
890 'CLASS' => __NAMESPACE__.'\StringInput',
891 'NAME' => Loc::getMessage('INPUT_STRING'),
892));
893
897class Number extends Base
898{
899 public static function getEditHtmlSingle($name, array $input, $value)
900 {
901 // TODO HTML5 from IE10: remove SIZE; Add MIN, MAX, STEP; Change type="number"
902
903 $size = 5;
904
905 $s = mb_strlen(
906 (string)($input['MIN'] ?? '')
907 );
908 if ($s > $size)
909 {
910 $size = $s;
911 }
912
913 $s = mb_strlen(
914 (string)($input['MAX'] ?? '')
915 );
916 if ($s > $size)
917 {
918 $size = $s;
919 }
920
921 $s = mb_strlen(
922 (string)($input['STEP'] ?? '')
923 );
924 if ($s > $size)
925 {
926 $size = $s;
927 }
928
929 $input['SIZE'] = $size;
930
931 $attributes = static::extractAttributes($input,
932 array('DISABLED'=>'', 'READONLY'=>'', 'AUTOFOCUS'=>'', 'REQUIRED'=>'', 'AUTOCOMPLETE'=>'on'),
933 array('FORM'=>1, 'LIST'=>1, 'PLACEHOLDER'=>1, 'SIZE'=>1));
934
935 return '<input type="text" name="'.$name.'" value="'.htmlspecialcharsbx($value).'"'.$attributes.'>';
936 }
937
944 public static function getFilterEditHtml($name, array $input, $value)
945 {
946 return static::getEditHtmlSingle($name, $input, $value);
947 }
948
949 public static function getErrorSingle(array $input, $value)
950 {
951 $errors = array();
952
953 if (is_numeric($value))
954 {
955 $value = (double) $value;
956
957 if (!empty($input['MIN']) && $value < $input['MIN'])
958 $errors['MIN'] = Loc::getMessage('INPUT_NUMBER_MIN_ERROR', array("#NUM#" => $input['MIN']));
959
960 if (!empty($input['MAX']) && $value > $input['MAX'])
961 $errors['MAX'] = Loc::getMessage('INPUT_NUMBER_MAX_ERROR', array("#NUM#" => $input['MAX']));
962
963 if (!empty($input['STEP']))
964 {
965 $step = (double) $input['STEP'];
966
967 $value = (double) abs($value - ($input['MIN'] ? $input['MIN'] : 0.0));
968
969 if (! ($value / pow(2.0, 53) > $step))
970 {
971 $remainder = (double) abs($value - $step * round($value / $step));
972 $acceptableError = (double) ($step / pow(2.0, 24));
973
974 if ($acceptableError < $remainder && ($step - $acceptableError) > $remainder)
975 $errors['STEP'] = Loc::getMessage('INPUT_NUMBER_STEP_ERROR', array("#NUM#" => $input['STEP']));
976 }
977 }
978 }
979 else
980 {
981 $errors['NUMERIC'] = Loc::getMessage('INPUT_NUMBER_NUMERIC_ERROR');
982 }
983
984 return $errors;
985 }
986
987 public static function getSettings(array $input, $reload)
988 {
989 return array(
990 'MIN' => array('TYPE' => 'NUMBER', 'LABEL' => Loc::getMessage('INPUT_NUMBER_MIN' )),
991 'MAX' => array('TYPE' => 'NUMBER', 'LABEL' => Loc::getMessage('INPUT_NUMBER_MAX' )),
992 'STEP' => array('TYPE' => 'NUMBER', 'LABEL' => Loc::getMessage('INPUT_NUMBER_STEP')),
993 );
994 }
995}
996
997Manager::register('NUMBER', array(
998 'CLASS' => __NAMESPACE__.'\Number',
999 'NAME' => Loc::getMessage('INPUT_NUMBER'),
1000));
1001
1005class EitherYN extends Base
1006{
1007 public static function getViewHtmlSingle(array $input, $value)
1008 {
1009 return $value == 'Y' ? Loc::getMessage('INPUT_EITHERYN_Y') : Loc::getMessage('INPUT_EITHERYN_N');
1010 }
1011
1012 public static function getEditHtmlSingle($name, array $input, $value)
1013 {
1014 $hiddenAttributes = static::extractAttributes($input, array('DISABLED'=>''), array('FORM'=>1), false);
1015 $checkboxAttributes = static::extractAttributes($input, array('DISABLED'=>'', 'AUTOFOCUS'=>'', 'REQUIRED'=>''), array('FORM'=>1));
1016
1017 if (isset($input['DISABLED_YN']))
1018 {
1019 return '<input type="hidden" name="'.$name.'" value="' . (($input['DISABLED_YN'] == 'Y') ? 'Y' : 'N') . '">'
1020 .'<input type="checkbox" '.($input['DISABLED_YN'] == 'Y' ? ' checked' : '').'disabled'.'>';
1021 }
1022 else
1023 {
1024 return '<input type="hidden" name="'.$name.'" value="N"'.$hiddenAttributes.'>'
1025 .'<input type="checkbox" name="'.$name.'" value="Y"'.($value == 'Y' ? ' checked' : '').$checkboxAttributes.'>';
1026 }
1027
1028 }
1029
1036 public static function getFilterEditHtml($name, array $input, $value)
1037 {
1038 $hiddenAttributes = static::extractAttributes($input, array('DISABLED'=>''), array('FORM'=>1), false);
1039
1040 $checkboxAttributes = static::extractAttributes($input, array('DISABLED'=>'', 'AUTOFOCUS'=>'', 'REQUIRED'=>''), array('FORM'=>1));
1041
1042 return '<select name="'.$name.'" '.$hiddenAttributes.'>
1043 <option value="">'.Loc::getMessage('INPUT_EITHERYN_ALL').'</option>
1044 <option value="Y"'.($value=="Y" ? " selected" : '').' '.$checkboxAttributes.'>'.Loc::getMessage('INPUT_EITHERYN_Y').'</option>
1045 <option value="N"'.($value=="N" ? " selected" : '').' '.$checkboxAttributes.'>'.Loc::getMessage('INPUT_EITHERYN_N').'</option>
1046 </select>';
1047 }
1048
1049 public static function getErrorSingle(array $input, $value)
1050 {
1051 $input['REQUIRED'] ??= 'N';
1052 $input['NAME'] ??= (string)($input['LABEL'] ?? '');
1053
1054 if (
1055 ($input['REQUIRED'] === 'Y' || $input['REQUIRED'] === true)
1056 && ($value === '' || $value === null)
1057 )
1058 {
1059 return [
1060 'REQUIRED' => isset($input['NAME'])
1061 ? Loc::getMessage('INPUT_REQUIRED_ERROR_MSGVER_1', ['#NAME#' => $input['NAME']])
1062 : Loc::getMessage('INPUT_REQUIRED_ERROR_WITHOUT_FIELD_TITLE'),
1063 ];
1064 }
1065
1066 return
1067 ($value === 'N' || $value === 'Y')
1068 ? []
1069 : ['INVALID' => Loc::getMessage('INPUT_INVALID_ERROR')]
1070 ;
1071 }
1072
1073 public static function getValueSingle(array $input, $value)
1074 {
1075 return $value == 'Y' ? 'Y' : 'N';
1076 }
1077
1078 public static function getRequiredError(array $input, $value)
1079 {
1080 $errors = parent::getRequiredError($input, $value);
1081 $input['REQUIRED'] ??= 'N';
1082 $input['NAME'] ??= $input['LABEL'];
1083 $input['NAME'] ??= '';
1084
1085 if (!$errors)
1086 {
1087 if (
1088 $value === 'N'
1089 && $input['REQUIRED'] === 'Y'
1090 )
1091 {
1092 $errors = [
1093 'REQUIRED' => isset($input['NAME'])
1094 ? Loc::getMessage('INPUT_REQUIRED_ERROR_MSGVER_1', ['#NAME#' => $input['NAME']])
1095 : Loc::getMessage('INPUT_REQUIRED_ERROR_WITHOUT_FIELD_TITLE'),
1096 ];
1097 }
1098 }
1099 return $errors;
1100 }
1101}
1102
1104 'CLASS' => __NAMESPACE__.'\EitherYN',
1105 'NAME' => Loc::getMessage('INPUT_EITHERYN'),
1106));
1107
1111class Enum extends Base
1112{
1113 private static function flatten(array $array)
1114 {
1115 $result = array();
1116
1117 foreach ($array as $key => $value)
1118 {
1119 if (is_array($value))
1120 {
1121 $result = $result + $value;
1122 }
1123 else
1124 {
1125 $result[$key] = $value;
1126 }
1127 }
1128
1129 return $result;
1130 }
1131
1132 public static function getViewHtmlSingle(array $input, $value) // TODO optimize to getViewHtml
1133 {
1134 $options = $input['OPTIONS'] ?? [];
1135
1136 if (is_array($options))
1137 {
1138 $options = self::flatten($options);
1139
1140 if (isset($options[$value]))
1141 {
1142 $value = $options[$value];
1143 }
1144 }
1145
1146 return htmlspecialcharsbx($value);
1147 }
1148
1155 public static function getFilterEditHtml($name, array $input, $value)
1156 {
1157 return static::getEditHtml($name, $input, $value);
1158 }
1159
1160 public static function getEditHtml($name, array $input, $value = null)
1161 {
1162 $options = $input['OPTIONS'];
1163
1164 if (! is_array($options))
1165 return Loc::getMessage('INPUT_ENUM_OPTIONS_ERROR');
1166
1167 $multiple = isset($input['MULTIPLE']) && $input['MULTIPLE'] === 'Y';
1168
1170
1171 if ($value === null && isset($input['VALUE']))
1172 {
1173 $value = $input['VALUE'];
1174 }
1175
1176 $originalValue = $value;
1177 $html = '';
1178
1179 if (isset($input['HIDDEN']) && ($input['HIDDEN'] === 'Y' || $input['HIDDEN'] === true))
1180 {
1181 $html .= static::getHiddenRecursive($name
1182 , $multiple ? static::asMultiple($value) : static::asSingle($value)
1183 , static::extractAttributes($input, array('DISABLED'=>''), array('FORM'=>1), false));
1184 }
1185 else
1186 {
1187 if ($value === null)
1188 $value = array();
1189 else
1190 $value = $multiple ? array_flip(static::asMultiple($value)) : array(static::asSingle($value) => true);
1191
1192 if (isset($input['MULTIELEMENT']) && $input['MULTIELEMENT'] === 'Y')
1193 {
1194 $tag = isset($input['MULTITAG']) ? htmlspecialcharsbx($input['MULTITAG']) : static::MULTITAG;
1195 [$startTag, $endTag] = $tag ? array("<$tag>", "</$tag>") : array('', '');
1196
1197 $attributes = static::extractAttributes($input, array('DISABLED'=>''), array('FORM'=>1), false);
1198
1199 $type = 'radio';
1200
1201 if ($multiple)
1202 {
1203 $type = 'checkbox';
1204 $name .= '[]';
1205 }
1206
1207 $html .= self::getEditOptionsHtml($options, $value, ' checked',
1208 '<fieldset><legend>{GROUP}</legend>{OPTIONS}</fieldset>',
1209 $startTag.'<label><input type="'.$type.'" name="'.$name.'" value="{VALUE}"{SELECTED}'.$attributes.'> {TEXT} </label>'.$endTag
1210 );
1211 }
1212 else // select
1213 {
1214 $attributes = static::extractAttributes($input, array('DISABLED'=>'', 'AUTOFOCUS'=>'', 'REQUIRED'=>''), array('FORM'=>1, 'SIZE'=>1));
1215
1216 $html .= '<select'.$attributes.' name="'.$name.($multiple ? '[]" multiple>' : '">');
1217
1218 $html .= self::getEditOptionsHtml($options, $value, ' selected',
1219 '<optgroup label="{GROUP}">{OPTIONS}</optgroup>',
1220 '<option value="{VALUE}"{SELECTED}>{TEXT}</option>'
1221 );
1222
1223 $html .= '</select>';
1224 }
1225 }
1226
1227 if (isset($input['ADDITIONAL_HIDDEN']) && $input['ADDITIONAL_HIDDEN'] === 'Y')
1228 {
1229 $html .= static::getHiddenRecursive($name
1230 , $multiple ? static::asMultiple($originalValue) : static::asSingle($originalValue)
1231 , static::extractAttributes($input, array(), array('FORM'=>1), false));
1232 }
1233
1234 return $html;
1235 }
1236
1237 private static function getEditOptionsHtml(array $options, array $selected, $selector, $group, $option)
1238 {
1239 $result = '';
1240
1241 foreach ($options as $key => $value)
1242 {
1243 $result .= is_array($value)
1244 ? str_replace(
1245 array('{GROUP}', '{OPTIONS}'),
1246 array(
1248 self::getEditOptionsHtml($value, $selected, $selector, $group, $option),
1249 ),
1250 $group
1251 )
1252 : str_replace(
1253 array('{VALUE}', '{SELECTED}', '{TEXT}'),
1254 array(
1256 isset($selected[$key]) ? $selector : '',
1258 ),
1259 $option
1260 );
1261 }
1262
1263 return $result;
1264 }
1265
1266 public static function getErrorSingle(array $input, $value) // TODO optimize to getError
1267 {
1268 $options = $input['OPTIONS'];
1269
1270 if (is_array($options))
1271 {
1272 $options = self::flatten($options);
1273
1274 return isset($options[$value])
1275 ? array()
1276 : array('INVALID' => Loc::getMessage('INPUT_INVALID_ERROR'));
1277 }
1278 else
1279 {
1280 return array('OPTIONS' => Loc::getMessage('INPUT_ENUM_OPTIONS_ERROR'));
1281 }
1282 }
1283
1284 static function getSettings(array $input, $reload)
1285 {
1286 $settings = array(
1287 // TODO maybe??? 'OPTIONS' => array('TYPE' => 'TUPLE'),
1288 'MULTIELEMENT' => array('TYPE' => 'Y/N', 'LABEL' => Loc::getMessage('INPUT_ENUM_MULTIELEMENT'), 'ONCLICK' => $reload),
1289 );
1290
1291 if ($input['MULTIELEMENT'] != 'Y')
1292 $settings['SIZE'] = array('TYPE' => 'NUMBER', 'LABEL' => Loc::getMessage('INPUT_ENUM_SIZE'), 'MIN' => 0, 'STEP' => 1);
1293
1294 return $settings;
1295 }
1296}
1297
1298Manager::register('ENUM', array(
1299 'CLASS' => __NAMESPACE__.'\Enum',
1300 'NAME' => Loc::getMessage('INPUT_ENUM'),
1301));
1302
1307class File extends Base
1308{
1346 {
1347 foreach ($files as $key => $file)
1348 {
1349 if (!isset($post[$key]) || !is_array($post[$key]))
1350 {
1351 $post[$key] = [];
1352 }
1353
1354 foreach ($file as $property => $value)
1355 {
1356 if (is_array($value))
1357 {
1358 self::getPostWithFilesRecursive($post[$key], $value, $property);
1359 }
1360 else
1361 {
1362 $post[$key][$property] = $value;
1363 }
1364 }
1365 }
1366
1367 return $post;
1368 }
1369
1370 private static function getPostWithFilesRecursive(array &$root, array $values, $property)
1371 {
1372 foreach ($values as $key => $value)
1373 {
1374 if (! is_array($root[$key]))
1375 $root[$key] = array();
1376
1377 if (is_array($value))
1378 self::getPostWithFilesRecursive($root[$key], $value, $property);
1379 else
1380 $root[$key][$property] = $value;
1381 }
1382 }
1383
1389 static function loadInfo($value)
1390 {
1391 if (! $multiple = static::isMultiple($value))
1392 $value = array($value);
1393
1394 foreach ($value as &$file)
1395 $file = self::loadInfoSingle($file);
1396
1397 return $multiple ? $value : reset($value);
1398 }
1399
1401 static function loadInfoSingle($file)
1402 {
1403 if (is_array($file))
1404 {
1405 if (isset($file['SRC']) && $file['SRC'])
1406 {
1407 return $file; // already loaded
1408 }
1409
1410
1411 $fileId = $file['ID'] ?? null;
1412 }
1413 else
1414 {
1415 $fileId = $file;
1416 }
1417
1418 if ($fileId && is_numeric($fileId) && ($row = \CFile::GetFileArray($fileId)))
1419 {
1420 $file = (is_array($file) ? $file : array('ID' => $fileId)) + $row;
1421 }
1422
1423 return $file;
1424 }
1425
1430 static function isDeletedSingle($value)
1431 {
1432 return is_array($value) && isset($value['DELETE']);
1433 }
1434
1439 static function isUploadedSingle($value)
1440 {
1441 return
1442 is_array($value)
1443 && isset($value['error'])
1444 && $value['error'] == UPLOAD_ERR_OK
1445 && isset($value['tmp_name'])
1446 && is_uploaded_file($value['tmp_name'])
1447 ;
1448 }
1449
1450 // input methods ///////////////////////////////////////////////////////////////////////////////////////////////////
1451
1452 static function isMultiple($value)
1453 {
1454 $isMultiple = false;
1455
1456 if (isset($value['ID']))
1457 {
1458 return $isMultiple;
1459 }
1460
1461 if (\is_array($value))
1462 {
1463 $file = current($value);
1464 if (\is_array($file) || ((int)$file > 0))
1465 {
1466 $isMultiple = true;
1467 }
1468 }
1469
1470 return $isMultiple;
1471 }
1472
1473 public static function getViewHtmlSingle(array $input, $value)
1474 {
1475 if (! is_array($value))
1476 $value = array('ID' => $value);
1477
1478 $src = $value['SRC'] ?? null;
1479 $originalName = $value['ORIGINAL_NAME'] ?? '';
1480
1481 if ($src)
1482 {
1483 $attributes = ' href="'.htmlspecialcharsbx($src).'" title="'.htmlspecialcharsbx(Loc::getMessage('INPUT_FILE_DOWNLOAD')).'"';
1484
1485 if (\CFile::IsImage($src, $value['CONTENT_TYPE']) && $value['FILE_SIZE'] > 100000)
1486 {
1487 $previewImage = \CFile::ResizeImageGet($value['ID'], array(200,200), BX_RESIZE_IMAGE_PROPORTIONAL);
1488 if (is_array($previewImage))
1489 $src = $previewImage['src'];
1490 }
1491
1492 $content = \CFile::IsImage($value['SRC'], $value['CONTENT_TYPE'])
1493 ? '<img src="'.$src.'" border="0" alt="" style="max-height:100px; max-width:100px">'
1494 : htmlspecialcharsbx($originalName);
1495 }
1496 else
1497 {
1498 $attributes = '';
1499 $content = htmlspecialcharsbx($originalName);
1500 }
1501
1502 if (!$content)
1503 {
1504 $content = $value['FILE_NAME'] ?? null;
1505 }
1506
1507 if (!$content)
1508 {
1509 $content = $value['ID'] ?? null;
1510 }
1511
1512 return "<a$attributes>$content</a>";
1513 }
1514
1521 public static function getFilterEditHtml($name, array $input, $value)
1522 {
1523 return static::getEditHtmlSingle($name, $input, $value);
1524 }
1525
1526 public static function getEditHtmlSingle($name, array $input, $value)
1527 {
1528 if (! is_array($value))
1529 {
1530 $value = array('ID' => $value);
1531 }
1532
1533 if (isset($value['DELETE']))
1534 {
1535 unset($value['ID']);
1536 }
1537
1538 $input['ONCHANGE'] =
1539 "var anchor = this.previousSibling.previousSibling;".
1540 "if (anchor.firstChild) anchor.removeChild(anchor.firstChild);".
1541 "anchor.appendChild(document.createTextNode(this.value.split(/(\\\\|\\/)/g).pop()));".
1542 $input['ONCHANGE'];
1543
1544 // TODO HTML5 add MULTIPLE
1545 $fileAttributes = static::extractAttributes($input,
1546 array('DISABLED'=>'', 'AUTOFOCUS'=>'', 'REQUIRED'=>''),
1547 array('FORM'=>1, 'ACCEPT'=>1));
1548
1549 $otherAttributes = static::extractAttributes($input, array('DISABLED'=>''), array('FORM'=>1), false);
1550
1551 return static::getViewHtmlSingle($input, $value)
1552 .'<input type="hidden" name="'.$name.'[ID]" value="'.htmlspecialcharsbx($value['ID']).'"'.$otherAttributes.'>'
1553 .'<input type="file" name="'.$name.'" style="position:absolute; visibility:hidden"'.$fileAttributes.'>'
1554 .'<input type="button" value="'.Loc::getMessage('INPUT_FILE_BROWSE').'" onclick="this.previousSibling.click()">'
1555 .(
1556 isset($input['NO_DELETE'])
1557 ? ''
1558 : '<label> '.Loc::getMessage('INPUT_DELETE').' <input type="checkbox" name="'.$name.'[DELETE]" onclick="'
1559
1560 ."var button = this.parentNode.previousSibling, file = button.previousSibling;"
1561 ."button.disabled = file.disabled = this.checked;"
1562
1563 .'"'.$otherAttributes.'> </label>'
1564 );
1565 }
1566
1567 public static function getEditHtmlSingleDelete($name, array $input)
1568 {
1569 return '';
1570 }
1571
1572 public static function getErrorSingle(array $input, $value)
1573 {
1574 $input['REQUIRED'] ??= 'N';
1575 $input['NAME'] ??= $input['LABEL'];
1576 $input['NAME'] ??= '';
1577
1578 if (is_array($value))
1579 {
1580 if (isset($value['DELETE']))
1581 {
1582 return $input['REQUIRED'] === 'Y'
1583 ? [
1584 'REQUIRED' => isset($input['NAME'])
1585 ? Loc::getMessage('INPUT_REQUIRED_ERROR_MSGVER_1', ['#NAME#' => $input['NAME']])
1586 : Loc::getMessage('INPUT_REQUIRED_ERROR_WITHOUT_FIELD_TITLE'),
1587 ]
1588 : [];
1589 }
1590 elseif (isset($value['tmp_name']) && is_uploaded_file($value['tmp_name']))
1591 {
1592 $errors = array();
1593
1594 if ($input['MAXSIZE'] && $value['size'] > $input['MAXSIZE'])
1595 $errors['MAXSIZE'] = Loc::getMessage('INPUT_FILE_MAXSIZE_ERROR');
1596
1597 // TODO check: file name, mime type, extension
1598 //$info = pathinfo($value['name']);
1599
1600 if ($error = \CFile::CheckFile($value, 0, false, $input['ACCEPT']))
1601 $errors['CFILE'] = $error;
1602
1603 return $errors;
1604 }
1605 else if (isset($value['error']))
1606 {
1607 switch ($value['error'])
1608 {
1609 case UPLOAD_ERR_OK: return array(); //file uploaded successfully
1610
1611 case UPLOAD_ERR_INI_SIZE:
1612 case UPLOAD_ERR_FORM_SIZE: return array('MAXSIZE' => Loc::getMessage('INPUT_FILE_MAXSIZE_ERROR'));
1613
1614 case UPLOAD_ERR_PARTIAL: return array('PARTIAL' => Loc::getMessage('INPUT_FILE_PARTIAL_ERROR'));
1615
1616 case UPLOAD_ERR_NO_FILE:
1617
1618 return $input['REQUIRED'] === 'Y' && (! is_numeric($value['ID']) || isset($value['DELETE']))
1619 ? [
1620 'REQUIRED' => isset($input['NAME'])
1621 ? Loc::getMessage('INPUT_REQUIRED_ERROR_MSGVER_1', ['#NAME#' => $input['NAME']])
1622 : Loc::getMessage('INPUT_REQUIRED_ERROR_WITHOUT_FIELD_TITLE'),
1623 ]
1624 : [];
1625
1626 // TODO case UPLOAD_ERR_NO_TMP_DIR UPLOAD_ERR_CANT_WRITE UPLOAD_ERR_EXTENSION
1627 default: return array('INVALID' => Loc::getMessage('INPUT_INVALID_ERROR'));
1628 }
1629 }
1630 }
1631 elseif (is_numeric($value))
1632 {
1633 // TODO check if file id exists maybe ???
1634 return array();
1635 }
1636 else
1637 {
1638 return array('INVALID' => Loc::getMessage('INPUT_INVALID_ERROR'));
1639 }
1640
1641 return [];
1642 }
1643
1644 public static function getValueSingle(array $input, $value)
1645 {
1646 if (is_array($value))
1647 {
1648 if (isset($value['DELETE']))
1649 {
1650 return null;
1651 }
1652
1653 $value = $value['ID'] ?? null;
1654 }
1655
1656 return is_numeric($value) ? $value : null;
1657 }
1658
1659 public static function getSettings(array $input, $reload)
1660 {
1661 return array(
1662 'MAXSIZE' => array('TYPE' => 'NUMBER', 'LABEL' => Loc::getMessage('INPUT_FILE_MAXSIZE'), 'MIN' => 0, 'STEP' => 1),
1663 'ACCEPT' => array('TYPE' => 'STRING', 'LABEL' => Loc::getMessage('INPUT_FILE_ACCEPT' ), 'PLACEHOLDER' => 'png, doc, zip'),
1664 );
1665 }
1666}
1667
1668Manager::register('FILE', array(
1669 'CLASS' => __NAMESPACE__.'\File',
1670 'NAME' => Loc::getMessage('INPUT_FILE'),
1671));
1672
1676class Date extends Base
1677{
1678 public static function getEditHtmlSingle($name, array $input, $value)
1679 {
1680 $showTime = $input['TIME'] == 'Y';
1681
1682 // TODO HTML5 input="date|datetime|datetime-local" & min & max & step(date:integer|datetime..:float)
1683
1684 $textAttributes = static::extractAttributes($input,
1685 array('DISABLED'=>'', 'AUTOCOMPLETE'=>'on', 'AUTOFOCUS'=>'', 'READONLY'=>'', 'REQUIRED'=>''),
1686 array('FORM'=>1, 'LIST'=>1));
1687
1688 $buttonAttributes = static::extractAttributes($input, array('DISABLED'=>''), array(), false);
1689
1690 return '<input type="text" name="'.$name.'" size="'.($showTime ? 20 : 10).'" value="'.htmlspecialcharsbx($value).'"'.$textAttributes.'>'
1691 .'<input type="button" value="'.Loc::getMessage('INPUT_DATE_SELECT').'"'.$buttonAttributes.' onclick="'
1692 ."BX.calendar({node:this, field:'$name', form:'', bTime:".($showTime ? 'true' : 'false').", bHideTime:false});"
1693 .'">';
1694 }
1695
1702 public static function getFilterEditHtml($name, array $input, $value)
1703 {
1704 return static::getEditHtmlSingle($name, $input, $value);
1705 }
1706
1707 public static function getEditHtmlSingleDelete($name, array $input)
1708 {
1709 return '<label> '.Loc::getMessage('INPUT_DELETE').' <input type="checkbox" onclick="'
1710
1711 ."var disabled = this.checked;"
1712 ."var button = this.parentNode.previousSibling;"
1713 ."button.disabled = disabled;"
1714 ."button.previousSibling.disabled = disabled;"
1715
1716 .'"> </label>';
1717 }
1718
1719 public static function getErrorSingle(array $input, $value)
1720 {
1721 return CheckDateTime($value, FORMAT_DATE)
1722 ? array()
1723 : array('INVALID' => Loc::getMessage('INPUT_INVALID_ERROR'));
1724 }
1725
1726 static function getSettings(array $input, $reload)
1727 {
1728 return array(
1729 'TIME' => array('TYPE' => 'Y/N', 'LABEL' => Loc::getMessage('INPUT_DATE_TIME'), 'ONCLICK' => $reload),
1730 // TODO min, max, step
1731 );
1732 }
1733}
1734
1735Manager::register('DATE', array(
1736 'CLASS' => __NAMESPACE__.'\Date',
1737 'NAME' => Loc::getMessage('INPUT_DATE'),
1738));
1739
1743class Location extends Base
1744{
1745 public static function getViewHtmlSingle(array $input, $value)
1746 {
1747 if((string) $value == '')
1748 return '';
1749
1750 try
1751 {
1753 'select' => array('CHAIN' => 'NAME.NAME'),
1754 'filter' => array('NAME.LANGUAGE_ID' => LANGUAGE_ID),
1755 ));
1756
1757 $path = array();
1758
1759 while($row = $result->fetch())
1760 $path[] = $row['CHAIN'];
1761
1762 return htmlspecialcharsbx(implode(', ', $path));
1763 }
1764 catch(\Bitrix\Main\SystemException $e)
1765 {
1766 return '';
1767 }
1768 }
1769
1776 public static function getFilterEditHtml($name, array $input, $value)
1777 {
1778 return static::getEditHtml($name, $input, $value);
1779 }
1780
1781 public static function getEditHtml($name, array $input, $value = null)
1782 {
1784
1785 $input['DISABLED'] ??= 'N';
1786
1787 if ($value === null && isset($input['VALUE']))
1788 {
1789 $value = $input['VALUE'];
1790 }
1791
1792 $html = '';
1793
1794 if (isset($input['HIDDEN']) && ($input['HIDDEN'] === 'Y' || $input['HIDDEN'] === true))
1795 {
1796 $html .= static::getHiddenRecursive($name
1797 , (isset($input['MULTIPLE']) && $input['MULTIPLE'] === 'Y') ? static::asMultiple($value) : static::asSingle($value)
1798 , static::extractAttributes($input, array('DISABLED'=>''), array('FORM'=>1), false));
1799 }
1800 else
1801 {
1802 $selector = md5("location input selector $name");
1803 $input["LOCATION_SELECTOR"] = $selector;
1804
1805 if ($onChange = $input['ONCHANGE'])
1806 {
1807 $functionName = 'OnLocationChange'.$selector;
1808 $html .= "<script>function $functionName (){ $onChange }; BX.proxy($functionName, this);</script>";
1809 $input['JS_CALLBACK'] = $functionName;
1810 }
1811 else
1812 {
1813 $input['JS_CALLBACK'] = null;
1814 }
1815
1816 if (isset($input['MULTIPLE']) && $input['MULTIPLE'] === 'Y')
1817 {
1818 $tag = isset($input['MULTITAG']) ? htmlspecialcharsbx($input['MULTITAG']) : static::MULTITAG;
1819 [$startTag, $endTag] = $tag ? array("<$tag>", "</$tag>") : array('', '');
1820
1821 $index = -1;
1822
1823 $values = static::asMultiple($value);
1824 if (empty($value))
1825 {
1826 $values = array(null);
1827 }
1828 foreach ($values as $value)
1829 $html .= $startTag
1830 .static::getEditHtmlSingle($name.'['.(++$index).']', $input, $value)
1831 .$endTag;
1832
1833 $replace = '##INPUT##NAME##';
1834
1835 if ($input['DISABLED'] !== 'Y') // TODO
1836 $html .= static::getEditHtmlInsert($tag, $replace, $name
1837 , static::getEditHtmlSingle($replace, $input, null)
1838 , "var location = BX.locationSelectors['$selector'].spawn(container, {selectedItem: false, useSpawn: false});"
1839 ."location.clearSelected();"
1840 //."location.focus();" // TODO
1841 );
1842 }
1843 else
1844 {
1845 $html .= static::getEditHtmlSingle($name, $input, static::asSingle($value));
1846 }
1847 }
1848
1849 if (isset($input['ADDITIONAL_HIDDEN']) && $input['ADDITIONAL_HIDDEN'] === 'Y')
1850 {
1851 $html .= static::getHiddenRecursive($name
1852 , (isset($input['MULTIPLE']) && $input['MULTIPLE'] === 'Y') ? static::asMultiple($value) : static::asSingle($value)
1853 , static::extractAttributes($input, array(), array('FORM'=>1), false));
1854 }
1855
1856 return $html;
1857 }
1858
1859 public static function getEditHtmlSingle($name, array $input, $value)
1860 {
1861 $filterMode = isset($input['IS_FILTER_FIELD']) && $input['IS_FILTER_FIELD'] === true;
1862 $isSearchLine = isset($input['IS_SEARCH_LINE']) && $input['IS_SEARCH_LINE'] === true;
1863 $parameters = array(
1864 'CODE' => $value,
1865 'INPUT_NAME' => $name,
1866 'PROVIDE_LINK_BY' => 'code',
1867 'SELECT_WHEN_SINGLE' => 'N',
1868 'FILTER_BY_SITE' => 'N',
1869 'SHOW_DEFAULT_LOCATIONS' => 'N',
1870 'SEARCH_BY_PRIMARY' => 'N',
1871 'JS_CONTROL_GLOBAL_ID' => $input["LOCATION_SELECTOR"],
1872 'JS_CALLBACK' => $input['JS_CALLBACK']
1873 );
1874
1875 ob_start();
1876
1877 if($filterMode)
1878 {
1879 print('<div style="width: 100%; margin-left: 12px">');
1880 $parameters['INITIALIZE_BY_GLOBAL_EVENT'] = 'onAdminFilterInited'; // this allows js logic to be initialized after admin filter
1881 $parameters['GLOBAL_EVENT_SCOPE'] = 'window';
1882 }
1883
1884 $GLOBALS['APPLICATION']->IncludeComponent(
1885 'bitrix:sale.location.selector.'.($filterMode || $isSearchLine ? 'search' : \Bitrix\Sale\Location\Admin\Helper::getWidgetAppearance()),
1886 '',
1887 $parameters,
1888 false
1889 );
1890
1891 if($filterMode)
1892 {
1893 print('</div>');
1894 }
1895
1896 $html = ob_get_contents();
1897 ob_end_clean();
1898
1899 return $html;
1900 }
1901
1902 public static function getErrorSingle(array $input, $value)
1903 {
1904 return \Bitrix\Sale\Location\LocationTable::getByCode($value)->fetch()
1905 ? array()
1906 : array('INVALID' => Loc::getMessage('INPUT_INVALID_ERROR'));
1907 }
1908}
1909
1910Manager::register('LOCATION', array(
1911 'CLASS' => __NAMESPACE__.'\Location',
1912 'NAME' => Loc::getMessage('INPUT_LOCATION'),
1913));
1914
1919class Address extends Base
1920{
1924 static function isMultiple($value)
1925 {
1926 return false;
1927 }
1928
1932 public static function hasMultipleValuesSupport()
1933 {
1934 return false;
1935 }
1936
1942 public static function getViewHtml(array $input, $value = null)
1943 {
1944 if (!is_array($value) || !Loader::includeModule('location'))
1945 {
1946 return '';
1947 }
1948
1949 $address = \Bitrix\Location\Entity\Address::fromArray($value);
1950
1951 return $address->toString(
1952 FormatService::getInstance()->findDefault(LANGUAGE_ID)
1953 );
1954 }
1955
1959 public static function getFilterEditHtml($name, array $input, $value)
1960 {
1961 //not implemented
1962 return '';
1963 }
1964
1970 public static function getErrorSingle(array $input, $value)
1971 {
1972 $input['REQUIRED'] ??= 'N';
1973 $input['NAME'] ??= $input['LABEL'];
1974 $input['NAME'] ??= '';
1975
1976 if ($input['REQUIRED'] === 'Y')
1977 {
1978 if (!(is_array($value) && !empty($value)))
1979 {
1980 return [
1981 'REQUIRED' => isset($input['NAME'])
1982 ? Loc::getMessage('INPUT_REQUIRED_ERROR_MSGVER_1', ['#NAME#' => $input['NAME']])
1983 : Loc::getMessage('INPUT_REQUIRED_ERROR_WITHOUT_FIELD_TITLE'),
1984 ];
1985 }
1986 }
1987
1988 return [];
1989 }
1990
1996 public static function getRequiredError(array $input, $value)
1997 {
1998 return static::getErrorSingle($input, $value);
1999 }
2000
2004 public static function getEditHtmlSingle($name, array $input, $value)
2005 {
2006 if (!Loader::includeModule('location'))
2007 {
2008 return '';
2009 }
2010
2011 $input['DISABLED'] ??= 'N';
2012
2013 \Bitrix\Main\UI\Extension::load('sale.address');
2014
2015 ob_start();
2016 ?>
2017 <script>
2018 if (BX.Sale.AddressControlConstructor)
2019 {
2020 new BX.Sale.AddressControlConstructor(
2021 {
2022 propsData: {
2023 name: '<?=$name?>',
2024 initValue: <?=(is_array($value)) ? ("'" . \Bitrix\Location\Entity\Address::fromArray($value)->toJson() . "'") : Json::encode(null)?>,
2025 isLocked: <?=($input['DISABLED'] === 'Y' ? 'true' : 'false'); ?>,
2026 onChangeCallback: function () {
2027 <?if (isset($input['ONCHANGE'])):?>
2028 <?=$input['ONCHANGE']?>
2029 <?endif;?>
2030 }
2031 }
2032 }
2033 ).$mount('#<?=$name?>');
2034 }
2035 </script>
2036 <?
2037 $script = ob_get_clean();
2038
2039 return '
2040 <div id="' . $name . '"></div>
2041 ' . $script . '
2042 ';
2043 }
2044}
2045
2046if (Loader::includeModule('location'))
2047{
2048 Manager::register('ADDRESS', array(
2049 'CLASS' => __NAMESPACE__.'\Address',
2050 'NAME' => Loc::getMessage('INPUT_ADDRESS'),
2051 ));
2052}
2053
2055{
2056
2063 public static function getViewHtml(array $input, $values = null) : string
2064 {
2065 if (!is_array($values))
2066 {
2067 return '';
2068 }
2069
2070 $result = '<br><br>';
2071 $catList = self::getCategoriesList($values);
2072
2073 foreach ($catList as $catName)
2074 {
2075 $result .= "<div> - {$catName}</div>";
2076 }
2077
2078 return $result;
2079 }
2080
2088 public static function getEditHtml($name, array $input, $values = null) : string
2089 {
2090 if (!is_array($values))
2091 {
2092 $values = [];
2093 }
2094
2095 $addInputTranslate = Loc::getMessage('SALE_PRODUCT_CATEGORY_INP_ADD');
2096 $deleteInputTranslate = Loc::getMessage('SALE_PRODUCT_CATEGORY_INP_DELETE');
2097
2098 $openFilterButtonId = $input['ID'];
2099
2100 $deprecatedSupport = isset($input['SCRIPT']) && isset($input['URL']);
2101 if ($deprecatedSupport)
2102 {
2103 $url = $input['URL'];
2104 $addCategoryScript = $input['SCRIPT'];
2105 $input['ID'] = 'sale-admin-delivery-restriction-cat';
2106 }
2107 else
2108 {
2109 $addCategoryScript = "window.InS".md5('SECTIONS_IDS')."=function(id, name){{$input['JS_HANDLER']}.addRestrictionProductSection(id, name, '{$input['ID']}', this);};";
2110 $url = 'cat_section_search.php?lang=' . LANGUAGE_ID . '&m=y&n=SECTIONS_IDS';
2111 }
2112
2113 $editSection = "
2114 <br>
2115 <a
2116 class='adm-s-restriction-open-dialog-link'
2117 href='javascript:void(0);'
2118 id='{$openFilterButtonId}'
2119 onclick=\"window.open('{$url}','choose category', 'width=850, height=600');\"
2120 >
2121 {$addInputTranslate}
2122 </a>
2123 <br><br>
2124 <script>
2125 {$addCategoryScript}
2126 BX.message({SALE_PRODUCT_CATEGORY_INP_DELETE: '{$deleteInputTranslate}'});
2127 </script>
2128 ";
2129
2130 $catList = self::getCategoriesList($values);
2131 $existCatHtml = "<table id='{$input['ID']}-content' width='100%'>";
2132
2133 foreach ($catList as $catId => $catName)
2134 {
2135 if ($deprecatedSupport)
2136 {
2137 $deleteNodeScript = "BX.Sale.Delivery.deleteRestrictionProductSection('{$catId}');";
2138 }
2139 else
2140 {
2141 $deleteNodeScript = "{$input['JS_HANDLER']}.deleteRestrictionProductSection('{$catId}', '{$input['ID']}');";
2142 }
2143
2144 $existCatHtml .= "
2145 <tr class='adm-s-product-category-restriction-delcat' id='{$input['ID']}-{$catId}'>
2146 <td>
2147 <span> - {$catName}</span>
2148 <input type='hidden' name='RESTRICTION[CATEGORIES][]' value='{$catId}'>
2149 </td>
2150 <td align='right'>
2151 &nbsp;
2152 <a
2153 class='adm-s-bus-morelinkqhsw'
2154 href='javascript:void(0);'
2155 onclick=\"{$deleteNodeScript}\"
2156 >
2157 {$deleteInputTranslate}
2158 </a>
2159 </td>
2160 </tr>
2161 ";
2162 }
2163
2164 $existCatHtml .= '</table>';
2165
2166 return $existCatHtml.$editSection;
2167 }
2168
2174 protected static function getCategoriesList($ids) : array
2175 {
2176 if(!\Bitrix\Main\Loader::includeModule('iblock'))
2177 return [];
2178
2179 $result = [];
2180
2182 'filter' => [
2183 'ID' => $ids,
2184 ],
2185 'select' => ['ID', 'NAME'],
2186 ]);
2187
2188 while($section = $res->fetch())
2189 $result[$section['ID']] = htmlspecialcharsbx($section['NAME']);
2190
2191 return $result;
2192 }
2193
2194 public static function getValueSingle(array $input, $userValue)
2195 {
2196 return $userValue;
2197 }
2198
2199 public static function getError(array $input, $values)
2200 {
2201 return self::getErrorSingle($input, $values);
2202 }
2203
2204 public static function getErrorSingle(array $input, $values)
2205 {
2206 return [];
2207 }
2208
2209 public static function getSettings(array $input, $reload)
2210 {
2211 return [];
2212 }
2213}
2214
2216 'PRODUCT_CATEGORIES',
2217 [
2218 'CLASS' => __NAMESPACE__.'\ProductCategories',
2219 'NAME' => Loc::getMessage('SALE_PRODUCT_CATEGORY_INP'),
2220 ]
2221);
2222
2224{
2230 public static function getViewHtml(array $input, $values = null) : string
2231 {
2232 if (!is_array($values))
2233 {
2234 return '';
2235 }
2236
2237 $result = '<br><br>';
2238
2239 $productList = self::getProductsList($values);
2240
2241 foreach ($productList as $productName)
2242 {
2243 $result .= "<div> - {$productName}</div>";
2244 }
2245
2246 return $result;
2247 }
2248
2256 public static function getEditHtml($name, array $input, $values = null) : string
2257 {
2258 if (!is_array($values))
2259 {
2260 $values = [];
2261 }
2262
2263 $nodeId = &$input['ID'];
2264
2265 $input['FORM_NAME'] = md5($input['FORM_NAME']);
2266 $url = "cat_product_search.php?func_name={$input['FORM_NAME']}&new_value=Y";
2267 $addProductScript = "window.".$input['FORM_NAME']."=function(id, name, url){".$input["JS_HANDLER"].".addRestrictionByConcreteProduct('".$nodeId."', id, name, this);};";
2268
2269 $addInputTranslate = Loc::getMessage('SALE_CONCRETE_PRODUCT_INP_ADD');
2270 $deleteInputTranslate = Loc::getMessage('SALE_CONCRETE_PRODUCT_INP_DELETE');
2271
2272 $editSection = "
2273 <br>
2274 <a
2275 class='adm-s-restriction-open-dialog-link'
2276 href='javascript:void(0);'
2277 id='{$input["ID"]}'
2278 onclick=\"window.open('{$url}', 'choose product', 'width=850,height=600');\"
2279 >
2280 {$addInputTranslate}
2281 </a>
2282 <br><br>
2283 <script>
2284 {$addProductScript}
2285 BX.message({SALE_CONCRETE_PRODUCT_INP_DELETE: '$deleteInputTranslate'});
2286 </script>";
2287
2288 $productsList = self::getProductsList($values);
2289 $existProductsHtml = "<table id='{$nodeId}-content' width='100%'>";
2290
2291 foreach ($productsList as $productId => $productName)
2292 {
2293 $existProductsHtml .= "
2294 <tr class='adm-s-concrete-product-restriction-delprod' id='{$nodeId}-{$productId}'>
2295 <td>
2296 <span> - {$productName}</span>
2297 <input type='hidden' name='RESTRICTION[PRODUCTS][]' value='{$productId}'>
2298 </td>
2299 <td align='right'>
2300 &nbsp;
2301 <a
2302 class='adm-s-bus-morelinkqhsw' href='javascript:void(0);'
2303 onclick=\"{$input["JS_HANDLER"]}.deleteRestrictionByConcreteProduct('{$nodeId}', '{$productId}');\"
2304 >
2305 {$deleteInputTranslate}
2306 </a>
2307 </td>
2308 </tr>
2309 ";
2310 }
2311
2312 $existProductsHtml .= "</table>";
2313
2314 return $existProductsHtml.$editSection;
2315 }
2316
2317 protected static function getProductsList($elementIds)
2318 {
2319 if (!\Bitrix\Main\Loader::includeModule('iblock'))
2320 {
2321 return [];
2322 }
2323
2324 $productsList = [];
2325
2326 $productsListSource = \Bitrix\Iblock\ElementTable::getList([
2327 'filter' => [
2328 'ID' => $elementIds,
2329 ],
2330 'select' => [
2331 'ID',
2332 'NAME',
2333 ],
2334 ]);
2335
2336 while ($productRow = $productsListSource->fetch())
2337 {
2338 $productsList[$productRow['ID']] = htmlspecialcharsbx($productRow['NAME']);
2339 }
2340
2341 return $productsList;
2342 }
2343
2344 public static function getValueSingle(array $input, $userValue)
2345 {
2346 return $userValue;
2347 }
2348
2349 public static function getError(array $input, $value)
2350 {
2351 return self::getErrorSingle($input, $value);
2352 }
2353
2354 public static function getErrorSingle(array $input, $value)
2355 {
2356 return [];
2357 }
2358
2359 public static function getSettings(array $input, $reload)
2360 {
2361 return [];
2362 }
2363}
2364
2366 'CONCRETE_PRODUCT',
2367 [
2368 'CLASS' => __NAMESPACE__.'\\ConcreteProduct',
2369 'NAME' => Loc::getMessage('SALE_CONCRETE_PRODUCT_INP'),
2370 ]
2371);
$path
Определения access_edit.php:21
$type
Определения options.php:106
static getInstance()
Определения baseservice.php:21
Определения event.php:5
Определения loader.php:13
static getList(array $parameters=array())
Определения datamanager.php:431
static load($extNames)
Определения extension.php:16
Определения json.php:9
static isMultiple($value)
Определения input.php:1924
static hasMultipleValuesSupport()
Определения input.php:1932
static getRequiredError(array $input, $value)
Определения input.php:1996
static getEditHtmlSingle($name, array $input, $value)
Определения input.php:2004
static getFilterEditHtml($name, array $input, $value)
Определения input.php:1959
static getErrorSingle(array $input, $value)
Определения input.php:1970
static getViewHtml(array $input, $value=null)
Определения input.php:1942
static getValue(array $input, $value)
Определения input.php:608
static isMultiple($value)
Определения input.php:339
static getSettings(array $input, $reload)
Определения input.php:644
static getViewHtmlSingle(array $input, $value)
Определения input.php:403
static hasMultipleValuesSupport()
Определения input.php:739
static getEditHtml($name, array $input, $value=null)
Определения input.php:414
static extractAttributes(array $input, array $boolean, array $other, $withGlobal=true)
Определения input.php:669
static asMultiple($value)
Определения input.php:366
static getHiddenRecursive($name, $value, $attributes)
Определения input.php:651
static getRequiredError(array $input, $value)
Определения input.php:549
static getEditHtmlSingle($name, array $input, $value)
Определения input.php:475
static asSingle($value)
Определения input.php:348
static getEditHtmlSingleDelete($name, array $input)
Определения input.php:480
static getValueSingle(array $input, $value)
Определения input.php:639
static getEditHtmlSingleAfterInsert()
Определения input.php:504
const MULTITAG
Определения input.php:333
static getErrorSingle(array $input, $value)
Определения input.php:603
static getError(array $input, $value)
Определения input.php:509
static getEditHtmlInsert($tag, $replace, $name, $sample, $after)
Определения input.php:489
static getViewHtml(array $input, $value=null)
Определения input.php:378
static getSettings(array $input, $reload)
Определения input.php:2359
static getViewHtml(array $input, $values=null)
Определения input.php:2230
static getValueSingle(array $input, $userValue)
Определения input.php:2344
static getProductsList($elementIds)
Определения input.php:2317
static getEditHtml($name, array $input, $values=null)
Определения input.php:2256
static getErrorSingle(array $input, $value)
Определения input.php:2354
static getError(array $input, $value)
Определения input.php:2349
static getSettings(array $input, $reload)
Определения input.php:1726
static getEditHtmlSingle($name, array $input, $value)
Определения input.php:1678
static getEditHtmlSingleDelete($name, array $input)
Определения input.php:1707
static getFilterEditHtml($name, array $input, $value)
Определения input.php:1702
static getErrorSingle(array $input, $value)
Определения input.php:1719
static getViewHtmlSingle(array $input, $value)
Определения input.php:1007
static getRequiredError(array $input, $value)
Определения input.php:1078
static getEditHtmlSingle($name, array $input, $value)
Определения input.php:1012
static getValueSingle(array $input, $value)
Определения input.php:1073
static getFilterEditHtml($name, array $input, $value)
Определения input.php:1036
static getErrorSingle(array $input, $value)
Определения input.php:1049
static getSettings(array $input, $reload)
Определения input.php:1284
static getViewHtmlSingle(array $input, $value)
Определения input.php:1132
static getEditHtml($name, array $input, $value=null)
Определения input.php:1160
static getFilterEditHtml($name, array $input, $value)
Определения input.php:1155
static getErrorSingle(array $input, $value)
Определения input.php:1266
static isMultiple($value)
Определения input.php:1452
static getSettings(array $input, $reload)
Определения input.php:1659
static isUploadedSingle($value)
Определения input.php:1439
static getViewHtmlSingle(array $input, $value)
Определения input.php:1473
static isDeletedSingle($value)
Определения input.php:1430
static getEditHtmlSingle($name, array $input, $value)
Определения input.php:1526
static getPostWithFiles(array $post, array $files)
Определения input.php:1345
static loadInfoSingle($file)
Определения input.php:1401
static getEditHtmlSingleDelete($name, array $input)
Определения input.php:1567
static getValueSingle(array $input, $value)
Определения input.php:1644
static getFilterEditHtml($name, array $input, $value)
Определения input.php:1521
static getErrorSingle(array $input, $value)
Определения input.php:1572
static loadInfo($value)
Определения input.php:1389
static getViewHtmlSingle(array $input, $value)
Определения input.php:1745
static getEditHtml($name, array $input, $value=null)
Определения input.php:1781
static getEditHtmlSingle($name, array $input, $value)
Определения input.php:1859
static getFilterEditHtml($name, array $input, $value)
Определения input.php:1776
static getErrorSingle(array $input, $value)
Определения input.php:1902
static getValue(array $input, $value)
Определения input.php:163
static getSettings(array $input, $reload=null)
Определения input.php:197
static getTypes()
Определения input.php:266
static getEditHtml($name, array $input, $value=null)
Определения input.php:88
static asMultiple(array $input, $value)
Определения input.php:180
static register($name, array $type)
Определения input.php:282
static $initialized
Определения input.php:302
static getRequiredError(array $input, $value)
Определения input.php:141
static $types
Определения input.php:62
static initJs()
Определения input.php:18
static getFilterEditHtml($name, array $input, $value=null)
Определения input.php:106
static getError(array $input, $value)
Определения input.php:123
static getViewHtml(array $input, $value=null)
Определения input.php:70
static getSettings(array $input, $reload)
Определения input.php:987
static getEditHtmlSingle($name, array $input, $value)
Определения input.php:899
static getFilterEditHtml($name, array $input, $value)
Определения input.php:944
static getErrorSingle(array $input, $value)
Определения input.php:949
static getCategoriesList($ids)
Определения input.php:2174
static getSettings(array $input, $reload)
Определения input.php:2209
static getErrorSingle(array $input, $values)
Определения input.php:2204
static getViewHtml(array $input, $values=null)
Определения input.php:2063
static getValueSingle(array $input, $userValue)
Определения input.php:2194
static getEditHtml($name, array $input, $values=null)
Определения input.php:2088
static getError(array $input, $values)
Определения input.php:2199
static getSettings(array $input, $reload)
Определения input.php:855
static isDeletedSingle($value)
Определения input.php:882
static getEditHtmlSingle($name, array $input, $value)
Определения input.php:752
static getFilterEditHtml($name, array $input, $value)
Определения input.php:794
static getErrorSingle(array $input, $value)
Определения input.php:799
static $patternDelimiters
Определения input.php:750
static getPathToNodeByCode($code, $parameters, $behaviour=array('SHOW_LEAF'=> true))
Определения location.php:376
static Init($arExt=array(), $bReturn=false)
Определения jscore.php:66
static RegisterExt($name, $arPaths)
Определения jscore.php:28
$options
Определения commerceml2.php:49
$content
Определения commerceml.php:144
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_NEW_TAGS")?> array( $site)
Определения file_new.php:804
$res
Определения filter_act.php:7
$result
Определения get_property_values.php:14
$errors
Определения iblock_catalog_edit.php:74
$output
Определения options.php:436
endif
Определения csv_new_setup.php:990
const BX_RESIZE_IMAGE_PROPORTIONAL
Определения constants.php:11
const FORMAT_DATE
Определения include.php:63
htmlspecialcharsEx($str)
Определения tools.php:2685
htmlspecialcharsbx($string, $flags=ENT_COMPAT, $doubleEncode=true)
Определения tools.php:2701
CheckDateTime($datetime, $format=false)
Определения tools.php:398
$name
Определения menu_edit.php:35
Определения ufield.php:9
$files
Определения mysql_to_pgsql.php:30
$GLOBALS['____1690880296']
Определения license.php:1
$settings
Определения product_settings.php:43
$event
Определения prolog_after.php:141
if( $daysToExpire >=0 &&$daysToExpire< 60 elseif)( $daysToExpire< 0)
Определения prolog_main_admin.php:393
if(empty($signedUserToken)) $key
Определения quickway.php:257
if($inWords) echo htmlspecialcharsbx(Number2Word_Rus(roundEx($totalVatSum $params['CURRENCY']
Определения template.php:799
$post
Определения template.php:8
$option
Определения options.php:1711
if(!Loader::includeModule('sale')) $pattern
Определения index.php:20
$error
Определения subscription_card_product.php:20
$k
Определения template_pdf.php:567
$url
Определения iframe.php:7