/** * Модуль Умный Полис * * @file options.php */ if (!$USER->IsAdmin()) { return; } $acl = $APPLICATION->GetGroupRight($mid); IncludeModuleLangFile(__FILE__); CModule::IncludeModule($mid); CModule::IncludeModule('fileman'); $aTabs = array(array('DIV' => 'calculations', 'TAB' => GetMessage('SPM_TAB_CALCULATIONS_NAME'), 'ICON' => 'ib_settings', 'TITLE' => GetMessage('SPM_TAB_CALCULATIONS_TITLE')), array('DIV' => 'mode', 'TAB' => GetMessage('SPM_TAB_MODE_NAME'), 'ICON' => 'ib_settings', 'TITLE' => GetMessage('SPM_TAB_MODE_TITLE')), array('DIV' => 'messages', 'TAB' => GetMessage('SPM_TAB_MESSAGES_NAME'), 'ICON' => 'ib_settings', 'TITLE' => GetMessage('SPM_TAB_MESSAGES_TITLE')), array('DIV' => 'companies', 'TAB' => GetMessage('SPM_TAB_COMPANIES_NAME'), 'ICON' => 'ib_settings', 'TITLE' => GetMessage('SPM_TAB_COMPANIES_TITLE'))); $tabControl = new CAdminTabControl('tabControl', $aTabs); $settings = new SmartpolisSettings(); if ($_POST['Update'] === 'Y') { try { $settings->updateCompanies(new SmartpolisCascoApi()); } catch (Exception $e) { echo CAdminMessage::ShowMessage(array('TYPE' => 'ERROR', 'MESSAGE' => GetMessage('SPM_MESSAGE_UPDATE_ERR'), 'DETAILS' => $e->getMessage(), 'HTML' => true)); } } if ($_POST['Save'] === 'Y') { try { $settings->set($_POST); } catch (Exception $e) { echo CAdminMessage::ShowMessage(array('TYPE' => 'ERROR', 'MESSAGE' => GetMessage('SPM_MESSAGE_SAVE_ERR'), 'DETAILS' => $e->getMessage(), 'HTML' => true)); } } echo '<form method="post" action="' . $APPLICATION->GetCurPage() . '?mid=' . htmlspecialcharsbx($mid) . '&lang=' . LANG . '">';
<?php /** * Компонент Умный Полис * */ if (!defined('B_PROLOG_INCLUDED') || B_PROLOG_INCLUDED !== true) { die; } IncludeModuleLangFile(__FILE__); //if ($_REQUEST['ajax'] === 'Y') $arParams['CACHE_TYPE'] = 0; if ($this->StartResultCache($arParams['CACHE_TYPE'] === 'N' ? 0 : (is_numeric($arParams['CACHE_TIME']) ? $arParams['CACHE_TIME'] : '3600'))) { CModule::IncludeModule('smartpolis'); $settings = new SmartpolisSettings(); $api = new SmartpolisCascoApi($settings); $arResult = array('TEXT_BEFORE_BUTTON' => $settings->get('smartpolis_message_before_button'), 'HEADER_BEFORE_FORM' => $settings->get('smartpolis_header_before_form'), 'MESSAGE_BEFORE_FORM' => $settings->get('smartpolis_message_before_form'), 'YEARS' => array(), 'DRIVERS' => array(), 'SHOW_TYPE' => $settings->get('smartpolis_show_type'), 'CAR_BRANDS' => array()); if (!empty($_POST)) { $brands = json_decode($api->getCarMarks()); $carBrand = 'Производитель не указан'; foreach ($brands as $brand) { if ($brand->id == $_POST['CAR_BRAND']) { $carBrand = $brand->title; break; } } $api->setValue('car_mark', $_POST['CAR_BRAND']); $models = json_decode($api->getCarModels()); $carModel = 'Модель не указана'; foreach ($models as $model) { if ($model->id == $_POST['CAR_MODEL']) {