IsAdmin()) { return; } if (!Loader::includeModule('iblock')) { return; } $defaultValues = Main\Config\Option::getDefaults('iblock'); IncludeModuleLangFile($_SERVER["DOCUMENT_ROOT"]."/bitrix/modules/main/options.php"); IncludeModuleLangFile(__FILE__); $arAllOptions = array( GetMessage('IBLOCK_OPTION_SECTION_SYSTEM'), array("property_features_enabled", GetMessage("IBLOCK_PROPERTY_FEATURES"), "Y", array("checkbox", "Y")), array("event_log_iblock", GetMessage("IBLOCK_EVENT_LOG"), "Y", array("checkbox", "Y")), array("path2rss", GetMessage("IBLOCK_PATH2RSS"), "/upload/", array("text", 30)), GetMessage('IBLOCK_OPTION_SECTION_LIST_AND_FORM'), array("use_htmledit", GetMessage("IBLOCK_USE_HTMLEDIT"), "N", array("checkbox", "Y")), array("list_image_size", GetMessage("IBLOCK_LIST_IMAGE_SIZE"), "50", array("text", 5)), array("detail_image_size", GetMessage("IBLOCK_DETAIL_IMAGE_SIZE"), "200", array("text", 5)), array("show_xml_id", GetMessage("IBLOCK_SHOW_LOADING_CODE"), "N", array("checkbox", "Y")), array("excel_export_rights", GetMessage("IBLOCK_EXCEL_EXPORT_RIGHTS"), "N", array("checkbox", "Y")), array("list_full_date_edit", GetMessage("IBLOCK_LIST_FULL_DATE_EDIT"), "N", array("checkbox", "Y")), array("combined_list_mode", GetMessage("IBLOCK_COMBINED_LIST_MODE"), "N", array("checkbox", "Y")), array("iblock_menu_max_sections", GetMessage("IBLOCK_MENU_MAX_SECTIONS"), "50", array("text", 5)), array("change_user_by_group_active_modify", GetMessage("IBLOCK_OPTION_CHANGE_USER_BY_GROUP_ACTIVE_MODIFY"), "N", array("checkbox", "N")), GetMessage('IBLOCK_OPTION_SECTION_CUSTOM_FORM'), array("custom_edit_form_use_property_id", GetMessage("IBLOCK_CUSTOM_FORM_USE_PROPERTY_ID"), "Y", array("checkbox", "Y")), GetMessage('IBLOCK_OPTION_SECTION_IMPORT_EXPORT'), array("num_catalog_levels", GetMessage("IBLOCK_NUM_CATALOG_LEVELS"), "3", array("text", 5)), ); $aTabs = array( array("DIV" => "edit1", "TAB" => GetMessage("MAIN_TAB_SET"), "ICON" => "ib_settings", "TITLE" => GetMessage("MAIN_TAB_TITLE_SET")), array("DIV" => "iblock_cache", "TAB" => GetMessage("IBLOCK_OPTION_TAB_CACHE"), "TITLE" => GetMessage("IBLOCK_OPTION_TAB_CACHE_TITLE")) ); $tabControl = new CAdminTabControl("tabControl", $aTabs); $request = Main\Context::getCurrent()->getRequest(); $currentAction = null; if ($request->getPost('Update') !== null) { $currentAction = 'save'; } elseif ($request->getPost('Apply') !== null) { $currentAction = 'apply'; } elseif ($request->getPost('RestoreDefaults') !== null) { $currentAction = 'reset'; } $backUrl = (string)$request->get('back_url_settings'); if ($request->isPost() && $currentAction !== null && check_bitrix_sessid()) { if ($currentAction === 'reset') { Main\Config\Option::delete('iblock'); } else { foreach($arAllOptions as $arOption) { if (!is_array($arOption)) continue; $name=$arOption[0]; $val = $request->getPost($name); if ($val === null) { continue; } $val = (string)$val; if ($arOption[3][0] === "checkbox") { $val = ($val === 'Y' ? 'Y' : 'N'); } Main\Config\Option::set('iblock', $name, $val, ''); } unset($arOption); $period = (int)$request->getPost('iblock_activity_dates_period'); if ($period === -1) { $period = (int)$request->getPost('iblock_activity_dates_period_custom'); } if ($period !== 0) { $oldPeriod = (int)Main\Config\Option::get('iblock', 'iblock_activity_dates_period'); $activity = $request->getPost('IBLOCK_ACTIVITY_DATES'); if (!is_array($activity)) { $activity = []; } if (!empty($activity)) { Main\Type\Collection::normalizeArrayValuesByInt($activity, true); } $oldActivity = Main\Config\Option::get('iblock', 'iblock_activity_dates'); if ($oldActivity !== '') { $oldActivity = explode(',', $oldActivity); Main\Type\Collection::normalizeArrayValuesByInt($oldActivity, true); } else { $oldActivity = []; } $removeAgents = []; $addAgents = []; if ($oldPeriod != $period) { $removeAgents = $oldActivity; $addAgents = $activity; } else { $removeAgents = array_diff($oldActivity, $activity); $addAgents = array_diff($activity, $oldActivity); } if (!empty($removeAgents)) { foreach ($removeAgents as $iblockId) { $iterator = CAgent::GetList( [], [ 'MODULE_ID' => 'iblock', 'NAME' => '\CIBlock::checkActivityDatesAgent(' . $iblockId . ',%', ] ); while ($row = $iterator->Fetch()) { CAgent::Delete($row['ID']); } unset($row); unset($iterator); } unset($iblockId); } if (!empty($addAgents)) { $currentTime = time(); foreach ($addAgents as $iblockId) { CAgent::AddAgent( '\CIBlock::checkActivityDatesAgent('.$iblockId.', '.$currentTime.');', 'iblock', 'N', $period, '', 'Y', '', 100, false, false ); } unset($iblockId); } Main\Config\Option::set('iblock', 'iblock_activity_dates', implode(',', $activity), ''); Main\Config\Option::set('iblock', 'iblock_activity_dates_period', $period, ''); } } if ($currentAction === 'save' && $backUrl !== '') { LocalRedirect($backUrl); } else { LocalRedirect($APPLICATION->GetCurPage() . '?lang=' . LANGUAGE_ID . '&mid=' . urlencode($mid) . '&mid_menu=1' . ($backUrl !== '' ? "&back_url_settings=" . urlencode($backUrl) : '') . "&" . $tabControl->ActiveTabParam()) ; } } $currentValues = []; foreach($arAllOptions as $option) { if (!is_array($option)) { continue; } $id = $option[0]; $currentValues[$id] = Main\Config\Option::get('iblock', $id); } unset($id, $option); $needFeatureConfirm = false; if ($currentValues['property_features_enabled'] == 'N') $needFeatureConfirm = !Iblock\Model\PropertyFeature::isPropertyFeaturesExist(); $activity = Main\Config\Option::get('iblock', 'iblock_activity_dates'); if ($activity !== '') { $activity = explode(',', $activity); Main\Type\Collection::normalizeArrayValuesByInt($activity, true); } else { $activity = array(); } $currentValues['iblock_activity_dates'] = $activity; unset($activity); $currentValues['iblock_activity_dates_period'] = (int)Main\Config\Option::get('iblock', 'iblock_activity_dates_period'); if ($currentValues['iblock_activity_dates_period'] <= 0) { $currentValues['iblock_activity_dates_period'] = (int)$defaultValues['iblock_activity_dates_period']; } $currentValues['iblock_activity_dates_period_custom'] = $currentValues['iblock_activity_dates_period']; $periodList = array( -1 => GetMessage('IBLOCK_OPTION_CHECK_ACTIVITY_PERIOD_CUSTOM'), 3600 => GetMessage('IBLOCK_OPTION_CHECK_ACTIVITY_PERIOD_ONE_HOUR'), 10800 => GetMessage('IBLOCK_OPTION_CHECK_ACTIVITY_PERIOD_THREE_HOUR'), 21600 => GetMessage('IBLOCK_OPTION_CHECK_ACTIVITY_PERIOD_SIX_HOUR'), 43200 => GetMessage('IBLOCK_OPTION_CHECK_ACTIVITY_PERIOD_TWELVE_HOUR'), 86400 => GetMessage('IBLOCK_OPTION_CHECK_ACTIVITY_PERIOD_DAY') ); if (!isset($periodList[$currentValues['iblock_activity_dates_period']])) { $currentValues['iblock_activity_dates_period'] = -1; } $region = Main\Application::getInstance()->getLicense()->getRegion(); $isBitrixSiteManagementOnly = !Loader::includeModule('bitrix24') && !Loader::includeModule('intranet'); $allowPropertyFeatureDescr = ($region === 'ru' || $region === 'by' || $region === 'kz' || $isBitrixSiteManagementOnly); $optionHints = [ 'property_features_enabled' => GetMessage( 'IBLOCK_PROPERTY_FEATURES_HINT', ['#LINK#' => 'https://dev.1c-bitrix.ru/learning/course/index.php?COURSE_ID=42&LESSON_ID=1986'] ), 'change_user_by_group_active_modify' => GetMessage('IBLOCK_OPTION_CHANGE_USER_BY_GROUP_ACTIVE_MODIFY_HINT') ]; if (!$allowPropertyFeatureDescr) { unset($optionHints['property_features_enabled']); } $tabControl->Begin(); ?>