1C-Bitrix 25.700.0
Загрузка...
Поиск...
Не найдено
options.php
См. документацию.
1<?php
8
9if (!$USER->IsAdmin())
10{
11 return;
12}
13
14if (!Loader::includeModule('iblock'))
15{
16 return;
17}
18
20
21IncludeModuleLangFile($_SERVER["DOCUMENT_ROOT"]."/bitrix/modules/main/options.php");
22IncludeModuleLangFile(__FILE__);
23
25 GetMessage('IBLOCK_OPTION_SECTION_SYSTEM'),
26 array("property_features_enabled", GetMessage("IBLOCK_PROPERTY_FEATURES"), "Y", array("checkbox", "Y")),
27 array("event_log_iblock", GetMessage("IBLOCK_EVENT_LOG"), "Y", array("checkbox", "Y")),
28 array("path2rss", GetMessage("IBLOCK_PATH2RSS"), "/upload/", array("text", 30)),
29 GetMessage('IBLOCK_OPTION_SECTION_LIST_AND_FORM'),
30 array("use_htmledit", GetMessage("IBLOCK_USE_HTMLEDIT"), "N", array("checkbox", "Y")),
31 array("list_image_size", GetMessage("IBLOCK_LIST_IMAGE_SIZE"), "50", array("text", 5)),
32 array("detail_image_size", GetMessage("IBLOCK_DETAIL_IMAGE_SIZE"), "200", array("text", 5)),
33 array("show_xml_id", GetMessage("IBLOCK_SHOW_LOADING_CODE"), "N", array("checkbox", "Y")),
34 array("excel_export_rights", GetMessage("IBLOCK_EXCEL_EXPORT_RIGHTS"), "N", array("checkbox", "Y")),
35 array("list_full_date_edit", GetMessage("IBLOCK_LIST_FULL_DATE_EDIT"), "N", array("checkbox", "Y")),
36 array("combined_list_mode", GetMessage("IBLOCK_COMBINED_LIST_MODE"), "N", array("checkbox", "Y")),
37 array("iblock_menu_max_sections", GetMessage("IBLOCK_MENU_MAX_SECTIONS"), "50", array("text", 5)),
38 array("change_user_by_group_active_modify", GetMessage("IBLOCK_OPTION_CHANGE_USER_BY_GROUP_ACTIVE_MODIFY"), "N", array("checkbox", "N")),
39 GetMessage('IBLOCK_OPTION_SECTION_CUSTOM_FORM'),
40 array("custom_edit_form_use_property_id", GetMessage("IBLOCK_CUSTOM_FORM_USE_PROPERTY_ID"), "Y", array("checkbox", "Y")),
41 GetMessage('IBLOCK_OPTION_SECTION_IMPORT_EXPORT'),
42 array("num_catalog_levels", GetMessage("IBLOCK_NUM_CATALOG_LEVELS"), "3", array("text", 5)),
43);
45 array("DIV" => "edit1", "TAB" => GetMessage("MAIN_TAB_SET"), "ICON" => "ib_settings", "TITLE" => GetMessage("MAIN_TAB_TITLE_SET")),
46 array("DIV" => "iblock_cache", "TAB" => GetMessage("IBLOCK_OPTION_TAB_CACHE"), "TITLE" => GetMessage("IBLOCK_OPTION_TAB_CACHE_TITLE"))
47);
48$tabControl = new CAdminTabControl("tabControl", $aTabs);
49
50$request = Main\Context::getCurrent()->getRequest();
51
53if ($request->getPost('Update') !== null)
54{
55 $currentAction = 'save';
56}
57elseif ($request->getPost('Apply') !== null)
58{
59 $currentAction = 'apply';
60}
61elseif ($request->getPost('RestoreDefaults') !== null)
62{
63 $currentAction = 'reset';
64}
65
66$backUrl = (string)$request->get('back_url_settings');
67if ($request->isPost() && $currentAction !== null && check_bitrix_sessid())
68{
69 if ($currentAction === 'reset')
70 {
72 }
73 else
74 {
75 foreach($arAllOptions as $arOption)
76 {
77 if (!is_array($arOption))
78 continue;
79 $name=$arOption[0];
80 $val = $request->getPost($name);
81 if ($val === null)
82 {
83 continue;
84 }
85 $val = (string)$val;
86 if ($arOption[3][0] === "checkbox")
87 {
88 $val = ($val === 'Y' ? 'Y' : 'N');
89 }
90 Main\Config\Option::set('iblock', $name, $val, '');
91 }
92 unset($arOption);
93
94 $period = (int)$request->getPost('iblock_activity_dates_period');
95 if ($period === -1)
96 {
97 $period = (int)$request->getPost('iblock_activity_dates_period_custom');
98 }
99 if ($period !== 0)
100 {
101 $oldPeriod = (int)Main\Config\Option::get('iblock', 'iblock_activity_dates_period');
102
103 $activity = $request->getPost('IBLOCK_ACTIVITY_DATES');
104 if (!is_array($activity))
105 {
106 $activity = [];
107 }
108 if (!empty($activity))
109 {
111 }
112 $oldActivity = Main\Config\Option::get('iblock', 'iblock_activity_dates');
113 if ($oldActivity !== '')
114 {
115 $oldActivity = explode(',', $oldActivity);
117 }
118 else
119 {
120 $oldActivity = [];
121 }
122 $removeAgents = [];
123 $addAgents = [];
124
125 if ($oldPeriod != $period)
126 {
127 $removeAgents = $oldActivity;
128 $addAgents = $activity;
129 }
130 else
131 {
132 $removeAgents = array_diff($oldActivity, $activity);
133 $addAgents = array_diff($activity, $oldActivity);
134 }
135
136 if (!empty($removeAgents))
137 {
138 foreach ($removeAgents as $iblockId)
139 {
140 $iterator = CAgent::GetList(
141 [],
142 [
143 'MODULE_ID' => 'iblock',
144 'NAME' => '\CIBlock::checkActivityDatesAgent(' . $iblockId . ',%',
145 ]
146 );
147 while ($row = $iterator->Fetch())
148 {
149 CAgent::Delete($row['ID']);
150 }
151 unset($row);
152 unset($iterator);
153 }
154 unset($iblockId);
155 }
156 if (!empty($addAgents))
157 {
158 $currentTime = time();
159 foreach ($addAgents as $iblockId)
160 {
161 CAgent::AddAgent(
162 '\CIBlock::checkActivityDatesAgent('.$iblockId.', '.$currentTime.');',
163 'iblock',
164 'N',
165 $period,
166 '',
167 'Y',
168 '',
169 100,
170 false,
171 false
172 );
173 }
174 unset($iblockId);
175 }
176
177 Main\Config\Option::set('iblock', 'iblock_activity_dates', implode(',', $activity), '');
178 Main\Config\Option::set('iblock', 'iblock_activity_dates_period', $period, '');
179 }
180 }
181
182 if ($currentAction === 'save' && $backUrl !== '')
183 {
185 }
186 else
187 {
188 LocalRedirect($APPLICATION->GetCurPage()
189 . '?lang=' . LANGUAGE_ID
190 . '&mid=' . urlencode($mid)
191 . '&mid_menu=1'
192 . ($backUrl !== '' ? "&back_url_settings=" . urlencode($backUrl) : '')
193 . "&" . $tabControl->ActiveTabParam())
194 ;
195 }
196}
197
199foreach($arAllOptions as $option)
200{
201 if (!is_array($option))
202 {
203 continue;
204 }
205 $id = $option[0];
206 $currentValues[$id] = Main\Config\Option::get('iblock', $id);
207}
208unset($id, $option);
209
211if ($currentValues['property_features_enabled'] == 'N')
212 $needFeatureConfirm = !Iblock\Model\PropertyFeature::isPropertyFeaturesExist();
213
214$activity = Main\Config\Option::get('iblock', 'iblock_activity_dates');
215if ($activity !== '')
216{
217 $activity = explode(',', $activity);
219}
220else
221{
222 $activity = array();
223}
224$currentValues['iblock_activity_dates'] = $activity;
225unset($activity);
226$currentValues['iblock_activity_dates_period'] = (int)Main\Config\Option::get('iblock', 'iblock_activity_dates_period');
227if ($currentValues['iblock_activity_dates_period'] <= 0)
228{
229 $currentValues['iblock_activity_dates_period'] = (int)$defaultValues['iblock_activity_dates_period'];
230}
231$currentValues['iblock_activity_dates_period_custom'] = $currentValues['iblock_activity_dates_period'];
232
234 -1 => GetMessage('IBLOCK_OPTION_CHECK_ACTIVITY_PERIOD_CUSTOM'),
235 3600 => GetMessage('IBLOCK_OPTION_CHECK_ACTIVITY_PERIOD_ONE_HOUR'),
236 10800 => GetMessage('IBLOCK_OPTION_CHECK_ACTIVITY_PERIOD_THREE_HOUR'),
237 21600 => GetMessage('IBLOCK_OPTION_CHECK_ACTIVITY_PERIOD_SIX_HOUR'),
238 43200 => GetMessage('IBLOCK_OPTION_CHECK_ACTIVITY_PERIOD_TWELVE_HOUR'),
239 86400 => GetMessage('IBLOCK_OPTION_CHECK_ACTIVITY_PERIOD_DAY')
240);
241if (!isset($periodList[$currentValues['iblock_activity_dates_period']]))
242{
243 $currentValues['iblock_activity_dates_period'] = -1;
244}
245
247 'property_features_enabled' => GetMessage(
248 'IBLOCK_PROPERTY_FEATURES_HINT',
249 ['#LINK#' => 'https://dev.1c-bitrix.ru/learning/course/index.php?COURSE_ID=42&LESSON_ID=1986']
250 ),
251 'change_user_by_group_active_modify' => GetMessage('IBLOCK_OPTION_CHANGE_USER_BY_GROUP_ACTIVE_MODIFY_HINT')
252);
253
254$tabControl->Begin();
255?><form method="post" action="<?= $APPLICATION->GetCurPage()?>?lang=<?= LANGUAGE_ID; ?>&mid=<?= urlencode($mid); ?>&mid_menu=1"><?php
256$tabControl->BeginNextTab();
257foreach($arAllOptions as $arOption)
258{
259 if (!is_array($arOption))
260 {
261 ?><tr class="heading"><td colspan="2"><?= htmlspecialcharsbx($arOption); ?></td></tr><?php
262 }
263 else
264 {
265 $id = $arOption[0];
266 $val = $currentValues[$id];
267 $type = $arOption[3];
268 $controlId = htmlspecialcharsbx($id);
269 ?>
270 <tr>
271 <td style="width: 40%; white-space: nowrap;"<?= ($type[0] === 'textarea' ? ' class="adm-detail-valign-top"' : ''); ?>>
272 <?php
273 if (isset($optionHints[$id]))
274 {
275 ?><span id="hint_<?= $controlId; ?>"></span>
276 <script>BX.hint_replace(BX('hint_<?=$controlId;?>'), '<?=\CUtil::JSEscape($optionHints[$id]); ?>');</script>&nbsp;<?php
277 }
278 ?><label for="<?= $controlId; ?>"><?= htmlspecialcharsbx($arOption[1]); ?></label>
279 <td>
280 <?php
281 switch ($type[0])
282 {
283 case "checkbox":
284 ?><input type="hidden" name="<?=$controlId; ?>" value="N">
285 <input type="checkbox" id="<?=$controlId; ?>" name="<?=$controlId; ?>" value="Y"<?=($val == "Y" ? " checked" : ""); ?>><?php
286 break;
287 case "text":
288 ?><input type="text" id="<?=$controlId; ?>" name="<?=$controlId; ?>" value="<?= htmlspecialcharsbx($val); ?>" size="<?=$type[1]; ?>" maxlength="255"><?php
289 break;
290 case "textarea":
291 ?><textarea id="<?=$controlId; ?>" name="<?=$controlId; ?>" rows="<?=$type[1]; ?>" cols="<?=$type[2]; ?>"><?= htmlspecialcharsbx($val); ?></textarea><?php
292 break;
293 }
294 ?>
295 </td>
296 </tr>
297 <?php
298 }
299}
300unset($arOption, $arAllOptions);
301$tabControl->BeginNextTab();
302?><tr class="heading"><td colspan="2"><?=htmlspecialcharsbx(GetMessage("IBLOCK_OPTION_SECTION_TAG_CACHE")); ?></td></tr>
303<tr>
304 <td style="width: 40%; white-space: nowrap;" class="adm-detail-valign-top"><?php
305 echo GetMessage("IBLOCK_OPTION_CHECK_ACTIVITY_CACHE");
306 ?></td>
307 <td style="width: 60%">
308 <table id="iblockList" class="internal">
309 <?php
310 if (!empty($currentValues['iblock_activity_dates']))
311 {
312 foreach($currentValues['iblock_activity_dates'] as $iblockId)
313 {
314 $iblockName = (string)CIBlock::GetArrayByID($iblockId, 'NAME');
315 if ($iblockName !== '')
316 {
317 ?><tr>
318 <td><?= ('['.$iblockId.'] '.htmlspecialcharsbx($iblockName)); ?></td>
319 <td>
320 <input type="button" value="<?= htmlspecialcharsbx(GetMessage("IBLOCK_MESS_DELETE_ENTITY")) ?>" onclick="deleteRow(this)">
321 <input type="hidden" name="IBLOCK_ACTIVITY_DATES[]" value="<?= $iblockId; ?>">
322 </td>
323 </tr><?php
324 }
325 }
326 unset($iblockId);
327 }
328 ?>
329 </table>
330 <script>
331 function deleteRow(button)
332 {
333 var my_row = button.parentNode.parentNode,
334 table = document.getElementById('iblockList'),
335 i;
336 if (BX.type.isElementNode(table))
337 {
338 for(i = 0; i < table.rows.length; i++)
339 {
340 if (table.rows[i] === my_row)
341 {
342 table.deleteRow(i);
343 }
344 }
345 }
346 }
347 function InS<?= md5("input_IBLOCK_LIST")?>(iblockId, iblockName)
348 {
349 var table = document.getElementById('iblockList'),
350 oRow,
351 i,
352 oCell;
353 if (BX.type.isElementNode(table))
354 {
355 if(iblockId !== '' && iblockName !== '')
356 {
357 oRow = table.insertRow(-1);
358
359 i=0;
360 oCell = oRow.insertCell(i++);
361 oCell.innerHTML = '['+iblockId +'] ' + BX.util.htmlspecialchars(iblockName);
362
363 oCell = oRow.insertCell(i++);
364 oCell.innerHTML =
365 '<input type="button" value="<?=htmlspecialcharsbx(GetMessage("IBLOCK_MESS_DELETE_ENTITY")); ?>" OnClick="deleteRow(this)">'+
366 '<input type="hidden" name="IBLOCK_ACTIVITY_DATES[]" value="'+iblockId+'">';
367 }
368 }
369 }
370 </script>
371 <input name="input_IBLOCK_LIST" id="input_IBLOCK_LIST" type="hidden">
372 <input type="button" value="<?= htmlspecialcharsbx(GetMessage("IBLOCK_MESS_ADD_ENTITY")); ?>" onClick="jsUtils.OpenWindow('/bitrix/admin/iblock_search.php?lang=<?=LANGUAGE_ID?>&amp;n=input_IBLOCK_LIST&amp;m=y', 900, 700);">
373 </td>
374</tr>
375<tr>
376 <td style="width: 40%;"><?=GetMessage("IBLOCK_OPTION_CHECK_ACTIVITY_PERIOD"); ?></td>
377 <td style="width: 60%;">
378 <select id="iblock_activity_dates_period" name="iblock_activity_dates_period"><?php
379 foreach ($periodList as $index => $value)
380 {
381 ?><option value="<?= $index; ?>"<?= ($index == $currentValues['iblock_activity_dates_period'] ? ' selected' : '');?>><?= htmlspecialcharsbx($value); ?></option><?php
382 }
383 ?></select>
384 </td>
385</tr>
386<tr id="iblock_activity_dates_period_custom" style="display: <?=($currentValues['iblock_activity_dates_period'] == -1 ? 'table-row' : 'none');?>;">
387 <td style="width: 40%;">&nbsp;</td>
388 <td style="width: 60%;">
389 <input type="text" name="iblock_activity_dates_period_custom" value="<?= $currentValues['iblock_activity_dates_period_custom']; ?>"><?= GetMessage('IBLOCK_OPTION_CHECK_ACTIVITY_PERIOD_CUSTOM_UNIT'); ?>
390 </td>
391</tr>
392<?php
393$tabControl->Buttons();?>
394 <input type="submit" name="Update" value="<?= GetMessage("MAIN_SAVE")?>" title="<?= GetMessage("MAIN_OPT_SAVE_TITLE")?>" class="adm-btn-save">
395 <input type="submit" name="Apply" value="<?= GetMessage("MAIN_OPT_APPLY")?>" title="<?= GetMessage("MAIN_OPT_APPLY_TITLE")?>">
396 <?php
397 if ($backUrl !== ''):?>
398 <input type="button" name="Cancel" value="<?=GetMessage("MAIN_OPT_CANCEL")?>" title="<?= GetMessage("MAIN_OPT_CANCEL_TITLE")?>" onclick="window.location='<?= htmlspecialcharsbx(CUtil::addslashes($backUrl))?>'">
399 <input type="hidden" name="back_url_settings" value="<?= htmlspecialcharsbx($backUrl)?>">
400 <?php
401 endif;
402 ?>
403 <input type="submit" name="RestoreDefaults" title="<?= GetMessage("MAIN_HINT_RESTORE_DEFAULTS")?>" OnClick="return confirm('<?= AddSlashes(GetMessage("MAIN_HINT_RESTORE_DEFAULTS_WARNING"))?>')" value="<?= GetMessage("MAIN_RESTORE_DEFAULTS")?>">
404 <?=bitrix_sessid_post();?>
405<?php
406$tabControl->End();
407?>
408</form>
409<script>
410function checkFeatures()
411{
412 var featureControl = BX('property_features_enabled');
413 if (BX.type.isElementNode(featureControl))
414 {
415 if (featureControl.checked)
416 {
417 if (!confirm('<?= \CUtil::JSEscape(GetMessage('IBLOCK_OPTION_MESS_CHECK_FEATURES')); ?>'))
418 featureControl.checked = false;
419 }
420 }
421}
422function checkCachePeriod()
423{
424 var control = BX('iblock_activity_dates_period'),
425 block = BX('iblock_activity_dates_period_custom');
426
427 if (BX.type.isElementNode(control) && BX.type.isElementNode(block))
428 {
429 block.style.display = (control.value === '-1' ? 'table-row' : 'none');
430 }
431}
432BX.ready(function(){
433 var featureControl = BX('property_features_enabled'),
434 periodControl = BX('iblock_activity_dates_period');
435<?php
437{
438 ?>
439 if (BX.type.isElementNode(featureControl))
440 {
441 BX.bind(featureControl, 'click', checkFeatures);
442 }
443<?php
444}
445?>
446 if (BX.type.isElementNode(periodControl))
447 {
448 BX.bind(periodControl, 'change', checkCachePeriod);
449 }
450});
451</script>
return select
Определения access_edit.php:440
$type
Определения options.php:106
global $APPLICATION
Определения include.php:80
if($_SERVER $arAllOptions['REQUEST_METHOD']=='GET' &&!empty($_REQUEST['RestoreDefaults']) &&! $bReadOnly &&check_bitrix_sessid())
Определения options.php:63
if(!Loader::includeModule('catalog')) if(!AccessController::getCurrent() ->check(ActionDictionary::ACTION_PRICE_EDIT)) if(!check_bitrix_sessid()) $request
Определения catalog_reindex.php:36
static delete($moduleId, array $filter=array())
Определения option.php:388
static getDefaults($moduleId)
Определения option.php:108
static get($moduleId, $name, $default="", $siteId=false)
Определения option.php:30
static set($moduleId, $name, $value="", $siteId="")
Определения option.php:261
Определения loader.php:13
static normalizeArrayValuesByInt(&$map, $sorted=true)
Определения collection.php:150
& nbsp
Определения epilog_main_admin.php:38
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_NEW_TAGS")?> array( $site)
Определения file_new.php:804
if($request->isPost() && $currentAction !==null &&check_bitrix_sessid()) $currentValues
Определения options.php:198
if(!isset($periodList[$currentValues['iblock_activity_dates_period']])) $optionHints
Определения options.php:246
$currentAction
Определения options.php:52
$periodList
Определения options.php:233
$needFeatureConfirm
Определения options.php:210
$activity
Определения options.php:214
if($request->getPost('Update') !==null) elseif( $request->getPost( 'Apply') !==null) elseif($request->getPost('RestoreDefaults') !==null) $backUrl
Определения options.php:66
$iblockId
Определения iblock_catalog_edit.php:30
$defaultValues
Определения iblock_catalog_edit.php:124
$_SERVER["DOCUMENT_ROOT"]
Определения cron_frame.php:9
global $USER
Определения csv_new_run.php:40
$tabControl
Определения csv_new_setup.php:244
$aTabs
Определения csv_new_setup.php:238
endif
Определения csv_new_setup.php:990
$mid
Определения options.php:27
bitrix_sessid_post($varname='sessid', $returnInvocations=false)
Определения tools.php:4700
check_bitrix_sessid($varname='sessid')
Определения tools.php:4686
htmlspecialcharsbx($string, $flags=ENT_COMPAT, $doubleEncode=true)
Определения tools.php:2701
IncludeModuleLangFile($filepath, $lang=false, $bReturnArray=false)
Определения tools.php:3778
GetMessage($name, $aReplace=null)
Определения tools.php:3397
LocalRedirect($url, $skip_security_check=false, $status="302 Found")
Определения tools.php:4005
$name
Определения menu_edit.php:35
if( $daysToExpire >=0 &&$daysToExpire< 60 elseif)( $daysToExpire< 0)
Определения prolog_main_admin.php:393
<? endif;?> window document title
Определения prolog_main_admin.php:76
font style
Определения invoice.php:442
font size
Определения invoice.php:442
$option
Определения options.php:1711
$val
Определения options.php:1793
$iterator
Определения yandex_run.php:610