3namespace Bitrix\Main\UI\Filter;
5use Bitrix\Main\Localization\Loc;
6use Bitrix\Main\Text\HtmlFilter;
7use Bitrix\Main\Type\Date;
9Loc::loadMessages(__FILE__);
28 "ID" =>
"field_".
$name,
29 "TYPE" => Type::STRING,
33 "PLACEHOLDER" => $placeholder
49 "ID" =>
"field_".
$name,
50 "TYPE" => Type::TEXTAREA,
54 "PLACEHOLDER" => $placeholder
70 public static function custom(
$name, $value, $label =
"", $placeholder =
"", $style =
false)
73 "ID" =>
"field_".
$name,
74 "TYPE" => Type::CUSTOM,
77 "PLACEHOLDER" => $placeholder,
79 "ENABLE_STYLE" => $style
94 public static function customEntity(
$name, $label =
"", $placeholder =
"", $multiple =
false)
97 "ID" =>
"field_".
$name,
98 "TYPE" => Type::CUSTOM_ENTITY,
105 "MULTIPLE" => $multiple,
106 "PLACEHOLDER" => $placeholder
136 $allowYearsSwithcer =
false,
140 if (!is_bool($enableTime))
145 if (!is_array($exclude))
150 $selectParams =
array(
"isMulti" =>
false);
165 $sourceMonths = range(1, 12);
167 $currentMonthNumber = $date->format(
"n");
169 $currentMonthType =
array();
171 foreach($sourceMonths as
$key => $month)
176 "NAME" => static::getMessage(
$messages,
"MAIN_UI_FILTER_FIELD_MONTH_".$month)
179 if ($currentMonthNumber == $month)
181 $currentMonthType =
array(
183 "NAME" => static::getMessage(
$messages,
"MAIN_UI_FILTER_FIELD_MONTH_".$month)
189 $sourceQuarters = range(1, 4);
192 $currentQuarterType =
array();
194 foreach($sourceQuarters as
$key => $quarter)
196 $quarter = (
string)$quarter;
200 "NAME" => static::getMessage(
$messages,
"MAIN_UI_FILTER_FIELD_QUARTER_".$quarter)
203 if ($quarterNumber == $quarter)
205 $currentQuarterType =
array(
207 "NAME" => static::getMessage(
$messages,
"MAIN_UI_FILTER_FIELD_QUARTER_".$quarter)
214 $subtypeType =
array();
216 foreach ($sourceSubtypes as
$key => $subtype)
218 if (!in_array($subtype, $exclude))
221 "NAME" => static::getMessage(
$messages,
"MAIN_UI_FILTER_FIELD_SUBTYPE_".$subtype),
225 if ($subtype ==
$type)
227 $subtypeType =
array(
228 "NAME" => static::getMessage(
$messages,
"MAIN_UI_FILTER_FIELD_SUBTYPE_".$subtype),
235 if (is_array($include))
237 foreach ($include as
$key => $item)
242 "NAME" => static::getMessage(
$messages,
"MAIN_UI_FILTER_FIELD_SUBTYPE_".$item),
244 "DECL" => static::customDate(
array(
"id" =>
$name,
"name" => $label))
254 "NAME" => static::getMessage(
$messages,
"MAIN_UI_FILTER_FIELD_SUBTYPE_".$item),
261 $currentYear = (int) $date->format(
"Y");
262 $sourceYears = range($currentYear+5, $currentYear-20);
264 $currentYearType =
array();
275 if (
$year == $currentYear)
277 $currentYearType =
array(
284 $yearsSwitcher = static::select(
288 "NAME" => Loc::getMessage(
"MAIN_UI_FILTER_FIELD_SUBTYPE_CUSTOM_DATE_YEARS_SWITCHER_YES"),
292 "NAME" => Loc::getMessage(
"MAIN_UI_FILTER_FIELD_SUBTYPE_CUSTOM_DATE_YEARS_SWITCHER_NO"),
300 "ID" =>
"field_".
$name,
301 "TYPE" => Type::DATE,
303 "SUB_TYPE" => $subtypeType,
304 "SUB_TYPES" => $subtypes,
305 "MONTH" => $currentMonthType,
307 "QUARTER" => $currentQuarterType,
308 "QUARTERS" => $quarters,
309 "YEAR" => $currentYearType,
312 "PLACEHOLDER" => $placeholder,
314 "ENABLE_TIME" => $enableTime,
315 "SELECT_PARAMS" => $selectParams,
316 "YEARS_SWITCHER" => $allowYearsSwithcer ? $yearsSwitcher :
null
343 $selectParams =
array(
"isMulti" =>
false);
356 foreach ($sourceSubtypes as
$key => $subtype)
358 if (!is_array($exclude) || !in_array($subtype, $exclude))
361 "NAME" => static::getMessage(
$messages,
"MAIN_UI_FILTER__NUMBER_".
$key),
365 if ($subtype ==
$type)
368 "NAME" => static::getMessage(
$messages,
"MAIN_UI_FILTER__NUMBER_".
$key),
375 if (is_array($include))
378 foreach ($additionalSubtypes as
$key => $subtype)
380 if (in_array($subtype, $include))
383 "NAME" => static::getMessage(
$messages,
"MAIN_UI_FILTER__NUMBER_".
$key),
391 "ID" =>
"field_".$name,
392 "TYPE" => Type::NUMBER,
394 "SUB_TYPE" => $subtypeType,
395 "SUB_TYPES" => $subtypes,
398 "PLACEHOLDER" => $placeholder,
399 "SELECT_PARAMS" => $selectParams
422 "ID" =>
"field_".
$name,
423 "TYPE" => Type::SELECT,
426 "PLACEHOLDER" => $placeholder,
429 "PARAMS" =>
array(
"isMulti" =>
false)
448 "ID" =>
"field_".
$name,
449 "TYPE" => Type::MULTI_SELECT,
452 "PLACEHOLDER" => $placeholder,
455 "PARAMS" =>
array(
"isMulti" =>
true)
470 $days = static::getDaysList();
471 $daysDate =
new Date();
472 $today = (int) $daysDate->format(
"d");
473 $yesterday = (int) $daysDate->add(
"-1 days")->format(
"d");
474 $tomorrow = (int) $daysDate->add(
"2 days")->format(
"d");
475 $additionalDays =
array(
477 "NAME" => Loc::getMessage(
"MAIN_UI_FILTER_FIELD_SUBTYPE_CUSTOM_DATE_TODAY"),
481 "NAME" => Loc::getMessage(
"MAIN_UI_FILTER_FIELD_SUBTYPE_CUSTOM_DATE_YESTERDAY"),
482 "VALUE" => $yesterday
485 "NAME" => Loc::getMessage(
"MAIN_UI_FILTER_FIELD_SUBTYPE_CUSTOM_DATE_TOMORROW"),
492 $days = array_merge($additionalDays, $days);
494 $months = static::getMonthsList();
495 $monthsDate =
new Date();
496 $currentMonth = (int) $monthsDate->format(
"n");
497 $lastMonth = (int) $monthsDate->add(
"-1 month")->format(
"n");
498 $nextMonth = (int) $monthsDate->add(
"2 month")->format(
"n");
499 $additionalMonths =
array(
501 "NAME" => Loc::getMessage(
"MAIN_UI_FILTER_FIELD_SUBTYPE_CUSTOM_DATE_CURRENT_MONTH"),
502 "VALUE" => $currentMonth
505 "NAME" => Loc::getMessage(
"MAIN_UI_FILTER_FIELD_SUBTYPE_CUSTOM_DATE_LAST_MONTH"),
506 "VALUE" => $lastMonth
509 "NAME" => Loc::getMessage(
"MAIN_UI_FILTER_FIELD_SUBTYPE_CUSTOM_DATE_NEXT_MONTH"),
510 "VALUE" => $nextMonth
516 $months = array_merge($additionalMonths, $months);
518 $years = static::getYearsList();
519 $yearsDate =
new Date();
520 $currentYear = (int) $yearsDate->format(
"Y");
521 $lastYear = (int) $yearsDate->add(
"-1 year")->format(
"Y");
522 $nextYear = (int) $yearsDate->add(
"2 year")->format(
"Y");
523 $additionalYears =
array(
525 "NAME" => Loc::getMessage(
"MAIN_UI_FILTER_FIELD_SUBTYPE_CUSTOM_DATE_CURRENT_YEAR"),
526 "VALUE" => $currentYear
529 "NAME" => Loc::getMessage(
"MAIN_UI_FILTER_FIELD_SUBTYPE_CUSTOM_DATE_LAST_YEAR"),
533 "NAME" => Loc::getMessage(
"MAIN_UI_FILTER_FIELD_SUBTYPE_CUSTOM_DATE_NEXT_YEAR"),
540 $years = array_merge($additionalYears, $years);
544 "TYPE" => Type::CUSTOM_DATE,
551 "DAYS_PLACEHOLDER" => Loc::getMessage(
"MAIN_UI_FILTER_FIELD_DAYS"),
552 "MONTHS_PLACEHOLDER" => Loc::getMessage(
"MAIN_UI_FILTER_FIELD_MONTHS"),
553 "YEARS_PLACEHOLDER" => Loc::getMessage(
"MAIN_UI_FILTER_FIELD_YEARS")
566 foreach(range(1, 12) as
$key => $month)
570 "NAME" => (
string) Loc::getMessage(
"MAIN_UI_FILTER_FIELD_MONTH_".$month)
586 $currentYear = (int) $date->format(
"Y");
587 $sourceYears = range(($currentYear+5), ($currentYear-95));
593 "NAME" => (
string)
$year,
610 foreach(range(1, 31) as
$key => $day)
614 "NAME" => (
string) $day
633 \CJSCore::init(
array(
'socnetlogdest'));
638 "ID" =>
"field_".
$name.($filterName <>
'' ?
'_'.$filterName :
''),
639 "TYPE" => Type::DEST_SELECTOR,
646 "MULTIPLE" => $multiple,
647 "PLACEHOLDER" => $placeholder
653 $optionsList =
array(
654 'multiple' => ($multiple ?
'Y' :
'N'),
655 'eventInit' =>
'BX.Filter.DestinationSelector:openInit',
656 'eventOpen' =>
'BX.Filter.DestinationSelector:open',
658 'popupAutoHide' =>
'N',
660 'userNameTemplate' => \CUtil::jSEscape(\CSite::getNameFormat()),
661 'useClientDatabase' => (isset(
$params[
'useClientDatabase']) &&
$params[
'useClientDatabase'] ==
'N' ?
'N' :
'Y'),
663 'enableUsers' => (!isset(
$params[
'enableUsers']) ||
$params[
'enableUsers'] !=
'N' ?
'Y' :
'N'),
664 'enableDepartments' => (!isset(
$params[
'enableDepartments']) ||
$params[
'enableDepartments'] !=
'N' ?
'Y' :
'N'),
665 'allowAddUser' =>
'N',
666 'allowAddCrmContact' =>
'N',
667 'allowAddSocNetGroup' =>
'N',
668 'allowSearchCrmEmailUsers' =>
'N',
669 'allowSearchNetworkUsers' =>
'N',
670 'useNewCallback' =>
'Y',
671 'focusInputOnSelectItem' =>
'N',
672 'focusInputOnSwitchTab' =>
'N',
673 'landing' => (isset(
$params[
'landing']) &&
$params[
'landing'] ==
'Y' ?
'Y' :
'N'),
676 if (!empty(
$params[
'contextCode']))
678 $optionsList[
'contextCode'] =
$params[
'contextCode'];
686 if (isset(
$params[
'enableUsers']))
690 if (isset(
$params[
'enableDepartments']))
692 unset(
$params[
'enableDepartments']);
695 $optionsList = array_merge($optionsList,
$params);
698 "bitrix:main.ui.selector",
701 'API_VERSION' => (!empty(
$params[
'apiVersion']) && intval(
$params[
'apiVersion']) >= 2 ? intval(
$params[
'apiVersion']) : 2),
703 'ITEMS_SELECTED' =>
array(),
705 'select' =>
'BX.Filter.DestinationSelectorManager.onSelect.bind(null, \''.(isset(
$params[
'isNumeric']) &&
$params[
'isNumeric'] ==
'Y' ?
'Y' :
'N').
'\', \
''.(
$params[
'prefix'] ??
'').
'\')
',
707 'openDialog
' => 'BX.Filter.DestinationSelectorManager.onDialogOpen
',
708 'closeDialog
' => 'BX.Filter.DestinationSelectorManager.onDialogClose
',
710 'closeSearch
' => 'BX.Filter.DestinationSelectorManager.onDialogClose
',
712 'OPTIONS
' => $optionsList,
716 array("HIDE_ICONS" => "Y")
719 $field["HTML"] = ob_get_clean();
725 public static function entitySelector(
728 string $placeholder = '',
730 string $filterName = ''
733 $multiple = $params['multiple
'] ?? false;
734 $addEntityIdToResult = $params['addEntityIdToResult
'] ?? false;
735 $showDialogOnEmptyInput = $params['showDialogOnEmptyInput
'] ?? true;
736 $dialogOptions = $params['dialogOptions
'] ?? [];
738 'ID
' => 'field_
' . $name . ($filterName != '' ? '_
' . $filterName : ''),
739 'TYPE
' => Type::ENTITY_SELECTOR,
746 'MULTIPLE
' => $multiple,
747 'PLACEHOLDER
' => $placeholder,
748 'DIALOG_OPTIONS
' => $dialogOptions,
749 'ADD_ENTITY_ID_TO_RESULT
' => $addEntityIdToResult,
750 'SHOW_DIALOG_ON_EMPTY_INPUT
' => $showDialogOnEmptyInput,
756 protected static function getMessage($messages, $messageId)
758 if (is_array($messages) && array_key_exists($messageId, $messages))
760 return $messages[$messageId];
763 return Loc::getMessage($messageId);
if($_SERVER $defaultValue['REQUEST_METHOD']==="GET" &&!empty($RestoreDefaults) && $bizprocPerms==="W" &&check_bitrix_sessid())
static encode($string, $flags=ENT_COMPAT, $doubleEncode=true)
static select($name, $items, Array $defaultValue=array(), $label="", $placeholder="")
static date( $name, $type=DateType::NONE, $values=[], $label="", $placeholder="", $enableTime=false, $exclude=[], $include=[], $allowYearsSwithcer=false, $messages=[])
static multiSelect($name, $items, $defaultValues=array(), $label="", $placeholder="")
static customEntity($name, $label="", $placeholder="", $multiple=false)
static destSelector($name, $label="", $placeholder="", $multiple=false, $params=array(), $lightweight=false, $filterName='')
static custom($name, $value, $label="", $placeholder="", $style=false)
static textarea($name, $defaultValue="", $label="", $placeholder="")
static number( $name, $type=NumberType::SINGLE, $values=[], $label="", $placeholder="", $exclude=[], $include=[], $messages=[])
static string($name, $defaultValue="", $label="", $placeholder="")
static customDate($options=array())
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_NEW_TAGS")?> array( $site)
if(empty($signedUserToken)) $key
</p ></td >< td valign=top style='border-top:none;border-left:none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;padding:0cm 2.0pt 0cm 2.0pt;height:9.0pt'>< p class=Normal align=center style='margin:0cm;margin-bottom:.0001pt;text-align:center;line-height:normal'>< a name=ТекстовоеПоле54 ></a ><?=($taxRate > count( $arTaxList) > 0) ? $taxRate."%"
if($inWords) echo htmlspecialcharsbx(Number2Word_Rus(roundEx($totalVatSum $params['CURRENCY']