26 if (Loader::includeModule(
'location'))
28 \Bitrix\Main\UI\Extension::load(
'sale.address');
31 \CJSCore::RegisterExt(
'input', array(
33 '/bitrix/js/sale/input.js'
35 'lang' =>
'/bitrix/modules/sale/lang/'.LANGUAGE_ID.
'/lib/internals/input.php',
37 \CJSCore::Init(array(
'input'));
39 print(
'<div style="display:none">');
40 $GLOBALS[
'APPLICATION']->IncludeComponent(
"bitrix:sale.location.selector.".\
Bitrix\
Sale\
Location\Admin\LocationHelper::getWidgetAppearance(),
"", array(
43 "INPUT_NAME" =>
'SALE_LOCATION_SELECTOR_RESOURCES',
44 "PROVIDE_LINK_BY" =>
'code',
46 "FILTER_BY_SITE" =>
'Y',
48 "SHOW_DEFAULT_LOCATIONS" =>
'Y',
49 "SEARCH_BY_PRIMARY" =>
'Y',
51 "JS_CONTROL_GLOBAL_ID" =>
'SALE_LOCATION_SELECTOR_RESOURCES',
56 array(
'HIDE_ICONS' =>
'Y')
72 if (! static::$initialized)
75 if ($type = static::$types[$input[
'TYPE']])
76 return call_user_func(array($type[
'CLASS'], __FUNCTION__), $input, $value);
78 throw new SystemException(
'invalid input type in '.print_r($input,
true), 0, __FILE__, __LINE__);
88 static function getEditHtml($name, array $input, $value =
null)
90 if (! static::$initialized)
93 if ($type = static::$types[$input[
'TYPE']])
94 return call_user_func(array($type[
'CLASS'], __FUNCTION__), $name, $input, $value);
96 throw new SystemException(
'invalid input type in '.print_r($input,
true), 0, __FILE__, __LINE__);
108 if (! static::$initialized)
109 static::initialize();
111 if ($type = static::$types[$input[
'TYPE']])
112 return call_user_func(array($type[
'CLASS'], __FUNCTION__), $name, $input, $value);
114 throw new SystemException(
'invalid input type in '.print_r($input,
true), 0, __FILE__, __LINE__);
125 if (! static::$initialized)
126 static::initialize();
128 if ($type = static::$types[$input[
'TYPE']])
129 return call_user_func(array($type[
'CLASS'], __FUNCTION__), $input, $value);
131 throw new SystemException(
'invalid input type in '.print_r($input,
true), 0, __FILE__, __LINE__);
143 if (! static::$initialized)
144 static::initialize();
146 if ($type = static::$types[$input[
'TYPE']])
148 return call_user_func(array($type[
'CLASS'], __FUNCTION__), $input, $value);
152 throw new SystemException(
'invalid input type in '.print_r($input,
true), 0, __FILE__, __LINE__);
165 if (! static::$initialized)
166 static::initialize();
168 if ($type = static::$types[$input[
'TYPE']])
169 return call_user_func(array($type[
'CLASS'], __FUNCTION__), $input, $value);
171 throw new SystemException(
'invalid input type in '.print_r($input,
true), 0, __FILE__, __LINE__);
182 if (! static::$initialized)
183 static::initialize();
185 if ($type = static::$types[$input[
'TYPE']])
186 return call_user_func(array($type[
'CLASS'], __FUNCTION__), $value);
188 throw new SystemException(
'invalid input type in '.print_r($input,
true), 0, __FILE__, __LINE__);
199 if (! static::$initialized)
200 static::initialize();
202 if ($type = static::$types[$input[
'TYPE']])
203 return call_user_func(array($type[
'CLASS'], __FUNCTION__), $input, $reload);
205 throw new SystemException(
'invalid input type in '.print_r($input,
true), 0, __FILE__, __LINE__);
213 static function getCommonSettings(array $input, $reload =
null)
215 if (! static::$initialized)
216 static::initialize();
218 $typeOptions = array();
220 foreach (static::$types as $k => $v)
222 if (in_array($k, [
'PRODUCT_CATEGORIES',
'CONCRETE_PRODUCT']))
227 $typeOptions[$k] = $v[
'NAME'].
" [$k]";
230 $hasMultipleSupport =
true;
231 if (isset(static::$types[$input[
'TYPE']]))
234 $typeClass = static::$types[$input[
'TYPE']][
'CLASS'];
236 if (!$typeClass::hasMultipleValuesSupport())
238 $hasMultipleSupport =
false;
242 $multiple = array(
'TYPE' =>
'Y/N' ,
'LABEL' =>
Loc::getMessage(
'INPUT_MULTIPLE'));
244 if (!$hasMultipleSupport)
246 $multiple[
'DISABLED_YN'] =
'N';
250 $multiple[
'ONCLICK'] = $reload;
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,
268 if (! static::$initialized)
269 static::initialize();
271 return static::$types;
282 static function register($name, array $type)
284 if (isset(static::$types[$name]))
286 throw new SystemException(
'duplicate type '.$name, 0, __FILE__, __LINE__);
289 if (! class_exists($type[
'CLASS']))
291 throw new SystemException(
'undefined CLASS in '.print_r($type,
true), 0, __FILE__, __LINE__);
294 if (! is_subclass_of($type[
'CLASS'], __NAMESPACE__.
'\Base'))
296 throw new SystemException($type[
'CLASS'].
' does not implement Input\Base', 0, __FILE__, __LINE__);
299 static::$types[$name] = $type;
304 protected static function initialize()
306 static::$initialized =
true;
309 $event =
new Event(
'sale',
'registerInputTypes', static::$types);
312 if ($event->getResults())
314 foreach($event->getResults() as $eventResult)
316 if ($eventResult->getType() != EventResult::SUCCESS)
319 if ($params = $eventResult->getParameters())
321 if(!empty($params) && is_array($params))
323 static::$types = array_merge(static::$types, $params);
341 return is_array($value);
350 if (static::isMultiple($value))
354 foreach ($value as $v)
368 if (static::isMultiple($value))
370 return array_diff($value, array(
"", NULL,
false));
374 return $value ===
null ? array() : array($value);
380 if ($value ===
null && isset($input[
'VALUE']))
382 $value = $input[
'VALUE'];
385 if (isset($input[
'MULTIPLE']) && $input[
'MULTIPLE'] ===
'Y')
387 $tag = isset($input[
'MULTITAG']) ? htmlspecialcharsbx($input[
'MULTITAG']) : static::MULTITAG;
388 [$startTag, $endTag] = $tag ? array(
"<$tag>",
"</$tag>") : array(
'',
'');
392 foreach (static::asMultiple($value) as $value)
393 $html .= $startTag.static::getViewHtmlSingle($input, $value).$endTag;
399 return static::getViewHtmlSingle($input, static::asSingle($value));
405 $output = $valueText = htmlspecialcharsbx($value);
406 if (isset($input[
'IS_EMAIL']) && $input[
'IS_EMAIL'] ===
'Y')
408 $output =
'<a href="mailto:'.$valueText.
'">'.$valueText.
'</a>';
414 public static function getEditHtml($name, array $input, $value =
null)
416 $name = htmlspecialcharsbx($name);
418 $input[
'DISABLED'] ??=
'N';
420 if ($value ===
null && isset($input[
'VALUE']))
422 $value = $input[
'VALUE'];
427 if (isset($input[
'HIDDEN']) && ($input[
'HIDDEN'] ===
'Y' || $input[
'HIDDEN'] ===
true))
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));
435 if (isset($input[
'MULTIPLE']) && $input[
'MULTIPLE'] ===
'Y')
437 $tag = isset($input[
'MULTITAG']) ? htmlspecialcharsbx($input[
'MULTITAG']) : static::MULTITAG;
438 [$startTag, $endTag] = $tag ? array(
"<$tag>",
"</$tag>") : array(
'',
'');
442 foreach (static::asMultiple($value) as $value)
444 $namix = $name.
'['.(++$index).
']';
446 .static::getEditHtmlSingle($namix, $input, $value)
447 .static::getEditHtmlSingleDelete($namix, $input)
451 $replace =
'##INPUT##NAME##';
453 if ($input[
'DISABLED'] !==
'Y')
454 $html .= static::getEditHtmlInsert($tag, $replace, $name
455 , static::getEditHtmlSingle($replace, $input,
null).static::getEditHtmlSingleDelete($replace, $input)
456 , static::getEditHtmlSingleAfterInsert());
460 $html .= static::getEditHtmlSingle($name, $input, static::asSingle($value));
464 if (isset($input[
'ADDITIONAL_HIDDEN']) && $input[
'ADDITIONAL_HIDDEN'] ===
'Y')
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));
477 throw new SystemException(
"you must implement [getEditHtmlSingle] or override [getEditHtml] in yor class", 0, __FILE__, __LINE__);
482 return '<label> '.Loc::getMessage(
'INPUT_DELETE').
' <input type="checkbox" onclick="'
484 .
"this.parentNode.previousSibling.disabled = this.checked;"
491 $name = \CUtil::JSEscape($name);
492 $sample = \CUtil::JSEscape(htmlspecialcharsbx($sample));
494 return '<input type="button" value="'.Loc::getMessage(
'INPUT_ADD').
'" onclick="'
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);"
506 return "container.firstChild.focus();";
509 public static function getError(array $input, $value)
512 if ($value ===
null && isset($input[
'VALUE']))
514 $value = $input[
'VALUE'];
517 if (isset($input[
'MULTIPLE']) && $input[
'MULTIPLE'] ===
'Y')
522 foreach (static::asMultiple($value) as $value)
524 if (($value !==
'' && $value !==
null) && ($error = static::getErrorSingle($input, $value)))
526 $errors[++$index] = $error;
532 $value = static::asSingle($value);
534 if ($value !==
'' && $value !==
null)
536 return static::getErrorSingle($input, $value);
553 $input[
'REQUIRED'] ??=
'N';
554 $input[
'MULTIPLE'] ??=
'N';
556 if ($value ===
null && isset($input[
'VALUE']))
558 $value = $input[
'VALUE'];
565 if ($input[
'MULTIPLE'] ===
'Y')
567 if ($input[
'REQUIRED'] ===
'Y')
569 foreach (static::asMultiple($value) as $value)
571 if ($value ===
'' || $value ===
null)
573 $errors = $requireError;
581 $value = static::asSingle($value);
583 if ($value ===
'' || $value ===
null)
585 if ($input[
'REQUIRED'] ===
'Y')
587 $errors = $requireError;
603 throw new SystemException(
"you must implement [getErrorSingle] or override [getError] in yor class", 0, __FILE__, __LINE__);
606 public static function getValue(array $input, $value)
608 if (isset($input[
'DISABLED']) && $input[
'DISABLED'] ===
'Y')
615 $value = $input[
'VALUE'] ??
null;
618 if (isset($input[
'MULTIPLE']) && $input[
'MULTIPLE'] ===
'Y')
622 foreach (static::asMultiple($value) as $value)
624 $value = static::getValueSingle($input, $value);
629 return $values ? $values :
null;
633 return static::getValueSingle($input, static::asSingle($value));
651 if (is_array($value))
655 foreach ($value as $k => $v)
662 return '<input type="hidden" name="'.$name.
'" value="'.htmlspecialcharsbx($value).
'"'.$attributes.
'>';
667 protected static function extractAttributes(array $input, array $boolean, array $other, $withGlobal =
true)
673 unset($boolean[
'REQUIRED']);
675 static $globalBoolean = array(
'CONTENTEDITABLE'=>
'',
'DRAGGABLE'=>
'true',
'SPELLCHECK'=>
'',
'TRANSLATE'=>
'yes');
678 $boolean = $globalBoolean + $boolean;
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].
'"' :
'');
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,
699 $events = array_intersect_key($input, $globalEvents);
700 $other = array_diff_key($other, $events);
702 foreach ($events as $k => $v)
704 $string .=
' '.mb_strtolower($k).
'="'.$v.
'"';
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
716 $other += $globalOther;
718 foreach (array_intersect_key($input, $other) as $k => $v)
720 $string .=
' '.mb_strtolower($k).
'="'.htmlspecialcharsbx($v).
'"';
723 if ($withGlobal && isset($input[
'DATA']) && is_array($input[
'DATA']))
725 foreach ($input[
'DATA'] as $k => $v)
727 $string .=
' data-'.htmlspecialcharsbx($k).
'="'.htmlspecialcharsbx($v).
'"';
752 $input = self::prepareIntFields($input);
753 if (isset($input[
'MULTILINE']) && $input[
'MULTILINE'] ===
'Y')
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));
759 return '<textarea name="'.$name.
'"'.$attributes.
'>'.htmlspecialcharsbx($value).
'</textarea>';
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));
767 return '<input type="text" name="'.$name.
'" value="'.htmlspecialcharsbx($value).
'"'.$attributes.
'>';
771 private static function prepareIntFields(array $input): array
773 $intFields = [
'SIZE',
'ROWS',
'COLS'];
774 foreach ($intFields as $field)
776 $input[$field] = (int)($input[$field] ?? 0);
777 if ($input[$field] <= 0)
779 unset($input[$field]);
794 return static::getEditHtmlSingle($name, $input, $value);
801 $value = trim($value);
803 $minLength = isset($input[
'MINLENGTH']) && is_numeric($input[
'MINLENGTH']) ? (int)$input[
'MINLENGTH'] : 0;
804 if ($minLength > 0 && mb_strlen($value) < $minLength)
806 $errors[
'MINLENGTH'] =
Loc::getMessage(
'INPUT_STRING_MINLENGTH_ERROR', [
'#NUM#' => $minLength]);
809 $maxLength = isset($input[
'MAXLENGTH']) && is_numeric($input[
'MAXLENGTH']) ? (int)$input[
'MAXLENGTH'] : 0;
810 if ($maxLength > 0 && mb_strlen($value) > $maxLength)
812 $errors[
'MAXLENGTH'] =
Loc::getMessage(
'INPUT_STRING_MAXLENGTH_ERROR', [
'#NUM#' => $maxLength]);
816 (
string)($input[
'PATTERN'] ??
'')
820 $issetDelimiter =
false;
822 if (isset($pattern[0]) && in_array($pattern[0], static::$patternDelimiters) && mb_strrpos($pattern, $pattern[0]) !==
false)
824 $issetDelimiter =
true;
827 $matchPattern = $pattern;
828 if (!$issetDelimiter)
830 $matchPattern =
"/".$pattern.
"/";
833 $pregMatchResult =
null;
836 $pregMatchResult = preg_match($matchPattern, $value);
838 catch (\Exception $e)
843 if (!$pregMatchResult)
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),
862 if (isset($input[
'MULTILINE']) && $input[
'MULTILINE'] ===
'Y')
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);
869 $settings[
'SIZE'] = array(
'TYPE' =>
'NUMBER',
'LABEL' =>
Loc::getMessage(
'INPUT_STRING_SIZE'),
'MIN' => 0,
'STEP' => 1);
882 return is_array($value) && isset($value[
'DELETE']);
888 'CLASS' => __NAMESPACE__.
'\StringInput',
904 (
string)($input[
'MIN'] ??
'')
912 (
string)($input[
'MAX'] ??
'')
920 (
string)($input[
'STEP'] ??
'')
927 $input[
'SIZE'] = $size;
929 $attributes = static::extractAttributes($input,
930 array(
'DISABLED'=>
'',
'READONLY'=>
'',
'AUTOFOCUS'=>
'',
'REQUIRED'=>
'',
'AUTOCOMPLETE'=>
'on'),
931 array(
'FORM'=>1,
'LIST'=>1,
'PLACEHOLDER'=>1,
'SIZE'=>1));
933 return '<input type="text" name="'.$name.
'" value="'.htmlspecialcharsbx($value).
'"'.$attributes.
'>';
944 return static::getEditHtmlSingle($name, $input, $value);
951 if (is_numeric($value))
953 $value = (double) $value;
955 if (!empty($input[
'MIN']) && $value < $input[
'MIN'])
956 $errors[
'MIN'] =
Loc::getMessage(
'INPUT_NUMBER_MIN_ERROR', array(
"#NUM#" => $input[
'MIN']));
958 if (!empty($input[
'MAX']) && $value > $input[
'MAX'])
959 $errors[
'MAX'] =
Loc::getMessage(
'INPUT_NUMBER_MAX_ERROR', array(
"#NUM#" => $input[
'MAX']));
961 if (!empty($input[
'STEP']))
963 $step = (double) $input[
'STEP'];
965 $value = (double) abs($value - ($input[
'MIN'] ? $input[
'MIN'] : 0.0));
967 if (! ($value / pow(2.0, 53) > $step))
969 $remainder = (double) abs($value - $step * round($value / $step));
970 $acceptableError = (double) ($step / pow(2.0, 24));
972 if ($acceptableError < $remainder && ($step - $acceptableError) > $remainder)
973 $errors[
'STEP'] =
Loc::getMessage(
'INPUT_NUMBER_STEP_ERROR', array(
"#NUM#" => $input[
'STEP']));
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')),
996 'CLASS' => __NAMESPACE__.
'\Number',
1012 $hiddenAttributes = static::extractAttributes($input, array(
'DISABLED'=>
''), array(
'FORM'=>1),
false);
1013 $checkboxAttributes = static::extractAttributes($input, array(
'DISABLED'=>
'',
'AUTOFOCUS'=>
'',
'REQUIRED'=>
''), array(
'FORM'=>1));
1015 if (isset($input[
'DISABLED_YN']))
1017 return '<input type="hidden" name="'.$name.
'" value="' . (($input[
'DISABLED_YN'] ==
'Y') ?
'Y' :
'N') .
'">'
1018 .
'<input type="checkbox" '.($input[
'DISABLED_YN'] ==
'Y' ?
' checked' :
'').
'disabled'.
'>';
1022 return '<input type="hidden" name="'.$name.
'" value="N"'.$hiddenAttributes.
'>'
1023 .
'<input type="checkbox" name="'.$name.
'" value="Y"'.($value ==
'Y' ?
' checked' :
'').$checkboxAttributes.
'>';
1036 $hiddenAttributes = static::extractAttributes($input, array(
'DISABLED'=>
''), array(
'FORM'=>1),
false);
1038 $checkboxAttributes = static::extractAttributes($input, array(
'DISABLED'=>
'',
'AUTOFOCUS'=>
'',
'REQUIRED'=>
''), array(
'FORM'=>1));
1040 return '<select name="'.$name.
'" '.$hiddenAttributes.
'>
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>
1049 $input[
'REQUIRED'] ??=
'N';
1051 $input[
'REQUIRED'] ===
'Y'
1052 && ($value ===
'' || $value ===
null)
1061 ($value ===
'N' || $value ===
'Y')
1069 return $value ==
'Y' ?
'Y' :
'N';
1074 $errors = parent::getRequiredError($input, $value);
1075 $input[
'REQUIRED'] ??=
'N';
1080 && $input[
'REQUIRED'] ===
'Y'
1091 'CLASS' => __NAMESPACE__.
'\EitherYN',
1100 private static function flatten(array $array)
1104 foreach ($array as $key => $value)
1106 if (is_array($value))
1108 $result = $result + $value;
1112 $result[$key] = $value;
1121 $options = $input[
'OPTIONS'] ?? [];
1123 if (is_array($options))
1125 $options = self::flatten($options);
1127 if (isset($options[$value]))
1129 $value = $options[$value];
1133 return htmlspecialcharsbx($value);
1144 return static::getEditHtml($name, $input, $value);
1147 public static function getEditHtml($name, array $input, $value =
null)
1149 $options = $input[
'OPTIONS'];
1151 if (! is_array($options))
1154 $multiple = isset($input[
'MULTIPLE']) && $input[
'MULTIPLE'] ===
'Y';
1156 $name = htmlspecialcharsbx($name);
1158 if ($value ===
null && isset($input[
'VALUE']))
1160 $value = $input[
'VALUE'];
1163 $originalValue = $value;
1166 if (isset($input[
'HIDDEN']) && ($input[
'HIDDEN'] ===
'Y' || $input[
'HIDDEN'] ===
true))
1168 $html .= static::getHiddenRecursive($name
1169 , $multiple ? static::asMultiple($value) : static::asSingle($value)
1170 , static::extractAttributes($input, array(
'DISABLED'=>
''), array(
'FORM'=>1),
false));
1174 if ($value ===
null)
1177 $value = $multiple ? array_flip(static::asMultiple($value)) : array(static::asSingle($value) =>
true);
1179 if (isset($input[
'MULTIELEMENT']) && $input[
'MULTIELEMENT'] ===
'Y')
1181 $tag = isset($input[
'MULTITAG']) ? htmlspecialcharsbx($input[
'MULTITAG']) : static::MULTITAG;
1182 [$startTag, $endTag] = $tag ? array(
"<$tag>",
"</$tag>") : array(
'',
'');
1184 $attributes = static::extractAttributes($input, array(
'DISABLED'=>
''), array(
'FORM'=>1),
false);
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
1201 $attributes = static::extractAttributes($input, array(
'DISABLED'=>
'',
'AUTOFOCUS'=>
'',
'REQUIRED'=>
''), array(
'FORM'=>1,
'SIZE'=>1));
1203 $html .=
'<select'.$attributes.
' name="'.$name.($multiple ?
'[]" multiple>' :
'">');
1205 $html .= self::getEditOptionsHtml($options, $value,
' selected',
1206 '<optgroup label="{GROUP}">{OPTIONS}</optgroup>',
1207 '<option value="{VALUE}"{SELECTED}>{TEXT}</option>'
1210 $html .=
'</select>';
1214 if (isset($input[
'ADDITIONAL_HIDDEN']) && $input[
'ADDITIONAL_HIDDEN'] ===
'Y')
1216 $html .= static::getHiddenRecursive($name
1217 , $multiple ? static::asMultiple($originalValue) : static::asSingle($originalValue)
1218 , static::extractAttributes($input, array(), array(
'FORM'=>1),
false));
1224 private static function getEditOptionsHtml(array $options, array $selected, $selector, $group, $option)
1228 foreach ($options as $key => $value)
1230 $result .= is_array($value)
1232 array(
'{GROUP}',
'{OPTIONS}'),
1234 htmlspecialcharsEx($key),
1235 self::getEditOptionsHtml($value, $selected, $selector, $group, $option),
1240 array(
'{VALUE}',
'{SELECTED}',
'{TEXT}'),
1242 htmlspecialcharsEx($key),
1243 isset($selected[$key]) ? $selector :
'',
1244 htmlspecialcharsEx($value) ?: htmlspecialcharsEx($key),
1255 $options = $input[
'OPTIONS'];
1257 if (is_array($options))
1259 $options = self::flatten($options);
1261 return isset($options[$value])
1267 return array(
'OPTIONS' =>
Loc::getMessage(
'INPUT_ENUM_OPTIONS_ERROR'));
1275 'MULTIELEMENT' => array(
'TYPE' =>
'Y/N',
'LABEL' =>
Loc::getMessage(
'INPUT_ENUM_MULTIELEMENT'),
'ONCLICK' => $reload),
1278 if ($input[
'MULTIELEMENT'] !=
'Y')
1279 $settings[
'SIZE'] = array(
'TYPE' =>
'NUMBER',
'LABEL' =>
Loc::getMessage(
'INPUT_ENUM_SIZE'),
'MIN' => 0,
'STEP' => 1);
1286 'CLASS' => __NAMESPACE__.
'\Enum',
1334 foreach ($files as $key => $file)
1336 if (!isset($post[$key]) || !is_array($post[$key]))
1341 foreach ($file as $property => $value)
1343 if (is_array($value))
1345 self::getPostWithFilesRecursive($post[$key], $value, $property);
1349 $post[$key][$property] = $value;
1357 private static function getPostWithFilesRecursive(array &$root, array $values, $property)
1359 foreach ($values as $key => $value)
1361 if (! is_array($root[$key]))
1362 $root[$key] = array();
1364 if (is_array($value))
1365 self::getPostWithFilesRecursive($root[$key], $value, $property);
1367 $root[$key][$property] = $value;
1378 if (! $multiple = static::isMultiple($value))
1379 $value = array($value);
1381 foreach ($value as &$file)
1384 return $multiple ? $value : reset($value);
1390 if (is_array($file))
1392 if (isset($file[
'SRC']) && $file[
'SRC'])
1398 $fileId = $file[
'ID'] ??
null;
1405 if ($fileId && is_numeric($fileId) && ($row = \CFile::GetFileArray($fileId)))
1407 $file = (is_array($file) ? $file : array(
'ID' => $fileId)) + $row;
1419 return is_array($value) && isset($value[
'DELETE']);
1430 && isset($value[
'error'])
1431 && $value[
'error'] == UPLOAD_ERR_OK
1432 && isset($value[
'tmp_name'])
1433 && is_uploaded_file($value[
'tmp_name'])
1441 $isMultiple =
false;
1443 if (isset($value[
'ID']))
1448 if (\is_array($value))
1450 $file = current($value);
1451 if (\is_array($file) || ((
int)$file > 0))
1462 if (! is_array($value))
1463 $value = array(
'ID' => $value);
1465 $src = $value[
'SRC'] ??
null;
1466 $originalName = $value[
'ORIGINAL_NAME'] ??
'';
1470 $attributes =
' href="'.htmlspecialcharsbx($src).
'" title="'.htmlspecialcharsbx(
Loc::getMessage(
'INPUT_FILE_DOWNLOAD')).
'"';
1472 if (\CFile::IsImage($src, $value[
'CONTENT_TYPE']) && $value[
'FILE_SIZE'] > 100000)
1474 $previewImage = \CFile::ResizeImageGet($value[
'ID'], array(200,200), BX_RESIZE_IMAGE_PROPORTIONAL);
1475 if (is_array($previewImage))
1476 $src = $previewImage[
'src'];
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);
1486 $content = htmlspecialcharsbx($originalName);
1491 $content = $value[
'FILE_NAME'] ??
null;
1496 $content = $value[
'ID'] ??
null;
1499 return "<a$attributes>$content</a>";
1510 return static::getEditHtmlSingle($name, $input, $value);
1515 if (! is_array($value))
1517 $value = array(
'ID' => $value);
1520 if (isset($value[
'DELETE']))
1522 unset($value[
'ID']);
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()));".
1532 $fileAttributes = static::extractAttributes($input,
1533 array(
'DISABLED'=>
'',
'AUTOFOCUS'=>
'',
'REQUIRED'=>
''),
1534 array(
'FORM'=>1,
'ACCEPT'=>1));
1536 $otherAttributes = static::extractAttributes($input, array(
'DISABLED'=>
''), array(
'FORM'=>1),
false);
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()">'
1543 isset($input[
'NO_DELETE'])
1545 :
'<label> '.Loc::getMessage(
'INPUT_DELETE').
' <input type="checkbox" name="'.$name.
'[DELETE]" onclick="'
1547 .
"var button = this.parentNode.previousSibling, file = button.previousSibling;"
1548 .
"button.disabled = file.disabled = this.checked;"
1550 .
'"'.$otherAttributes.
'> </label>'
1561 $input[
'REQUIRED'] ??=
'N';
1562 if (is_array($value))
1564 if (isset($value[
'DELETE']))
1566 return $input[
'REQUIRED'] ===
'Y'
1570 elseif (isset($value[
'tmp_name']) && is_uploaded_file($value[
'tmp_name']))
1574 if ($input[
'MAXSIZE'] && $value[
'size'] > $input[
'MAXSIZE'])
1580 if ($error = \CFile::CheckFile($value, 0,
false, $input[
'ACCEPT']))
1581 $errors[
'CFILE'] = $error;
1585 else if (isset($value[
'error']))
1587 switch ($value[
'error'])
1589 case UPLOAD_ERR_OK:
return array();
1591 case UPLOAD_ERR_INI_SIZE:
1592 case UPLOAD_ERR_FORM_SIZE:
return array(
'MAXSIZE' =>
Loc::getMessage(
'INPUT_FILE_MAXSIZE_ERROR'));
1594 case UPLOAD_ERR_PARTIAL:
return array(
'PARTIAL' =>
Loc::getMessage(
'INPUT_FILE_PARTIAL_ERROR'));
1596 case UPLOAD_ERR_NO_FILE:
1598 return $input[
'REQUIRED'] ===
'Y' && (! is_numeric($value[
'ID']) || isset($value[
'DELETE']))
1603 default:
return array(
'INVALID' =>
Loc::getMessage(
'INPUT_INVALID_ERROR'));
1607 elseif (is_numeric($value))
1622 if (is_array($value))
1624 if (isset($value[
'DELETE']))
1629 $value = $value[
'ID'] ??
null;
1632 return is_numeric($value) ? $value :
null;
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'),
1645 'CLASS' => __NAMESPACE__.
'\File',
1656 $showTime = $input[
'TIME'] ==
'Y';
1660 $textAttributes = static::extractAttributes($input,
1661 array(
'DISABLED'=>
'',
'AUTOCOMPLETE'=>
'on',
'AUTOFOCUS'=>
'',
'READONLY'=>
'',
'REQUIRED'=>
''),
1662 array(
'FORM'=>1,
'LIST'=>1));
1664 $buttonAttributes = static::extractAttributes($input, array(
'DISABLED'=>
''), array(),
false);
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});"
1680 return static::getEditHtmlSingle($name, $input, $value);
1685 return '<label> '.Loc::getMessage(
'INPUT_DELETE').
' <input type="checkbox" onclick="'
1687 .
"var disabled = this.checked;"
1688 .
"var button = this.parentNode.previousSibling;"
1689 .
"button.disabled = disabled;"
1690 .
"button.previousSibling.disabled = disabled;"
1697 return CheckDateTime($value, FORMAT_DATE)
1705 'TIME' => array(
'TYPE' =>
'Y/N',
'LABEL' =>
Loc::getMessage(
'INPUT_DATE_TIME'),
'ONCLICK' => $reload),
1712 'CLASS' => __NAMESPACE__.
'\Date',
1723 if((
string) $value ==
'')
1728 $result = \Bitrix\Sale\Location\LocationTable::getPathToNodeByCode($value, array(
1729 'select' => array(
'CHAIN' =>
'NAME.NAME'),
1730 'filter' => array(
'NAME.LANGUAGE_ID' => LANGUAGE_ID),
1735 while($row = $result->fetch())
1736 $path[] = $row[
'CHAIN'];
1738 return htmlspecialcharsbx(implode(
', ', $path));
1754 return static::getEditHtml($name, $input, $value);
1757 public static function getEditHtml($name, array $input, $value =
null)
1759 $name = htmlspecialcharsbx($name);
1761 $input[
'DISABLED'] ??=
'N';
1763 if ($value ===
null && isset($input[
'VALUE']))
1765 $value = $input[
'VALUE'];
1770 if (isset($input[
'HIDDEN']) && ($input[
'HIDDEN'] ===
'Y' || $input[
'HIDDEN'] ===
true))
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));
1778 $selector = md5(
"location input selector $name");
1779 $input[
"LOCATION_SELECTOR"] = $selector;
1781 if ($onChange = $input[
'ONCHANGE'])
1783 $functionName =
'OnLocationChange'.$selector;
1784 $html .=
"<script>function $functionName (){ $onChange }; BX.proxy($functionName, this);</script>";
1785 $input[
'JS_CALLBACK'] = $functionName;
1789 $input[
'JS_CALLBACK'] =
null;
1792 if (isset($input[
'MULTIPLE']) && $input[
'MULTIPLE'] ===
'Y')
1794 $tag = isset($input[
'MULTITAG']) ? htmlspecialcharsbx($input[
'MULTITAG']) : static::MULTITAG;
1795 [$startTag, $endTag] = $tag ? array(
"<$tag>",
"</$tag>") : array(
'',
'');
1799 $values = static::asMultiple($value);
1802 $values = array(
null);
1804 foreach ($values as $value)
1806 .static::getEditHtmlSingle($name.
'['.(++$index).
']', $input, $value)
1809 $replace =
'##INPUT##NAME##';
1811 if ($input[
'DISABLED'] !==
'Y')
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();"
1821 $html .= static::getEditHtmlSingle($name, $input, static::asSingle($value));
1825 if (isset($input[
'ADDITIONAL_HIDDEN']) && $input[
'ADDITIONAL_HIDDEN'] ===
'Y')
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));
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(
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']
1855 print(
'<div style="width: 100%; margin-left: 12px">');
1856 $parameters[
'INITIALIZE_BY_GLOBAL_EVENT'] =
'onAdminFilterInited';
1857 $parameters[
'GLOBAL_EVENT_SCOPE'] =
'window';
1860 $GLOBALS[
'APPLICATION']->IncludeComponent(
1861 'bitrix:sale.location.selector.'.($filterMode || $isSearchLine ?
'search' : \Bitrix\Sale\Location\Admin\Helper::getWidgetAppearance()),
1872 $html = ob_get_contents();
1880 return \Bitrix\Sale\Location\LocationTable::getByCode($value)->fetch()
1887 'CLASS' => __NAMESPACE__.
'\Location',
1920 if (!is_array($value) || !Loader::includeModule(
'location'))
1925 $address = \Bitrix\Location\Entity\Address::fromArray($value);
1927 return $address->toString(
1928 FormatService::getInstance()->findDefault(LANGUAGE_ID)
1948 $input[
'REQUIRED'] ??=
'N';
1949 if ($input[
'REQUIRED'] ===
'Y')
1951 if (!(is_array($value) && !empty($value)))
1967 return static::getErrorSingle($input, $value);
1975 if (!Loader::includeModule(
'location'))
1980 $input[
'DISABLED'] ??=
'N';
1982 \Bitrix\Main\UI\Extension::load(
'sale.address');
1987 if (
BX.Sale.AddressControlConstructor)
1989 new BX.Sale.AddressControlConstructor(
1994 isLocked: <?=($input[
'DISABLED'] ===
'Y' ?
'true' :
'false'); ?>,
1995 onChangeCallback:
function () {
1996 <?
if (isset($input[
'ONCHANGE'])):?>
1997 <?=$input[
'ONCHANGE']?>
2002 ).$mount(
'#<?=$name?>');
2006 $script = ob_get_clean();
2009 <div id="' . $name .
'"></div>
2015if (Loader::includeModule(
'location'))
2018 'CLASS' => __NAMESPACE__.
'\Address',
2032 public static function getViewHtml(array $input, $values =
null) : string
2034 if (!is_array($values))
2039 $result =
'<br><br>';
2042 foreach ($catList as $catName)
2044 $result .=
"<div> - {$catName}</div>";
2057 public static function getEditHtml($name, array $input, $values =
null) : string
2059 if (!is_array($values))
2064 $addInputTranslate =
Loc::getMessage(
'SALE_PRODUCT_CATEGORY_INP_ADD');
2065 $deleteInputTranslate =
Loc::getMessage(
'SALE_PRODUCT_CATEGORY_INP_DELETE');
2067 $openFilterButtonId = $input[
'ID'];
2069 $deprecatedSupport = isset($input[
'SCRIPT']) && isset($input[
'URL']);
2070 if ($deprecatedSupport)
2072 $url = $input[
'URL'];
2073 $addCategoryScript = $input[
'SCRIPT'];
2074 $input[
'ID'] =
'sale-admin-delivery-restriction-cat';
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';
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');\"
2090 {$addInputTranslate}
2093 <script type='text/javascript'>
2094 {$addCategoryScript}
2095 BX.message({SALE_PRODUCT_CATEGORY_INP_DELETE: '{$deleteInputTranslate}'});
2100 $existCatHtml =
"<table id='{$input['ID']}-content' width='100%'>";
2102 foreach ($catList as $catId => $catName)
2104 if ($deprecatedSupport)
2106 $deleteNodeScript =
"BX.Sale.Delivery.deleteRestrictionProductSection('{$catId}');";
2110 $deleteNodeScript =
"{$input['JS_HANDLER']}.deleteRestrictionProductSection('{$catId}', '{$input['ID']}');";
2114 <tr class='adm-s-product-category-restriction-delcat' id='{$input['ID']}-{$catId}'>
2116 <span> - {$catName}</span>
2117 <input type='hidden' name='RESTRICTION[CATEGORIES][]' value='{$catId}'>
2122 class='adm-s-bus-morelinkqhsw'
2123 href='javascript:void(0);'
2124 onclick=\"{$deleteNodeScript}\"
2126 {$deleteInputTranslate}
2133 $existCatHtml .=
'</table>';
2135 return $existCatHtml.$editSection;
2145 if(!\
Bitrix\Main\Loader::includeModule(
'iblock'))
2150 $res = \Bitrix\Iblock\SectionTable::getList([
2154 'select' => [
'ID',
'NAME'],
2157 while($section = $res->fetch())
2158 $result[$section[
'ID']] = htmlspecialcharsbx($section[
'NAME']);
2185 'PRODUCT_CATEGORIES',
2187 'CLASS' => __NAMESPACE__.
'\ProductCategories',
2199 public static function getViewHtml(array $input, $values =
null) : string
2201 if (!is_array($values))
2206 $result =
'<br><br>';
2210 foreach ($productList as $productName)
2212 $result .=
"<div> - {$productName}</div>";
2225 public static function getEditHtml($name, array $input, $values =
null) : string
2227 if (!is_array($values))
2232 $nodeId = &$input[
'ID'];
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);};";
2238 $addInputTranslate =
Loc::getMessage(
'SALE_CONCRETE_PRODUCT_INP_ADD');
2239 $deleteInputTranslate =
Loc::getMessage(
'SALE_CONCRETE_PRODUCT_INP_DELETE');
2244 class='adm-s-restriction-open-dialog-link'
2245 href='javascript:void(0);'
2247 onclick=\"window.open('{$url}', 'choose product', 'width=850,height=600');\"
2249 {$addInputTranslate}
2252 <script type='text/javascript'>
2254 BX.message({SALE_CONCRETE_PRODUCT_INP_DELETE: '$deleteInputTranslate'});
2258 $existProductsHtml =
"<table id='{$nodeId}-content' width='100%'>";
2260 foreach ($productsList as $productId => $productName)
2262 $existProductsHtml .=
"
2263 <tr class='adm-s-concrete-product-restriction-delprod' id='{$nodeId}-{$productId}'>
2265 <span> - {$productName}</span>
2266 <input type='hidden' name='RESTRICTION[PRODUCTS][]' value='{$productId}'>
2271 class='adm-s-bus-morelinkqhsw' href='javascript:void(0);'
2272 onclick=\"{$input["JS_HANDLER
"]}.deleteRestrictionByConcreteProduct('{$nodeId}', '{$productId}');\"
2274 {$deleteInputTranslate}
2281 $existProductsHtml .=
"</table>";
2283 return $existProductsHtml.$editSection;
2288 if (!\
Bitrix\Main\Loader::includeModule(
'iblock'))
2295 $productsListSource = \Bitrix\Iblock\ElementTable::getList([
2297 'ID' => $elementIds,
2305 while ($productRow = $productsListSource->fetch())
2307 $productsList[$productRow[
'ID']] = htmlspecialcharsbx($productRow[
'NAME']);
2310 return $productsList;
2337 'CLASS' => __NAMESPACE__.
'\\ConcreteProduct',
static fromArray(array $arrayData)
static loadMessages($file)
static getMessage($code, $replace=null, $language=null)
$GLOBALS['____1444769544']