1C-Bitrix 25.700.0
Загрузка...
Поиск...
Не найдено
options.php
См. документацию.
1<?php
2
11
12$module_id = 'currency';
14if ($moduleAccessLevel >= 'R')
15{
16 Loader::includeModule('currency');
17
18 $settingsUrl = $APPLICATION->GetCurPage() . '?lang=' . LANGUAGE_ID . '&mid=' . $module_id;
19
20 $request = Context::getCurrent()->getRequest();
21
22 $aTabs = [
23 [
24 'DIV' => 'edit0',
25 'TAB' => Loc::getMessage('CURRENCY_SETTINGS'),
26 'ICON' => 'currency_settings',
27 'TITLE' => Loc::getMessage('CURRENCY_SETTINGS_TITLE'),
28 ],
29 [
30 'DIV' => 'edit1',
31 'TAB' => Loc::getMessage('CO_TAB_RIGHTS'),
32 'ICON' => 'currency_settings',
33 'TITLE' => Loc::getMessage('CO_TAB_RIGHTS_TITLE'),
34 ],
35 ];
36 $tabControl = new CAdminTabControl('currencyTabControl', $aTabs, true, true);
37
38 $systemTabs = [
39 [
40 'DIV' => 'proc_edit0',
41 'TAB' => Loc::getMessage('CURRENCY_BASE_RATE'),
42 'ICON' => '',
43 'TITLE' => Loc::getMessage('CURRENCY_BASE_RATE_TITLE'),
44 ],
45 [
46 'DIV' => 'proc_edit1',
47 'TAB' => Loc::getMessage('CURRENCY_AGENTS'),
48 'ICON' => '',
49 'TITLE' => Loc::getMessage('CURRENCY_AGENTS_TITLE'),
50 ],
51 ];
52 $systemTabControl = new CAdminTabControl('currencyProcTabControl', $systemTabs, true, true);
53
54 if (
55 $request->getRequestMethod() === 'GET'
56 && $request->get('RestoreDefaults') !== null
57 && $moduleAccessLevel === 'W'
59 )
60 {
61 Option::delete('currency');
62
63 $userGroupIds = [];
65 'id',
66 'asc',
67 [
68 'ACTIVE' => 'Y',
69 'ADMIN' => 'N',
70 ]
71 );
72 while ($row = $iterator->Fetch())
73 {
74 $userGroupIds[] = (int)$row['ID'];
75 }
76 unset($row, $iterator);
77 if (!empty($userGroupIds))
78 {
79 $APPLICATION->DelGroupRight($module_id, $userGroupIds);
80 }
81 unset($userGroupIds);
82
83 LocalRedirect($settingsUrl);
84 }
85
86 if (
87 $request->isPost()
88 && $moduleAccessLevel === 'W'
90 )
91 {
92 if ($request->getPost('Update') === 'Y')
93 {
94 $newBaseCurrency = $request->getPost('BASE_CURRENCY');
95 if (!is_string($newBaseCurrency))
96 {
97 $newBaseCurrency = null;
98 }
99 $newBaseCurrency = trim((string)$newBaseCurrency);
100 if ($newBaseCurrency !== '')
101 {
102 $res = CCurrency::SetBaseCurrency($newBaseCurrency);
103 }
104
105 ob_start();
106 require_once $_SERVER['DOCUMENT_ROOT'] . '/bitrix/modules/main/admin/group_rights.php';
107 ob_end_clean();
108
109 LocalRedirect($settingsUrl . '&' . $tabControl->ActiveTabParam());
110 }
111 if ($request->getPost('procedures') === 'Y' && $request->getPost('action') === 'recalc')
112 {
113 Currency\CurrencyManager::updateBaseRates();
114 LocalRedirect($settingsUrl . '&' . $systemTabControl->ActiveTabParam());
115 }
116 if ($request->getPost('agents') === 'Y' && !empty($_POST['action']))
117 {
118 $action = $request->getPost('action');
119 if (!is_string($action))
120 {
121 $action = null;
122 }
123 $action = trim((string)$action);
124 if ($action !== '')
125 {
126 switch ($action)
127 {
128 case 'activate':
129 case 'deactivate':
130 $agentIterator = CAgent::GetList(
131 [],
132 [
133 'MODULE_ID' => 'currency',
134 '=NAME' => '\Bitrix\Currency\CurrencyManager::currencyBaseRateAgent();',
135 ]
136 );
137 $currencyAgent = $agentIterator->Fetch();
138 unset($agentIterator);
139 if (!empty($currencyAgent))
140 {
141 $active = ($action === 'activate' ? 'Y' : 'N');
142 CAgent::Update(
143 $currencyAgent['ID'],
144 [
145 'ACTIVE' => $active,
146 ]
147 );
148 }
149 break;
150 case 'create':
151 $checkDate = DateTime::createFromTimestamp(strtotime('tomorrow 00:01:00'));
152 CAgent::AddAgent(
153 '\Bitrix\Currency\CurrencyManager::currencyBaseRateAgent();',
154 'currency',
155 'Y',
156 86400,
157 '',
158 'Y',
159 $checkDate->toString(),
160 100,
161 false,
162 false
163 );
164 break;
165 }
166 LocalRedirect($settingsUrl . '&' . $systemTabControl->ActiveTabParam());
167 }
168 }
169 }
170
171 $baseCurrency = Currency\CurrencyManager::getBaseCurrency();
172
173 $tabControl->Begin();
174 ?>
175 <form method="POST" action="<?= $APPLICATION->GetCurPage(); ?>?lang=<?= LANGUAGE_ID; ?>&mid=<?= $module_id; ?>" name="currency_settings">
176 <?= bitrix_sessid_post();
177
178 $tabControl->BeginNextTab();
179 ?><tr>
180 <td style="width: 40%;"><?= HtmlFilter::encode(Loc::getMessage('BASE_CURRENCY')); ?></td>
181 <td><select name="BASE_CURRENCY"><?php
182 $currencyList = Currency\CurrencyManager::getCurrencyList();
183 if (!empty($currencyList))
184 {
185 foreach ($currencyList as $currency => $title)
186 {
187 ?><option value="<?= HtmlFilter::encode($currency); ?>"<?= ($currency === $baseCurrency ? ' selected' : ''); ?>><?php
188 echo HtmlFilter::encode($title);
189 ?></option><?php
190 }
191 unset($title, $currency);
192 }
193 unset($currencyList);
194 ?></select></td>
195 </tr>
196 <?php
197 $tabControl->BeginNextTab();
198
199 require_once $_SERVER['DOCUMENT_ROOT'] . '/bitrix/modules/main/admin/group_rights.php';
200
201 $tabControl->Buttons();?>
202<script>
203function RestoreDefaults()
204{
205 if (confirm('<?= CUtil::JSEscape(Loc::getMessage("CUR_OPTIONS_BTN_HINT_RESTORE_DEFAULT_WARNING")); ?>'))
206 {
207 window.location = "<?= $APPLICATION->GetCurPage(); ?>?lang=<?= LANGUAGE_ID; ?>&mid=<?= $module_id; ?>&RestoreDefaults=Y&<?= bitrix_sessid_get()?>";
208 }
209}
210</script>
211 <input
212 type="submit"<?= ($moduleAccessLevel < 'W' ? ' disabled' : ''); ?>
213 name="Update"
214 class="adm-btn-save"
215 value="<?= HtmlFilter::encode(Loc::getMessage('CUR_OPTIONS_BTN_SAVE')); ?>"
216 title="<?= HtmlFilter::encode(Loc::getMessage('CUR_OPTIONS_BTN_SAVE_TITLE')); ?>"
217 >
218 <input type="hidden" name="Update" value="Y">
219 <input
220 type="reset"
221 name="reset"
222 value="<?= HtmlFilter::encode(Loc::getMessage('CUR_OPTIONS_BTN_RESET')); ?>"
223 title="<?= HtmlFilter::encode(Loc::getMessage('CUR_OPTIONS_BTN_RESET_TITLE')); ?>"
224 >
225 <input
226 type="button"<?= ($moduleAccessLevel < 'W' ? ' disabled' : ''); ?>
227 value="<?= HtmlFilter::encode(Loc::getMessage('CUR_OPTIONS_BTN_RESTORE_DEFAULT')); ?>"
228 title="<?= HtmlFilter::encode(Loc::getMessage('CUR_OPTIONS_BTN_HINT_RESTORE_DEFAULT')); ?>"
229 onclick="RestoreDefaults();"
230 >
231 </form>
232 <?php
233 $tabControl->End();
234 ?><h2><?= Loc::getMessage('CURRENCY_PROCEDURES'); ?></h2><?php
235 $systemTabControl->Begin();
236 $systemTabControl->BeginNextTab();
237 ?><form method="POST" action="<?= $APPLICATION->GetCurPage(); ?>?lang=<?= LANGUAGE_ID; ?>&mid=<?= $module_id; ?>" name="currency_procedures"><?php
238 echo bitrix_sessid_post();
239 ?>
240 <input type="hidden" name="action" value="recalc">
241 <input
242 type="submit"<?= ($moduleAccessLevel < "W" || $baseCurrency === '' ? ' disabled' : ''); ?>
243 name="recalc"
244 value="<?= HtmlFilter::encode(Loc::getMessage('CUR_PROCEDURES_BTN_RECALC')); ?>"
245 >
246 <input type="hidden" name="procedures" value="Y">
247 </form><?php
248 $systemTabControl->BeginNextTab();
249 ?><form method="POST" action="<?= $APPLICATION->GetCurPage(); ?>?lang=<?= LANGUAGE_ID; ?>&mid=<?= $module_id; ?>" name="currency_agents"><?php
250 echo bitrix_sessid_post();
251 ?><h4><?= Loc::getMessage('CURRENCY_BASE_RATE_AGENT'); ?></h4><?php
252 $currencyAgent = false;
253 $agentIterator = CAgent::GetList(
254 [],
255 [
256 'MODULE_ID' => 'currency',
257 '=NAME' => '\Bitrix\Currency\CurrencyManager::currencyBaseRateAgent();',
258 ]
259 );
260 if ($agentIterator)
261 {
262 $currencyAgent = $agentIterator->Fetch();
263 }
264 if (!empty($currencyAgent))
265 {
266 $currencyAgent['LAST_EXEC'] = (string)$currencyAgent['LAST_EXEC'];
267 $currencyAgent['NEXT_EXEC'] = (string)$currencyAgent['NEXT_EXEC'];
268 ?><b><?= Loc::getMessage('CURRENCY_BASE_RATE_AGENT_ACTIVE'); ?>:</b>&nbsp;<?= (
269 $currencyAgent['ACTIVE'] === 'Y'
270 ? Loc::getMessage('CURRENCY_AGENTS_ACTIVE_YES')
271 : Loc::getMessage('CURRENCY_AGENTS_ACTIVE_NO')
272 );?><br><?php
273 if ($currencyAgent['LAST_EXEC'])
274 {
275 ?><b><?= Loc::getMessage('CURRENCY_AGENTS_LAST_EXEC'); ?>:</b>&nbsp;<?= $currencyAgent['LAST_EXEC']; ?><br><?php
276 if ($currencyAgent['ACTIVE'] === 'Y')
277 {
278 ?><b><?= Loc::getMessage('CURRENCY_AGENTS_NEXT_EXEC');?>:</b>&nbsp;<?= $currencyAgent['NEXT_EXEC']; ?><br><?php
279 }
280 }
281 elseif ($currencyAgent['ACTIVE'] === 'Y')
282 {
283 ?><b><?= Loc::getMessage('CURRENCY_AGENTS_PLANNED_NEXT_EXEC') ?>:</b>&nbsp;<?= $currencyAgent['NEXT_EXEC']; ?><br><?php
284 }
285 if ($currencyAgent['ACTIVE'] !== 'Y')
286 {
287 ?><br><input type="hidden" name="action" value="activate">
288 <input type="submit" name="activate" value="<?= HtmlFilter::encode(Loc::getMessage('CURRENCY_AGENTS_ACTIVATE')); ?>"><?php
289 }
290 else
291 {
292 ?><br><input type="hidden" name="action" value="deactivate">
293 <input type="submit" name="deactivate" value="<?= HtmlFilter::encode(Loc::getMessage('CURRENCY_AGENTS_DEACTIVATE')); ?>"><?php
294 }
295 }
296 else
297 {
298 ?><b><?= Loc::getMessage('CURRENCY_BASE_RATE_AGENT_ABSENT'); ?></b><br><br>
299 <input type="hidden" name="action" value="create">
300 <input type="submit" name="startagent" value="<?= HtmlFilter::encode(Loc::getMessage('CURRENCY_AGENTS_CREATE_AGENT')); ?>">
301 <?php
302 }
303
304 ?><input type="hidden" name="agents" value="Y">
305 </form><?php
306 $systemTabControl->End();
307}
return select
Определения access_edit.php:440
global $APPLICATION
Определения include.php:80
$module_id
Определения options.php:6
if($canUseYandexMarket) if(! $useSaleDiscountOnly||$catalogCount > 0) if($strUseStoreControl==='N' && $catalogCount > 0 $systemTabControl)
Определения options.php:2339
if(!Loader::includeModule('catalog')) if(!AccessController::getCurrent() ->check(ActionDictionary::ACTION_PRICE_EDIT)) if(!check_bitrix_sessid()) $request
Определения catalog_reindex.php:36
Определения loader.php:13
static SetBaseCurrency($currency)
Определения currency.php:494
static GetList($by='c_sort', $order='asc', $arFilter=[], $SHOW_USERS_AMOUNT="N")
Определения group.php:136
$moduleAccessLevel
Определения options.php:13
& nbsp
Определения epilog_main_admin.php:38
$res
Определения filter_act.php:7
$_SERVER["DOCUMENT_ROOT"]
Определения cron_frame.php:9
$tabControl
Определения csv_new_setup.php:244
$aTabs
Определения csv_new_setup.php:238
bitrix_sessid_post($varname='sessid', $returnInvocations=false)
Определения tools.php:4700
check_bitrix_sessid($varname='sessid')
Определения tools.php:4686
LocalRedirect($url, $skip_security_check=false, $status="302 Found")
Определения tools.php:4005
Определения culture.php:9
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
$currency
Определения template.php:266
$title
Определения pdf.php:123
if($showbasketDiscountConvert) $systemTabs[]
Определения options.php:3637
$action
Определения file_dialog.php:21
$iterator
Определения yandex_run.php:610