13Loc::loadMessages(__FILE__);
26 if (Loader::includeModule(
'location'))
33 '/bitrix/js/sale/input.js'
35 'lang' =>
'/bitrix/modules/sale/lang/'.LANGUAGE_ID.
'/lib/internals/input.php',
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__);
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;
284 if (isset(static::$types[
$name]))
289 if (! class_exists(
$type[
'CLASS']))
294 if (! is_subclass_of(
$type[
'CLASS'], __NAMESPACE__.
'\Base'))
296 throw new SystemException(
$type[
'CLASS'].
' does not implement Input\Base', 0, __FILE__, __LINE__);
304 protected static function initialize()
306 static::$initialized =
true;
309 $event =
new Event(
'sale',
'registerInputTypes', static::$types);
314 foreach(
$event->getResults() as $eventResult)
316 if ($eventResult->getType() != EventResult::SUCCESS)
319 if (
$params = $eventResult->getParameters())
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));
406 if (isset($input[
'IS_EMAIL']) && $input[
'IS_EMAIL'] ===
'Y')
408 $output =
'<a href="mailto:'.$valueText.
'">'.$valueText.
'</a>';
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;"
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();";
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)))
532 $value = static::asSingle($value);
534 if ($value !==
'' && $value !==
null)
536 return static::getErrorSingle($input, $value);
553 $input[
'REQUIRED'] ??=
'N';
554 $input[
'MULTIPLE'] ??=
'N';
555 $input[
'NAME'] ??= $input[
'LABEL'];
556 $input[
'NAME'] ??=
'';
558 if ($value ===
null && isset($input[
'VALUE']))
560 $value = $input[
'VALUE'];
563 if ($input[
'MULTIPLE'] ===
'Y')
565 if ($input[
'REQUIRED'] ===
'Y' || $input[
'REQUIRED'] ===
true)
567 foreach (static::asMultiple($value) as $value)
569 if ($value ===
'' || $value ===
null)
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');
581 $value = static::asSingle($value);
583 if ($value ===
'' || $value ===
null)
585 if ($input[
'REQUIRED'] ===
'Y' || $input[
'REQUIRED'] ===
true)
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');
605 throw new SystemException(
"you must implement [getErrorSingle] or override [getError] in yor class", 0, __FILE__, __LINE__);
610 if (isset($input[
'DISABLED']) && $input[
'DISABLED'] ===
'Y')
617 $value = $input[
'VALUE'] ??
null;
620 if (isset($input[
'MULTIPLE']) && $input[
'MULTIPLE'] ===
'Y')
624 foreach (static::asMultiple($value) as $value)
626 $value = static::getValueSingle($input, $value);
631 return $values ? $values :
null;
635 return static::getValueSingle($input, static::asSingle($value));
653 if (is_array($value))
657 foreach ($value as
$k => $v)
664 return '<input type="hidden" name="'.$name.
'" value="'.
htmlspecialcharsbx($value).
'"'.$attributes.
'>';
675 unset($boolean[
'REQUIRED']);
677 static $globalBoolean =
array(
'CONTENTEDITABLE'=>
'',
'DRAGGABLE'=>
'true',
'SPELLCHECK'=>
'',
'TRANSLATE'=>
'yes');
680 $boolean = $globalBoolean + $boolean;
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].
'"' :
'');
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,
701 $events = array_intersect_key($input, $globalEvents);
702 $other = array_diff_key($other, $events);
704 foreach ($events as
$k => $v)
706 $string .=
' '.mb_strtolower(
$k).
'="'.$v.
'"';
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
718 $other += $globalOther;
720 foreach (array_intersect_key($input, $other) as
$k => $v)
725 if ($withGlobal && isset($input[
'DATA']) && is_array($input[
'DATA']))
727 foreach ($input[
'DATA'] as
$k => $v)
754 $input = self::prepareIntFields($input);
755 if (isset($input[
'MULTILINE']) && $input[
'MULTILINE'] ===
'Y')
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));
761 return '<textarea name="'.$name.
'"'.$attributes.
'>'.
htmlspecialcharsbx($value).
'</textarea>';
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));
769 return '<input type="text" name="'.$name.
'" value="'.
htmlspecialcharsbx($value).
'"'.$attributes.
'>';
773 private static function prepareIntFields(
array $input):
array
775 $intFields = [
'SIZE',
'ROWS',
'COLS'];
776 foreach ($intFields as $field)
778 $input[$field] = (int)($input[$field] ?? 0);
779 if ($input[$field] <= 0)
781 unset($input[$field]);
796 return static::getEditHtmlSingle(
$name, $input, $value);
803 $value = trim($value);
805 $minLength = isset($input[
'MINLENGTH']) && is_numeric($input[
'MINLENGTH']) ? (int)$input[
'MINLENGTH'] : 0;
806 if ($minLength > 0 && mb_strlen($value) < $minLength)
808 $errors[
'MINLENGTH'] = Loc::getMessage(
'INPUT_STRING_MINLENGTH_ERROR', [
'#NUM#' => $minLength]);
811 $maxLength = isset($input[
'MAXLENGTH']) && is_numeric($input[
'MAXLENGTH']) ? (int)$input[
'MAXLENGTH'] : 0;
812 if ($maxLength > 0 && mb_strlen($value) > $maxLength)
814 $errors[
'MAXLENGTH'] = Loc::getMessage(
'INPUT_STRING_MAXLENGTH_ERROR', [
'#NUM#' => $maxLength]);
818 (
string)($input[
'PATTERN'] ??
'')
822 $issetDelimiter =
false;
826 $issetDelimiter =
true;
830 if (!$issetDelimiter)
832 $matchPattern =
"/".$pattern.
"/";
835 $pregMatchResult =
null;
838 $pregMatchResult = preg_match($matchPattern, $value);
845 if (!$pregMatchResult)
847 $errors[
'PATTERN'] = Loc::getMessage(
'INPUT_STRING_PATTERN_ERROR');
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),
864 if (isset($input[
'MULTILINE']) && $input[
'MULTILINE'] ===
'Y')
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);
871 $settings[
'SIZE'] =
array(
'TYPE' =>
'NUMBER',
'LABEL' => Loc::getMessage(
'INPUT_STRING_SIZE'),
'MIN' => 0,
'STEP' => 1);
884 return is_array($value) && isset($value[
'DELETE']);
890 'CLASS' => __NAMESPACE__.
'\StringInput',
891 'NAME' => Loc::getMessage(
'INPUT_STRING'),
906 (
string)($input[
'MIN'] ??
'')
914 (
string)($input[
'MAX'] ??
'')
922 (
string)($input[
'STEP'] ??
'')
929 $input[
'SIZE'] = $size;
931 $attributes = static::extractAttributes($input,
932 array(
'DISABLED'=>
'',
'READONLY'=>
'',
'AUTOFOCUS'=>
'',
'REQUIRED'=>
'',
'AUTOCOMPLETE'=>
'on'),
933 array(
'FORM'=>1,
'LIST'=>1,
'PLACEHOLDER'=>1,
'SIZE'=>1));
935 return '<input type="text" name="'.$name.
'" value="'.
htmlspecialcharsbx($value).
'"'.$attributes.
'>';
946 return static::getEditHtmlSingle(
$name, $input, $value);
953 if (is_numeric($value))
955 $value = (double) $value;
957 if (!empty($input[
'MIN']) && $value < $input[
'MIN'])
958 $errors[
'MIN'] = Loc::getMessage(
'INPUT_NUMBER_MIN_ERROR',
array(
"#NUM#" => $input[
'MIN']));
960 if (!empty($input[
'MAX']) && $value > $input[
'MAX'])
961 $errors[
'MAX'] = Loc::getMessage(
'INPUT_NUMBER_MAX_ERROR',
array(
"#NUM#" => $input[
'MAX']));
963 if (!empty($input[
'STEP']))
965 $step = (double) $input[
'STEP'];
967 $value = (double) abs($value - ($input[
'MIN'] ? $input[
'MIN'] : 0.0));
969 if (! ($value / pow(2.0, 53) > $step))
971 $remainder = (double) abs($value - $step * round($value / $step));
972 $acceptableError = (double) ($step / pow(2.0, 24));
974 if ($acceptableError < $remainder && ($step - $acceptableError) > $remainder)
975 $errors[
'STEP'] = Loc::getMessage(
'INPUT_NUMBER_STEP_ERROR',
array(
"#NUM#" => $input[
'STEP']));
981 $errors[
'NUMERIC'] = Loc::getMessage(
'INPUT_NUMBER_NUMERIC_ERROR');
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')),
998 'CLASS' => __NAMESPACE__.
'\Number',
999 'NAME' => Loc::getMessage(
'INPUT_NUMBER'),
1009 return $value ==
'Y' ? Loc::getMessage(
'INPUT_EITHERYN_Y') : Loc::getMessage(
'INPUT_EITHERYN_N');
1014 $hiddenAttributes = static::extractAttributes($input,
array(
'DISABLED'=>
''),
array(
'FORM'=>1),
false);
1015 $checkboxAttributes = static::extractAttributes($input,
array(
'DISABLED'=>
'',
'AUTOFOCUS'=>
'',
'REQUIRED'=>
''),
array(
'FORM'=>1));
1017 if (isset($input[
'DISABLED_YN']))
1019 return '<input type="hidden" name="'.$name.
'" value="' . (($input[
'DISABLED_YN'] ==
'Y') ?
'Y' :
'N') .
'">'
1020 .
'<input type="checkbox" '.($input[
'DISABLED_YN'] ==
'Y' ?
' checked' :
'').
'disabled'.
'>';
1024 return '<input type="hidden" name="'.$name.
'" value="N"'.$hiddenAttributes.
'>'
1025 .
'<input type="checkbox" name="'.
$name.
'" value="Y"'.($value ==
'Y' ?
' checked' :
'').$checkboxAttributes.
'>';
1038 $hiddenAttributes = static::extractAttributes($input,
array(
'DISABLED'=>
''),
array(
'FORM'=>1),
false);
1040 $checkboxAttributes = static::extractAttributes($input,
array(
'DISABLED'=>
'',
'AUTOFOCUS'=>
'',
'REQUIRED'=>
''),
array(
'FORM'=>1));
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>
1051 $input[
'REQUIRED'] ??=
'N';
1052 $input[
'NAME'] ??= (string)($input[
'LABEL'] ??
'');
1055 ($input[
'REQUIRED'] ===
'Y' || $input[
'REQUIRED'] ===
true)
1056 && ($value ===
'' || $value ===
null)
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'),
1067 ($value ===
'N' || $value ===
'Y')
1069 : [
'INVALID' => Loc::getMessage(
'INPUT_INVALID_ERROR')]
1075 return $value ==
'Y' ?
'Y' :
'N';
1080 $errors = parent::getRequiredError($input, $value);
1081 $input[
'REQUIRED'] ??=
'N';
1082 $input[
'NAME'] ??= $input[
'LABEL'];
1083 $input[
'NAME'] ??=
'';
1089 && $input[
'REQUIRED'] ===
'Y'
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'),
1104 'CLASS' => __NAMESPACE__.
'\EitherYN',
1105 'NAME' => Loc::getMessage(
'INPUT_EITHERYN'),
1113 private static function flatten(
array $array)
1117 foreach ($array as
$key => $value)
1119 if (is_array($value))
1134 $options = $input[
'OPTIONS'] ?? [];
1157 return static::getEditHtml(
$name, $input, $value);
1165 return Loc::getMessage(
'INPUT_ENUM_OPTIONS_ERROR');
1167 $multiple = isset($input[
'MULTIPLE']) && $input[
'MULTIPLE'] ===
'Y';
1171 if ($value ===
null && isset($input[
'VALUE']))
1173 $value = $input[
'VALUE'];
1176 $originalValue = $value;
1179 if (isset($input[
'HIDDEN']) && ($input[
'HIDDEN'] ===
'Y' || $input[
'HIDDEN'] ===
true))
1181 $html .= static::getHiddenRecursive(
$name
1182 , $multiple ? static::asMultiple($value) : static::asSingle($value)
1183 , static::extractAttributes($input,
array(
'DISABLED'=>
''),
array(
'FORM'=>1),
false));
1187 if ($value ===
null)
1190 $value = $multiple ? array_flip(static::asMultiple($value)) :
array(static::asSingle($value) =>
true);
1192 if (isset($input[
'MULTIELEMENT']) && $input[
'MULTIELEMENT'] ===
'Y')
1194 $tag = isset($input[
'MULTITAG']) ?
htmlspecialcharsbx($input[
'MULTITAG']) : static::MULTITAG;
1195 [$startTag, $endTag] = $tag ?
array(
"<$tag>",
"</$tag>") :
array(
'',
'');
1197 $attributes = static::extractAttributes($input,
array(
'DISABLED'=>
''),
array(
'FORM'=>1),
false);
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
1214 $attributes = static::extractAttributes($input,
array(
'DISABLED'=>
'',
'AUTOFOCUS'=>
'',
'REQUIRED'=>
''),
array(
'FORM'=>1,
'SIZE'=>1));
1216 $html .=
'<select'.$attributes.
' name="'.
$name.($multiple ?
'[]" multiple>' :
'">');
1218 $html .= self::getEditOptionsHtml(
$options, $value,
' selected',
1219 '<optgroup label="{GROUP}">{OPTIONS}</optgroup>',
1220 '<option value="{VALUE}"{SELECTED}>{TEXT}</option>'
1223 $html .=
'</select>';
1227 if (isset($input[
'ADDITIONAL_HIDDEN']) && $input[
'ADDITIONAL_HIDDEN'] ===
'Y')
1229 $html .= static::getHiddenRecursive(
$name
1230 , $multiple ? static::asMultiple($originalValue) : static::asSingle($originalValue)
1231 , static::extractAttributes($input,
array(),
array(
'FORM'=>1),
false));
1245 array(
'{GROUP}',
'{OPTIONS}'),
1248 self::getEditOptionsHtml($value, $selected, $selector, $group,
$option),
1253 array(
'{VALUE}',
'{SELECTED}',
'{TEXT}'),
1256 isset($selected[
$key]) ? $selector :
'',
1276 :
array(
'INVALID' => Loc::getMessage(
'INPUT_INVALID_ERROR'));
1280 return array(
'OPTIONS' => Loc::getMessage(
'INPUT_ENUM_OPTIONS_ERROR'));
1288 'MULTIELEMENT' =>
array(
'TYPE' =>
'Y/N',
'LABEL' => Loc::getMessage(
'INPUT_ENUM_MULTIELEMENT'),
'ONCLICK' => $reload),
1291 if ($input[
'MULTIELEMENT'] !=
'Y')
1292 $settings[
'SIZE'] =
array(
'TYPE' =>
'NUMBER',
'LABEL' => Loc::getMessage(
'INPUT_ENUM_SIZE'),
'MIN' => 0,
'STEP' => 1);
1299 'CLASS' => __NAMESPACE__.
'\Enum',
1300 'NAME' => Loc::getMessage(
'INPUT_ENUM'),
1354 foreach ($file as $property => $value)
1356 if (is_array($value))
1358 self::getPostWithFilesRecursive(
$post[
$key], $value, $property);
1370 private static function getPostWithFilesRecursive(
array &$root,
array $values, $property)
1372 foreach ($values as
$key => $value)
1374 if (! is_array($root[
$key]))
1377 if (is_array($value))
1378 self::getPostWithFilesRecursive($root[
$key], $value, $property);
1380 $root[
$key][$property] = $value;
1391 if (! $multiple = static::isMultiple($value))
1392 $value =
array($value);
1394 foreach ($value as &$file)
1397 return $multiple ? $value : reset($value);
1403 if (is_array($file))
1405 if (isset($file[
'SRC']) && $file[
'SRC'])
1411 $fileId = $file[
'ID'] ??
null;
1418 if ($fileId && is_numeric($fileId) && ($row = \CFile::GetFileArray($fileId)))
1420 $file = (is_array($file) ? $file :
array(
'ID' => $fileId)) + $row;
1432 return is_array($value) && isset($value[
'DELETE']);
1443 && isset($value[
'error'])
1444 && $value[
'error'] == UPLOAD_ERR_OK
1445 && isset($value[
'tmp_name'])
1446 && is_uploaded_file($value[
'tmp_name'])
1454 $isMultiple =
false;
1456 if (isset($value[
'ID']))
1461 if (\is_array($value))
1463 $file = current($value);
1464 if (\is_array($file) || ((
int)$file > 0))
1475 if (! is_array($value))
1476 $value =
array(
'ID' => $value);
1478 $src = $value[
'SRC'] ??
null;
1479 $originalName = $value[
'ORIGINAL_NAME'] ??
'';
1483 $attributes =
' href="'.htmlspecialcharsbx($src).
'" title="'.
htmlspecialcharsbx(Loc::getMessage(
'INPUT_FILE_DOWNLOAD')).
'"';
1485 if (\CFile::IsImage($src, $value[
'CONTENT_TYPE']) && $value[
'FILE_SIZE'] > 100000)
1488 if (is_array($previewImage))
1489 $src = $previewImage[
'src'];
1492 $content = \CFile::IsImage($value[
'SRC'], $value[
'CONTENT_TYPE'])
1493 ?
'<img src="'.$src.
'" border="0" alt="" style="max-height:100px; max-width:100px">'
1504 $content = $value[
'FILE_NAME'] ??
null;
1512 return "<a$attributes>$content</a>";
1523 return static::getEditHtmlSingle(
$name, $input, $value);
1528 if (! is_array($value))
1530 $value =
array(
'ID' => $value);
1533 if (isset($value[
'DELETE']))
1535 unset($value[
'ID']);
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()));".
1545 $fileAttributes = static::extractAttributes($input,
1546 array(
'DISABLED'=>
'',
'AUTOFOCUS'=>
'',
'REQUIRED'=>
''),
1547 array(
'FORM'=>1,
'ACCEPT'=>1));
1549 $otherAttributes = static::extractAttributes($input,
array(
'DISABLED'=>
''),
array(
'FORM'=>1),
false);
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()">'
1556 isset($input[
'NO_DELETE'])
1558 :
'<label> '.Loc::getMessage(
'INPUT_DELETE').
' <input type="checkbox" name="'.
$name.
'[DELETE]" onclick="'
1560 .
"var button = this.parentNode.previousSibling, file = button.previousSibling;"
1561 .
"button.disabled = file.disabled = this.checked;"
1563 .
'"'.$otherAttributes.
'> </label>'
1574 $input[
'REQUIRED'] ??=
'N';
1575 $input[
'NAME'] ??= $input[
'LABEL'];
1576 $input[
'NAME'] ??=
'';
1578 if (is_array($value))
1580 if (isset($value[
'DELETE']))
1582 return $input[
'REQUIRED'] ===
'Y'
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'),
1590 elseif (isset($value[
'tmp_name']) && is_uploaded_file($value[
'tmp_name']))
1594 if ($input[
'MAXSIZE'] && $value[
'size'] > $input[
'MAXSIZE'])
1595 $errors[
'MAXSIZE'] = Loc::getMessage(
'INPUT_FILE_MAXSIZE_ERROR');
1600 if (
$error = \CFile::CheckFile($value, 0,
false, $input[
'ACCEPT']))
1605 else if (isset($value[
'error']))
1607 switch ($value[
'error'])
1609 case UPLOAD_ERR_OK:
return array();
1611 case UPLOAD_ERR_INI_SIZE:
1612 case UPLOAD_ERR_FORM_SIZE:
return array(
'MAXSIZE' => Loc::getMessage(
'INPUT_FILE_MAXSIZE_ERROR'));
1614 case UPLOAD_ERR_PARTIAL:
return array(
'PARTIAL' => Loc::getMessage(
'INPUT_FILE_PARTIAL_ERROR'));
1616 case UPLOAD_ERR_NO_FILE:
1618 return $input[
'REQUIRED'] ===
'Y' && (! is_numeric($value[
'ID']) || isset($value[
'DELETE']))
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'),
1627 default:
return array(
'INVALID' => Loc::getMessage(
'INPUT_INVALID_ERROR'));
1631 elseif (is_numeric($value))
1638 return array(
'INVALID' => Loc::getMessage(
'INPUT_INVALID_ERROR'));
1646 if (is_array($value))
1648 if (isset($value[
'DELETE']))
1653 $value = $value[
'ID'] ??
null;
1656 return is_numeric($value) ? $value :
null;
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'),
1669 'CLASS' => __NAMESPACE__.
'\File',
1670 'NAME' => Loc::getMessage(
'INPUT_FILE'),
1680 $showTime = $input[
'TIME'] ==
'Y';
1684 $textAttributes = static::extractAttributes($input,
1685 array(
'DISABLED'=>
'',
'AUTOCOMPLETE'=>
'on',
'AUTOFOCUS'=>
'',
'READONLY'=>
'',
'REQUIRED'=>
''),
1686 array(
'FORM'=>1,
'LIST'=>1));
1688 $buttonAttributes = static::extractAttributes($input,
array(
'DISABLED'=>
''),
array(),
false);
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});"
1704 return static::getEditHtmlSingle(
$name, $input, $value);
1709 return '<label> '.Loc::getMessage(
'INPUT_DELETE').
' <input type="checkbox" onclick="'
1711 .
"var disabled = this.checked;"
1712 .
"var button = this.parentNode.previousSibling;"
1713 .
"button.disabled = disabled;"
1714 .
"button.previousSibling.disabled = disabled;"
1723 :
array(
'INVALID' => Loc::getMessage(
'INPUT_INVALID_ERROR'));
1729 'TIME' =>
array(
'TYPE' =>
'Y/N',
'LABEL' => Loc::getMessage(
'INPUT_DATE_TIME'),
'ONCLICK' => $reload),
1736 'CLASS' => __NAMESPACE__.
'\Date',
1737 'NAME' => Loc::getMessage(
'INPUT_DATE'),
1747 if((
string) $value ==
'')
1753 'select' =>
array(
'CHAIN' =>
'NAME.NAME'),
1754 'filter' =>
array(
'NAME.LANGUAGE_ID' => LANGUAGE_ID),
1759 while($row =
$result->fetch())
1760 $path[] = $row[
'CHAIN'];
1778 return static::getEditHtml(
$name, $input, $value);
1785 $input[
'DISABLED'] ??=
'N';
1787 if ($value ===
null && isset($input[
'VALUE']))
1789 $value = $input[
'VALUE'];
1794 if (isset($input[
'HIDDEN']) && ($input[
'HIDDEN'] ===
'Y' || $input[
'HIDDEN'] ===
true))
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));
1802 $selector = md5(
"location input selector $name");
1803 $input[
"LOCATION_SELECTOR"] = $selector;
1805 if ($onChange = $input[
'ONCHANGE'])
1807 $functionName =
'OnLocationChange'.$selector;
1808 $html .=
"<script>function $functionName (){ $onChange }; BX.proxy($functionName, this);</script>";
1809 $input[
'JS_CALLBACK'] = $functionName;
1813 $input[
'JS_CALLBACK'] =
null;
1816 if (isset($input[
'MULTIPLE']) && $input[
'MULTIPLE'] ===
'Y')
1818 $tag = isset($input[
'MULTITAG']) ?
htmlspecialcharsbx($input[
'MULTITAG']) : static::MULTITAG;
1819 [$startTag, $endTag] = $tag ?
array(
"<$tag>",
"</$tag>") :
array(
'',
'');
1823 $values = static::asMultiple($value);
1826 $values =
array(
null);
1828 foreach ($values as $value)
1830 .static::getEditHtmlSingle(
$name.
'['.(++$index).
']', $input, $value)
1833 $replace =
'##INPUT##NAME##';
1835 if ($input[
'DISABLED'] !==
'Y')
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();"
1845 $html .= static::getEditHtmlSingle(
$name, $input, static::asSingle($value));
1849 if (isset($input[
'ADDITIONAL_HIDDEN']) && $input[
'ADDITIONAL_HIDDEN'] ===
'Y')
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));
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(
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']
1879 print(
'<div style="width: 100%; margin-left: 12px">');
1880 $parameters[
'INITIALIZE_BY_GLOBAL_EVENT'] =
'onAdminFilterInited';
1881 $parameters[
'GLOBAL_EVENT_SCOPE'] =
'window';
1884 $GLOBALS[
'APPLICATION']->IncludeComponent(
1885 'bitrix:sale.location.selector.'.($filterMode || $isSearchLine ?
'search' : \
Bitrix\
Sale\
Location\Admin\Helper::getWidgetAppearance()),
1896 $html = ob_get_contents();
1904 return \Bitrix\Sale\Location\LocationTable::getByCode($value)->fetch()
1906 :
array(
'INVALID' => Loc::getMessage(
'INPUT_INVALID_ERROR'));
1911 'CLASS' => __NAMESPACE__.
'\Location',
1912 'NAME' => Loc::getMessage(
'INPUT_LOCATION'),
1944 if (!is_array($value) || !Loader::includeModule(
'location'))
1949 $address = \Bitrix\Location\Entity\Address::fromArray($value);
1951 return $address->toString(
1972 $input[
'REQUIRED'] ??=
'N';
1973 $input[
'NAME'] ??= $input[
'LABEL'];
1974 $input[
'NAME'] ??=
'';
1976 if ($input[
'REQUIRED'] ===
'Y')
1978 if (!(is_array($value) && !empty($value)))
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'),
1998 return static::getErrorSingle($input, $value);
2006 if (!Loader::includeModule(
'location'))
2011 $input[
'DISABLED'] ??=
'N';
2018 if (BX.Sale.AddressControlConstructor)
2020 new BX.Sale.AddressControlConstructor(
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']?>
2033 ).$mount(
'#<?=$name?>');
2037 $script = ob_get_clean();
2040 <div id="' .
$name .
'"></div>
2046if (Loader::includeModule(
'location'))
2049 'CLASS' => __NAMESPACE__.
'\Address',
2050 'NAME' => Loc::getMessage(
'INPUT_ADDRESS'),
2065 if (!is_array($values))
2073 foreach ($catList as $catName)
2075 $result .=
"<div> - {$catName}</div>";
2090 if (!is_array($values))
2095 $addInputTranslate = Loc::getMessage(
'SALE_PRODUCT_CATEGORY_INP_ADD');
2096 $deleteInputTranslate = Loc::getMessage(
'SALE_PRODUCT_CATEGORY_INP_DELETE');
2098 $openFilterButtonId = $input[
'ID'];
2100 $deprecatedSupport = isset($input[
'SCRIPT']) && isset($input[
'URL']);
2101 if ($deprecatedSupport)
2103 $url = $input[
'URL'];
2104 $addCategoryScript = $input[
'SCRIPT'];
2105 $input[
'ID'] =
'sale-admin-delivery-restriction-cat';
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';
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');\"
2121 {$addInputTranslate}
2125 {$addCategoryScript}
2126 BX.message({SALE_PRODUCT_CATEGORY_INP_DELETE: '{$deleteInputTranslate}'});
2131 $existCatHtml =
"<table id='{$input['ID']}-content' width='100%'>";
2133 foreach ($catList as $catId => $catName)
2135 if ($deprecatedSupport)
2137 $deleteNodeScript =
"BX.Sale.Delivery.deleteRestrictionProductSection('{$catId}');";
2141 $deleteNodeScript =
"{$input['JS_HANDLER']}.deleteRestrictionProductSection('{$catId}', '{$input['ID']}');";
2145 <tr class='adm-s-product-category-restriction-delcat' id='{$input['ID']}-{$catId}'>
2147 <span> - {$catName}</span>
2148 <input type='hidden' name='RESTRICTION[CATEGORIES][]' value='{$catId}'>
2153 class='adm-s-bus-morelinkqhsw'
2154 href='javascript:void(0);'
2155 onclick=\"{$deleteNodeScript}\"
2157 {$deleteInputTranslate}
2164 $existCatHtml .=
'</table>';
2166 return $existCatHtml.$editSection;
2176 if(!\
Bitrix\
Main\Loader::includeModule(
'iblock'))
2185 'select' => [
'ID',
'NAME'],
2188 while($section =
$res->fetch())
2216 'PRODUCT_CATEGORIES',
2218 'CLASS' => __NAMESPACE__.
'\ProductCategories',
2219 'NAME' => Loc::getMessage(
'SALE_PRODUCT_CATEGORY_INP'),
2232 if (!is_array($values))
2241 foreach ($productList as $productName)
2243 $result .=
"<div> - {$productName}</div>";
2258 if (!is_array($values))
2263 $nodeId = &$input[
'ID'];
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);};";
2269 $addInputTranslate = Loc::getMessage(
'SALE_CONCRETE_PRODUCT_INP_ADD');
2270 $deleteInputTranslate = Loc::getMessage(
'SALE_CONCRETE_PRODUCT_INP_DELETE');
2275 class='adm-s-restriction-open-dialog-link'
2276 href='javascript:void(0);'
2278 onclick=\"window.open('{$url}', 'choose product', 'width=850,height=600');\"
2280 {$addInputTranslate}
2285 BX.message({SALE_CONCRETE_PRODUCT_INP_DELETE: '$deleteInputTranslate'});
2289 $existProductsHtml =
"<table id='{$nodeId}-content' width='100%'>";
2291 foreach ($productsList as $productId => $productName)
2293 $existProductsHtml .=
"
2294 <tr class='adm-s-concrete-product-restriction-delprod' id='{$nodeId}-{$productId}'>
2296 <span> - {$productName}</span>
2297 <input type='hidden' name='RESTRICTION[PRODUCTS][]' value='{$productId}'>
2302 class='adm-s-bus-morelinkqhsw' href='javascript:void(0);'
2303 onclick=\"{$input["JS_HANDLER
"]}.deleteRestrictionByConcreteProduct('{$nodeId}', '{$productId}');\"
2305 {$deleteInputTranslate}
2312 $existProductsHtml .=
"</table>";
2314 return $existProductsHtml.$editSection;
2319 if (!\
Bitrix\
Main\Loader::includeModule(
'iblock'))
2328 'ID' => $elementIds,
2336 while ($productRow = $productsListSource->fetch())
2341 return $productsList;
2368 'CLASS' => __NAMESPACE__.
'\\ConcreteProduct',
2369 'NAME' => Loc::getMessage(
'SALE_CONCRETE_PRODUCT_INP'),
static getList(array $parameters=array())
static getPathToNodeByCode($code, $parameters, $behaviour=array('SHOW_LEAF'=> true))
static Init($arExt=array(), $bReturn=false)
static RegisterExt($name, $arPaths)
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_NEW_TAGS")?> array( $site)
const BX_RESIZE_IMAGE_PROPORTIONAL
htmlspecialcharsbx($string, $flags=ENT_COMPAT, $doubleEncode=true)
CheckDateTime($datetime, $format=false)
$GLOBALS['____1690880296']
if( $daysToExpire >=0 &&$daysToExpire< 60 elseif)( $daysToExpire< 0)
if(empty($signedUserToken)) $key
if($inWords) echo htmlspecialcharsbx(Number2Word_Rus(roundEx($totalVatSum $params['CURRENCY']
if(!Loader::includeModule('sale')) $pattern