1C-Bitrix 25.700.0
Загрузка...
Поиск...
Не найдено
options.php
См. документацию.
1<?php
2
12
13$module_id = 'location';
14$moduleAccess = $APPLICATION::GetGroupRight($module_id);
15
16if($moduleAccess >= 'W' && Loader::includeModule($module_id)):
17
22
23 IncludeModuleLangFile($_SERVER['DOCUMENT_ROOT'].BX_ROOT.'/modules/main/options.php');
24 IncludeModuleLangFile(__FILE__);
25
27 array('DIV' => 'edit1', 'TAB' => Loc::getMessage('LOCATION_OPT_TAB_OPTIONS'), 'ICON' => "", 'TITLE' => Loc::getMessage('LOCATION_OPT_TAB_OPTIONS')),
28 array('DIV' => 'edit2', 'TAB' => Loc::getMessage('LOCATION_OPT_TAB_SOURCES_OPTIONS'), 'ICON' => "", 'TITLE' => Loc::getMessage('LOCATION_OPT_TAB_SOURCES_OPTIONS')),
29 array('DIV' => 'edit3', 'TAB' => Loc::getMessage('MAIN_TAB_RIGHTS'), 'ICON' => "", 'TITLE' => Loc::getMessage('MAIN_TAB_TITLE_RIGHTS')),
30 );
31
32 $tabControl = new CAdminTabControl('tabControl', $aTabs);
33
34 $sourceRepository = new SourceRepository(new OrmConverter());
36
37 if ($_SERVER['REQUEST_METHOD'] === 'POST' && $_REQUEST['Update'] !== "" && check_bitrix_sessid())
38 {
42 if(isset($_REQUEST['address_format_code']))
43 {
45 }
46
47 if(isset($_REQUEST['log_level']))
48 {
49 Option::set('location', 'log_level', (string)$_REQUEST['log_level']);
50 }
51
55 foreach ($sources as $source)
56 {
57 $sourceCode = $source->getCode();
58 $sourceConfig = $source->getConfig() ?? new Config();
59
60 if (!isset($_REQUEST['SOURCE'][$sourceCode]))
61 {
62 continue;
63 }
64 $sourceRequest = $_REQUEST['SOURCE'][$sourceCode];
65
69 $sourceConfigRequest = $_REQUEST['SOURCE'][$sourceCode]['CONFIG'] ?? [];
71 foreach ($sourceConfig as $configItem)
72 {
73 if (!$configItem->isVisible())
74 {
75 continue;
76 }
77 if (!isset($sourceConfigRequest[$configItem->getCode()]))
78 {
79 continue;
80 }
81
82 $value = null;
83 if ($configItem->getType() === ConfigItem::STRING_TYPE)
84 {
85 $value = $sourceConfigRequest[$configItem->getCode()];
86 }
87 elseif ($configItem->getType() === ConfigItem::BOOL_TYPE)
88 {
89 $value = $sourceConfigRequest[$configItem->getCode()] === 'Y';
90 }
91
92 $configItem->setValue($value);
93 }
94 $source->setConfig($sourceConfig);
95
99 $sourceRepository->save($source);
100 }
101
102 ob_start();
103 require_once($_SERVER['DOCUMENT_ROOT'].'/bitrix/modules/main/admin/group_rights.php');
104 ob_end_clean();
105
106 if($_REQUEST['back_url_settings'] <> '')
107 LocalRedirect($_REQUEST['back_url_settings']);
108
109 LocalRedirect($APPLICATION->GetCurPage().'?mid='.urlencode($module_id).'&lang='.urlencode(LANGUAGE_ID).'&'.$tabControl->ActiveTabParam());
110 }
111
116
117 foreach(FormatService::getInstance()->findAll(LANGUAGE_ID) as $format)
118 {
119 $formatList[$format->getCode()] = $format->getName();
120 $formatDescriptionList[$format->getCode()] = $format->getDescription();
121
122 if($format->getCode() === $formatCode)
123 {
124 $formatDescription = $format->getDescription();
125 }
126 }
127
128 $currentLogLevel = (int)Option::get('location', 'log_level', LogLevel::ERROR);
130 LogLevel::NONE => loc::getMessage('LOCATION_OPT_LOG_LEVEL_NONE'),
131 LogLevel::ERROR => loc::getMessage('LOCATION_OPT_LOG_LEVEL_ERROR'),
132 LogLevel::INFO => loc::getMessage('LOCATION_OPT_LOG_LEVEL_INFO'),
133 LogLevel::DEBUG => loc::getMessage('LOCATION_OPT_LOG_LEVEL_DEBUG')
134 ];
135
136 $tabControl->Begin();
137 ?>
138 <form method="post" action="<?echo $APPLICATION->GetCurPage()?>?mid=<?=urlencode($module_id)?>&amp;lang=<?=LANGUAGE_ID?>">
139 <?$tabControl->BeginNextTab();?>
140 <tr>
141 <td width="40%" valign="top"><?=Loc::getMessage("LOCATION_OPT_FORMAT")?>:</td>
142 <td width="60%">
143 <select name="address_format_code" onchange="onLocationOptionFormatChanged(this.value);">
144 <?foreach($formatList as $code => $name):?>
145 <option
146 value="<?=htmlspecialcharsbx($code)?>"
147 <?=$formatCode === $code ? ' selected' : ''?>>
149 </option>
150 <?endforeach;?>
151 </select>
152 <?=BeginNote();?>
153 <div id="location_address_format_description">
155 </div>
156 <?=EndNote();?>
157 </td>
158 </tr>
159 <tr>
160 <td width="40%" valign="top"><?=Loc::getMessage("LOCATION_OPT_LOG_LEVEL")?>:</td>
161 <td width="60%">
162 <select name="log_level">
163 <?foreach($logLevels as $level => $name):?>
164 <option value="<?=$level?>"<?=($level === $currentLogLevel ? ' selected' : '')?>><?=$name?></option>
166 </select>
167 </td>
168 </tr>
169 <?$tabControl->BeginNextTab();?>
170 <?foreach ($sources as $source):
171 $sourceCode = $source->getCode();
172 if (
173 $sourceCode === \Bitrix\Location\Entity\Source\Factory::OSM_SOURCE_CODE
174 && !\Bitrix\Main\ModuleManager::isModuleInstalled('bitrix24')
175 )
176 {
177 continue;
178 }
179
180 $config = $source->getConfig();
181 ?>
182 <tr class="heading">
183 <td colspan="2"><b><?=htmlspecialcharsbx($source->getName())?></b></td>
184 </tr>
185
186 <?if (!is_null($config)):?>
187 <?
189 foreach ($config as $configItem):
190 if (!$configItem->isVisible())
191 {
192 continue;
193 }
194
195 $code = $configItem->getCode();
196
197 $inputName = sprintf(
198 'SOURCE[%s][CONFIG][%s]',
199 $sourceCode,
200 $code
201 );
202 $name = Loc::getMessage(
203 sprintf(
204 'LOCATION_OPT_SOURCE_%s_%s',
205 $sourceCode,
206 $code
207 )
208 );
209 $note = Loc::getMessage(
210 sprintf(
211 'LOCATION_OPT_SOURCE_%s_%s_NOTE',
212 $sourceCode,
213 $code
214 )
215 );
216 ?>
217 <tr>
218 <td width="40%" valign="top"><?=$name?>:</td>
219 <td width="60%">
220 <?if ($configItem->getType() == ConfigItem::STRING_TYPE):?>
221 <input type="text" name="<?=htmlspecialcharsbx($inputName)?>" size="40" value="<?=htmlspecialcharsbx($configItem->getValue())?>">
222 <?elseif ($configItem->getType() == ConfigItem::BOOL_TYPE):?>
223 <input type="hidden" name="<?=htmlspecialcharsbx($inputName)?>" value="N">
224 <input type="checkbox" name="<?=htmlspecialcharsbx($inputName)?>" value="Y" <?=($configItem->getValue() ? ' checked' : '')?> >
225 <?endif;?>
226 <?if ($note):?>
227 <?=BeginNote();?><?=$note?><?=EndNote();?>
228 <?endif;?>
229 </td>
230 </tr>
231 <?endforeach;?>
232 <?endif;?>
233 <?endforeach;?>
234 <?$tabControl->BeginNextTab();?>
235 <?require_once($_SERVER["DOCUMENT_ROOT"]."/bitrix/modules/main/admin/group_rights.php");?>
236
237 <?$tabControl->Buttons();?>
238 <input type="submit" name="Update" value="<?=GetMessage("MAIN_SAVE")?>" title="<?=GetMessage("MAIN_OPT_SAVE_TITLE")?>" class="adm-btn-save">
239 <?=bitrix_sessid_post();?>
240 <?if($_REQUEST["back_url_settings"] <> ''):?>
241 <input type="button" name="Cancel" value="<?=GetMessage("MAIN_OPT_CANCEL")?>" onclick="window.location="<?echo htmlspecialcharsbx(CUtil::addslashes($_REQUEST["back_url_settings"]))?>''>
242 <input type="hidden" name="back_url_settings" value="<?=htmlspecialcharsbx($_REQUEST["back_url_settings"])?>">
243 <?endif;?>
244 <?$tabControl->End();?>
245 </form>
246
247 <script>
248 function onLocationOptionFormatChanged(formatCode)
249 {
250 var formatDescriptionsList = <?=CUtil::PhpToJSObject($formatDescriptionList)?>;
251 var note = document.getElementById('location_address_format_description');
252 note.innerHTML = formatDescriptionsList[formatCode];
253 }
254 </script>
255<?endif;?>
return select
Определения access_edit.php:440
$moduleAccess
Определения options.php:10
const BX_ROOT
Определения bx_root.php:3
global $APPLICATION
Определения include.php:80
$module_id
Определения options.php:6
static setCurrent(string $formatCode, string $siteId='')
Определения formatcode.php:29
static getCurrent(string $regionId=null, string $siteId='')
Определения formatcode.php:19
Определения loader.php:13
bx popup label bx width30 PAGE_NEW_MENU_NAME text width
Определения file_new.php:677
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_NEW_TAGS")?> array( $site)
Определения file_new.php:804
EndNote()
Определения filter_tools.php:601
BeginNote($sParams='', $sMessParams='')
Определения filter_tools.php:589
$_REQUEST["admin_mnu_menu_id"]
Определения get_menu.php:8
$_SERVER["DOCUMENT_ROOT"]
Определения cron_frame.php:9
$tabControl
Определения csv_new_setup.php:244
$aTabs
Определения csv_new_setup.php:238
endif
Определения csv_new_setup.php:990
$formatDescription
Определения options.php:115
$inputName
Определения options.php:197
$formatCode
Определения options.php:112
if(!is_null($config))($config as $configItem)(! $configItem->isVisible()) $code
Определения options.php:195
foreach(FormatService::getInstance() ->findAll(LANGUAGE_ID) as $format) $currentLogLevel
Определения options.php:128
$logLevels
Определения options.php:129
$note
Определения options.php:209
$sources
Определения options.php:35
$formatDescriptionList
Определения options.php:114
$sourceRepository
Определения options.php:34
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
LocalRedirect($url, $skip_security_check=false, $status="302 Found")
Определения tools.php:4005
$name
Определения menu_edit.php:35
global_menu_<?echo $menu["menu_id"]?> adm main menu item icon adm main menu item text text adm main menu hover adm submenu menucontainer menu_id menu_id items_id items_id desktop menu_id block none adm global submenu<?=($subMenuDisplay=="block" ? " adm-global-submenu-active" :"")?> global_submenu_<?echo $menu["menu_id"]?> text MAIN_PR_ADMIN_FAV items adm submenu items wrap adm submenu items stretch wrap BX adminMenu itemsStretchScroll()"> <table class if (!empty( $menu["items"])) elseif ( $menu[ 'menu_id']=='desktop') if ( $menu[ 'menu_id']=='desktop') endforeach
Определения prolog_main_admin.php:255
if( $daysToExpire >=0 &&$daysToExpire< 60 elseif)( $daysToExpire< 0)
Определения prolog_main_admin.php:393
<? endif;?> window document title
Определения prolog_main_admin.php:76
$config
Определения quickway.php:69
font size
Определения invoice.php:442
$formatList
Определения yandex_run.php:85