1C-Bitrix 25.700.0
Загрузка...
Поиск...
Не найдено
prop_seq.php
См. документацию.
1<?php
2
5
7{
10
11 public static function GetUserTypeDescription()
12 {
13 return [
14 'PROPERTY_TYPE' => Iblock\PropertyTable::TYPE_NUMBER,
16 'DESCRIPTION' => Loc::getMessage('IBLOCK_PROP_SEQUENCE_DESC'),
17 'GetPropertyFieldHtml' => [__CLASS__, 'GetPropertyFieldHtml'],
18 'GetPublicEditHTML' => [__CLASS__, 'GetPropertyFieldHtml'],
19 'PrepareSettings' => [__CLASS__, 'PrepareSettings'],
20 'GetSettingsHTML' => [__CLASS__, 'GetSettingsHTML'],
21 'GetAdminFilterHTML' => [__CLASS__, 'GetPublicFilterHTML'],
22 'GetPublicFilterHTML' => [__CLASS__, 'GetPublicFilterHTML'],
23 'AddFilterFields' => [__CLASS__, 'AddFilterFields'],
24 'GetUIFilterProperty' => [__CLASS__, 'GetUIFilterProperty'],
25 'GetUIEntityEditorProperty' => [__CLASS__, 'GetUIEntityEditorProperty'],
26 'GetUIEntityEditorPropertyEditHtml' => [__CLASS__, 'GetUIEntityEditorPropertyEditHtml'],
27 'GetUIEntityEditorPropertyViewHtml' => [__CLASS__, 'GetUIEntityEditorPropertyViewHtml'],
28 ];
29 }
30
31 public static function AddFilterFields($arProperty, $strHTMLControlName, &$arFilter, &$filtered)
32 {
33 $from_name = $strHTMLControlName["VALUE"].'_from';
34 $from = isset($_REQUEST[$from_name])? $_REQUEST[$from_name]: "";
35 if (isset($strHTMLControlName["FILTER_ID"]))
36 {
37 $filterOption = new \Bitrix\Main\UI\Filter\Options($strHTMLControlName["FILTER_ID"]);
38 $filterData = $filterOption->getFilter();
39 $from = (!empty($filterData[$from_name]) ? $filterData[$from_name] : "");
40 if ($from)
41 {
42 $arFilter[">=PROPERTY_".$arProperty["ID"]] = $from;
43 $filtered = true;
44 }
45 }
46 elseif ($from)
47 {
48 $arFilter[">=PROPERTY_".$arProperty["ID"]] = $from;
49 $filtered = true;
50 }
51
52 $to_name = $strHTMLControlName["VALUE"].'_to';
53 $to = isset($_REQUEST[$to_name])? $_REQUEST[$to_name]: "";
54 if (isset($strHTMLControlName["FILTER_ID"]))
55 {
56 $filterOption = new \Bitrix\Main\UI\Filter\Options($strHTMLControlName["FILTER_ID"]);
57 $filterData = $filterOption->getFilter();
58 $to = (!empty($filterData[$to_name]) ? $filterData[$to_name] : "");
59 if ($to)
60 {
61 $arFilter["<=PROPERTY_".$arProperty["ID"]] = $to;
62 $filtered = true;
63 }
64 }
65 elseif ($to)
66 {
67 $arFilter["<=PROPERTY_".$arProperty["ID"]] = $to;
68 $filtered = true;
69 }
70 }
71
72 public static function GetPublicFilterHTML($arProperty, $strHTMLControlName)
73 {
74 $from_name = $strHTMLControlName["VALUE"].'_from';
75 $to_name = $strHTMLControlName["VALUE"].'_to';
76 $from = isset($_REQUEST[$from_name])? $_REQUEST[$from_name]: "";
77 $to = isset($_REQUEST[$to_name])? $_REQUEST[$to_name]: "";
78
79 return '
80 <input name="'.htmlspecialcharsbx($from_name).'" value="'.htmlspecialcharsbx($from).'" size="8" type="text"> ...
81 <input name="'.htmlspecialcharsbx($to_name).'" value="'.htmlspecialcharsbx($to).'" size="8" type="text">
82 ';
83 }
84
85 public static function GetPropertyFieldHtml($arProperty, $value, $strHTMLControlName)
86 {
87 if($value["VALUE"] > 0 && !$strHTMLControlName["COPY"])
88 {
89 $current_value = intval($value["VALUE"]);
90 }
91 else
92 {
93 $seq = new CIBlockSequence($arProperty["IBLOCK_ID"], $arProperty["ID"]);
94 $current_value = $seq->GetNext();
95 }
96
97 $fieldName = $strHTMLControlName['VALUE'] ?? '';
98 if (($arProperty['USER_TYPE_SETTINGS']['write'] ?? 'N') === 'Y')
99 {
100 return '<input type="text" size="5" name="' . $fieldName . '" value="' . $current_value . '">';
101 }
102 else
103 {
104 return
105 '<input disabled type="text" size="5" name="' . $fieldName . '" value="' . $current_value . '">'
106 . '<input type="hidden" size="5" name="' . $fieldName . '" value="'. $current_value. '">'
107 ;
108 }
109 }
110
111 public static function PrepareSettings($arProperty)
112 {
113 //This method not for storing sequence value in the database
114 //but it just sets starting value for it
115 if(
116 is_array($arProperty['USER_TYPE_SETTINGS'])
117 && isset($arProperty['USER_TYPE_SETTINGS']['current_value'])
118 && (int)($arProperty['USER_TYPE_SETTINGS']['current_value']) > 0
119 )
120 {
121 $seq = new CIBlockSequence($arProperty['IBLOCK_ID'], $arProperty['ID']);
122 $seq->SetNext((int)$arProperty['USER_TYPE_SETTINGS']['current_value']);
123 }
124
125 $strWritable = ($arProperty['USER_TYPE_SETTINGS']['write'] ?? 'N') === 'Y' ? 'Y' : 'N';
126
127 $arProperty['USER_TYPE_SETTINGS'] = [
128 'write' => $strWritable,
129 ];
130
131 return $arProperty;
132 }
133
134 public static function GetSettingsHTML($arProperty, $strHTMLControlName, &$arPropertyFields)
135 {
136 $arPropertyFields = array(
137 "HIDE" => array("SEARCHABLE", "WITH_DESCRIPTION", "ROW_COUNT", "COL_COUNT", "DEFAULT_VALUE")
138 );
139
140 $bWritable = ($arProperty['USER_TYPE_SETTINGS']['write'] ?? 'N') === 'Y';
141
142 $html = '
143 <tr valign="top">
144 <td>'.Loc::getMessage("IBLOCK_PROP_SEQ_SETTING_WRITABLE").':</td>
145 <td>
146 <input type="hidden" name="'.$strHTMLControlName["NAME"].'[write]" value="N">
147 <input type="checkbox" name="'.$strHTMLControlName["NAME"].'[write]" value="Y" '.($bWritable? 'checked="checked"': '').'>
148 </td>
149 </tr>
150 ';
151
152 if ((int)($arProperty['ID'] ?? 0) > 0)
153 {
154 $seq = new CIBlockSequence($arProperty["IBLOCK_ID"], $arProperty["ID"]);
155 $current_value = $seq->GetCurrent();
156 return $html.'
157 <tr valign="top">
158 <td>'.Loc::getMessage("IBLOCK_PROP_SEQ_SETTING_CURRENT_VALUE").':</td>
159 <td><input type="text" size="5" name="'.$strHTMLControlName["NAME"].'[current_value]" value="'.$current_value.'"></td>
160 </tr>
161 ';
162 }
163 else
164 {
165 $current_value = 1;
166 return $html.'
167 <tr valign="top">
168 <td>'.Loc::getMessage("IBLOCK_PROP_SEQ_SETTING_CURRENT_VALUE").':</td>
169 <td><input disabled type="text" size="5" name="'.$strHTMLControlName["NAME"].'[current_value]" value="'.$current_value.'"></td>
170 </tr>
171 ';
172 }
173 }
174
181 public static function GetUIFilterProperty($property, $control, &$fields)
182 {
183 $fields["type"] = "number";
184 $fields["filterable"] = "";
185 $fields["operators"] = array(
186 "default" => "=",
187 "exact" => "=",
188 "enum" => "@",
189 "range" => "><",
190 "more" => ">",
191 "less" => "<"
192 );
193 }
194
195 public static function GetUIEntityEditorProperty($settings, $value)
196 {
197 return [
198 'type' => $settings['MULTIPLE'] === 'Y' ? 'multinumber' : 'number',
199 ];
200 }
201}
const USER_TYPE_SEQUENCE
Определения propertytable.php:81
const TYPE_NUMBER
Определения propertytable.php:66
static GetUIFilterProperty($property, $control, &$fields)
Определения prop_seq.php:181
static PrepareSettings($arProperty)
Определения prop_seq.php:111
static GetSettingsHTML($arProperty, $strHTMLControlName, &$arPropertyFields)
Определения prop_seq.php:134
static AddFilterFields($arProperty, $strHTMLControlName, &$arFilter, &$filtered)
Определения prop_seq.php:31
static GetPropertyFieldHtml($arProperty, $value, $strHTMLControlName)
Определения prop_seq.php:85
static GetUserTypeDescription()
Определения prop_seq.php:11
static GetUIEntityEditorProperty($settings, $value)
Определения prop_seq.php:195
const USER_TYPE
Определения prop_seq.php:9
static GetPublicFilterHTML($arProperty, $strHTMLControlName)
Определения prop_seq.php:72
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_NEW_TAGS")?> array( $site)
Определения file_new.php:804
$_REQUEST["admin_mnu_menu_id"]
Определения get_menu.php:8
$control
Определения iblock_catalog_edit.php:61
htmlspecialcharsbx($string, $flags=ENT_COMPAT, $doubleEncode=true)
Определения tools.php:2701
$settings
Определения product_settings.php:43
if( $daysToExpire >=0 &&$daysToExpire< 60 elseif)( $daysToExpire< 0)
Определения prolog_main_admin.php:393
$arFilter
Определения user_search.php:106
$fields
Определения yandex_run.php:501