Find this useful? Enter your email to receive occasional updates for securing PHP code.

Signing you up...

Thank you for signing up!

PHP Decode

<?php namespace Legacy\Html; use erp\models\Attachment\Entity\Attachment; use erp\module..

Decoded Output download

<?php 
 namespace Legacy\Html; use erp\models\Attachment\Entity\Attachment; use erp\modules\ExternalServices\Domain\ExternalServiceRepository; use erp\modules\ExternalServices\Domain\ServiceStatusDto; use erp\modules\Staff\Ldap\LdapServer; use erp\modules\Staff\models\Employee; use erp\modules\SystemHealth\DataCollector\RabbitMq\RabbitMqCollector; use Exception; use InvalidArgumentException; use JsonException; use Legacy\AdditionalFieldAR; use Legacy\AdvertisementAR; use Legacy\AttachmentAR; use Legacy\BillingAR; use Legacy\BuildingAdditionalAddressAR; use Legacy\BuildingAR; use Legacy\CableCatalogAR; use Legacy\CableColorAR; use Legacy\CableDuctAR; use Legacy\CableLineAR; use Legacy\CableLineTrunkAR; use Legacy\CableLineTypeAR; use Legacy\CableRouteAR; use Legacy\Cache\AddressLocalityTypeCache; use Legacy\Cache\BillingCache; use Legacy\Cache\BuildingCache; use Legacy\Cache\CableLineTypeCache; use Legacy\Cache\CustomerStatusCache; use Legacy\Cache\CustomPageCache; use Legacy\Cache\EmployeeCache; use Legacy\Cache\EmployeeProfileCache; use Legacy\Cache\InventoryAssortmentCache; use Legacy\Cache\InventorySectionCache; use Legacy\Cache\MapNodeIconCache; use Legacy\Cache\NodeTypeCache; use Legacy\Cache\NodeTypeGroupCache; use Legacy\Cache\OwnerCache; use Legacy\Cache\RedisCache; use Legacy\Cache\TagCache; use Legacy\CrossAR; use Legacy\CustomerActivityLogAR; use Legacy\CustomerAR; use Legacy\CustomerGroupAR; use Legacy\CustomerStatusAR; use Legacy\DeviceAR; use Legacy\DeviceIfaceAutoLearningAR; use Legacy\DeviceObserverLogAR; use Legacy\DevicePelengLogAR; use Legacy\DevicePonLevelLogAR; use Legacy\DeviceSnmpProfileAR; use Legacy\EmployeeProfileAR; use Legacy\EmployeeProfilePageAR; use Legacy\EmployeePropertyAR; use Legacy\GpsRouteAR; use Legacy\InventoryAR; use Legacy\InventoryAssortmentAR; use Legacy\InventoryOperationAR; use Legacy\InventorySectionAR; use Legacy\InventorySubaccountAR; use Legacy\KeyAR; use Legacy\MapNodeIconAR; use Legacy\MapObjectAR; use Legacy\MapTileAR; use Legacy\Module\UsmAsterisk; use Legacy\MultiplexerAR; use Legacy\NodeAR; use Legacy\NodeTypeAdditionalFieldAR; use Legacy\NodeTypeAR; use Legacy\OwnerAR; use Legacy\PageAR; use Legacy\ReadModel\Dto\AdditionalFieldValueDto; use Legacy\ReadModel\Dto\EmployeeActionLogDto; use Legacy\ReadModel\Dto\EmployeeProfilesNodeTypesDto; use Legacy\ReadModel\Dto\EmployeeTableSettingDto; use Legacy\ReadModel\Dto\ErpProfileDto; use Legacy\ReadModel\Dto\IpAddressDto; use Legacy\ReadModel\Dto\MacsUnknownDto; use Legacy\ReadModel\Dto\NodeTypeGroupDto; use Legacy\ReadModel\Dto\SatellitesAddressesDto; use Legacy\ReadModel\Dto\SmsListConditionDto; use Legacy\ReadModel\Fetcher\AdditionalFieldValueFetcher; use Legacy\ReadModel\Fetcher\EmployeeActionLogFetcher; use Legacy\ReadModel\Fetcher\EmployeeProfilesNodeTypesFetcher; use Legacy\ReadModel\Fetcher\EmployeeTableSettingFetcher; use Legacy\ReadModel\Fetcher\IpAddressFetcher; use Legacy\ReadModel\Fetcher\MacsUnknownFetcher; use Legacy\ReadModel\Fetcher\NodeTypeGroupFetcher; use Legacy\ReadModel\Fetcher\SatellitesAddressesFetcher; use Legacy\ReadModel\Fetcher\SmsListConditionFetcher; use Legacy\ReadModel\System\AdditionalFieldValueSystem; use Legacy\ReadModel\System\EmployeeActionLogSystem; use Legacy\ReadModel\System\EmployeeProfilesNodeTypesSystem; use Legacy\ReadModel\System\EmployeeTableSettingSystem; use Legacy\ReadModel\System\NodeTypeGroupSystem; use Legacy\ReadModel\System\RackSystem; use Legacy\ReadModel\System\SatellitesAddressesSystem; use Legacy\ReadModel\System\VlanSystem; use Legacy\SatelliteAR; use Legacy\SettingAR; use Legacy\SplitterAR; use Legacy\StatisticsSystemAR; use Legacy\TagAR; use Legacy\TagObjectAR; use Legacy\TagsObjectTypesAR; use Legacy\TariffAR; use Legacy\TaskAR; use Legacy\TraderAR; use Legacy\TransportAR; use Legacy\Utility\Central; use Legacy\Utility\CommutationScheme; use Legacy\Utility\EmployeeHistoryType; use Legacy\Utility\ExportKml; use Legacy\Utility\Import; use Legacy\Utility\Lang; use Legacy\Utility\OperatorAccess; use Legacy\Utility\RequestData; use Legacy\Utility\SettingsCatalog; use Legacy\Utility\Table; use Legacy\Utility\WebSocket; use Legacy\WarehouseAR; use Legacy\WarehousesEmployeesAccessAR; use Legacy\YiiUtility\AddressLocalityType; use Legacy\YiiUtility\AddressUnit; use PDO; use Throwable; use Yii; use yii\base\InvalidConfigException; use yii\db\StaleObjectException; use yii\di\NotInstantiableException; class SettingsMainHtml { public const A_ADDITIONAL_FIELD_DELETE = 'additional_field_delete'; public const A_ADDITIONAL_FIELD_EDIT = 'additional_field_edit'; public const A_ADDITIONAL_FIELD_LIST = 'additional_field_list'; public const A_ADDITIONAL_FIELD_MERGE = 'additional_field_merge'; public const A_ADDITIONAL_FIELD_SAVE = 'additional_field_save'; public const A_AJAX_LOAD_ADDITIONAL_FIELD_LIST = 'ajax_load_additional_field_list'; public const A_CUSTOM_PAGE_DELETE = 'custom_page_delete'; public const A_CUSTOM_PAGE_DIALOG_ADD = 'custom_page_dialog_add'; public const A_CUSTOM_PAGE_DIALOG_EDIT = 'custom_page_dialog_edit'; public const A_CUSTOM_PAGE_LIST = 'custom_page_list'; public const A_CUSTOM_PAGE_SAVE = 'custom_page_save'; public const A_DIALOG_NODE_TYPE_GROUP = 'dialog_node_type_group'; public const A_LOAD_MENU_BODY = 'load_menu_body'; public const A_NODE_TYPES = 'node_types'; public const A_NODE_TYPE_ADD_EDIT = 'node_type_add_edit'; public const A_NODE_TYPE_DELETE = 'node_type_delete'; public const A_NODE_TYPE_GROUPS = 'node_type_groups'; public const A_NODE_TYPE_SAVE = 'node_type_save'; public const A_NODE_TYPE_SET_DEFAULT_CARD_EXTERIOR_FIELD = 'node_type_set_default_card_exterior_field'; public const A_OBJECT_MARK_PAGE = 'object_mark_page'; public const A_OBJECT_MARK_DIALOG_ADD = 'object_mark_dialog_add'; public const A_OBJECT_MARK_DIALOG_EDIT = 'object_mark_dialog_edit'; public const A_OBJECT_MARK_SAVE = 'object_mark_save'; public const A_OBJECT_MARK_DELETE = 'object_mark_delete'; public const A_DELETE_NODE_TYPE_GROUP = 'delete_node_type_group'; public const A_TABLE_PROPERTY_SAVE = 'table_property_save'; public const A_SAVE_NODE_TYPE_GROUP = 'save_node_type_group'; public const A_SHOW_LOG = 'show_log'; public const A_CHECK_ERROR_PAGE = 'check_error_page'; public const ITEM_1 = '1'; public const ITEM_2 = '2'; public const ITEM_3 = '3'; public const ITEM_4 = '4'; public const ITEM_7 = '7'; public const ITEM_10 = '10'; public const ITEM_18 = '18'; public const ITEM_19 = '19'; public const ITEM_20 = '20'; public const ITEM_21 = '21'; public const ITEM_23 = '23'; public const ITEM_24 = '24'; public const ITEM_25 = '25'; public const ITEM_26 = '26'; public const ITEM_27 = '27'; public const ITEM_28 = '28'; public const ITEM_98 = '98'; public const ITEM_99 = '99'; private const LOGS_ARRAY = [ 'core_error', 'sql_error', 'js_error', 'redis_log', 'asterisk_log', 'usm_poller', 'core-worker', 'slow_page', 'slow_250', 'slow_500', 'slow_1000', 'queue_jobs', 'poller' ]; public static function coreHtml(): string { Html::$menuSection = BodyHtml::SECTION_SETTINGS; Html::$pageTitleMain = Lang::getPhrase(669); Html::$pageTitleSecond = Lang::getPhrase(671); Html::$pageId = 75; Html::$helpPageId = 146; switch (RequestData::$action) { case self::A_ADDITIONAL_FIELD_MERGE: return self::additionalFieldMerge(); case self::A_ADDITIONAL_FIELD_DELETE: self::additionalFieldDelete(); case self::A_ADDITIONAL_FIELD_EDIT: return self::additionalFieldEdit(); case self::A_ADDITIONAL_FIELD_LIST: return self::additionalFieldList(); case self::A_ADDITIONAL_FIELD_SAVE: self::additionalFieldSave(); break; case self::A_DELETE_NODE_TYPE_GROUP: self::deleteNodeTypeGroup(); break; case self::A_AJAX_LOAD_ADDITIONAL_FIELD_LIST: return self::ajaxLoadAdditionalFieldList(); case 'arp': return self::arp(); case 'arp_mac': return self::arpMac(); case 'attach': return self::attach(); case 'change_additional_field_value': return self::changeAdditionalFieldValue(); case 'customer_group': return self::customerGroup(); case 'customer_group_delete': self::customerGroupDelete(); break; case 'customer_group_dialog_add': case 'customer_group_dialog_edit': return self::customerGroupDialogAddEdit(); case 'customer_group_save': self::customerGroupSave(); break; case 'tag_delete_image': self::tagDeleteImage(); break; case 'customer_state': return self::customerState(); case 'customer_state_delete': self::customerStateDelete(); break; case 'customer_state_dialog_add': case 'customer_state_dialog_edit': return self::customerStateDialogAddEdit(); case 'customer_state_save': self::customerStateSave(); break; case self::A_CUSTOM_PAGE_DELETE: self::customPageDelete(); break; case self::A_CUSTOM_PAGE_DIALOG_ADD: case self::A_CUSTOM_PAGE_DIALOG_EDIT: return self::customPageDialogAddEdit(); case self::A_CUSTOM_PAGE_LIST: return self::customPageList(); case self::A_CUSTOM_PAGE_SAVE: self::customPageSave(); break; case self::A_DIALOG_NODE_TYPE_GROUP: return self::dialogNodeTypeGroup(); case 'diag_delete_unuse_address': return self::deleteUnuseAddress(); case 'diag_reload_building_address': return self::reloadBuildingAddress(); case 'diag_system_stat': return self::diagSystemStat(); case 'diag_flush_redis_cache': return self::diagFlushRedisCache(); case 'diag_db_info': return self::diagDbInfo(); case 'device_autocommutation_on': self::deviceAutocommutationOn(); break; case 'device_profile': return self::deviceProfile(); case 'device_profile_delete': self::deviceProfileDelete(); break; case 'device_profile_dialog_add': case 'device_profile_dialog_edit': return self::deviceProfileDialogAddEdit(); case 'device_profile_save': self::deviceProfileSave(); break; case 'diag': return self::diag(); case 'diag_merge_addresses': return self::diagMergeAddresses(); case 'diag_notify': return self::diagNotify(); case 'diag_web_socket': return self::diagWebSocket(); case 'export_to_kml': return self::exportToKml(); case 'export_to_kml_save': self::exportToKmlSave(); break; case 'import': return self::import(); case 'inventory_sub_account': return self::inventorySubaccount(); case 'inventory_subaccount_delete': self::inventorySubaccountDelete(); break; case 'inventory_subaccount_dialog_add': case 'inventory_subaccount_dialog_edit': return self::inventorySubaccountDialogAddEdit(); case 'inventory_subaccount_save': self::inventorySubaccountSave(); break; case 'ldap': return self::ldap(); case 'ldap_save': self::ldapSave(); break; case self::A_LOAD_MENU_BODY: return self::loadMenuBody(); case 'main_menu': return self::mainMenu(); case 'main_menu_save_position': return self::mainMenuSavePosition(); case 'map_tile': return self::mapTile(); case 'map_tile_delete': self::mapTileDelete(); break; case 'map_tile_edit': return self::mapTileEdit(); case 'map_tile_save': self::mapTileSave(); break; case 'map_tile_save_position': return self::mapTileSavePosition(); case 'node_icon': return self::nodeIcon(); case 'node_icon_delete': self::nodeIconDelete(); break; case 'node_icon_save': self::nodeIconSave(); break; case 'node_icon_dialog_add': case 'node_icon_dialog_edit': return self::nodeIconDialogAddEdit(); case self::A_NODE_TYPES: return self::nodeTypes(); case self::A_NODE_TYPE_GROUPS: return self::nodeTypeGroups(); case self::A_NODE_TYPE_ADD_EDIT: return self::nodeTypeAddEdit(); case self::A_NODE_TYPE_DELETE: self::nodeTypeDelete(); break; case self::A_NODE_TYPE_SAVE: self::nodeTypeSave(); break; case self::A_NODE_TYPE_SET_DEFAULT_CARD_EXTERIOR_FIELD: self::nodeTypeSetDefaultCardExteriorField(); break; case self::A_OBJECT_MARK_DIALOG_ADD: case self::A_OBJECT_MARK_DIALOG_EDIT: return self::objectMarkDialogAddEdit(); case self::A_OBJECT_MARK_DELETE: self::objectMarkDelete(); break; case self::A_OBJECT_MARK_PAGE: return self::objectMarkPage(); case self::A_OBJECT_MARK_SAVE: self::objectMarkSave(); break; case self::A_SAVE_NODE_TYPE_GROUP: self::saveNodeTypeGroup(); break; case 'phpinfo': self::phpinfo(); break; case 'ping': return self::ping(); case 'ping_ip': return self::pingIp(); case 'repair_inventory': return self::repairInventory(); case 'repair_inventory_device': return self::repairInventoryDevice(); case 'repair_inventory_reload': return self::repairInventoryReload(); case 'repair_inv_splitter_to_node': return self::repairInvSplitterToNode(); case 'satellite': return self::satellite(); case 'satellite_dialog_add': case 'satellite_dialog_edit': return self::satelliteDialogAddEdit(); case 'satellite_delete': self::satelliteDelete(); break; case 'satellite_save': self::satelliteSave(); break; case 'satellite_test': return self::satelliteTest(); case 'search_fields': return self::searchFields(); case 'search_fields_save': self::searchFieldsSave(); break; case self::A_SHOW_LOG: return self::showLog(); case 'sql': return self::sql(); case 'table_clear': return self::tableClear(); case 'table_property': return self::tableProperty(); case self::A_TABLE_PROPERTY_SAVE: self::tablePropertySave(); break; case 'var_log': return self::varLog(); case 'verifik_files': return self::verifikFiles(); case 'weather_save_coord': self::weatherSaveCoord(); break; case self::A_CHECK_ERROR_PAGE: self::checkErrorPage(); break; default: return self::mainPage(); } return ''; } private static function repairInvSplitterToNode(): string { $id = RequestData::$id; Html::$isEmptyTemplate = true; OperatorAccess::verifyRight(OperatorAccess::RIGHT_SETTING); if ( SplitterAR::find() ->where( [ SplitterAR::F_INVENTORY_ID => $id ] ) ->count() > 0 ) { return 'Cancel. Yet!'; } $inventory = InventoryAR::findOne($id); $inventoryAssortment = InventoryAssortmentAR::findOne($inventory->getInventoryAssortmentId()); $paramInv = $inventoryAssortment->getOptions(); if ($paramInv === []) { return 'BAD options: ' . $inventory->getInventoryAssortmentId(); } $portCount = floor($paramInv['PORT1']); $ps_port2 = floor($paramInv['PORT2']); $splitterId = SplitterAR::create($inventory->getAccountObjectId(), $portCount, $ps_port2)->getId(); $splitter = SplitterAR::findOne($splitterId); $splitter->edit( [ SplitterAR::F_INVENTORY_ID => $id ] ); return 'Doing!'; } private static function additionalFieldEdit(): string { if (Central::$isUSOnline === false) { OperatorAccess::verifyRight(OperatorAccess::RIGHT_SETTING); } $id = RequestData::$id; $ret = '?' . BodyHtml::CORES_SECTION . '=' . BodyHtml::SECTION_SETTINGS_MAIN . '&action=' . self::A_ADDITIONAL_FIELD_LIST; $content = ' 
            <a href="' . $ret . '"><i class="us-icon fa-chevron-left"></i>' . Lang::getPhrase( 1580 ) . '</a><br> 
            <br> 
            <span class="label_h2">' . AdditionalFieldAR::classCaptionSingle() . '</span>'; $categories = []; if ($id > 0) { $additionalField = AdditionalFieldAR::findOne($id); if (!$additionalField) { throw new InvalidArgumentException( __CLASS__ . ' | ' . __FUNCTION__ . ' | AdditionalField #' . $id . ' not found' ); } $currentFieldType = $additionalField->getFieldType(); $exteriorArray = $additionalField->getExterior(); if ($additionalField->getCategories() !== null) { $categories = json_decode($additionalField->getCategories(), false, 512, JSON_THROW_ON_ERROR); $categories = array_flip($categories); } $additionalProperties = $additionalField->getAdditionalProperties(); } else { $additionalField = new AdditionalFieldAR(); $currentFieldType = 0; $exteriorArray = []; $additionalProperties = []; } $content .= ' 
            <br> 
            <form method="post" name="form1" action=""> 
                <input type="hidden" name="' . BodyHtml::CORES_SECTION . '" value="' . BodyHtml::SECTION_SETTINGS_MAIN . '"> 
                <input type="hidden" name="action" value="' . self::A_ADDITIONAL_FIELD_SAVE . '"> 
                <input type="hidden" name="id" value="' . $id . '"> 
                <div class="table_block">'; if ($id > 0) { $content .= ' 
                    <div class="item"> 
                        <div class="left_data"> 
                            Id: 
                        </div> 
                        <div> 
                            ' . $id . ' 
                        </div> 
                    </div>'; } $content .= ' 
                    <div class="item"> 
                        <div class="left_data"> 
                            ' . Lang::getPhrase(1451) . ': 
                        </div> 
                        <div> 
                            <input name="name" type="text" class="input_box" required size="50" maxlength="255" value=\'' . ($id > 0 ? $additionalField->getName( ) : '') . '\'> 
                        </div> 
                    </div> 
                    <div class="item"> 
                        <div class="left_data"> 
                            ' . Lang::getPhrase(3836) . ': 
                        </div> 
                        <div> 
                            <input name="position" type="text" size=3 maxlength=3 class="input_box" value="' . ($id > 0 ? $additionalField->getPosition( ) : '') . '"> 
                        </div> 
                    </div> 
                    <div class="item"> 
                        <div class="left_data"> 
                            ' . Lang::getPhrase(6115) . ': 
                        </div> 
                        <div> 
                            <input name="hint" type="text" size=50 maxlength=255 class="input_box" value="' . ($id > 0 ? $additionalField->getHint( ) : '') . '"> 
                        </div> 
                    </div> 
                    <div class="item"> 
                        <div class="left_data"> 
                            ' . Lang::getPhrase(4463) . ': 
                        </div> 
                        <div> 
                            <input name="is_required" type="checkbox"'; if ( $id > 0 && true === $additionalField->getIsRequire() ) { $content .= ' checked'; } $content .= ' value="1">                                         
                        </div> 
                    </div> 
                    <div class="item"> 
                        <div class="left_data"> 
                            ' . Lang::getPhrase(1124) . ': 
                        </div> 
                        <div> 
                            <select id="fieldTypeId" name="field_type" size="1" onchange="reloadFieldType()">'; $catalogFieldType = AdditionalFieldAR::catalogFieldType(); foreach ($catalogFieldType as $tempTypeId => $tempFieldName) { $content .= ' 
                                 
                                <option '; if ($tempTypeId === $currentFieldType) { $content .= 'selected '; } $content .= 'value="' . $tempTypeId . '">' . $tempFieldName . '</option>'; } $content .= ' 
                            </select> 
                        </div> 
                    </div> 
                    <div class="item" id="perTypeId"> 
                        <div class="left_data"> 
                            ' . Lang::getPhrase(5893) . ': 
                        </div> 
                        <div> 
                            <input name="is_per_type" type="checkbox"'; if (isset($exteriorArray['is_per_type'])) { $content .= ' checked'; } $content .= ' value="1">    
                        </div> 
                    </div> 
                    <div class="item" id="startValueId"> 
                        <div class="left_data"> 
                            ' . Lang::getPhrase(5894) . ': 
                        </div> 
                        <div> 
                            <input name="start_value" type="text" size=5 maxlength=10 class="input_box" value="'; $content .= $exteriorArray['start_value'] ?? '1'; $content .= '">   
                        </div> 
                    </div> 
                    <div class="item" id="clearYearId"> 
                        <div class="left_data"> 
                            ' . Lang::getPhrase(5895) . ': 
                        </div> 
                        <div> 
                            <input name="is_clear_year" type="checkbox"'; if (isset($exteriorArray['is_clear_year'])) { $content .= ' checked'; } $content .= ' value="1">    
                        </div> 
                    </div> 
                    <div class="item" id="clearMonthId"> 
                        <div class="left_data"> 
                            ' . Lang::getPhrase(5896) . ': 
                        </div> 
                        <div> 
                            <input name="is_clear_month" type="checkbox"'; if (isset($exteriorArray['is_clear_month'])) { $content .= ' checked'; } $content .= ' value="1">    
                        </div> 
                    </div> 
                    <div class="item" id="fieldSizeId"> 
                        <div class="left_data"> 
                            ' . Lang::getPhrase(1127) . ' (size):<br> 
                            <span class="info_block">' . Lang::getPhrase(1216) . ' 35</span> 
                        </div> 
                        <div> 
                            <input name="field_size" type="text" size=3 maxlength=2 class="input_box" value="' . ($id > 0 ? $additionalField->getFieldSize( ) : 35) . '"> 
                        </div> 
                    </div> 
                    <div class="item" id="fieldMaxSizeId"> 
                        <div class="left_data"> 
                            ' . Lang::getPhrase(1128) . ' (maxlenght): 
                        </div> 
                        <div> 
                            <input name="field_max_size" type="text" size=4 maxlength=3 class="input_box" value="' . ($id > 0 ? $additionalField->getFieldMaxSize( ) : 255) . '"> 
                        </div> 
                    </div>'; if (Central::$isUSOnline === false) { $content .= ' 
                    <div class="item" id="specialTypeId"> 
                        <div class="left_data"> 
                            ' . Lang::getPhrase(1575) . ': 
                        </div> 
                        <div> 
                            <select name="special_type" size="1"> 
                                <option value=""></option> 
                                <option '; if ( $id > 0 && AdditionalFieldAR::SPECIAL_TYPE_PHONE_NUMBER === $additionalField->getSpecialType() ) { $content .= 'selected '; } $content .= 'value="' . AdditionalFieldAR::SPECIAL_TYPE_PHONE_NUMBER . '">' . Lang::getPhrase( 4720 ) . '</option> 
                                <option '; if ( $id > 0 && AdditionalFieldAR::SPECIAL_TYPE_CABLE_LENGTH === $additionalField->getSpecialType() ) { $content .= 'selected '; } $content .= 'value="' . AdditionalFieldAR::SPECIAL_TYPE_CABLE_LENGTH . '">' . Lang::getPhrase( 1013 ) . '</option> 
                            </select>                     
                        </div> 
                    </div>'; } $content .= ' 
                    <div class="item" id="valueListId"> 
                        <div class="left_data"> 
                            ' . Lang::getPhrase(4176) . ':<br> 
                            <span class="info_block">' . Lang::getPhrase(4177) . '</span> 
                        </div> 
                        <div> 
                            <textarea class="textarea_class" name="value_list" cols="40" rows="10">' . ($id > 0 ? $additionalField->getValueList( ) : '') . '</textarea> 
                        </div> 
                    </div> 
                    <div class="item"> 
                        <div class="left_data"> 
                            ' . Lang::getPhrase(5664) . ': 
                        </div> 
                        <div> 
                            <input name="is_in_main_info" type="checkbox"'; if ( $id > 0 && true === $additionalField->getIsInMainInfo() ) { $content .= ' checked'; } $content .= ' value="1">                                         
                        </div> 
                    </div> 
                    <div class="item"> 
                        <div class="left_data"> 
                            ' . Lang::getPhrase(5665) . ': 
                        </div> 
                        <div> 
                            <input name="is_in_top" type="checkbox"'; if ( $id > 0 && true === $additionalField->getIsInTopInfo() ) { $content .= ' checked'; } $content .= ' value="1">                                         
                        </div> 
                    </div> 
                     
                    <div class="item"> 
                        <div class="left_data"> 
                            ' . Lang::getPhrase(5882) . ': 
                        </div> 
                        <div> 
                            <div class="div_space2"> 
                                ' . Lang::getPhrase( 5885 ) . ' <input name="field_exterior_fontsize" type="text" size=4 maxlength=3 class="input_box" value="'; if (isset($exteriorArray['fontsize'])) { $content .= $exteriorArray['fontsize']; } $content .= '"> 
                                ' . Lang::getPhrase( 5250 ) . ' <input name="field_exterior_fontcolor"  id="colorId" type="text" size=8 maxlength=7 class="input_box iColorPicker" value="'; if (isset($exteriorArray['fontcolor'])) { $content .= $exteriorArray['fontcolor']; } $content .= '"> 
                            </div> 
                            <div class="div_space2"> 
                                <input name="field_exterior_bold" type="checkbox" value="1"'; if ( isset($exteriorArray['bold']) && 1 === (int)$exteriorArray['bold'] ) { $content .= ' checked'; } $content .= '> <b>bold</b> 
                            </div> 
                            <div class="div_space2"> 
                                <input name="field_exterior_italic" type="checkbox" value="1"'; if ( isset($exteriorArray['italic']) && 1 === (int)$exteriorArray['italic'] ) { $content .= ' checked'; } $content .= '> <i>italic</i> 
                            </div> 
                        </div> 
                    </div> 
                     
                    <div class="item"> 
                        <div class="left_data"> 
                            ' . Lang::getPhrase(6119) . ': 
                        </div> 
                        <div>'; $catalog = AdditionalFieldAR::getCatalog(); foreach ($catalog as $categoryId => $value) { $content .= ' 
                            <div class="div_space"> 
                                <input id="categories' . $categoryId . 'Id" name="categories[]" type="checkbox"'; if (isset($categories[$categoryId])) { $content .= ' checked'; } $content .= ' value=' . $categoryId . '> ' . $value['name']; if ($categoryId === AdditionalFieldAR::CATEGORY_NODE) { $content .= ' - <span class="info_block">(' . Lang::getPhrase( 3608 ) . ' "<a href="?core_section=' . BodyHtml::SECTION_SETTINGS_MAIN . '&action=' . self::A_NODE_TYPES . '">' . NodeAR::classCaption( ) . '</a>" ' . Lang::getPhrase( 5771 ) . ')</span>'; } if ($categoryId === AdditionalFieldAR::CATEGORY_TASK) { $content .= ' - <span class="info_block">(' . Lang::getPhrase( 3608 ) . ' "<a href="?core_section=settings_task">' . Lang::getPhrase( 676 ) . '</a>" ' . Lang::getPhrase( 5771 ) . ')</span>'; } $content .= ' 
                            </div>'; if ($categoryId === AdditionalFieldAR::CATEGORY_CUSTOMER) { $content .= ' 
                            <div class="div_space"> 
                                &nbsp; &nbsp; &nbsp; &nbsp;   
                                <input name="additional_properties_' . AdditionalFieldAR::ADDITIONAL_PROPERTIES_CUSTOMER_PRIVATE . '" type="checkbox"'; if ( isset($additionalProperties[AdditionalFieldAR::ADDITIONAL_PROPERTIES_CUSTOMER_PRIVATE]) && 1 === (int)$additionalProperties[AdditionalFieldAR::ADDITIONAL_PROPERTIES_CUSTOMER_PRIVATE] ) { $content .= ' checked'; } $content .= ' value="1"> ' . Lang::getPhrase(4251) . '  
                            </div> 
                            <div class="div_space"> 
                                &nbsp; &nbsp; &nbsp; &nbsp;   
                                <input name="additional_properties_' . AdditionalFieldAR::ADDITIONAL_PROPERTIES_CUSTOMER_CORPORATE . '" type="checkbox"'; if ( isset($additionalProperties[AdditionalFieldAR::ADDITIONAL_PROPERTIES_CUSTOMER_CORPORATE]) && 1 === (int)$additionalProperties[AdditionalFieldAR::ADDITIONAL_PROPERTIES_CUSTOMER_CORPORATE] ) { $content .= ' checked'; } $content .= ' value="1"> ' . Lang::getPhrase( 4252 ) . '  
                            </div> 
                            <div class="div_space"> 
                                &nbsp; &nbsp; &nbsp; &nbsp;   
                                <input name="additional_properties_' . AdditionalFieldAR::ADDITIONAL_PROPERTIES_CUSTOMER_POTENTIAL_PRIVATE . '" type="checkbox"'; if ( isset($additionalProperties[AdditionalFieldAR::ADDITIONAL_PROPERTIES_CUSTOMER_POTENTIAL_PRIVATE]) && 1 == $additionalProperties[AdditionalFieldAR::ADDITIONAL_PROPERTIES_CUSTOMER_POTENTIAL_PRIVATE] ) { $content .= ' checked'; } $content .= ' value="1"> ' . Lang::getPhrase( 5125 ) . ' - ' . Lang::getPhrase( 4251 ) . '  
                            </div> 
                            <div class="div_space"> 
                                &nbsp; &nbsp; &nbsp; &nbsp;   
                                <input name="additional_properties_' . AdditionalFieldAR::ADDITIONAL_PROPERTIES_CUSTOMER_POTENTIAL_CORPORATE . '" type="checkbox"'; if ( isset($additionalProperties[AdditionalFieldAR::ADDITIONAL_PROPERTIES_CUSTOMER_POTENTIAL_CORPORATE]) && 1 === (int)$additionalProperties[AdditionalFieldAR::ADDITIONAL_PROPERTIES_CUSTOMER_POTENTIAL_CORPORATE] ) { $content .= ' checked'; } $content .= ' value="1"> ' . Lang::getPhrase( 5125 ) . ' - ' . Lang::getPhrase( 4252 ) . '  
                            </div>'; } } $content .= ' 
                        </div> 
                    </div> 
                </div> 
                <script src="../main/js/icolorpicker.js?t=' . time() . '"></script> 
                <script> 
                    function reloadFieldType() { 
                        var fieldTypeId = document.getElementById("fieldTypeId").value; 
                        $("#valueListId").hide(); 
                        if ( 
                            fieldTypeId == "' . AdditionalFieldAR::FIELD_TYPE_STRING . '"  
                            ||  
                            fieldTypeId == "' . AdditionalFieldAR::FIELD_TYPE_STRING_UNIQUE . '"  
                            ||  
                            fieldTypeId == "' . AdditionalFieldAR::FIELD_TYPE_INT . '"  
                            ||  
                            fieldTypeId == "' . AdditionalFieldAR::FIELD_TYPE_TEXTAREA . '" 
                        ) { 
                            $("#fieldSizeId").show(); 
                            $("#fieldMaxSizeId").hide(); 
                            if ( 
                                fieldTypeId == "' . AdditionalFieldAR::FIELD_TYPE_STRING . '"  
                                ||  
                                fieldTypeId == "' . AdditionalFieldAR::FIELD_TYPE_STRING_UNIQUE . '"  
                                ||  
                                fieldTypeId == "' . AdditionalFieldAR::FIELD_TYPE_INT . '"  
                                ) { 
                                $("#fieldMaxSizeId").show(); 
                            } 
                        } else { 
                            $("#fieldSizeId").hide(); 
                            $("#fieldMaxSizeId").hide(); 
                            if ( 
                                fieldTypeId == "' . AdditionalFieldAR::FIELD_TYPE_SELECTOR . '"  
                                ||  
                                fieldTypeId == "' . AdditionalFieldAR::FIELD_TYPE_SELECTOR_CUSTOM . '"  
                                || 
                                fieldTypeId == "' . AdditionalFieldAR::FIELD_TYPE_SELECTOR_MULTIPLE . '"  
                            ) { 
                                $("#valueListId").show(); 
                            } 
                        } 
                        if ( 
                            fieldTypeId == "' . AdditionalFieldAR::FIELD_TYPE_STRING . '" 
                        ) { 
                            $("#specialTypeId").show(); 
                        } else { 
                            $("#specialTypeId").hide(); 
                        } 
                        if ( 
                            fieldTypeId == "' . AdditionalFieldAR::FIELD_TYPE_COUNTER . '" 
                        ) { 
                            $("#perTypeId").show(); 
                            $("#startValueId").show(); 
                            $("#clearYearId").show(); 
                            $("#clearMonthId").show(); 
                        } else { 
                            $("#perTypeId").hide(); 
                            $("#startValueId").hide(); 
                            $("#clearYearId").hide(); 
                            $("#clearMonthId").hide(); 
                        } 
                    } 
                    reloadFieldType(); 
                </script> 
                ' . BodyHtml::formButton('save_cancel', $ret) . ' 
            </form>'; if ($id > 0) { $tempCount = Yii::$container ->get(AdditionalFieldValueFetcher::class) ->getCountByCondition( [ AdditionalFieldValueDto::F_ADDITIONAL_FIELD_ID => $id ] ); if (0 < $tempCount) { $content .= ' 
                        <br> 
                        <div class="div_space"> 
                            <span class="info_block">' . Lang::getPhrase( 1129 ) . ': <b>' . $tempCount . '</b> </span>'; if (Central::$isUSOnline === false) { $content .= BodyHtml::linkConfirm( '?' . BodyHtml::CORES_SECTION . '=' . BodyHtml::SECTION_ADDITIONAL_DATA . '&action=' . AdditionalDataHtml::A_DELETE_VALUE . '&id=' . $id, Lang::getPhrase(1415), Lang::getPhrase(1150) , '<i class="us-icon fa-times"></i>', 'linkConfirmDeleteValue' . $id . 'Id' ); } $content .= ' 
                        </div>'; } $content .= '<br>' . BodyHtml::linkConfirm( url: '?' . BodyHtml::CORES_SECTION . '=' . BodyHtml::SECTION_SETTINGS_MAIN . '&action=' . self::A_ADDITIONAL_FIELD_DELETE . '&id=' . $id, caption: Lang::getPhrase(1415), confirmText: Lang::getPhrase(1150) . '?', linkBodyFull: '<i class="us-icon us-icon-danger fa-close"></i>' . Lang::getPhrase(1415) , linkTextId: 'linkConfirmDeleteFieldId' ); } return $content; } private static function checkErrorPage(): void { OperatorAccess::verifyRight(OperatorAccess::RIGHT_SETTING); throw new Exception('TestErrorPage'); } private static function additionalFieldMerge(): string { OperatorAccess::verifyRight(OperatorAccess::RIGHT_SETTING); $dstFieldId = RequestData::customInt('dst_field_id'); $srcFieldId = RequestData::customInt('src_field_id'); if ($srcFieldId > 0) { AdditionalFieldValueSystem::changeFieldId($srcFieldId, $dstFieldId); EmployeeActionLogSystem::writeLog( EmployeeHistoryType::T593, AdditionalFieldAR::OBJECT_TYPE_ID, $srcFieldId ); $ret = '?core_section=settings_main&item_id=' . self::ITEM_18; Html::location($ret, Html::TYPE_MSG_UPDOK); } $additionalDataConfigs = AdditionalFieldAR::find() ->orderBy(AdditionalFieldAR::F_NAME) ->all(); $ret = '?core_section=settings_main&item_id=' . self::ITEM_18; $content = ' 
            <a href="' . $ret . '"><i class="us-icon fa-chevron-left"></i>' . Lang::getPhrase( 1443 ) . '</a><br> 
            <br> 
            <span class="label_h2">' . AdditionalFieldAR::classCaption() . '</span> 
            <br> 
            <br> 
            <span class="label_h3">' . Lang::getPhrase(6120) . '</span><br> 
            <form method="post" name="form1" action=""> 
                <input type="hidden" name="' . BodyHtml::CORES_SECTION . '" value="' . BodyHtml::SECTION_SETTINGS_MAIN . '"> 
                <input type="hidden" name="action" value="' . self::A_ADDITIONAL_FIELD_MERGE . '"> 
                <div class="table_block"> 
                    <div class="item"> 
                        <div class="left_data"> 
                            ' . Lang::getPhrase(5229) . ': 
                        </div> 
                        <div> 
                            <select name="dst_field_id" size="1">'; foreach ($additionalDataConfigs as $additionalDataConfig) { $content .= ' 
                                <option value="' . $additionalDataConfig->getId( ) . '">' . $additionalDataConfig->getName() . ' (#' . $additionalDataConfig->getId() . ')</option>'; } $content .= ' 
                            <select> 
                        </div> 
                    </div> 
                    <div class="item"> 
                        <div class="left_data"> 
                            ' . Lang::getPhrase(1518) . ': 
                        </div> 
                        <div> 
                            <select name="src_field_id" size="1">'; foreach ($additionalDataConfigs as $additionalDataConfig) { $content .= ' 
                                <option value="' . $additionalDataConfig->getId( ) . '">' . $additionalDataConfig->getName() . ' (#' . $additionalDataConfig->getId() . ')</option>'; } $content .= ' 
                            <select> 
                        </div> 
                    </div> 
                </div> 
                ' . BodyHtml::formButton('save_cancel', $ret) . ' 
            </form>'; return $content; } private static function changeAdditionalFieldValue(): string { OperatorAccess::verifyRight(OperatorAccess::RIGHT_SETTING); $fieldId = RequestData::customInt('field_id'); if ($fieldId > 0) { $newValue = RequestData::customTrue('new_value'); $oldValue = RequestData::customTrue('old_value'); AdditionalFieldValueSystem::replaceValue($fieldId, $oldValue, $newValue); EmployeeActionLogSystem::writeLog( EmployeeHistoryType::T593, AdditionalFieldAR::OBJECT_TYPE_ID, $fieldId ); Html::locationBackOk(); } $additionalDataCatalog = AdditionalFieldAR::getCatalog(); $additionalDataConfigs = AdditionalFieldAR::find() ->orderBy(AdditionalFieldAR::F_NAME) ->all(); $ret = '?core_section=settings_main&item_id=' . self::ITEM_18; $content = ' 
            <a href="' . $ret . '"><i class="us-icon fa-chevron-left"></i>' . Lang::getPhrase( 1443 ) . '</a><br> 
            <br> 
            <span class="label_h2">' . AdditionalFieldAR::classCaption() . '</span> 
            <br> 
            <br> 
            <span class="label_h3">' . Lang::getPhrase(5990) . '</span><br> 
            <i>(' . Lang::getPhrase(5993) . ')</i> 
            <form method="post" name="form1" action=""> 
                <input type="hidden" name="core_section" value="settings_main"> 
                <input type="hidden" name="action" value="change_additional_field_value"> 
                <div class="table_block"> 
                    <div class="item"> 
                        <div class="left_data"> 
                            ' . Lang::getPhrase(5609) . ': 
                        </div> 
                        <div> 
                            <select name="field_id" size="1">'; foreach ($additionalDataConfigs as $additionalDataConfig) { $content .= ' 
                                <option value="' . $additionalDataConfig->getId( ) . '">' . $additionalDataConfig->getName() . ' (#' . $additionalDataConfig->getId() . ')</option>'; } $content .= ' 
                            <select> 
                        </div> 
                    </div> 
                    <div class="item"> 
                        <div class="left_data"> 
                            ' . Lang::getPhrase(5991) . ': 
                        </div> 
                        <div> 
                            <input name="old_value" type="text" size=30 maxlength=255 class="input_box" value=""> 
                        </div> 
                    </div> 
                    <div class="item"> 
                        <div class="left_data"> 
                            ' . Lang::getPhrase(5992) . ': 
                        </div> 
                        <div> 
                            <input name="new_value" type="text" size=30 maxlength=255 class="input_box" value=""> 
                        </div> 
                    </div> 
                </div> 
                ' . BodyHtml::formButton('save_cancel', $ret, Lang::getPhrase(735) ) . ' 
            </form>'; return $content; } public static function diagFlushRedisCache(): string { Html::$isEmptyTemplate = true; RedisCache::clearByTemplate('*'); return 'Doing!'; } public static function diagDbInfo(): string { OperatorAccess::verifyRight(OperatorAccess::RIGHT_SETTING); $content = '<span class="label_h2">DB Info</span><br> 
            <br>'; $query = "SELECT pg_size_pretty(pg_database_size(current_database()))"; $stmt = Yii::$app->db->masterPdo->prepare($query); $stmt->execute(); $value = $stmt->fetch(PDO::FETCH_ASSOC); $content .= 'Total DBSize: <b>' . $value['pg_size_pretty'] . '</b><br>'; $content .= '<br>Size:<br>'; $data = []; $query = "SELECT nspname || '.' || relname AS relation, 
    pg_size_pretty(pg_relation_size(C.oid)) AS size 
  FROM pg_class C 
  LEFT JOIN pg_namespace N ON (N.oid = C.relnamespace) 
  WHERE nspname NOT IN ('pg_catalog', 'information_schema') 
  ORDER BY pg_relation_size(C.oid) DESC 
  LIMIT 20"; $stmt = Yii::$app->db->masterPdo->prepare($query); $stmt->execute(); while ($value = $stmt->fetch(PDO::FETCH_ASSOC)) { $data[] = [ 'table_name' => $value['relation'], 'size' => $value['size'] ]; } $field = [ [ 'SPECIAL' => '_number' ], [ 'NAME' => 'Table', 'EL' => 'table_name' ], [ 'NAME' => 'Size', 'ALIGN' => 'right', 'EL' => 'size' ] ]; $table = new Table(); $content .= $table->show($data, $field); $content .= '<br><br>Size with index:<br>'; $data = []; $query = "SELECT nspname || '.' || relname AS relation, 
    pg_size_pretty(pg_total_relation_size(C.oid)) AS size 
  FROM pg_class C 
  LEFT JOIN pg_namespace N ON (N.oid = C.relnamespace) 
  WHERE nspname NOT IN ('pg_catalog', 'information_schema') 
    AND C.relkind <> 'i' 
    AND nspname !~ '^pg_toast' 
  ORDER BY pg_total_relation_size(C.oid) DESC 
  LIMIT 50"; $stmt = Yii::$app->db->masterPdo->prepare($query); $stmt->execute(); while ($value = $stmt->fetch(PDO::FETCH_ASSOC)) { $data[] = [ 'table_name' => $value['relation'], 'size' => $value['size'] ]; } $field = [ [ 'SPECIAL' => '_number' ], [ 'NAME' => 'Table', 'EL' => 'table_name' ], [ 'NAME' => 'Size', 'ALIGN' => 'right', 'EL' => 'size' ] ]; $table = new Table(); $content .= $table->show($data, $field); return $content; } public static function diagSystemStat(): string { OperatorAccess::verifyRight(OperatorAccess::RIGHT_SETTING); $content = '<span class="label_h2">SystemStat</span><br> 
            <br>'; $month = RequestData::custom('month'); $array = StatisticsSystemAR::find() ->select( [ 'month' => StatisticsSystemAR::F_MONTH, 'sum' => 'COUNT(*)' ] ) ->indexBy(StatisticsSystemAR::F_MONTH) ->groupBy(StatisticsSystemAR::F_MONTH) ->asArray() ->all(); foreach ($array as $value) { $content .= ' 
                <div class="div_space"> 
                    &bull; <a href="?core_section=settings_main&action=diag_system_stat&month=' . $value['month'] . '">' . $value['month'] . '</a> (' . $value['sum'] . ') 
                </div>'; } if ('' != $month) { $content .= ' 
                <br> 
                <span class="label_h3">' . $month . '</span><br>'; $data = StatisticsSystemAR::find() ->select( [ 'section' => StatisticsSystemAR::F_SECTION, 'action' => StatisticsSystemAR::F_ACTION, 'sum' => 'COUNT(*)', 'sum_all_sql_counter' => 'SUM(' . StatisticsSystemAR::F_ALL_SQL_COUNTER . ')', 'sum_all_time' => 'SUM(' . StatisticsSystemAR::F_ALL_TIME . ')', 'sum_all_mem' => 'SUM(' . StatisticsSystemAR::F_ALL_MEMORY . ')' ] ) ->where( [ StatisticsSystemAR::F_MONTH => $month ] ) ->groupBy( [ StatisticsSystemAR::F_SECTION, StatisticsSystemAR::F_ACTION ] ) ->asArray() ->all(); $totalCounter = []; foreach ($data as $value) { $totalCounter['sum'] = !isset($totalCounter['sum']) ? $value['sum'] : $totalCounter['sum'] + $value['sum']; $totalCounter['sum_all_sql_counter'] = !isset($totalCounter['sum_all_sql_counter']) ? $value['sum_all_sql_counter'] : $totalCounter['sum_all_sql_counter'] + $value['sum_all_sql_counter']; $totalCounter['sum_all_time'] = !isset($totalCounter['sum_all_time']) ? $value['sum_all_time'] : $totalCounter['sum_all_time'] + $value['sum_all_time']; $totalCounter['sum_all_mem'] = !isset($totalCounter['sum_all_mem']) ? $value['sum_all_mem'] : $totalCounter['sum_all_mem'] + $value['sum_all_mem']; } foreach ($data as $i => $value) { $data[$i]['sql_per_one_full'] = $value['sum_all_sql_counter'] / $value['sum'] * 1000; $data[$i]['sql_per_one'] = round($data[$i]['sql_per_one_full'] * 0.001, 2); $data[$i]['time_per_one_full'] = $value['sum_all_time'] / $value['sum'] * 1000; $data[$i]['time_per_one'] = round($data[$i]['time_per_one_full'] * 0.001, 2); $data[$i]['mem_per_one_full'] = $value['sum_all_mem'] / $value['sum']; $data[$i]['mem_per_one'] = round($data[$i]['mem_per_one_full'] * 0.000001, 2) . ' M'; $data[$i]['sum_percent'] = round($value['sum'] / $totalCounter['sum'], 3) * 100; if ($value['sum_all_sql_counter'] > 0) { $data[$i]['sum_all_sql_counter_percent'] = round( $value['sum_all_sql_counter'] / $totalCounter['sum_all_sql_counter'], 3 ) * 100; } if ($value['sum_all_time'] > 0) { $data[$i]['sum_all_time_percent'] = round( $value['sum_all_time'] / $totalCounter['sum_all_time'], 3 ) * 100; } if ($value['sum_all_mem'] > 0) { $data[$i]['sum_all_mem_percent'] = round( $value['sum_all_mem'] / $totalCounter['sum_all_mem'], 3 ) * 100; } } $field = [ [ 'SPECIAL' => '_number' ], [ 'NAME' => 'Section', 'EL' => 'section' ], [ 'NAME' => 'Action', 'EL' => 'action' ], [ 'NAME' => 'Counter', 'ALIGN' => 'right', 'EL' => 'sum', 'IS_TOTAL' => 1, 'ISSORT' => 1 ], [ 'NAME' => '%', 'ALIGN' => 'right', 'EL' => 'sum_percent', 'ISSORT' => 1 ], [ 'NAME' => 'All SQL Counter', 'ALIGN' => 'right', 'EL' => 'sum_all_sql_counter', 'IS_TOTAL' => 1, 'ISSORT' => 1 ], [ 'NAME' => '%', 'ALIGN' => 'right', 'EL' => 'sum_all_sql_counter_percent', 'ISSORT' => 1 ], [ 'NAME' => 'All Time', 'ALIGN' => 'right', 'EL' => 'sum_all_time', 'IS_TOTAL' => 1, 'ISSORT' => 1 ], [ 'NAME' => '%', 'ALIGN' => 'right', 'EL' => 'sum_all_time_percent', 'ISSORT' => 1 ], [ 'NAME' => 'All Mem', 'ALIGN' => 'right', 'EL' => 'sum_all_mem', 'IS_TOTAL' => 1, 'ISSORT' => 1 ], [ 'NAME' => '%', 'ALIGN' => 'right', 'EL' => 'sum_all_mem_percent', 'ISSORT' => 1 ], [ 'NAME' => 'SQL/1', 'ALIGN' => 'right', 'EL' => 'sql_per_one', 'EL_SORT' => 'sql_per_one_full', 'ISSORT' => 1 ], [ 'NAME' => 'Time/1', 'ALIGN' => 'right', 'EL' => 'time_per_one', 'EL_SORT' => 'time_per_one_full', 'ISSORT' => 1 ], [ 'NAME' => 'Mem/1', 'ALIGN' => 'right', 'EL' => 'mem_per_one', 'EL_SORT' => 'mem_per_one_full', 'ISSORT' => 1 ] ]; $table = new Table(); $table->sortDefault = 'sum'; $table->isSortDesc = 1; $table->customPerPage = 'all'; $content .= $table->show($data, $field); $content .= ' 
                <br><br>'; $data = StatisticsSystemAR::find() ->select( [ 'section' => StatisticsSystemAR::F_SECTION, 'sum' => 'COUNT(*)', 'sum_all_sql_counter' => 'SUM(' . StatisticsSystemAR::F_ALL_SQL_COUNTER . ')', 'sum_all_time' => 'SUM(' . StatisticsSystemAR::F_ALL_TIME . ')', 'sum_all_mem' => 'SUM(' . StatisticsSystemAR::F_ALL_MEMORY . ')' ] ) ->where( [ StatisticsSystemAR::F_MONTH => $month ] ) ->groupBy(StatisticsSystemAR::F_SECTION) ->asArray() ->all(); $totalCounter = []; foreach ($data as $value) { $totalCounter['sum'] = !isset($totalCounter['sum']) ? $value['sum'] : $totalCounter['sum'] + $value['sum']; $totalCounter['sum_all_sql_counter'] = !isset($totalCounter['sum_all_sql_counter']) ? $value['sum'] : $totalCounter['sum_all_sql_counter'] + $value['sum_all_sql_counter']; $totalCounter['sum_all_time'] = !isset($totalCounter['sum_all_time']) ? $value['sum_all_time'] : $totalCounter['sum_all_time'] + $value['sum_all_time']; $totalCounter['sum_all_mem'] = !isset($totalCounter['sum_all_mem']) ? $value['sum_all_mem'] : $totalCounter['sum_all_mem'] + $value['sum_all_mem']; } foreach ($data as $i => $value) { $data[$i]['sql_per_one_full'] = $value['sum_all_sql_counter'] / $value['sum'] * 1000; $data[$i]['sql_per_one'] = round($data[$i]['sql_per_one_full'] * 0.001, 2); $data[$i]['time_per_one_full'] = $value['sum_all_time'] / $value['sum'] * 1000; $data[$i]['time_per_one'] = round($data[$i]['time_per_one_full'] * 0.001, 2); $data[$i]['mem_per_one_full'] = $value['sum_all_mem'] / $value['sum']; $data[$i]['mem_per_one'] = round($data[$i]['mem_per_one_full'] * 0.000001, 2) . ' M'; $data[$i]['sum_percent'] = round($value['sum'] / $totalCounter['sum'], 3) * 100; if ($value['sum_all_sql_counter'] > 0 && $totalCounter['sum_all_sql_counter'] > 0) { $data[$i]['sum_all_sql_counter_percent'] = round( $value['sum_all_sql_counter'] / $totalCounter['sum_all_sql_counter'], 3 ) * 100; } if ($value['sum_all_time'] > 0 && $totalCounter['sum_all_time'] > 0) { $data[$i]['sum_all_time_percent'] = round( $value['sum_all_time'] / $totalCounter['sum_all_time'], 3 ) * 100; } if ($value['sum_all_mem'] > 0 && $totalCounter['sum_all_mem'] > 0) { $data[$i]['sum_all_mem_percent'] = round( $value['sum_all_mem'] / $totalCounter['sum_all_mem'], 3 ) * 100; } } $field = [ [ 'SPECIAL' => '_number' ], [ 'NAME' => 'Section', 'EL' => 'section' ], [ 'NAME' => 'Counter', 'ALIGN' => 'right', 'EL' => 'sum', 'IS_TOTAL' => 1, 'ISSORT' => 1 ], [ 'NAME' => '%', 'ALIGN' => 'right', 'EL' => 'sum_percent', 'ISSORT' => 1 ], [ 'NAME' => 'All SQL Counter', 'ALIGN' => 'right', 'EL' => 'sum_all_sql_counter', 'IS_TOTAL' => 1, 'ISSORT' => 1 ], [ 'NAME' => '%', 'ALIGN' => 'right', 'EL' => 'sum_all_sql_counter_percent', 'ISSORT' => 1 ], [ 'NAME' => 'All Time', 'ALIGN' => 'right', 'EL' => 'sum_all_time', 'IS_TOTAL' => 1, 'ISSORT' => 1 ], [ 'NAME' => '%', 'ALIGN' => 'right', 'EL' => 'sum_all_time_percent', 'ISSORT' => 1 ], [ 'NAME' => 'All Mem', 'ALIGN' => 'right', 'EL' => 'sum_all_mem', 'IS_TOTAL' => 1, 'ISSORT' => 1 ], [ 'NAME' => '%', 'ALIGN' => 'right', 'EL' => 'sum_all_mem_percent', 'ISSORT' => 1 ], [ 'NAME' => 'SQL/1', 'ALIGN' => 'right', 'EL' => 'sql_per_one', 'EL_SORT' => 'sql_per_one_full', 'ISSORT' => 1 ], [ 'NAME' => 'Time/1', 'ALIGN' => 'right', 'EL' => 'time_per_one', 'EL_SORT' => 'time_per_one_full', 'ISSORT' => 1 ], [ 'NAME' => 'Mem/1', 'ALIGN' => 'right', 'EL' => 'mem_per_one', 'EL_SORT' => 'mem_per_one_full', 'ISSORT' => 1 ] ]; $table = new Table(); $table->sortDefault = 'sum'; $table->isSortDesc = 1; $table->isShowTotal = 1; $table->customPerPage = 'all'; $content .= $table->show($data, $field); $content .= ' 
                <br><br>'; $data = StatisticsSystemAR::find() ->where( [ StatisticsSystemAR::F_MONTH => $month ] ) ->andWhere( ['IS NOT', StatisticsSystemAR::F_ALL_MEMORY, null] ) ->orderBy( [ StatisticsSystemAR::F_ALL_MEMORY => SORT_DESC ] ) ->limit(25) ->asArray() ->all(); $field = [ [ 'SPECIAL' => '_number' ], [ 'NAME' => 'Section', 'EL' => 'section' ], [ 'NAME' => 'Action', 'EL' => 'action' ], [ 'NAME' => 'SQL Counter', 'ALIGN' => 'right', 'EL' => 'all_sql_counter', ], [ 'NAME' => 'Time', 'ALIGN' => 'right', 'EL' => 'all_time', ], [ 'NAME' => 'Memory', 'ALIGN' => 'right', 'EL' => 'all_memory', 'ISSORT' => 1 ], [ 'NAME' => 'Page', 'EL' => 'page', ], ]; $table = new Table(); $table->sortDefault = 'all_memory'; $table->isSortDesc = 1; $table->customPerPage = 'all'; $content .= $table->show($data, $field); $content .= ' 
                <br><br>'; $data = StatisticsSystemAR::find() ->where( [ StatisticsSystemAR::F_MONTH => $month ] ) ->andWhere( ['IS NOT', StatisticsSystemAR::F_ALL_TIME, null] ) ->orderBy( [ StatisticsSystemAR::F_ALL_TIME => SORT_DESC ] ) ->limit(25) ->asArray() ->all(); $field = [ [ 'SPECIAL' => '_number' ], [ 'NAME' => 'Section', 'EL' => 'section' ], [ 'NAME' => 'Action', 'EL' => 'action' ], [ 'NAME' => 'SQL Counter', 'ALIGN' => 'right', 'EL' => 'all_sql_counter', ], [ 'NAME' => 'Time', 'ALIGN' => 'right', 'EL' => 'all_time', 'ISSORT' => 1 ], [ 'NAME' => 'Memory', 'ALIGN' => 'right', 'EL' => 'all_memory', ], [ 'NAME' => 'Page', 'EL' => 'page', ], ]; $table = new Table(); $table->sortDefault = 'all_time'; $table->isSortDesc = 1; $table->customPerPage = 'all'; $content .= $table->show($data, $field); $content .= ' 
                <br><br>'; $data = StatisticsSystemAR::find() ->where( [ StatisticsSystemAR::F_MONTH => $month ] ) ->andWhere( ['IS NOT', StatisticsSystemAR::F_ALL_SQL_COUNTER, null] ) ->orderBy( [ StatisticsSystemAR::F_ALL_SQL_COUNTER => SORT_DESC ] ) ->limit(25) ->asArray() ->all(); $field = [ [ 'SPECIAL' => '_number' ], [ 'NAME' => 'Section', 'EL' => 'section' ], [ 'NAME' => 'Action', 'EL' => 'action' ], [ 'NAME' => 'SQL Counter', 'ALIGN' => 'right', 'EL' => 'all_sql_counter', 'ISSORT' => 1 ], [ 'NAME' => 'Time', 'ALIGN' => 'right', 'EL' => 'all_time', ], [ 'NAME' => 'Memory', 'ALIGN' => 'right', 'EL' => 'all_memory', ], [ 'NAME' => 'Page', 'EL' => 'page', ], ]; $table = new Table(); $table->sortDefault = 'all_sql_counter'; $table->isSortDesc = 1; $table->customPerPage = 'all'; $content .= $table->show($data, $field); } return $content; } private static function loadMenuBody(): string { Html::$isEmptyTemplate = true; return '<span id="spanLoadMenuBodyId"></span>' . self::editSettingsOption(RequestData::$id); } private static function showLog(): string { Html::$isEmptyTemplate = true; OperatorAccess::verifyRight(OperatorAccess::RIGHT_SETTING); $type = RequestData::custom('type'); $taskId = RequestData::customInt('task_id'); $deviceId = RequestData::customInt('device_id'); $date = RequestData::customInt('date'); $tempArray = self::LOGS_ARRAY; $tempArray = array_flip($tempArray); $fileName = ''; if (isset($tempArray[$type])) { $fileName = $type . '.log'; } else { switch ($type) { case 'microservice_poller': $fileName = '../../microservice/poller/var/log/poller.log'; break; case 'cron': $fileName = 'cron_' . $taskId . '_' . date('Ymd', $date) . '.log'; break; case 'pon_poller': $fileName = 'pon_poller_' . $deviceId . '.log'; break; default: echo 'BAD TYPE'; Html::locationCancel(); break; } } $fileSrc = realpath(__DIR__) . '/../../../../var/log/' . $fileName; if (file_exists($fileSrc) === true) { $file = fopen($fileSrc, "r"); $fileTempSize = filesize($fileSrc); $maxSizeFile = 2000000; if ($fileTempSize > $maxSizeFile) { echo '<pre>>> ... LAST ' . $maxSizeFile . ' BYTES (FROM ' . $fileTempSize . ' | SEEK ' . ($fileTempSize - $maxSizeFile) . ') ... <<</pre>'; fseek($file, ($fileTempSize - $maxSizeFile)); $fileTempSize = $maxSizeFile; } $content = fread($file, $fileTempSize); echo '<pre>' . $content . '</pre>'; fclose($file); } else { echo 'Not Found'; } return ''; } private static function varLog(): string { Html::$isEmptyTemplate = true; OperatorAccess::verifyRight(OperatorAccess::RIGHT_SETTING); $fileType = RequestData::custom('file_type'); $limit = RequestData::customInt('limit'); switch ($fileType) { case 'notifications': default; $fileName = 'notifications.log'; break; } $fileName = realpath(__DIR__) . '/../../../../var/log/' . $fileName; if (!file_exists($fileName)) { Html::$isEmptyTemplate = true; return 'File not found! (' . $fileName . ')'; } $file = fopen($fileName, "r"); $content = fread(fopen($fileName, "r"), filesize($fileName)); $data = explode(chr(10), $content); $data = array_reverse($data); if ($limit > 0) { $count = 0; foreach ($data as $i => $value) { ++$count; if ($count > $limit) { unset($data[$i]); } } } echo '<pre>' . implode("\n", $data) . '</pre>'; fclose($file); return ''; } private static function diagMergeAddresses(): string { OperatorAccess::verifyRight(OperatorAccess::RIGHT_SETTING); $fromUnitId = RequestData::customInt('from_unit_id'); $toUnitId = RequestData::customInt('to_unit_id'); $isRealy = RequestData::customInt('is_realy'); $mergeCount = RequestData::customInt('merge_count'); if ( 1 === $isRealy && $mergeCount < 1 ) { Html::$isEmptyTemplate = true; AddressUnit::transferObject($fromUnitId, $toUnitId); return "Done! (from " . $fromUnitId . " to " . $toUnitId . ")"; } $content = ' 
            <span class="label_h2">Merge Addresses</span><br> 
            <br> 
            <br>'; $addressesArray = \erp\modules\GeoAddress\models\AddressUnit::find() ->select( [ 'COUNT(*) AS counter', 'parent_id', 'locality_type_id', 'name', 'ARRAY_AGG(id) AS id' ] ) ->groupBy( [ 'parent_id', 'locality_type_id', 'name' ] ) ->asArray() ->all(); foreach ($addressesArray as $i => $value) { if ($value['counter'] < 2) { unset($addressesArray[$i]); } } $countTemp = 0; foreach ($addressesArray as $i => $value) { ++$countTemp; $content .= ' 
                <div class="div_space"> 
                    ' . $countTemp . ') ' . AddressLocalityTypeCache::getToken($value['locality_type_id']) . ': '; $tempArray = explode(',', str_replace('}', '', str_replace('{', '', $value['id']))); $minId = 0; $maxId = 0; foreach ($tempArray as $value2) { if ( $minId === 0 || $value2 < $minId ) { $minId = $value2; } if ($value2 > $maxId) { $maxId = $value2; } $content .= '<a href="javascript:ajaxWindow(\'?' . BodyHtml::CORES_SECTION . '=' . BodyHtml::SECTION_SETTINGS_ADDRESS . '&action=dialog_edit_address_unit&id=' . $value2 . '\')">' . $value['name'] . '</a> (#' . $value2 . ') &middot; '; } $content .= ' 
                    &nbsp; &nbsp; &nbsp; &nbsp; <a target=_blank href="?core_section=settings_main&action=diag_merge_addresses&is_realy=1&from_unit_id=' . $maxId . '&to_unit_id=' . $minId . '">merge</a> 
                </div>'; if ( 1 === $isRealy && $countTemp <= $mergeCount ) { AddressUnit::transferObject($maxId, $minId); } } if (1 === $isRealy) { Html::$isEmptyTemplate = true; AddressUnit::transferObject($fromUnitId, $toUnitId); return "MERGE! (" . $mergeCount . ") OK"; } $content .= ' 
            <br> 
            <br> 
            <i class="us-icon fa-bars"></i><a href="?core_section=settings_main&action=diag_merge_addresses&is_realy=1&merge_count=50">Merge 50</a>'; return $content; } private static function reloadBuildingAddress(): string { Html::$isEmptyTemplate = true; OperatorAccess::verifyRight(OperatorAccess::RIGHT_SETTING); $responce = BuildingAR::reloadAllName(1); return 'Done (' . $responce[1] . '/' . $responce[0] . ')!'; } public static function deleteUnuseAddress($isByCommandString = 0): string { $stop = RequestData::customInt('stop'); if (1 != $isByCommandString) { OperatorAccess::verifyRight(OperatorAccess::RIGHT_SETTING); $isRealy = RequestData::customInt('is_realy'); } else { echo "Start Working\n"; $isRealy = 1; } $buildingUnitArray = []; $buildingUnitNameArray = []; $buildingArray = []; $array = AddressUnit::getByToken(AddressLocalityType::TOKEN_HOUSE); foreach ($array as $value) { $buildingUnitArray[$value['id']] = []; $buildingUnitNameArray[$value['id']] = [ 'name' => $value['name'], 'parent_id' => $value['parent_id'] ]; } if (1 == $isByCommandString || Html::$isDebug === true) { echo date('H:i:s') . " Stage Complete: 1\n"; if ($stop == 1) { Html::locationCancel(); } } $array = BuildingAR::find() ->where( [ BuildingAR::F_ADDRESS_UNIT_ID => Central::getArrayListForAR($buildingUnitArray) ] ) ->asArray() ->all(); foreach ($array as $value) { $unitId = $value[BuildingAR::F_ADDRESS_UNIT_ID]; $buildingId = $value[BuildingAR::F_ID]; $buildingUnitArray[$unitId]['building_id'] = $buildingId; $buildingArray[$buildingId]['unit_id'] = $unitId; } $array = BuildingAdditionalAddressAR::find() ->where( [ BuildingAdditionalAddressAR::F_ADDRESS_UNIT_ID => Central::getArrayListForAR( $buildingUnitArray ) ] ) ->asArray() ->all(); foreach ($array as $value) { $unitId = $value[BuildingAdditionalAddressAR::F_ADDRESS_UNIT_ID]; $buildingId = $value[BuildingAdditionalAddressAR::F_BUILDING_ID]; $buildingUnitArray[$unitId]['building_id'] = $buildingId; $buildingArray[$buildingId]['unit_id'] = $unitId; } if (1 == $isByCommandString || Html::$isDebug === true) { echo date('H:i:s') . " Stage Complete: 2\n"; if ($stop == 2) { Html::locationCancel(); } } $addressArrayUse = []; $addressArray = \erp\modules\GeoAddress\models\AddressUnit::find() ->where( ['NOT IN', 'id', Central::getArrayListForAR($buildingUnitArray)] ) ->all(); foreach ($addressArray as $i => $address) { $parentId = $address->parent_id; $addressArrayUse[$parentId] = $i; } $array = \erp\modules\GeoAddress\models\AddressUnit::find() ->where( [ 'id' => Central::getArrayListForAR($buildingUnitArray) ] ) ->asArray() ->all(); foreach ($array as $i => $value) { $parentId = $value['parent_id']; $addressArrayUse[$parentId] = $i; } $addressArray2 = []; foreach ($addressArray as $i => $address) { if (isset($addressArrayUse[$address->id])) { unset($addressArray[$i]); } else { $addressArray2[$address->id] = $i; } } if (1 == $isByCommandString || Html::$isDebug === true) { echo date('H:i:s') . " Stage Complete: 3\n"; if ($stop == 3) { Html::locationCancel(); } } $array = BuildingAR::find() ->where( [ BuildingAR::F_ID => Central::getArrayListForAR($buildingArray) ] ) ->andWhere(BuildingAR::F_COORD . " <> ''") ->asArray() ->all(); foreach ($array as $value) { $buildingId = $value[BuildingAR::F_ID]; if (isset($buildingArray[$buildingId])) { unset($buildingArray[$buildingId]); } } if (1 == $isByCommandString || Html::$isDebug === true) { echo date('H:i:s') . " Stage Complete: 4\n"; if ($stop == 4) { Html::locationCancel(); } } $array = NodeAR::find() ->where( [ NodeAR::F_ADDRESS_ID => Central::getArrayListForAR($addressArray2) ] ) ->indexBy(NodeAR::F_ADDRESS_ID) ->asArray() ->all(); foreach ($array as $unitId => $value) { if (isset($addressArray2[$unitId])) { unset($addressArray[$addressArray2[$unitId]]); } } if (1 == $isByCommandString || Html::$isDebug === true) { echo date('H:i:s') . " Stage Complete: 5\n"; if ($stop == 5) { Html::locationCancel(); } } if (1 == $isRealy) { $tempCount = 0; foreach ($addressArray as $address) { ++$tempCount; if (1 == $isByCommandString || Html::$isDebug === true) { echo "TryDelete: " . $address->id . " (" . $tempCount . "/" . count($addressArray) . ")\n"; } AddressUnit::tryDelete($address->id); } } if (1 == $isByCommandString || Html::$isDebug === true) { echo date('H:i:s') . " Stage Complete: 6\n"; if ($stop == 6) { Html::locationCancel(); } } $array = CustomerAR::find() ->where( [ CustomerAR::F_BUILDING_ID => Central::getArrayListForAR($buildingArray) ] ) ->asArray() ->all(); foreach ($array as $value) { $buildingId = $value[CustomerAR::F_BUILDING_ID]; if (isset($buildingArray[$buildingId])) { unset($buildingArray[$buildingId]); } } if (1 == $isByCommandString || Html::$isDebug === true) { echo date('H:i:s') . " Stage Complete: 7\n"; if ($stop == 7) { Html::locationCancel(); } } $array = CableLineAR::find() ->where( [ CableLineAR::F_BUILDING2_ID => Central::getArrayListForAR($buildingArray) ] ) ->asArray() ->all(); foreach ($array as $value) { $buildingId = $value[CableLineAR::F_BUILDING2_ID]; if (isset($buildingArray[$buildingId])) { unset($buildingArray[$buildingId]); } } if (1 == $isByCommandString || Html::$isDebug === true) { echo date('H:i:s') . " Stage Complete: 8\n"; if ($stop == 8) { Html::locationCancel(); } } if (1 == $isByCommandString || Html::$isDebug === true) { echo date('H:i:s') . " Stage Complete: 9\n"; if ($stop == 9) { Html::locationCancel(); } } $array = KeyAR::find() ->where( [ KeyAR::F_BUILDING_ID => Central::getArrayListForAR($buildingArray) ] ) ->asArray() ->all(); foreach ($array as $value) { $buildingId = $value[KeyAR::F_BUILDING_ID]; if (isset($buildingArray[$buildingId])) { unset($buildingArray[$buildingId]); } } if (1 == $isByCommandString || Html::$isDebug === true) { echo date('H:i:s') . " Stage Complete: 10\n"; if ($stop == 10) { Html::locationCancel(); } } $inventories = InventoryAR::find() ->where( [ InventoryAR::F_ACCOUNT_TYPE => InventoryAR::ACCOUNT_BUILDING, InventoryAR::F_ACCOUNT_OBJECT_ID => Central::getArrayListForAR($buildingArray) ] ) ->all(); foreach ($inventories as $inventory) { $buildingId = $inventory->getAccountObjectId(); if (isset($buildingArray[$buildingId])) { unset($buildingArray[$buildingId]); } } if (1 == $isByCommandString || Html::$isDebug === true) { echo date('H:i:s') . " Stage Complete: 11\n"; if ($stop == 11) { Html::locationCancel(); } } $array = NodeAR::find() ->where( [ NodeAR::F_ADDRESS_ID => Central::getArrayListForAR($buildingUnitArray) ] ) ->indexBy(NodeAR::F_ADDRESS_ID) ->asArray() ->all(); foreach ($array as $unitId => $value) { if (isset($buildingUnitArray[$unitId])) { unset($buildingUnitArray[$unitId]); } } if (1 == $isByCommandString || Html::$isDebug === true) { echo date('H:i:s') . " Stage Complete: 12\n"; if ($stop == 12) { Html::locationCancel(); } } $array = TaskAR::find() ->where( [ TaskAR::F_ADDRESS_ID => Central::getArrayListForAR($buildingUnitArray) ] ) ->select(TaskAR::F_ADDRESS_ID) ->asArray() ->all(); foreach ($array as $value) { $unitId = $value[TaskAR::F_ADDRESS_ID]; if (isset($buildingUnitArray[$unitId])) { unset($buildingUnitArray[$unitId]); } } if (1 == $isByCommandString || Html::$isDebug === true) { echo date('H:i:s') . " Stage Complete: 13\n"; if ($stop == 13) { Html::locationCancel(); } } foreach ($buildingUnitArray as $unitId => $value) { if (isset($value['building_id'])) { $buildingId = $value['building_id']; if (!isset($buildingArray[$buildingId])) { unset($buildingUnitArray[$unitId]); } } } if (1 == $isByCommandString || Html::$isDebug === true) { echo date('H:i:s') . " Stage Complete: 14\n"; if ($stop == 14) { Html::locationCancel(); } } $tempArray = []; foreach ($buildingUnitArray as $unitId => $value) { $tempArray[$unitId] = $unitId; } $data = \erp\modules\GeoAddress\models\AddressUnit::find() ->select( [ 'id id', 'parent_id' ] ) ->where( [ 'parent_id' => $tempArray ] ) ->asArray() ->all(); foreach ($data as $value) { $unitId = $value['parent_id']; if (isset($buildingUnitArray[$unitId])) { unset($buildingUnitArray[$unitId]); } } if (1 == $isByCommandString || Html::$isDebug === true) { echo date('H:i:s') . " Stage Complete: 15\n"; if ($stop == 15) { Html::locationCancel(); } } if (1 == $isRealy) { $tempCount = 0; foreach ($buildingUnitArray as $unitId => $value) { ++$tempCount; if (1 == $isByCommandString || Html::$isDebug === true) { echo "TryDelete: " . $unitId . " (" . $tempCount . "/" . count($buildingUnitArray) . ")\n"; } AddressUnit::tryDelete($unitId); } Html::$isEmptyTemplate = true; return "Doing!\n"; } $content = ' 
            <a href="?core_section=settings_address"><i class="us-icon fa-chevron-left"></i>' . Lang::getPhrase(461) . '</a><br> 
            <br> 
            <span class="label_h2">' . Lang::getPhrase(6124) . '</span><br> 
            <br> 
            <b>Houses:</b><br><br>'; $parentArray = []; foreach ($buildingUnitArray as $unitId => $value) { $parentId = $buildingUnitNameArray[$unitId]['parent_id']; $parentArray[$parentId] = $parentId; } $data = \erp\modules\GeoAddress\models\AddressUnit::find() ->select( [ 'id id', 'name' ] ) ->where( [ 'id' => $parentArray ] ) ->asArray() ->all(); foreach ($data as $value) { $parentArray[$value['id']] = $value['name']; } foreach ($buildingUnitArray as $unitId => $value) { $parentId = $buildingUnitNameArray[$unitId]['parent_id']; $parentName = isset($parentArray[$parentId]) ? $parentArray[$parentId] . ', ' : ''; $buildingUnitNameArray[$unitId]['parent_name'] = $parentName; } $count = 0; foreach ($buildingUnitArray as $unitId => $value) { ++$count; $name = $buildingUnitNameArray[$unitId]['parent_name'] . ' ' . $buildingUnitNameArray[$unitId]['name']; $content .= ' 
                <div class="div_space"> 
                    ' . $count . '. <a href="' . AddressUnit::getUrlById($unitId) . '">' . $name . '</a> 
                </div>'; } if (1 == $isByCommandString || Html::$isDebug === true) { echo date('H:i:s') . " Stage Complete: 16\n"; if ($stop == 16) { Html::locationCancel(); } } $count2 = 0; if (count($addressArray) > 0) { $content .= '<br><br><b>Addresses:</b><br><br>'; foreach ($addressArray as $address) { ++$count2; $content .= ' 
                <div class="div_space"> 
                    ' . $count2 . '. <a class="link_dashed" href="' . AddressUnit::getUrlById( $address->id ) . '"><span>' . AddressUnit::getNameById($address->id) . '</span></a> 
                </div>'; } } if ($count > 0 || $count2 > 0) { $content .= ' 
                <br><br> 
                <a id="linkRealyDeleteId" href="?core_section=settings_main&action=diag_delete_unuse_address&is_realy=1"><i class="us-icon us-icon-danger fa-times"></i>' . Lang::getPhrase( 1150 ) . '!</a>'; } return $content; } private static function weatherSaveCoord(): void { OperatorAccess::verifyRight(OperatorAccess::RIGHT_SETTING); $coord = RequestData::custom('coord'); SettingAR::setByName(SettingsCatalog::WEATHER_COORD, $coord); Html::locationBackOk(); } private static function additionalFieldDelete(): void { if (Central::$isUSOnline === false) { OperatorAccess::verifyRight(OperatorAccess::RIGHT_SETTING); } $id = RequestData::$id; if (true === AdditionalFieldAR::findOne($id)->tryDelete()) { Html::location( '?' . BodyHtml::CORES_SECTION . '=' . BodyHtml::SECTION_SETTINGS_MAIN . '&action=' . self::A_ADDITIONAL_FIELD_LIST, Html::TYPE_MSG_DELETED ); } else { Html::locationBackCancel(); } } private static function additionalFieldSave(): void { if (Central::$isUSOnline === false) { OperatorAccess::verifyRight(OperatorAccess::RIGHT_SETTING); } $id = RequestData::$id; $name = RequestData::custom('name'); $fieldType = RequestData::custom('field_type'); $categories = $_REQUEST['categories'] ?? []; $exterior = [ 'fontsize' => RequestData::customInt('field_exterior_fontsize'), 'fontcolor' => RequestData::custom('field_exterior_fontcolor'), 'bold' => RequestData::customInt('field_exterior_bold'), 'italic' => RequestData::customInt('field_exterior_italic'), 'is_per_type' => RequestData::customInt('is_per_type'), 'is_clear_year' => RequestData::customInt('is_clear_year'), 'is_clear_month' => RequestData::customInt('is_clear_month') ]; if ($id < 1) { $additionalDataConfig = AdditionalFieldAR::create( categories: $categories, name: $name, fieldType: $fieldType ); $id = $additionalDataConfig->getId(); } else { $additionalDataConfig = AdditionalFieldAR::findOne($id); EmployeeActionLogSystem::writeLog( EmployeeHistoryType::T383, AdditionalFieldAR::OBJECT_TYPE_ID, $id ); } $additionalProperties = [ AdditionalFieldAR::ADDITIONAL_PROPERTIES_CUSTOMER_PRIVATE => RequestData::customInt( 'additional_properties_' . AdditionalFieldAR::ADDITIONAL_PROPERTIES_CUSTOMER_PRIVATE ), AdditionalFieldAR::ADDITIONAL_PROPERTIES_CUSTOMER_CORPORATE => RequestData::customInt( 'additional_properties_' . AdditionalFieldAR::ADDITIONAL_PROPERTIES_CUSTOMER_CORPORATE ), AdditionalFieldAR::ADDITIONAL_PROPERTIES_CUSTOMER_POTENTIAL_PRIVATE => RequestData::customInt( 'additional_properties_' . AdditionalFieldAR::ADDITIONAL_PROPERTIES_CUSTOMER_POTENTIAL_PRIVATE ), AdditionalFieldAR::ADDITIONAL_PROPERTIES_CUSTOMER_POTENTIAL_CORPORATE => RequestData::customInt( 'additional_properties_' . AdditionalFieldAR::ADDITIONAL_PROPERTIES_CUSTOMER_POTENTIAL_CORPORATE ), ]; $additionalDataConfig->edit( [ AdditionalFieldAR::F_NAME => $name, AdditionalFieldAR::F_SUBCATEGORY => null, AdditionalFieldAR::F_FIELD_TYPE => $fieldType, AdditionalFieldAR::F_FIELD_SIZE => RequestData::customInt('field_size'), AdditionalFieldAR::F_FIELD_MAX_SIZE => RequestData::customInt('field_max_size'), AdditionalFieldAR::F_POSITION => RequestData::customInt('position'), AdditionalFieldAR::F_HINT => RequestData::custom('hint'), AdditionalFieldAR::F_IS_REQUIRE => RequestData::customBoolean('is_required'), AdditionalFieldAR::F_SPECIAL_TYPE => RequestData::custom('special_type'), AdditionalFieldAR::F_VALUE_LIST => RequestData::custom('value_list'), AdditionalFieldAR::F_IS_IN_MAIN_INFO => RequestData::customBoolean('is_in_main_info'), AdditionalFieldAR::F_IS_IN_TOP_INFO => RequestData::customBoolean('is_in_top'), AdditionalFieldAR::F_EXTERIOR => json_encode($exterior, JSON_THROW_ON_ERROR), AdditionalFieldAR::F_ADDITIONAL_PROPERTIES => json_encode($additionalProperties, JSON_THROW_ON_ERROR), AdditionalFieldAR::F_CATEGORIES => json_encode($categories, JSON_THROW_ON_ERROR), ] ); Html::location( '?' . BodyHtml::CORES_SECTION . '=' . BodyHtml::SECTION_SETTINGS_MAIN . '&action=' . self::A_ADDITIONAL_FIELD_EDIT . '&id=' . $id, Html::TYPE_MSG_SAVED ); } private static function mapTile(): string { OperatorAccess::verifyRight(OperatorAccess::RIGHT_SETTING); $content = ' 
            <a href="?core_section=settings_main&item_id=' . self::ITEM_4 . '"><i class="us-icon fa-chevron-left"></i>' . Lang::getPhrase( 1443 ) . '</a><br> 
            <br> 
            <span class="label_h2">' . MapTileAR::classCaption() . '</span> 
            <div class="div_space"> 
                <a id="linkAddId" href="?core_section=settings_main&action=map_tile_edit"><i class="us-icon fa-plus"></i>' . Lang::getPhrase( 841 ) . '</a> 
            </div> 
            <br>'; $data = []; $mapTiles = MapTileAR::find() ->orderBy( [ MapTileAR::F_POSITION => SORT_ASC, MapTileAR::F_NAME => SORT_ASC ] ) ->all(); foreach ($mapTiles as $mapTile) { if ($mapTile->getIsEnable() === true) { $caption = '<i class="us-icon us-icon-ok fa-check" title="' . Lang::getPhrase( 837 ) . '"></i>'; } else { $caption = '<i class="us-icon us-icon-danger fa-ban" title="' . Lang::getPhrase( 5744 ) . '"></i>'; } $caption .= '<a href="?core_section=settings_main&action=map_tile_edit&id=' . $mapTile->getId( ) . '" style="text-decoration: underline"><i class="us-icon us-icon-normal fa-globe"></i>' . $mapTile->getName( ) . '</a>'; $data[] = [ 'id' => $mapTile->getId(), 'caption' => $caption, 'is_use' => $mapTile->getIsEnable() === true ? 1 : 0 ]; } $content .= ' 
            <div class="info_block">' . Lang::getPhrase(4086) . '</div> 
            <span id="saveResultId"></span> 
            <div id="table_field_id"> 
                <ul id="div_sortable" onmouseup="mapTileReorder()">'; foreach ($data as $value) { $content .= ' 
                    <li class="ui-state-default div_sortable_class" id="' . $value['id'] . '"> 
                        <div style="position: relative;"> 
                            <div> 
                                ' . $value['caption'] . ' 
                            </div> 
                        </div> 
                    </li>'; } $content .= ' 
                </ul> 
            </div>         
        '; return $content; } private static function mainMenu(): string { OperatorAccess::verifyRight(OperatorAccess::RIGHT_SETTING); $content = ' 
            <a href="?core_section=settings_main&item_id=' . self::ITEM_4 . '"><i class="us-icon fa-chevron-left"></i>' . Lang::getPhrase( 1443 ) . '</a><br> 
            <br> 
            <span class="label_h2">' . Lang::getPhrase(5962) . '</span> 
            <br>'; $data = [ [ 'id' => BodyHtml::SECTION_DASHBOARD, 'caption' => Lang::getPhrase(499), ] ]; if (Central::$erpProfileChapters[ErpProfileDto::CHAPTER_CUSTOMER]) { $data[] = [ 'id' => BodyHtml::SECTION_CUSTOMER, 'caption' => CustomerAR::classCaption(), ]; } if (Central::$erpProfileChapters[ErpProfileDto::CHAPTER_TARIFF]) { $data[] = [ 'id' => BodyHtml::SECTION_TARIFF, 'caption' => TariffAR::classCaption(), ]; } if (Central::$erpProfileChapters[ErpProfileDto::CHAPTER_CUSTOMER_MSG]) { $data[] = [ 'id' => BodyHtml::SECTION_MESSAGE, 'caption' => Lang::getPhrase(603), ]; } if (Central::$erpProfileChapters[ErpProfileDto::CHAPTER_ACCOUNTANCY]) { $data[] = [ 'id' => BodyHtml::SECTION_ACCOUNTANCY, 'caption' => Lang::getPhrase(607), ]; } if (Central::$erpProfileChapters[ErpProfileDto::CHAPTER_INTERFACE]) { $data[] = [ 'id' => BodyHtml::SECTION_INTERFACE, 'caption' => Lang::getPhrase(622), ]; } if (Central::$erpProfileChapters[ErpProfileDto::CHAPTER_NODE]) { $data[] = [ 'id' => BodyHtml::SECTION_NODE, 'caption' => NodeAR::classCaption(), ]; } if (Central::$erpProfileChapters[ErpProfileDto::CHAPTER_CABLE_LINE]) { $data[] = [ 'id' => BodyHtml::SECTION_CABLE, 'caption' => Lang::getPhrase(5864), ]; } if (Central::$erpProfileChapters[ErpProfileDto::CHAPTER_DEVICE]) { $data[] = [ 'id' => BodyHtml::SECTION_DEVICE, 'caption' => DeviceAR::classCaption(), ]; } if (Central::$erpProfileChapters[ErpProfileDto::CHAPTER_TASK]) { $data[] = [ 'id' => BodyHtml::SECTION_TASK, 'caption' => Lang::getPhrase(636), ]; } if (Central::$erpProfileChapters[ErpProfileDto::CHAPTER_WAREHOUSE]) { $data[] = [ 'id' => BodyHtml::SECTION_INVENTORY, 'caption' => Lang::getPhrase(639), ]; } if (Central::$erpProfileChapters[ErpProfileDto::CHAPTER_MAP]) { $data[] = [ 'id' => BodyHtml::SECTION_MAP, 'caption' => Lang::getPhrase(647), ]; } $data[] = [ 'id' => BodyHtml::SECTION_EMPLOYEE, 'caption' => Lang::getPhrase(652), ]; if (Central::$erpProfileChapters[ErpProfileDto::CHAPTER_ADVERTISEMENT]) { $data[] = [ 'id' => BodyHtml::SECTION_ADVERT, 'caption' => AdvertisementAR::classCaption() ]; } if (Central::$erpProfileChapters[ErpProfileDto::CHAPTER_NOTEPAD]) { $data[] = [ 'id' => BodyHtml::SECTION_NOTEPAD, 'caption' => Lang::getPhrase(660), ]; } if (Central::$erpProfileChapters[ErpProfileDto::CHAPTER_STATISTICS]) { $data[] = [ 'id' => BodyHtml::SECTION_STATISTICS, 'caption' => Lang::getPhrase(662), ]; } $data[] = [ 'id' => BodyHtml::SECTION_OPERATOR, 'caption' => Lang::getPhrase(664), ]; $data[] = [ 'id' => BodyHtml::SECTION_SETTINGS, 'caption' => Lang::getPhrase(669), ]; $data[] = [ 'id' => '_SMS_BLOCK', 'caption' => Lang::getPhrase(1075), ]; $maxPosition = 0; foreach ($data as $i => $value) { ++$maxPosition; $data[$i]['position'] = $maxPosition; } $customPageArray = CustomPageCache::getDataCat(PageAR::CATEGORY_LEFT_MENU); if (isset($customPageArray[0])) { foreach ($customPageArray[0] as $value) { ++$maxPosition; $data[] = [ 'id' => '_PAGE_' . $value['id'], 'caption' => $value['name'], 'position' => $maxPosition ]; } } $array = BodyHtml::getMenuOrder(); foreach ($data as $i => $value) { if (isset($array[$value['id']])) { $data[$i]['position'] = $array[$value['id']]; } } $data = Central::sort($data, 'position'); $content .= ' 
            <div class="info_block">' . Lang::getPhrase(4086) . '</div> 
            <span id="saveResultId"></span> 
            <div id="table_field_id"> 
                <ul id="div_sortable" onmouseup="menuReorder()">'; foreach ($data as $value) { $content .= ' 
                    <li class="ui-state-default div_sortable_class" id="' . $value['id'] . '"> 
                        <div style="position: relative;"> 
                            <div> 
                                ' . $value['caption'] . ' 
                            </div> 
                        </div> 
                    </li>'; } $content .= ' 
                </ul> 
            </div> 
            <br>     
            <div class="div_space"> 
                <a id="linkMainMenuDefaultId" href="?core_section=settings_main&action=main_menu_save_position&data="><i class="us-icon fa-times"></i>' . Lang::getPhrase( 4029 ) . '</a> 
            </div>'; return $content; } private static function mapTileDelete(): void { OperatorAccess::verifyRight(OperatorAccess::RIGHT_SETTING); $id = RequestData::$id; $result = MapTileAR::findOne($id)->tryDelete(); if ($result === true) { Html::location('?core_section=settings_main&action=map_tile', Html::TYPE_MSG_UPDOK); } else { Html::locationBackCancel(); } } private static function mapTileSave(): void { OperatorAccess::verifyRight(OperatorAccess::RIGHT_SETTING); $id = RequestData::$id; $urlPattern = RequestData::customTrue('url_pattern'); $parentId = RequestData::customInt('parent_id'); if ($id < 1) { $isNew = true; $mapTile = MapTileAR::create(RequestData::custom('name'), $urlPattern); $id = $mapTile->getId(); } else { $isNew = false; $mapTile = MapTileAR::findOne($id); if (!$mapTile) { Html::location('?core_section=settings_main&action=map_tile', Html::TYPE_MSG_CANCEL); } } $mapTile->edit( [ MapTileAR::F_NAME => RequestData::custom('name'), MapTileAR::F_IS_ENABLE => RequestData::customBoolean('is_use'), MapTileAR::F_SUBDOMAINS => RequestData::custom('subdomains'), MapTileAR::F_PARENT_MAP_TILE_ID => $parentId, MapTileAR::F_MAX_ZOOM => RequestData::customInt('max_zoom'), MapTileAR::F_IS_TMS => RequestData::customBoolean('is_tms'), MapTileAR::F_COPYRIGHT => RequestData::customTrue('copyright'), MapTileAR::F_COORDINATE_SYSTEM => RequestData::custom('coord_system') ] ); if ($isNew === false) { EmployeeActionLogSystem::writeLog(EmployeeHistoryType::T533, MapTileAR::OBJECT_TYPE_ID, $id); } Html::location('?core_section=settings_main&action=map_tile_edit&id=' . $id, Html::TYPE_MSG_UPDOK); } private static function mainMenuSavePosition(): string { Html::$isEmptyTemplate = true; OperatorAccess::verifyRight(OperatorAccess::RIGHT_SETTING); $data = RequestData::custom('data'); SettingAR::setByName(SettingsCatalog::MAIN_MENU_ORDER, serialize($data)); if ('' == $data) { Html::locationBackOk(); } return '<span class="green_text"><b>Save!</b></span>'; } private static function mapTileSavePosition(): string { Html::$isEmptyTemplate = true; OperatorAccess::verifyRight(OperatorAccess::RIGHT_SETTING); $data = RequestData::custom('data'); $array = explode(',', $data); $count = 0; foreach ($array as $mapTileId) { ++$count; $mapTile = MapTileAR::findOne((int)($mapTileId)); if ($mapTile) { $mapTile->edit( [ MapTileAR::F_POSITION => $count ] ); } else { return '<span class="red_text"><b>Bad MapTileId: ' . $mapTileId . '!</b></span>'; } } return '<span class="green_text"><b>Save!</b></span>'; } private static function mapTileEdit(): string { OperatorAccess::verifyRight(OperatorAccess::RIGHT_SETTING); $id = RequestData::$id; if ($id > 0) { $mapTile = MapTileAR::findOne($id); if (!$mapTile) { Html::location('?core_section=settings_main&action=map_tile', Html::TYPE_MSG_CANCEL); } } else { $mapTile = new MapTileAR(); } $content = ' 
            <a href="?core_section=settings_main&action=map_tile"><i class="us-icon fa-chevron-left"></i>' . Lang::getPhrase( 1580 ) . '</a><br> 
            <br> 
            <span class="label_h2">' . MapTileAR::classCaption() . '</span> 
            <form method="post" name="form1" action=""> 
                <input type="hidden" name="core_section" value="settings_main"> 
                <input type="hidden" name="action" value="map_tile_save"> 
                <input type="hidden" name="id" value="' . $id . '"> 
                <div class="table_block"> 
                    <div class="item"> 
                        <div class="left_data"> 
    ' . Lang::getPhrase(1451) . ': 
                        </div> 
                        <div> 
                            <input name="name" type="text" size=30 maxlength=255 class="input_box" value=\'' . ($id > 0 ? $mapTile->getName( ) : '') . '\'> 
                        </div> 
                    </div> 
                    <div class="item"> 
                        <div class="left_data"> 
                            ' . Lang::getPhrase(837) . ': 
                        </div> 
                        <div> 
                            <input name="is_use" type="checkbox"'; if ($id < 1 || true === $mapTile->getIsEnable()) { $content .= ' checked'; } $content .= ' value="1"> 
                        </div> 
                    </div> 
                    <div class="item"> 
                        <div class="left_data"> 
                            ' . Lang::getPhrase(5363) . ' URL: 
                        </div> 
                        <div> 
                            <input name="url_pattern" type="text" size=80 class="input_box" value=\'' . ($id > 0 ? $mapTile->getUrlPattern( ) : '') . '\'><br> 
                            <i>{x} - tile lat<br> 
                            {y} - tile lon<br> 
                            {z} - zoom<br> 
                            {s} - subdomains<br> 
                            {BBOX_x1}<br> 
                            {BBOX_y1}<br> 
                            {BBOX_x2}<br> 
                            {BBOX_y2}<br> 
                            </i> 
                        </div> 
                    </div> 
                    <div class="item"> 
                        <div class="left_data"> 
                            ' . Lang::getPhrase(5745) . ':                             
                        </div> 
                        <div> 
                            <input name="subdomains" type="text" size=30 maxlength=255 class="input_box" value=\'' . ($id > 0 ? $mapTile->getSubdomains( ) : '') . '\'><br> 
                            <i>' . Lang::getPhrase(3530) . '</i> 
                        </div> 
                    </div> 
                    <div class="item"> 
                        <div class="left_data"> 
                            ' . Lang::getPhrase(5746) . ':                             
                        </div> 
                        <div> 
                            <input name="max_zoom" type="text" size=2 maxlength=2 class="input_box" value=\'' . ($id > 0 ? $mapTile->getMaxZoom( ) : '') . '\'> 
                        </div> 
                    </div> 
                    <div class="item"> 
                        <div class="left_data"> 
                            <a href="https://leafletjs.com/examples/wms/wms.html">TMS</a>: 
                        </div> 
                        <div> 
                            <input name="is_tms" type="checkbox"'; if ($id > 0 && true === $mapTile->getIsTms()) { $content .= ' checked'; } $content .= ' value="1"> 
                        </div> 
                    </div> 
                    <div class="item"> 
                        <div class="left_data"> 
                            ' . Lang::getPhrase(5747) . ': 
                        </div> 
                        <div> 
                            <select name="coord_system" size="1"> 
                                <option value="' . MapTileAR::COORDINATE_SYSTEM_EPSG3857 . '">EPSG3857</option> 
                                <option value="' . MapTileAR::COORDINATE_SYSTEM_EPSG3395 . '"'; if ($id > 0 && $mapTile->getCoordinateSystem() == MapTileAR::COORDINATE_SYSTEM_EPSG3395) { $content .= ' selected'; } $content .= '>EPSG3395</option> 
                                <option value="' . MapTileAR::COORDINATE_SYSTEM_BBOX . '"'; if ($id > 0 && $mapTile->getCoordinateSystem() == MapTileAR::COORDINATE_SYSTEM_BBOX) { $content .= ' selected'; } $content .= '>BBOX</option> 
                            <select> 
                        </div> 
                    </div> 
                    <div class="item"> 
                        <div class="left_data"> 
                            ' . Lang::getPhrase(5748) . ': 
                        </div> 
                        <div> 
                            <select name="parent_id" size="1"> 
                                <option value="0"></option>'; $mapTiles = MapTileAR::find() ->where( ['<>', 'id', $id] ) ->orderBy(MapTileAR::F_NAME) ->all(); foreach ($mapTiles as $mapTileTemp) { $content .= ' 
                                <option value="' . $mapTileTemp->getId() . '"'; if ($id > 0 && $mapTileTemp->getId() == $mapTile->getParentMapTileId()) { $content .= ' selected'; } $content .= '>' . $mapTileTemp->getName() . '</option>'; } $content .= ' 
                            <select> 
                        </div> 
                    </div> 
                    <div class="item"> 
                        <div class="left_data"> 
                            Copyright:                             
                        </div> 
                        <div> 
                            <textarea name="copyright" rows="10" cols="50">' . ($id > 0 ? $mapTile->getCopyright( ) : '') . '</textarea> 
                        </div> 
                    </div> 
                </div> 
                ' . BodyHtml::formButton('save_cancel', '?core_section=settings_main&action=map_tile') . ' 
            </form>'; if ($id > 0) { $content .= BodyHtml::linkDeleteObject( $id, '?core_section=settings_main&action=map_tile_delete&id=' . $id, '', '', '', MapTileAR::OBJECT_TYPE_ID, count(MapTileAR::findOne($id)->checkDelete()) ); } return $content; } private static function ajaxLoadAdditionalFieldList(): string { Html::$isEmptyTemplate = true; return '<span id="spanAjaxLoadListId"></span>' . self::additionalFieldList(true); } private static function additionalFieldList(bool $isAjaxLoad = false): string { if (Central::$isUSOnline === false) { OperatorAccess::verifyRight(OperatorAccess::RIGHT_SETTING); } $search = RequestData::getSearch(); $content = ''; if ($isAjaxLoad !== true) { $content = ' 
                <a href="?' . BodyHtml::CORES_SECTION . '=' . BodyHtml::SECTION_SETTINGS_MAIN . '&item_id=' . self::ITEM_18 . '"><i class="us-icon fa-chevron-left"></i>' . Lang::getPhrase( 1443 ) . '</a><br> 
                <br> 
                <span class="label_h2">' . Lang::getPhrase(6118) . '</span><br> 
                <br> 
                <div class="div_space"> 
                    <a id="linkAddId" href="?' . BodyHtml::CORES_SECTION . '=' . BodyHtml::SECTION_SETTINGS_MAIN . '&action=' . self::A_ADDITIONAL_FIELD_EDIT . '"><i class="us-icon fa-plus"></i>' . Lang::getPhrase( 841 ) . '</a> 
                </div> 
                '; $content .= ' 
                    <script> 
                        var URL_SEARCH_LOAD_LIST = "?' . BodyHtml::CORES_SECTION . '=' . BodyHtml::SECTION_SETTINGS_MAIN . '&action=' . self::A_AJAX_LOAD_ADDITIONAL_FIELD_LIST . '&search=";  
                    </script> 
                    <div id="usersearch"> 
                        <form autocomplete="off"> 
                            <input type="hidden" name="' . BodyHtml::CORES_SECTION . '" value="' . BodyHtml::SECTION_SETTINGS_MAIN . '"> 
                            <input type="hidden" name="action" value="' . self::A_ADDITIONAL_FIELD_LIST . '"> 
                            <input name="search" id="search_field_id" class="field" value="' . $search . '" type="text" onkeyup="dataSearchWait(this.value)"> 
                            <input name="" type="submit" id="buttonSubmitSearchFieldId" class="button" value=""> 
                        </form> 
                    </div> 
                    <div id="dataSearchResultId">'; } $fieldTypeCatalog = AdditionalFieldAR::catalogFieldType(); $useArray = []; $additionalFieldValuesDto = Yii::$container ->get(AdditionalFieldValueFetcher::class) ->getByCondition( condition: [], selectFields: [ 'id' => AdditionalFieldValueDto::F_ADDITIONAL_FIELD_ID, 'counter' => 'COUNT(*)' ], groupBy: AdditionalFieldValueDto::F_ADDITIONAL_FIELD_ID ); foreach ($additionalFieldValuesDto as $additionalFieldValueDto) { $useArray[$additionalFieldValueDto->id] = $additionalFieldValueDto->counter; } if ($search !== '') { $condition = ['ILIKE', AdditionalFieldAR::F_NAME, $search]; } else { $condition = []; } $data = AdditionalFieldAR::find() ->select( [ 'id' => AdditionalFieldAR::F_ID, 'name' => AdditionalFieldAR::F_NAME, 'field_type' => AdditionalFieldAR::F_FIELD_TYPE, ] ) ->where($condition) ->asArray() ->all(); foreach ($data as $i => $value) { $data[$i]['field_type_name'] = $fieldTypeCatalog[$value['field_type']]; $data[$i]['counter'] = $useArray[$value['id']] ?? 0; } $field = [ [ 'SPECIAL' => '_number' ], [ 'NAME' => Lang::getPhrase(1451), 'ISSORT' => 1, 'ISSORTABC' => 1, 'EL' => 'name' ], [ 'NAME' => Lang::getPhrase(1124), 'ISSORT' => 1, 'ISSORTABC' => 1, 'EL' => 'field_type_name' ], [ 'NAME' => Lang::getPhrase(1129), 'ALIGN' => 'right', 'ISSORT' => 1, 'CONVERT' => 'floor2', 'EL' => 'counter' ] ]; $table = new Table(); $table->link = '?' . BodyHtml::CORES_SECTION . '=' . BodyHtml::SECTION_SETTINGS_MAIN . '&action=' . self::A_ADDITIONAL_FIELD_EDIT . '&id='; $table->sortDefault = 'name'; $table->isSortDefaultAbc = 1; if (true === $isAjaxLoad) { $table->ajaxBodyDivId = 'dataSearchResultId'; } $content .= $table->show($data, $field); if (true !== $isAjaxLoad) { $content .= ' 
                </div>'; } return $content; } private static function deviceProfileDelete(): void { OperatorAccess::verifyRight(OperatorAccess::RIGHT_SETTING); $id = RequestData::$id; DeviceSnmpProfileAR::findOne($id)->remove(); Html::location('?core_section=settings_main&action=device_profile', 'updok'); } private static function deviceProfileSave(): void { OperatorAccess::verifyRight(OperatorAccess::RIGHT_SETTING); $id = RequestData::$id; if ($id < 1) { $deviceProfile = DeviceSnmpProfileAR::create(RequestData::custom('name')); $id = $deviceProfile->getId(); } else { $deviceProfile = DeviceSnmpProfileAR::findOne($id); } $argArray2 = @json_decode($deviceProfile->getProperties(), 1); if (!is_array($argArray2)) { $argArray2 = []; } $argArray = []; $tempCount = 0; foreach ($argArray2 as $j => $value) { $nameTemp4 = RequestData::custom('name_id_' . $j); $oidId = RequestData::custom('oid_id_' . $j); $doId = RequestData::customInt('do_id_' . $j); $nameTemp4 = str_replace('|', '_', $nameTemp4); $nameTemp4 = str_replace('*', '_', $nameTemp4); $nameTemp4 = str_replace('[', '_', $nameTemp4); $oidId = str_replace('|', '_', $oidId); $oidId = str_replace('*', '_', $oidId); $oidId = str_replace('[', '_', $oidId); if ('' != $nameTemp4) { ++$tempCount; $argArray[$tempCount] = [ 'ID' => $tempCount, 'NAME' => $nameTemp4, 'OID' => $oidId, 'DO' => $doId ]; } } for ($j = 1; $j <= 20; ++$j) { $nameTemp4 = RequestData::custom('name_new_' . $j); $oidId = RequestData::custom('oid_new_' . $j); $doId = RequestData::custom('do_new_' . $j); $nameTemp4 = str_replace('|', '_', $nameTemp4); $nameTemp4 = str_replace('*', '_', $nameTemp4); $nameTemp4 = str_replace('[', '_', $nameTemp4); $oidId = str_replace('|', '_', $oidId); $oidId = str_replace('*', '_', $oidId); $oidId = str_replace('[', '_', $oidId); if ('' != $nameTemp4) { ++$tempCount; $argArray[$tempCount] = [ 'ID' => $tempCount, 'NAME' => $nameTemp4, 'OID' => $oidId, 'DO' => $doId ]; } } $deviceProfile->edit( [ DeviceSnmpProfileAR::F_NAME => RequestData::custom('name'), DeviceSnmpProfileAR::F_IS_POLLING_PORT => RequestData::customBoolean('isport'), DeviceSnmpProfileAR::F_PROPERTIES => json_encode($argArray) ] ); Html::location('?core_section=settings_main&action=device_profile_dialog_edit&id=' . $id, 'updok'); } private static function deviceProfileDialogAddEdit(): string { OperatorAccess::verifyRight(OperatorAccess::RIGHT_SETTING); $id = RequestData::$id; $ret = '?core_section=settings_main&action=device_profile'; if ($id > 0) { $deviceProfile = DeviceSnmpProfileAR::findOne($id); } else { $deviceProfile = new DeviceSnmpProfileAR(); } $argProfile = @json_decode($deviceProfile->getProperties(), 1); if (!is_array($argProfile)) { $argProfile = []; } $content = ' 
            <a href="' . $ret . '"><i class="us-icon fa-chevron-left"></i>' . Lang::getPhrase( 893 ) . '</a><br> 
            <br> 
            <span class="label_h2">' . Lang::getPhrase(4247) . '</span><br> 
            <form method="post" name="form1" action=""> 
                <input type="hidden" name="core_section" value="settings_main"> 
                <input type="hidden" name="action" value="device_profile_save"> 
                <input type="hidden" name="id" value="' . $id . '"> 
                <div class="table_block"> 
                    <div class="item"> 
                        <div class="left_data"> 
                            ' . Lang::getPhrase(1451) . ': 
                        </div> 
                        <div> 
                            <input name="name" type="text" size=30 maxlength=255 class="input_box" value=\'' . ($id > 0 ? $deviceProfile->getName( ) : '') . '\'> 
                        </div> 
                    </div> 
                    <div class="item"> 
                        <div class="left_data"> 
                            ' . Lang::getPhrase(4249) . ': 
                        </div> 
                        <div> 
                            <input name="isport" type="checkbox"'; if ($id > 0 && true === $deviceProfile->getIsPollingPort()) { $content .= ' checked'; } $content .= ' value="1"> 
                        </div> 
                    </div> 
                </div> 
                <div class="label_h3_hr">' . Lang::getPhrase(4248) . '</div> 
                <div class="table_block">'; if (count($argProfile) > 0) { foreach ($argProfile as $i => $value) { if ( !isset($value['NAME']) && isset($value['NAZV']) ) { $value['NAME'] = $value['NAZV']; } $content .= ' 
                    <div class="item"> 
                        <div class="left_data"> 
                            ' . Lang::getPhrase(833) . ': 
                        </div> 
                        <div> 
                            <input name="name_id_' . $i . '" type="text" size=30 maxlength=255 class="input_box" value=\'' . $value['NAME'] . '\'> 
                        </div> 
                        <div class="left_data"> 
                            OID: 
                        </div> 
                        <div> 
                            <input name="oid_id_' . $i . '" type="text" size=30 maxlength=255 class="input_box" value=\'' . $value['OID'] . '\'> 
                        </div> 
                        <div class="left_data"> 
                            ' . Lang::getPhrase(2225) . ': 
                        </div> 
                        <div> 
                            <select name="do_id_' . $i . '" size="1"> 
                                <option value="0"></option> 
                                <option value="' . DeviceSnmpProfileAR::TYPE_1 . '"'; if (DeviceSnmpProfileAR::TYPE_1 == $value['DO']) { $content .= ' selected'; } $content .= '>* 0.1</option> 
                                <option value="' . DeviceSnmpProfileAR::TYPE_2 . '"'; if (DeviceSnmpProfileAR::TYPE_2 == $value['DO']) { $content .= ' selected'; } $content .= '>uptime</option> 
                                <option value="' . DeviceSnmpProfileAR::TYPE_3 . '"'; if (DeviceSnmpProfileAR::TYPE_3 == $value['DO']) { $content .= ' selected'; } $content .= '>1/0</option> 
                                <option value="' . DeviceSnmpProfileAR::TYPE_4 . '"'; if (DeviceSnmpProfileAR::TYPE_4 == $value['DO']) { $content .= ' selected'; } $content .= '>MAC</option> 
                                <option value="' . DeviceSnmpProfileAR::TYPE_5 . '"'; if (DeviceSnmpProfileAR::TYPE_5 == $value['DO']) { $content .= ' selected'; } $content .= '>* 0.01</option> 
                                <option value="' . DeviceSnmpProfileAR::TYPE_6 . '"'; if (DeviceSnmpProfileAR::TYPE_6 == $value['DO']) { $content .= ' selected'; } $content .= '>1/>1</option> 
                    <option value="' . DeviceSnmpProfileAR::TYPE_7 . '"'; if (DeviceSnmpProfileAR::TYPE_7 == $value['DO']) { $content .= ' selected'; } $content .= '>* 0.001</option> 
                            </select> 
                        </div> 
                    </div>'; } } for ($j = 1; $j <= 20; ++$j) { $content .= ' 
                    <div class="item"> 
                        <div class="left_data"> 
                            ' . Lang::getPhrase(833) . ': 
                        </div> 
                        <div> 
                            <input name="name_new_' . $j . '" type="text" size=30 maxlength=255 class="input_box" value=\'\'> 
                        </div> 
                        <div class="left_data"> 
                            OID: 
                        </div> 
                        <div> 
                            <input name="oid_new_' . $j . '" type="text" size=30 maxlength=255 class="input_box" value=\'\'> 
                        </div> 
                        <div class="left_data"> 
                            ' . Lang::getPhrase(2225) . ': 
                        </div> 
                        <div> 
                            <select name="do_new_' . $j . '" size="1"> 
                                <option value="0"></option> 
                                <option value="' . DeviceSnmpProfileAR::TYPE_1 . '">* 0.1</option> 
                                <option value="' . DeviceSnmpProfileAR::TYPE_2 . '">uptime</option> 
                                <option value="' . DeviceSnmpProfileAR::TYPE_3 . '">1/0</option> 
                                <option value="' . DeviceSnmpProfileAR::TYPE_4 . '">MAC</option> 
                                <option value="' . DeviceSnmpProfileAR::TYPE_5 . '">* 0.01</option> 
                                <option value="' . DeviceSnmpProfileAR::TYPE_6 . '">1/>1</option> 
                            </select> 
                        </div> 
                    </div>'; } $content .= ' 
                </div> 
                ' . BodyHtml::formButton('save_cancel', $ret) . ' 
            </form>'; if ($id > 0) { $content .= ' ' . BodyHtml::linkConfirm( '?core_section=settings_main&action=device_profile_delete&id=' . $id, Lang::getPhrase(1415), Lang::getPhrase(1150) . '?', '<i class="us-icon us-icon-danger fa-close"></i>' . Lang::getPhrase(1415) , 'linkConfirmDeleteProfileId' ); } return $content; } private static function deviceProfile(): string { OperatorAccess::verifyRight(OperatorAccess::RIGHT_SETTING); $content = ' 
            <a href="?core_section=settings_main&item_id=' . self::ITEM_7 . '"><i class="us-icon fa-chevron-left"></i>' . Lang::getPhrase( 1443 ) . '</a><br> 
            <div class="label_h2">' . Lang::getPhrase(4247) . '</div> 
            <div class="div_space"> 
                <a id="linkAddId" href="?core_section=settings_main&action=device_profile_dialog_add"><i class="us-icon fa-plus"></i>' . Lang::getPhrase( 841 ) . '</a> 
            </div>'; $data = []; $deviceProfiles = DeviceSnmpProfileAR::find()->all(); foreach ($deviceProfiles as $deviceProfile) { $data[$deviceProfile->getId()] = [ 'id' => $deviceProfile->getId(), 'name' => $deviceProfile->getName() ]; } $field = [ [ 'SPECIAL' => '_number' ], [ 'NAME' => Lang::getPhrase(1451), 'ISSORT' => 1, 'ISSORTABC' => 1, 'EL' => 'name' ] ]; $table = new Table(); $table->link = '?core_section=settings_main&action=device_profile_dialog_edit&id='; $table->sortDefault = 'name'; $table->isSortDefaultAbc = 1; $content .= $table->show($data, $field); return $content; } private static function deleteNodeTypeGroup(): void { OperatorAccess::verifyRight(OperatorAccess::RIGHT_SETTING); $uuid = RequestData::$uuid; if (false === NodeTypeGroupSystem::tryDelete($uuid)) { Html::locationBackCancel(); } else { Html::location( '?' . BodyHtml::CORES_SECTION . '=' . BodyHtml::SECTION_SETTINGS_MAIN . '&action=' . self::A_NODE_TYPE_GROUPS, Html::TYPE_MSG_DELETED ); } } private static function nodeTypeDelete(): void { if (Central::$isUSOnline === false) { OperatorAccess::verifyRight(OperatorAccess::RIGHT_SETTING); } $id = RequestData::$id; if ( Central::$isUSOnline === true && NodeTypeAR::findOne($id)->getAuthorEmployeeId() != Html::$currentEmployeeId ) { Html::locationForbidden(); } if (false === NodeTypeAR::findOne($id)->tryDelete()) { Html::locationBackCancel(); } else { Html::location( '?core_section=' . BodyHtml::SECTION_SETTINGS_MAIN . '&action=' . self::A_NODE_TYPES, Html::TYPE_MSG_UPDOK ); } } private static function nodeTypeSetDefaultCardExteriorField(): void { if (Central::$isUSOnline === false) { OperatorAccess::verifyRight(OperatorAccess::RIGHT_SETTING); } $id = RequestData::$id; $nodeType = NodeTypeAR::findOne($id); if ( Central::$isUSOnline === true && $nodeType->getAuthorEmployeeId() != Html::$currentEmployeeId ) { Html::locationForbidden(); } $nodeType->edit( [ NodeTypeAR::F_CARD_EXTERIOR => '' ] ); Html::locationBackOk(); } private static function nodeTypeSave(): void { if (Central::$isUSOnline === false) { OperatorAccess::verifyRight(OperatorAccess::RIGHT_SETTING); } $id = RequestData::$id; if ($id < 1) { $nodeType = NodeTypeAR::create(RequestData::custom('name')); $id = $nodeType->getId(); } else { $nodeType = NodeTypeAR::findOne($id); } if (!$nodeType) { Html::locationCancel(); } if ( Central::$isUSOnline === true && $nodeType->getAuthorEmployeeId() != Html::$currentEmployeeId ) { Html::locationForbidden(); } NodeTypeAdditionalFieldAR::removeByNodeTypeId($id); $styleArray = [ 'template' => RequestData::customInt('style_template'), 'opation' => RequestData::customInt('style_opation'), 'color' => RequestData::customColor('style_color'), 'color_plan' => RequestData::customColor('style_color_plan'), 'stroke_color' => RequestData::customColor('style_stroke_color'), 'stroke_color_plan' => RequestData::customColor('style_stroke_color_plan'), 'ico' => RequestData::customTrue('style_ico'), 'ico_plan' => RequestData::customTrue('style_ico_plan'), 'z' => RequestData::customInt('style_z'), 'size' => round(RequestData::custom('style_size'), 6) ]; $bundle = [ NodeTypeAR::F_NAME => RequestData::custom('name'), NodeTypeAR::F_POSITION => RequestData::customInt('position'), NodeTypeAR::F_DEFAULT_OWNER_ID => RequestData::customInt('default_owner_id'), NodeTypeAR::F_IS_CAN_PARENT => RequestData::customBoolean('is_can_parent'), NodeTypeAR::F_IS_LAYER_ON_MAP => RequestData::customBoolean('is_layer_on_map'), NodeTypeAR::F_IS_COMMUTATION => RequestData::customBoolean('is_commutation'), NodeTypeAR::F_IS_INSTALL_DEVICE => RequestData::customBoolean('is_install_device'), NodeTypeAR::F_STYLE => json_encode($styleArray, JSON_THROW_ON_ERROR), NodeTypeAR::F_CARD_EXTERIOR => BodyHtml::interfaceCardExteriorFieldsListRequestData(), NodeTypeAR::F_NODE_TYPE_GROUP_ID => RequestData::custom('node_type_group_id'), ]; if (NodeTypeCache::getPatternName($id) != RequestData::customTrue('pattern_name')) { $bundle[NodeTypeAR::F_PATTERN_NAME] = RequestData::customTrue('pattern_name'); } if (NodeTypeCache::getSingleName($id) != RequestData::customTrue('single_name')) { $bundle[NodeTypeAR::F_SINGLE_NAME] = RequestData::customTrue('single_name'); } $nodeType->edit($bundle); if (isset($_REQUEST['fields'])) { $fields = $_REQUEST['fields']; foreach ($fields as $value) { NodeTypeAdditionalFieldAR::create($id, $value); } } if (OperatorAccess::isAccess(OperatorAccess::RIGHT_OPERATOR) == 1) { EmployeeProfilesNodeTypesSystem::removeByNodeTypeId($id); $tempArray = []; if (isset($_REQUEST['operator_profile_access_write'])) { foreach ($_REQUEST['operator_profile_access_write'] as $operatorProfileId) { $tempArray[$operatorProfileId] = [ 'is_access_read' => true, 'is_access_write' => true ]; } } if (isset($_REQUEST['operator_profile_access_read'])) { foreach ($_REQUEST['operator_profile_access_read'] as $operatorProfileId) { if (!isset($tempArray[$operatorProfileId])) { $tempArray[$operatorProfileId] = [ 'is_access_read' => true, 'is_access_write' => false ]; } else { $tempArray[$operatorProfileId]['is_access_read'] = true; } } } foreach ($tempArray as $operatorProfileId => $value) { EmployeeProfilesNodeTypesSystem::create( $id, $operatorProfileId, $value['is_access_write'], $value['is_access_read'] ); } } EmployeeActionLogSystem::writeLog(EmployeeHistoryType::T545, NodeTypeAR::OBJECT_TYPE_ID, $id); Html::location( '?core_section=' . BodyHtml::SECTION_SETTINGS_MAIN . '&action=' . self::A_NODE_TYPE_ADD_EDIT . '&id=' . $id, Html::TYPE_MSG_UPDOK ); } private static function saveNodeTypeGroup(): void { OperatorAccess::verifyRight(OperatorAccess::RIGHT_SETTING); $uuid = RequestData::$uuid; $name = RequestData::custom('name'); $position = RequestData::customInt('position'); if ($uuid === '') { $uuid = NodeTypeGroupSystem::create( name: $name, position: $position ); } else { NodeTypeGroupSystem::edit( uuid: $uuid, bundle: [ NodeTypeGroupDto::F_NAME => $name, NodeTypeGroupDto::F_POSITION => $position, ] ); } Html::locationBackOk(); } private static function dialogNodeTypeGroup(): string { OperatorAccess::verifyRight(OperatorAccess::RIGHT_SETTING); Html::$pageId = 141; $uuid = RequestData::$uuid; if ($uuid !== '') { $nodeTypeGroupDto = Yii::$container ->get(NodeTypeGroupFetcher::class) ->getOneByCondition( [ NodeTypeGroupDto::F_ID => $uuid ] ); if (!$nodeTypeGroupDto) { Html::locationCancel(); } $ret = '?' . BodyHtml::CORES_SECTION . '=' . BodyHtml::SECTION_SETTINGS_MAIN . '&action=' . self::A_NODE_TYPE_GROUPS; $content = ' 
                <a href="' . $ret . '"><i class="us-icon fa-chevron-left"></i>' . Lang::getPhrase( 1580 ) . '</a><br> 
                <div class="label_h2">' . NodeTypeGroupSystem::classCaption() . '</div>'; } else { Html::$isEmptyTemplate = true; $ret = ''; $content = ' 
                <div class="dialog_header"><span id="spanDialogNodeTypeGroupId">' . Lang::getPhrase( 3865 ) . '</span></div> 
                <br>'; } $content .= ' 
            <form method="post" name="form1" action=""> 
                <input type="hidden" name="core_section" value="' . BodyHtml::SECTION_SETTINGS_MAIN . '"> 
                <input type="hidden" name="action" value="' . self::A_SAVE_NODE_TYPE_GROUP . '"> 
                <input type="hidden" name="uuid" value="' . $uuid . '">             
                <div class="table_block"> 
                    <div class="item"> 
                        <div class="left_data"> 
                            ' . Lang::getPhrase(1451) . ': 
                        </div> 
                        <div> 
                            <input name="name" type="text" size=30 maxlength=255 class="input_box" value=\'' . ($uuid !== '' ? NodeTypeGroupCache::getName( $uuid ) : '') . '\'> 
                        </div> 
                    </div> 
                    <div class="item"> 
                        <div class="left_data"> 
                            ' . Lang::getPhrase(3836) . ': 
                        </div> 
                        <div> 
                            <input name="position" type="text" size=5 maxlength=5 class="input_box" value=\'' . ($uuid !== '' ? $nodeTypeGroupDto->position : '') . '\'> 
                        </div> 
                    </div> 
                </div> 
                ' . BodyHtml::formButton('save_cancel', $ret) . ' 
            </form>'; if ($uuid !== '') { $content .= BodyHtml::linkDeleteObject( id: null, linkDelete: '?' . BodyHtml::CORES_SECTION . '=' . BodyHtml::SECTION_SETTINGS_MAIN . '&action=' . self::A_DELETE_NODE_TYPE_GROUP . '&uuid=' . $uuid, objectTypeId: NodeTypeGroupDto::OBJECT_TYPE_ID, checkCountDelete: count(NodeTypeGroupSystem::checkDelete($uuid)), uuid: $uuid ); } return $content; } private static function nodeTypeAddEdit(): string { if (Central::$isUSOnline === false) { OperatorAccess::verifyRight(OperatorAccess::RIGHT_SETTING); } Html::$pageId = 141; $id = RequestData::$id; if ($id > 0) { $nodeType = NodeTypeAR::findOne($id); if (!$nodeType) { Html::locationCancel(); } if ( Central::$isUSOnline === true && $nodeType->getAuthorEmployeeId() != Html::$currentEmployeeId ) { Html::locationForbidden(); } } else { $nodeType = new NodeTypeAR(); } $ret = '?core_section=' . BodyHtml::SECTION_SETTINGS_MAIN . '&action=' . self::A_NODE_TYPES; $content = ' 
            <a href="' . $ret . '"><i class="us-icon fa-chevron-left"></i>' . Lang::getPhrase( 1443 ) . '</a><br> 
            <div class="label_h2">' . NodeAR::classCaption() . '</div> 
            <script src="../main/js/icolorpicker.js?t=' . time() . '"></script> 
            <form method="post" name="form1" action=""> 
                <input type="hidden" name="core_section" value="' . BodyHtml::SECTION_SETTINGS_MAIN . '"> 
                <input type="hidden" name="action" value="' . self::A_NODE_TYPE_SAVE . '"> 
                <input type="hidden" name="id" value="' . $id . '">             
                <div class="table_block"> 
                    <div class="item"> 
                        <div class="left_data"> 
                            ' . Lang::getPhrase(1451) . ': 
                        </div> 
                        <div>'; $content .= ' 
                            <input name="name" type="text" size=30 maxlength=255 class="input_box" value="' . ($id > 0 ? NodeTypeCache::getName( $id ) : '') . '">'; $content .= ' 
                        </div> 
                    </div>'; $content .= ' 
                    <div class="item"> 
                        <div class="left_data"> 
                            ' . Lang::getPhrase(5777) . ': 
                        </div> 
                        <div> 
                            <input name="single_name" type="text" size=30 maxlength=255 class="input_box" value="' . ($id > 0 ? NodeTypeCache::getSingleName( $id ) : '') . '"> 
                        </div> 
                    </div> 
                    <div class="item"> 
                        <div class="left_data"> 
                            ' . NodeTypeGroupSystem::classCaptionSingle() . ': 
                        </div> 
                        <div> 
                            <select name="node_type_group_id" size="1"> 
                                <option value="0"></option>'; $nodeTypeGroupsDto = Yii::$container ->get(NodeTypeGroupFetcher::class) ->getByCondition(); foreach ($nodeTypeGroupsDto as $nodeTypeGroupDto) { $content .= ' 
                                <option value="' . $nodeTypeGroupDto->id . '"'; if ( $id > 0 && $nodeTypeGroupDto->id === $nodeType->getNodeTypeGroupId() ) { $content .= ' selected'; } $content .= '>' . NodeTypeGroupCache::getName($nodeTypeGroupDto->id) . '</option>'; } $content .= ' 
                            </select> 
                        </div> 
                    </div> 
                    <div class="item"> 
                        <div class="left_data"> 
                            ' . Lang::getPhrase(3836) . ': 
                        </div> 
                        <div> 
                            <input name="position" type="text" size=5 maxlength=5 class="input_box" value=\'' . ($id > 0 ? $nodeType->getPosition( ) : '') . '\'> 
                        </div> 
                    </div> 
                    <div class="item"> 
                        <div class="left_data"> 
                            ' . Lang::getPhrase(5778) . ':<br> 
                            <i>(' . Lang::getPhrase(5779) . ')</i> 
                        </div> 
                        <div> 
                            <input name="is_can_parent" type="checkbox" value="1"'; if ($id > 0 && $nodeType->getIsCanParent() === true) { $content .= ' checked'; } $content .= '> 
                        </div> 
                    </div> 
                    <div class="item"> 
                        <div class="left_data"> 
                            ' . Lang::getPhrase(5452) . ':<br> 
                            <i>(TWIG)<br> 
                            ' . Lang::getPhrase( 740 ) . ':<br> {{ ' . NodeTypeAR::PATTERN_NAME_LOCATION_FULL . ' }}{% if ' . NodeTypeAR::PATTERN_NAME_NUMBER . ' %}, #{{ ' . NodeTypeAR::PATTERN_NAME_NUMBER . ' }} {% endif %}</i> 
                        </div> 
                        <div> 
                            <input name="pattern_name" type="text" size=50 maxlength=255 class="input_box" value=\'' . ($id > 0 ? NodeTypeCache::getPatternName( $id ) : '') . '\'><br> 
                            <div class="div_space"> 
                                {{ ' . NodeTypeAR::PATTERN_NAME_ADDRESS_NAME . ' }} - ' . Lang::getPhrase( 1186 ) . '<br> 
                                {{ ' . NodeTypeAR::PATTERN_NAME_BUILDING_ENTRANCE . ' }} - ' . Lang::getPhrase( 3261 ) . '<br> 
                                {{ ' . NodeTypeAR::PATTERN_NAME_BUILDING_LEVEL_NAME . ' }} - ' . Lang::getPhrase( 3262 ) . '<br> 
                                {{ ' . NodeTypeAR::PATTERN_NAME_LOCATION . ' }} - ' . Lang::getPhrase( 2069 ) . '<br> 
                                {{ ' . NodeTypeAR::PATTERN_NAME_LOCATION_FULL . ' }} - ' . Lang::getPhrase( 2069 ) . ' <i>(' . Lang::getPhrase( 1186 ) . ', ' . Lang::getPhrase(2069) . ', ' . Lang::getPhrase(3262) . '...)</i><br> 
                                {{ ' . NodeTypeAR::PATTERN_NAME_NUMBER . ' }} - ' . Lang::getPhrase(875) . '<br> 
                                {{ ' . NodeTypeAR::PATTERN_NAME_TYPE_NAME . ' }} - ' . Lang::getPhrase(863) . ' 
                            </div> 
                        </div> 
                    </div> 
                    <div class="item"> 
                        <div class="left_data"> 
                            ' . Lang::getPhrase(6163) . ':<br> 
                            <span class="info_block">(' . Lang::getPhrase(740) . ')</span> 
                        </div> 
                        <div> 
                            <select name="default_owner_id" size="1"> 
                                <option value="0"></option>'; $owners = OwnerAR::getWithAddressVerify([], [], 0, 0, 'o.' . OwnerAR::F_NAME, false, false); foreach ($owners as $owner) { $content .= ' 
                                <option value="' . $owner->getId() . '"'; if ( $id > 0 && $owner->getId() === $nodeType->getDefaultOwnerId() ) { $content .= ' selected'; } $content .= '>' . OwnerCache::getName($owner->getId()) . '</option>'; } $content .= ' 
                            </select> 
                        </div> 
                    </div> 
                    <div class="item"> 
                        <div class="left_data"> 
                            ' . Lang::getPhrase(5984) . ': 
                        </div> 
                        <div> 
                            <input name="is_install_device" type="checkbox" value="1"'; if ($id > 0 && $nodeType->getIsInstallDevice() === true) { $content .= ' checked'; } $content .= '> 
                        </div> 
                    </div> 
                    <div class="item"> 
                        <div class="left_data"> 
                            ' . Lang::getPhrase(5804) . ': 
                        </div> 
                        <div> 
                            <input name="is_commutation" type="checkbox" value="1"'; if ($id > 0 && $nodeType->getIsCommutation() === true) { $content .= ' checked'; } $content .= '> 
                        </div> 
                    </div> 
                    <div class="item"> 
                        <div class="left_data"> 
                            ' . Lang::getPhrase(3809) . ': 
                        </div> 
                        <div>'; $usedField = []; if ($id > 0) { $nodeTypeAdditionalFields = NodeTypeAdditionalFieldAR::find() ->where( [ NodeTypeAdditionalFieldAR::F_NODE_TYPE_ID => $nodeType->getId() ] ) ->all(); foreach ($nodeTypeAdditionalFields as $nodeTypeAdditionalField) { $additionalDataConfig = AdditionalFieldAR::findOne($nodeTypeAdditionalField->getAdditionalFieldId()); if ( Central::$isUSOnline === false || $additionalDataConfig->getAuthorEmployeeId() == Html::$currentEmployeeId ) { $usedField[$nodeTypeAdditionalField->getAdditionalFieldId()] = true; } } } $expr = ''; if (Central::$isUSOnline === true) { $expr = [ AdditionalFieldAR::F_AUTHOR_EMPLOYEE_ID => Html::$currentEmployeeId ]; } $additionalDataConfigs = AdditionalFieldAR::find() ->where(AdditionalFieldAR::F_CATEGORIES . " @> '[\"" . AdditionalFieldAR::CATEGORY_NODE . "\"]'") ->andWhere($expr) ->orderBy(AdditionalFieldAR::F_NAME) ->all(); foreach ($additionalDataConfigs as $additionalDataConfig) { $content .= ' 
                            <div class="div_space"> 
                                <input type="checkbox"'; if (isset($usedField[$additionalDataConfig->getId()])) { $content .= ' checked'; } $content .= ' name="fields[]" value="' . $additionalDataConfig->getId( ) . '"> ' . $additionalDataConfig->getName() . ' 
                            </div>'; } $content .= ' 
                        </div> 
                    </div> 
                </div>'; $style = $nodeType->getStyle(); $content .= ' 
                <span class="label_h2">' . Lang::getPhrase(729) . '</span> 
                <div class="table_block"> 
                    <div class="item"> 
                        <div class="left_data"> 
                            ' . Lang::getPhrase(5330) . ': 
                        </div> 
                        <div> 
                            <input name="is_layer_on_map" type="checkbox" value="1"'; if ($id > 0 && $nodeType->getIsLayerOnMap() === true) { $content .= ' checked'; } $content .= '> 
                        </div> 
                    </div> 
                    <div class="item"> 
                        <div class="left_data"> 
                            ' . Lang::getPhrase(5801) . ':<br> 
                            <i>(' . Lang::getPhrase(5802) . ')</i> 
                        </div> 
                        <div> 
                            <input name="style_z" type="text" size=5 maxlength=3 class="input_box" value="' . $style['z'] . '">  
                            <i>(' . Lang::getPhrase(5803) . ')</i> 
                        </div> 
                    </div>                 
                    <div class="item"> 
                        <div class="left_data"> 
                            ' . Lang::getPhrase(5363) . ': 
                        </div> 
                        <div> 
                            <select id="styleTemplateId" name="style_template" size="1" onchange="changeStyleTemplate(' . NodeTypeAR::STYLE_TEMPLATE_IMAGE . ',' . NodeTypeAR::STYLE_TEMPLATE_CIRCLE . ')"> 
                                <option value="' . NodeTypeAR::STYLE_TEMPLATE_TRIANGLE . '"'; if ($style['template'] == NodeTypeAR::STYLE_TEMPLATE_TRIANGLE) { $content .= " selected"; } $content .= '>' . Lang::getPhrase( 5798 ) . '</option> 
                                <option value="' . NodeTypeAR::STYLE_TEMPLATE_SQUARE . '"'; if ($style['template'] == NodeTypeAR::STYLE_TEMPLATE_SQUARE) { $content .= " selected"; } $content .= '>' . Lang::getPhrase( 5924 ) . '</option> 
                                <option value="' . NodeTypeAR::STYLE_TEMPLATE_RHOMBUS . '"'; if ($style['template'] == NodeTypeAR::STYLE_TEMPLATE_RHOMBUS) { $content .= " selected"; } $content .= '>' . Lang::getPhrase( 5925 ) . '</option> 
                                <option value="' . NodeTypeAR::STYLE_TEMPLATE_CIRCLE . '"'; if ($style['template'] == NodeTypeAR::STYLE_TEMPLATE_CIRCLE) { $content .= " selected"; } $content .= '>' . Lang::getPhrase( 5799 ) . '</option> 
                                <option value="' . NodeTypeAR::STYLE_TEMPLATE_IMAGE . '"'; if ($style['template'] == NodeTypeAR::STYLE_TEMPLATE_IMAGE) { $content .= " selected"; } $content .= '>' . Lang::getPhrase( 4335 ) . '</option> 
                            </select>         
                        </div> 
                    </div> 
                    <div class="item" id="divSizeId"> 
                        <div class="left_data"> 
                            ' . Lang::getPhrase(5376) . ': 
                        </div> 
                        <div> 
                            <input id="sizeId" name="style_size" type="text" size=3 maxlength=5 class="input_box" value="' . $style['size'] . '"> x 
                        </div> 
                    </div> 
                    <div class="item" id="divColorId"> 
                        <div class="left_data"> 
                            ' . Lang::getPhrase(5250) . ': 
                        </div> 
                        <div> 
                            <input id="colorId" name="style_color" type="text" size=8 maxlength=7 class="input_box iColorPicker" value="' . $style['color'] . '"> 
                            / 
                            <input id="strokeColorId" name="style_stroke_color" type="text" size=8 maxlength=7 class="input_box iColorPicker" value="' . $style['stroke_color'] . '"> 
                        </div> 
                    </div> 
                    <div class="item" id="divColorPlanId"> 
                        <div class="left_data"> 
                            ' . Lang::getPhrase(5250) . ' (' . Lang::getPhrase( 5253 ) . '): 
                        </div> 
                        <div> 
                            <input id="colorPlanId" name="style_color_plan" type="text" size=8 maxlength=7 class="input_box iColorPicker" value="' . $style['color_plan'] . '"> 
                            / 
                            <input id="strokeColorPlanId" name="style_stroke_color_plan" type="text" size=8 maxlength=7 class="input_box iColorPicker" value="' . $style['stroke_color_plan'] . '"> 
                        </div> 
                    </div> 
                    <div class="item" id="divOpationId"> 
                        <div class="left_data"> 
                            ' . Lang::getPhrase(5930) . ': 
                        </div> 
                        <div> 
                            <input id="opationId" name="style_opation" type="text" size=3 maxlength=3 class="input_box" value="' . $style['opation'] . '"> % 
                        </div> 
                    </div> 
                    <div class="item" id="divIcoId"> 
                        <div class="left_data"> 
                            ' . Lang::getPhrase(5800) . ':<br> 
                            <i>(URL)</i> 
                        </div> 
                        <div> 
                            <input name="style_ico" type="text" size=40 maxlength=255 class="input_box" value="' . $style['ico'] . '"> 
                        </div> 
                    </div> 
                    <div class="item" id="divIcoPlanId"> 
                        <div class="left_data"> 
                            ' . Lang::getPhrase(5800) . ' (' . Lang::getPhrase( 5253 ) . '):<br> 
                            <i>(URL)</i> 
                        </div> 
                        <div> 
                            <input name="style_ico_plan" type="text" size=40 maxlength=255 class="input_box" value="' . $style['ico_plan'] . '"> 
                        </div> 
                    </div> 
                    <script> 
                        changeStyleTemplate(' . NodeTypeAR::STYLE_TEMPLATE_IMAGE . ',' . NodeTypeAR::STYLE_TEMPLATE_CIRCLE . '); 
                    </script> 
                </div>'; if ($id > 0) { $tempExterior = $nodeType->getCardExterior(); } else { $tempExterior = []; } $content .= BodyHtml::interfaceCardExteriorFieldsListEdit( AdditionalFieldAR::CATEGORY_NODE, $tempExterior, NodeHtml::cardFieldDefaultCatalog(), '?core_section=' . BodyHtml::SECTION_SETTINGS_MAIN . '&action=' . self::A_NODE_TYPE_SET_DEFAULT_CARD_EXTERIOR_FIELD . '&id=' . $id ); if ( $id > 0 && OperatorAccess::isAccess(OperatorAccess::RIGHT_OPERATOR) == 1 ) { $currentArrayRights = []; $employeeProfilesNodeTypesDtos = Yii::$container ->get(EmployeeProfilesNodeTypesFetcher::class) ->getByCondition( [ EmployeeProfilesNodeTypesDto::F_NODE_TYPE_ID => $nodeType->getId() ] ); foreach ($employeeProfilesNodeTypesDtos as $employeeProfilesNodeTypesDto) { $currentArrayRights[$employeeProfilesNodeTypesDto->employee_profile_id] = [ 'is_access_read' => $employeeProfilesNodeTypesDto->is_access_read, 'is_access_write' => $employeeProfilesNodeTypesDto->is_access_write ]; } $content .= ' 
                <span class="label_h2">' . Lang::getPhrase(1132) . '</span> 
                <div class="table_block"> 
                    <div class="item" style="text-align: center"> 
                        <div class="left_data"> 
                        </div> 
                        <div> 
                            ' . Lang::getPhrase(840) . ' 
                        </div> 
                        <div> 
                            ' . Lang::getPhrase(2390) . ' 
                        </div> 
                    </div>'; $operatorProfiles = EmployeeProfileAR::find() ->orderBy(EmployeeProfileAR::F_NAME) ->all(); foreach ($operatorProfiles as $operatorProfile) { $content .= ' 
                    <div class="item"> 
                        <div class="left_data"> 
                            ' . EmployeeProfileCache::getName($operatorProfile->getId()) . ' 
                        </div> 
                        <div class="div_center"> 
                            <input name="operator_profile_access_read[]" type="checkbox"'; if (isset( $currentArrayRights[$operatorProfile->getId()]['is_access_read'] ) && true === $currentArrayRights[$operatorProfile->getId()]['is_access_read']) { $content .= ' checked'; } $content .= ' value=' . $operatorProfile->getId() . '>                                         
                        </div> 
                        <div class="div_center"> 
                            <input name="operator_profile_access_write[]" type="checkbox"'; if (isset( $currentArrayRights[$operatorProfile->getId()]['is_access_write'] ) && true === $currentArrayRights[$operatorProfile->getId()]['is_access_write']) { $content .= ' checked'; } $content .= ' value=' . $operatorProfile->getId() . '>                                         
                        </div> 
                    </div>'; } $content .= ' 
                </div>'; } $content .= ' 
                ' . BodyHtml::formButton('save_cancel', $ret) . ' 
            </form>'; if ($id > 0) { $content .= BodyHtml::linkDeleteObject( $id, '?core_section=' . BodyHtml::SECTION_SETTINGS_MAIN . '&action=' . self::A_NODE_TYPE_DELETE . '&id=' . $id, '', '', '', NodeTypeAR::OBJECT_TYPE_ID, count(NodeTypeAR::findOne($id)->checkDelete()) ); } return $content; } private static function nodeTypeGroups(): string { OperatorAccess::verifyRight(OperatorAccess::RIGHT_SETTING); Html::$pageId = 141; $content = ' 
            <div class="div_space"> 
                <a id="linkNodeTypeId" href="?' . BodyHtml::CORES_SECTION . '=' . BodyHtml::SECTION_SETTINGS_MAIN . '&action=' . self::A_NODE_TYPES . '"><i class="us-icon fa-chevron-left"></i>' . NodeTypeAR::classCaption( ) . '</a> 
            </div> 
            <div class="label_h2">' . NodeTypeGroupSystem::classCaption() . '</div> 
            <div class="div_space"> 
                <a id="linkAddId" class="link_dashed" href="javascript:ajaxWindow(\'?' . BodyHtml::CORES_SECTION . '=' . BodyHtml::SECTION_SETTINGS_MAIN . '&action=' . self::A_DIALOG_NODE_TYPE_GROUP . '\')"><i class="us-icon fa-plus"></i><span>' . Lang::getPhrase( 841 ) . '</span></a> 
            </div> 
            <br>'; $data = []; $nodeTypeGroupsDto = Yii::$container ->get(NodeTypeGroupFetcher::class) ->getByCondition(); foreach ($nodeTypeGroupsDto as $nodeTypeGroupDto) { $data[] = [ 'id' => $nodeTypeGroupDto->id, 'name' => NodeTypeGroupCache::getName($nodeTypeGroupDto->id), 'position' => $nodeTypeGroupDto->position, ]; } $field = [ [ 'SPECIAL' => '_number' ], [ 'NAME' => Lang::getPhrase(1451), 'ISSORT' => 1, 'ISSORTABC' => 1, 'EL' => 'name' ], [ 'NAME' => Lang::getPhrase(3836), 'ISSORT' => 1, 'ALIGN' => 'center', 'EL' => 'position' ] ]; $table = new Table(); $table->link = '?' . BodyHtml::CORES_SECTION . '=' . BodyHtml::SECTION_SETTINGS_MAIN . '&action=' . self::A_DIALOG_NODE_TYPE_GROUP . '&uuid='; $table->sortDefault = 'name'; $table->isSortDefaultAbc = 1; $content .= $table->show($data, $field); return $content; } private static function nodeTypes(): string { if (Central::$isUSOnline === false) { OperatorAccess::verifyRight(OperatorAccess::RIGHT_SETTING); } Html::$pageId = 141; $content = ' 
            <div class="label_h2">' . NodeTypeAR::classCaption() . '</div>'; $content .= ' 
                <div class="div_space"> 
                    <a id="linkNodeTypeGroupId" href="?' . BodyHtml::CORES_SECTION . '=' . BodyHtml::SECTION_SETTINGS_MAIN . '&action=' . self::A_NODE_TYPE_GROUPS . '"><i class="us-icon fa-bars"></i>' . NodeTypeGroupSystem::classCaption( ) . '</a> 
                </div> 
                <div class="div_space"> 
                    <a id="linkNodeIconListId" href="?core_section=settings_main&action=node_icon"><i class="us-icon fa-bars"></i>' . Lang::getPhrase( 4149 ) . '</a> 
                </div> 
                <br> 
                <div class="div_space"> 
                    <a id="linkAddId" href="?core_section=' . BodyHtml::SECTION_SETTINGS_MAIN . '&action=' . self::A_NODE_TYPE_ADD_EDIT . '"><i class="us-icon fa-plus"></i>' . Lang::getPhrase( 841 ) . '</a> 
                </div><br>'; $expr = ''; if (Central::$isUSOnline === true) { $expr = [ NodeTypeAR::F_AUTHOR_EMPLOYEE_ID => Html::$currentEmployeeId ]; } $data = []; $nodeTypes = NodeTypeAR::find() ->where($expr) ->all(); foreach ($nodeTypes as $nodeType) { $data[] = [ 'id' => $nodeType->getId(), 'name' => NodeTypeCache::getName($nodeType->getId()), 'position' => $nodeType->getPosition(), 'is_layer_on_map' => $nodeType->getIsLayerOnMap() === true ? 1 : 0, 'node_type_group_name' => NodeTypeGroupCache::getName($nodeType->getNodeTypeGroupId()), ]; } $field = [ [ 'SPECIAL' => '_number' ], [ 'NAME' => Lang::getPhrase(1451), 'ISSORT' => 1, 'ISSORTABC' => 1, 'EL' => 'name' ], [ 'NAME' => NodeTypeGroupSystem::classCaptionSingle(), 'EL' => 'node_type_group_name', 'ISSORT' => 1, 'ISSORTABC' => 1, ], [ 'NAME' => Lang::getPhrase(3836), 'ISSORT' => 1, 'ALIGN' => 'center', 'EL' => 'position' ], [ 'NAME' => Lang::getPhrase(2203), 'ISSORT' => 1, 'ALIGN' => 'center', 'CONVERT' => 'boolean', 'EL' => 'is_layer_on_map' ] ]; $table = new Table(); $table->link = '?core_section=' . BodyHtml::SECTION_SETTINGS_MAIN . '&action=' . self::A_NODE_TYPE_ADD_EDIT . '&id='; $table->sortDefault = 'name'; $table->isSortDefaultAbc = 1; $content .= $table->show($data, $field); return $content; } private static function nodeIconDelete(): void { OperatorAccess::verifyRight(OperatorAccess::RIGHT_SETTING); $id = RequestData::$id; MapNodeIconAR::findOne($id)->tryDelete(); Html::location('?core_section=settings_main&action=node_icon', 'updok'); } private static function nodeIconSave(): void { OperatorAccess::verifyRight(OperatorAccess::RIGHT_SETTING); $id = RequestData::$id; if ($id < 1) { $id = MapNodeIconAR::create(RequestData::custom('name'))->getId(); } else { $mapMarker = MapNodeIconAR::findOne($id); $mapMarker->edit( [ MapNodeIconAR::F_NAME => RequestData::custom('name') ] ); } EmployeeActionLogSystem::writeLog(EmployeeHistoryType::T402, MapNodeIconAR::OBJECT_TYPE_ID, $id); AttachHtml::save(AttachmentAR::TYPE_MAP_MARKER, $id, 0, 1); Html::location('?core_section=settings_main&action=node_icon_dialog_edit&id=' . $id, 'updok'); } private static function nodeIconDialogAddEdit(): string { OperatorAccess::verifyRight(OperatorAccess::RIGHT_SETTING); $id = RequestData::$id; if ($id > 0) { $mapMarker = MapNodeIconAR::findOne($id); $imageId = MapNodeIconCache::getImageIdById($id); } else { $mapMarker = new MapNodeIconAR(); $imageId = 0; } $content = ' 
            <a href="?core_section=settings_main&action=node_icon"><i class="us-icon fa-chevron-left"></i>' . Lang::getPhrase( 893 ) . '</a><br> 
            <br> 
            <span class="label_h2">' . Lang::getPhrase(4149) . '</span><br>'; if ($imageId > 0) { $content .= ' 
                <br> 
                <div class="div_center"> 
                    <img alt="Icon" width="64" src="' . AttachmentAR::getViewUrl($imageId) . '"><br> 
                </div>'; } $content .= ' 
            <form method="post" enctype="multipart/form-data" name="form1" action=""> 
                <input type="hidden" name="core_section" value="settings_main"> 
                <input type="hidden" name="action" value="node_icon_save"> 
                <input type="hidden" name="id" value="' . $id . '"> 
                <div class="table_block"> 
                    <div class="item"> 
                        <div class="left_data"> 
                            ' . Lang::getPhrase(1451) . ': 
                        </div> 
                        <div> 
                            <input name="name" type="text" size=30 maxlength=255 class="input_box" value=\'' . ($id > 0 ? MapNodeIconCache::getNameById( $id ) : '') . '\'> 
                        </div> 
                    </div> 
                    <div class="item"> 
                        <div class="left_data"> 
                            ' . Lang::getPhrase(4150) . ':<br> 
                            <span class="info_block">' . Lang::getPhrase(880) . ' 16x16 px</span> 
                        </div> 
                        <div> 
                            <input type="file" name="attach_file[]"> 
                        </div> 
                    </div> 
                </div> 
                ' . BodyHtml::formButton('save_cancel', '?core_section=settings_main&action=node_icon') . ' 
            </form>'; if ($id > 0) { $content .= ' ' . BodyHtml::linkConfirm( '?core_section=settings_main&action=node_icon_delete&id=' . $id, Lang::getPhrase(1415), Lang::getPhrase(1150) . '?', '<i class="us-icon us-icon-danger fa-close"></i>' . Lang::getPhrase(1415) , 'linkConfirmDeleteIconId' ); } return $content; } private static function nodeIcon(): string { OperatorAccess::verifyRight(OperatorAccess::RIGHT_SETTING); $data = []; $mapNodeIcons = MapNodeIconAR::find() ->all(); foreach ($mapNodeIcons as $i => $mapNodeIcon) { $data[$i]['id'] = $mapNodeIcon->getId(); $data[$i]['name'] = MapNodeIconCache::getNameById($mapNodeIcon->getId()); $imageId = MapNodeIconCache::getImageIdById($mapNodeIcon->getId()); if ($imageId > 0) { $data[$i][103] = '<img src="' . AttachmentAR::getViewUrl($imageId) . '" width=16 height=16>'; } } $content = ' 
            <a href="?core_section=settings_main&item_id=' . self::ITEM_4 . '"><i class="us-icon fa-chevron-left"></i>' . Lang::getPhrase( 1443 ) . '</a><br> 
            <div class="label_h2">' . Lang::getPhrase(4149) . '</div> 
            <a id="linkAddId" href="?core_section=settings_main&action=node_icon_dialog_add"><i class="us-icon fa-plus"></i>' . Lang::getPhrase( 841 ) . '</a><br>'; $field = [ [ 'EL' => 103, 'ALIGN' => 'center' ], [ 'NAME' => Lang::getPhrase(1451), 'ISSORT' => 1, 'ISSORTABC' => 1, 'EL' => 'name' ] ]; $table = new Table(); $table->link = '?core_section=settings_main&action=node_icon_dialog_edit&id='; $table->sortDefault = MapNodeIconAR::F_NAME; $table->isSortDefaultAbc = 1; $content .= $table->show($data, $field); return $content; } private static function ldapSave(): void { OperatorAccess::verifyRight(OperatorAccess::RIGHT_SETTING); $isLdap = RequestData::customInt('is_ldap'); EmployeePropertyAR::ldapChangeStatus($isLdap); $ldap = LdapServer::find()->where('id > 0')->one(); if (!$ldap) { $ldap = new LdapServer(); $ldap->name = 'LDAP Server'; } $ldap->host = $_REQUEST['host']; $ldap->port = $_REQUEST['port']; $ldap->login = $_REQUEST['login']; $pass = $_REQUEST['pass']; if ('****' != $pass) { $ldap->password = $pass; } $ldap->tls = $_REQUEST['tls'] ?? 0; $ldap->base_dn = $_REQUEST['base_dn']; $ldap->filter = $_REQUEST['filter']; $ldap->attr_username = $_REQUEST['attr_username']; $ldap->attr_lastname = $_REQUEST['attr_lastname']; $ldap->attr_firstname = $_REQUEST['attr_firstname']; $ldap->save(); Html::locationBackOk(); } private static function ldap(): string { OperatorAccess::verifyRight(OperatorAccess::RIGHT_SETTING); $ldapServer = LdapServer::find() ->where('id > 0') ->one(); if (!$ldapServer) { $ldapServer = new LdapServer(); $pass = ''; } else { $pass = '****'; } $content = ' 
            <a href="?core_section=settings_main&item_id=' . self::ITEM_25 . '"><i class="us-icon fa-chevron-left"></i>' . Lang::getPhrase( 1443 ) . '</a><br> 
            <div class="label_h2">LDAP</div> 
 
            <form method="post" name="form1" action=""> 
                <input type="hidden" name="core_section" value="settings_main"> 
                <input type="hidden" name="action" value="ldap_save"> 
                <div class="table_block"> 
                    <div class="item"> 
                        <div class="left_data"> 
                            ' . Lang::getPhrase(837) . ': 
                        </div> 
                        <div> 
                            <input name="is_ldap" type="checkbox"'; if (1 == SettingAR::getByNameInt(SettingsCatalog::EMPLOYEE_LDAP_IS_USE)) { $content .= ' checked'; } $content .= ' value="1"> 
                        </div> 
                    </div> 
                    <div class="item"> 
                        <div class="left_data"> 
                            Host: 
                        </div> 
                        <div> 
                            <input type="text" class="input_box" required name="host" size="20" maxlength="255" value="' . $ldapServer->host . '"> 
                        </div> 
                    </div> 
                    <div class="item"> 
                        <div class="left_data"> 
                            Port: 
                        </div> 
                        <div> 
                            <input type="text" class="input_box" required name="port" size="4" maxlength="5" value="' . $ldapServer->port . '"> 
                        </div> 
                    </div> 
                    <div class="item"> 
                        <div class="left_data"> 
                            TLS: 
                        </div> 
                        <div> 
                            <input name="tls" type="checkbox"'; if ($ldapServer->tls === true) { $content .= ' checked'; } $content .= ' value="1"> 
                        </div> 
                    </div> 
                    <div class="item"> 
                        <div class="left_data"> 
                            LDAP Login: 
                        </div> 
                        <div> 
                            <input type="text" class="input_box" required name="login" size="20" maxlength="255" value="' . $ldapServer->login . '"> 
                        </div> 
                    </div> 
                    <div class="item"> 
                        <div class="left_data"> 
                            LDAP Password: 
                        </div> 
                        <div> 
                            <input type="password" class="input_box" required name="pass" size="20" maxlength="255" value="' . $pass . '"> 
                        </div> 
                    </div> 
                    <div class="item"> 
                        <div class="left_data"> 
                            Base DN: 
                        </div> 
                        <div> 
                            <input type="text" class="input_box" required name="base_dn" size="40" maxlength="255" value="' . $ldapServer->base_dn . '"> 
                        </div> 
                    </div> 
                    <div class="item"> 
                        <div class="left_data"> 
                            Filter: 
                        </div> 
                        <div> 
                            <input type="text" class="input_box" required name="filter" size="40" maxlength="255" value="' . $ldapServer->filter . '"> 
                        </div> 
                    </div> 
                    <div class="item"> 
                        <div class="left_data"> 
                            LDAP Attribute - Username: 
                        </div> 
                        <div> 
                            <input type="text" class="input_box" required name="attr_username" size="20" maxlength="50" value="' . $ldapServer->attr_username . '"> 
                        </div> 
                    </div> 
                    <div class="item"> 
                        <div class="left_data"> 
                            LDAP Attribute - Firstname: 
                        </div> 
                        <div> 
                            <input type="text" class="input_box" name="attr_firstname" size="20" maxlength="50" value="' . $ldapServer->attr_firstname . '"> 
                        </div> 
                    </div> 
                    <div class="item"> 
                        <div class="left_data"> 
                            LDAP Attribute - Lastname: 
                        </div> 
                        <div> 
                            <input type="text" class="input_box" name="attr_lastname" size="20" maxlength="50" value="' . $ldapServer->attr_lastname . '"> 
                        </div> 
                    </div> 
                </div> 
                ' . BodyHtml::formButton('save_cancel', '?core_section=settings_main') . ' 
            </form>'; return $content; } private static function searchFieldsSave(): void { OperatorAccess::verifyRight(OperatorAccess::RIGHT_SETTING); $sectionId = RequestData::customInt('section_id'); $data = []; if (isset($_REQUEST['enabled'])) { $array = $_REQUEST['enabled']; foreach ($array as $value) { $value = Central::escapeSymbol($value); if ('' !== $value) { $data[$value] = 1; } } } switch ($sectionId) { case 1: $arg = SettingsCatalog::FIELD_L_SEARCH; break; case 2: $arg = SettingsCatalog::FIELD_L_TOPSEARCH; break; default: throw new InvalidArgumentException( __CLASS__ . ' | ' . __FUNCTION__ . ' | SectionId #' . $sectionId . ' is unknown' ); } SettingAR::setByName($arg, json_encode($data, JSON_THROW_ON_ERROR)); Html::locationBackOk(); } private static function searchFields(): string { OperatorAccess::verifyRight(OperatorAccess::RIGHT_SETTING); $sectionId = RequestData::customInt('section_id'); $content = ' 
            <a href="?core_section=settings_main&item_id=' . self::ITEM_99 . '"><i class="us-icon fa-chevron-left"></i>' . Lang::getPhrase( 1443 ) . '</a><br>'; $caption = ''; switch ($sectionId) { case 1: $caption = Lang::getPhrase(3771); $fieldArray = []; if (Central::$erpProfileChapters[ErpProfileDto::CHAPTER_CUSTOMER]) { $fieldArray = [ [ 'name' => Lang::getPhrase(1072) . '. ' . Lang::getPhrase(5579), 'setting' => CustomerListHtml::SEARCH_FIELD_CUSTOMER_NAME ], [ 'name' => Lang::getPhrase(1072) . '. Id', 'setting' => CustomerListHtml::SEARCH_FIELD_CUSTOMER_ID ], [ 'name' => Lang::getPhrase(1072) . '. ' . Lang::getPhrase(821), 'setting' => CustomerListHtml::SEARCH_FIELD_CUSTOMER_LOGIN ], [ 'name' => Lang::getPhrase(1072) . '. ' . Lang::getPhrase(661), 'setting' => CustomerListHtml::SEARCH_FIELD_CUSTOMER_DESCRIPTION ], [ 'name' => Lang::getPhrase(1072) . '. ' . Lang::getPhrase(1010), 'setting' => CustomerListHtml::SEARCH_FIELD_CUSTOMER_PHONE ], [ 'name' => Lang::getPhrase(1072) . '. ' . Lang::getPhrase(1186), 'setting' => CustomerListHtml::SEARCH_FIELD_CUSTOMER_ADDRESS ], [ 'name' => Lang::getPhrase(1072) . '. ' . Lang::getPhrase(977), 'setting' => CustomerListHtml::SEARCH_FIELD_CUSTOMER_ACCOUNT ], [ 'name' => Lang::getPhrase(1072) . '. ' . Lang::getPhrase(3809), 'setting' => CustomerListHtml::SEARCH_FIELD_CUSTOMER_ADDITIONAL_FIELD ], [ 'name' => Lang::getPhrase(1072) . '. ' . Lang::getPhrase(5490), 'setting' => CustomerListHtml::SEARCH_FIELD_CUSTOMER_IP ], [ 'name' => Lang::getPhrase(1072) . '. ' . Lang::getPhrase(3776), 'setting' => CustomerListHtml::SEARCH_FIELD_CUSTOMER_AGREEMENT ] ]; } if (Central::$erpProfileChapters[ErpProfileDto::CHAPTER_DEVICE]) { $fieldArray[] = [ 'name' => Lang::getPhrase(624), 'setting' => CustomerListHtml::SEARCH_FIELD_DEVICE ]; $fieldArray[] = [ 'name' => Lang::getPhrase(3773), 'setting' => CustomerListHtml::SEARCH_FIELD_PELENG_MAC ]; } if (Central::$erpProfileChapters[ErpProfileDto::CHAPTER_TASK]) { $fieldArray[] = [ 'name' => Lang::getPhrase(1436) . '. ' . Lang::getPhrase(875), 'setting' => CustomerListHtml::SEARCH_FIELD_TASK_ID ]; $fieldArray[] = [ 'name' => Lang::getPhrase(1436) . '. ' . Lang::getPhrase(1184), 'setting' => CustomerListHtml::SEARCH_FIELD_TASK_DESCRIPTION ]; $fieldArray[] = [ 'name' => Lang::getPhrase(1436) . '. ' . Lang::getPhrase(3809), 'setting' => CustomerListHtml::SEARCH_FIELD_TASK_ADDITIONAL_FIELD ]; $fieldArray[] = [ 'name' => Lang::getPhrase(1436) . '. ' . Lang::getPhrase(1384), 'setting' => CustomerListHtml::SEARCH_FIELD_TASK_COMMENT ]; $fieldArray[] = [ 'name' => Lang::getPhrase(1436) . '. ' . Lang::getPhrase(5562), 'setting' => CustomerListHtml::SEARCH_FIELD_TASK_CLIENT ]; } if (Central::$erpProfileChapters[ErpProfileDto::CHAPTER_CUSTOMER]) { $fieldArray[] = [ 'name' => Lang::getPhrase(1072) . '. ' . Lang::getPhrase(4953), 'setting' => CustomerListHtml::SEARCH_FIELD_CUSTOMER_BILLING_ID ]; } break; case 2: $caption = Lang::getPhrase(3788); $fieldArray = []; if (Central::$erpProfileChapters[ErpProfileDto::CHAPTER_CUSTOMER]) { $fieldArray = [ [ 'name' => Lang::getPhrase(1072) . '. ' . Lang::getPhrase(5579), 'setting' => CustomerListHtml::SEARCH_FIELD_CUSTOMER_NAME ], [ 'name' => Lang::getPhrase(1072) . '. ' . Lang::getPhrase(821), 'setting' => CustomerListHtml::SEARCH_FIELD_CUSTOMER_LOGIN ], [ 'name' => Lang::getPhrase(1072) . '. ' . Lang::getPhrase(661), 'setting' => CustomerListHtml::SEARCH_FIELD_CUSTOMER_DESCRIPTION ], [ 'name' => Lang::getPhrase(1072) . '. ' . Lang::getPhrase(1010), 'setting' => CustomerListHtml::SEARCH_FIELD_CUSTOMER_PHONE ], [ 'name' => Lang::getPhrase(1072) . '. ' . Lang::getPhrase(1186), 'setting' => CustomerListHtml::SEARCH_FIELD_CUSTOMER_ADDRESS ], [ 'name' => Lang::getPhrase(1072) . '. ' . Lang::getPhrase(977), 'setting' => CustomerListHtml::SEARCH_FIELD_CUSTOMER_ACCOUNT ], [ 'name' => Lang::getPhrase(1072) . '. ' . Lang::getPhrase(3809), 'setting' => CustomerListHtml::SEARCH_FIELD_CUSTOMER_ADDITIONAL_FIELD ], [ 'name' => Lang::getPhrase(1072) . '. ' . Lang::getPhrase(5490), 'setting' => CustomerListHtml::SEARCH_FIELD_CUSTOMER_IP ], [ 'name' => Lang::getPhrase(1072) . '. ' . Lang::getPhrase(3776), 'setting' => CustomerListHtml::SEARCH_FIELD_CUSTOMER_AGREEMENT ] ]; } $fieldArray[] = [ 'name' => Lang::getPhrase(654), 'setting' => CustomerListHtml::SEARCH_FIELD_EMPLOYEE ]; if (Central::$erpProfileChapters[ErpProfileDto::CHAPTER_MAP]) { $fieldArray[] = [ 'name' => Lang::getPhrase(5482), 'setting' => CustomerListHtml::SEARCH_FIELD_BUILDING ]; } break; } $fieldArray = Central::sort( data: $fieldArray, sortElement: 'name', isSortAbc: true ); $content .= ' 
            <div class="label_h2">' . $caption . '</div> 
            <div class="info_block">' . Lang::getPhrase( 3783 ) . '</div>'; $value = ''; switch ($sectionId) { case 1: $value = SettingAR::getByNameString(SettingsCatalog::FIELD_L_SEARCH); break; case 2: $value = SettingAR::getByNameString(SettingsCatalog::FIELD_L_TOPSEARCH); break; } if ('' === $value) { $valueCurrent = []; } else { $valueCurrent = @json_decode($value, true, 512, JSON_THROW_ON_ERROR); } if (is_array($valueCurrent)) { foreach ($valueCurrent as $i => $value) { foreach ($fieldArray as $j => $value2) { if ($i == $value2['setting']) { $fieldArray[$j]['is_enable'] = 1; } } } } $content .= ' 
                    <form method="post" name="form1" action=""> 
                        <input type="hidden" name="core_section" value="settings_main"> 
                        <input type="hidden" name="action" value="search_fields_save"> 
                        <input type="hidden" name="section_id" value="' . $sectionId . '"> 
                        <div class="table_block">'; foreach ($fieldArray as $value) { $content .= ' 
                            <div class="item"> 
                                <div class="left_data"> 
                                    ' . $value['name'] . ': 
                                </div> 
                                <div> 
                                    <input id="fieldSearch' . $value['setting'] . 'Id" type="checkbox" name="enabled[]" value="' . $value['setting'] . '"'; if (isset($value['is_enable'])) { $content .= ' checked'; } $content .= '> 
                                </div> 
                            </div>'; } $content .= ' 
                            </div> 
                        </div> 
                        ' . BodyHtml::formButton('save_cancel', '?core_section=settings_main') . ' 
                    </form>'; return $content; } private static function tableClear(): string { OperatorAccess::verifyRight(OperatorAccess::RIGHT_SETTING); $content = ' 
            <a href="?core_section=settings_main&item_id=' . self::ITEM_99 . '"><i class="us-icon fa-chevron-left"></i>' . Lang::getPhrase( 1443 ) . '</a><br> 
            <div class="label_h2">' . Lang::getPhrase(5400) . '</div> 
            <spam class="info_block">' . Lang::getPhrase(5402) . '</spam> 
            <div class="table_block" style="width: 100%;">'; $countAll = Yii::$container->get(EmployeeActionLogFetcher::class)->getCountByCondition( [ EmployeeActionLogDto::F_OBJECT_TYPE_ID => null ] ); $count30 = Yii::$container->get(EmployeeActionLogFetcher::class)->getCountByCondition( [ 'AND', [EmployeeActionLogDto::F_OBJECT_TYPE_ID => 0], ['<', EmployeeActionLogDto::F_DATE_OPERATION, time() - 86400 * 30] ] ); $content .= SettingsHtml::propertyDialog( SettingsCatalog::EMPLOYEE_HISTORY_CLEAR, 'VALUESTR', Lang::getPhrase(5403) , '>30: ' . $count30 . '<br>all: ' . $countAll ); if ( Central::$erpProfileChapters[ErpProfileDto::CHAPTER_CUSTOMER] && 1 == SettingAR::getByNameInt(SettingsCatalog::IS_US_STAT) ) { $countAll = CustomerActivityLogAR::find()->count(); $count30 = CustomerActivityLogAR::find()->where( ['<', CustomerActivityLogAR::F_DATE_ACTIVITY, strtotime(date('Y-m-d 00:00:00', (time() - 86400 * 30)))] )->count(); $content .= SettingsHtml::propertyDialog( SettingsCatalog::US_STATCLEAR, 'VALUESTR', Lang::getPhrase(5404) . ' usm_stat', '>30: ' . $count30 . '<br>all: ' . $countAll ); } if (1 == SettingAR::getByNameInt(SettingsCatalog::US_GPS)) { $countAll = GpsRouteAR::find()->count(); $count30 = GpsRouteAR::find() ->where( [ '<', GpsRouteAR::F_DATE_ADD, strtotime(date('Y-m-d 00:00:00', (time() - 86400 * 30))) ] ) ->count(); $content .= SettingsHtml::propertyDialog( SettingsCatalog::GPS_ROW_CLEAR, 'VALUESTR', Lang::getPhrase(5404) . ' usm_gps', '>30: ' . $count30 . '<br>all: ' . $countAll ); } if ( Central::$erpProfileChapters[ErpProfileDto::CHAPTER_DEVICE] && 1 == SettingAR::getByNameInt(SettingsCatalog::US_PELENG) ) { $countAll = DevicePelengLogAR::find()->count(); $count30 = DevicePelengLogAR::find() ->where( ['<', DevicePelengLogAR::F_DATE_ADD, strtotime(date('Y-m-d 00:00:00', (time() - 86400 * 30)))] ) ->count(); $content .= SettingsHtml::propertyDialog( SettingsCatalog::PELENG_ROW_CLEAR, 'VALUESTR', Lang::getPhrase(5404) . ' usm_peleng', '>30: ' . $count30 . '<br>all: ' . $countAll ); } if ( Central::$erpProfileChapters[ErpProfileDto::CHAPTER_DEVICE] && 1 == SettingAR::getByNameInt(SettingsCatalog::MODULE_USM_OBSERVER_IS_ACTIVE) ) { $countAll = DeviceObserverLogAR::find()->count(); $count30 = DeviceObserverLogAR::find() ->where( DeviceObserverLogAR::F_DATE_CHANGE . " < " . (time() - 86400 * 30) ) ->count(); $content .= SettingsHtml::propertyDialog( SettingsCatalog::CONTROL_ROW_CLEAR, 'VALUESTR', Lang::getPhrase(5404) . ' usm_observer', '>30: ' . $count30 . '<br>all: ' . $countAll ); } if (Central::$erpProfileChapters[ErpProfileDto::CHAPTER_DEVICE]) { $countAll2 = DevicePonLevelLogAR::find()->count(); $count30 = DevicePonLevelLogAR::find() ->where( DevicePonLevelLogAR::F_DATE_TO . " < " . strtotime(date('Y-m-d 00:00:00', (time() - 86400 * 30))) ) ->count(); $content .= SettingsHtml::propertyDialog( SettingsCatalog::PON_ROW_CLEAR, 'VALUESTR', Lang::getPhrase(5401) , '>30: ' . $count30 . '<br>all: ' . $countAll2 ); } if (Central::$erpProfileChapters[ErpProfileDto::CHAPTER_CUSTOMER]) { $countAll = Yii::$container ->get(MacsUnknownFetcher::class) ->getCountByCondition([]); $count30 = Yii::$container ->get(MacsUnknownFetcher::class) ->getCountByCondition( ['<', MacsUnknownDto::F_DATE_LAST, strtotime(date('Y-m-d 00:00:00', (time() - 86400 * 30)))] ); $content .= SettingsHtml::propertyDialog( SettingsCatalog::UNK_MAC_ROW_CLEAR, 'VALUESTR', Lang::getPhrase(591) , '>30: ' . $count30 . '<br>all: ' . $countAll ); } $content .= ' 
                </div>'; return $content; } private static function attach(): string { OperatorAccess::verifyRight(OperatorAccess::RIGHT_SETTING); $content = ' 
            <a href="?core_section=settings_main&item_id=' . self::ITEM_99 . '"><i class="us-icon fa-chevron-left"></i>' . Lang::getPhrase( 1443 ) . '</a><br> 
            <div class="label_h2">' . Lang::getPhrase(1217) . '</div>'; $content .= FilterHtml::insertForm( filterArray: [ FilterHtml::F_PERIOD, FilterHtml::F_FILE_NAME, FilterHtml::F_COMMENT, FilterHtml::F_ATTACH_CATEGORY ], urlCancel: '?core_section=settings_main&action=attach' ); $date1 = 0; $date2 = time(); $usedFlter = FilterHtml::getUseFilter(); foreach ($usedFlter as $value) { switch ($value['filter']) { case FilterHtml::F_PERIOD: $date1 = strtotime($value['date1'] . ' 00:00:00'); $date2 = strtotime($value['date2'] . ' 23:59:59'); break; } } $offset = Html::$offset; $limit = Html::$perPage; $conditions = [ 'AND', ['BETWEEN', 'aa.uploaded_at', $date1, $date2] ]; foreach ($usedFlter as $value) { switch ($value['filter']) { case FilterHtml::F_FILE_NAME: $conditions[] = ['LIKE', 'LOWER(aa.filename_original)', strtolower($value['value'])]; break; case FilterHtml::F_COMMENT: $conditions[] = ['LIKE', 'LOWER(aa.comment)', strtolower($value['value'])]; break; case FilterHtml::F_ATTACH_CATEGORY: $conditions[] = ['=', AttachmentAR::F_OBJECT_TYPE, $value['value']]; break; } } $isDesc = RequestData::getDesc(); if ($isDesc == 1) { $isDesc = SORT_DESC; } else { $isDesc = SORT_ASC; } switch (strtolower(RequestData::getOrderBy())) { case 'name': $orderBy = [ 'aa.filename_original' => $isDesc ]; break; case 'size': $orderBy = [ 'aa.size' => $isDesc ]; break; case 'date_add': $orderBy = [ 'aa.uploaded_at' => $isDesc ]; break; default: $orderBy = [ 'aa.uploaded_at' => SORT_DESC ]; break; } $preLoadCountData = AttachmentAR::find() ->join( 'INNER JOIN', 'attachments AS aa', 'aa.id = ' . AttachmentAR::tableName() . '.' . AttachmentAR::F_EXT_UUID ) ->where( ['>', AttachmentAR::F_OBJECT_ID, 0] ) ->andWhere($conditions) ->count(); $allSize = AttachmentAR::find() ->join( 'INNER JOIN', 'attachments AS aa', 'aa.id = ' . AttachmentAR::tableName() . '.' . AttachmentAR::F_EXT_UUID ) ->select( [ 'amount' => 'SUM(aa.size)' ] ) ->where($conditions) ->asArray() ->all(); $allSize = $allSize[0]['amount']; $categoryCatalog = AttachmentAR::categoryCatalog(); $data = []; $attaches = AttachmentAR::find() ->join( 'INNER JOIN', 'attachments AS aa', 'aa.id = ' . AttachmentAR::tableName() . '.' . AttachmentAR::F_EXT_UUID ) ->where(['>', AttachmentAR::F_OBJECT_ID, 0]) ->andWhere($conditions) ->offset($offset) ->limit($limit) ->orderBy($orderBy); if (Html::$isDebug === true) { echo "attachesCommand:\n"; echo $attaches->createCommand()->rawSql . "\n\n"; } $attaches = $attaches->all(); foreach ($attaches as $i => $attach) { $data[$i]['name'] = '#' . $attach->getId() . ' <span class="red_text">(' . Lang::getPhrase( 3290 ) . ')</span>'; $attachment = Attachment::findOne($attach->ext_uuid); if ($attachment) { $fn = $attachment->filename_storage; $folder = __DIR__ . '/../../../../var/attachments' . $attachment->filepath; $fileForExist = $folder . $fn; if (file_exists($fileForExist)) { $data[$i]['name'] = $attachment->filename_original; $data[$i]['size'] = ceil(filesize($fileForExist) / 1024); $data[$i]['date_add'] = date('Y-m-d H:i:s', $attachment->uploaded_at); } else { $data[$i]['name'] = $attachment->filename_original . ' <span class="red_text">(' . Lang::getPhrase( 3290 ) . ')</span>'; } } $data[$i]['full_name'] = $attach->getObjectId(); if (isset($categoryCatalog[strtolower($attach->getObjectType())])) { $data[$i]['category_name'] = $categoryCatalog[strtolower($attach->getObjectType())]['name']; $link = ''; if ('' != $link) { $data[$i]['full_name'] = '<a href="' . $link . '" target=_blank>' . $attach->getObjectId() . '</a>'; } } } $content .= ' 
                <br> 
                upload_max_filesize: <b>' . ini_get('upload_max_filesize') . '</b><br> 
                post_max_size: <b>' . ini_get('post_max_size') . '</b><br> 
                <br> 
                ' . Lang::getPhrase(5377) . ': <b>' . $preLoadCountData . '</b><br> 
                ' . Lang::getPhrase(5378) . ': <b>' . (int)($allSize / 1024 / 1024) . ' MB</b><br>'; $field = [ [ 'SPECIAL' => '_number' ], [ 'NAME' => Lang::getPhrase(1635), 'EL' => 'category_name' ], [ 'NAME' => Lang::getPhrase(4233), 'EL' => 'full_name' ], [ 'NAME' => Lang::getPhrase(2910), 'ISSORT' => 1, 'EL' => 'name' ], [ 'NAME' => Lang::getPhrase(5376) . ' (KB)', 'ALIGN' => 'right', 'ISSORT' => 1, 'EL' => 'size' ], [ 'NAME' => Lang::getPhrase(1033) , 'CONVERT' => 'cdaten', 'ISSORT' => 1, 'EL' => 'date_add' ] ]; $table = new Table(); $table->sortDefault = 'date_add'; $table->isSortDesc = 1; $table->preLoadCountData = $preLoadCountData; $table->doNotSort = 1; $content .= $table->show($data, $field); return $content; } private static function arpMac(): string { OperatorAccess::verifyRight(OperatorAccess::RIGHT_SETTING); $ip = RequestData::custom('userip'); return ' 
            <a href="?core_section=settings_main&item_id=' . self::ITEM_99 . '"><i class="us-icon fa-chevron-left"></i>' . Lang::getPhrase( 1443 ) . '</a><br> 
            <div class="label_h2" id="divArpId">' . Lang::getPhrase(4793) . '</div> 
            <iframe scrolling="no" style="border: none; overflow: auto;" src="?core_section=ping&action=ping_mac&ip=' . $ip . '&show_arg=1&fixed=1" height=1000 width=1000></iframe>'; } private static function satelliteTest(): string { OperatorAccess::verifyRight(OperatorAccess::RIGHT_SETTING); Html::$isEmptyTemplate = true; $id = RequestData::$id; $content = ' 
            <div class="dialog_header"><span id="spanSatelliteTestId">' . Lang::getPhrase(5949) . '</span></div> 
            <br>'; try { $rabbitCollector = \Yii::$container->get(RabbitMqCollector::class); $queuesArray = []; foreach ($rabbitCollector->queues() as $queue) { if ($queue->name === 'usm_poller-sat-' . $id) { $queuesArray[] = [$queue->name, $queue->consumers, $queue->messages]; } } if (count($queuesArray) < 1) { $content .= ' 
                <div class="label_stop"><a href="javascript:showFullError()"><i class="us-icon us-icon-danger fa-exclamation-circle"></i></a>' . Lang::getPhrase( 3411 ) . ' &nbsp; &nbsp; &nbsp; </div>'; } else { $queuesArray = Central::sort( data: $queuesArray, sortElement: 0, isSortAbc: true ); foreach ($queuesArray as $value) { $content .= ' 
                        <div class="div_space2"> 
                            ' . $value[0] . ' | consumers: ' . $value[1] . ' |messages: ' . $value[2] . ' 
                        </div>'; } } } catch (Exception $e) { $content .= ' 
                    <div class="div_space2"> 
                        ' . $e->getMessage() . ' 
                    </div>'; } $content .= ' 
            <br> 
            <a id="linkCancelId" href="javascript:hide_dialog()" class="link_dashed"><span>' . Lang::getPhrase( 386 ) . '</span></a>'; return $content; } private static function arp(): string { Html::$isEmptyTemplate = true; OperatorAccess::verifyRight(OperatorAccess::RIGHT_SETTING); return ' 
            <div class="dialog_header"><span id="spanArpId">' . Lang::getPhrase(4793) . '</span></div> 
            <br> 
            <form method="post" name="form1" action=""> 
                <input type="hidden" name="core_section" value="settings_main"> 
                <input type="hidden" name="action" value="arp_mac"> 
                <div class="table_block"> 
                    <div class="item"> 
                        <div class="left_data"> 
                            IP: 
                        </div> 
                        <div> 
                            <input type="text" class="input_box" required name="userip" size="15" maxlength="15" value=""> 
                        </div> 
                    </div> 
                </div> 
                ' . BodyHtml::formButton('save_cancel', BodyHtml::FORM_DIALOG_CLOSE, 'ARP') . ' 
            </form>'; } private static function pingIp(): string { OperatorAccess::verifyRight(OperatorAccess::RIGHT_SETTING); $ip = RequestData::custom('ip'); $content = ' 
            <a href="?core_section=settings_main&item_id=' . self::ITEM_99 . '"><i class="us-icon fa-chevron-left"></i>' . Lang::getPhrase( 1443 ) . '</a><br> 
            <div class="label_h2" id="divPingId">' . Lang::getPhrase(3308) . ' ' . $ip . '</div> 
 
            <span id="pollerResultPingData"></span> 
            <script> 
                function processingReloadPingData(taskId) { 
                    $.post("", { 
                        ' . BodyHtml::CORES_SECTION . ': "' . BodyHtml::SECTION_PING . '", 
                        action: "reload_ping_data", 
                        ip: "' . $ip . '", 
                        task_id: taskId 
                    }).done(function (content) { 
                        content = JSON.parse(content); 
                        $("#pollerResultPingData").html(content["content"]); 
                    }); 
                } 
                function processingPollerTableResult(data) { 
                    if (data["device_ip"] == "' . $ip . '") { 
                        if (data["status"] == "error") { 
                            console.log(data); 
                            $("#pollerResultPingData").html("<div class=\"label_stop\"><i class=\"us-icon us-icon-red fa-ban\"></i>Error: " + data["error_message"] + "</div>"); 
                        } 
                        if (data["status"] == "ok") { 
                            processingReloadPingData(data["task_id"]); 
                        } 
                    } 
                } 
                $(document).ready(function () { 
                    processingReloadPingData(); 
                }) 
            </script> 
            '; return $content; } private static function ping(): string { Html::$isEmptyTemplate = true; OperatorAccess::verifyRight(OperatorAccess::RIGHT_SETTING); return ' 
            <div class="dialog_header""><span id="spanPingId">' . Lang::getPhrase(3308) . '</span></div> 
            <br> 
            <form method="get" name="form1" action=""> 
                <input type="hidden" name="core_section" value="settings_main"> 
                <input type="hidden" name="action" value="ping_ip"> 
                <div class="table_block"> 
                    <div class="item"> 
                        <div class="left_data"> 
                            IP: 
                        </div> 
                        <div> 
                            <input type="text" class="input_box" required name="ip" size="15" maxlength="15" value=""> 
                        </div> 
                    </div> 
                </div> 
                ' . BodyHtml::formButton('save_cancel', BodyHtml::FORM_DIALOG_CLOSE, 'PING') . ' 
            </form>'; } private static function customerGroupDelete(): void { OperatorAccess::verifyRight(OperatorAccess::RIGHT_SETTING); $id = RequestData::$id; CustomerGroupAR::findOne($id)->remove(); Html::location('?core_section=settings_main&action=customer_group', 'updok'); } private static function customerGroupSave(): void { OperatorAccess::verifyRight(OperatorAccess::RIGHT_SETTING); $id = RequestData::$id; if ($id < 1) { $id = CustomerGroupAR::create(RequestData::custom('name'))->getId(); } else { $customerGroupConfig = CustomerGroupAR::findOne($id); $customerGroupConfig->edit( [ CustomerGroupAR::F_NAME => RequestData::custom('name') ] ); } EmployeeActionLogSystem::writeLogWithZeroTypeId(EmployeeHistoryType::T394, 0, $id); Html::location('?core_section=settings_main&action=customer_group_dialog_edit&id=' . $id, 'updok'); } private static function customerGroupDialogAddEdit(): string { OperatorAccess::verifyRight(OperatorAccess::RIGHT_SETTING); $id = RequestData::$id; if ($id < 1) { $customerGroupConfig = new CustomerGroupAR(); $ret = BodyHtml::FORM_DIALOG_CLOSE; $content = ' 
                <div class="dialog_header"><span id="spanAddGroupId">' . Lang::getPhrase(1971) . '</span></div> 
                <br>'; } else { $customerGroupConfig = CustomerGroupAR::findOne($id); $ret = '?core_section=settings_main&action=customer_group'; $content = ' 
                <a href="' . $ret . '"><i class="us-icon fa-chevron-left"></i>' . Lang::getPhrase( 1443 ) . '</a><br> 
                <br> 
                <span class="label_h2">' . Lang::getPhrase(3955) . '</span><br>'; } $content .= ' 
            <form method="post" name="form1" action=""> 
                <input type="hidden" name="core_section" value="settings_main"> 
                <input type="hidden" name="action" value="customer_group_save"> 
                <input type="hidden" name="id" value="' . $id . '"> 
                <div class="table_block"> 
                    <div class="item"> 
                        <div class="left_data"> 
                            ' . Lang::getPhrase(1451) . ': 
                        </div> 
                        <div> 
                            <input type="text" class="input_box" required name="name" size="40" maxlength="255" value=\'' . ($id > 0 ? $customerGroupConfig->getName( ) : '') . '\'> 
                        </div> 
                    </div> 
                </div> 
                ' . BodyHtml::formButton('save_cancel', $ret) . ' 
            </form>'; if ($id < 1) { Html::$isEmptyTemplate = true; return $content; } else { $content .= ' ' . BodyHtml::linkConfirm( '?core_section=settings_main&action=customer_group_delete&id=' . $id, Lang::getPhrase(1415), Lang::getPhrase(1150) . '?', '<i class="us-icon us-icon-danger fa-close"></i>' . Lang::getPhrase(1415) , 'linkConfirmDeleteGroupId' ); } return $content; } private static function customerGroup(): string { OperatorAccess::verifyRight(OperatorAccess::RIGHT_SETTING); $content = ' 
            <a href="?core_section=settings_main&item_id=' . self::ITEM_10 . '"><i class="us-icon fa-chevron-left"></i>' . Lang::getPhrase( 1443 ) . '</a><br> 
            <br> 
            <span class="label_h2">' . Lang::getPhrase(3955) . '</span><br> 
            <br> 
            <div class="div_space"> 
                <a id="linkAddId" href="javascript:ajaxWindow(\'?core_section=settings_main&action=customer_group_dialog_add\')" class="link_dashed"><i class="us-icon fa-plus"></i><span>' . Lang::getPhrase( 841 ) . '</span></a> 
            </div>'; $data = []; $customerGroupConfigs = CustomerGroupAR::find()->all(); foreach ($customerGroupConfigs as $customerGroupConfig) { $data[] = [ 'id' => $customerGroupConfig->getId(), 'name' => $customerGroupConfig->getName() ]; } $field = [ [ 'SPECIAL' => '_number' ], [ 'NAME' => Lang::getPhrase(1451), 'ISSORT' => 1, 'ISSORTABC' => 1, 'EL' => 'name' ] ]; $table = new Table(); $table->link = '?core_section=settings_main&action=customer_group_dialog_edit&id='; $table->sortDefault = 'name'; $table->isSortDefaultAbc = 1; $content .= $table->show($data, $field); return $content; } private static function inventorySubaccountDelete(): void { OperatorAccess::verifyRight(OperatorAccess::RIGHT_SETTING); $id = RequestData::$id; InventorySubaccountAR::findOne($id)->tryDelete(); Html::location('?core_section=settings_main&action=inventory_sub_account', 'updok'); } private static function satelliteDelete(): void { OperatorAccess::verifyRight(OperatorAccess::RIGHT_SETTING); $id = RequestData::$id; SatelliteAR::findOne($id)->remove(); Html::location('?core_section=settings_main&action=satellite', 'updok'); } private static function satelliteSave(): void { OperatorAccess::verifyRight(OperatorAccess::RIGHT_SETTING); $id = RequestData::$id; $name = RequestData::custom('name'); if ($id < 1) { $satellite = SatelliteAR::create($name); $id = $satellite->getId(); } else { $satellite = SatelliteAR::findOne($id); if (!$satellite) { Html::locationForbidden(); } $satellite->edit( [ SatelliteAR::F_NAME => $name ] ); EmployeeActionLogSystem::writeLog(EmployeeHistoryType::T462, SatelliteAR::OBJECT_TYPE_ID, $id); } SatellitesAddressesSystem::removeByExpr($id); for ($i = 1; $i <= 10; ++$i) { $addressUnitId = RequestData::customInt('address_unit_id' . $i); if ($addressUnitId > 0) { SatellitesAddressesSystem::create( satelliteId: $id, addressUnitId: $addressUnitId ); } } Html::location('?core_section=settings_main&action=satellite_dialog_edit&id=' . $id, 'updok'); } private static function inventorySubaccountSave(): void { OperatorAccess::verifyRight(OperatorAccess::RIGHT_SETTING); $id = RequestData::$id; $name = RequestData::custom('name'); if ($id < 1) { $id = InventorySubaccountAR::create($name)->getId(); $isEdit = false; } else { $isEdit = true; $inventorySubaccount = InventorySubaccountAR::findOne($id); if (!$inventorySubaccount) { Html::locationBackCancel(); } $inventorySubaccount->edit( [ InventorySubaccountAR::F_NAME => $name ] ); } if ($isEdit === true) { EmployeeActionLogSystem::writeLog(EmployeeHistoryType::T597, SatelliteAR::OBJECT_TYPE_ID, $id); } Html::location('?core_section=settings_main&action=inventory_subaccount_dialog_edit&id=' . $id, 'updok'); } private static function satelliteDialogAddEdit(): string { OperatorAccess::verifyRight(OperatorAccess::RIGHT_SETTING); $id = RequestData::$id; if ($id < 1) { $content = ' 
                <div class="dialog_header"><span>' . Lang::getPhrase(1971) . '</span></div> 
                <br>'; $ret = BodyHtml::FORM_DIALOG_CLOSE; $satellite = new SatelliteAR(); } else { $satellite = SatelliteAR::findOne($id); if (!$satellite) { Html::locationForbidden(); } $ret = '?core_section=settings_main&action=satellite'; $content = ' 
                <a href="' . $ret . '"><i class="us-icon fa-chevron-left"></i>' . Lang::getPhrase( 1443 ) . '</a><br> 
                <br> 
                <span class="label_h2">' . Lang::getPhrase(4959) . '</span><br>'; } if ($id > 0) { $content .= ' 
                <br> 
                <a class="link_dashed" href="javascript:ajaxWindow(\'?core_section=settings_main&action=satellite_test&id=' . $id . '\')"><i class="us-icon fa-cogs"></i><span>' . Lang::getPhrase( 5949 ) . '</span></a><br>'; } $addressArray = AddressUnit::getByToken(AddressLocalityType::TOKEN_CITY); $addressArray = Central::sort( data: $addressArray, sortElement: 'name', isSortAbc: true ); $currentAddressesArray = []; $satellitesAddressesDtos = Yii::$container ->get(SatellitesAddressesFetcher::class) ->getByCondition( [ SatellitesAddressesDto::F_SATELLITE_ID => $id ] ); foreach ($satellitesAddressesDtos as $satelliteAddressDto) { $currentAddressesArray[] = $satelliteAddressDto->address_unit_id; } $content .= ' 
                <form method="post" name="form1" action=""> 
                    <input type="hidden" name="core_section" value="settings_main"> 
                    <input type="hidden" name="action" value="satellite_save"> 
                    <input type="hidden" name="id" value="' . $id . '"> 
                    <div class="table_block"> 
                        <div class="item"> 
                            <div class="left_data"> 
                                ' . Lang::getPhrase(1451) . ': 
                            </div> 
                            <div> 
                                <input type="text" class="input_box" autocomplete="off" name="name" size="80" maxlength="255" value=\'' . ($id > 0 ? $satellite->getName( ) : '') . '\'> 
                            </div> 
                        </div>'; for ($i = 1; $i <= 10; ++$i) { $content .= ' 
                        <div class="item"> 
                            <div class="left_data"> 
                                ' . Lang::getPhrase(1186) . ' #' . $i . ':<br>'; if ($i > 1) { $content .= '<span class="info_block">' . Lang::getPhrase(1214) . '</span>'; } $content .= ' 
                            </div> 
                            <div> 
                                <select id="addressUnitId' . $i . 'Id" name="address_unit_id' . $i . '" size="1">'; if ($i > 1) { $content .= ' 
                                <option value="0"></option>'; } foreach ($addressArray as $value) { $content .= ' 
                                <option value="' . $value['id'] . '"'; if ( $id > 0 && isset($currentAddressesArray[$i - 1]) && $value['id'] == $currentAddressesArray[$i - 1] ) { $content .= ' selected'; } $content .= '>' . $value['name'] . '</option>'; } $content .= ' 
                                </select> 
                            </div> 
                        </div>'; } $content .= ' 
                    </div> 
                    ' . BodyHtml::formButton('save_cancel', $ret) . ' 
                </form>'; if ($id < 1) { Html::$isEmptyTemplate = true; return $content; } else { $content .= ' ' . BodyHtml::linkConfirm( '?core_section=settings_main&action=satellite_delete&id=' . $id, Lang::getPhrase(1415), Lang::getPhrase(1150) . '?', '<i class="us-icon us-icon-danger fa-close"></i>' . Lang::getPhrase(1415) , 'linkConfirmDeleteSatelliteId' ); } return $content; } private static function inventorySubaccountDialogAddEdit(): string { OperatorAccess::verifyRight(OperatorAccess::RIGHT_SETTING); $id = RequestData::$id; if ($id < 1) { $content = ' 
                <div class="dialog_header"><span id="spanInventorySubAccountDialogAddId">' . Lang::getPhrase( 1971 ) . '</span></div> 
                <br>'; $ret = BodyHtml::FORM_DIALOG_CLOSE; $inventorySubaccount = new InventorySubaccountAR(); } else { $inventorySubaccount = InventorySubaccountAR::findOne($id); if (!$inventorySubaccount) { Html::locationForbidden(); } $ret = '?core_section=settings_main&action=inventory_sub_account'; $content = ' 
                <a href="' . $ret . '"><i class="us-icon fa-chevron-left"></i>' . Lang::getPhrase( 1443 ) . '</a><br> 
                <br> 
                <span class="label_h2">' . Lang::getPhrase(6000) . '</span><br>'; } $content .= ' 
                <form method="post" name="form1" action=""> 
                    <input type="hidden" name="core_section" value="settings_main"> 
                    <input type="hidden" name="action" value="inventory_subaccount_save"> 
                    <input type="hidden" name="id" value="' . $id . '"> 
                    <div class="table_block"> 
                        <div class="item"> 
                            <div class="left_data"> 
                                ' . Lang::getPhrase(1451) . ': 
                            </div> 
                            <div> 
                                <input type="text" class="input_box" autocomplete="off" required name="name" size="80" maxlength="255" value=\'' . $inventorySubaccount->getName( ) . '\'> 
                            </div> 
                        </div> 
                    </div> 
                    ' . BodyHtml::formButton('save_cancel', $ret) . ' 
                </form>'; if ($id < 1) { Html::$isEmptyTemplate = true; return $content; } else { $content .= BodyHtml::linkDeleteObject( $id, '?core_section=settings_main&action=inventory_subaccount_delete&id=' . $id, '', '', '', InventorySubaccountAR::OBJECT_TYPE_ID, count(InventorySubaccountAR::findOne($id)->checkDelete()) ); } return $content; } private static function satellite(): string { OperatorAccess::verifyRight(OperatorAccess::RIGHT_SETTING); $content = ' 
            <a href="?core_section=settings_main&item_id=' . self::ITEM_7 . '"><i class="us-icon fa-chevron-left"></i>' . Lang::getPhrase( 1443 ) . '</a><br> 
            <br> 
            <span class="label_h2">' . Lang::getPhrase(4959) . '</span><br> 
             
            <br> 
            <div class="div_space"> 
                <a href="https://wiki.userside.eu/satellite_wiki_link"><i class="us-icon fa-info-circle"></i><i>Wiki</i></a><br> 
            </div> 
 
            <div class="div_space" style="margin-top: 10px;"> 
                <a id="linkAddId" class="link_dashed" href="javascript:ajaxWindow(\'?core_section=settings_main&action=satellite_dialog_add\');"><i class="us-icon fa-plus"></i><span>' . Lang::getPhrase( 841 ) . '</span></a> 
            </div>'; $data = []; $satellites = SatelliteAR::find()->all(); foreach ($satellites as $satellite) { $addressListName = ''; $satellitesAddressesDtos = Yii::$container ->get(SatellitesAddressesFetcher::class) ->getByCondition( [ SatellitesAddressesDto::F_SATELLITE_ID => $satellite->getId() ], [ SatellitesAddressesDto::F_ADDRESS_UNIT_ID => SORT_ASC ] ); foreach ($satellitesAddressesDtos as $satelliteAddressDto) { $addressListName .= AddressUnit::getNameById($satelliteAddressDto->address_unit_id) . "<br>"; } $data[] = [ 'id' => $satellite->getId(), 'id_full' => '<a href="?core_section=settings_main&action=satellite_dialog_edit&id=' . $satellite->getId( ) . '">' . $satellite->getId() . '</a>', 'name' => $satellite->getName(), 'address_name' => $addressListName ]; } $field = [ [ 'NAME' => 'ID', 'EL' => 'id_full', 'ISBREAK' => 1 ], [ 'NAME' => Lang::getPhrase(1186), 'EL' => 'address_name', 'ISSORT' => 1, 'ISSORTABC' => 1 ], [ 'NAME' => Lang::getPhrase(1451), 'EL' => 'name', 'ISSORT' => 1, 'ISSORTABC' => 1 ] ]; $table = new Table(); $table->link = '?core_section=settings_main&action=satellite_dialog_edit&id='; $table->sortDefault = 'address_name'; $table->isSortDefaultAbc = 1; $content .= $table->show($data, $field); return $content; } private static function inventorySubaccount(): string { OperatorAccess::verifyRight(OperatorAccess::RIGHT_SETTING); $content = ' 
            <a href="?core_section=settings_main&item_id=' . self::ITEM_24 . '"><i class="us-icon fa-chevron-left"></i>' . Lang::getPhrase( 1443 ) . '</a><br> 
            <br> 
            <span class="label_h2">' . Lang::getPhrase(6000) . '</span><br> 
            <div class="div_space" style="margin-top: 10px;"> 
                <a id="linkAddId" class="link_dashed" href="javascript:ajaxWindow(\'?core_section=settings_main&action=inventory_subaccount_dialog_add\')"><i class="us-icon fa-plus"></i><span>' . Lang::getPhrase( 841 ) . '</span></a> 
            </div>'; $data = []; $inventorySubAccounts = InventorySubaccountAR::find()->all(); foreach ($inventorySubAccounts as $inventorySubAccount) { $data[] = [ 'id' => $inventorySubAccount->getId(), 'id_full' => '<a href="?core_section=settings_main&action=inventory_subaccount_dialog_edit&id=' . $inventorySubAccount->getId( ) . '">' . $inventorySubAccount->getId() . '</a>', 'name' => $inventorySubAccount->getName(), 'is_special' => $inventorySubAccount->getIsSpecial() ]; } $field = [ [ 'NAME' => 'ID', 'EL' => 'id_full', 'ISBREAK' => 1 ], [ 'NAME' => Lang::getPhrase(1451), 'EL' => 'name' ], [ 'NAME' => Lang::getPhrase(5999), 'EL' => 'is_special', 'CONVERT' => 'boolean3' ] ]; $table = new Table(); $table->link = '?core_section=settings_main&action=inventory_subaccount_dialog_edit&id='; $table->sortDefault = 'id'; $content .= $table->show($data, $field); return $content; } private static function import(): string { OperatorAccess::verifyRight(OperatorAccess::RIGHT_SETTING); $content = ''; $objectType = RequestData::custom('object_type'); $step = RequestData::customInt('step'); $codepage = RequestData::custom('codepage'); $caption = ''; $arrayResult = []; $fieldArray = []; $fn = ''; $arg1 = ''; $arg2 = ''; $temp1 = ''; $temp2 = ''; switch ($objectType) { case 'customer': $caption = CustomerAR::classCaption(); $fieldArray = [ 1 => Lang::getPhrase(3841) , 2 => Lang::getPhrase(821) . '/' . Lang::getPhrase( 552 ) . '<b>*</b>', 3 => Lang::getPhrase(4711) . ' <b>*</b>', 4 => Lang::getPhrase(810) . ' <b>*</b>', 5 => Lang::getPhrase(2676) . ' <b>*</b>', 6 => Lang::getPhrase(2679) . ' <b>*</b>', 7 => Lang::getPhrase(1230) . ' <b>*</b>', 8 => Lang::getPhrase(1285) . ' <b>*</b>', 9 => Lang::getPhrase(5439) . ' <b>*</b>', 10 => Lang::getPhrase(3263) . ' <b>*</b>', 11 => Lang::getPhrase(2073) . ' <b>*</b>', 12 => Lang::getPhrase(3262) . ' <b>*</b>', 13 => Lang::getPhrase(1012) . ' <b>*</b>', 14 => Lang::getPhrase(809) . ' <b>*</b>', 15 => Lang::getPhrase(1010) . ' <b>*</b>', 16 => Lang::getPhrase(1010) . ' (2) <b>*</b>', 17 => 'E-mail <b>*</b>', 18 => 'IP <b>*</b>', 19 => 'MAC <b>*</b>', 20 => Lang::getPhrase(661) . ' <b>*</b>' ]; break; case 'address': $caption = Lang::getPhrase(3877); $fieldArray = [ 1 => Lang::getPhrase(1230), 2 => Lang::getPhrase(1285), 3 => Lang::getPhrase(5439), 4 => Lang::getPhrase(2179) . ' <b>*</b>', 5 => Lang::getPhrase(2181) . ' <b>*</b>', 6 => Lang::getPhrase(2180) . ' <b>*</b>', 7 => Lang::getPhrase(4614) . ' <b>*</b>', 8 => Lang::getPhrase(5808) . ' <b>*</b>', 9 => Lang::getPhrase(5609) . '-1 (ID) <b>*</b>', 10 => Lang::getPhrase(5609) . '-1 (' . Lang::getPhrase( 6197 ) . ') <b>*</b>', 11 => Lang::getPhrase(5609) . '-2 (ID) <b>*</b>', 12 => Lang::getPhrase(5609) . '-2 (' . Lang::getPhrase( 6197 ) . ') <b>*</b>', ]; break; case 'node': $caption = NodeAR::classCaption(); $fieldArray = [ 1 => Lang::getPhrase(1230) . ' <b>*</b>', 2 => Lang::getPhrase(1285) . ' <b>*</b>', 3 => Lang::getPhrase(5439) . ' <b>*</b>', 4 => Lang::getPhrase(2073) . ' <b>*</b>', 5 => Lang::getPhrase(3262) . ' <b>*</b>', 6 => Lang::getPhrase(2069) . ' <b>*</b>', 7 => Lang::getPhrase(4749) . ' <b>*</b>', 8 => Lang::getPhrase(3661) . ' <b>*</b>', 9 => Lang::getPhrase(1184) . ' <b>*</b>', 10 => Lang::getPhrase(5207) . ' <b>*</b>', 11 => Lang::getPhrase(5208) . ' <b>*</b>', 12 => Lang::getPhrase(5216) . ' <b>*</b>', 13 => Lang::getPhrase(4041) . ' <b>*</b>' ]; break; case 'device': $caption = Lang::getPhrase(627); $fieldArray = [ 1 => NodeAR::classCaptionSingle() . '. ' . Lang::getPhrase(1230), 2 => NodeAR::classCaptionSingle() . '. ' . Lang::getPhrase(1285), 3 => NodeAR::classCaptionSingle() . '. ' . Lang::getPhrase(5439), 4 => NodeAR::classCaptionSingle() . '. ' . Lang::getPhrase( 2073 ) . ' <b>*</b>', 5 => NodeAR::classCaptionSingle() . '. ' . Lang::getPhrase( 3262 ) . ' <b>*</b>', 6 => NodeAR::classCaptionSingle() . '. ' . Lang::getPhrase( 2069 ) . ' <b>*</b>', 7 => NodeAR::classCaptionSingle() . '. ' . Lang::getPhrase( 4749 ) . ' <b>*</b>', 8 => Lang::getPhrase(1552) . '. ' . Lang::getPhrase( 1016 ) . ' <b>*</b>', 9 => Lang::getPhrase(1552) . '. ' . Lang::getPhrase(1559), 10 => Lang::getPhrase(1552) . '. ' . Lang::getPhrase(1565), 11 => Lang::getPhrase(1552) . '. ' . Lang::getPhrase( 1660 ) . ' <b>*</b>', 12 => Lang::getPhrase(1552) . '. ' . Lang::getPhrase( 1045 ) . ' <b>*</b>', 13 => Lang::getPhrase(1552) . '. ' . Lang::getPhrase( 1637 ) . ' <b>*</b>', 14 => Lang::getPhrase(1552) . '. ' . Lang::getPhrase( 1638 ) . ' <b>*</b>' ]; break; case 'inventory': $caption = Lang::getPhrase(641); $fieldArray = [ 1 => Lang::getPhrase(1584), 2 => Lang::getPhrase(1582), 3 => Lang::getPhrase(1585), 4 => Lang::getPhrase(3556), 5 => Lang::getPhrase(3937), 6 => Lang::getPhrase(661) . ' <b>*</b>', 7 => Lang::getPhrase(1637) . ' <b>*</b>' ]; break; } if ( 3 == $step || 4 == $step ) { $arg1 = RequestData::custom('arg1'); $arg2 = RequestData::custom('arg2'); $fn = 'import_' . $arg1 . '_' . $arg2 . '.csv'; $fn = realpath(__DIR__) . '/../../../../var/log/' . $fn; if (file_exists($fn) == false) { if (4 == $step) { Html::location("?core_section=settings_main"); } Html::locationCancel(); } $isGood = 1; $fileTemp = fopen($fn, "r"); while (!feof($fileTemp)) { $temp1 = trim(fgets($fileTemp)); if ('' != $temp1) { if ('utf8' != $codepage) { $temp1 = iconv("WINDOWS-1251", "UTF-8", $temp1); } $arrayTemp = explode(';', $temp1); $arrayResult[] = $arrayTemp; if ('address' == $objectType && !isset($arrayTemp[3])) { $isGood = 0; } if ('node' == $objectType && !isset($arrayTemp[6])) { $isGood = 0; } if ('device' == $objectType && !isset($arrayTemp[9])) { $isGood = 0; } if ( 'customer' == $objectType && ( !isset($arrayTemp[0]) || $arrayTemp[0] == '' ) ) { $isGood = 0; } } } fclose($fileTemp); if (1 != $isGood) { unlink($fn); Html::location('?core_section=settings_main&action=import&object_type=' . $objectType, 'cancel'); } $content = ' 
                <a href="?core_section=settings_main&item_id=' . self::ITEM_20 . '"><i class="us-icon fa-chevron-left"></i>' . Lang::getPhrase( 1443 ) . '</a><br> 
                <br> 
                <span class="label_h2">' . Lang::getPhrase( 4743 ) . ' - ' . $caption . '</span><br>'; } if ($step < 1) { $ret = "?core_section=settings_main&item_id=" . self::ITEM_20; $content = ' 
                    <a href="' . $ret . '"><i class="us-icon fa-chevron-left"></i>' . Lang::getPhrase( 1443 ) . '</a><br> 
                    <br> 
                    <span class="label_h2">' . Lang::getPhrase(4743) . ' - ' . $caption . '</span><br> 
                    <br> 
                    <span class="red_text bold_text">' . Lang::getPhrase( 4748 ) . '</span><br><br> 
                    ' . Lang::getPhrase( 4744 ) . ':<br>'; foreach ($fieldArray as $i => $value) { $content .= ' 
                    <div class="div_space"> 
                    &nbsp; &nbsp; &nbsp; <b>' . $i . '.</b> ' . $value . ' 
                    </div>'; } $content .= ' 
                <div class="div_space"> 
                    <b>*</b> - ' . Lang::getPhrase( 4750 ) . ' 
                </div> 
                <div class="div_space"> 
                    ' . Lang::getPhrase(5154) . ' 
                </div> 
                <form method="post" enctype="multipart/form-data" name="form1" action=""> 
                    <input type="hidden" name="core_section" value="settings_main"> 
                    <input type="hidden" name="action" value="import"> 
                    <input type="hidden" name="object_type" value="' . $objectType . '"> 
                    <input type="hidden" name="step" value="2"> 
                    <div class="table_block"> 
                        <div class="item"> 
                            <div class="left_data"> 
                                ' . Lang::getPhrase(1243) . ':<br> 
                                <span class="info_block">' . Lang::getPhrase( 787 ) . ': csv</span> 
                            </div> 
                            <div> 
                                <input type="file" name="fileTemp"> 
                            </div> 
                        </div> 
                        <div class="item"> 
                            <div class="left_data"> 
                                ' . Lang::getPhrase(5155) . ': 
                            </div> 
                            <div> 
                                <select name="codepage" size="1"> 
                                    <option value="utf8">utf8</option> 
                                    <option value="1251">1251</option> 
                                </select> 
                            </div> 
                        </div> 
                    </div>'; $isFail = 0; if (('device' == $objectType || 'inventory' == $objectType)) { if (1 > count(WarehousesEmployeesAccessAR::getWarehouseAccessList())) { $isFail = 1; $content .= ' 
                        <span class="red_text bold_text">' . Lang::getPhrase( 4969 ) . '</span><br>'; } } if (1 != $isFail) { $content .= BodyHtml::formButton('save_cancel', $ret, Lang::getPhrase(1830) ); } $content .= ' 
                    </form>'; } if (2 == $step) { $fileName = $_FILES["fileTemp"]["name"]; if ('' != $fileName) { $ext = str_replace('.', '', strtolower(substr($_FILES["fileTemp"]["name"], -4))); if ('csv' != $ext) { Html::locationBackCancel(); } $temp1 = mt_rand(); $temp2 = mt_rand(); $fileName = 'import_' . $temp1 . '_' . $temp2 . '.' . $ext; $folder = realpath(__DIR__) . '/../../../../var/log/'; if ('1' != copy($_FILES["fileTemp"]["tmp_name"], $folder . $fileName)) { Html::locationCancel(); } } else { Html::locationCancel(); } $url = "?core_section=settings_main&action=import&object_type=" . $objectType . "&step=3&arg1=" . $temp1 . "&arg2=" . $temp2 . "&codepage=" . $codepage; Html::location($url); } if (3 == $step) { $content .= ' 
                <form method="send" name="form1" action=""> 
                    <input type="hidden" name="core_section" value="settings_main"> 
                    <input type="hidden" name="action" value="import"> 
                    <input type="hidden" name="object_type" value="' . $objectType . '"> 
                    <input type="hidden" name="arg1" value="' . $arg1 . '"> 
                    <input type="hidden" name="arg2" value="' . $arg2 . '"> 
                    <input type="hidden" name="codepage" value="' . $codepage . '"> 
                    <input type="hidden" name="step" value="4"> 
                    <div class="table_block"> 
                        <div class="item"> 
                            <div class="left_data"> 
                                <input name="dont_first" type="checkbox" value="1"> 
                            </div> 
                            <div> 
                                ' . Lang::getPhrase(4746) . ' 
                            </div> 
                        </div>'; if ('node' == $objectType) { $content .= ' 
                        <div class="item"> 
                            <div class="left_data"> 
                                ' . Lang::getPhrase(863) . ' 
                            </div> 
                            <div> 
                                <select name="node_type_id" size="1">'; $nodeTypes = NodeTypeAR::find() ->orderBy(NodeTypeAR::F_POSITION . ',' . NodeTypeAR::F_NAME) ->all(); foreach ($nodeTypes as $nodeType) { $content .= ' 
                                    <option value="' . $nodeType->getId() . '">' . NodeTypeCache::getName( $nodeType->getId() ) . '</option>'; } $content .= ' 
                                </select> 
                            </div> 
                        </div>'; } if ('inventory' == $objectType) { $content .= ' 
                        <div class="item"> 
                            <div class="left_data"> 
                                ' . Lang::getPhrase(639) . ' 
                            </div> 
                            <div> 
                                <select name="warehouse_id" size="1">'; $warehouses = WarehouseAR::find() ->where( [ WarehouseAR::F_ID => WarehousesEmployeesAccessAR::getWarehouseAccessList() ] ) ->orderBy(WarehouseAR::F_NAME) ->all(); foreach ($warehouses as $warehouse) { $content .= ' 
                                    <option value="' . $warehouse->getId() . '">' . $warehouse->getName() . '</option>'; } $content .= ' 
                                </select> 
                            </div> 
                        </div> 
                        <div class="item"> 
                            <div class="left_data"> 
                                ' . Lang::getPhrase(1660) . ' 
                            </div> 
                            <div> 
                                <select name="trader_id" size="1" required>'; $traders = TraderAR::find() ->orderBy(TraderAR::F_NAME) ->all(); foreach ($traders as $trader) { $content .= ' 
                                    <option value="' . $trader->getId() . '">' . $trader->getName() . '</option>'; } $content .= ' 
                                </select> 
                            </div> 
                        </div>'; } if ('customer' == $objectType) { $content .= ' 
                        <div class="item"> 
                            <div class="left_data"> 
                                ' . Lang::getPhrase(2228) . ' 
                            </div> 
                            <div> 
                                <select name="billing_id" size="1">'; $billings = BillingAR::find() ->orderBy(BillingAR::F_NAME) ->all(); foreach ($billings as $billing) { $content .= ' 
                                    <option value="' . $billing->getId() . '">' . BillingCache::getName( $billing->getId() ) . '</option>'; } $content .= ' 
                                </select> 
                            </div> 
                        </div>'; } $content .= ' 
                    </div> 
                    <div class="div_space"> 
                        <b>' . Lang::getPhrase(4745) . ':</b> 
                    </div>'; $field = [ [ 'SPECIAL' => '_number' ] ]; foreach ($fieldArray as $i => $value) { $field[] = [ 'NAME' => $value, 'EL' => $i - 1 ]; } $table = new Table(); $table->customPerPage = 'all'; $content .= $table->show($arrayResult, $field); $content .= ' 
                    <br> 
                    ' . BodyHtml::formButton( 'save_cancel', '?core_section=settings_main', Lang::getPhrase(1830) ) . ' 
                </form>'; } if (4 == $step) { if ($objectType !== 'inventory') { BuildingCache::flushData(); RedisCache::$arrayKeyExist['isAll'] = true; } $isDontFirst = RequestData::customInt('dont_first'); $nodeTypeId = RequestData::customInt('node_type_id'); $importResult = []; $count = 0; $arrayToImport = []; switch ($objectType) { case 'customer': $billingId = RequestData::customInt('billing_id'); foreach ($arrayResult as $value) { ++$count; if ( 1 < $count || 1 != $isDontFirst ) { $arrayToImport[] = [ 'billing_id' => $billingId, 'billing_customer_id' => $value[0] ?? '', 'login' => $value[1] ?? '', 'name' => $value[2] ?? '', 'tariff_name' => $value[3] ?? '', 'agreement_number' => $value[4] ?? '', 'agreement_date' => $value[5] ?? '', 'cityName' => $value[6] ?? '', 'streetName' => $value[7] ?? '', 'houseNumber' => $value[8] ?? '', 'apart' => $value[9] ?? '', 'entrance' => $value[10] ?? '', 'level' => $value[11] ?? '', 'date_connect' => $value[12] ?? '', 'balance' => $value[13] ?? '', 'phone' => $value[14] ?? '', 'phone2' => $value[15] ?? '', 'mail' => $value[16] ?? '', 'ip' => $value[17] ?? '', 'mac' => $value[18] ?? '', 'description' => $value[19] ?? '' ]; } } break; case 'inventory': $inventorySections = InventorySectionAR::find() ->orderBy(InventorySectionAR::F_NAME) ->all(); $inventoryAssortmentArray = []; $inventoryAssortments = InventoryAssortmentAR::find()->all(); foreach ($inventoryAssortments as $inventoryAssortment) { $uuid = $inventoryAssortment->getInventorySectionId() . '-US-' . mb_strtolower( $inventoryAssortment->getName() ); $inventoryAssortmentArray[$uuid] = $inventoryAssortment->getId(); } foreach ($arrayResult as $value) { ++$count; if ( 1 < $count || 1 != $isDontFirst ) { $categoryName = $value[0] ?? ''; $inventoryName = $value[1] ?? ''; $unitName = $value[2] ?? ''; $count = $value[3] ?? 0; $amount = $value[4] ?? 0; $comment = $value[5] ?? ''; $sn = $value[6] ?? ''; if ($count != 1) { $sn = ''; } $traderId = RequestData::customInt('trader_id'); $warehouseId = RequestData::custom('warehouse_id'); $categoryName = Central::escapeSymbol($categoryName); $inventoryName = Central::escapeSymbol($inventoryName); if ($count > 0) { $catId = 0; foreach ($inventorySections as $inventorySection) { if (mb_strtolower($categoryName) == mb_strtolower( InventorySectionCache::getName($inventorySection->getId()) )) { $catId = $inventorySection->getId(); break; } } if ($catId < 1) { $catId = InventorySectionAR::create( $categoryName, InventorySectionAR::T_0_OTHER )->getId(); } $uuid = $catId . '-US-' . mb_strtolower($inventoryName); $invId = $inventoryAssortmentArray[$uuid] ?? 0; if ($invId < 1) { $inventoryAssortment = InventoryAssortmentAR::create($catId, $inventoryName); $invId = $inventoryAssortment->getId(); $inventoryAssortment = InventoryAssortmentAR::findOne($invId); $inventoryAssortment->edit( [ InventoryAssortmentAR::F_NAME => $inventoryName, InventoryAssortmentAR::F_UNIT_NAME => $unitName ] ); $inventoryAssortmentArray = []; $inventoryAssortments = InventoryAssortmentAR::find()->all(); foreach ($inventoryAssortments as $inventoryAssortment2) { $uuid = InventoryAssortmentCache::getInventorySectionId( $inventoryAssortment2->getId() ) . '-US-' . mb_strtolower( InventoryAssortmentCache::getName($inventoryAssortment2->getId()) ); $inventoryAssortmentArray[$uuid] = $inventoryAssortment2->getId(); } } $inventory = InventoryAR::create( traderId: $traderId, inventoryAssortmentId: $invId, amount: $count, price: $amount, inventoryOperationId: -1, inventoryNumber: $sn, comment: $comment ); $inventory->moved( InventoryAR::ACCOUNT_WAREHOUSE, InventoryAR::SUB_ACCOUNT_3, $warehouseId ); $id = $inventory->getId(); $importResult[] = [ 'type' => Lang::getPhrase(641), 'caption' => '(' . $invId . ') <a href="' . $inventory->getUrl( ) . '">' . $inventoryName . '</a> (' . $unitName . ': ' . $count . ') - ' . $amount ]; } } } break; case 'address': case 'node': case 'device': foreach ($arrayResult as $value) { ++$count; if ( 1 < $count || 1 != $isDontFirst ) { $cityName = $value[0] ?? ''; $streetName = $value[1] ?? ''; $houseNumber = $value[2] ?? ''; $tempBundle = [ 'cityName' => $cityName, 'streetName' => $streetName, 'houseNumber' => $houseNumber ]; switch ($objectType) { case 'address': $tempBundle['entranceCount'] = isset($value[3]) ? (int)($value[3]) : 0; $tempBundle['levelCount'] = isset($value[4]) ? (int)($value[4]) : 0; $tempBundle['apartCount'] = isset($value[5]) ? (int)($value[5]) : 0; $tempBundle['isUnused'] = isset($value[6]) ? (int)($value[6]) : 0; $tempBundle['buildingTypeId'] = isset($value[7]) ? (int)($value[7]) : 0; $tempBundle['additionalData1Id'] = isset($value[8]) ? (int)($value[8]) : 0; $tempBundle['additionalData1Data'] = $value[9] ?? ''; $tempBundle['additionalData2Id'] = isset($value[10]) ? (int)($value[10]) : 0; $tempBundle['additionalData2Data'] = $value[11] ?? ''; break; case 'node': $tempBundle['nodeTypeId'] = $nodeTypeId; $tempBundle['nodeEntrance'] = isset($value[3]) ? (int)($value[3]) : 0; $tempBundle['nodeLevel'] = isset($value[4]) ? (int)($value[4]) : 0; $tempBundle['nodeLocation'] = $value[5] ?? ''; $tempBundle['nodeNumber'] = $value[6] ?? ''; $tempBundle['nodeCoord'] = $value[7] ?? ''; $tempBundle['nodeComment'] = $value[8] ?? ''; $tempBundle['nodeOwnerId'] = $value[9] ?? 0; $tempBundle['nodeMapMarkId'] = $value[10] ?? 0; $tempBundle['nodeLayerId'] = $value[11] ?? 0; $tempBundle['nodeInvNo'] = $value[12] ?? ''; break; case 'device': $tempBundle['nodeTypeId'] = NodeAR::TYPE_NODE; $tempBundle['nodeEntrance'] = isset($value[3]) ? (int)($value[3]) : 0; $tempBundle['nodeLevel'] = isset($value[4]) ? (int)($value[4]) : 0; $tempBundle['nodeLocation'] = $value[5] ?? ''; $tempBundle['nodeNumber'] = $value[6] ?? ''; $tempBundle['deviceIp'] = $value[7] ?? 0; $tempBundle['deviceModel'] = $value[8] ?? ''; $tempBundle['devicePort'] = $value[9] ?? 0; $tempBundle['deviceTrader'] = $value[10] ?? ''; $tempBundle['deviceMac'] = $value[11] ?? ''; $tempBundle['deviceSn'] = $value[12] ?? ''; $tempBundle['deviceInv'] = $value[13] ?? ''; break; } $arrayToImport[] = $tempBundle; } } break; } if ($objectType != 'inventory') { $importResult = Import::importData($arrayToImport); } unlink($fn); if ($isDontFirst == 1) { --$count; } $content .= ' 
                            <br> 
                            <div class="div_space"> 
                                <b>' . Lang::getPhrase(1289) . ':</b><br> 
                                &nbsp; &nbsp; &nbsp; &bull; &nbsp; ' . Lang::getPhrase( 4747 ) . ': <b>' . $count . '</b><br> 
                                &nbsp; &nbsp; &nbsp; &bull; &nbsp; ' . Lang::getPhrase( 4678 ) . '/' . Lang::getPhrase( 4267 ) . ': <b>' . count($importResult) . '</b><br> 
                            </div>'; foreach ($importResult as $i => $value) { $content .= ' 
                                <div class="div_space"> 
                                    ' . ($i + 1) . '. ' . $value['type'] . ' "<i>' . $value['caption'] . '</i>" 
                                </div>'; } EmployeeActionLogSystem::writeLogWithZeroTypeId(EmployeeHistoryType::T440, 0, 0, $objectType); } return $content; } private static function tablePropertySave(): void { $typeId = RequestData::custom('id'); $employeeId = RequestData::customInt('employee_id'); if ($employeeId > 0) { $employeeId = Html::$currentEmployeeId; } else { OperatorAccess::verifyRight(OperatorAccess::RIGHT_SETTING); $employeeId = null; } $employeeTableSettingDto = Yii::$container ->get(EmployeeTableSettingFetcher::class) ->getOneByCondition( [ EmployeeTableSettingDto::F_EMPLOYEE_ID => $employeeId, EmployeeTableSettingDto::F_TABLE_TYPE => $typeId ] ); if (!$employeeTableSettingDto) { EmployeeTableSettingSystem::create($typeId, $employeeId); } if ('cancel' == RequestData::custom('data')) { EmployeeTableSettingSystem::removeByEmployeeTableType( $employeeId, $typeId ); } else { $fieldsListArray = []; $fieldList = RequestData::custom('field_list'); $arrayField = explode(',', $fieldList); $position = 0; foreach ($arrayField as $value) { if ('' != $value) { $field = str_replace('li_', '', $value); $field = str_replace('_id', '', $field); $width = RequestData::custom('w_' . $field); if (1 == RequestData::custom('check_' . $field)) { ++$position; $fieldsListArray[$field] = [ 'POS' => $position, 'W' => $width ]; } else { $fieldsListArray[$field] = [ 'POS' => -1, 'W' => $width ]; } } } EmployeeTableSettingSystem::editFieldList($typeId, $employeeId, $fieldsListArray); } Html::locationBackOk(); } public static function tableSettingCatalog($id, $employeeId = null): array { $catalog = EmployeeTableSettingSystem::getCatalog(); $field = []; $arrAddField = []; if (!isset($catalog[$id])) { Html::locationCancel(); } $fieldsArray = $catalog[$id]['fields']; foreach ($fieldsArray as $i => $value) { $field[$i]['NAME'] = $value; } if (isset($catalog[$id]['additional_field_category'])) { $arrAddField = AdditionalFieldAR::getByCategory($catalog[$id]['additional_field_category']); } if (count($arrAddField) > 0) { foreach ($arrAddField as $i => $value) { $field[(1000 + $i)]['NAME'] = Lang::getPhrase(3945) . ': ' . $value['name']; } } $tableData = EmployeeTableSettingSystem::getProperty($id, $employeeId); foreach ($field as $i => $value) { $field[$i]['ID'] = $i; $field[$i]['POS'] = -1; $field[$i]['W'] = ''; if (isset($tableData[$i])) { $field[$i]['POS'] = $tableData[$i]['POS']; $field[$i]['W'] = $tableData[$i]['W']; } } return [ 'field' => $field, 'additionalField' => $arrAddField ]; } private static function tableProperty(): string { OperatorAccess::verifyRight(OperatorAccess::RIGHT_SETTING); $id = RequestData::custom('id'); $ret = '?core_section=settings_main'; return self::tableSetting($id, $ret); } public static function tableSetting($tableId, $ret, $employeeId = null): string { $responce = self::tableSettingCatalog($tableId, $employeeId); $field = $responce['field']; $field = Central::sort($field, 'POS'); $content = ' 
            <a href="' . $ret . '"><i class="us-icon fa-chevron-left"></i>' . Lang::getPhrase( 1443 ) . '</a><br> 
            <br> 
            <span class="label_h2">' . Lang::getPhrase( 3833 ) . ' - ' . EmployeeTableSettingSystem::getCatalog()[$tableId]['name'] . '</span> 
            <div class="info_block">' . Lang::getPhrase( 4028 ) . '</div> 
            <form method="send" name="form1" action=""> 
                <input type="hidden" name="core_section" value="' . BodyHtml::SECTION_SETTINGS_MAIN . '"> 
                <input type="hidden" name="action" value="' . self::A_TABLE_PROPERTY_SAVE . '"> 
                <input type="hidden" id="field_list_id" name="field_list" value=""> 
                <input type="hidden" name="id" value="' . $tableId . '"> 
                <input type="hidden" name="employee_id" value="' . $employeeId . '"> 
                <div id="table_field_id"> 
                    <ul id="div_sortable">'; $fieldTempCount = 0; foreach ($field as $value) { ++$fieldTempCount; $content .= ' 
                        <li class="ui-state-default div_sortable_class" id="li_' . $value['ID'] . '_id"> 
                            <div style="position: relative;"> 
                                <div> 
                                    <input id="checkField' . $fieldTempCount . 'Id" name="check_' . $value['ID'] . '" type="checkbox"'; if (-1 != $value['POS']) { $content .= ' checked'; } $content .= ' value="1"> 
                                    ' . $value['NAME'] . ' 
                                </div> 
                                <div style="position: absolute; top: 0px; right: 0;"> 
                                    ' . Lang::getPhrase( 3837 ) . ' <input type="text" name="w_' . $value['ID'] . '" size="5" class="input_field" maxlength="5" value="' . $value['W'] . '"> 
                                </div> 
                            </div> 
                        </li>'; } $content .= ' 
                    </ul> 
                </div>                 
                <script> 
                    reload_sort_position(); 
                </script> 
                <br>     
                <div class="div_space"> 
                    <a href="?core_section=' . BodyHtml::SECTION_SETTINGS_MAIN . '&action=' . self::A_TABLE_PROPERTY_SAVE . '&id=' . $tableId . '&data=cancel&employee_id=' . $employeeId . '"><i class="us-icon fa-times"></i>' . Lang::getPhrase( 4029 ) . '</a> 
                </div>     
                ' . BodyHtml::formButton('save_cancel', $ret) . ' 
            </form>'; return $content; } private static function customerStateDelete(): void { OperatorAccess::verifyRight(OperatorAccess::RIGHT_SETTING); $id = RequestData::$id; CustomerStatusAR::findOne($id)->remove(); Html::location('?core_section=settings_main&action=customer_state', 'updok'); } private static function customerStateSave(): void { OperatorAccess::verifyRight(OperatorAccess::RIGHT_SETTING); $id = RequestData::$id; $name = RequestData::custom('name'); if ($id < 1) { $customerState = CustomerStatusAR::create($name); $id = $customerState->getId(); } else { $customerState = CustomerStatusAR::findOne($id); $customerState->edit( [ CustomerStatusAR::F_NAME => $name ] ); } EmployeeActionLogSystem::writeLogWithZeroTypeId(EmployeeHistoryType::T459, 0, $id); Html::location('?core_section=settings_main&action=customer_state_dialog_edit&id=' . $id, 'updok'); } private static function customerStateDialogAddEdit(): string { OperatorAccess::verifyRight(OperatorAccess::RIGHT_SETTING); $id = RequestData::$id; if (RequestData::custom('id') != '') { $mode = 'edit'; } else { Html::$isEmptyTemplate = true; $mode = 'add'; } if ($mode == 'add') { $content = ' 
                <div class="dialog_header"><span id="spanAddStateId">' . Lang::getPhrase(1971) . '</span></div> 
                <br>'; $ret = BodyHtml::FORM_DIALOG_CLOSE; } else { $ret = '?core_section=settings_main&action=customer_state'; $content = ' 
                <a href="' . $ret . '"><i class="us-icon fa-chevron-left"></i>' . Lang::getPhrase( 1443 ) . '</a><br> 
                <br> 
                <span class="label_h2">' . Lang::getPhrase(4924) . '</span><br>'; } $content .= ' 
                <form method="post" name="form1" action=""> 
                    <input type="hidden" name="core_section" value="settings_main"> 
                    <input type="hidden" name="action" value="customer_state_save"> 
                    <input type="hidden" name="id" value="' . $id . '"> 
                    <div class="table_block"> 
                        <div class="item"> 
                            <div class="left_data"> 
                                ' . Lang::getPhrase(1451) . ': 
                            </div> 
                            <div>'; if (0 < $id || 'add' == $mode) { $content .= ' 
                                <input type="text" class="input_box" required name="name" size="20" maxlength="255" value=\'' . CustomerStatusCache::getName( $id ) . '\'>'; } else { $content .= CustomerStatusCache::getName($id); } $content .= ' 
                            </div> 
                        </div> 
                    </div>'; if (0 < $id || 'add' == $mode) { $content .= BodyHtml::formButton('save_cancel', $ret); } $content .= ' 
                </form>'; if ('add' == $mode) { Html::$isEmptyTemplate = true; return $content; } elseif (2 < $id) { $content .= ' ' . BodyHtml::linkConfirm( '?core_section=settings_main&action=customer_state_delete&id=' . $id, Lang::getPhrase(1415), Lang::getPhrase(1150) . '?', '<i class="us-icon us-icon-danger fa-close"></i>' . Lang::getPhrase(1415) , 'linkConfirmDeleteStateId' ); } return $content; } private static function customerState(): string { OperatorAccess::verifyRight(OperatorAccess::RIGHT_SETTING); $content = ' 
            <a href="?core_section=settings_main&item_id=' . self::ITEM_10 . '"><i class="us-icon fa-chevron-left"></i>' . Lang::getPhrase( 1443 ) . '</a><br> 
            <br> 
            <span class="label_h2">' . Lang::getPhrase(4925) . '</span><br> 
            <div class="div_space" style="margin-top: 10px;"> 
                <a id="linkAddId" href="javascript:ajaxWindow(\'?core_section=settings_main&action=customer_state_dialog_add\')" class="link_dashed"><i class="us-icon fa-plus"></i><span>' . Lang::getPhrase( 841 ) . '</span></a> 
            </div>'; $data = CustomerStatusAR::getCatalog(); $field = [ [ 'SPECIAL' => '_number' ], [ 'NAME' => 'ID', 'EL' => 'id' ], [ 'NAME' => Lang::getPhrase(1451), 'ISSORT' => 1, 'ISSORTABC' => 1, 'EL' => 'name' ] ]; $table = new Table(); $table->link = '?core_section=settings_main&action=customer_state_dialog_edit&id='; $table->sortDefault = 'name'; $table->isSortDefaultAbc = 1; $content .= $table->show($data, $field); return $content; } private static function customPageSave(): void { if (Central::$isUSOnline === false) { OperatorAccess::verifyRight(OperatorAccess::RIGHT_SETTING); } $id = RequestData::$id; $category = RequestData::custom('category'); $name = RequestData::custom('name'); if ('' == $name) { $name = '_'; } if ($id < 1) { $customPage = PageAR::create($category, $name); $id = $customPage->getId(); } else { $customPage = PageAR::findOne($id); } if ( Central::$isUSOnline === true && $customPage->getAuthorEmployeeId() != Html::$currentEmployeeId ) { Html::locationForbidden(); } $customPage->edit( [ PageAR::F_NAME => $name, PageAR::F_CATEGORY => $category, PageAR::F_URL => RequestData::customTrue('links'), PageAR::F_BODY => RequestData::customTrue('comment'), PageAR::F_IS_FRAME => RequestData::customBoolean('is_frame'), PageAR::F_IS_BLANK => RequestData::customBoolean('is_blank'), PageAR::F_SECTION_TYPE => RequestData::custom('section_type'), PageAR::F_EXTERIOR => [ PageAR::EXTERIOR_ICON => RequestData::custom('exterior_icon') ], ] ); $currentAccess = EmployeeProfilePageAR::getByPageId($id); if (isset($_REQUEST['profile_access']) && is_array($_REQUEST['profile_access'])) { foreach ($_REQUEST['profile_access'] as $profileId) { if (!isset($currentAccess[$profileId])) { EmployeeProfilePageAR::create($id, $profileId); } else { unset($currentAccess[$profileId]); } } } foreach ($currentAccess as $profileId => $value) { EmployeeProfilePageAR::removeByPageProfileId($id, $profileId); } EmployeeActionLogSystem::writeLogWithZeroTypeId(EmployeeHistoryType::T99, 0, $id); CustomPageCache::flushData(); Html::location( '?core_section=' . BodyHtml::SECTION_SETTINGS_MAIN . '&action=' . self::A_CUSTOM_PAGE_DIALOG_EDIT . '&id=' . $id, 'updok' ); } private static function customPageDelete(): void { if (Central::$isUSOnline === false) { OperatorAccess::verifyRight(OperatorAccess::RIGHT_SETTING); } $id = RequestData::$id; $customPage = PageAR::findOne($id); if ( Central::$isUSOnline === true && $customPage->getAuthorEmployeeId() != Html::$currentEmployeeId ) { Html::locationForbidden(); } $customPage->remove(); Html::location( '?core_section=' . BodyHtml::SECTION_SETTINGS_MAIN . '&action=' . self::A_CUSTOM_PAGE_LIST . '&category=' . $customPage->getCategory( ), 'updok' ); } private static function customPageDialogAddEdit(): string { if (Central::$isUSOnline === false) { OperatorAccess::verifyRight(OperatorAccess::RIGHT_SETTING); } $id = RequestData::$id; if ($id < 1) { $category = RequestData::custom('category'); $customPage = new PageAR(); } else { $customPage = PageAR::findOne($id); if ( Central::$isUSOnline === true && $customPage->getAuthorEmployeeId() != Html::$currentEmployeeId ) { Html::locationForbidden(); } $category = $customPage->getCategory(); } switch ($category) { case PageAR::CATEGORY_CUSTOMER_CABINET: $caption = Lang::getPhrase(4127); break; case PageAR::CATEGORY_LEFT_MENU: $caption = Lang::getPhrase(5968); break; case PageAR::CATEGORY_CUSTOMER_CARD: $caption = Lang::getPhrase(5853); break; case PageAR::CATEGORY_TOP_MENU: $caption = Lang::getPhrase(5967); break; case PageAR::CATEGORY_DASHBOARD: $caption = Lang::getPhrase(6205); break; default: $caption = '???'; break; } $ret = '?core_section=' . BodyHtml::SECTION_SETTINGS_MAIN . '&action=' . self::A_CUSTOM_PAGE_LIST . '&category=' . $category; $content = ' 
            <a href="' . $ret . '"><i class="us-icon fa-chevron-left"></i>' . Lang::getPhrase( 893 ) . '</a><br> 
            <div class="label_h2">' . $caption . '</div> 
            <form method="post" name="form1" action=""> 
                <input type="hidden" name="core_section" value="' . BodyHtml::SECTION_SETTINGS_MAIN . '"> 
                <input type="hidden" name="action" value="' . self::A_CUSTOM_PAGE_SAVE . '"> 
                <input type="hidden" name="category" value="' . $category . '"> 
                <input type="hidden" name="id" value="' . $id . '"> 
                <div class="table_block">'; if ( PageAR::CATEGORY_LEFT_MENU == $category && Central::$isUSOnline === false ) { $content .= ' 
                    <div class="item"> 
                        <div class="left_data"> 
                            ' . Lang::getPhrase(5200) . ': 
                        </div> 
                        <div> 
                            <select name="section_type" size="1">'; $arrayPage = PageAR::returnArrayPage(); $sectionType = $customPage->getSectionType(); foreach ($arrayPage as $tempSection => $value) { $content .= ' 
                                <option value="' . $tempSection . '"'; if ($tempSection == $sectionType) { $content .= ' selected'; } $content .= '>' . $value['name'] . '</option>'; } $content .= ' 
                            </select> 
                        </div> 
                    </div>'; } $content .= ' 
                    <div class="item"> 
                        <div class="left_data"> 
                            ' . Lang::getPhrase(833) . ': 
                        </div> 
                        <div> 
                            <input name="name" type="text" size=80 maxlength=200 class="input_box" value=\'' . ($id > 0 ? $customPage->getName( ) : '') . '\'> 
                        </div> 
                    </div> 
                    <div class="item"> 
                        <div class="left_data"> 
                            ' . Lang::getPhrase(3187) . ': 
                        </div> 
                        <div> 
                            <input name="links" type="text" size=80 class="input_box" value=\'' . ($id > 0 ? $customPage->getUrl( ) : '') . '\'> 
                        </div> 
                    </div>'; if (PageAR::CATEGORY_DASHBOARD == $category) { $exterior = []; if ( $id > 0 && $customPage->getExterior() !== null ) { $exterior = json_decode($customPage->getExterior(), true); } $exteriorIcon = $exterior[PageAR::EXTERIOR_ICON] ?? ''; $content .= ' 
                    <div class="item"> 
                        <div class="left_data"> 
                            ' . Lang::getPhrase(4150) . ': 
                        </div> 
                        <div> 
                            fa-<input name="exterior_icon" type="text" size=10 class="input_box" value=\'' . $exteriorIcon . '\'> 
                            <a target="_blank" href="https://fontawesome.com/v4/icons/">icons</a> 
                        </div> 
                    </div>'; } $content .= ' 
                    <div class="item"> 
                        <div class="left_data"> 
                            ' . Lang::getPhrase(4708) . ': 
                        </div> 
                        <div> 
                            <input name="is_frame" type="checkbox"'; if ( $id > 0 && true === $customPage->getIsFrame() ) { $content .= ' checked'; } $content .= ' value="1"> 
                        </div> 
                    </div> 
                    <div class="item"> 
                        <div class="left_data"> 
                            ' . Lang::getPhrase(6157) . ': 
                        </div> 
                        <div> 
                            <input name="is_blank" type="checkbox"'; if ( $id > 0 && true === $customPage->getIsBlank() ) { $content .= ' checked'; } $content .= ' value="1"> 
                        </div> 
                    </div> 
                    <div class="item"> 
                        <div class="left_data"> 
                            ' . Lang::getPhrase(852) . ' 
                        </div> 
                        <div> 
                            <script src="../main/config/tiny_mce/tiny_mce.js"></script> 
                            <script> 
                                loadTinyMcePage(); 
                            </script> 
                            <textarea name="comment" style="width: 100%; height: 600px;" rows="40">' . ($id > 0 ? $customPage->getBody( ) : '') . '</textarea> 
                        </div> 
                    </div>'; if ( ( PageAR::CATEGORY_LEFT_MENU == $category || PageAR::CATEGORY_TOP_MENU == $category || PageAR::CATEGORY_DASHBOARD == $category ) && Central::$isUSOnline === false ) { $content .= ' 
                    <div class="item"> 
                        <div class="left_data"> 
                            ' . Lang::getPhrase(5969) . ': 
                        </div> 
                        <div>'; $arrAccess = EmployeeProfilePageAR::getByPageId($id); $arrProfile = []; $operatorProfiles = EmployeeProfileAR::find()->all(); foreach ($operatorProfiles as $operatorProfile) { $arrProfile[] = [ 'id' => $operatorProfile->getId(), 'name' => EmployeeProfileCache::getName($operatorProfile->getId()) ]; } $arrProfile = Central::sort( data: $arrProfile, sortElement: 'name', isSortAbc: true ); foreach ($arrProfile as $value) { $content .= ' 
                            <div class="div_space"> 
                                <input name="profile_access[]" type="checkbox" value="' . $value['id'] . '"'; if ( isset($arrAccess[$value['id']]) || 1 > count($arrAccess) ) { $content .= ' checked'; } $content .= '> 
                                ' . $value['name'] . ' 
                            </div>'; } $content .= ' 
                        </div> 
                    </div>'; } $content .= ' 
                </div> 
                ' . BodyHtml::formButton('save_cancel', $ret) . ' 
            </form>'; if ( $category == PageAR::CATEGORY_CUSTOMER_CABINET || $category == PageAR::CATEGORY_SUPPORT_INTERFACE ) { $content .= '             
                <div class="label_h3" style="margin-bottom: 3px; margin-top: 0px;">' . Lang::getPhrase( 2673 ) . '</div> 
                <div class="info_block">' . Lang::getPhrase( 2674 ) . '</div> 
                <div class="gray_block_light"> 
                    <div class="table_block"> 
                        <div class="item"> 
                            <div class="left_data"> 
                                [' . PageAR::D_DATE . '] 
                            </div> 
                            <div> 
                                ' . Lang::getPhrase(2675) . ' ' . date( 'd.m.Y' ) . ' 
                            </div> 
                        </div> 
                        <div class="item"> 
                            <div class="left_data"> 
                                [' . PageAR::D_CUSTOMER_NAME . '] 
                            </div> 
                            <div> 
                                ' . Lang::getPhrase(2682) . ' 
                            </div> 
                        </div> 
                        <div class="item"> 
                            <div class="left_data"> 
                                [' . PageAR::D_CUSTOMER_ACCOUNT_NUMBER . '] 
                            </div> 
                            <div> 
                                ' . Lang::getPhrase(977) . ' 
                            </div> 
                        </div> 
                        <div class="item"> 
                            <div class="left_data"> 
                                [' . PageAR::D_CUSTOMER_IP . '] 
                            </div> 
                            <div> 
                                ' . Lang::getPhrase(1016) . ' 
                            </div> 
                        </div> 
                    </div> 
                </div>'; } if ( $category == PageAR::CATEGORY_CUSTOMER_CARD ) { $content .= '             
                <div class="label_h3" style="margin-bottom: 3px; margin-top: 0px;">' . Lang::getPhrase( 2673 ) . '</div> 
                <div class="gray_block_light"> 
                    <div class="table_block"> 
                        <div class="item"> 
                            <div class="left_data"> 
                                [' . PageAR::D_AGREEMENT_NUMBER . '] 
                            </div> 
                            <div> 
                                ' . Lang::getPhrase(2676) . ' 
                            </div> 
                        </div> 
                        <div class="item"> 
                            <div class="left_data"> 
                                [' . PageAR::D_BILLING_ID . '] 
                            </div> 
                            <div> 
                                ' . Lang::getPhrase(5854) . ' 
                            </div> 
                        </div> 
                        <div class="item"> 
                            <div class="left_data"> 
                                [' . PageAR::D_BILLING_UID . '] 
                            </div> 
                            <div> 
                                ' . Lang::getPhrase(3841) . ' 
                            </div> 
                        </div> 
                        <div class="item"> 
                            <div class="left_data"> 
                                [' . PageAR::D_ID . '] 
                            </div> 
                            <div> 
                                ' . Lang::getPhrase(3784) . ' 
                            </div> 
                        </div> 
                        <div class="item"> 
                            <div class="left_data"> 
                                [' . PageAR::D_IP . '] 
                            </div> 
                            <div> 
                                ' . Lang::getPhrase(2695) . ' 
                            </div> 
                        </div> 
                        <div class="item"> 
                            <div class="left_data"> 
                                [' . PageAR::D_LOGIN . '] 
                            </div> 
                            <div> 
                                ' . Lang::getPhrase(821) . ' 
                            </div> 
                        </div> 
                        <div class="item"> 
                            <div class="left_data"> 
                                [' . PageAR::D_MAC . '] 
                            </div> 
                            <div> 
                                ' . Lang::getPhrase(1045) . ' 
                            </div> 
                        </div> 
                        <div class="item"> 
                            <div class="left_data"> 
                                [' . PageAR::D_EMPLOYEE_ID . '] 
                            </div> 
                            <div> 
                                ' . Lang::getPhrase(5936) . ' 
                            </div> 
                        </div> 
                         <div class="item"> 
                            <div class="left_data"> 
                                [' . PageAR::D_EMPLOYEE_HASH . '] 
                            </div> 
                            <div> 
                                ' . Lang::getPhrase( 5856 ) . ' 
                            </div> 
                        </div> 
                    </div> 
                </div>'; } if ($id > 0) { $content .= ' 
                <br> 
                <div class="div_space">'; $content .= ' ' . BodyHtml::linkConfirm( '?core_section=' . BodyHtml::SECTION_SETTINGS_MAIN . '&action=' . self::A_CUSTOM_PAGE_DELETE . '&id=' . $id, Lang::getPhrase(1415), Lang::getPhrase(1150) . '?', '<i class="us-icon us-icon-danger fa-close"></i>' . Lang::getPhrase(1415) , 'linkConfirmDeletePageId' ); } return $content; } private static function customPageList(): string { if (Central::$isUSOnline === false) { OperatorAccess::verifyRight(OperatorAccess::RIGHT_SETTING); } $category = RequestData::custom('category'); if (Central::$isUSOnline === true) { if ( $category != PageAR::CATEGORY_LEFT_MENU && $category != PageAR::CATEGORY_TOP_MENU ) { $category = PageAR::CATEGORY_LEFT_MENU; } } switch ($category) { case PageAR::CATEGORY_LEFT_MENU: $caption = Lang::getPhrase(5968); break; case PageAR::CATEGORY_CUSTOMER_CARD: $caption = Lang::getPhrase(5853); break; case PageAR::CATEGORY_TOP_MENU: $caption = Lang::getPhrase(5967); break; case PageAR::CATEGORY_DASHBOARD: $caption = Lang::getPhrase(6205); break; case PageAR::CATEGORY_CUSTOMER_CABINET: $caption = Lang::getPhrase(3185); break; } $content = ' 
            <a href="?core_section=settings_main&item_id=' . self::ITEM_99 . '"><i class="us-icon fa-chevron-left"></i>' . Lang::getPhrase( 1443 ) . '</a><br> 
            <div class="label_h2">' . $caption . '</div> 
            <div class="div_space"> 
                <a id="linkAddId" href="?core_section=' . BodyHtml::SECTION_SETTINGS_MAIN . '&action=' . self::A_CUSTOM_PAGE_DIALOG_ADD . '&category=' . $category . '"><i class="us-icon fa-plus"></i>' . Lang::getPhrase( 841 ) . '</a> 
            </div>'; $expr = ''; if (Central::$isUSOnline === true) { $expr = [ PageAR::F_AUTHOR_EMPLOYEE_ID => Html::$currentEmployeeId ]; } $data = []; $customPages = PageAR::find() ->where( [ PageAR::F_CATEGORY => $category ] ) ->andWhere($expr) ->indexBy(PageAR::F_ID) ->orderBy(PageAR::F_NAME) ->all(); foreach ($customPages as $i => $customPage) { if ('' != $customPage->getUrl()) { $data[$i][100] = Lang::getPhrase(3187); } else { $data[$i][100] = Lang::getPhrase(814); } $data[$i]['id'] = $customPage->getId(); $data[$i]['_name'] = Central::replaceSymbolCode($customPage->getName()); } $fieldArray = [ [ 'SPECIAL' => '_number' ], [ 'NAME' => Lang::getPhrase(1451), 'ISSORT' => 1, 'ISSORTABC' => 1, 'EL' => '_name' ], [ 'NAME' => Lang::getPhrase(863), 'EL' => 100, 'ISSORTABC' => 1 ] ]; $table = new Table(); $table->link = '?core_section=' . BodyHtml::SECTION_SETTINGS_MAIN . '&action=' . self::A_CUSTOM_PAGE_DIALOG_EDIT . '&id='; $table->sortDefault = 'NAME'; $table->isSortDefaultAbc = 1; $content .= $table->show($data, $fieldArray); return $content; } private static function repairInventoryDevice(): string { $id = RequestData::$id; Html::$isEmptyTemplate = true; OperatorAccess::verifyRight(OperatorAccess::RIGHT_SETTING); $device = DeviceAR::findOne($id); $inventoryId = $device->getInventoryId(); $customerId = $device->getCustomerId(); $accountSub = InventoryAR::SUB_ACCOUNT_3; if ($customerId > 0) { $accountType = InventoryAR::ACCOUNT_CUSTOMER; $accountObjectId = $customerId; } else { $accountType = InventoryAR::ACCOUNT_NODE; $accountObjectId = $device->getNodeId(); } InventoryOperationAR::create( $inventoryId, $accountType, $accountSub, $accountObjectId, null, null, null, 'REPAIR' ); return 'Doing!'; } private static function repairInventoryReload(): string { return self::repairInventoryReloadBody(RequestData::$id, RequestData::customInt('is_delete')); } private static function repairInventoryReloadBody($inventoryId): string { Html::$isEmptyTemplate = true; $inventory = InventoryAR::findOne($inventoryId); if (!$inventory) { return 'Bad Id!'; } OperatorAccess::verifyRight(OperatorAccess::RIGHT_SETTING); if (InventoryAR::ACCOUNT_CUSTOMER == $inventory->getAccountType()) { $customerId = $inventory->getAccountObjectId(); $nodeId = 0; } else { $customerId = 0; $nodeId = $inventory->getAccountObjectId(); } $inventorySubAccount = $inventory->getAccountSub(); $argArray = $inventory->getOptions(); $mac = $argArray['MAC'] ?? ''; $ip = null; $count = DeviceAR::find() ->where( [ DeviceAR::F_INVENTORY_ID => $inventoryId ] ) ->count(); if ($count < 1) { DeviceAR::create( 1, $inventoryId, $nodeId, $customerId, $ip, $mac, null, null, null, 'REPAIR', $inventorySubAccount, null, true ); $result = 'Doing!'; } else { $result = 'Yet!'; } return $result; } private static function repairInventory(): string { $id = RequestData::$id; Html::$isEmptyTemplate = true; OperatorAccess::verifyRight(OperatorAccess::RIGHT_SETTING); InventoryOperationAR::create( $id, InventoryAR::ACCOUNT_WAREHOUSE, InventoryAR::SUB_ACCOUNT_3, 1, null, null, null, 'REPAIR' ); return 'Doing!'; } private static function diagWebSocket(): string { Html::$isJsonTemplate = true; OperatorAccess::verifyRight(OperatorAccess::RIGHT_SETTING); $msg = RequestData::custom('msg'); $data = WebSocket::createBodyNotification($msg, 'f00'); return json_encode( [ 'responce' => WebSocket::sendMessage(Html::$currentEmployeeId, WebSocket::TYPE_NOTIFY, $data) ] ); } private static function diagNotify(): string { Html::$isEmptyTemplate = true; OperatorAccess::verifyRight(OperatorAccess::RIGHT_SETTING); $phone = RequestData::custom('phone'); $callerIdName = RequestData::custom('caller_id'); UsmAsterisk::createNotify(Html::$currentEmployeeId, $phone, 0, $callerIdName); return 'Create!'; } private static function exportToKmlSave(): void { OperatorAccess::verifyRight(OperatorAccess::RIGHT_SETTING); $nodeTypeData = []; $nodeTypes = NodeTypeAR::find()->all(); foreach ($nodeTypes as $nodeType) { if (1 == RequestData::customBooleanOld('node' . $nodeType->getId())) { $nodeTypeData[$nodeType->getId()] = $nodeType->getId(); } } $planMode = []; $plan2Mode = []; if (1 == RequestData::customBooleanOld('state_0')) { $planMode[0] = 0; $plan2Mode[] = false; } if (1 == RequestData::customBooleanOld('state_1')) { $planMode[1] = 1; $plan2Mode[] = true; } $ignoreLayer = []; if (isset($_REQUEST['ignore_layer'])) { foreach ($_REQUEST['ignore_layer'] as $layerId) { $ignoreLayer[$layerId] = $layerId; } } $cableLineType = []; if (isset($_REQUEST['cable_line_type'])) { foreach ($_REQUEST['cable_line_type'] as $cableLineTypeId) { $cableLineType[$cableLineTypeId] = $cableLineTypeId; } } $bundle = [ 'nodeType' => $nodeTypeData, 'cableLineType' => $cableLineType, 'planMode' => $planMode, 'plan2Mode' => $plan2Mode, 'is_planned' => RequestData::customBooleanOld('state_0'), 'is_not_planned' => RequestData::customBooleanOld('state_1'), 'ignoreLayer' => $ignoreLayer, 'is_cable_route' => RequestData::customBooleanOld('is_cable_route'), 'is_cable_duct' => RequestData::customBooleanOld('is_cable_duct') ]; $data = ExportKml::createEIT($bundle); header("Content-Disposition: attachment; filename=\"" . date('Y-m-d H:i:s') . ' - ERP.kml' . "\""); echo $data; Central::exitPoint(); } private static function exportToKml(): string { OperatorAccess::verifyRight(OperatorAccess::RIGHT_SETTING); $content = ' 
            <a href="?core_section=settings_main&item_id=' . self::ITEM_4 . '"><i class="us-icon fa-chevron-left"></i>' . Lang::getPhrase( 1443 ) . '</a><br> 
            <div class="label_h2">' . Lang::getPhrase(5649) . ' (EIT)</div> 
            <div class="div_space"> 
                <a target=_blank href="https://www.mtitc.government.bg/bg/category/46/edinna-informacionna-tochka"><i class="us-icon us-icon-normal fa-globe"></i><i>EIT</i></a> 
                &middot; 
                <a target=_blank href="https://sipbg.gov.bg/SIP.Experts/"><i>SIP</i></a> 
            </div> 
 
            <form method="post" name="form1" action=""> 
                <input type="hidden" name="core_section" value="settings_main"> 
                <input type="hidden" name="action" value="export_to_kml_save"> 
                <div class="table_block"> 
                    <div class="item"> 
                        <div class="left_data"> 
                            ' . Lang::getPhrase(1437) . ': 
                        </div> 
                        <div> 
                            <input name="state_0" type="checkbox" value="1"> ' . Lang::getPhrase( 5546 ) . '<br> 
                            <input name="state_1" type="checkbox" value="1"> ' . Lang::getPhrase( 5253 ) . '<br> 
                        </div> 
                    </div> 
                    <div class="item"> 
                        <div class="left_data"> 
                            ' . Lang::getPhrase(5393) . ': 
                        </div> 
                        <div> 
 
                            <div class="div_space"> 
                                <b>' . Lang::getPhrase(5740) . '</b> 
                            </div> 
                            <input name="is_cable_route" type="checkbox" value="1"> ' . Lang::getPhrase( 5614 ) . '<br> 
                            <input name="is_cable_duct" type="checkbox" value="1"> ' . Lang::getPhrase( 5092 ) . '<br> 
                            <div class="div_space"> 
                                <b>' . Lang::getPhrase(5741) . '</b> 
                            </div>'; $nodeTypes = NodeTypeAR::find() ->orderBy(NodeTypeAR::F_POSITION) ->all(); foreach ($nodeTypes as $nodeType) { $content .= ' 
                            <input name="node' . $nodeType->getId( ) . '" type="checkbox" value="1"> ' . NodeTypeCache::getName($nodeType->getId()) . '<br>'; } $cableLineTypes = CableLineTypeAR::find() ->orderBy(CableLineTypeAR::F_NAME) ->all(); foreach ($cableLineTypes as $cableLineType) { $content .= ' 
                            <input name="cable_line_type[]" type="checkbox" value="' . $cableLineType->getId( ) . '"> ' . CableLineTypeCache::getName($cableLineType->getId()) . '<br>'; } $content .= ' 
                        </div> 
                    </div> 
                    <div class="item"> 
                        <div class="left_data"> 
                            ' . Lang::getPhrase(5394) . ': 
                        </div> 
                        <div> 
                            <div class="div_space"> 
                                <b>' . Lang::getPhrase(3752) . '</b> 
                            </div>'; $arrayMark = TagAR::find() ->orderBy(TagAR::F_NAME) ->indexBy(TagAR::F_ID) ->asArray() ->all(); foreach ($arrayMark as $tempId => $value) { $content .= ' 
                            <input name="ignore_layer[]" type="checkbox" value="' . $tempId . '"> ' . TagCache::getNameById( $tempId ) . '<br>'; } $content .= ' 
                        </div> 
                    </div> 
                </div> 
                ' . BodyHtml::formButton('save', '', Lang::getPhrase(1414) ) . ' 
            </form>'; return $content; } private static function diag(): string { OperatorAccess::verifyRight(OperatorAccess::RIGHT_SETTING); $content = ' 
            <div class="div_space"> 
                <a href="?core_section=' . BodyHtml::SECTION_SETTINGS_PROFILE . '"><i class="us-icon fa-bars"></i>ERP Profile</a>             
            </div> 
            <div class="label_h2">DIAG</div> 
            <div class="div_space"> 
                <a id="linkWebSocketId" href="?core_section=settings_main&action=diag_web_socket&msg=test"><i class="us-icon fa-bars"></i>webSocket</a>             
            </div> 
            <div class="div_space"> 
                <a id="linkNotifyId" href="?core_section=settings_main&action=diag_notify&phone=380671234567&caller_id=TestCaller"><i class="us-icon fa-bars"></i>operNotify</a>             
            </div> 
            <div class="div_space"> 
                <a id="linkDeleteUnusedAddressId" href="?core_section=settings_main&action=diag_delete_unuse_address"><i class="us-icon fa-bars"></i>deleteUnusedAddress</a>             
            </div> 
            <div class="div_space"> 
                <a id="linkReloadAddressId" href="?core_section=settings_main&action=diag_reload_building_address"><i class="us-icon fa-bars"></i>reloadBuildingAddress</a>             
            </div> 
            <div class="div_space"> 
                <a id="linkFromAddressToAddressId" href="?core_section=settings_main&action=diag_merge_addresses"><i class="us-icon fa-bars"></i>mergeAddresses</a>             
            </div> 
            <div class="div_space"> 
                <a id="linkSystemStatId" href="?core_section=settings_main&action=diag_system_stat"><i class="us-icon fa-bars"></i>systemStat</a>             
            </div> 
            <div class="div_space"> 
                <a id="linkDBInfoId" href="?core_section=settings_main&action=diag_db_info"><i class="us-icon fa-bars"></i>dbInfo</a>             
            </div> 
            <div class="div_space"> 
                <a id="linkFlushRedisCache" href="?core_section=settings_main&action=diag_flush_redis_cache"><i class="us-icon fa-bars"></i>flushRedisCache</a>             
            </div> 
            <div class="div_space"> 
                <a id="checkErrorPage" href="?core_section=' . BodyHtml::SECTION_SETTINGS_MAIN . '&action=' . self::A_CHECK_ERROR_PAGE . '"><i class="us-icon fa-bars"></i>checkErrorPage</a>             
            </div> 
            <div class="div_space"> 
                <a id="linkNotifLogId" href="?core_section=settings_main&action=var_log&file_type=notifications&limit=100"><i class="us-icon fa-bars"></i>/var/log/notifications.log</a>'; $fileName = realpath(__DIR__) . '/../../../../var/log/notifications.log'; if (file_exists($fileName) == false) { $content .= ' <i>(n/a)</i>'; } else { $content .= ' <i>(' . filesize($fileName) . ')</i>'; } $content .= ' 
            </div> 
            <br>'; $content .= SettingsHtml::propertyDialog( SettingsCatalog::IS_LOG_ASTERISK, 'VALUEINT', 'Is Log Asterisk' ); $content .= ' 
            <div class="table_block"> 
                <div class="item"> 
                    <div class="left_data"> 
                        MainUrl: 
                    </div> 
                    <div> 
                        ' . getenv('US_URL') . ' 
                    </div> 
                </div>             
                <div class="item"> 
                    <div class="left_data"> 
                        OS: 
                    </div> 
                    <div> 
                        ' . PHP_OS . ' 
                    </div> 
                </div> 
                <div class="item"> 
                    <div class="left_data"> 
                        PHP: 
                    </div> 
                    <div> 
                        ' . PHP_VERSION; ob_start(); phpinfo(); $phpInfoData = ob_get_contents(); ob_get_clean(); $temp = explode('Loaded Configuration File </td><td class="v">', $phpInfoData); if (isset($temp[1])) { $temp = $temp[1]; $temp = explode('</td>', $temp); $iniPath = trim($temp[0]); $content .= '<br>' . $iniPath; } $postgesTime = '1970-01-01'; $stmt = Yii::$app->db->masterPdo->prepare("SELECT now()"); $stmt->execute(); while ($value = $stmt->fetch(PDO::FETCH_ASSOC)) { $postgesTime = date('d.m.Y H:i:s', strtotime($value['now'])); } $postgresVersion = ''; $stmt = Yii::$app->db->masterPdo->prepare("SELECT VERSION()"); $stmt->execute(); while ($value = $stmt->fetch(PDO::FETCH_ASSOC)) { $postgresVersion = $value['version']; } if (1 === RequestData::customInt('is_redis')) { echo print_r(RedisCache::getKeyList('*'), true); exit; } $content .= ' 
                    </div> 
                </div> 
                <div class="item"> 
                    <div class="left_data"> 
                        Postgres: 
                    </div> 
                    <div> 
                        ' . $postgresVersion . '<br> 
                        ' . Yii::$app->db->dsn . '<br> 
                    </div> 
                </div> 
                <div class="item"> 
                    <div class="left_data"> 
                        Redis: 
                    </div> 
                    <div> 
                        keys: ' . count(RedisCache::getKeyList('*')) . ' 
                    </div> 
                </div> 
                <div class="item"> 
                    <div class="left_data"> 
                        Date: 
                    </div> 
                    <div> 
                        cli (cron): ' . date( 'd.m.Y H:i:s', strtotime(SettingAR::getByNameString(SettingsCatalog::CRON_SCRIPT)) ) . '<br> 
                        cli: ' . date('d.m.Y H:i:s') . '<br> 
                        DB: ' . $postgesTime . '<br> 
                        act: ' . Central::$dateCustomerActiveUnix . ' / ' . date( 'd.m.Y H:i:s', Central::$dateCustomerActiveUnix ) . '<br> 
                        act_e: ' . Central::$dateDeviceActiveUnix . ' / ' . date( 'd.m.Y H:i:s', Central::$dateDeviceActiveUnix ) . ' 
                    </div> 
                </div> 
                <div class="item"> 
                    <div class="left_data"> 
                        Path: 
                    </div> 
                    <div> 
                        ' . $_SERVER["SCRIPT_FILENAME"] . ' 
                    </div> 
                </div> 
                <div class="item"> 
                    <div class="left_data"> 
                        Memory: 
                    </div> 
                    <div> 
                        ' . ini_get("memory_limit") . ' 
                    </div> 
                </div> 
                <div class="item"> 
                    <div class="left_data"> 
                        Table: 
                    </div> 
                    <div>'; $stmt = Yii::$app->db->masterPdo->prepare( " 
            SELECT  
                p1.relname AS table_name, 
                p1.reltuples::bigint AS row_count 
            FROM  
                 pg_catalog.pg_class AS p1  
            INNER JOIN  
                information_schema.tables AS t1  
            ON 
                t1.table_name = p1.relname 
            AND  
                t1.table_schema = 'erp' 
            ORDER BY  
                 p1.reltuples DESC  
             LIMIT 10" ); $stmt->execute(); while ($value = $stmt->fetch(PDO::FETCH_ASSOC)) { $content .= $value['table_name'] . ': ~ ' . $value['row_count'] . '<br>'; } $content .= ' 
                    </div> 
                </div> 
                <div class="item"> 
                    <div class="left_data"> 
                        Logs: 
                    </div> 
                    <div>'; foreach (self::LOGS_ARRAY as $value) { $fileSrc = realpath(__DIR__) . '/../../../../var/log/' . $value . '.log'; if (file_exists($fileSrc) === true) { $sizeSrc = filesize($fileSrc); $dateSrc = filemtime($fileSrc); $content .= ' 
                        <div class="div_space"> 
                            <a id="linkShowLog' . $value . 'Id" href="?core_section=' . BodyHtml::SECTION_SETTINGS_MAIN . '&action=' . self::A_SHOW_LOG . '&type=' . $value . '">' . $value . '</a> (' . $sizeSrc . ' - ' . date( 'd.m.Y H:i:s', $dateSrc ) . ') 
                        </div>'; } } $content .= ' 
                    </div> 
                </div> 
                <div class="item"> 
                    <div class="left_data"> 
                        Rabbit queues: 
                    </div> 
                    <div> 
                        <script> 
                            function showQueues() { 
                                $("#queuesListId").show(); 
                                $("#linkShowQueId").hide(); 
                            } 
                        </script> 
                        <a class="link_dashed" href="javascript:showQueues();"><span id="linkShowQueId">show</span></a> 
                        <span id="queuesListId" style="display: none">'; try { $rabbitCollector = \Yii::$container->get(RabbitMqCollector::class); $queuesArray = []; foreach ($rabbitCollector->queues() as $queue) { $queuesArray[] = [$queue->name, $queue->consumers, $queue->messages, $queue->consumerCapacity]; } $queuesArray = Central::sort( data: $queuesArray, sortElement: 0, isSortAbc: true ); foreach ($queuesArray as $value) { $content .= ' 
                    <div class="div_space2"> 
                        ' . $value[0] . ' | consumers: ' . $value[1] . ' | messages: ' . $value[2] . ' | consumerCapacity: ' . $value[3] . '% 
                    </div>'; } } catch (Exception $e) { $content .= ' 
                    <div class="div_space2"> 
                        ' . $e->getMessage() . ' 
                    </div>'; } $content .= ' 
                        </span> 
                    </div> 
                </div> 
                <div class="item"> 
                    <div class="left_data"> 
                        usm_poller: 
                    </div> 
                    <div> 
                        <script> 
                            function showServiceStatusLog() { 
                                $("#serviceStatusLogId").show(); 
                                $("#linkserviceStatusLogId").hide(); 
                            } 
                        </script> 
                        <a class="link_dashed" href="javascript:showServiceStatusLog();"><span id="linkserviceStatusLogId">show</span></a> 
                        <span id="serviceStatusLogId" style="display: none">'; $repo = Yii::$container->get(ExternalServiceRepository::class); $serviceLog = $repo->getAllPaginated( page: 1, pageSize: 50 ); $serviceStatusesDto = $serviceLog->getItems(); foreach ($serviceStatusesDto as $serviceStatus) { $content .= $serviceStatus->version . ' | '; $content .= $serviceStatus->status . ' | '; $content .= date('Y-m-d H:i:s', $serviceStatus->time) . '<br>'; } $content .= ' 
                        </span> 
                    </div> 
                </div> 
                <div class="item"> 
                    <div class="left_data"> 
                        Building double: 
                    </div> 
                    <div>'; $isGood = true; $addressBuildingArray = BuildingAR::find() ->select( [ 'unit_id' => BuildingAR::F_ADDRESS_UNIT_ID, 'building_list' => 'ARRAY_AGG(' . BuildingAR::F_ID . ')', 'counter' => 'COUNT(*)' ] ) ->groupBy(BuildingAR::F_ADDRESS_UNIT_ID) ->asArray() ->all(); foreach ($addressBuildingArray as $value) { if ($value['counter'] > 1) { $isGood = false; $content .= ' 
                    <div class="div_space2"> 
                        AddressUnitId: ' . $value['unit_id'] . ' (count: ' . $value['counter'] . ') | ' . $value['building_list'] . ' 
                    </div>'; } } if ($isGood === true) { $content .= 'OK'; } $content .= ' 
                    </div> 
                </div> 
                <div class="item"> 
                    <div class="left_data"> 
                        Inventory on lost Warehouse: 
                    </div> 
                    <div>'; $inventories = InventoryAR::find() ->leftJoin( WarehouseAR::tableName() . ' AS w', InventoryAR::F_ACCOUNT_OBJECT_ID . ' = w.' . WarehouseAR::F_ID ) ->where( [ InventoryAR::F_ACCOUNT_TYPE => InventoryAR::ACCOUNT_WAREHOUSE ] ) ->andWhere('w.' . WarehouseAR::F_ID . ' IS NULL') ->all(); if (count($inventories) < 1) { $content .= "OK"; } else { foreach ($inventories as $inventory) { $url = $inventory->getUrl(); $content .= ' 
                    <div class="div_space"> 
                        <a href="' . $url . '"> #' . $inventory->getId() . '</a> (' . $inventory->getAccountObjectId() . ') 
                    </div>'; } } $content .= ' 
                    </div> 
                </div> 
                <div class="item"> 
                    <div class="left_data"> 
                        Device lost INVENTORY: 
                    </div> 
                    <div>'; $data = []; $devices = DeviceAR::find() ->leftJoin(InventoryAR::tableName() . ' AS i', DeviceAR::F_INVENTORY_ID . ' = i.' . InventoryAR::F_ID) ->where(DeviceAR::F_INVENTORY_ID . ' IS NOT NULL') ->andWhere( ' 
                    i.' . InventoryAR::F_ID . ' IS NULL 
                OR 
                    COALESCE(' . DeviceAR::F_INVENTORY_ID . ', 0) = 0 
                OR 
                    i.' . InventoryAR::F_ACCOUNT_TYPE . ' NOT IN (' . InventoryAR::ACCOUNT_CUSTOMER . ',' . InventoryAR::ACCOUNT_NODE . ') 
                OR 
                    ( 
                        i.' . InventoryAR::F_ACCOUNT_TYPE . ' = ' . InventoryAR::ACCOUNT_CUSTOMER . ' 
                    AND 
                        i.' . InventoryAR::F_ACCOUNT_OBJECT_ID . ' <> ' . DeviceAR::F_CUSTOMER_ID . ' 
                    ) 
                OR 
                    ( 
                        i.' . InventoryAR::F_ACCOUNT_TYPE . ' = ' . InventoryAR::ACCOUNT_NODE . ' 
                    AND 
                        i.' . InventoryAR::F_ACCOUNT_OBJECT_ID . ' <> ' . DeviceAR::F_NODE_ID . ' 
                    ) 
                    ' ) ->all(); if (Html::$isDebug === true) { echo "inventory - start - " . BodyHtml::show_usage_mem() . "\n\n"; } foreach ($devices as $device) { $data[$device->getId()] = true; if ($device->getInventoryId() > 0) { $inventory = InventoryAR::findOne($device->getInventoryId()); $url = $inventory->getUrl(); $urlCaption = $device->getInventoryId(); } else { $url = $device->getUrl(); $urlCaption = 'n/a'; } $content .= ' 
                <div class="div_space"> 
                    inventory:  
                    <a href="' . $url . '"> ' . $urlCaption . '</a> 
                    -  
                    <a href="' . $device->getUrl() . '"> ' . $device->getName() . '</a> '; if ($device->getInventoryId() < 1) { $content .= ' - Unknown Inventory ID ' . $device->getInventoryId(); } else { $content .= ' 
                    - 
                    <a id="linkRepairInvDevice' . $device->getId( ) . 'Id" href="?core_section=settings_main&action=repair_inventory_device&id=' . $device->getId( ) . '">repair</a>'; } $content .= ' 
                </div>'; } if (Html::$isDebug === true) { echo "inventory - finish - " . BodyHtml::show_usage_mem() . "\n\n"; } if (1 > count($data)) { $content .= 'OK'; } $content .= ' 
                    </div> 
                </div> 
                <div class="item"> 
                    <div class="left_data"> 
                        inventory lost Device - Inventory ID: 
                    </div> 
                    <div>'; $inventorySectionArray = InventorySectionAR::find() ->where( [ InventorySectionAR::F_TYPE_ID => [ InventorySectionAR::T_1_SWITCH, InventorySectionAR::T_2_RADIO, InventorySectionAR::T_16_CUSTOM ] ] ) ->indexBy(InventorySectionAR::F_ID) ->asArray() ->all(); $inventoryAssortArrayList = Central::getArrayListForAR( InventoryAssortmentAR::find() ->where( [ InventoryAssortmentAR::F_INVENTORY_SECTION_ID => Central::getArrayListForAR( $inventorySectionArray ) ] ) ->indexBy(InventoryAssortmentAR::F_ID) ->asArray() ->all() ); if (true === Html::$isDebug) { echo Central::getResourceInfo(); echo "InventoryAR-0\n"; } $arrayTemp = []; $arrayDevice = DeviceAR::find() ->where(DeviceAR::F_INVENTORY_ID . ' > 0') ->indexBy(DeviceAR::F_INVENTORY_ID) ->asArray() ->all(); if (true === Html::$isDebug) { echo Central::getResourceInfo(); echo "InventoryAR-0.5\n"; } foreach ($arrayDevice as $tempInventoryId => $value) { $arrayTemp[$tempInventoryId] = $tempInventoryId; } $inventoriesArray = InventoryAR::find() ->select( [ 'id' => InventoryAR::F_ID, 'inventory_assortment_id' => InventoryAR::F_INVENTORY_ASSORTMENT_ID, ] ) ->where( [ InventoryAR::F_ACCOUNT_TYPE => [ InventoryAR::ACCOUNT_NODE, InventoryAR::ACCOUNT_CUSTOMER ], InventoryAR::F_INVENTORY_ASSORTMENT_ID => $inventoryAssortArrayList ] ) ->orderBy(InventoryAR::F_ID) ->asArray() ->all(); foreach ($inventoriesArray as $i => $value) { if (isset($arrayTemp[$value['id']])) { unset($inventoriesArray[$i]); } } if (true === Html::$isDebug) { echo Central::getResourceInfo(); echo 'InventoryAR-1 | ' . count($inventories) . "\n"; } if (1 > count($inventoriesArray)) { $content .= 'OK'; } else { $tempCount = 0; foreach ($inventoriesArray as $value) { ++$tempCount; $content .= ' 
                        <div class="div_space"> 
                            inventory: ' . $value['id'] . '  
                            - <a href="' . InventoryAR::getUrlById( $value['id'] ) . '">' . InventoryAssortmentCache::getName( $value['inventory_assortment_id'] ) . '</a> 
                            - 
                            <a id="linkRepairInventoryReload' . $value['id'] . 'Id" href="?core_section=settings_main&action=repair_inventory_reload&id=' . $value['id'] . '">repair</a>'; if ($tempCount < RequestData::customInt('realy')) { $content .= '(result: ' . self::repairInventoryReloadBody($value['id']) . ')'; } $content .= ' 
                        </div>'; } } $content .= ' 
                    </div> 
                </div> 
                <div class="item"> 
                    <div class="left_data"> 
                        ,    ,      : 
                    </div> 
                    <div>'; $inventories = InventoryAR::find() ->where( InventoryAR::F_ACCOUNT_TYPE . " <> " . InventoryAR::ACCOUNT_NODE . " 
                and 
                    " . InventoryAR::F_ACCOUNT_TYPE . " <> " . InventoryAR::ACCOUNT_CUSTOMER . " 
                and 
                    " . InventoryAR::F_ID . " IN (" . Central::getArrayList($arrayTemp) . ")" ) ->andWhere( [ InventoryAR::F_INVENTORY_ASSORTMENT_ID => $inventoryAssortArrayList ] ) ->all(); if (true === Html::$isDebug) { echo Central::getResourceInfo(); echo 'InventoryAR-2 | ' . count($inventories) . "\n"; } if (1 > count($inventories)) { $content .= 'OK'; } else { $tempCount = 0; foreach ($inventories as $inventory) { ++$tempCount; $device = DeviceAR::find() ->where( [ DeviceAR::F_INVENTORY_ID => $inventory->getId() ] ) ->one(); if ($device) { $deviceTempId = $device->getId(); } else { $deviceTempId = 0; } $content .= ' 
                        <div class="div_space"> 
                            inventory: ' . $inventory->getId() . '  
                            - <a href="' . $inventory->getUrl() . '">' . InventoryAssortmentCache::getName( $inventory->getInventoryAssortmentId() ) . '</a> 
                            - DEVICE: <a href="' . DeviceAR::url($deviceTempId) . '">' . DeviceAR::getFullNameById( $deviceTempId ) . '</a> 
                            - 
                            <a href="?core_section=settings_main&action=repair_inventory_reload&id=' . $inventory->getId( ) . '&is_delete=1" onclick="return confirm(\'Yes?\'); return true;">repair</a>'; if ($tempCount < RequestData::customInt('realy')) { $content .= '(result: ' . self::repairInventoryReloadBody($inventory->getId(), 1) . ')'; } $content .= ' 
                        </div>'; } } $content .= ' 
                    </div> 
                </div> 
                <div class="item"> 
                    <div class="left_data"> 
                        inventory lost Customer: 
                    </div> 
                    <div>'; $arrayCustomer = CustomerAR::find() ->select( [ 'id' => CustomerAR::F_ID ] ) ->indexBy('id') ->asArray() ->all(); $inventories = InventoryAR::find() ->where( [ InventoryAR::F_ACCOUNT_TYPE => InventoryAR::ACCOUNT_CUSTOMER ] ) ->all(); foreach ($inventories as $i => $inventory) { if (isset($arrayCustomer[$inventory->getAccountObjectId()])) { unset($inventories[$i]); } } if (1 > count($inventories)) { $content .= 'OK'; } else { foreach ($inventories as $inventory) { $content .= ' 
                    <div class="div_space"> 
                        inventory: ' . $inventory->getId() . ' - <a href="' . $inventory->getUrl( ) . '">' . InventoryAssortmentCache::getName($inventory->getInventoryAssortmentId()) . '</a> 
                        - 
                        <a id="linkRepairInventory' . $inventory->getId( ) . 'Id" href="?core_section=settings_main&action=repair_inventory&id=' . $inventory->getId() . '">repair</a> 
                    </div>'; } } $content .= ' 
                    </div> 
                </div> 
                <div class="item"> 
                    <div class="left_data"> 
                           : 
                    </div> 
                    <div>'; $splittersArray = SplitterAR::find() ->select( [ 'id' => SplitterAR::F_ID, 'inventory_id' => SplitterAR::F_INVENTORY_ID ] ) ->where( ['>', 'inventory_id', 0] ) ->indexBy('inventory_id') ->asArray() ->all(); $inventories = InventoryAR::find() ->where( [ InventoryAR::F_ID => Central::getArrayListForAR($splittersArray) ] ) ->all(); foreach ($inventories as $i => $inventory) { if ( $inventory->getAccountType() == InventoryAR::ACCOUNT_NODE && $inventory->getAmount() == 1 ) { unset($inventories[$i]); } } if (1 > count($inventories)) { $content .= 'OK'; } else { $tempCount = 0; foreach ($inventories as $inventory) { ++$tempCount; $content .= ' 
                    <div class="div_space"> 
                        ' . $tempCount . '. Inventory: ' . $inventory->getId() . ' - <a href="' . $inventory->getUrl( ) . '">' . InventoryAssortmentCache::getName($inventory->getInventoryAssortmentId()) . '</a> 
                        - 
                        <a href="?core_section=' . BodyHtml::SECTION_SPLITTER . '&action=' . SplitterHtml::A_SHOW . '&id=' . $splittersArray[$inventory->getId( )]['id'] . '">Splitter</a> 
                    </div>'; } } $content .= ' 
                    </div> 
                </div> 
                <div class="item"> 
                    <div class="left_data"> 
                          ""   : 
                    </div> 
                    <div>'; $tempArray = InventorySectionAR::find() ->where( [ InventorySectionAR::F_TYPE_ID => InventorySectionAR::T_4_SPLIT ] ) ->indexBy(InventorySectionAR::F_ID) ->asArray() ->all(); $tempArray2 = InventoryAssortmentAR::find() ->where( [ InventoryAssortmentAR::F_INVENTORY_SECTION_ID => Central::getArrayListForAR($tempArray) ] ) ->indexBy(InventoryAssortmentAR::F_ID) ->asArray() ->all(); $inventoriesArray = InventoryAR::find() ->where( [ InventoryAR::F_INVENTORY_ASSORTMENT_ID => Central::getArrayListForAR($tempArray2), InventoryAR::F_ACCOUNT_TYPE => InventoryAR::ACCOUNT_NODE ] ) ->indexBy(InventoryAR::F_ID) ->asArray() ->all(); $splittersArray = SplitterAR::find() ->select( [ 'id' => SplitterAR::F_ID, 'inventory_id' => SplitterAR::F_INVENTORY_ID ] ) ->where( ['>', 'inventory_id', 0] ) ->indexBy('inventory_id') ->asArray() ->all(); foreach ($splittersArray as $tempId => $value) { unset($inventoriesArray[$tempId]); } if (1 > count($inventoriesArray)) { $content .= 'OK'; } else { $tempCount = 0; foreach ($inventoriesArray as $tempId => $value) { ++$tempCount; $content .= ' 
                    <div class="div_space"> 
                        ' . $tempCount . '. TMC: ' . $tempId . ' - <a href="' . InventoryAR::getUrlById( $tempId ) . '">#' . $tempId . '</a>'; if ($value[InventoryAR::F_AMOUNT] < 2) { $content .= ' 
                     - 
                        <a id="linkRepairSplitNode' . $tempId . 'Id" href="?core_section=settings_main&action=repair_inv_splitter_to_node&id=' . $tempId . '">repair</a>'; } else { $content .= ' (' . $value[InventoryAR::F_AMOUNT] . ' .)'; } $content .= ' 
                    </div>'; } } $content .= ' 
                    </div> 
                </div> 
                <div class="item"> 
                    <div class="left_data"> 
                            : 
                    </div> 
                    <div>'; $cableLineArray = CableLineAR::find() ->where(['IS', CableLineAR::F_NODE2_ID, null]) ->andWhere(['IS', CableLineAR::F_BUILDING2_ID, null]) ->andWhere(['IS', CableLineAR::F_CUSTOMER2_ID, null]) ->indexBy(CableLineAR::F_ID) ->asArray() ->all(); if (1 > count($cableLineArray)) { $content .= 'OK'; } else { $tempCount = 0; foreach ($cableLineArray as $tempId => $value) { ++$tempCount; $content .= ' 
                    <div class="div_space"> 
                        ' . $tempCount . '. <a href="' . CableLineAR::url($tempId) . '">#' . $tempId . '</a> 
                    </div>'; } } $content .= ' 
                    </div> 
                </div> 
            </div>'; return $content; } private static function deviceAutocommutationOn(): void { OperatorAccess::verifyRight(OperatorAccess::RIGHT_SETTING); DeviceIfaceAutoLearningAR::removeAll(); $data = DeviceAR::find() ->alias('s') ->select( [ 's.' . DeviceAR::F_ID . ' AS id', 's.' . DeviceAR::F_IFACE_COUNT . ' AS port' ] ) ->join( 'INNER JOIN', IpAddressFetcher::TABLE_NAME . ' AS i', 'i.' . IpAddressDto::F_DEVICE_ID . ' = s.' . DeviceAR::F_ID ) ->leftJoin( InventoryAR::tableName() . ' as i2', 'i2.' . InventoryAR::F_ID . ' = s.' . DeviceAR::F_INVENTORY_ID ) ->leftJoin( InventoryAssortmentAR::tableName() . ' as ia', 'ia.' . InventoryAssortmentAR::F_ID . ' = i2.' . InventoryAR::F_INVENTORY_ASSORTMENT_ID ) ->leftJoin( InventorySectionAR::tableName() . ' as iss', 'iss.' . InventorySectionAR::F_ID . ' = ia.' . InventoryAssortmentAR::F_INVENTORY_SECTION_ID ) ->where( [ 'iss.' . InventorySectionAR::F_TYPE_ID => InventorySectionAR::T_1_SWITCH ] ) ->indexBy('id') ->asArray() ->all(); foreach ($data as $deviceId => $value) { for ($i = 1; $i <= $value['port']; ++$i) { DeviceIfaceAutoLearningAR::create($deviceId, $i); } } EmployeeActionLogSystem::writeLogWithZeroTypeId(EmployeeHistoryType::T255); Html::locationBackOk(); } private static function sql(): string { OperatorAccess::verifyRight(OperatorAccess::RIGHT_SETTING); if (true === Central::$isDemo) { $command = ''; } else { $command = $_POST['command'] ?? ''; } $content = ' 
            <a href="?core_section=settings_main&item_id=' . self::ITEM_99 . '"><i class="us-icon fa-chevron-left"></i>' . Lang::getPhrase( 1443 ) . '</a><br> 
            <div class="label_h2">' . Lang::getPhrase(3281) . '</div> 
            <form name="form_attach" method="post" action=""> 
                <input type="hidden" name="core_section" value="settings_main"> 
                <input type="hidden" name="action" value="sql"> 
                <div class="gray_block"> 
                    <div style="float: right; margin-top: 20px;"> 
                        ' . BodyHtml::formButton('save', '', Lang::getPhrase(1414) ) . ' 
                    </div> 
                    <div style="margin-right: 120px;"> 
                        <span class="label_h3">' . Lang::getPhrase(3278) . '</span> 
                        <div class="table_block" style="margin-top: 0px;"> 
                            <div class="item"> 
                                <div class="left_data"> 
                                    ' . Lang::getPhrase(3280) . ':  
                                </div> 
                                <div> 
                                    <input type="text" id="commandId" name="command" size="80" class="input_field" value="' . $command . '"> 
                                </div> 
                            </div> 
                        </div> 
                    </div> 
                </div> 
            </form>'; if ('' != $command) { EmployeeActionLogSystem::writeLogWithZeroTypeId( EmployeeHistoryType::T449, 0, 0, mb_substr($command, 0, 50) ); if (0 == stripos($command, 'elect', 0)) { try { Yii::$app->db->masterPdo->query($command); $content .= ' 
                        <div class="div_space div_bold green_text"> 
                            ' . Lang::getPhrase(3282) . ' 
                        </div>'; } catch (Exception $e) { echo '<pre>'; echo $e->getMessage(); echo '</pre>'; Central::exitPoint(); } } else { $bundle = []; try { $bundle = Yii::$app->db->masterPdo->query($command, PDO::FETCH_ASSOC); if (!is_bool($bundle)) { $bundle = $bundle->fetchAll(); } } catch (Exception $e) { echo '<pre>'; echo $e->getMessage(); echo '</pre>'; Central::exitPoint(); } $content .= ' 
                    <div class="div_space"> 
                        ' . Lang::getPhrase(3283) . ': <b>' . count($bundle) . '</b> 
                    </div>'; if (0 < count($bundle)) { foreach ($bundle as $i => $value) { foreach ($value as $j => $value2) { if ($bundle[$i][$j] === null) { $bundle[$i][$j] = ''; } $bundle[$i][$j] = str_replace('<', '&lt;', $bundle[$i][$j]); $bundle[$i][$j] = str_replace('>', '&gt;', $bundle[$i][$j]); if ( ( 'log_time' == $j || 'created_at' == $j || 'accepted_at' == $j ) && '' != $bundle[$i][$j] ) { $bundle[$i][$j] .= '<br><b>' . date('d.m.Y H:i:s', $bundle[$i][$j]) . '</b>'; } } } $arrayFields = []; foreach ($bundle[0] as $i => $value) { $arrayFields[] = [ 'EL' => $i, 'NAME' => $i ]; } $table = new Table(); $content .= $table->show($bundle, $arrayFields); } } } return $content; } private static function phpinfo(): void { OperatorAccess::verifyRight(OperatorAccess::RIGHT_SETTING); echo phpinfo(); Central::exitPoint(); } private static function verifikFiles(): string { OperatorAccess::verifyRight(OperatorAccess::RIGHT_SETTING); $content = ' 
            <a href="?core_section=settings_main&item_id=' . self::ITEM_99 . '"><i class="us-icon fa-chevron-left"></i>' . Lang::getPhrase( 1443 ) . '</a><br> 
            <div class="label_h2">' . Lang::getPhrase(3288) . '</div> 
            ver: <b>' . Central::$currentVer . '</b><br>'; $responce = self::verifikator(); if ('ERROR' == $responce['result']) { $content .= ' 
                    <div class="div_bold red_text div_space"> 
                        ' . $responce['error_text'] . ' 
                    </div>'; } else { if (0 < count($responce['ArrayBad'])) { $content .= ' 
                    <div class="label_h3 red_text"> 
                        ' . Lang::getPhrase(3292) . ' 
                    </div>'; $field = [ [ 'SPECIAL' => '_number' ], [ 'NAME' => Lang::getPhrase(3293), 'EL' => 'name' ], [ 'NAME' => Lang::getPhrase(3295), 'ALIGN' => 'right', 'CONVERT' => 'floor2', 'EL' => 'size' ], [ 'NAME' => Lang::getPhrase(3297), 'CONVERT' => 'daten', 'EL' => 'date' ] ]; $table = new Table(); $table->sortDefault = 'name'; $table->isSortDefaultAbc = 1; $content .= $table->show($responce['ArrayBad'], $field); } $content .= ' 
                ' . Lang::getPhrase(3298) . ': <b>' . (count( $responce['ArrayGood'] ) + count($responce['ArrayBad'])) . '</b><br> 
                ' . Lang::getPhrase(3299) . ': <b>' . count($responce['ArrayGood']) . '</b><br> 
                ' . Lang::getPhrase(3300) . ': <b>' . count($responce['ArrayBad']) . '</b><br>'; } return $content; } private static function verifikator(): array { $arrayBad = []; $arrayGood = []; $filename = realpath(__DIR__) . '/../../../../.checksum'; if (file_exists($filename) == false) { return [ 'result' => 'ERROR', 'error_text' => Lang::getPhrase( 3290 ) . ' ' . $filename . '<br>' . Lang::getPhrase( 3291 ) ]; } else { $file = fopen($filename, "r"); while (!feof($file)) { $string = trim(fgets($file)); if (strlen($string) > 32) { $crc = substr($string, 0, 32); $filePath = trim(substr($string, 33, strlen($string))); if ('/.release' != $filePath) { $fileSrc = realpath(__DIR__) . '/../../../..' . $filePath; if (file_exists($fileSrc) == false) { $sizeSrc = 0; $dateSrc = 0; $crcSrc = ''; } else { $sizeSrc = filesize($fileSrc); $dateSrc = filemtime($fileSrc); $crcSrc = md5(file_get_contents($fileSrc)); } if ($crcSrc != $crc) { $arrayBad[] = [ 'name' => $filePath, 'size' => $sizeSrc, 'date' => date('Y-m-d H:i:s', $dateSrc) ]; } else { $arrayGood[] = [ 'name' => $filePath . ' - OK', 'size' => $sizeSrc, 'date' => date('Y-m-d H:i:s', $dateSrc) ]; } } } } fclose($file); } return [ 'result' => 'OK', 'ArrayGood' => $arrayGood, 'ArrayBad' => $arrayBad ]; } private static function objectMarkDelete(): void { if (Central::$isUSOnline === false) { OperatorAccess::verifyRight(OperatorAccess::RIGHT_SETTING); } $id = RequestData::$id; if ( Central::$isUSOnline === true && TagAR::findOne($id)->getAuthorEmployeeId() != Html::$currentEmployeeId ) { Html::locationForbidden(); } if (TagAR::findOne($id)->tryDelete() !== true) { Html::locationBackCancel(); } else { Html::location( '?core_section=' . BodyHtml::SECTION_SETTINGS_MAIN . '&action=' . self::A_OBJECT_MARK_PAGE, 'updok' ); } } private static function objectMarkSave(): void { if (Central::$isUSOnline === false) { OperatorAccess::verifyRight(OperatorAccess::RIGHT_SETTING); } $id = RequestData::$id; $name = RequestData::custom('name'); if ($id < 1) { $tag = TagAR::create($name); $id = $tag->getId(); } else { $tag = TagAR::findOne($id); } if ( Central::$isUSOnline === true && $tag->getAuthorEmployeeId() !== Html::$currentEmployeeId ) { Html::locationForbidden(); } $objectArray = TagsObjectTypesAR::getObjectListByTagId($id); $array = $_REQUEST['object_types'] ?? []; foreach ($array as $idx) { if (isset($objectArray[$idx])) { $objectArray[$idx]['is_use'] = true; } else { TagsObjectTypesAR::create($id, $idx); } } $array = $_REQUEST['object_type_nodes'] ?? []; foreach ($array as $objectTypeSecond) { $idx = TagObjectAR::OBJECT_TYPE_NODE . '-' . $objectTypeSecond; if (isset($objectArray[$idx])) { $objectArray[$idx]['is_use'] = true; } else { TagsObjectTypesAR::create( tagId: $id, objectType: TagObjectAR::OBJECT_TYPE_NODE, objectTypeSecond: $objectTypeSecond ); } } $array = $_REQUEST['object_type_cable_lines'] ?? []; foreach ($array as $objectTypeSecond) { $idx = TagObjectAR::OBJECT_TYPE_CABLE_LINE . '-' . $objectTypeSecond; if (isset($objectArray[$idx])) { $objectArray[$idx]['is_use'] = true; } else { TagsObjectTypesAR::create( tagId: $id, objectType: TagObjectAR::OBJECT_TYPE_CABLE_LINE, objectTypeSecond: $objectTypeSecond ); } } $array = $_REQUEST['object_type_devices'] ?? []; foreach ($array as $objectTypeSecond) { $idx = TagObjectAR::OBJECT_TYPE_DEVICE . '-' . $objectTypeSecond; if (isset($objectArray[$idx])) { $objectArray[$idx]['is_use'] = true; } else { TagsObjectTypesAR::create( tagId: $id, objectType: TagObjectAR::OBJECT_TYPE_DEVICE, objectTypeSecond: $objectTypeSecond ); } } foreach ($objectArray as $value) { if (!isset($value['is_use'])) { TagsObjectTypesAR::removeByObjectType( tagId: $id, objectType: $value['object_type'], objectTypeSecond: $value['object_type_second'] ); } } $lineType = RequestData::custom('property_line'); $color = RequestData::customColor('property_color'); if ('' != $color) { $color = '#' . $color; } $textColor = RequestData::customColor('property_text_color'); if ('' != $textColor) { $textColor = '#' . $textColor; } $styleArray = [ 'COLOR' => $color, 'TEXT_COLOR' => $textColor, 'LINE' => $lineType ]; $tag->edit( [ TagAR::F_NAME => $name, TagAR::F_IS_ON_MAP_BY_DEFAULT => RequestData::customBoolean('onmapdef'), TagAR::F_EXTERIOR => json_encode($styleArray) ] ); AttachHtml::save(AttachmentAR::TYPE_TAG, $id, 0, 1); EmployeeActionLogSystem::writeLog(EmployeeHistoryType::T376, TagAR::OBJECT_TYPE_ID, $id); Html::location( '?core_section=' . BodyHtml::SECTION_SETTINGS_MAIN . '&action=' . self::A_OBJECT_MARK_DIALOG_EDIT . '&id=' . $id, 'updok' ); } private static function useTagLabel(array $useArray, int $objectType, bool $isAdditional = false): string { if (isset($useArray[$objectType])) { $label = ' <i><b>(' . $useArray[$objectType]; if ($isAdditional === true) { $label .= '*'; } $label .= ')</b></i>'; return $label; } return ''; } private static function objectMarkDialogAddEdit(): string { if (Central::$isUSOnline === false) { OperatorAccess::verifyRight(OperatorAccess::RIGHT_SETTING); } $id = RequestData::$id; $property = []; if ($id > 0) { $property = TagCache::getStyle($id); $tag = TagAR::findOne($id); if ( Central::$isUSOnline === true && $tag->getAuthorEmployeeId() != Html::$currentEmployeeId ) { Html::locationForbidden(); } } else { $tag = new TagAR(); } $textColor = $property['TEXT_COLOR'] ?? ''; $color = $property['COLOR'] ?? ''; $lineType = $property['LINE'] ?? ''; $content = ' 
            <a href="?core_section=' . BodyHtml::SECTION_SETTINGS_MAIN . '&action=' . self::A_OBJECT_MARK_PAGE . '"><i class="us-icon fa-chevron-left"></i>' . Lang::getPhrase( 893 ) . '</a><br> 
            <br> 
            <span class="label_h2">' . Lang::getPhrase(3745) . '</span><br>'; if ($id > 0) { $imageId = TagCache::getImageById($id); if ($imageId > 0) { $content .= ' 
                        <br> 
                        <div class="div_center"> 
                            <img src="' . AttachmentAR::getViewUrl($imageId) . '" alt="' . Lang::getPhrase( 3018 ) . '"></a><br> 
                            <br>'; $content .= ' ' . BodyHtml::linkConfirm( '?core_section=settings_main&action=tag_delete_image&id=' . $id, Lang::getPhrase(1415), Lang::getPhrase(1150) . '?', '<i class="us-icon us-icon-danger fa-close"></i>' . Lang::getPhrase(1415) , 'linkConfirmDeleteTagImageId' ); $content .= ' 
                        </div>'; } } $content .= ' 
            <form name="form1" method="post" enctype="multipart/form-data" action=""> 
                <input type="hidden" name="core_section" value="' . BodyHtml::SECTION_SETTINGS_MAIN . '"> 
                <input type="hidden" name="action" value="' . self::A_OBJECT_MARK_SAVE . '"> 
                <input type="hidden" name="id" value="' . $id . '"> 
                <div class="table_block"> 
                    <div class="item"> 
                        <div class="left_data"> 
                            ' . Lang::getPhrase(1451) . ': 
                        </div> 
                        <div> 
                            <input name="name" type="text" size=30 maxlength=255 class="input_box" value=\'' . ($id > 0 ? TagCache::getNameById( $id ) : '') . '\'> 
                        </div> 
                    </div> 
                    <div class="item"> 
                        <div class="left_data"> 
                            ' . Lang::getPhrase(847) . ': 
                        </div> 
                        <div> 
                            <input type="file" name="attach_file[]"> 
                        </div> 
                    </div> 
                    <div class="item"> 
                        <div class="left_data"> 
                            ' . Lang::getPhrase(3748) . ': 
                        </div> 
                        <div> 
                            <script src="../main/js/icolorpicker.js?t=' . time() . '"></script> 
                            <input id="property_color_id" name="property_color" type="text" size=10 maxlength=7 class="input_field iColorPicker" value="' . $color . '"> 
                        </div> 
                    </div> 
                     <div class="item"> 
                        <div class="left_data"> 
                            ' . Lang::getPhrase(1110) . ':<br> 
                            <span class="info_block">' . Lang::getPhrase(6139) . '</span> 
                        </div> 
                        <div> 
                            <input id="property_text_color_id" name="property_text_color" type="text" size=10 maxlength=7 class="input_field iColorPicker" value="' . $textColor . '"> 
                        </div> 
                    </div> 
                    <div class="item"> 
                        <div class="left_data"> 
                            ' . Lang::getPhrase(5006) . ': 
                        </div> 
                        <div> 
                            <select name="onmapdef" size="1"> 
                                <option value="0"></option> 
                                <option value="1"'; if ($id > 0 && true === $tag->getIsOnMapByDefault()) { $content .= ' selected'; } $content .= '>' . Lang::getPhrase(5007) . '</option> 
                            </select> 
                        </div> 
                    </div> 
                    <div class="item"> 
                        <div class="left_data"> 
                            ' . Lang::getPhrase(3749) . ': 
                        </div> 
                        <div> 
                            <select name="property_line" size="1"> 
                                <option value="0">' . Lang::getPhrase(3750) . '</option> 
                                <option value="1"'; if (1 == $lineType) { $content .= ' selected'; } $content .= '>' . Lang::getPhrase(3751) . '</option> 
                                <option value="2"'; if (2 == $lineType) { $content .= ' selected'; } $content .= '>' . Lang::getPhrase(3761) . '</option> 
                            </select> 
                        </div> 
                    </div>'; $objectArray = TagsObjectTypesAR::getObjectListByTagId($id); $content .= ' 
                    <div class="item"> 
                        <div class="left_data"> 
                            ' . Lang::getPhrase(4339) . ': 
                        </div> 
                        <div>'; $useArray = []; $tempArray = TagObjectAR::find() ->where( [ TagObjectAR::F_TAG_ID => $id ] ) ->asArray() ->all(); foreach ($tempArray as $value) { $useArray[$value[TagObjectAR::F_OBJECT_TYPE]] = isset($useArray[$value[TagObjectAR::F_OBJECT_TYPE]]) ? ++$useArray[$value[TagObjectAR::F_OBJECT_TYPE]] : 1; } if (Central::$isUSOnline === false) { if (Central::$erpProfileChapters[ErpProfileDto::CHAPTER_CUSTOMER]) { $content .= ' 
                            <input name="object_types[]" type="checkbox" value="' . TagObjectAR::OBJECT_TYPE_CUSTOMER . '"'; if (isset($objectArray[TagObjectAR::OBJECT_TYPE_CUSTOMER])) { $content .= ' checked'; } $content .= '> ' . CustomerAR::classCaption() . self::useTagLabel( $useArray, TagObjectAR::OBJECT_TYPE_CUSTOMER ) . '<br>'; } if (Central::$erpProfileChapters[ErpProfileDto::CHAPTER_TASK]) { $content .= ' 
                            <input name="object_types[]" type="checkbox" value="' . TagObjectAR::OBJECT_TYPE_TASK . '"'; if (isset($objectArray[TagObjectAR::OBJECT_TYPE_TASK])) { $content .= ' checked'; } $content .= '> ' . TaskAR::classCaption() . self::useTagLabel( $useArray, TagObjectAR::OBJECT_TYPE_TASK ) . '<br>'; } } if (Central::$erpProfileChapters[ErpProfileDto::CHAPTER_MAP]) { $content .= ' 
                            <input name="object_types[]" type="checkbox" value="' . TagObjectAR::OBJECT_TYPE_BUILDING . '"'; if (isset($objectArray[TagObjectAR::OBJECT_TYPE_BUILDING])) { $content .= ' checked'; } $content .= '> ' . BuildingAR::classCaption() . self::useTagLabel( $useArray, TagObjectAR::OBJECT_TYPE_BUILDING ) . '<br>'; } $expr = ''; if (Central::$isUSOnline === true) { $expr = [ CableLineTypeAR::F_AUTHOR_EMPLOYEE_ID => Html::$currentEmployeeId ]; } if (Central::$erpProfileChapters[ErpProfileDto::CHAPTER_NODE]) { $nodeTypes = NodeTypeAR::find() ->where($expr) ->orderBy( [ NodeTypeAR::F_NAME => SORT_ASC ] ) ->all(); foreach ($nodeTypes as $nodeType) { $content .= ' 
                            <input name="object_type_nodes[]" type="checkbox" value="' . $nodeType->getId() . '"'; if (isset($objectArray[TagObjectAR::OBJECT_TYPE_NODE . '-' . $nodeType->getId()])) { $content .= ' checked'; } $content .= '> ' . NodeAR::classCaption() . ':  ' . NodeTypeCache::getName( $nodeType->getId() ) . self::useTagLabel( $useArray, TagObjectAR::OBJECT_TYPE_NODE, true ) . '<br>'; } } if (Central::$erpProfileChapters[ErpProfileDto::CHAPTER_CABLE_LINE]) { $expr = ''; if (Central::$isUSOnline === true) { $expr = [ CableLineTypeAR::F_AUTHOR_EMPLOYEE_ID => Html::$currentEmployeeId ]; } $cableLineTypes = CableLineTypeAR::find() ->where($expr) ->orderBy( [ CableLineTypeAR::F_NAME => SORT_ASC ] ) ->all(); foreach ($cableLineTypes as $cableLineType) { $content .= ' 
                            <input name="object_type_cable_lines[]" type="checkbox" value="' . $cableLineType->getId( ) . '"'; if (isset($objectArray[TagObjectAR::OBJECT_TYPE_CABLE_LINE . '-' . $cableLineType->getId()])) { $content .= ' checked'; } $content .= '> ' . CableLineAR::classCaption() . ': ' . CableLineTypeCache::getName( $cableLineType->getId() ) . self::useTagLabel( $useArray, TagObjectAR::OBJECT_TYPE_CABLE_LINE, true ) . '<br>'; } } if ( Central::$isUSOnline === false && Central::$erpProfileChapters[ErpProfileDto::CHAPTER_DEVICE] ) { $content .= ' 
                            <input name="object_type_devices[]" id="checkDevice' . InventorySectionAR::T_0_OTHER . 'Id" type="checkbox" value="0"'; if (isset($objectArray[TagObjectAR::OBJECT_TYPE_DEVICE . '-' . InventorySectionAR::T_0_OTHER])) { $content .= ' checked'; } $content .= '> ' . DeviceAR::classCaption() . ': ' . Lang::getPhrase( 633 ) . self::useTagLabel($useArray, TagObjectAR::OBJECT_TYPE_DEVICE, true) . '<br> 
                            <input name="object_type_devices[]" id="checkDevice' . InventorySectionAR::T_1_SWITCH . 'Id" type="checkbox" value="' . InventorySectionAR::T_1_SWITCH . '"'; if (isset($objectArray[TagObjectAR::OBJECT_TYPE_DEVICE . '-' . InventorySectionAR::T_1_SWITCH])) { $content .= ' checked'; } $content .= '> ' . DeviceAR::classCaption() . ': ' . Lang::getPhrase( 627 ) . self::useTagLabel($useArray, TagObjectAR::OBJECT_TYPE_DEVICE, true) . '<br> 
                            <input name="object_type_devices[]" id="checkDevice' . InventorySectionAR::T_2_RADIO . 'Id" type="checkbox" value="' . InventorySectionAR::T_2_RADIO . '"'; if (isset($objectArray[TagObjectAR::OBJECT_TYPE_DEVICE . '-' . InventorySectionAR::T_2_RADIO])) { $content .= ' checked'; } $content .= '> ' . DeviceAR::classCaption() . ': ' . Lang::getPhrase( 1553 ) . self::useTagLabel($useArray, TagObjectAR::OBJECT_TYPE_DEVICE, true) . '<br> 
                            <input name="object_type_devices[]" id="checkDevice' . InventorySectionAR::T_3_MEDIC . 'Id" type="checkbox" value="' . InventorySectionAR::T_3_MEDIC . '"'; if (isset($objectArray[TagObjectAR::OBJECT_TYPE_DEVICE . '-' . InventorySectionAR::T_3_MEDIC])) { $content .= ' checked'; } $content .= '> ' . DeviceAR::classCaption() . ': ' . Lang::getPhrase( 628 ) . self::useTagLabel($useArray, TagObjectAR::OBJECT_TYPE_DEVICE, true) . '<br> 
                            <input name="object_type_devices[]" id="checkDevice' . InventorySectionAR::T_16_CUSTOM . 'Id" type="checkbox" value="' . InventorySectionAR::T_16_CUSTOM . '"'; if (isset($objectArray[TagObjectAR::OBJECT_TYPE_DEVICE . '-' . InventorySectionAR::T_16_CUSTOM])) { $content .= ' checked'; } $content .= '> ' . DeviceAR::classCaption() . ': ' . Lang::getPhrase( 5018 ) . self::useTagLabel( $useArray, TagObjectAR::OBJECT_TYPE_DEVICE, true ) . '<br>'; } if (Central::$erpProfileChapters[ErpProfileDto::CHAPTER_CABLE_LINE]) { $content .= ' 
                            <input name="object_types[]" type="checkbox" value="' . TagObjectAR::OBJECT_TYPE_CROSS . '"'; if (isset($objectArray[TagObjectAR::OBJECT_TYPE_CROSS])) { $content .= ' checked'; } $content .= '> ' . CrossAR::classCaption() . self::useTagLabel($useArray, TagObjectAR::OBJECT_TYPE_CROSS) . '<br> 
 
                            <input name="object_types[]" type="checkbox" value="' . TagObjectAR::OBJECT_TYPE_SPLITTER . '"'; if (isset($objectArray[TagObjectAR::OBJECT_TYPE_SPLITTER])) { $content .= ' checked'; } $content .= '> ' . SplitterAR::classCaption() . self::useTagLabel( $useArray, TagObjectAR::OBJECT_TYPE_SPLITTER ) . '<br> 
             
                            <input name="object_types[]" type="checkbox" value="' . TagObjectAR::OBJECT_TYPE_MULTIPLEXER . '"'; if (isset($objectArray[TagObjectAR::OBJECT_TYPE_MULTIPLEXER])) { $content .= ' checked'; } $content .= '> ' . MultiplexerAR::classCaption() . self::useTagLabel( $useArray, TagObjectAR::OBJECT_TYPE_MULTIPLEXER ) . '<br>'; $content .= ' 
                            <input name="object_types[]" type="checkbox" value="' . TagObjectAR::OBJECT_TYPE_CABLE_ROUTE . '"'; if (isset($objectArray[TagObjectAR::OBJECT_TYPE_CABLE_ROUTE])) { $content .= ' checked'; } $content .= '> ' . CableRouteAR::classCaption() . self::useTagLabel( $useArray, TagObjectAR::OBJECT_TYPE_CABLE_ROUTE ) . '<br> 
 
                            <input name="object_types[]" type="checkbox" value="' . TagObjectAR::OBJECT_TYPE_CABLE_LINE_TRUNK . '"'; if (isset($objectArray[TagObjectAR::OBJECT_TYPE_CABLE_LINE_TRUNK])) { $content .= ' checked'; } $content .= '> ' . CableLineTrunkAR::classCaption() . self::useTagLabel( $useArray, TagObjectAR::OBJECT_TYPE_CABLE_LINE_TRUNK ) . '<br>'; } if (Central::$erpProfileChapters[ErpProfileDto::CHAPTER_NODE]) { $content .= ' 
                            <input name="object_types[]" type="checkbox" value="' . TagObjectAR::OBJECT_TYPE_RACK . '"'; if (isset($objectArray[TagObjectAR::OBJECT_TYPE_RACK])) { $content .= ' checked'; } $content .= '> ' . RackSystem::classCaption() . self::useTagLabel( $useArray, TagObjectAR::OBJECT_TYPE_RACK ) . '<br>'; } $content .= ' 
 
                        </div> 
                    </div> 
                </div> 
                ' . BodyHtml::formButton( 'save_cancel', '?core_section=' . BodyHtml::SECTION_SETTINGS_MAIN . '&action=' . self::A_OBJECT_MARK_PAGE ) . ' 
            </form>'; if ($id > 0) { $count = TagObjectAR::find() ->where( [ TagObjectAR::F_TAG_ID => $id ] ) ->count(); if (0 < $count) { $content .= ' 
                    <div class="div_space">             
                        <span class="info_block">' . Lang::getPhrase(6074) . ': <b>' . $count . '</b></span> 
                    </div> 
                    <br>'; } $smsListConditionsDto = Yii::$container ->get(SmsListConditionFetcher::class) ->getByCondition( [ SmsListConditionDto::F_CONDITION_TYPE => SmsListConditionDto::CONDITION_TYPE_TAG, SmsListConditionDto::F_BODY => $id, ] ); foreach ($smsListConditionsDto as $smsListConditionDto) { $content .= ' 
                    <div class="div_space">             
                        <span class="info_block">' . Lang::getPhrase( 6074 ) . ': <a href="?core_section=' . BodyHtml::SECTION_SMS_LIST . '&action=dialog_edit&id=' . $smsListConditionDto->smslist_id . '"><b>' . Lang::getPhrase( 592 ) . '</b></a></span> 
                    </div> 
                    <br>'; } $content .= ' ' . BodyHtml::linkConfirm( url: '?core_section=' . BodyHtml::SECTION_SETTINGS_MAIN . '&action=' . self::A_OBJECT_MARK_DELETE . '&id=' . $id, caption: Lang::getPhrase(1415), confirmText: Lang::getPhrase(1150) . '?', linkBodyFull: '<i class="us-icon us-icon-danger fa-close"></i>' . Lang::getPhrase(1415) , linkTextId: 'linkConfirmDeleteMarkId' ); } return $content; } private static function objectMarkPage(): string { if (Central::$isUSOnline === false) { OperatorAccess::verifyRight(OperatorAccess::RIGHT_SETTING); } $content = ' 
                <a href="?core_section=settings_main&item_id=' . self::ITEM_4 . '"><i class="us-icon fa-chevron-left"></i>' . Lang::getPhrase( 1443 ) . '</a><br> 
                <div class="label_h2">' . TagAR::classCaption() . '</div> 
                <a id="linkAddId" href="?core_section=' . BodyHtml::SECTION_SETTINGS_MAIN . '&action=' . self::A_OBJECT_MARK_DIALOG_ADD . '"><i class="us-icon fa-plus"></i>' . Lang::getPhrase( 841 ) . '</a><br>'; $expr = ''; if (Central::$isUSOnline === true) { $expr = [ TagAR::F_AUTHOR_EMPLOYEE_ID => Html::$currentEmployeeId ]; } $data = []; $layers = TagAR::find() ->where($expr) ->all(); foreach ($layers as $layer) { $data[$layer->getId()] = [ 'id' => $layer->getId(), 'name' => TagCache::getNameById($layer->getId()) ]; $textColor = TagCache::getTextColorById($layer->getId()); $color = TagCache::getColorById($layer->getId()); if ($textColor === '') { $textColor = '#fff'; } if ($color === '') { $color = '#000'; } $data[$layer->getId()][101] = 'color: ' . $textColor . ';'; $data[$layer->getId()][101] .= 'background: ' . $color . ';'; $imageId = TagCache::getImageById($layer->getId()); if ($imageId > 0) { $data[$layer->getId()]['image'] = '<img src="' . AttachmentAR::getViewUrl( $imageId ) . '" alt="' . Lang::getPhrase( 3018 ) . '">'; } } $field = [ [ 'SPECIAL' => '_number' ], [ 'ALIGN' => 'center', 'EL' => 'image' ], [ 'NAME' => Lang::getPhrase(1451), 'ISSORT' => 1, 'ISSORTABC' => 1, 'EL' => 'name' ] ]; $table = new Table(); $table->link = '?core_section=' . BodyHtml::SECTION_SETTINGS_MAIN . '&action=' . self::A_OBJECT_MARK_DIALOG_EDIT . '&id='; $table->sortDefault = 'name'; $table->isSortDefaultAbc = 1; $table->elementWithStyle = 101; $content .= $table->show($data, $field); return $content; } private static function tagDeleteImage(): void { OperatorAccess::verifyRight(OperatorAccess::RIGHT_SETTING); $id = RequestData::$id; TagAR::deleteImage($id); Html::location('?core_section=settings_main&action=object_mark_dialog_edit&id=' . $id, 'updok'); } private static function addObjectLimitData($caption, $objCount, $maxLimit = 0, $limitLink = ''): string { if ( $maxLimit < 1 && Central::$isUSOnline === false ) { $maxLimit = Central::$erpLimitCounter; } if ($limitLink != '') { $caption = '<a href="' . $limitLink . '">' . $caption . '</a>'; } $content = ' 
            <div class="item"> 
                <div style="text-align: right"> 
                    ' . $caption . ': 
                </div> 
                <div> 
                    <b>' . $objCount . '</b> &nbsp; '; if ($maxLimit > $objCount) { $content .= '<span class="green_text">(+' . ($maxLimit - $objCount) . ')</span>'; } if ($maxLimit < $objCount) { $content .= '<span class="red_text">(' . ($maxLimit - $objCount) . ')</span>'; } $content .= ' 
                </div> 
            </div>'; return $content; } public static function tableSettingList($url = '?core_section=settings_main&action=table_property'): string { $profileRight = Html::$currentEmployeeRight; $content = ''; $isRightSetting = OperatorAccess::isAccess(OperatorAccess::RIGHT_SETTING); if ( 1 != SettingAR::getByNameInt(SettingsCatalog::IS_EMPLOYEE_TABLE_SET) && 1 != $isRightSetting ) { Html::locationCancel(); } $arrayTable = []; if ( Central::$erpProfileChapters[ErpProfileDto::CHAPTER_CABLE_LINE] && ( 1 == $isRightSetting || true === FiberHtml::verifySectionRight('read', false) ) ) { $cableLineTypes = CableLineTypeAR::find() ->orderBy(CableLineTypeAR::F_NAME) ->all(); foreach ($cableLineTypes as $cableLineType) { if (true == FiberHtml::verifyRight($cableLineType->getId(), 'read', false)) { $arrayTable[] = [ 'id' => EmployeeTableSettingDto::KAT_CABLE_LINE_TYPE . $cableLineType->getId(), 'name' => CableLineAR::classCaption() . ' - ' . CableLineTypeCache::getName( $cableLineType->getId() ) ]; } } $arrayTable[] = [ 'id' => EmployeeTableSettingDto::KAT_CABLE_LINE_ROUTE, 'name' => CableLineTrunkAR::classCaption() ]; $arrayTable[] = [ 'id' => EmployeeTableSettingDto::KAT_CABLE_DUCT, 'name' => CableDuctAR::classCaption() ]; } if ( Central::$erpProfileChapters[ErpProfileDto::CHAPTER_DEVICE] && ( 1 == $isRightSetting || isset($profileRight[EmployeeProfileAR::T_INVENTORY_SECTION_TYPE][InventorySectionAR::T_1_SWITCH]) ) ) { $arrayTable[] = [ 'id' => EmployeeTableSettingDto::KAT_DEVICE_SWITCH, 'name' => Lang::getPhrase(627) ]; } if ( Central::$erpProfileChapters[ErpProfileDto::CHAPTER_DEVICE] && ( 1 == $isRightSetting || isset($profileRight[EmployeeProfileAR::T_INVENTORY_SECTION_TYPE][InventorySectionAR::T_2_RADIO]) ) ) { $arrayTable[] = [ 'id' => EmployeeTableSettingDto::KAT_DEVICE_RADIO, 'name' => Lang::getPhrase(1553) ]; } if ( Central::$erpProfileChapters[ErpProfileDto::CHAPTER_TASK] && ( 1 == $isRightSetting || 1 == OperatorAccess::isAccess(OperatorAccess::RIGHT_TASK_READ) ) ) { $arrayTable[] = [ 'id' => EmployeeTableSettingDto::KAT_TASK, 'name' => Lang::getPhrase(638) ]; $arrayTable[] = [ 'id' => EmployeeTableSettingDto::KAT_TASK_XLS, 'name' => Lang::getPhrase(638) . ' (Excel)' ]; } if ( 1 == $isRightSetting || 1 == OperatorAccess::isAccess(OperatorAccess::RIGHT_EMPLOYEE) ) { $arrayTable[] = [ 'id' => EmployeeTableSettingDto::KAT_STAFF, 'name' => EmployeePropertyAR::classCaption() ]; $arrayTable[] = [ 'id' => EmployeeTableSettingDto::KAT_EMPLOYEE_TIMESHEET, 'name' => Lang::getPhrase(655) ]; $arrayTable[] = [ 'id' => EmployeeTableSettingDto::KAT_TRANSPORT, 'name' => TransportAR::classCaption() ]; } if ( Central::$erpProfileChapters[ErpProfileDto::CHAPTER_CUSTOMER] && ( 1 == $isRightSetting || 1 == OperatorAccess::isAccess(OperatorAccess::RIGHT_CUSTOMER_LIST) ) ) { $arrayTable[] = [ 'id' => EmployeeTableSettingDto::KAT_CUSTOMER, 'name' => CustomerAR::classCaption() ]; $arrayTable[] = [ 'id' => EmployeeTableSettingDto::KAT_CUSTOMER_BUILDING, 'name' => CustomerAR::classCaption() . ' (' . Lang::getPhrase( 5566 ) . ')' ]; $arrayTable[] = [ 'id' => EmployeeTableSettingDto::KAT_CUSTOMER_TARIFF_REQUEST, 'name' => CustomerAR::classCaption() . ' (' . Lang::getPhrase(615) . ')' ]; } $isNodeRight = false; $nodeTypes = NodeTypeAR::find() ->orderBy(NodeTypeAR::F_NAME) ->all(); foreach ($nodeTypes as $nodeType) { if ( Central::$erpProfileChapters[ErpProfileDto::CHAPTER_NODE] && ( 1 == $isRightSetting || true === NodeHtml::verifyRight($nodeType->getId(), 'read', false) ) ) { $isNodeRight = true; $arrayTable[] = [ 'id' => EmployeeTableSettingDto::KAT_NODE_TYPE . $nodeType->getId(), 'name' => NodeAR::classCaption() . ' - ' . NodeTypeCache::getName($nodeType->getId()) ]; } } if ( Central::$erpProfileChapters[ErpProfileDto::CHAPTER_CABLE_LINE] && ( 1 == $isRightSetting || isset($profileRight[EmployeeProfileAR::T_CROSS]) ) ) { $arrayTable[] = [ 'id' => EmployeeTableSettingDto::KAT_CROSS, 'name' => CrossAR::classCaption() ]; } if ( Central::$erpProfileChapters[ErpProfileDto::CHAPTER_CABLE_LINE] && ( 1 == $isRightSetting || isset($profileRight[EmployeeProfileAR::T_SPLITTER]) ) ) { $arrayTable[] = [ 'id' => EmployeeTableSettingDto::KAT_SPLITTER, 'name' => SplitterAR::classCaption() ]; } if ( Central::$erpProfileChapters[ErpProfileDto::CHAPTER_DEVICE] && ( 1 == $isRightSetting || isset($profileRight[EmployeeProfileAR::T_DEVICE][EmployeeProfileAR::T2_DEVICE_VLAN]) ) ) { $arrayTable[] = [ 'id' => EmployeeTableSettingDto::KAT_VLAN, 'name' => VlanSystem::classCaption() ]; } if ( Central::$erpProfileSubChapters[ErpProfileDto::SUB_CHAPTER_MAP_KEY] && ( 1 == $isRightSetting || 1 == OperatorAccess::isAccess(OperatorAccess::RIGHT_KEY) ) ) { $arrayTable[] = [ 'id' => EmployeeTableSettingDto::KAT_KEYS, 'name' => KeyAR::classCaption() ]; } if ( Central::$erpProfileSubChapters[ErpProfileDto::SUB_CHAPTER_MAP_OWNER] && ( 1 == $isRightSetting || 1 == OperatorAccess::isAccess(OperatorAccess::RIGHT_MAP) ) ) { $arrayTable[] = [ 'id' => EmployeeTableSettingDto::KAT_OWNERS, 'name' => OwnerAR::classCaption() ]; } if ( Central::$erpProfileChapters[ErpProfileDto::CHAPTER_NODE] && true === $isNodeRight ) { $arrayTable[] = [ 'id' => EmployeeTableSettingDto::KAT_RACK, 'name' => RackSystem::classCaption() ]; } if ( Central::$erpProfileChapters[ErpProfileDto::CHAPTER_WAREHOUSE] && ( 1 == $isRightSetting || 1 == OperatorAccess::isAccess(OperatorAccess::RIGHT_INVENTORY) ) ) { $arrayTable[] = [ 'id' => EmployeeTableSettingDto::KAT_INVENTORY, 'name' => InventoryAR::classCaption() ]; } $arrayTable = Central::sort( data: $arrayTable, sortElement: 'name', isSortAbc: true ); foreach ($arrayTable as $value) { $content .= ' 
                <div class="div_space"> 
                    <a id="linkSetSet' . $value['id'] . 'Id" href="' . $url . '&id=' . $value['id'] . '"><i class="us-icon fa-bars"></i>' . $value['name'] . '</a> 
                </div>'; } return $content; } private static function editSettingsOption($section): string { EmployeePropertyAR::saveSessionCashe(EmployeePropertyAR::CACHE_36, $section); if ( Central::$isUSOnline === true && $section != self::ITEM_18 && $section != self::ITEM_98 && $section != self::ITEM_99 ) { $section = self::ITEM_98; } switch ($section) { case self::ITEM_2: $sectionName = Lang::getPhrase(720); $sectionContent = ' 
                    <div class="div_space"> 
                        <a href="?core_section=' . BodyHtml::SECTION_SETTINGS_MAIN . '&action=' . self::A_CUSTOM_PAGE_LIST . '&category=' . PageAR::CATEGORY_CUSTOMER_CABINET . '"><i class="us-icon fa-bars"></i>' . Lang::getPhrase( 3185 ) . '</a> 
                    </div> 
                    <br>'; $sectionContent .= SettingsHtml::propertyDialog( SettingsCatalog::CUSTOMER_IS_ACTIVE_CUSTOMER_AREA, 'VALUEINT', Lang::getPhrase(5486) ); $sectionContent .= SettingsHtml::propertyDialog( SettingsCatalog::CUSTOMER_AREA_DEFAULT_LANGUAGE, 'VALUESTR', Lang::getPhrase(3381) , '(' . Lang::getPhrase(740) . ': RU)', SettingsCatalog::CUSTOMER_IS_ACTIVE_CUSTOMER_AREA ); $sectionContent .= SettingsHtml::propertyDialog( SettingsCatalog::CUSTOMER_AREA_ENTER_TYPE, 'VALUESTR', Lang::getPhrase(5487) , '', SettingsCatalog::CUSTOMER_IS_ACTIVE_CUSTOMER_AREA ); $sectionContent .= SettingsHtml::propertyDialog( SettingsCatalog::CUSTOMER_IS_ENCRYPT_PASSWORD, 'VALUEINT', Lang::getPhrase(5491) , '', SettingsCatalog::CUSTOMER_AREA_ENTER_TYPE . ',' . SettingsCatalog::CUSTOMER_IS_ACTIVE_CUSTOMER_AREA ); $sectionContent .= SettingsHtml::propertyDialog( SettingsCatalog::CUSTOMER_IS_ALLOW_CHANGE_PASSWORD_IN_CUSTOMER_AREA, 'VALUEINT', Lang::getPhrase(5492) , '', SettingsCatalog::CUSTOMER_AREA_ENTER_TYPE . ',' . SettingsCatalog::CUSTOMER_IS_ACTIVE_CUSTOMER_AREA ); $sectionContent .= SettingsHtml::propertyDialog( SettingsCatalog::CUSTOMER_IS_ALLOW_REGISTRATION, 'VALUEINT', Lang::getPhrase(5463) , '', SettingsCatalog::CUSTOMER_IS_ACTIVE_CUSTOMER_AREA ); $sectionContent .= SettingsHtml::propertyDialog( SettingsCatalog::CUSTOMET_REGISTER_TASK_ORDER_NUMBER, 'VALUEINT', Lang::getPhrase(3691) , '', SettingsCatalog::CUSTOMER_IS_ALLOW_REGISTRATION . ',' . SettingsCatalog::CUSTOMER_IS_ACTIVE_CUSTOMER_AREA ); $sectionContent .= SettingsHtml::propertyDialog( SettingsCatalog::CUSTOMER_MSG_IS_SEND_EMAIL_ON_RECEIVE, 'VALUEINT', Lang::getPhrase(3528) , '', SettingsCatalog::CUSTOMER_IS_ACTIVE_CUSTOMER_AREA ); $sectionContent .= SettingsHtml::propertyDialog( SettingsCatalog::CUSTOMER_MSG_EMAIL_FOR_RECEIVE, 'VALUESTR', Lang::getPhrase(5493) , '(' . Lang::getPhrase(5494) . ')', SettingsCatalog::CUSTOMER_IS_ACTIVE_CUSTOMER_AREA . ',' . SettingsCatalog::CUSTOMER_MSG_IS_SEND_EMAIL_ON_RECEIVE ); $sectionContent .= SettingsHtml::propertyDialog( SettingsCatalog::CUSTOMER_MSG_EMAIL_THEME, 'VALUESTR', Lang::getPhrase(5495) , '', SettingsCatalog::CUSTOMER_IS_ACTIVE_CUSTOMER_AREA . ',' . SettingsCatalog::CUSTOMER_MSG_IS_SEND_EMAIL_ON_RECEIVE ); $sectionContent .= SettingsHtml::propertyDialog( SettingsCatalog::CUSTOMER_IS_ALLOW_DISABLE_RECEIVE_SMS, 'VALUEINT', Lang::getPhrase(5496) , '', SettingsCatalog::CUSTOMER_IS_ACTIVE_CUSTOMER_AREA ); break; case self::ITEM_3: $sectionName = Lang::getPhrase(607); $sectionContent = SettingsHtml::propertyDialog( SettingsCatalog::CUSTOMER_SUSPECT_DURATION, 'VALUESTR', Lang::getPhrase(5471) , '', '', '(' . Lang::getPhrase(2234) . ')' ); $sectionContent .= SettingsHtml::propertyDialog( SettingsCatalog::CUSTOMER_HOPELESS_DURATION, 'VALUESTR', Lang::getPhrase(5472) , '', '', '(' . Lang::getPhrase(2234) . ')' ); $sectionContent .= SettingsHtml::propertyDialog( SettingsCatalog::ACCOUNTANCY_BILLING_BALANCE, 'VALUEINT', Lang::getPhrase(4583) , '(' . Lang::getPhrase(5473) . ')' ); $sectionContent .= SettingsHtml::propertyDialog( SettingsCatalog::CUSTOMER_CHILD_BALANCE_INDIVIDUAL, 'VALUEINT', Lang::getPhrase(5179) ); $sectionContent .= SettingsHtml::propertyDialog( SettingsCatalog::CUSTOMER_IS_LOCKED_CORPORATE_CUSTOMER, 'VALUEINT', Lang::getPhrase(5474) , '(' . Lang::getPhrase(5475) . ')' ); break; case self::ITEM_4: $sectionName = Lang::getPhrase(647); $sectionContent = ''; if (Central::$erpProfileChapters[ErpProfileDto::CHAPTER_NODE]) { $sectionContent = ' 
                    <div class="div_space"> 
                        <a id="linkNodeIconListId" href="?core_section=settings_main&action=node_icon"><i class="us-icon fa-bars"></i>' . Lang::getPhrase( 4149 ) . '</a> 
                    </div>'; } if (Central::$erpProfileChapters[ErpProfileDto::CHAPTER_NODE]) { $sectionContent .= ' 
                    <div class="div_space"> 
                        <a id="linkExportKmlId" href="?core_section=settings_main&action=export_to_kml"><i class="us-icon fa-bars"></i>' . Lang::getPhrase( 5649 ) . ' (EIT)</a> 
                    </div>'; } $sectionContent .= ' 
                    <div class="div_space"> 
                        <a id="linkLayerId" href="?core_section=' . BodyHtml::SECTION_SETTINGS_MAIN . '&action=' . self::A_OBJECT_MARK_PAGE . '"><i class="us-icon fa-bars"></i>' . TagAR::classCaption( ) . '</a> 
                    </div>'; $sectionContent .= ' 
                        <div class="div_space"> 
                            <a id="linkTilesId" href="?core_section=settings_main&action=map_tile"><i class="us-icon fa-bars"></i>' . MapTileAR::classCaption( ) . '</a> 
                        </div>'; $sectionContent .= ' 
                    <br>'; $sectionContent .= SettingsHtml::propertyDialog( SettingsCatalog::MAP_CACHE_IS_ENABLE, 'VALUEINT', Lang::getPhrase(5430) ); $sectionContent .= SettingsHtml::propertyDialog( SettingsCatalog::BUILDING_DEFAULT_TYPE, 'VALUESTR', Lang::getPhrase(5808) , '(' . Lang::getPhrase(740) . ')' ); $sectionContent .= SettingsHtml::propertyDialog( SettingsCatalog::MAP_NEWWINDOW, 'VALUEINT', Lang::getPhrase( 3435 ) ); $sectionContent .= SettingsHtml::propertyDialog( SettingsCatalog::MAP_TIMEUPDATE, 'VALUESTR', Lang::getPhrase(5499) , '(refresh. ' . Lang::getPhrase(740) . ': 300)', '', '(' . Lang::getPhrase(5500) . ')' ); $sectionContent .= SettingsHtml::propertyDialog( SettingsCatalog::MAP_BUILDING_POLYGON_SIZE, 'VALUESTR', Lang::getPhrase(4929) , '(' . Lang::getPhrase(740) . ': 0.0005)' ); $sectionContent .= SettingsHtml::propertyDialog( SettingsCatalog::MAP_IS_OTHER_OBJECT_ON_MAP_WHEN_BUILDING_EDIT, 'VALUEINT', Lang::getPhrase(5760) ); $sectionContent .= SettingsHtml::propertyDialog( SettingsCatalog::MAP_IS_MARKER_STYLE_312, 'VALUEINT', Lang::getPhrase(5696) , '(' . Lang::getPhrase(5697) . ')' ); $sectionContent .= SettingsHtml::propertyDialog( SettingsCatalog::MAP_LABEL_CANVAS, 'VALUEINT', Lang::getPhrase(5942) ); if (Central::$erpProfileChapters[ErpProfileDto::CHAPTER_CABLE_LINE]) { $sectionContent .= SettingsHtml::propertyDialog( SettingsCatalog::MAP_SHOW_CABLE_STOCK, 'VALUEINT', Lang::getPhrase(5821) ); } if (Central::$erpProfileChapters[ErpProfileDto::CHAPTER_NODE]) { $sectionContent .= SettingsHtml::propertyDialog( SettingsCatalog::MAP_SHOW_LBL, 'VALUEINT', Lang::getPhrase(5502) , '(' . Lang::getPhrase(5503) . ')' ); $sectionContent .= SettingsHtml::propertyDialog( SettingsCatalog::MAP_SHOW_LBL_NODE_SH, 'VALUESTR', Lang::getPhrase(5398) , '(' . Lang::getPhrase(740) . ': number)', SettingsCatalog::MAP_SHOW_LBL ); $sectionContent .= SettingsHtml::propertyDialog( arg: SettingsCatalog::MAP_IS_NODE_PREVIEW, argType: 'VALUEINT', caption: Lang::getPhrase( 6104 ) ); $sectionContent .= SettingsHtml::propertyDialog( arg: SettingsCatalog::MAP_NODE_PREVIEW_SIZE, argType: 'VALUESTR', caption: Lang::getPhrase(6105), parentArg: SettingsCatalog::MAP_IS_NODE_PREVIEW ); } if (Central::$erpProfileChapters[ErpProfileDto::CHAPTER_CABLE_LINE]) { $sectionContent .= SettingsHtml::propertyDialog( arg: SettingsCatalog::MAP_IS_CABLE_LINE_TO_TOP_ON_HOVER, argType: 'VALUEINT', caption: Lang::getPhrase( 6196 ) ); } $sectionContent .= SettingsHtml::propertyDialog( SettingsCatalog::MAP_IS_SHOW_BUILDING_LABEL, 'VALUEINT', Lang::getPhrase(5504) , '(' . Lang::getPhrase(5505) . ')' ); $sectionContent .= SettingsHtml::propertyDialog( SettingsCatalog::MAP_BUILDING_LABEL_TEMPLATE, 'VALUESTR', Lang::getPhrase(5506) , '(' . Lang::getPhrase(740) . ': number)', SettingsCatalog::MAP_IS_SHOW_BUILDING_LABEL ); if (Central::$erpProfileChapters[ErpProfileDto::CHAPTER_DEVICE]) { $sectionContent .= SettingsHtml::propertyDialog( SettingsCatalog::MAP_BUILDING_ACTIVITY_BY_DEVICE, 'VALUEINT', Lang::getPhrase(5508) , '(' . Lang::getPhrase(5509) . ')' ); } $sectionContent .= SettingsHtml::propertyDialog( SettingsCatalog::ADDRESS_BUILDING_MANUAL_ADD_IS_NOT_USE, 'VALUEINT', Lang::getPhrase(6154) ); $sectionContent .= SettingsHtml::propertyDialog( SettingsCatalog::MAP_BATCH_OBJECT, 'VALUESTR', Lang::getPhrase(5834) , '(' . Lang::getPhrase(740) . ': 100)' ); $sectionContent .= ' 
                    <br> 
                    <div class="item" style="text-align: center; font-weight: bold"> 
                        ' . Lang::getPhrase(5829) . ' 
                    </div>'; $sectionContent .= SettingsHtml::propertyDialog( SettingsCatalog::MAP_GOOGLE_API_KEY, 'VALUESTR', 'Google API Key', '<a target=_blank href="https://wiki.' . Central::$erpMainDomain . '/Google_API_Key">WiKi</a>' ); $sectionContent .= SettingsHtml::propertyDialog( SettingsCatalog::MAP_NOMINATIM, 'VALUEINT', Lang::getPhrase(5501) . ' "OpenStreetMap Nominatim"' ); $sectionContent .= SettingsHtml::propertyDialog( SettingsCatalog::MAP_YANDEX_GEO, 'VALUEINT', Lang::getPhrase(5501) . ' "Yandex Geocoder"' ); $sectionContent .= SettingsHtml::propertyDialog( SettingsCatalog::YANDEX_KEY, 'VALUESTR', 'Yandex API Key', '<a target=_blank href="https://developer.tech.yandex.ru/">developer.tech.yandex.ru</a>', SettingsCatalog::MAP_YANDEX_GEO ); $sectionContent .= SettingsHtml::propertyDialog( SettingsCatalog::IS_DADATA_GEOCODER, 'VALUEINT', Lang::getPhrase(5501) . ' "DaData.ru"' ); $sectionContent .= SettingsHtml::propertyDialog( SettingsCatalog::MAP_IS_DADATA_SEARCH, 'VALUEINT', Lang::getPhrase(5739) , '<a target=_blank href="https://dadata.ru/?ref=61885">https://dadata.ru</a>' ); $sectionContent .= SettingsHtml::propertyDialog( SettingsCatalog::DADATA_API_KEY, 'VALUESTR', 'DaData.ru API Key', '<a target=_blank href="https://dadata.ru/?ref=61885">https://dadata.ru</a>' ); $sectionContent .= SettingsHtml::propertyDialog( SettingsCatalog::DADATA_X_KEY, 'VALUESTR', 'DaData.ru SECRET Key', '<a target=_blank href="https://dadata.ru/?ref=61885">https://dadata.ru</a>' ); if (Central::$erpProfileChapters[ErpProfileDto::CHAPTER_CUSTOMER]) { $sectionContent .= ' 
                    <br> 
                    <div class="item" style="text-align: center; font-weight: bold"> 
                        ' . Lang::getPhrase(5838) . ' 
                    </div>'; $sectionContent .= SettingsHtml::propertyDialog( SettingsCatalog::IS_BUILDING_LOGIC_SCHEME_CUSTOMER_BILLING_ICO, 'VALUEINT', Lang::getPhrase(6026) ); } break; case self::ITEM_7: $sectionName = Lang::getPhrase(624); $sectionContent = ' 
                        <div class="div_space"> 
                            <a id="linkProfileId" href="?core_section=settings_main&action=device_profile"><i class="us-icon fa-bars"></i>' . Lang::getPhrase( 4247 ) . '</a> 
                        </div> 
                        <div class="div_space"> 
                            <a id="linkSatelliteId" href="?core_section=settings_main&action=satellite"><i class="us-icon fa-bars"></i>' . Lang::getPhrase( 4959 ) . '</a> 
                        </div> 
                        <div class="div_space"> 
                            <a href="?core_section=' . BodyHtml::SECTION_SETTINGS_MAIN . '&action=' . self::A_OBJECT_MARK_PAGE . '"><i class="us-icon fa-bars"></i>' . TagAR::classCaption( ) . '</a> 
                        </div>                         
                        <div class="div_space">'; $sectionContent .= ' ' . BodyHtml::linkConfirm( '?core_section=settings_main&action=device_autocommutation_on', Lang::getPhrase(5193), Lang::getPhrase(4131) . '?', '<i class="us-icon fa-wrench"></i>' . Lang::getPhrase( 5193 ) , 'linkConfirmPortOnId' ); $sectionContent .= ' 
                        </div> 
                        <br>'; $sectionContent .= SettingsHtml::propertyDialog( SettingsCatalog::NODE_NUMBER, 'VALUEINT', Lang::getPhrase(5759) ); $sectionContent .= SettingsHtml::propertyDialog( SettingsCatalog::E_NUMBER_RULE, 'VALUEINT', Lang::getPhrase(4052) ); $sectionContent .= SettingsHtml::propertyDialog( SettingsCatalog::ADDRESS_IS_SORT_NODE_IN_BUILDING_CARD_BY_NUMBER, 'VALUEINT', Lang::getPhrase(5749) ); $sectionContent .= SettingsHtml::propertyDialog( SettingsCatalog::CROSS_ADAPTER_TYPE, 'VALUESTR', Lang::getPhrase(3317) ); $sectionContent .= SettingsHtml::propertyDialog( SettingsCatalog::CROSS_IS_ALLOW_DOUBLE_COMMUTATION, 'VALUEINT', Lang::getPhrase(5805) ); $sectionContent .= SettingsHtml::propertyDialog( SettingsCatalog::STRUCTURE_SCHEME_HOPS, 'VALUESTR', Lang::getPhrase(5826), '(' . Lang::getPhrase(740) . ': 40)' ); $sectionContent .= SettingsHtml::propertyDialog( SettingsCatalog::DEVICE_IS_SEND_ONLY_UNACTIVITY, 'VALUEINT', Lang::getPhrase(5242) , '(' . Lang::getPhrase(5243) . ')' ); $sectionContent .= SettingsHtml::propertyDialog( SettingsCatalog::IS_QR_ONE_PER_PAGE, 'VALUEINT', Lang::getPhrase(5375) ); $sectionContent .= SettingsHtml::propertyDialog( SettingsCatalog::EQUIPMENT_CARD_FAST_LINK_1, 'VALUESTR', Lang::getPhrase(5359) . ' #1' ); $sectionContent .= SettingsHtml::propertyDialog( SettingsCatalog::EQUIPMENT_CARD_FAST_LINK_2, 'VALUESTR', Lang::getPhrase(5359) . ' #2' ); $sectionContent .= SettingsHtml::propertyDialog( SettingsCatalog::EQUIPMENT_CARD_FAST_LINK_3, 'VALUESTR', Lang::getPhrase(5359) . ' #3' ); $sectionContent .= SettingsHtml::propertyDialog( SettingsCatalog::EQUIPMENT_CARD_FAST_LINK_4, 'VALUESTR', Lang::getPhrase(5359) . ' #4' ); $sectionContent .= SettingsHtml::propertyDialog( SettingsCatalog::DEVICE_IS_FAST_LINK_IN_COMMUTATION, 'VALUEINT', Lang::getPhrase( 6194 ) ); $sectionContent .= SettingsHtml::propertyDialog( SettingsCatalog::E_MAC_DEL_DAY, 'VALUESTR', Lang::getPhrase(4387) ); $sectionContent .= SettingsHtml::propertyDialog( SettingsCatalog::DEVICE_LEFT_MENU_FIND_BY_ID, 'VALUEINT', Lang::getPhrase(6151) ); $sectionContent .= SettingsHtml::propertyDialog( SettingsCatalog::DEVICE_LEFT_MENU_FIND_BY_INVENTORY_NUMBER, 'VALUEINT', Lang::getPhrase(6152) ); $sectionContent .= ' 
                    <br> 
                    <div class="item" style="text-align: center; font-weight: bold"> 
                        SNMP / Telnet 
                    </div>'; $sectionContent .= SettingsHtml::propertyDialog( SettingsCatalog::TELNET_NAME, 'VALUESTR', Lang::getPhrase(3321) ); $sectionContent .= SettingsHtml::propertyDialog( SettingsCatalog::TELNET_PASS, 'VALUESTR', Lang::getPhrase(3322) ); $sectionContent .= SettingsHtml::propertyDialog( SettingsCatalog::SNMP_DATA_CACHE_TIMEOUT, 'VALUESTR', 'SNMP. Data cache timeout', '(' . Lang::getPhrase(740) . ': 600)' ); $sectionContent .= SettingsHtml::propertyDialog( SettingsCatalog::SNMP_COMUNITY, 'VALUESTR', 'Default ro-community', '(' . Lang::getPhrase(740) . ': public)' ); $sectionContent .= SettingsHtml::propertyDialog( SettingsCatalog::SNMP_COMUNITY2, 'VALUESTR', 'Default rw-community', '(' . Lang::getPhrase(740) . ': private)' ); $sectionContent .= SettingsHtml::propertyDialog( SettingsCatalog::SNMP_DEFAULT_SECURITY_NAME, 'VALUESTR', 'Default v3 security name' ); $sectionContent .= SettingsHtml::propertyDialog( SettingsCatalog::SNMP_DEFAULT_SECURITY_LEVEL, 'VALUESTR', 'Default v3 security level' ); $sectionContent .= SettingsHtml::propertyDialog( SettingsCatalog::SNMP_DEFAULT_AUTH_PROTOCOL, 'VALUESTR', 'Default v3 authentification protocol' ); $sectionContent .= SettingsHtml::propertyDialog( SettingsCatalog::SNMP_DEFAULT_AUTH_PASSPHRASE, 'VALUESTR', 'Default v3 authentification passphrase' ); $sectionContent .= SettingsHtml::propertyDialog( SettingsCatalog::SNMP_DEFAULT_PRIV_PROTOCOL, 'VALUESTR', 'Default v3 privacy protocol' ); $sectionContent .= SettingsHtml::propertyDialog( SettingsCatalog::SNMP_DEFAULT_PRIV_PASSPHRASE, 'VALUESTR', 'Default v3 privacy passphrase' ); $sectionContent .= ' 
                    <br> 
                    <div class="item" style="text-align: center; font-weight: bold"> 
                        PING 
                    </div>'; $sectionContent .= SettingsHtml::propertyDialog( SettingsCatalog::PING_ENABLE, 'VALUEINT', Lang::getPhrase(783) ); $sectionContent .= SettingsHtml::propertyDialog( SettingsCatalog::PING_TIMEOUT, 'VALUESTR', 'Timeout', '(' . Lang::getPhrase(740) . ': 4)', SettingsCatalog::PING_ENABLE, ' (s)' ); $sectionContent .= SettingsHtml::propertyDialog( SettingsCatalog::EQUIPMENT_IS_DEVICE_PING, 'VALUEINT', Lang::getPhrase(5550) , '', SettingsCatalog::PING_ENABLE ); $sectionContent .= SettingsHtml::propertyDialog( SettingsCatalog::IS_GETMAC, 'VALUEINT', Lang::getPhrase(776) , '', SettingsCatalog::PING_ENABLE ); $sectionContent .= SettingsHtml::propertyDialog( SettingsCatalog::NIX_ARPPATH, 'VALUESTR', Lang::getPhrase(3354) . ' arp', '', SettingsCatalog::PING_ENABLE ); $sectionContent .= ' 
                    <br> 
                    <div class="item" style="text-align: center; font-weight: bold"> 
                        ' . Lang::getPhrase(5534) . ' 
                    </div>'; $sectionContent .= SettingsHtml::propertyDialog( SettingsCatalog::DEVICE_IS_UPDATE_IFACE_INFO_IN_CARD, 'VALUEINT', Lang::getPhrase(5530) ); $sectionContent .= SettingsHtml::propertyDialog( SettingsCatalog::DEVICE_IS_IFACE_ANIMATION, 'VALUEINT', Lang::getPhrase(5539) ); $sectionContent .= SettingsHtml::propertyDialog( SettingsCatalog::EQUIP_NAME, 'VALUEINT', Lang::getPhrase(5543) , '(ifName)' ); $sectionContent .= SettingsHtml::propertyDialog( SettingsCatalog::EQUIP_PORTDESC, 'VALUEINT', Lang::getPhrase(5540) , '(ifDescr)' ); $sectionContent .= SettingsHtml::propertyDialog( SettingsCatalog::EQUIP_ERROR, 'VALUEINT', Lang::getPhrase(5542) , '(ifInErrors/ifOutErrors)' ); $sectionContent .= ' 
                    <br> 
                    <div class="item" style="text-align: center; font-weight: bold"> 
                        ARP/FDB 
                    </div>'; $sectionContent .= SettingsHtml::propertyDialog( SettingsCatalog::FDP_TABLETELNET, 'VALUESTR', Lang::getPhrase(5531) , '(' . Lang::getPhrase(740) . ')' ); $sectionContent .= SettingsHtml::propertyDialog( SettingsCatalog::DEVICE_IS_USE_MAC_FROM_UPLINK, 'VALUEINT', Lang::getPhrase(5535) ); $sectionContent .= SettingsHtml::propertyDialog( SettingsCatalog::DEVICE_IS_USE_MAC_FROM_DOWNLINK, 'VALUEINT', Lang::getPhrase(5536) ); $sectionContent .= SettingsHtml::propertyDialog( SettingsCatalog::DEVICE_IS_UPDATE_CUSTOMER_ACTIVITY_BY_FDB, 'VALUEINT', Lang::getPhrase(5532) ); $sectionContent .= SettingsHtml::propertyDialog( SettingsCatalog::IS_UPDATE_MAC_BY_ARP, 'VALUEINT', Lang::getPhrase( 6048 ) ); $sectionContent .= SettingsHtml::propertyDialog( SettingsCatalog::EQUIPMENT_FLOOD_COUNTER, 'VALUESTR', Lang::getPhrase(5728) , '(' . Lang::getPhrase(740) . ': 500)' ); $sectionContent .= ' 
                    <br> 
                    <div class="item" style="text-align: center; font-weight: bold"> 
                        ' . Lang::getPhrase(1553) . ' 
                    </div>'; $sectionContent .= SettingsHtml::propertyDialog( SettingsCatalog::E_RADIO_LVL_MAX, 'VALUESTR', Lang::getPhrase(5039) ); $sectionContent .= SettingsHtml::propertyDialog( SettingsCatalog::E_RADIO_LVL_MIN, 'VALUESTR', Lang::getPhrase(5040) ); $sectionContent .= SettingsHtml::propertyDialog( SettingsCatalog::DEVICE_RADIO_SECTOR_COLOR, 'VALUESTR', Lang::getPhrase(3685) , '(' . Lang::getPhrase(740) . ': #008080)', '', '', 1 ); $sectionContent .= ' 
                    <br> 
                    <div class="item" style="text-align: center; font-weight: bold"> 
                        PON 
                    </div>'; $sectionContent .= SettingsHtml::propertyDialog( arg: SettingsCatalog::DEVICE_IS_PON_ONU_TX, argType: 'VALUEINT', caption: Lang::getPhrase(6176) . ' ONU-TX', tooltip: '(' . Lang::getPhrase(6177) . ')' ); $sectionContent .= SettingsHtml::propertyDialog( arg: SettingsCatalog::DEVICE_IS_PON_OLT_RX, argType: 'VALUEINT', caption: Lang::getPhrase(6176) . ' OLT-RX', tooltip: '(' . Lang::getPhrase(6177) . ')' ); $sectionContent .= SettingsHtml::propertyDialog( arg: SettingsCatalog::DEVICE_IS_PON_OLT_TX, argType: 'VALUEINT', caption: Lang::getPhrase(6176) . ' OLT-TX', tooltip: '(' . Lang::getPhrase(6177) . ')' ); $sectionContent .= SettingsHtml::propertyDialog( SettingsCatalog::DEVICE_IS_PON_0_IS_BAD, 'VALUEINT', Lang::getPhrase(5431) ); $sectionContent .= SettingsHtml::propertyDialog( SettingsCatalog::DBM_MAX, 'VALUESTR', Lang::getPhrase(3994) . '. ' . Lang::getPhrase(5544) , '(' . Lang::getPhrase(740) . ': -10)', '', '(dBm)' ); $sectionContent .= SettingsHtml::propertyDialog( SettingsCatalog::DBM_MIN, 'VALUESTR', Lang::getPhrase(3994) . '. ' . Lang::getPhrase(5545) , '(' . Lang::getPhrase(740) . ': -27)', '', '(dBm)' ); $sectionContent .= SettingsHtml::propertyDialog( SettingsCatalog::DEVICE_SFP_ATT, 'VALUESTR', Lang::getPhrase(4689) , '', '', '(dBm)' ); $sectionContent .= SettingsHtml::propertyDialog( SettingsCatalog::PON_LEVEL_CHANGE_FIX, 'VALUESTR', Lang::getPhrase(5786) , '(' . Lang::getPhrase(740) . ': 0.2)', '', '(dBm)' ); break; case self::ITEM_10: $sectionName = Lang::getPhrase(595); $sectionContent = ' 
                    <div class="div_space"> 
                        <a id="linkGroupId" href="?core_section=settings_main&action=customer_group"><i class="us-icon fa-bars"></i>' . Lang::getPhrase( 3955 ) . '</a> 
                    </div> 
                    <div class="div_space"> 
                        <a id="linkStateId" href="?core_section=settings_main&action=customer_state"><i class="us-icon fa-bars"></i>' . Lang::getPhrase( 4925 ) . '</a> 
                    </div> 
                    <div class="div_space"> 
                        <a id="linkCustomerMarkId" href="?core_section=settings_main&action=object_mark_page"><i class="us-icon fa-bars"></i>' . Lang::getPhrase( 6076 ) . '</a> 
                    </div> 
                    <div class="div_space"> 
                        <a id="linkCustomerTabId" href="?core_section=' . BodyHtml::SECTION_SETTINGS_MAIN . '&action=' . self::A_CUSTOM_PAGE_LIST . '&category=' . PageAR::CATEGORY_CUSTOMER_CARD . '"><i class="us-icon fa-bars"></i>' . Lang::getPhrase( 5853 ) . '</a> 
                    </div> 
                    <br>'; $sectionContent .= SettingsHtml::propertyDialog( SettingsCatalog::CUSTOMER_IS_ALLOW_DELETE, 'VALUEINT', Lang::getPhrase(5476) ); $sectionContent .= SettingsHtml::propertyDialog( SettingsCatalog::CUSTOMER_IS_ALLOW_DELETE_POTENTIAL_CUSTOMER, 'VALUEINT', Lang::getPhrase(5811) ); $sectionContent .= SettingsHtml::propertyDialog( SettingsCatalog::CUSTOMER_IS_ALLOW_UNLINK, 'VALUEINT', Lang::getPhrase(5479) ); $sectionContent .= SettingsHtml::propertyDialog( SettingsCatalog::CUSTOMER_IS_ALLOW_CHANGE_TYPE, 'VALUEINT', Lang::getPhrase(5480) , '(' . Lang::getPhrase(5481) . ')' ); $sectionContent .= SettingsHtml::propertyDialog( SettingsCatalog::CUSTOMER_HISTORY_ORDER, 'VALUEINT', Lang::getPhrase(3993) ); $sectionContent .= SettingsHtml::propertyDialog( SettingsCatalog::TAB_SUPPNEWWINDOW, 'VALUEINT', Lang::getPhrase(3509) ); if (true == BillingCache::isHasManualBilling()) { $sectionContent .= SettingsHtml::propertyDialog( SettingsCatalog::CUSTOMER_STATUS_AT_ADD, 'VALUESTR', Lang::getPhrase(4857) ); $sectionContent .= SettingsHtml::propertyDialog( SettingsCatalog::CUSTOMER_TARIFF_AT_ADD, 'VALUESTR', Lang::getPhrase(4751) ); } $sectionContent .= SettingsHtml::propertyDialog( SettingsCatalog::EXCEL_CUSTOMER_ALLOW, 'VALUEINT', Lang::getPhrase(5325) ); $sectionContent .= SettingsHtml::propertyDialog( SettingsCatalog::EXCEL_UNLOCK, 'VALUEINT', Lang::getPhrase(5043) , '', SettingsCatalog::EXCEL_CUSTOMER_ALLOW ); $sectionContent .= SettingsHtml::propertyDialog( SettingsCatalog::CUSTOMER_DAY_DISCONNECT_NOTIFY, 'VALUESTR', Lang::getPhrase(3355) , '(' . Lang::getPhrase(740) . ': 30)' ); $sectionContent .= SettingsHtml::propertyDialog( SettingsCatalog::PING_DEMAND, 'VALUEINT', Lang::getPhrase(3646) ); $sectionContent .= SettingsHtml::propertyDialog( SettingsCatalog::MSG_BILLING_LINK, 'VALUESTR', Lang::getPhrase(5060) ); break; case self::ITEM_18: $sectionName = Lang::getPhrase(3809); $sectionContent = ' 
                    <div class="div_space"> 
                        <a id="linkListAllFieldId" href="?' . BodyHtml::CORES_SECTION . '=' . BodyHtml::SECTION_SETTINGS_MAIN . '&action=' . self::A_ADDITIONAL_FIELD_LIST . '"><i class="us-icon fa-list"></i>' . Lang::getPhrase( 6118 ) . '</a> 
                    </div> 
                    <div class="div_space"> 
                        <a href="?' . BodyHtml::CORES_SECTION . '=' . BodyHtml::SECTION_SETTINGS_MAIN . '&action=' . self::A_OBJECT_MARK_PAGE . '"><i class="us-icon fa-tags"></i>' . TagAR::classCaption( ) . '</a> 
                    </div> 
                    <br>'; if (Central::$isUSOnline == false) { $sectionContent .= ' 
                        <div class="div_space"> 
                            <a id="linkChangeAdditionalValueId" href="?core_section=settings_main&action=change_additional_field_value"><i class="us-icon fa-cogs"></i>' . Lang::getPhrase( 5990 ) . '</a> 
                        </div> 
                        <br>'; $sectionContent .= ' 
                        <div class="div_space"> 
                            <a id="linkTransferAdditionalValueId" href="?' . BodyHtml::CORES_SECTION . '=' . BodyHtml::SECTION_SETTINGS_MAIN . '&action=' . self::A_ADDITIONAL_FIELD_MERGE . '"><i class="us-icon fa-cogs"></i>' . Lang::getPhrase( 6120 ) . '</a> 
                        </div> 
                        <br>'; } break; case self::ITEM_19: $sectionName = Lang::getPhrase(3833); $sectionContent = self::tableSettingList(); break; case self::ITEM_20: $sectionName = Lang::getPhrase(4743); $sectionContent = ' 
                        <div class="div_space"> 
                            <a id="linkImportAddressId" href="?core_section=settings_main&action=import&object_type=address"><i class="us-icon fa-bars"></i>' . Lang::getPhrase( 3877 ) . '</a> 
                        </div>'; if (Central::$erpProfileChapters[ErpProfileDto::CHAPTER_NODE]) { $sectionContent .= ' 
                        <div class="div_space"> 
                            <a href="?core_section=settings_main&action=import&object_type=node"><i class="us-icon fa-bars"></i>' . NodeAR::classCaption( ) . '</a> 
                        </div>'; } if (Central::$erpProfileChapters[ErpProfileDto::CHAPTER_DEVICE]) { $sectionContent .= ' 
                        <div class="div_space"> 
                            <a href="?core_section=settings_main&action=import&object_type=device"><i class="us-icon fa-bars"></i>' . Lang::getPhrase( 627 ) . '</a> 
                        </div>'; } if (Central::$erpProfileChapters[ErpProfileDto::CHAPTER_WAREHOUSE]) { $sectionContent .= ' 
                        <div class="div_space"> 
                            <a href="?core_section=settings_main&action=import&object_type=inventory"><i class="us-icon fa-bars"></i>' . Lang::getPhrase( 641 ) . '</a> 
                        </div>'; } if (Central::$erpProfileChapters[ErpProfileDto::CHAPTER_CUSTOMER]) { $sectionContent .= ' 
                        <div class="div_space"> 
                            <a href="?core_section=' . BodyHtml::SECTION_SETTINGS_MAIN . '&action=import&object_type=customer"><i class="us-icon fa-bars"></i>' . CustomerAR::classCaption( ) . '</a> 
                        </div>'; } break; case self::ITEM_21: $sectionName = Lang::getPhrase(4805); $sectionContent = SettingsHtml::propertyDialog( SettingsCatalog::NEWIN_IS, 'VALUEINT', Lang::getPhrase(5497) , '<a href="https://www.' . Central::$erpMainDomain . '/manual.php?page_id=25">Wiki</a>' ); $sectionContent .= SettingsHtml::propertyDialog( SettingsCatalog::J_NEW_INTYPE, 'VALUESTR', Lang::getPhrase(4810) , '', SettingsCatalog::NEWIN_IS ); $sectionContent .= SettingsHtml::propertyDialog( SettingsCatalog::REQUEST_CONNECTION_DESCRIPTION, 'VALUEMEMO', Lang::getPhrase(5498) , '', SettingsCatalog::NEWIN_IS ); break; case self::ITEM_23: $sectionName = Lang::getPhrase(5365); $sectionContent = MapHtml::insertMapEditObject('saveWeatherCoord'); $weatherCoord = SettingAR::getByNameString(SettingsCatalog::WEATHER_COORD); $weatherCoord = explode(',', $weatherCoord); if (isset($weatherCoord[1])) { $lat = Central::roundConvert($weatherCoord[0], 6); $lon = Central::roundConvert($weatherCoord[1], 6); } else { $lat = '50'; $lon = '40'; } $sectionContent .= SettingsHtml::propertyDialog( SettingsCatalog::WEATHER_COORD, 'VALUESTR', Lang::getPhrase(3661) , '<a class="link_dashed" id="linkWeatherSelectId" href="javascript:chooseMapWeather(\'' . $lat . '\',\'' . $lon . '\')"><span> ' . Lang::getPhrase( 1742 ) . '</span></a>' ); $sectionContent .= SettingsHtml::propertyDialog( SettingsCatalog::WEATHER_IS_USE, 'VALUEINT', Lang::getPhrase(838) ); $sectionContent .= SettingsHtml::propertyDialog( SettingsCatalog::WEATHER_API_KEY, 'VALUESTR', 'OpenWeatherMap API key', ' <a href="https://home.openweathermap.org/api_keys">https://home.openweathermap.org/api_keys</a>', SettingsCatalog::WEATHER_IS_USE ); if (Central::$erpProfileChapters[ErpProfileDto::CHAPTER_TASK]) { $sectionContent .= SettingsHtml::propertyDialog( SettingsCatalog::WEATHER_IS_IN_CALENDAR, 'VALUEINT', Lang::getPhrase(5366) , '', SettingsCatalog::WEATHER_IS_USE ); } break; case self::ITEM_24: $sectionName = Lang::getPhrase(639); $sectionContent = ' 
                    <div class="div_space"> 
                        <a href="?core_section=settings_main&action=inventory_sub_account"><i class="us-icon fa-bars"></i>' . Lang::getPhrase( 6000 ) . '</a> 
                    </div> 
                    <br>'; $sectionContent .= SettingsHtml::propertyDialog( SettingsCatalog::INVENTORY_WAREHOUSE_IS_TRANSIT_CONFIRM, 'VALUEINT', Lang::getPhrase(4434) ); $sectionContent .= SettingsHtml::propertyDialog( SettingsCatalog::INVENTORY_WAREHOUSE_IS_CONFIRM_ON_READ, 'VALUEINT', Lang::getPhrase(5320) ); $sectionContent .= SettingsHtml::propertyDialog( SettingsCatalog::INVENTORY_WAREHOUSE_ADDITIONAL_INFORMATION, 'VALUEINT', Lang::getPhrase(5239) ); $sectionContent .= SettingsHtml::propertyDialog( SettingsCatalog::INVENTORY_IS_BARCODE_PRINT_DELIMITER, 'VALUEINT', Lang::getPhrase( 5205 ) ); $sectionContent .= SettingsHtml::propertyDialog( SettingsCatalog::INVENTORY_IS_SEND_INFO_TO_EMPLOYEE_ABOUT_TRANSFER, 'VALUEINT', Lang::getPhrase( 5395 ) ); $sectionContent .= SettingsHtml::propertyDialog( SettingsCatalog::INVENTORY_ADD_INVENTORY_NUMBER_ON_ADD, 'VALUEINT', Lang::getPhrase(4406) ); $sectionContent .= SettingsHtml::propertyDialog( SettingsCatalog::WAREHOUSE_CUSTOMER_MOVED, 'VALUESTR', Lang::getPhrase(4698) ); $sectionContent .= SettingsHtml::propertyDialog( SettingsCatalog::IS_QR_ONE_PER_PAGE, 'VALUEINT', Lang::getPhrase(5375) ); $sectionContent .= SettingsHtml::propertyDialog( SettingsCatalog::OPERATION_BLANK, 'VALUESTR', Lang::getPhrase(3540) . ' #1' ); $sectionContent .= SettingsHtml::propertyDialog( SettingsCatalog::OPERATION_BLANK2, 'VALUESTR', Lang::getPhrase(3540) . ' #2' ); $sectionContent .= SettingsHtml::propertyDialog( SettingsCatalog::OPERATION_BLANK3, 'VALUESTR', Lang::getPhrase(3540) . ' #3' ); $sectionContent .= SettingsHtml::propertyDialog( SettingsCatalog::INVENTORY_LIMIT_ADD, 'VALUESTR', Lang::getPhrase(5828) , '(' . Lang::getPhrase(740) . ': 100)' ); $sectionContent .= SettingsHtml::propertyDialog( SettingsCatalog::INVENTORY_INTEGRATE_ONE_PER_IFACE, 'VALUEINT', Lang::getPhrase(5908) ); $sectionContent .= SettingsHtml::propertyDialog( SettingsCatalog::IS_INVENTORY_NUMBER_SORT_AS_TEXT, 'VALUEINT', Lang::getPhrase(6027) ); $sectionContent .= SettingsHtml::propertyDialog( SettingsCatalog::INVENTORY_IS_SELECT_ALL_CATEGORY_DEFAULT, 'VALUEINT', Lang::getPhrase(6171) ); break; case self::ITEM_25: $sectionName = Lang::getPhrase(652); $sectionContent = ' 
                        <div class="div_space"> 
                            <a id="linkLdapId" href="?core_section=settings_main&action=ldap"><i class="us-icon fa-bars"></i>LDAP</a> 
                        </div> 
                        <br>'; $sectionContent .= SettingsHtml::propertyDialog( SettingsCatalog::EMPLOYEE_IS_USE_FULLNAME, 'VALUEINT', Lang::getPhrase(3858) , '(' . Lang::getPhrase(3859) . ')' ); $sectionContent .= SettingsHtml::propertyDialog( SettingsCatalog::P_BIRTH_ONMAIN, 'VALUEINT', Lang::getPhrase(5000) ); if (Central::$erpProfileSubChapters[ErpProfileDto::SUB_CHAPTER_EMPLOYEE_TIMESHEET]) { $sectionContent .= SettingsHtml::propertyDialog( SettingsCatalog::EMPLOYEE_IS_ALLOW_EDIT_TABEL_LAST_DAY, 'VALUEINT', Lang::getPhrase(5549) ); } $sectionContent .= SettingsHtml::propertyDialog( SettingsCatalog::EMPLOYEE_SESSION_TIMEOUT_INTERVAL, 'VALUESTR', Lang::getPhrase(6059) , '(' . Lang::getPhrase(740) . ': 43200)', '', '(' . Lang::getPhrase(5466) . ')' ); $sectionContent .= SettingsHtml::propertyDialog( SettingsCatalog::EMPLOYEE_UNACTIVE_LOCKED_DAY, 'VALUESTR', Lang::getPhrase(5668) , '(' . Lang::getPhrase(740) . ': 45)', '', '(' . Lang::getPhrase(2234) . ')' ); $sectionContent .= SettingsHtml::propertyDialog( SettingsCatalog::EMPLOYEE_ALLOW_DEBUG_FOR_ALL, 'VALUEINT', Lang::getPhrase(789) ); $sectionContent .= SettingsHtml::propertyDialog( SettingsCatalog::IS_EMPLOYEE_TABLE_SET, 'VALUEINT', Lang::getPhrase(5827) ); $sectionContent .= SettingsHtml::propertyDialog( SettingsCatalog::IS_EMPLOYEE_TABLE_SET_ADMIN, 'VALUEINT', Lang::getPhrase( 6141 ) ); $sectionContent .= SettingsHtml::propertyDialog( SettingsCatalog::TIME_SINCE_EMPLOYEE_DISMISS, 'VALUESTR', Lang::getPhrase(6046) , '(' . Lang::getPhrase(740) . ': 90)' ); $sectionContent .= ' 
                    <div class="item" style="text-align: center; font-weight: bold"> 
                        ' . Lang::getPhrase(5548) . ' 
                    </div>'; $sectionContent .= SettingsHtml::propertyDialog( SettingsCatalog::ALLOW_SAVELOGIN, 'VALUEINT', Lang::getPhrase(3506) ); $sectionContent .= SettingsHtml::propertyDialog( SettingsCatalog::EMPLOYEE_CHANGE_PASSWORD_INTERVAL, 'VALUESTR', Lang::getPhrase(5485) , '', '', '(' . Lang::getPhrase(2234) . ')' ); $sectionContent .= SettingsHtml::propertyDialog( SettingsCatalog::EMPLOYEE_PASSWORD_MIN_LENGTH, 'VALUESTR', Lang::getPhrase(5134) ); $sectionContent .= SettingsHtml::propertyDialog( SettingsCatalog::EMPLOYEE_PASSWORD_REQUIRED_DIGITAL, 'VALUEINT', Lang::getPhrase(5131) ); $sectionContent .= SettingsHtml::propertyDialog( SettingsCatalog::EMPLOYEE_PASSWORD_REQUIRED_CAPITAL_LETTER, 'VALUEINT', Lang::getPhrase(5132) ); $sectionContent .= SettingsHtml::propertyDialog( SettingsCatalog::EMPLOYEE_PASSWORD_REQUIRED_SMALL_LETTER, 'VALUEINT', Lang::getPhrase(5133) ); $sectionContent .= SettingsHtml::propertyDialog( SettingsCatalog::EMPLOYEE_PASSWORD_MUST_INDIVIDUAL, 'VALUEINT', Lang::getPhrase(5136) ); break; case self::ITEM_26: $sectionName = Lang::getPhrase(3802); $sectionContent = SettingsHtml::propertyDialog( SettingsCatalog::NODE_SCHEME_DEVICE_LABEL, 'VALUESTR', Lang::getPhrase(627) . '. ' . Lang::getPhrase(5373) , 'name<br>ip<br>hostname<br>comment<br>add_field_XXX' ); $sectionContent .= SettingsHtml::propertyDialog( SettingsCatalog::SCHEME_SPLIT_LABEL, 'VALUESTR', Lang::getPhrase(4138) . '. ' . Lang::getPhrase( 5373 ) , 'comment<br>dataXXX' ); $sectionContent .= SettingsHtml::propertyDialog( SettingsCatalog::SCHEME_CROSS_LABEL, 'VALUESTR', Lang::getPhrase(3794) . '. ' . Lang::getPhrase(5373) , 'comment<br>number' ); $sectionContent .= SettingsHtml::propertyDialog( SettingsCatalog::NODE_IS_HIDE_FULL_COMMUTATION_ON_SCHEME, 'VALUEINT', Lang::getPhrase(5079) ); $sectionContent .= SettingsHtml::propertyDialog( SettingsCatalog::COMMUTATION_SCHEME_IS_MODULE_NUMBER, 'VALUEINT', Lang::getPhrase( 5931 ) ); $sectionContent .= SettingsHtml::propertyDialog( SettingsCatalog::COMMUTATION_SCHEME_IS_COLOR_NAME_MODULE, 'VALUEINT', Lang::getPhrase( 5840 ) ); $sectionContent .= SettingsHtml::propertyDialog( SettingsCatalog::COMMUTATION_SCHEME_LINE_SIZE, 'VALUESTR', Lang::getPhrase(5844) , '(' . Lang::getPhrase(740) . ': 5)' ); $sectionContent .= SettingsHtml::propertyDialog( SettingsCatalog::COMMUTATION_SCHEME_IS_NET, 'VALUEINT', Lang::getPhrase(5845) ); $sectionContent .= SettingsHtml::propertyDialog( SettingsCatalog::COMMUTATION_SCHEME_NET_COLOR, 'VALUESTR', Lang::getPhrase(5846) , '(' . Lang::getPhrase(740) . ': #efefef)', SettingsCatalog::COMMUTATION_SCHEME_IS_NET, '', 1 ); $sectionContent .= SettingsHtml::propertyDialog( SettingsCatalog::COMMUTATION_SCHEME_IS_SCROLL, 'VALUEINT', Lang::getPhrase(5537) ); $sectionContent .= SettingsHtml::propertyDialog( SettingsCatalog::COMMUTATION_SCHEME_VOK_WIDTH, 'VALUESTR', Lang::getPhrase(5932) , '(' . Lang::getPhrase(740) . ': 100)' ); $sectionContent .= SettingsHtml::propertyDialog( SettingsCatalog::COMMUTATION_SCHEME_VOK_MIN_HEIGHT, 'VALUESTR', Lang::getPhrase(5933) , '(' . Lang::getPhrase(740) . ': 0)' ); $sectionContent .= SettingsHtml::propertyDialog( SettingsCatalog::CABLE_LINE_CORE_CONNECTION_INFORMATION, 'VALUEINT', Lang::getPhrase(6002) ); $sectionContent .= SettingsHtml::propertyDialog( arg: SettingsCatalog::CABLE_LINE_CORE_CONNECTION_INFORMATION_TEMPLATE, argType: 'VALUESTR', caption: Lang::getPhrase(6003) , tooltip: '(' . Lang::getPhrase( 740 ) . ': ' . CommutationScheme::TEMPLATE_CONNECT_INFORMATION_NODE_NAME . ')<br>' . CommutationScheme::TEMPLATE_CONNECT_INFORMATION_NODE_NAME . ' | ' . CommutationScheme::TEMPLATE_CONNECT_INFORMATION_DEVICE_NAME . ' | ' . CommutationScheme::TEMPLATE_CONNECT_INFORMATION_DEVICE_PORT . ' | ' . CommutationScheme::TEMPLATE_CONNECT_INFORMATION_DEVICE_HOSTNAME . ' | ' . CommutationScheme::TEMPLATE_CONNECT_INFORMATION_DEVICE_IP, parentArg: SettingsCatalog::CABLE_LINE_CORE_CONNECTION_INFORMATION ); $sectionContent .= SettingsHtml::propertyDialog( arg: SettingsCatalog::CABLE_LINE_CORE_CONNECTION_INFORMATION_WIDTH, argType: 'VALUESTR', caption: Lang::getPhrase(6004) , tooltip: '(' . Lang::getPhrase(740) . ': 200)', parentArg: SettingsCatalog::CABLE_LINE_CORE_CONNECTION_INFORMATION ); $sectionContent .= SettingsHtml::propertyDialog( arg: SettingsCatalog::NODE_SCHEME_IS_SPLITTER_SHOW_LEVEL, argType: 'VALUEINT', caption: Lang::getPhrase( 6206 ) ); break; case self::ITEM_27: $sectionName = 'WebSocket'; $sectionContent = SettingsHtml::propertyDialog( arg: SettingsCatalog::WEB_SOCKET_USER, argType: 'VALUESTR', caption: Lang::getPhrase(5624) , tooltip: '(WebSTOMP)' ); $sectionContent .= SettingsHtml::propertyDialog( arg: SettingsCatalog::WEB_SOCKET_PASSWORD, argType: 'VALUESTR', caption: Lang::getPhrase(553) , tooltip: '(WebSTOMP)' ); $sectionContent .= SettingsHtml::propertyDialog( arg: SettingsCatalog::WEB_SOCKET_NOTIFY_TIMEOUT, argType: 'VALUESTR', caption: Lang::getPhrase(5234) ); $sectionContent .= SettingsHtml::propertyDialog( arg: SettingsCatalog::IS_WEBSTOMP_DEBUG, argType: 'VALUEINT', caption: 'Debug Mode' ); break; case self::ITEM_28: $sectionName = Lang::getPhrase(6068); $sectionContent = ' 
                    <div class="div_space"> 
                        <a href="?' . BodyHtml::CORES_SECTION . '=' . BodyHtml::SECTION_SETTINGS_NOTIFICATION . '"><i class="us-icon fa-bars"></i>' . Lang::getPhrase(669) . ' - ' . Lang::getPhrase(5312) . '</a> 
                    </div> 
                    <br>'; $sectionContent .= SettingsHtml::propertyDialog( SettingsCatalog::SMS_FORMAT, 'VALUESTR', Lang::getPhrase(3052) , '(' . Lang::getPhrase(3053) . ': +380XXXXXXXXX)' ); $sectionContent .= SettingsHtml::propertyDialog( SettingsCatalog::IS_PHONE_NUMBER_CONVERT, 'VALUEINT', Lang::getPhrase( 4827 ) ); $sectionContent .= SettingsHtml::propertyDialog( SettingsCatalog::PHONE_ADDITIONAL_URL, 'VALUESTR', Lang::getPhrase( 4917 ) ); $sectionContent .= SettingsHtml::propertyDialog( SettingsCatalog::IS_SMS, 'VALUEINT', Lang::getPhrase(3325) . ' SMS' ); $sectionContent .= SettingsHtml::propertyDialog( SettingsCatalog::SMS_LEFTBLOCK, 'VALUEINT', Lang::getPhrase(4404) , '', SettingsCatalog::IS_SMS ); break; case self::ITEM_98: $sectionName = Lang::getPhrase(5383); $sectionContent = ''; if (Central::$isUSOnline === false) { $sectionContent .= ' 
                    <div class="item"> 
                        <div style="text-align: right; width: 250px"> 
                            ' . Lang::getPhrase(5427) . ': 
                        </div> 
                        <div> 
                            <b>' . Central::$erpCustomerName . '</b> 
                        </div> 
                    </div> 
                    <div class="item"> 
                        <div style="text-align: right"> 
                            ' . Lang::getPhrase(5425) . ': 
                        </div> 
                        <div> 
                            <b>' . Central::dateFormatShortByUnix(strtotime(Central::$erpCustomerDateSupport)) . '</b> 
                        </div> 
                    </div>                     
                    <div class="item"> 
                        <div style="text-align: right"> 
                            ' . Lang::getPhrase(5384) . ': 
                            <br><br><br> 
                            <b>' . Lang::getPhrase(5385) . '</b> 
                        </div> 
                        <div> 
                            <b>' . Central::$erpLimitCounter . '</b> 
                        </div> 
                    </div>'; if (Central::$erpProfileChapters[ErpProfileDto::CHAPTER_CUSTOMER]) { $sectionContent .= self::addObjectLimitData( Lang::getPhrase(595) , CustomerAR::find() ->where( [ CustomerAR::F_ACTUAL_STATUS => CustomerAR::ACTUAL_STATUS_NORMAL ] ) ->count() ); } if (Central::$erpProfileChapters[ErpProfileDto::CHAPTER_NODE]) { $nodeTypes = NodeTypeAR::find() ->orderBy( [ NodeTypeAR::F_NAME => SORT_ASC ] )->all(); foreach ($nodeTypes as $nodeType) { $count2 = NodeAR::find() ->where( [ NodeAR::F_NODE_TYPE_ID => $nodeType->getId() ] ) ->count(); $sectionContent .= self::addObjectLimitData( NodeTypeCache::getName($nodeType->getId()), $count2 ); } } if (Central::$erpProfileChapters[ErpProfileDto::CHAPTER_DEVICE]) { $sectionContent .= self::addObjectLimitData( Lang::getPhrase(633) , DeviceAR::find() ->where(DeviceAR::F_INVENTORY_ID . ' IS NULL') ->count() ); $sectionContent .= self::addObjectLimitData( Lang::getPhrase(627) , DeviceAR::find() ->innerJoin( InventoryAR::tableName() . ' as i', 'i.' . InventoryAR::F_ID . ' = ' . DeviceAR::tableName( ) . '.' . DeviceAR::F_INVENTORY_ID ) ->innerJoin( InventoryAssortmentAR::tableName() . ' as ia', 'ia.' . InventoryAssortmentAR::F_ID . ' = i.' . InventoryAR::F_INVENTORY_ASSORTMENT_ID ) ->innerJoin( InventorySectionAR::tableName() . ' as iss', 'iss.' . InventorySectionAR::F_ID . ' = ia.' . InventoryAssortmentAR::F_INVENTORY_SECTION_ID ) ->where( [ 'iss.' . InventorySectionAR::F_TYPE_ID => InventorySectionAR::T_1_SWITCH ] ) ->count() ); $sectionContent .= self::addObjectLimitData( Lang::getPhrase(1553) , DeviceAR::find() ->innerJoin( InventoryAR::tableName() . ' as i', 'i.' . InventoryAR::F_ID . ' = ' . DeviceAR::tableName( ) . '.' . DeviceAR::F_INVENTORY_ID ) ->innerJoin( InventoryAssortmentAR::tableName() . ' as ia', 'ia.' . InventoryAssortmentAR::F_ID . ' = i.' . InventoryAR::F_INVENTORY_ASSORTMENT_ID ) ->innerJoin( InventorySectionAR::tableName() . ' as iss', 'iss.' . InventorySectionAR::F_ID . ' = ia.' . InventoryAssortmentAR::F_INVENTORY_SECTION_ID ) ->where( [ 'iss.' . InventorySectionAR::F_TYPE_ID => InventorySectionAR::T_2_RADIO ] ) ->count() ); $sectionContent .= self::addObjectLimitData( Lang::getPhrase(628) , DeviceAR::find() ->innerJoin( InventoryAR::tableName() . ' as i', 'i.' . InventoryAR::F_ID . ' = ' . DeviceAR::tableName( ) . '.' . DeviceAR::F_INVENTORY_ID ) ->innerJoin( InventoryAssortmentAR::tableName() . ' as ia', 'ia.' . InventoryAssortmentAR::F_ID . ' = i.' . InventoryAR::F_INVENTORY_ASSORTMENT_ID ) ->innerJoin( InventorySectionAR::tableName() . ' as iss', 'iss.' . InventorySectionAR::F_ID . ' = ia.' . InventoryAssortmentAR::F_INVENTORY_SECTION_ID ) ->where( [ 'iss.' . InventorySectionAR::F_TYPE_ID => InventorySectionAR::T_3_MEDIC ] ) ->count() ); } if (Central::$erpProfileChapters[ErpProfileDto::CHAPTER_MAP]) { $sectionContent .= self::addObjectLimitData( BuildingAR::classCaption(), BuildingAR::find()->count() ); } if (Central::$erpProfileChapters[ErpProfileDto::CHAPTER_CABLE_LINE]) { $sectionContent .= self::addObjectLimitData( CableLineAR::classCaption(), CableLineAR::find()->count() ); } } else { $employee = Yii::$app->user->identity; $sectionContent .= ' 
                        <div class="item"> 
                            <div style="text-align: right; width: 250px"> 
                            </div> 
                            <div> 
                                <b>' . $employee->employeeProperty->getShortName() . '</b> 
                            </div> 
                        </div>'; $limits = EmployeeProfileAR::findOne(Html::$currentOperatorProfileId)->getUSOnlineLimit(); $addressArray = AddressUnit::getAllChildById( EmployeeCache::getCurrentAccessAddressId($employee->getId()) ); $cableLineTypesArray = CableLineTypeAR::find() ->where( [ CableLineTypeAR::F_AUTHOR_EMPLOYEE_ID => Html::$currentEmployeeId ] ) ->indexBy(CableLineTypeAR::F_ID) ->asArray() ->all(); $cableRouteArray = CableRouteAR::find() ->where( [ CableRouteAR::F_AUTHOR_EMPLOYEE_ID => Html::$currentEmployeeId ] ) ->indexBy(CableRouteAR::F_ID) ->asArray() ->all(); $sectionContent .= self::addObjectLimitData( Lang::getPhrase(3877) , count($addressArray), $limits[EmployeeProfileAR::USO_ADDRESS], '?core_section=' . BodyHtml::SECTION_SETTINGS_ADDRESS ); $sectionContent .= self::addObjectLimitData( NodeTypeAR::classCaption(), NodeTypeAR::find() ->where( [ NodeTypeAR::F_AUTHOR_EMPLOYEE_ID => Html::$currentEmployeeId ] ) ->count(), $limits[EmployeeProfileAR::USO_NODE_TYPE], '?core_section=' . BodyHtml::SECTION_SETTINGS_MAIN . '&action=' . SettingsMainHtml::A_NODE_TYPES ); $sectionContent .= self::addObjectLimitData( NodeAR::classCaption(), NodeAR::find() ->where( [ NodeAR::F_AUTHOR_EMPLOYEE_ID => Html::$currentEmployeeId ] ) ->count(), $limits[EmployeeProfileAR::USO_NODE] ); $sectionContent .= self::addObjectLimitData( CableLineTypeAR::classCaption(), count($cableLineTypesArray), $limits[EmployeeProfileAR::USO_CABLE_LINE_TYPE], '?core_section=' . BodyHtml::SECTION_SETTINGS_CABLE_LINE ); $sectionContent .= self::addObjectLimitData( Lang::getPhrase(5703) , CableColorAR::find() ->where( [ CableColorAR::F_AUTHOR_EMPLOYEE_ID => Html::$currentEmployeeId ] ) ->count(), $limits[EmployeeProfileAR::USO_CABLE_LINE_COLOR], '?core_section=' . BodyHtml::SECTION_SETTINGS_CABLE_LINE . '&action=' . SettingsCableLineHtml::A_FIBER_COLOR ); $sectionContent .= self::addObjectLimitData( CableCatalogAR::classCaption(), CableCatalogAR::find() ->where( [ CableCatalogAR::F_CABLE_LINE_TYPE_ID => Central::getArrayListForAR( $cableLineTypesArray ) ] ) ->count(), $limits[EmployeeProfileAR::USO_CABLE_CATALOG], '?core_section=' . BodyHtml::SECTION_SETTINGS_CABLE_LINE . '&action=' . SettingsCableLineHtml::A_FIBER_CABLE_CATALOG ); $sectionContent .= self::addObjectLimitData( CableLineAR::classCaption(), CableLineAR::find() ->where( [ CableLineAR::F_AUTHOR_EMPLOYEE_ID => Html::$currentEmployeeId ] ) ->count(), $limits[EmployeeProfileAR::USO_CABLE_LINE] ); $sectionContent .= self::addObjectLimitData( CableLineTrunkAR::classCaption(), CableLineTrunkAR::find() ->where( [ CableLineTrunkAR::F_AUTHOR_EMPLOYEE_ID => Html::$currentEmployeeId ] ) ->count(), $limits[EmployeeProfileAR::USO_CABLE_LINE_MAG], '?core_section=' . BodyHtml::SECTION_FIBER_MAG ); $sectionContent .= self::addObjectLimitData( CableRouteAR::classCaption(), count($cableRouteArray), $limits[EmployeeProfileAR::USO_CABLE_ROUTE], '?core_section=' . BodyHtml::SECTION_DUCT . '&action=' . DuctHtml::A_ROUTE_LIST ); $sectionContent .= self::addObjectLimitData( CableDuctAR::classCaption(), CableDuctAR::find() ->where( [ CableDuctAR::F_CABLE_ROUTE_ID => Central::getArrayListForAR( $cableRouteArray ) ] ) ->count(), $limits[EmployeeProfileAR::USO_CABLE_LINE_MAG], '?core_section=' . BodyHtml::SECTION_DUCT . '&action=' . DuctHtml::A_DUCT_LIST ); $sectionContent .= self::addObjectLimitData( CrossAR::classCaption(), CrossAR::find() ->where( [ CrossAR::F_AUTHOR_EMPLOYEE_ID => Html::$currentEmployeeId ] ) ->count(), $limits[EmployeeProfileAR::USO_CROSS], '?core_section=' . BodyHtml::SECTION_CROSS ); $sectionContent .= self::addObjectLimitData( SplitterAR::classCaption(), SplitterAR::find() ->where( [ SplitterAR::F_AUTHOR_EMPLOYEE_ID => Html::$currentEmployeeId ] ) ->count(), $limits[EmployeeProfileAR::USO_SPLITTER], '?core_section=' . BodyHtml::SECTION_SPLITTER ); $sectionContent .= self::addObjectLimitData( Lang::getPhrase(6053) , MapObjectAR::find() ->where( [ MapObjectAR::F_AUTHOR_EMPLOYEE_ID => Html::$currentEmployeeId, MapObjectAR::F_OBJECT_TYPE => MapObjectAR::OBJECT_TYPE_POLYGON ] ) ->count(), $limits[EmployeeProfileAR::USO_MAP_POLYGON] ); $sectionContent .= self::addObjectLimitData( Lang::getPhrase(1217) , AttachmentAR::find() ->where( [ AttachmentAR::F_EMPLOYEE_ID => Html::$currentEmployeeId ] ) ->count(), $limits[EmployeeProfileAR::USO_ATTACH] ); $sectionContent .= self::addObjectLimitData( OwnerAR::classCaption(), OwnerAR::find() ->where( [ OwnerAR::F_AUTHOR_EMPLOYEE_ID => Html::$currentEmployeeId ] ) ->count(), $limits[EmployeeProfileAR::USO_OWNER], '?core_section=' . BodyHtml::SECTION_OWNER ); $sectionContent .= self::addObjectLimitData( Lang::getPhrase(6051) , PageAR::find() ->where( [ PageAR::F_AUTHOR_EMPLOYEE_ID => Html::$currentEmployeeId ] ) ->count(), $limits[EmployeeProfileAR::USO_CUSTOM_PAGE], '?core_section=' . BodyHtml::SECTION_SETTINGS_MAIN . '&action=' . self::A_CUSTOM_PAGE_LIST . '&category=' . PageAR::CATEGORY_LEFT_MENU ); $sectionContent .= self::addObjectLimitData( Lang::getPhrase(6052) , MapObjectAR::find() ->where( [ MapObjectAR::F_AUTHOR_EMPLOYEE_ID => Html::$currentEmployeeId ] ) ->andWhere( ['<>', MapObjectAR::F_OBJECT_TYPE, MapObjectAR::OBJECT_TYPE_POLYGON] ) ->count(), $limits[EmployeeProfileAR::USO_MAP_OBJECT] ); $sectionContent .= self::addObjectLimitData( TagAR::classCaption(), TagAR::find() ->where( [ TagAR::F_AUTHOR_EMPLOYEE_ID => Html::$currentEmployeeId ] ) ->count(), $limits[EmployeeProfileAR::USO_LAYER], '?core_section=' . BodyHtml::SECTION_SETTINGS_MAIN . '&action=' . self::A_OBJECT_MARK_PAGE ); $sectionContent .= self::addObjectLimitData( AdditionalFieldAR::classCaption(), AdditionalFieldAR::find() ->where( [ TagAR::F_AUTHOR_EMPLOYEE_ID => Html::$currentEmployeeId ] ) ->count(), $limits[EmployeeProfileAR::USO_ADDITIONAL_DATA_CONFIG], '?core_section=' . BodyHtml::SECTION_SETTINGS_MAIN . '&item_id=' . self::ITEM_18 ); } break; case self::ITEM_99: $sectionName = Lang::getPhrase(730); $sectionContent = ''; if (Central::$isUSOnline === false) { $sectionContent .= ' 
                    <div class="div_space"> 
                        <a id="linkSqlCommandId" href="?core_section=settings_main&action=sql"><i class="us-icon fa-bars"></i>' . Lang::getPhrase( 3281 ) . '</a> 
                    </div>'; if ( Central::$erpProfileChapters[ErpProfileDto::CHAPTER_CUSTOMER] || Central::$erpProfileChapters[ErpProfileDto::CHAPTER_DEVICE] ) { $sectionContent .= ' 
                    <div class="div_space"> 
                        <a id="linkPingIpId" class="link_dashed" href="javascript:ajaxWindow(\'?core_section=settings_main&action=ping\');"><i class="us-icon fa-bars"></i><span>' . Lang::getPhrase( 3308 ) . '</span></a> 
                    </div> 
                    <div class="div_space"> 
                        <a id="linkArpId" class="link_dashed" href="javascript:ajaxWindow(\'?core_section=settings_main&action=arp\');"><i class="us-icon fa-bars"></i><span>' . Lang::getPhrase( 4793 ) . '</span></a> 
                    </div>'; } if (true !== Central::$isDemo) { $sectionContent .= ' 
                    <div class="div_space"> 
                        <a id="linkPhpInfoId" href="?core_section=settings_main&action=phpinfo"><i class="us-icon fa-bars"></i>phpinfo()</a> 
                    </div>'; } } $sectionContent .= ' 
                    <div class="div_space"> 
                        <a id="linkCustomPageId" href="?core_section=' . BodyHtml::SECTION_SETTINGS_MAIN . '&action=' . self::A_CUSTOM_PAGE_LIST . '&category=' . PageAR::CATEGORY_LEFT_MENU . '"><i class="us-icon fa-bars"></i>' . Lang::getPhrase( 5968 ) . '</a> 
                    </div> 
                    <div class="div_space"> 
                        <a id="linkCustomPageId" href="?core_section=' . BodyHtml::SECTION_SETTINGS_MAIN . '&action=' . self::A_CUSTOM_PAGE_LIST . '&category=' . PageAR::CATEGORY_TOP_MENU . '"><i class="us-icon fa-bars"></i>' . Lang::getPhrase( 5967 ) . '</a> 
                    </div>'; if (Central::$isUSOnline === false) { $sectionContent .= ' 
                    <div class="div_space"> 
                        <a id="linkMainMenuId" href="?core_section=settings_main&action=main_menu"><i class="us-icon fa-bars"></i>' . Lang::getPhrase( 5962 ) . '</a> 
                    </div>'; } if (Central::$isUSOnline === false) { $sectionContent .= ' 
                    <div class="div_space"> 
                        <a id="linkTableClearId" href="?core_section=settings_main&action=table_clear"><i class="us-icon fa-bars"></i>' . Lang::getPhrase( 5400 ) . '</a> 
                    </div> 
                    <div class="div_space"> 
                        <a id="linkAttachId" href="?core_section=settings_main&action=attach"><i class="us-icon fa-bars"></i>' . Lang::getPhrase( 1217 ) . '</a> 
                    </div> 
                    <div class="div_space"> 
                        <a id="linkFieldSearchGlobalId" href="?core_section=settings_main&action=search_fields&section_id=1"><i class="us-icon fa-bars"></i>' . Lang::getPhrase( 3771 ) . '</a> 
                    </div> 
                    <div class="div_space"> 
                        <a href="?core_section=settings_main&action=search_fields&section_id=2"><i class="us-icon fa-bars"></i>' . Lang::getPhrase( 3788 ) . '</a> 
                    </div>'; } $sectionContent .= ' 
                    <br>'; if (Central::$isUSOnline === false) { $sectionContent .= SettingsHtml::propertyDialog( SettingsCatalog::SYSTEM_ROW_PER_PAGE, 'VALUESTR', Lang::getPhrase(3359) , '(' . Lang::getPhrase(740) . ': 100)' ); if ( Central::$erpProfileChapters[ErpProfileDto::CHAPTER_CUSTOMER] || Central::$erpProfileChapters[ErpProfileDto::CHAPTER_DEVICE] ) { $sectionContent .= SettingsHtml::propertyDialog( SettingsCatalog::MAC_TYPE, 'VALUESTR', Lang::getPhrase(3362) ); } $sectionContent .= SettingsHtml::propertyDialog( SettingsCatalog::IS_QR_ONE_PER_PAGE, 'VALUEINT', Lang::getPhrase(5375) ); $sectionContent .= SettingsHtml::propertyDialog( SettingsCatalog::ANIMATE_SPEED, 'VALUESTR', Lang::getPhrase(3438) , '(' . Lang::getPhrase(740) . ': 400)' ); $sectionContent .= SettingsHtml::propertyDialog( SettingsCatalog::DATE_FULL_TEMPLATE, 'VALUESTR', Lang::getPhrase(5939) . ' d.m.Y H:i:s' ); $sectionContent .= SettingsHtml::propertyDialog( SettingsCatalog::DATE_MIDDLE_TEMPLATE, 'VALUESTR', Lang::getPhrase(5939) . ' d.m.Y H:i' ); $sectionContent .= SettingsHtml::propertyDialog( SettingsCatalog::DATE_SHORT_TEMPLATE, 'VALUESTR', Lang::getPhrase(5939) . ' d.m.Y' ); $sectionContent .= ' 
                    <div class="item" style="text-align: center; font-weight: bold"> 
                        ' . Lang::getPhrase(1217) . ' 
                    </div>'; $sectionContent .= SettingsHtml::propertyDialog( SettingsCatalog::ATTACH_IS_CONVERT_TO_JPEG, 'VALUEINT', Lang::getPhrase(5954) ); $sectionContent .= SettingsHtml::propertyDialog( SettingsCatalog::ATTACH_JPEG_QUALITY, 'VALUESTR', Lang::getPhrase(5955) , '(0-100)', SettingsCatalog::ATTACH_IS_CONVERT_TO_JPEG ); $sectionContent .= SettingsHtml::propertyDialog( SettingsCatalog::ATTACH_RESIZE_TO, 'VALUESTR', Lang::getPhrase(5956) , '(' . Lang::getPhrase(5957) . ')', SettingsCatalog::ATTACH_IS_CONVERT_TO_JPEG ); } break; case self::ITEM_1: default: $sectionName = Lang::getPhrase(719); $sectionContent = SettingsHtml::propertyDialog( SettingsCatalog::NET_NAME, 'VALUESTR', Lang::getPhrase(5427) ); $sectionContent .= SettingsHtml::propertyDialog( SettingsCatalog::MAIN_LANG, 'VALUESTR', Lang::getPhrase(5470) , '(' . Lang::getPhrase(740) . ': English)' ); if (1 != SettingAR::getByNameInt(SettingsCatalog::CUSTOMER_IS_ACTIVE_CUSTOMER_AREA)) { $sectionContent .= SettingsHtml::propertyDialog( SettingsCatalog::ENTER_TYPE, 'VALUESTR', Lang::getPhrase(738) , '<a target=_blank href="' . Central::$mainUrl . '">' . Central::$mainUrl . '</a>' ); } $sectionContent .= SettingsHtml::propertyDialog( SettingsCatalog::SYSTEM_CURRENCY, 'VALUESTR', Lang::getPhrase(5468) ); if ( Central::$erpProfileChapters[ErpProfileDto::CHAPTER_CUSTOMER] || Central::$erpProfileChapters[ErpProfileDto::CHAPTER_DEVICE] ) { $sectionContent .= SettingsHtml::propertyDialog( SettingsCatalog::ACTIVE_TIME, 'VALUESTR', Lang::getPhrase(5465) , '(' . Lang::getPhrase(740) . ': 15)', '', '(' . Lang::getPhrase(5466) . ')' ); } if (Central::$erpProfileChapters[ErpProfileDto::CHAPTER_DEVICE]) { $sectionContent .= SettingsHtml::propertyDialog( SettingsCatalog::ACTIVE_TIME_E, 'VALUESTR', Lang::getPhrase(5467) , '(' . Lang::getPhrase(740) . ': 15)', '', '(' . Lang::getPhrase(5466) . ')' ); } break; } return ' 
            <span class="label_h2">' . $sectionName . '</span> 
            <div class="table_block" style="width: 100%;"> 
                ' . $sectionContent . ' 
            </div>'; } public static function sliderSetting() { $content = " 
                <script> 
                    $(document).ready(function () { 
                        lc_switch('input[type=checkbox]', { 
                            on_color : '#1871A5', 
                            on_txt : '" . Lang::getPhrase(731) . "', 
                            off_txt : '" . Lang::getPhrase(732) . "' 
                        }); 
                        document.querySelectorAll('input').forEach(function(el) { 
                            el.addEventListener('lcs-statuschange', (e) => { 
                                if (el.checked == true) { 
                                    must_value = 1; 
                                } else { 
                                    must_value = 0; 
                                } 
                                var url = '?" . BodyHtml::CORES_SECTION . "=" . BodyHtml::SECTION_SETTINGS . "&action=change_boolean_value&option=' + el.value + '&must_value=' + must_value; 
                                $.ajax({ 
                                    url: url, 
                                    async: true, 
                                    success: function (data) { 
                                        $('div').each(function (i, elem) { 
                                            if ($(this).hasClass('classSet_' + el.value)) { 
                                                if (el.checked == true) { 
                                                    $(elem).show(); 
                                                } else { 
                                                    $(elem).hide(); 
                                                } 
                                            } 
                                        }); 
                                    }, 
                                    error: function (data) { 
                                        console.log('Error', data); 
                                        window.alert('Error!'); 
                                    } 
                                }); 
                            }); 
                        }); 
                    }); 
                </script>"; return $content; } private static function mainPage(): string { $itemId = RequestData::custom('item_id'); $currentItem = EmployeePropertyAR::getSessionCashe(EmployeePropertyAR::CACHE_36); if ( $itemId === '' || $itemId === '0' ) { if ( $currentItem !== '' && $currentItem !== '0' ) { $itemId = $currentItem; } else { $itemId = self::ITEM_1; $currentItem = $itemId; } } $currentItem = $itemId; EmployeePropertyAR::saveSessionCashe(EmployeePropertyAR::CACHE_36, $itemId); $content = ''; $menuArray = []; if (1 === OperatorAccess::isAccess(OperatorAccess::RIGHT_SETTING)) { $menuArray[] = [ 1 => '!', 2 => self::ITEM_1 ]; if (Central::$erpProfileChapters[ErpProfileDto::CHAPTER_MAP]) { $menuArray[] = [ 1 => Lang::getPhrase(647), 2 => self::ITEM_4 ]; } if (Central::$erpProfileChapters[ErpProfileDto::CHAPTER_DEVICE]) { $menuArray[] = [ 1 => Lang::getPhrase(624), 2 => self::ITEM_7 ]; } } if ( Central::$isUSOnline === true || 1 === OperatorAccess::isAccess(OperatorAccess::RIGHT_SETTING) ) { $menuArray[] = [ 1 => Lang::getPhrase(3809), 2 => self::ITEM_18 ]; } if (1 === OperatorAccess::isAccess(OperatorAccess::RIGHT_SETTING)) { $menuArray[] = [ 1 => Lang::getPhrase(3833), 2 => self::ITEM_19 ]; $menuArray[] = [ 1 => Lang::getPhrase(4743), 2 => self::ITEM_20 ]; if (Central::$erpProfileChapters[ErpProfileDto::CHAPTER_CUSTOMER]) { $menuArray[] = [ 1 => Lang::getPhrase(720), 2 => self::ITEM_2 ]; } if (Central::$erpProfileChapters[ErpProfileDto::CHAPTER_ACCOUNTANCY]) { $menuArray[] = [ 1 => Lang::getPhrase(607), 2 => self::ITEM_3 ]; } if (Central::$erpProfileChapters[ErpProfileDto::CHAPTER_CUSTOMER]) { $menuArray[] = [ 1 => Lang::getPhrase(595), 2 => self::ITEM_10 ]; } if ( Central::$erpProfileChapters[ErpProfileDto::CHAPTER_CUSTOMER] && 1 === SettingAR::getByNameInt(SettingsCatalog::NEWIN_IS) ) { $menuArray[] = [ 1 => Lang::getPhrase(4805), 2 => self::ITEM_21 ]; } $menuArray[] = [ 1 => Lang::getPhrase(5365), 2 => self::ITEM_23 ]; if (Central::$erpProfileChapters[ErpProfileDto::CHAPTER_WAREHOUSE]) { $menuArray[] = [ 1 => Lang::getPhrase(639), 2 => self::ITEM_24 ]; } $menuArray[] = [ 1 => Lang::getPhrase(652), 2 => self::ITEM_25 ]; if (Central::$erpProfileChapters[ErpProfileDto::CHAPTER_NODE]) { $menuArray[] = [ 1 => Lang::getPhrase(3802), 2 => self::ITEM_26 ]; } $menuArray[] = [ 1 => Lang::getPhrase(6068), 2 => self::ITEM_28 ]; $menuArray[] = [ 1 => 'WebSocket', 2 => self::ITEM_27 ]; } $menuArray = Central::sort( data: $menuArray, sortElement: 1, isSortAbc: true ); if ( Central::$isUSOnline === true || 1 === OperatorAccess::isAccess(OperatorAccess::RIGHT_SETTING) ) { if (Central::$isUSOnline !== true) { $menuArray[0] = [ 1 => Lang::getPhrase(719), 2 => self::ITEM_1 ]; } $menuArray[] = [ 1 => Lang::getPhrase(5383), 2 => self::ITEM_98 ]; $menuArray[] = [ 1 => Lang::getPhrase(730), 2 => self::ITEM_99 ]; } $isFind = false; foreach ($menuArray as $value) { if ((string)$value[2] === $itemId) { $isFind = true; } } if ($isFind === false) { EmployeePropertyAR::saveSessionCashe(EmployeePropertyAR::CACHE_36, self::ITEM_1); Html::locationCancel(); } $content .= ' 
            <div> 
                <script> 
                    function menu_set_change(ps_razdel) { 
                        for (var i = 0; i < 100; i++) { 
                            $("#element_menu_f_" + i).hide(); 
                            $("#element_menu_s_" + i).show(); 
                        } 
                        hideel("element_menu_s_" + ps_razdel); 
                        showel("element_menu_f_" + ps_razdel); 
                        $("#menu_set_body").load("?core_section=settings_main&action=load_menu_body&id=" + ps_razdel); 
                    } 
                </script>             
                <div class="menu_div_leftblock"> 
                    <ul>'; foreach ($menuArray as $value) { $content .= ' 
                            <li '; if ((string)$value[2] !== $currentItem) { $content .= 'style="display:none" '; } $content .= 'id="element_menu_f_' . $value[2] . '"> 
                            <span class="select_punkt">' . $value[1] . '</span> 
                        </li> 
                        <li '; if ((string)$value[2] === (string)$currentItem) { $content .= 'style="display:none" '; } $content .= 'id="element_menu_s_' . $value[2] . '"> 
                            <a id="linkMenuSet' . $value[2] . 'Id" href="javascript:menu_set_change(\'' . $value[2] . '\')" class="link_dashed"><span>' . $value[1] . '</span></a> 
                        </li>'; } $content .= ' 
                    </ul> 
                </div> 
                <div class="menu_div_rightblock"> 
                    <div id="menu_set_body" style="width: 100%;">'; $content .= self::editSettingsOption($currentItem) . '</div> 
                </div> 
            </div>'; return $content; } }  
/* cust:td:A30283E6_Z5aa2Kens54vGy/zwT9ZZNvyCm5SK8Ql */ 
 ?>

Did this file decode correctly?

Original Code

<?php
 namespace Legacy\Html; use erp\models\Attachment\Entity\Attachment; use erp\modules\ExternalServices\Domain\ExternalServiceRepository; use erp\modules\ExternalServices\Domain\ServiceStatusDto; use erp\modules\Staff\Ldap\LdapServer; use erp\modules\Staff\models\Employee; use erp\modules\SystemHealth\DataCollector\RabbitMq\RabbitMqCollector; use Exception; use InvalidArgumentException; use JsonException; use Legacy\AdditionalFieldAR; use Legacy\AdvertisementAR; use Legacy\AttachmentAR; use Legacy\BillingAR; use Legacy\BuildingAdditionalAddressAR; use Legacy\BuildingAR; use Legacy\CableCatalogAR; use Legacy\CableColorAR; use Legacy\CableDuctAR; use Legacy\CableLineAR; use Legacy\CableLineTrunkAR; use Legacy\CableLineTypeAR; use Legacy\CableRouteAR; use Legacy\Cache\AddressLocalityTypeCache; use Legacy\Cache\BillingCache; use Legacy\Cache\BuildingCache; use Legacy\Cache\CableLineTypeCache; use Legacy\Cache\CustomerStatusCache; use Legacy\Cache\CustomPageCache; use Legacy\Cache\EmployeeCache; use Legacy\Cache\EmployeeProfileCache; use Legacy\Cache\InventoryAssortmentCache; use Legacy\Cache\InventorySectionCache; use Legacy\Cache\MapNodeIconCache; use Legacy\Cache\NodeTypeCache; use Legacy\Cache\NodeTypeGroupCache; use Legacy\Cache\OwnerCache; use Legacy\Cache\RedisCache; use Legacy\Cache\TagCache; use Legacy\CrossAR; use Legacy\CustomerActivityLogAR; use Legacy\CustomerAR; use Legacy\CustomerGroupAR; use Legacy\CustomerStatusAR; use Legacy\DeviceAR; use Legacy\DeviceIfaceAutoLearningAR; use Legacy\DeviceObserverLogAR; use Legacy\DevicePelengLogAR; use Legacy\DevicePonLevelLogAR; use Legacy\DeviceSnmpProfileAR; use Legacy\EmployeeProfileAR; use Legacy\EmployeeProfilePageAR; use Legacy\EmployeePropertyAR; use Legacy\GpsRouteAR; use Legacy\InventoryAR; use Legacy\InventoryAssortmentAR; use Legacy\InventoryOperationAR; use Legacy\InventorySectionAR; use Legacy\InventorySubaccountAR; use Legacy\KeyAR; use Legacy\MapNodeIconAR; use Legacy\MapObjectAR; use Legacy\MapTileAR; use Legacy\Module\UsmAsterisk; use Legacy\MultiplexerAR; use Legacy\NodeAR; use Legacy\NodeTypeAdditionalFieldAR; use Legacy\NodeTypeAR; use Legacy\OwnerAR; use Legacy\PageAR; use Legacy\ReadModel\Dto\AdditionalFieldValueDto; use Legacy\ReadModel\Dto\EmployeeActionLogDto; use Legacy\ReadModel\Dto\EmployeeProfilesNodeTypesDto; use Legacy\ReadModel\Dto\EmployeeTableSettingDto; use Legacy\ReadModel\Dto\ErpProfileDto; use Legacy\ReadModel\Dto\IpAddressDto; use Legacy\ReadModel\Dto\MacsUnknownDto; use Legacy\ReadModel\Dto\NodeTypeGroupDto; use Legacy\ReadModel\Dto\SatellitesAddressesDto; use Legacy\ReadModel\Dto\SmsListConditionDto; use Legacy\ReadModel\Fetcher\AdditionalFieldValueFetcher; use Legacy\ReadModel\Fetcher\EmployeeActionLogFetcher; use Legacy\ReadModel\Fetcher\EmployeeProfilesNodeTypesFetcher; use Legacy\ReadModel\Fetcher\EmployeeTableSettingFetcher; use Legacy\ReadModel\Fetcher\IpAddressFetcher; use Legacy\ReadModel\Fetcher\MacsUnknownFetcher; use Legacy\ReadModel\Fetcher\NodeTypeGroupFetcher; use Legacy\ReadModel\Fetcher\SatellitesAddressesFetcher; use Legacy\ReadModel\Fetcher\SmsListConditionFetcher; use Legacy\ReadModel\System\AdditionalFieldValueSystem; use Legacy\ReadModel\System\EmployeeActionLogSystem; use Legacy\ReadModel\System\EmployeeProfilesNodeTypesSystem; use Legacy\ReadModel\System\EmployeeTableSettingSystem; use Legacy\ReadModel\System\NodeTypeGroupSystem; use Legacy\ReadModel\System\RackSystem; use Legacy\ReadModel\System\SatellitesAddressesSystem; use Legacy\ReadModel\System\VlanSystem; use Legacy\SatelliteAR; use Legacy\SettingAR; use Legacy\SplitterAR; use Legacy\StatisticsSystemAR; use Legacy\TagAR; use Legacy\TagObjectAR; use Legacy\TagsObjectTypesAR; use Legacy\TariffAR; use Legacy\TaskAR; use Legacy\TraderAR; use Legacy\TransportAR; use Legacy\Utility\Central; use Legacy\Utility\CommutationScheme; use Legacy\Utility\EmployeeHistoryType; use Legacy\Utility\ExportKml; use Legacy\Utility\Import; use Legacy\Utility\Lang; use Legacy\Utility\OperatorAccess; use Legacy\Utility\RequestData; use Legacy\Utility\SettingsCatalog; use Legacy\Utility\Table; use Legacy\Utility\WebSocket; use Legacy\WarehouseAR; use Legacy\WarehousesEmployeesAccessAR; use Legacy\YiiUtility\AddressLocalityType; use Legacy\YiiUtility\AddressUnit; use PDO; use Throwable; use Yii; use yii\base\InvalidConfigException; use yii\db\StaleObjectException; use yii\di\NotInstantiableException; class SettingsMainHtml { public const A_ADDITIONAL_FIELD_DELETE = 'additional_field_delete'; public const A_ADDITIONAL_FIELD_EDIT = 'additional_field_edit'; public const A_ADDITIONAL_FIELD_LIST = 'additional_field_list'; public const A_ADDITIONAL_FIELD_MERGE = 'additional_field_merge'; public const A_ADDITIONAL_FIELD_SAVE = 'additional_field_save'; public const A_AJAX_LOAD_ADDITIONAL_FIELD_LIST = 'ajax_load_additional_field_list'; public const A_CUSTOM_PAGE_DELETE = 'custom_page_delete'; public const A_CUSTOM_PAGE_DIALOG_ADD = 'custom_page_dialog_add'; public const A_CUSTOM_PAGE_DIALOG_EDIT = 'custom_page_dialog_edit'; public const A_CUSTOM_PAGE_LIST = 'custom_page_list'; public const A_CUSTOM_PAGE_SAVE = 'custom_page_save'; public const A_DIALOG_NODE_TYPE_GROUP = 'dialog_node_type_group'; public const A_LOAD_MENU_BODY = 'load_menu_body'; public const A_NODE_TYPES = 'node_types'; public const A_NODE_TYPE_ADD_EDIT = 'node_type_add_edit'; public const A_NODE_TYPE_DELETE = 'node_type_delete'; public const A_NODE_TYPE_GROUPS = 'node_type_groups'; public const A_NODE_TYPE_SAVE = 'node_type_save'; public const A_NODE_TYPE_SET_DEFAULT_CARD_EXTERIOR_FIELD = 'node_type_set_default_card_exterior_field'; public const A_OBJECT_MARK_PAGE = 'object_mark_page'; public const A_OBJECT_MARK_DIALOG_ADD = 'object_mark_dialog_add'; public const A_OBJECT_MARK_DIALOG_EDIT = 'object_mark_dialog_edit'; public const A_OBJECT_MARK_SAVE = 'object_mark_save'; public const A_OBJECT_MARK_DELETE = 'object_mark_delete'; public const A_DELETE_NODE_TYPE_GROUP = 'delete_node_type_group'; public const A_TABLE_PROPERTY_SAVE = 'table_property_save'; public const A_SAVE_NODE_TYPE_GROUP = 'save_node_type_group'; public const A_SHOW_LOG = 'show_log'; public const A_CHECK_ERROR_PAGE = 'check_error_page'; public const ITEM_1 = '1'; public const ITEM_2 = '2'; public const ITEM_3 = '3'; public const ITEM_4 = '4'; public const ITEM_7 = '7'; public const ITEM_10 = '10'; public const ITEM_18 = '18'; public const ITEM_19 = '19'; public const ITEM_20 = '20'; public const ITEM_21 = '21'; public const ITEM_23 = '23'; public const ITEM_24 = '24'; public const ITEM_25 = '25'; public const ITEM_26 = '26'; public const ITEM_27 = '27'; public const ITEM_28 = '28'; public const ITEM_98 = '98'; public const ITEM_99 = '99'; private const LOGS_ARRAY = [ 'core_error', 'sql_error', 'js_error', 'redis_log', 'asterisk_log', 'usm_poller', 'core-worker', 'slow_page', 'slow_250', 'slow_500', 'slow_1000', 'queue_jobs', 'poller' ]; public static function coreHtml(): string { Html::$menuSection = BodyHtml::SECTION_SETTINGS; Html::$pageTitleMain = Lang::getPhrase(669); Html::$pageTitleSecond = Lang::getPhrase(671); Html::$pageId = 75; Html::$helpPageId = 146; switch (RequestData::$action) { case self::A_ADDITIONAL_FIELD_MERGE: return self::additionalFieldMerge(); case self::A_ADDITIONAL_FIELD_DELETE: self::additionalFieldDelete(); case self::A_ADDITIONAL_FIELD_EDIT: return self::additionalFieldEdit(); case self::A_ADDITIONAL_FIELD_LIST: return self::additionalFieldList(); case self::A_ADDITIONAL_FIELD_SAVE: self::additionalFieldSave(); break; case self::A_DELETE_NODE_TYPE_GROUP: self::deleteNodeTypeGroup(); break; case self::A_AJAX_LOAD_ADDITIONAL_FIELD_LIST: return self::ajaxLoadAdditionalFieldList(); case 'arp': return self::arp(); case 'arp_mac': return self::arpMac(); case 'attach': return self::attach(); case 'change_additional_field_value': return self::changeAdditionalFieldValue(); case 'customer_group': return self::customerGroup(); case 'customer_group_delete': self::customerGroupDelete(); break; case 'customer_group_dialog_add': case 'customer_group_dialog_edit': return self::customerGroupDialogAddEdit(); case 'customer_group_save': self::customerGroupSave(); break; case 'tag_delete_image': self::tagDeleteImage(); break; case 'customer_state': return self::customerState(); case 'customer_state_delete': self::customerStateDelete(); break; case 'customer_state_dialog_add': case 'customer_state_dialog_edit': return self::customerStateDialogAddEdit(); case 'customer_state_save': self::customerStateSave(); break; case self::A_CUSTOM_PAGE_DELETE: self::customPageDelete(); break; case self::A_CUSTOM_PAGE_DIALOG_ADD: case self::A_CUSTOM_PAGE_DIALOG_EDIT: return self::customPageDialogAddEdit(); case self::A_CUSTOM_PAGE_LIST: return self::customPageList(); case self::A_CUSTOM_PAGE_SAVE: self::customPageSave(); break; case self::A_DIALOG_NODE_TYPE_GROUP: return self::dialogNodeTypeGroup(); case 'diag_delete_unuse_address': return self::deleteUnuseAddress(); case 'diag_reload_building_address': return self::reloadBuildingAddress(); case 'diag_system_stat': return self::diagSystemStat(); case 'diag_flush_redis_cache': return self::diagFlushRedisCache(); case 'diag_db_info': return self::diagDbInfo(); case 'device_autocommutation_on': self::deviceAutocommutationOn(); break; case 'device_profile': return self::deviceProfile(); case 'device_profile_delete': self::deviceProfileDelete(); break; case 'device_profile_dialog_add': case 'device_profile_dialog_edit': return self::deviceProfileDialogAddEdit(); case 'device_profile_save': self::deviceProfileSave(); break; case 'diag': return self::diag(); case 'diag_merge_addresses': return self::diagMergeAddresses(); case 'diag_notify': return self::diagNotify(); case 'diag_web_socket': return self::diagWebSocket(); case 'export_to_kml': return self::exportToKml(); case 'export_to_kml_save': self::exportToKmlSave(); break; case 'import': return self::import(); case 'inventory_sub_account': return self::inventorySubaccount(); case 'inventory_subaccount_delete': self::inventorySubaccountDelete(); break; case 'inventory_subaccount_dialog_add': case 'inventory_subaccount_dialog_edit': return self::inventorySubaccountDialogAddEdit(); case 'inventory_subaccount_save': self::inventorySubaccountSave(); break; case 'ldap': return self::ldap(); case 'ldap_save': self::ldapSave(); break; case self::A_LOAD_MENU_BODY: return self::loadMenuBody(); case 'main_menu': return self::mainMenu(); case 'main_menu_save_position': return self::mainMenuSavePosition(); case 'map_tile': return self::mapTile(); case 'map_tile_delete': self::mapTileDelete(); break; case 'map_tile_edit': return self::mapTileEdit(); case 'map_tile_save': self::mapTileSave(); break; case 'map_tile_save_position': return self::mapTileSavePosition(); case 'node_icon': return self::nodeIcon(); case 'node_icon_delete': self::nodeIconDelete(); break; case 'node_icon_save': self::nodeIconSave(); break; case 'node_icon_dialog_add': case 'node_icon_dialog_edit': return self::nodeIconDialogAddEdit(); case self::A_NODE_TYPES: return self::nodeTypes(); case self::A_NODE_TYPE_GROUPS: return self::nodeTypeGroups(); case self::A_NODE_TYPE_ADD_EDIT: return self::nodeTypeAddEdit(); case self::A_NODE_TYPE_DELETE: self::nodeTypeDelete(); break; case self::A_NODE_TYPE_SAVE: self::nodeTypeSave(); break; case self::A_NODE_TYPE_SET_DEFAULT_CARD_EXTERIOR_FIELD: self::nodeTypeSetDefaultCardExteriorField(); break; case self::A_OBJECT_MARK_DIALOG_ADD: case self::A_OBJECT_MARK_DIALOG_EDIT: return self::objectMarkDialogAddEdit(); case self::A_OBJECT_MARK_DELETE: self::objectMarkDelete(); break; case self::A_OBJECT_MARK_PAGE: return self::objectMarkPage(); case self::A_OBJECT_MARK_SAVE: self::objectMarkSave(); break; case self::A_SAVE_NODE_TYPE_GROUP: self::saveNodeTypeGroup(); break; case 'phpinfo': self::phpinfo(); break; case 'ping': return self::ping(); case 'ping_ip': return self::pingIp(); case 'repair_inventory': return self::repairInventory(); case 'repair_inventory_device': return self::repairInventoryDevice(); case 'repair_inventory_reload': return self::repairInventoryReload(); case 'repair_inv_splitter_to_node': return self::repairInvSplitterToNode(); case 'satellite': return self::satellite(); case 'satellite_dialog_add': case 'satellite_dialog_edit': return self::satelliteDialogAddEdit(); case 'satellite_delete': self::satelliteDelete(); break; case 'satellite_save': self::satelliteSave(); break; case 'satellite_test': return self::satelliteTest(); case 'search_fields': return self::searchFields(); case 'search_fields_save': self::searchFieldsSave(); break; case self::A_SHOW_LOG: return self::showLog(); case 'sql': return self::sql(); case 'table_clear': return self::tableClear(); case 'table_property': return self::tableProperty(); case self::A_TABLE_PROPERTY_SAVE: self::tablePropertySave(); break; case 'var_log': return self::varLog(); case 'verifik_files': return self::verifikFiles(); case 'weather_save_coord': self::weatherSaveCoord(); break; case self::A_CHECK_ERROR_PAGE: self::checkErrorPage(); break; default: return self::mainPage(); } return ''; } private static function repairInvSplitterToNode(): string { $id = RequestData::$id; Html::$isEmptyTemplate = true; OperatorAccess::verifyRight(OperatorAccess::RIGHT_SETTING); if ( SplitterAR::find() ->where( [ SplitterAR::F_INVENTORY_ID => $id ] ) ->count() > 0 ) { return 'Cancel. Yet!'; } $inventory = InventoryAR::findOne($id); $inventoryAssortment = InventoryAssortmentAR::findOne($inventory->getInventoryAssortmentId()); $paramInv = $inventoryAssortment->getOptions(); if ($paramInv === []) { return 'BAD options: ' . $inventory->getInventoryAssortmentId(); } $portCount = floor($paramInv['PORT1']); $ps_port2 = floor($paramInv['PORT2']); $splitterId = SplitterAR::create($inventory->getAccountObjectId(), $portCount, $ps_port2)->getId(); $splitter = SplitterAR::findOne($splitterId); $splitter->edit( [ SplitterAR::F_INVENTORY_ID => $id ] ); return 'Doing!'; } private static function additionalFieldEdit(): string { if (Central::$isUSOnline === false) { OperatorAccess::verifyRight(OperatorAccess::RIGHT_SETTING); } $id = RequestData::$id; $ret = '?' . BodyHtml::CORES_SECTION . '=' . BodyHtml::SECTION_SETTINGS_MAIN . '&action=' . self::A_ADDITIONAL_FIELD_LIST; $content = '
            <a href="' . $ret . '"><i class="us-icon fa-chevron-left"></i>' . Lang::getPhrase( 1580 ) . '</a><br>
            <br>
            <span class="label_h2">' . AdditionalFieldAR::classCaptionSingle() . '</span>'; $categories = []; if ($id > 0) { $additionalField = AdditionalFieldAR::findOne($id); if (!$additionalField) { throw new InvalidArgumentException( __CLASS__ . ' | ' . __FUNCTION__ . ' | AdditionalField #' . $id . ' not found' ); } $currentFieldType = $additionalField->getFieldType(); $exteriorArray = $additionalField->getExterior(); if ($additionalField->getCategories() !== null) { $categories = json_decode($additionalField->getCategories(), false, 512, JSON_THROW_ON_ERROR); $categories = array_flip($categories); } $additionalProperties = $additionalField->getAdditionalProperties(); } else { $additionalField = new AdditionalFieldAR(); $currentFieldType = 0; $exteriorArray = []; $additionalProperties = []; } $content .= '
            <br>
            <form method="post" name="form1" action="">
                <input type="hidden" name="' . BodyHtml::CORES_SECTION . '" value="' . BodyHtml::SECTION_SETTINGS_MAIN . '">
                <input type="hidden" name="action" value="' . self::A_ADDITIONAL_FIELD_SAVE . '">
                <input type="hidden" name="id" value="' . $id . '">
                <div class="table_block">'; if ($id > 0) { $content .= '
                    <div class="item">
                        <div class="left_data">
                            Id:
                        </div>
                        <div>
                            ' . $id . '
                        </div>
                    </div>'; } $content .= '
                    <div class="item">
                        <div class="left_data">
                            ' . Lang::getPhrase(1451) . ':
                        </div>
                        <div>
                            <input name="name" type="text" class="input_box" required size="50" maxlength="255" value=\'' . ($id > 0 ? $additionalField->getName( ) : '') . '\'>
                        </div>
                    </div>
                    <div class="item">
                        <div class="left_data">
                            ' . Lang::getPhrase(3836) . ':
                        </div>
                        <div>
                            <input name="position" type="text" size=3 maxlength=3 class="input_box" value="' . ($id > 0 ? $additionalField->getPosition( ) : '') . '">
                        </div>
                    </div>
                    <div class="item">
                        <div class="left_data">
                            ' . Lang::getPhrase(6115) . ':
                        </div>
                        <div>
                            <input name="hint" type="text" size=50 maxlength=255 class="input_box" value="' . ($id > 0 ? $additionalField->getHint( ) : '') . '">
                        </div>
                    </div>
                    <div class="item">
                        <div class="left_data">
                            ' . Lang::getPhrase(4463) . ':
                        </div>
                        <div>
                            <input name="is_required" type="checkbox"'; if ( $id > 0 && true === $additionalField->getIsRequire() ) { $content .= ' checked'; } $content .= ' value="1">                                        
                        </div>
                    </div>
                    <div class="item">
                        <div class="left_data">
                            ' . Lang::getPhrase(1124) . ':
                        </div>
                        <div>
                            <select id="fieldTypeId" name="field_type" size="1" onchange="reloadFieldType()">'; $catalogFieldType = AdditionalFieldAR::catalogFieldType(); foreach ($catalogFieldType as $tempTypeId => $tempFieldName) { $content .= '
                                
                                <option '; if ($tempTypeId === $currentFieldType) { $content .= 'selected '; } $content .= 'value="' . $tempTypeId . '">' . $tempFieldName . '</option>'; } $content .= '
                            </select>
                        </div>
                    </div>
                    <div class="item" id="perTypeId">
                        <div class="left_data">
                            ' . Lang::getPhrase(5893) . ':
                        </div>
                        <div>
                            <input name="is_per_type" type="checkbox"'; if (isset($exteriorArray['is_per_type'])) { $content .= ' checked'; } $content .= ' value="1">   
                        </div>
                    </div>
                    <div class="item" id="startValueId">
                        <div class="left_data">
                            ' . Lang::getPhrase(5894) . ':
                        </div>
                        <div>
                            <input name="start_value" type="text" size=5 maxlength=10 class="input_box" value="'; $content .= $exteriorArray['start_value'] ?? '1'; $content .= '">  
                        </div>
                    </div>
                    <div class="item" id="clearYearId">
                        <div class="left_data">
                            ' . Lang::getPhrase(5895) . ':
                        </div>
                        <div>
                            <input name="is_clear_year" type="checkbox"'; if (isset($exteriorArray['is_clear_year'])) { $content .= ' checked'; } $content .= ' value="1">   
                        </div>
                    </div>
                    <div class="item" id="clearMonthId">
                        <div class="left_data">
                            ' . Lang::getPhrase(5896) . ':
                        </div>
                        <div>
                            <input name="is_clear_month" type="checkbox"'; if (isset($exteriorArray['is_clear_month'])) { $content .= ' checked'; } $content .= ' value="1">   
                        </div>
                    </div>
                    <div class="item" id="fieldSizeId">
                        <div class="left_data">
                            ' . Lang::getPhrase(1127) . ' (size):<br>
                            <span class="info_block">' . Lang::getPhrase(1216) . ' 35</span>
                        </div>
                        <div>
                            <input name="field_size" type="text" size=3 maxlength=2 class="input_box" value="' . ($id > 0 ? $additionalField->getFieldSize( ) : 35) . '">
                        </div>
                    </div>
                    <div class="item" id="fieldMaxSizeId">
                        <div class="left_data">
                            ' . Lang::getPhrase(1128) . ' (maxlenght):
                        </div>
                        <div>
                            <input name="field_max_size" type="text" size=4 maxlength=3 class="input_box" value="' . ($id > 0 ? $additionalField->getFieldMaxSize( ) : 255) . '">
                        </div>
                    </div>'; if (Central::$isUSOnline === false) { $content .= '
                    <div class="item" id="specialTypeId">
                        <div class="left_data">
                            ' . Lang::getPhrase(1575) . ':
                        </div>
                        <div>
                            <select name="special_type" size="1">
                                <option value=""></option>
                                <option '; if ( $id > 0 && AdditionalFieldAR::SPECIAL_TYPE_PHONE_NUMBER === $additionalField->getSpecialType() ) { $content .= 'selected '; } $content .= 'value="' . AdditionalFieldAR::SPECIAL_TYPE_PHONE_NUMBER . '">' . Lang::getPhrase( 4720 ) . '</option>
                                <option '; if ( $id > 0 && AdditionalFieldAR::SPECIAL_TYPE_CABLE_LENGTH === $additionalField->getSpecialType() ) { $content .= 'selected '; } $content .= 'value="' . AdditionalFieldAR::SPECIAL_TYPE_CABLE_LENGTH . '">' . Lang::getPhrase( 1013 ) . '</option>
                            </select>                    
                        </div>
                    </div>'; } $content .= '
                    <div class="item" id="valueListId">
                        <div class="left_data">
                            ' . Lang::getPhrase(4176) . ':<br>
                            <span class="info_block">' . Lang::getPhrase(4177) . '</span>
                        </div>
                        <div>
                            <textarea class="textarea_class" name="value_list" cols="40" rows="10">' . ($id > 0 ? $additionalField->getValueList( ) : '') . '</textarea>
                        </div>
                    </div>
                    <div class="item">
                        <div class="left_data">
                            ' . Lang::getPhrase(5664) . ':
                        </div>
                        <div>
                            <input name="is_in_main_info" type="checkbox"'; if ( $id > 0 && true === $additionalField->getIsInMainInfo() ) { $content .= ' checked'; } $content .= ' value="1">                                        
                        </div>
                    </div>
                    <div class="item">
                        <div class="left_data">
                            ' . Lang::getPhrase(5665) . ':
                        </div>
                        <div>
                            <input name="is_in_top" type="checkbox"'; if ( $id > 0 && true === $additionalField->getIsInTopInfo() ) { $content .= ' checked'; } $content .= ' value="1">                                        
                        </div>
                    </div>
                    
                    <div class="item">
                        <div class="left_data">
                            ' . Lang::getPhrase(5882) . ':
                        </div>
                        <div>
                            <div class="div_space2">
                                ' . Lang::getPhrase( 5885 ) . ' <input name="field_exterior_fontsize" type="text" size=4 maxlength=3 class="input_box" value="'; if (isset($exteriorArray['fontsize'])) { $content .= $exteriorArray['fontsize']; } $content .= '">
                                ' . Lang::getPhrase( 5250 ) . ' <input name="field_exterior_fontcolor"  id="colorId" type="text" size=8 maxlength=7 class="input_box iColorPicker" value="'; if (isset($exteriorArray['fontcolor'])) { $content .= $exteriorArray['fontcolor']; } $content .= '">
                            </div>
                            <div class="div_space2">
                                <input name="field_exterior_bold" type="checkbox" value="1"'; if ( isset($exteriorArray['bold']) && 1 === (int)$exteriorArray['bold'] ) { $content .= ' checked'; } $content .= '> <b>bold</b>
                            </div>
                            <div class="div_space2">
                                <input name="field_exterior_italic" type="checkbox" value="1"'; if ( isset($exteriorArray['italic']) && 1 === (int)$exteriorArray['italic'] ) { $content .= ' checked'; } $content .= '> <i>italic</i>
                            </div>
                        </div>
                    </div>
                    
                    <div class="item">
                        <div class="left_data">
                            ' . Lang::getPhrase(6119) . ':
                        </div>
                        <div>'; $catalog = AdditionalFieldAR::getCatalog(); foreach ($catalog as $categoryId => $value) { $content .= '
                            <div class="div_space">
                                <input id="categories' . $categoryId . 'Id" name="categories[]" type="checkbox"'; if (isset($categories[$categoryId])) { $content .= ' checked'; } $content .= ' value=' . $categoryId . '> ' . $value['name']; if ($categoryId === AdditionalFieldAR::CATEGORY_NODE) { $content .= ' - <span class="info_block">(' . Lang::getPhrase( 3608 ) . ' "<a href="?core_section=' . BodyHtml::SECTION_SETTINGS_MAIN . '&action=' . self::A_NODE_TYPES . '">' . NodeAR::classCaption( ) . '</a>" ' . Lang::getPhrase( 5771 ) . ')</span>'; } if ($categoryId === AdditionalFieldAR::CATEGORY_TASK) { $content .= ' - <span class="info_block">(' . Lang::getPhrase( 3608 ) . ' "<a href="?core_section=settings_task">' . Lang::getPhrase( 676 ) . '</a>" ' . Lang::getPhrase( 5771 ) . ')</span>'; } $content .= '
                            </div>'; if ($categoryId === AdditionalFieldAR::CATEGORY_CUSTOMER) { $content .= '
                            <div class="div_space">
                                &nbsp; &nbsp; &nbsp; &nbsp;  
                                <input name="additional_properties_' . AdditionalFieldAR::ADDITIONAL_PROPERTIES_CUSTOMER_PRIVATE . '" type="checkbox"'; if ( isset($additionalProperties[AdditionalFieldAR::ADDITIONAL_PROPERTIES_CUSTOMER_PRIVATE]) && 1 === (int)$additionalProperties[AdditionalFieldAR::ADDITIONAL_PROPERTIES_CUSTOMER_PRIVATE] ) { $content .= ' checked'; } $content .= ' value="1"> ' . Lang::getPhrase(4251) . ' 
                            </div>
                            <div class="div_space">
                                &nbsp; &nbsp; &nbsp; &nbsp;  
                                <input name="additional_properties_' . AdditionalFieldAR::ADDITIONAL_PROPERTIES_CUSTOMER_CORPORATE . '" type="checkbox"'; if ( isset($additionalProperties[AdditionalFieldAR::ADDITIONAL_PROPERTIES_CUSTOMER_CORPORATE]) && 1 === (int)$additionalProperties[AdditionalFieldAR::ADDITIONAL_PROPERTIES_CUSTOMER_CORPORATE] ) { $content .= ' checked'; } $content .= ' value="1"> ' . Lang::getPhrase( 4252 ) . ' 
                            </div>
                            <div class="div_space">
                                &nbsp; &nbsp; &nbsp; &nbsp;  
                                <input name="additional_properties_' . AdditionalFieldAR::ADDITIONAL_PROPERTIES_CUSTOMER_POTENTIAL_PRIVATE . '" type="checkbox"'; if ( isset($additionalProperties[AdditionalFieldAR::ADDITIONAL_PROPERTIES_CUSTOMER_POTENTIAL_PRIVATE]) && 1 == $additionalProperties[AdditionalFieldAR::ADDITIONAL_PROPERTIES_CUSTOMER_POTENTIAL_PRIVATE] ) { $content .= ' checked'; } $content .= ' value="1"> ' . Lang::getPhrase( 5125 ) . ' - ' . Lang::getPhrase( 4251 ) . ' 
                            </div>
                            <div class="div_space">
                                &nbsp; &nbsp; &nbsp; &nbsp;  
                                <input name="additional_properties_' . AdditionalFieldAR::ADDITIONAL_PROPERTIES_CUSTOMER_POTENTIAL_CORPORATE . '" type="checkbox"'; if ( isset($additionalProperties[AdditionalFieldAR::ADDITIONAL_PROPERTIES_CUSTOMER_POTENTIAL_CORPORATE]) && 1 === (int)$additionalProperties[AdditionalFieldAR::ADDITIONAL_PROPERTIES_CUSTOMER_POTENTIAL_CORPORATE] ) { $content .= ' checked'; } $content .= ' value="1"> ' . Lang::getPhrase( 5125 ) . ' - ' . Lang::getPhrase( 4252 ) . ' 
                            </div>'; } } $content .= '
                        </div>
                    </div>
                </div>
                <script src="../main/js/icolorpicker.js?t=' . time() . '"></script>
                <script>
                    function reloadFieldType() {
                        var fieldTypeId = document.getElementById("fieldTypeId").value;
                        $("#valueListId").hide();
                        if (
                            fieldTypeId == "' . AdditionalFieldAR::FIELD_TYPE_STRING . '" 
                            || 
                            fieldTypeId == "' . AdditionalFieldAR::FIELD_TYPE_STRING_UNIQUE . '" 
                            || 
                            fieldTypeId == "' . AdditionalFieldAR::FIELD_TYPE_INT . '" 
                            || 
                            fieldTypeId == "' . AdditionalFieldAR::FIELD_TYPE_TEXTAREA . '"
                        ) {
                            $("#fieldSizeId").show();
                            $("#fieldMaxSizeId").hide();
                            if (
                                fieldTypeId == "' . AdditionalFieldAR::FIELD_TYPE_STRING . '" 
                                || 
                                fieldTypeId == "' . AdditionalFieldAR::FIELD_TYPE_STRING_UNIQUE . '" 
                                || 
                                fieldTypeId == "' . AdditionalFieldAR::FIELD_TYPE_INT . '" 
                                ) {
                                $("#fieldMaxSizeId").show();
                            }
                        } else {
                            $("#fieldSizeId").hide();
                            $("#fieldMaxSizeId").hide();
                            if (
                                fieldTypeId == "' . AdditionalFieldAR::FIELD_TYPE_SELECTOR . '" 
                                || 
                                fieldTypeId == "' . AdditionalFieldAR::FIELD_TYPE_SELECTOR_CUSTOM . '" 
                                ||
                                fieldTypeId == "' . AdditionalFieldAR::FIELD_TYPE_SELECTOR_MULTIPLE . '" 
                            ) {
                                $("#valueListId").show();
                            }
                        }
                        if (
                            fieldTypeId == "' . AdditionalFieldAR::FIELD_TYPE_STRING . '"
                        ) {
                            $("#specialTypeId").show();
                        } else {
                            $("#specialTypeId").hide();
                        }
                        if (
                            fieldTypeId == "' . AdditionalFieldAR::FIELD_TYPE_COUNTER . '"
                        ) {
                            $("#perTypeId").show();
                            $("#startValueId").show();
                            $("#clearYearId").show();
                            $("#clearMonthId").show();
                        } else {
                            $("#perTypeId").hide();
                            $("#startValueId").hide();
                            $("#clearYearId").hide();
                            $("#clearMonthId").hide();
                        }
                    }
                    reloadFieldType();
                </script>
                ' . BodyHtml::formButton('save_cancel', $ret) . '
            </form>'; if ($id > 0) { $tempCount = Yii::$container ->get(AdditionalFieldValueFetcher::class) ->getCountByCondition( [ AdditionalFieldValueDto::F_ADDITIONAL_FIELD_ID => $id ] ); if (0 < $tempCount) { $content .= '
                        <br>
                        <div class="div_space">
                            <span class="info_block">' . Lang::getPhrase( 1129 ) . ': <b>' . $tempCount . '</b> </span>'; if (Central::$isUSOnline === false) { $content .= BodyHtml::linkConfirm( '?' . BodyHtml::CORES_SECTION . '=' . BodyHtml::SECTION_ADDITIONAL_DATA . '&action=' . AdditionalDataHtml::A_DELETE_VALUE . '&id=' . $id, Lang::getPhrase(1415), Lang::getPhrase(1150) , '<i class="us-icon fa-times"></i>', 'linkConfirmDeleteValue' . $id . 'Id' ); } $content .= '
                        </div>'; } $content .= '<br>' . BodyHtml::linkConfirm( url: '?' . BodyHtml::CORES_SECTION . '=' . BodyHtml::SECTION_SETTINGS_MAIN . '&action=' . self::A_ADDITIONAL_FIELD_DELETE . '&id=' . $id, caption: Lang::getPhrase(1415), confirmText: Lang::getPhrase(1150) . '?', linkBodyFull: '<i class="us-icon us-icon-danger fa-close"></i>' . Lang::getPhrase(1415) , linkTextId: 'linkConfirmDeleteFieldId' ); } return $content; } private static function checkErrorPage(): void { OperatorAccess::verifyRight(OperatorAccess::RIGHT_SETTING); throw new Exception('TestErrorPage'); } private static function additionalFieldMerge(): string { OperatorAccess::verifyRight(OperatorAccess::RIGHT_SETTING); $dstFieldId = RequestData::customInt('dst_field_id'); $srcFieldId = RequestData::customInt('src_field_id'); if ($srcFieldId > 0) { AdditionalFieldValueSystem::changeFieldId($srcFieldId, $dstFieldId); EmployeeActionLogSystem::writeLog( EmployeeHistoryType::T593, AdditionalFieldAR::OBJECT_TYPE_ID, $srcFieldId ); $ret = '?core_section=settings_main&item_id=' . self::ITEM_18; Html::location($ret, Html::TYPE_MSG_UPDOK); } $additionalDataConfigs = AdditionalFieldAR::find() ->orderBy(AdditionalFieldAR::F_NAME) ->all(); $ret = '?core_section=settings_main&item_id=' . self::ITEM_18; $content = '
            <a href="' . $ret . '"><i class="us-icon fa-chevron-left"></i>' . Lang::getPhrase( 1443 ) . '</a><br>
            <br>
            <span class="label_h2">' . AdditionalFieldAR::classCaption() . '</span>
            <br>
            <br>
            <span class="label_h3">' . Lang::getPhrase(6120) . '</span><br>
            <form method="post" name="form1" action="">
                <input type="hidden" name="' . BodyHtml::CORES_SECTION . '" value="' . BodyHtml::SECTION_SETTINGS_MAIN . '">
                <input type="hidden" name="action" value="' . self::A_ADDITIONAL_FIELD_MERGE . '">
                <div class="table_block">
                    <div class="item">
                        <div class="left_data">
                            ' . Lang::getPhrase(5229) . ':
                        </div>
                        <div>
                            <select name="dst_field_id" size="1">'; foreach ($additionalDataConfigs as $additionalDataConfig) { $content .= '
                                <option value="' . $additionalDataConfig->getId( ) . '">' . $additionalDataConfig->getName() . ' (#' . $additionalDataConfig->getId() . ')</option>'; } $content .= '
                            <select>
                        </div>
                    </div>
                    <div class="item">
                        <div class="left_data">
                            ' . Lang::getPhrase(1518) . ':
                        </div>
                        <div>
                            <select name="src_field_id" size="1">'; foreach ($additionalDataConfigs as $additionalDataConfig) { $content .= '
                                <option value="' . $additionalDataConfig->getId( ) . '">' . $additionalDataConfig->getName() . ' (#' . $additionalDataConfig->getId() . ')</option>'; } $content .= '
                            <select>
                        </div>
                    </div>
                </div>
                ' . BodyHtml::formButton('save_cancel', $ret) . '
            </form>'; return $content; } private static function changeAdditionalFieldValue(): string { OperatorAccess::verifyRight(OperatorAccess::RIGHT_SETTING); $fieldId = RequestData::customInt('field_id'); if ($fieldId > 0) { $newValue = RequestData::customTrue('new_value'); $oldValue = RequestData::customTrue('old_value'); AdditionalFieldValueSystem::replaceValue($fieldId, $oldValue, $newValue); EmployeeActionLogSystem::writeLog( EmployeeHistoryType::T593, AdditionalFieldAR::OBJECT_TYPE_ID, $fieldId ); Html::locationBackOk(); } $additionalDataCatalog = AdditionalFieldAR::getCatalog(); $additionalDataConfigs = AdditionalFieldAR::find() ->orderBy(AdditionalFieldAR::F_NAME) ->all(); $ret = '?core_section=settings_main&item_id=' . self::ITEM_18; $content = '
            <a href="' . $ret . '"><i class="us-icon fa-chevron-left"></i>' . Lang::getPhrase( 1443 ) . '</a><br>
            <br>
            <span class="label_h2">' . AdditionalFieldAR::classCaption() . '</span>
            <br>
            <br>
            <span class="label_h3">' . Lang::getPhrase(5990) . '</span><br>
            <i>(' . Lang::getPhrase(5993) . ')</i>
            <form method="post" name="form1" action="">
                <input type="hidden" name="core_section" value="settings_main">
                <input type="hidden" name="action" value="change_additional_field_value">
                <div class="table_block">
                    <div class="item">
                        <div class="left_data">
                            ' . Lang::getPhrase(5609) . ':
                        </div>
                        <div>
                            <select name="field_id" size="1">'; foreach ($additionalDataConfigs as $additionalDataConfig) { $content .= '
                                <option value="' . $additionalDataConfig->getId( ) . '">' . $additionalDataConfig->getName() . ' (#' . $additionalDataConfig->getId() . ')</option>'; } $content .= '
                            <select>
                        </div>
                    </div>
                    <div class="item">
                        <div class="left_data">
                            ' . Lang::getPhrase(5991) . ':
                        </div>
                        <div>
                            <input name="old_value" type="text" size=30 maxlength=255 class="input_box" value="">
                        </div>
                    </div>
                    <div class="item">
                        <div class="left_data">
                            ' . Lang::getPhrase(5992) . ':
                        </div>
                        <div>
                            <input name="new_value" type="text" size=30 maxlength=255 class="input_box" value="">
                        </div>
                    </div>
                </div>
                ' . BodyHtml::formButton('save_cancel', $ret, Lang::getPhrase(735) ) . '
            </form>'; return $content; } public static function diagFlushRedisCache(): string { Html::$isEmptyTemplate = true; RedisCache::clearByTemplate('*'); return 'Doing!'; } public static function diagDbInfo(): string { OperatorAccess::verifyRight(OperatorAccess::RIGHT_SETTING); $content = '<span class="label_h2">DB Info</span><br>
            <br>'; $query = "SELECT pg_size_pretty(pg_database_size(current_database()))"; $stmt = Yii::$app->db->masterPdo->prepare($query); $stmt->execute(); $value = $stmt->fetch(PDO::FETCH_ASSOC); $content .= 'Total DBSize: <b>' . $value['pg_size_pretty'] . '</b><br>'; $content .= '<br>Size:<br>'; $data = []; $query = "SELECT nspname || '.' || relname AS relation,
    pg_size_pretty(pg_relation_size(C.oid)) AS size
  FROM pg_class C
  LEFT JOIN pg_namespace N ON (N.oid = C.relnamespace)
  WHERE nspname NOT IN ('pg_catalog', 'information_schema')
  ORDER BY pg_relation_size(C.oid) DESC
  LIMIT 20"; $stmt = Yii::$app->db->masterPdo->prepare($query); $stmt->execute(); while ($value = $stmt->fetch(PDO::FETCH_ASSOC)) { $data[] = [ 'table_name' => $value['relation'], 'size' => $value['size'] ]; } $field = [ [ 'SPECIAL' => '_number' ], [ 'NAME' => 'Table', 'EL' => 'table_name' ], [ 'NAME' => 'Size', 'ALIGN' => 'right', 'EL' => 'size' ] ]; $table = new Table(); $content .= $table->show($data, $field); $content .= '<br><br>Size with index:<br>'; $data = []; $query = "SELECT nspname || '.' || relname AS relation,
    pg_size_pretty(pg_total_relation_size(C.oid)) AS size
  FROM pg_class C
  LEFT JOIN pg_namespace N ON (N.oid = C.relnamespace)
  WHERE nspname NOT IN ('pg_catalog', 'information_schema')
    AND C.relkind <> 'i'
    AND nspname !~ '^pg_toast'
  ORDER BY pg_total_relation_size(C.oid) DESC
  LIMIT 50"; $stmt = Yii::$app->db->masterPdo->prepare($query); $stmt->execute(); while ($value = $stmt->fetch(PDO::FETCH_ASSOC)) { $data[] = [ 'table_name' => $value['relation'], 'size' => $value['size'] ]; } $field = [ [ 'SPECIAL' => '_number' ], [ 'NAME' => 'Table', 'EL' => 'table_name' ], [ 'NAME' => 'Size', 'ALIGN' => 'right', 'EL' => 'size' ] ]; $table = new Table(); $content .= $table->show($data, $field); return $content; } public static function diagSystemStat(): string { OperatorAccess::verifyRight(OperatorAccess::RIGHT_SETTING); $content = '<span class="label_h2">SystemStat</span><br>
            <br>'; $month = RequestData::custom('month'); $array = StatisticsSystemAR::find() ->select( [ 'month' => StatisticsSystemAR::F_MONTH, 'sum' => 'COUNT(*)' ] ) ->indexBy(StatisticsSystemAR::F_MONTH) ->groupBy(StatisticsSystemAR::F_MONTH) ->asArray() ->all(); foreach ($array as $value) { $content .= '
                <div class="div_space">
                    &bull; <a href="?core_section=settings_main&action=diag_system_stat&month=' . $value['month'] . '">' . $value['month'] . '</a> (' . $value['sum'] . ')
                </div>'; } if ('' != $month) { $content .= '
                <br>
                <span class="label_h3">' . $month . '</span><br>'; $data = StatisticsSystemAR::find() ->select( [ 'section' => StatisticsSystemAR::F_SECTION, 'action' => StatisticsSystemAR::F_ACTION, 'sum' => 'COUNT(*)', 'sum_all_sql_counter' => 'SUM(' . StatisticsSystemAR::F_ALL_SQL_COUNTER . ')', 'sum_all_time' => 'SUM(' . StatisticsSystemAR::F_ALL_TIME . ')', 'sum_all_mem' => 'SUM(' . StatisticsSystemAR::F_ALL_MEMORY . ')' ] ) ->where( [ StatisticsSystemAR::F_MONTH => $month ] ) ->groupBy( [ StatisticsSystemAR::F_SECTION, StatisticsSystemAR::F_ACTION ] ) ->asArray() ->all(); $totalCounter = []; foreach ($data as $value) { $totalCounter['sum'] = !isset($totalCounter['sum']) ? $value['sum'] : $totalCounter['sum'] + $value['sum']; $totalCounter['sum_all_sql_counter'] = !isset($totalCounter['sum_all_sql_counter']) ? $value['sum_all_sql_counter'] : $totalCounter['sum_all_sql_counter'] + $value['sum_all_sql_counter']; $totalCounter['sum_all_time'] = !isset($totalCounter['sum_all_time']) ? $value['sum_all_time'] : $totalCounter['sum_all_time'] + $value['sum_all_time']; $totalCounter['sum_all_mem'] = !isset($totalCounter['sum_all_mem']) ? $value['sum_all_mem'] : $totalCounter['sum_all_mem'] + $value['sum_all_mem']; } foreach ($data as $i => $value) { $data[$i]['sql_per_one_full'] = $value['sum_all_sql_counter'] / $value['sum'] * 1000; $data[$i]['sql_per_one'] = round($data[$i]['sql_per_one_full'] * 0.001, 2); $data[$i]['time_per_one_full'] = $value['sum_all_time'] / $value['sum'] * 1000; $data[$i]['time_per_one'] = round($data[$i]['time_per_one_full'] * 0.001, 2); $data[$i]['mem_per_one_full'] = $value['sum_all_mem'] / $value['sum']; $data[$i]['mem_per_one'] = round($data[$i]['mem_per_one_full'] * 0.000001, 2) . ' M'; $data[$i]['sum_percent'] = round($value['sum'] / $totalCounter['sum'], 3) * 100; if ($value['sum_all_sql_counter'] > 0) { $data[$i]['sum_all_sql_counter_percent'] = round( $value['sum_all_sql_counter'] / $totalCounter['sum_all_sql_counter'], 3 ) * 100; } if ($value['sum_all_time'] > 0) { $data[$i]['sum_all_time_percent'] = round( $value['sum_all_time'] / $totalCounter['sum_all_time'], 3 ) * 100; } if ($value['sum_all_mem'] > 0) { $data[$i]['sum_all_mem_percent'] = round( $value['sum_all_mem'] / $totalCounter['sum_all_mem'], 3 ) * 100; } } $field = [ [ 'SPECIAL' => '_number' ], [ 'NAME' => 'Section', 'EL' => 'section' ], [ 'NAME' => 'Action', 'EL' => 'action' ], [ 'NAME' => 'Counter', 'ALIGN' => 'right', 'EL' => 'sum', 'IS_TOTAL' => 1, 'ISSORT' => 1 ], [ 'NAME' => '%', 'ALIGN' => 'right', 'EL' => 'sum_percent', 'ISSORT' => 1 ], [ 'NAME' => 'All SQL Counter', 'ALIGN' => 'right', 'EL' => 'sum_all_sql_counter', 'IS_TOTAL' => 1, 'ISSORT' => 1 ], [ 'NAME' => '%', 'ALIGN' => 'right', 'EL' => 'sum_all_sql_counter_percent', 'ISSORT' => 1 ], [ 'NAME' => 'All Time', 'ALIGN' => 'right', 'EL' => 'sum_all_time', 'IS_TOTAL' => 1, 'ISSORT' => 1 ], [ 'NAME' => '%', 'ALIGN' => 'right', 'EL' => 'sum_all_time_percent', 'ISSORT' => 1 ], [ 'NAME' => 'All Mem', 'ALIGN' => 'right', 'EL' => 'sum_all_mem', 'IS_TOTAL' => 1, 'ISSORT' => 1 ], [ 'NAME' => '%', 'ALIGN' => 'right', 'EL' => 'sum_all_mem_percent', 'ISSORT' => 1 ], [ 'NAME' => 'SQL/1', 'ALIGN' => 'right', 'EL' => 'sql_per_one', 'EL_SORT' => 'sql_per_one_full', 'ISSORT' => 1 ], [ 'NAME' => 'Time/1', 'ALIGN' => 'right', 'EL' => 'time_per_one', 'EL_SORT' => 'time_per_one_full', 'ISSORT' => 1 ], [ 'NAME' => 'Mem/1', 'ALIGN' => 'right', 'EL' => 'mem_per_one', 'EL_SORT' => 'mem_per_one_full', 'ISSORT' => 1 ] ]; $table = new Table(); $table->sortDefault = 'sum'; $table->isSortDesc = 1; $table->customPerPage = 'all'; $content .= $table->show($data, $field); $content .= '
                <br><br>'; $data = StatisticsSystemAR::find() ->select( [ 'section' => StatisticsSystemAR::F_SECTION, 'sum' => 'COUNT(*)', 'sum_all_sql_counter' => 'SUM(' . StatisticsSystemAR::F_ALL_SQL_COUNTER . ')', 'sum_all_time' => 'SUM(' . StatisticsSystemAR::F_ALL_TIME . ')', 'sum_all_mem' => 'SUM(' . StatisticsSystemAR::F_ALL_MEMORY . ')' ] ) ->where( [ StatisticsSystemAR::F_MONTH => $month ] ) ->groupBy(StatisticsSystemAR::F_SECTION) ->asArray() ->all(); $totalCounter = []; foreach ($data as $value) { $totalCounter['sum'] = !isset($totalCounter['sum']) ? $value['sum'] : $totalCounter['sum'] + $value['sum']; $totalCounter['sum_all_sql_counter'] = !isset($totalCounter['sum_all_sql_counter']) ? $value['sum'] : $totalCounter['sum_all_sql_counter'] + $value['sum_all_sql_counter']; $totalCounter['sum_all_time'] = !isset($totalCounter['sum_all_time']) ? $value['sum_all_time'] : $totalCounter['sum_all_time'] + $value['sum_all_time']; $totalCounter['sum_all_mem'] = !isset($totalCounter['sum_all_mem']) ? $value['sum_all_mem'] : $totalCounter['sum_all_mem'] + $value['sum_all_mem']; } foreach ($data as $i => $value) { $data[$i]['sql_per_one_full'] = $value['sum_all_sql_counter'] / $value['sum'] * 1000; $data[$i]['sql_per_one'] = round($data[$i]['sql_per_one_full'] * 0.001, 2); $data[$i]['time_per_one_full'] = $value['sum_all_time'] / $value['sum'] * 1000; $data[$i]['time_per_one'] = round($data[$i]['time_per_one_full'] * 0.001, 2); $data[$i]['mem_per_one_full'] = $value['sum_all_mem'] / $value['sum']; $data[$i]['mem_per_one'] = round($data[$i]['mem_per_one_full'] * 0.000001, 2) . ' M'; $data[$i]['sum_percent'] = round($value['sum'] / $totalCounter['sum'], 3) * 100; if ($value['sum_all_sql_counter'] > 0 && $totalCounter['sum_all_sql_counter'] > 0) { $data[$i]['sum_all_sql_counter_percent'] = round( $value['sum_all_sql_counter'] / $totalCounter['sum_all_sql_counter'], 3 ) * 100; } if ($value['sum_all_time'] > 0 && $totalCounter['sum_all_time'] > 0) { $data[$i]['sum_all_time_percent'] = round( $value['sum_all_time'] / $totalCounter['sum_all_time'], 3 ) * 100; } if ($value['sum_all_mem'] > 0 && $totalCounter['sum_all_mem'] > 0) { $data[$i]['sum_all_mem_percent'] = round( $value['sum_all_mem'] / $totalCounter['sum_all_mem'], 3 ) * 100; } } $field = [ [ 'SPECIAL' => '_number' ], [ 'NAME' => 'Section', 'EL' => 'section' ], [ 'NAME' => 'Counter', 'ALIGN' => 'right', 'EL' => 'sum', 'IS_TOTAL' => 1, 'ISSORT' => 1 ], [ 'NAME' => '%', 'ALIGN' => 'right', 'EL' => 'sum_percent', 'ISSORT' => 1 ], [ 'NAME' => 'All SQL Counter', 'ALIGN' => 'right', 'EL' => 'sum_all_sql_counter', 'IS_TOTAL' => 1, 'ISSORT' => 1 ], [ 'NAME' => '%', 'ALIGN' => 'right', 'EL' => 'sum_all_sql_counter_percent', 'ISSORT' => 1 ], [ 'NAME' => 'All Time', 'ALIGN' => 'right', 'EL' => 'sum_all_time', 'IS_TOTAL' => 1, 'ISSORT' => 1 ], [ 'NAME' => '%', 'ALIGN' => 'right', 'EL' => 'sum_all_time_percent', 'ISSORT' => 1 ], [ 'NAME' => 'All Mem', 'ALIGN' => 'right', 'EL' => 'sum_all_mem', 'IS_TOTAL' => 1, 'ISSORT' => 1 ], [ 'NAME' => '%', 'ALIGN' => 'right', 'EL' => 'sum_all_mem_percent', 'ISSORT' => 1 ], [ 'NAME' => 'SQL/1', 'ALIGN' => 'right', 'EL' => 'sql_per_one', 'EL_SORT' => 'sql_per_one_full', 'ISSORT' => 1 ], [ 'NAME' => 'Time/1', 'ALIGN' => 'right', 'EL' => 'time_per_one', 'EL_SORT' => 'time_per_one_full', 'ISSORT' => 1 ], [ 'NAME' => 'Mem/1', 'ALIGN' => 'right', 'EL' => 'mem_per_one', 'EL_SORT' => 'mem_per_one_full', 'ISSORT' => 1 ] ]; $table = new Table(); $table->sortDefault = 'sum'; $table->isSortDesc = 1; $table->isShowTotal = 1; $table->customPerPage = 'all'; $content .= $table->show($data, $field); $content .= '
                <br><br>'; $data = StatisticsSystemAR::find() ->where( [ StatisticsSystemAR::F_MONTH => $month ] ) ->andWhere( ['IS NOT', StatisticsSystemAR::F_ALL_MEMORY, null] ) ->orderBy( [ StatisticsSystemAR::F_ALL_MEMORY => SORT_DESC ] ) ->limit(25) ->asArray() ->all(); $field = [ [ 'SPECIAL' => '_number' ], [ 'NAME' => 'Section', 'EL' => 'section' ], [ 'NAME' => 'Action', 'EL' => 'action' ], [ 'NAME' => 'SQL Counter', 'ALIGN' => 'right', 'EL' => 'all_sql_counter', ], [ 'NAME' => 'Time', 'ALIGN' => 'right', 'EL' => 'all_time', ], [ 'NAME' => 'Memory', 'ALIGN' => 'right', 'EL' => 'all_memory', 'ISSORT' => 1 ], [ 'NAME' => 'Page', 'EL' => 'page', ], ]; $table = new Table(); $table->sortDefault = 'all_memory'; $table->isSortDesc = 1; $table->customPerPage = 'all'; $content .= $table->show($data, $field); $content .= '
                <br><br>'; $data = StatisticsSystemAR::find() ->where( [ StatisticsSystemAR::F_MONTH => $month ] ) ->andWhere( ['IS NOT', StatisticsSystemAR::F_ALL_TIME, null] ) ->orderBy( [ StatisticsSystemAR::F_ALL_TIME => SORT_DESC ] ) ->limit(25) ->asArray() ->all(); $field = [ [ 'SPECIAL' => '_number' ], [ 'NAME' => 'Section', 'EL' => 'section' ], [ 'NAME' => 'Action', 'EL' => 'action' ], [ 'NAME' => 'SQL Counter', 'ALIGN' => 'right', 'EL' => 'all_sql_counter', ], [ 'NAME' => 'Time', 'ALIGN' => 'right', 'EL' => 'all_time', 'ISSORT' => 1 ], [ 'NAME' => 'Memory', 'ALIGN' => 'right', 'EL' => 'all_memory', ], [ 'NAME' => 'Page', 'EL' => 'page', ], ]; $table = new Table(); $table->sortDefault = 'all_time'; $table->isSortDesc = 1; $table->customPerPage = 'all'; $content .= $table->show($data, $field); $content .= '
                <br><br>'; $data = StatisticsSystemAR::find() ->where( [ StatisticsSystemAR::F_MONTH => $month ] ) ->andWhere( ['IS NOT', StatisticsSystemAR::F_ALL_SQL_COUNTER, null] ) ->orderBy( [ StatisticsSystemAR::F_ALL_SQL_COUNTER => SORT_DESC ] ) ->limit(25) ->asArray() ->all(); $field = [ [ 'SPECIAL' => '_number' ], [ 'NAME' => 'Section', 'EL' => 'section' ], [ 'NAME' => 'Action', 'EL' => 'action' ], [ 'NAME' => 'SQL Counter', 'ALIGN' => 'right', 'EL' => 'all_sql_counter', 'ISSORT' => 1 ], [ 'NAME' => 'Time', 'ALIGN' => 'right', 'EL' => 'all_time', ], [ 'NAME' => 'Memory', 'ALIGN' => 'right', 'EL' => 'all_memory', ], [ 'NAME' => 'Page', 'EL' => 'page', ], ]; $table = new Table(); $table->sortDefault = 'all_sql_counter'; $table->isSortDesc = 1; $table->customPerPage = 'all'; $content .= $table->show($data, $field); } return $content; } private static function loadMenuBody(): string { Html::$isEmptyTemplate = true; return '<span id="spanLoadMenuBodyId"></span>' . self::editSettingsOption(RequestData::$id); } private static function showLog(): string { Html::$isEmptyTemplate = true; OperatorAccess::verifyRight(OperatorAccess::RIGHT_SETTING); $type = RequestData::custom('type'); $taskId = RequestData::customInt('task_id'); $deviceId = RequestData::customInt('device_id'); $date = RequestData::customInt('date'); $tempArray = self::LOGS_ARRAY; $tempArray = array_flip($tempArray); $fileName = ''; if (isset($tempArray[$type])) { $fileName = $type . '.log'; } else { switch ($type) { case 'microservice_poller': $fileName = '../../microservice/poller/var/log/poller.log'; break; case 'cron': $fileName = 'cron_' . $taskId . '_' . date('Ymd', $date) . '.log'; break; case 'pon_poller': $fileName = 'pon_poller_' . $deviceId . '.log'; break; default: echo 'BAD TYPE'; Html::locationCancel(); break; } } $fileSrc = realpath(__DIR__) . '/../../../../var/log/' . $fileName; if (file_exists($fileSrc) === true) { $file = fopen($fileSrc, "r"); $fileTempSize = filesize($fileSrc); $maxSizeFile = 2000000; if ($fileTempSize > $maxSizeFile) { echo '<pre>>> ... LAST ' . $maxSizeFile . ' BYTES (FROM ' . $fileTempSize . ' | SEEK ' . ($fileTempSize - $maxSizeFile) . ') ... <<</pre>'; fseek($file, ($fileTempSize - $maxSizeFile)); $fileTempSize = $maxSizeFile; } $content = fread($file, $fileTempSize); echo '<pre>' . $content . '</pre>'; fclose($file); } else { echo 'Not Found'; } return ''; } private static function varLog(): string { Html::$isEmptyTemplate = true; OperatorAccess::verifyRight(OperatorAccess::RIGHT_SETTING); $fileType = RequestData::custom('file_type'); $limit = RequestData::customInt('limit'); switch ($fileType) { case 'notifications': default; $fileName = 'notifications.log'; break; } $fileName = realpath(__DIR__) . '/../../../../var/log/' . $fileName; if (!file_exists($fileName)) { Html::$isEmptyTemplate = true; return 'File not found! (' . $fileName . ')'; } $file = fopen($fileName, "r"); $content = fread(fopen($fileName, "r"), filesize($fileName)); $data = explode(chr(10), $content); $data = array_reverse($data); if ($limit > 0) { $count = 0; foreach ($data as $i => $value) { ++$count; if ($count > $limit) { unset($data[$i]); } } } echo '<pre>' . implode("\n", $data) . '</pre>'; fclose($file); return ''; } private static function diagMergeAddresses(): string { OperatorAccess::verifyRight(OperatorAccess::RIGHT_SETTING); $fromUnitId = RequestData::customInt('from_unit_id'); $toUnitId = RequestData::customInt('to_unit_id'); $isRealy = RequestData::customInt('is_realy'); $mergeCount = RequestData::customInt('merge_count'); if ( 1 === $isRealy && $mergeCount < 1 ) { Html::$isEmptyTemplate = true; AddressUnit::transferObject($fromUnitId, $toUnitId); return "Done! (from " . $fromUnitId . " to " . $toUnitId . ")"; } $content = '
            <span class="label_h2">Merge Addresses</span><br>
            <br>
            <br>'; $addressesArray = \erp\modules\GeoAddress\models\AddressUnit::find() ->select( [ 'COUNT(*) AS counter', 'parent_id', 'locality_type_id', 'name', 'ARRAY_AGG(id) AS id' ] ) ->groupBy( [ 'parent_id', 'locality_type_id', 'name' ] ) ->asArray() ->all(); foreach ($addressesArray as $i => $value) { if ($value['counter'] < 2) { unset($addressesArray[$i]); } } $countTemp = 0; foreach ($addressesArray as $i => $value) { ++$countTemp; $content .= '
                <div class="div_space">
                    ' . $countTemp . ') ' . AddressLocalityTypeCache::getToken($value['locality_type_id']) . ': '; $tempArray = explode(',', str_replace('}', '', str_replace('{', '', $value['id']))); $minId = 0; $maxId = 0; foreach ($tempArray as $value2) { if ( $minId === 0 || $value2 < $minId ) { $minId = $value2; } if ($value2 > $maxId) { $maxId = $value2; } $content .= '<a href="javascript:ajaxWindow(\'?' . BodyHtml::CORES_SECTION . '=' . BodyHtml::SECTION_SETTINGS_ADDRESS . '&action=dialog_edit_address_unit&id=' . $value2 . '\')">' . $value['name'] . '</a> (#' . $value2 . ') &middot; '; } $content .= '
                    &nbsp; &nbsp; &nbsp; &nbsp; <a target=_blank href="?core_section=settings_main&action=diag_merge_addresses&is_realy=1&from_unit_id=' . $maxId . '&to_unit_id=' . $minId . '">merge</a>
                </div>'; if ( 1 === $isRealy && $countTemp <= $mergeCount ) { AddressUnit::transferObject($maxId, $minId); } } if (1 === $isRealy) { Html::$isEmptyTemplate = true; AddressUnit::transferObject($fromUnitId, $toUnitId); return "MERGE! (" . $mergeCount . ") OK"; } $content .= '
            <br>
            <br>
            <i class="us-icon fa-bars"></i><a href="?core_section=settings_main&action=diag_merge_addresses&is_realy=1&merge_count=50">Merge 50</a>'; return $content; } private static function reloadBuildingAddress(): string { Html::$isEmptyTemplate = true; OperatorAccess::verifyRight(OperatorAccess::RIGHT_SETTING); $responce = BuildingAR::reloadAllName(1); return 'Done (' . $responce[1] . '/' . $responce[0] . ')!'; } public static function deleteUnuseAddress($isByCommandString = 0): string { $stop = RequestData::customInt('stop'); if (1 != $isByCommandString) { OperatorAccess::verifyRight(OperatorAccess::RIGHT_SETTING); $isRealy = RequestData::customInt('is_realy'); } else { echo "Start Working\n"; $isRealy = 1; } $buildingUnitArray = []; $buildingUnitNameArray = []; $buildingArray = []; $array = AddressUnit::getByToken(AddressLocalityType::TOKEN_HOUSE); foreach ($array as $value) { $buildingUnitArray[$value['id']] = []; $buildingUnitNameArray[$value['id']] = [ 'name' => $value['name'], 'parent_id' => $value['parent_id'] ]; } if (1 == $isByCommandString || Html::$isDebug === true) { echo date('H:i:s') . " Stage Complete: 1\n"; if ($stop == 1) { Html::locationCancel(); } } $array = BuildingAR::find() ->where( [ BuildingAR::F_ADDRESS_UNIT_ID => Central::getArrayListForAR($buildingUnitArray) ] ) ->asArray() ->all(); foreach ($array as $value) { $unitId = $value[BuildingAR::F_ADDRESS_UNIT_ID]; $buildingId = $value[BuildingAR::F_ID]; $buildingUnitArray[$unitId]['building_id'] = $buildingId; $buildingArray[$buildingId]['unit_id'] = $unitId; } $array = BuildingAdditionalAddressAR::find() ->where( [ BuildingAdditionalAddressAR::F_ADDRESS_UNIT_ID => Central::getArrayListForAR( $buildingUnitArray ) ] ) ->asArray() ->all(); foreach ($array as $value) { $unitId = $value[BuildingAdditionalAddressAR::F_ADDRESS_UNIT_ID]; $buildingId = $value[BuildingAdditionalAddressAR::F_BUILDING_ID]; $buildingUnitArray[$unitId]['building_id'] = $buildingId; $buildingArray[$buildingId]['unit_id'] = $unitId; } if (1 == $isByCommandString || Html::$isDebug === true) { echo date('H:i:s') . " Stage Complete: 2\n"; if ($stop == 2) { Html::locationCancel(); } } $addressArrayUse = []; $addressArray = \erp\modules\GeoAddress\models\AddressUnit::find() ->where( ['NOT IN', 'id', Central::getArrayListForAR($buildingUnitArray)] ) ->all(); foreach ($addressArray as $i => $address) { $parentId = $address->parent_id; $addressArrayUse[$parentId] = $i; } $array = \erp\modules\GeoAddress\models\AddressUnit::find() ->where( [ 'id' => Central::getArrayListForAR($buildingUnitArray) ] ) ->asArray() ->all(); foreach ($array as $i => $value) { $parentId = $value['parent_id']; $addressArrayUse[$parentId] = $i; } $addressArray2 = []; foreach ($addressArray as $i => $address) { if (isset($addressArrayUse[$address->id])) { unset($addressArray[$i]); } else { $addressArray2[$address->id] = $i; } } if (1 == $isByCommandString || Html::$isDebug === true) { echo date('H:i:s') . " Stage Complete: 3\n"; if ($stop == 3) { Html::locationCancel(); } } $array = BuildingAR::find() ->where( [ BuildingAR::F_ID => Central::getArrayListForAR($buildingArray) ] ) ->andWhere(BuildingAR::F_COORD . " <> ''") ->asArray() ->all(); foreach ($array as $value) { $buildingId = $value[BuildingAR::F_ID]; if (isset($buildingArray[$buildingId])) { unset($buildingArray[$buildingId]); } } if (1 == $isByCommandString || Html::$isDebug === true) { echo date('H:i:s') . " Stage Complete: 4\n"; if ($stop == 4) { Html::locationCancel(); } } $array = NodeAR::find() ->where( [ NodeAR::F_ADDRESS_ID => Central::getArrayListForAR($addressArray2) ] ) ->indexBy(NodeAR::F_ADDRESS_ID) ->asArray() ->all(); foreach ($array as $unitId => $value) { if (isset($addressArray2[$unitId])) { unset($addressArray[$addressArray2[$unitId]]); } } if (1 == $isByCommandString || Html::$isDebug === true) { echo date('H:i:s') . " Stage Complete: 5\n"; if ($stop == 5) { Html::locationCancel(); } } if (1 == $isRealy) { $tempCount = 0; foreach ($addressArray as $address) { ++$tempCount; if (1 == $isByCommandString || Html::$isDebug === true) { echo "TryDelete: " . $address->id . " (" . $tempCount . "/" . count($addressArray) . ")\n"; } AddressUnit::tryDelete($address->id); } } if (1 == $isByCommandString || Html::$isDebug === true) { echo date('H:i:s') . " Stage Complete: 6\n"; if ($stop == 6) { Html::locationCancel(); } } $array = CustomerAR::find() ->where( [ CustomerAR::F_BUILDING_ID => Central::getArrayListForAR($buildingArray) ] ) ->asArray() ->all(); foreach ($array as $value) { $buildingId = $value[CustomerAR::F_BUILDING_ID]; if (isset($buildingArray[$buildingId])) { unset($buildingArray[$buildingId]); } } if (1 == $isByCommandString || Html::$isDebug === true) { echo date('H:i:s') . " Stage Complete: 7\n"; if ($stop == 7) { Html::locationCancel(); } } $array = CableLineAR::find() ->where( [ CableLineAR::F_BUILDING2_ID => Central::getArrayListForAR($buildingArray) ] ) ->asArray() ->all(); foreach ($array as $value) { $buildingId = $value[CableLineAR::F_BUILDING2_ID]; if (isset($buildingArray[$buildingId])) { unset($buildingArray[$buildingId]); } } if (1 == $isByCommandString || Html::$isDebug === true) { echo date('H:i:s') . " Stage Complete: 8\n"; if ($stop == 8) { Html::locationCancel(); } } if (1 == $isByCommandString || Html::$isDebug === true) { echo date('H:i:s') . " Stage Complete: 9\n"; if ($stop == 9) { Html::locationCancel(); } } $array = KeyAR::find() ->where( [ KeyAR::F_BUILDING_ID => Central::getArrayListForAR($buildingArray) ] ) ->asArray() ->all(); foreach ($array as $value) { $buildingId = $value[KeyAR::F_BUILDING_ID]; if (isset($buildingArray[$buildingId])) { unset($buildingArray[$buildingId]); } } if (1 == $isByCommandString || Html::$isDebug === true) { echo date('H:i:s') . " Stage Complete: 10\n"; if ($stop == 10) { Html::locationCancel(); } } $inventories = InventoryAR::find() ->where( [ InventoryAR::F_ACCOUNT_TYPE => InventoryAR::ACCOUNT_BUILDING, InventoryAR::F_ACCOUNT_OBJECT_ID => Central::getArrayListForAR($buildingArray) ] ) ->all(); foreach ($inventories as $inventory) { $buildingId = $inventory->getAccountObjectId(); if (isset($buildingArray[$buildingId])) { unset($buildingArray[$buildingId]); } } if (1 == $isByCommandString || Html::$isDebug === true) { echo date('H:i:s') . " Stage Complete: 11\n"; if ($stop == 11) { Html::locationCancel(); } } $array = NodeAR::find() ->where( [ NodeAR::F_ADDRESS_ID => Central::getArrayListForAR($buildingUnitArray) ] ) ->indexBy(NodeAR::F_ADDRESS_ID) ->asArray() ->all(); foreach ($array as $unitId => $value) { if (isset($buildingUnitArray[$unitId])) { unset($buildingUnitArray[$unitId]); } } if (1 == $isByCommandString || Html::$isDebug === true) { echo date('H:i:s') . " Stage Complete: 12\n"; if ($stop == 12) { Html::locationCancel(); } } $array = TaskAR::find() ->where( [ TaskAR::F_ADDRESS_ID => Central::getArrayListForAR($buildingUnitArray) ] ) ->select(TaskAR::F_ADDRESS_ID) ->asArray() ->all(); foreach ($array as $value) { $unitId = $value[TaskAR::F_ADDRESS_ID]; if (isset($buildingUnitArray[$unitId])) { unset($buildingUnitArray[$unitId]); } } if (1 == $isByCommandString || Html::$isDebug === true) { echo date('H:i:s') . " Stage Complete: 13\n"; if ($stop == 13) { Html::locationCancel(); } } foreach ($buildingUnitArray as $unitId => $value) { if (isset($value['building_id'])) { $buildingId = $value['building_id']; if (!isset($buildingArray[$buildingId])) { unset($buildingUnitArray[$unitId]); } } } if (1 == $isByCommandString || Html::$isDebug === true) { echo date('H:i:s') . " Stage Complete: 14\n"; if ($stop == 14) { Html::locationCancel(); } } $tempArray = []; foreach ($buildingUnitArray as $unitId => $value) { $tempArray[$unitId] = $unitId; } $data = \erp\modules\GeoAddress\models\AddressUnit::find() ->select( [ 'id id', 'parent_id' ] ) ->where( [ 'parent_id' => $tempArray ] ) ->asArray() ->all(); foreach ($data as $value) { $unitId = $value['parent_id']; if (isset($buildingUnitArray[$unitId])) { unset($buildingUnitArray[$unitId]); } } if (1 == $isByCommandString || Html::$isDebug === true) { echo date('H:i:s') . " Stage Complete: 15\n"; if ($stop == 15) { Html::locationCancel(); } } if (1 == $isRealy) { $tempCount = 0; foreach ($buildingUnitArray as $unitId => $value) { ++$tempCount; if (1 == $isByCommandString || Html::$isDebug === true) { echo "TryDelete: " . $unitId . " (" . $tempCount . "/" . count($buildingUnitArray) . ")\n"; } AddressUnit::tryDelete($unitId); } Html::$isEmptyTemplate = true; return "Doing!\n"; } $content = '
            <a href="?core_section=settings_address"><i class="us-icon fa-chevron-left"></i>' . Lang::getPhrase(461) . '</a><br>
            <br>
            <span class="label_h2">' . Lang::getPhrase(6124) . '</span><br>
            <br>
            <b>Houses:</b><br><br>'; $parentArray = []; foreach ($buildingUnitArray as $unitId => $value) { $parentId = $buildingUnitNameArray[$unitId]['parent_id']; $parentArray[$parentId] = $parentId; } $data = \erp\modules\GeoAddress\models\AddressUnit::find() ->select( [ 'id id', 'name' ] ) ->where( [ 'id' => $parentArray ] ) ->asArray() ->all(); foreach ($data as $value) { $parentArray[$value['id']] = $value['name']; } foreach ($buildingUnitArray as $unitId => $value) { $parentId = $buildingUnitNameArray[$unitId]['parent_id']; $parentName = isset($parentArray[$parentId]) ? $parentArray[$parentId] . ', ' : ''; $buildingUnitNameArray[$unitId]['parent_name'] = $parentName; } $count = 0; foreach ($buildingUnitArray as $unitId => $value) { ++$count; $name = $buildingUnitNameArray[$unitId]['parent_name'] . ' ' . $buildingUnitNameArray[$unitId]['name']; $content .= '
                <div class="div_space">
                    ' . $count . '. <a href="' . AddressUnit::getUrlById($unitId) . '">' . $name . '</a>
                </div>'; } if (1 == $isByCommandString || Html::$isDebug === true) { echo date('H:i:s') . " Stage Complete: 16\n"; if ($stop == 16) { Html::locationCancel(); } } $count2 = 0; if (count($addressArray) > 0) { $content .= '<br><br><b>Addresses:</b><br><br>'; foreach ($addressArray as $address) { ++$count2; $content .= '
                <div class="div_space">
                    ' . $count2 . '. <a class="link_dashed" href="' . AddressUnit::getUrlById( $address->id ) . '"><span>' . AddressUnit::getNameById($address->id) . '</span></a>
                </div>'; } } if ($count > 0 || $count2 > 0) { $content .= '
                <br><br>
                <a id="linkRealyDeleteId" href="?core_section=settings_main&action=diag_delete_unuse_address&is_realy=1"><i class="us-icon us-icon-danger fa-times"></i>' . Lang::getPhrase( 1150 ) . '!</a>'; } return $content; } private static function weatherSaveCoord(): void { OperatorAccess::verifyRight(OperatorAccess::RIGHT_SETTING); $coord = RequestData::custom('coord'); SettingAR::setByName(SettingsCatalog::WEATHER_COORD, $coord); Html::locationBackOk(); } private static function additionalFieldDelete(): void { if (Central::$isUSOnline === false) { OperatorAccess::verifyRight(OperatorAccess::RIGHT_SETTING); } $id = RequestData::$id; if (true === AdditionalFieldAR::findOne($id)->tryDelete()) { Html::location( '?' . BodyHtml::CORES_SECTION . '=' . BodyHtml::SECTION_SETTINGS_MAIN . '&action=' . self::A_ADDITIONAL_FIELD_LIST, Html::TYPE_MSG_DELETED ); } else { Html::locationBackCancel(); } } private static function additionalFieldSave(): void { if (Central::$isUSOnline === false) { OperatorAccess::verifyRight(OperatorAccess::RIGHT_SETTING); } $id = RequestData::$id; $name = RequestData::custom('name'); $fieldType = RequestData::custom('field_type'); $categories = $_REQUEST['categories'] ?? []; $exterior = [ 'fontsize' => RequestData::customInt('field_exterior_fontsize'), 'fontcolor' => RequestData::custom('field_exterior_fontcolor'), 'bold' => RequestData::customInt('field_exterior_bold'), 'italic' => RequestData::customInt('field_exterior_italic'), 'is_per_type' => RequestData::customInt('is_per_type'), 'is_clear_year' => RequestData::customInt('is_clear_year'), 'is_clear_month' => RequestData::customInt('is_clear_month') ]; if ($id < 1) { $additionalDataConfig = AdditionalFieldAR::create( categories: $categories, name: $name, fieldType: $fieldType ); $id = $additionalDataConfig->getId(); } else { $additionalDataConfig = AdditionalFieldAR::findOne($id); EmployeeActionLogSystem::writeLog( EmployeeHistoryType::T383, AdditionalFieldAR::OBJECT_TYPE_ID, $id ); } $additionalProperties = [ AdditionalFieldAR::ADDITIONAL_PROPERTIES_CUSTOMER_PRIVATE => RequestData::customInt( 'additional_properties_' . AdditionalFieldAR::ADDITIONAL_PROPERTIES_CUSTOMER_PRIVATE ), AdditionalFieldAR::ADDITIONAL_PROPERTIES_CUSTOMER_CORPORATE => RequestData::customInt( 'additional_properties_' . AdditionalFieldAR::ADDITIONAL_PROPERTIES_CUSTOMER_CORPORATE ), AdditionalFieldAR::ADDITIONAL_PROPERTIES_CUSTOMER_POTENTIAL_PRIVATE => RequestData::customInt( 'additional_properties_' . AdditionalFieldAR::ADDITIONAL_PROPERTIES_CUSTOMER_POTENTIAL_PRIVATE ), AdditionalFieldAR::ADDITIONAL_PROPERTIES_CUSTOMER_POTENTIAL_CORPORATE => RequestData::customInt( 'additional_properties_' . AdditionalFieldAR::ADDITIONAL_PROPERTIES_CUSTOMER_POTENTIAL_CORPORATE ), ]; $additionalDataConfig->edit( [ AdditionalFieldAR::F_NAME => $name, AdditionalFieldAR::F_SUBCATEGORY => null, AdditionalFieldAR::F_FIELD_TYPE => $fieldType, AdditionalFieldAR::F_FIELD_SIZE => RequestData::customInt('field_size'), AdditionalFieldAR::F_FIELD_MAX_SIZE => RequestData::customInt('field_max_size'), AdditionalFieldAR::F_POSITION => RequestData::customInt('position'), AdditionalFieldAR::F_HINT => RequestData::custom('hint'), AdditionalFieldAR::F_IS_REQUIRE => RequestData::customBoolean('is_required'), AdditionalFieldAR::F_SPECIAL_TYPE => RequestData::custom('special_type'), AdditionalFieldAR::F_VALUE_LIST => RequestData::custom('value_list'), AdditionalFieldAR::F_IS_IN_MAIN_INFO => RequestData::customBoolean('is_in_main_info'), AdditionalFieldAR::F_IS_IN_TOP_INFO => RequestData::customBoolean('is_in_top'), AdditionalFieldAR::F_EXTERIOR => json_encode($exterior, JSON_THROW_ON_ERROR), AdditionalFieldAR::F_ADDITIONAL_PROPERTIES => json_encode($additionalProperties, JSON_THROW_ON_ERROR), AdditionalFieldAR::F_CATEGORIES => json_encode($categories, JSON_THROW_ON_ERROR), ] ); Html::location( '?' . BodyHtml::CORES_SECTION . '=' . BodyHtml::SECTION_SETTINGS_MAIN . '&action=' . self::A_ADDITIONAL_FIELD_EDIT . '&id=' . $id, Html::TYPE_MSG_SAVED ); } private static function mapTile(): string { OperatorAccess::verifyRight(OperatorAccess::RIGHT_SETTING); $content = '
            <a href="?core_section=settings_main&item_id=' . self::ITEM_4 . '"><i class="us-icon fa-chevron-left"></i>' . Lang::getPhrase( 1443 ) . '</a><br>
            <br>
            <span class="label_h2">' . MapTileAR::classCaption() . '</span>
            <div class="div_space">
                <a id="linkAddId" href="?core_section=settings_main&action=map_tile_edit"><i class="us-icon fa-plus"></i>' . Lang::getPhrase( 841 ) . '</a>
            </div>
            <br>'; $data = []; $mapTiles = MapTileAR::find() ->orderBy( [ MapTileAR::F_POSITION => SORT_ASC, MapTileAR::F_NAME => SORT_ASC ] ) ->all(); foreach ($mapTiles as $mapTile) { if ($mapTile->getIsEnable() === true) { $caption = '<i class="us-icon us-icon-ok fa-check" title="' . Lang::getPhrase( 837 ) . '"></i>'; } else { $caption = '<i class="us-icon us-icon-danger fa-ban" title="' . Lang::getPhrase( 5744 ) . '"></i>'; } $caption .= '<a href="?core_section=settings_main&action=map_tile_edit&id=' . $mapTile->getId( ) . '" style="text-decoration: underline"><i class="us-icon us-icon-normal fa-globe"></i>' . $mapTile->getName( ) . '</a>'; $data[] = [ 'id' => $mapTile->getId(), 'caption' => $caption, 'is_use' => $mapTile->getIsEnable() === true ? 1 : 0 ]; } $content .= '
            <div class="info_block">' . Lang::getPhrase(4086) . '</div>
            <span id="saveResultId"></span>
            <div id="table_field_id">
                <ul id="div_sortable" onmouseup="mapTileReorder()">'; foreach ($data as $value) { $content .= '
                    <li class="ui-state-default div_sortable_class" id="' . $value['id'] . '">
                        <div style="position: relative;">
                            <div>
                                ' . $value['caption'] . '
                            </div>
                        </div>
                    </li>'; } $content .= '
                </ul>
            </div>        
        '; return $content; } private static function mainMenu(): string { OperatorAccess::verifyRight(OperatorAccess::RIGHT_SETTING); $content = '
            <a href="?core_section=settings_main&item_id=' . self::ITEM_4 . '"><i class="us-icon fa-chevron-left"></i>' . Lang::getPhrase( 1443 ) . '</a><br>
            <br>
            <span class="label_h2">' . Lang::getPhrase(5962) . '</span>
            <br>'; $data = [ [ 'id' => BodyHtml::SECTION_DASHBOARD, 'caption' => Lang::getPhrase(499), ] ]; if (Central::$erpProfileChapters[ErpProfileDto::CHAPTER_CUSTOMER]) { $data[] = [ 'id' => BodyHtml::SECTION_CUSTOMER, 'caption' => CustomerAR::classCaption(), ]; } if (Central::$erpProfileChapters[ErpProfileDto::CHAPTER_TARIFF]) { $data[] = [ 'id' => BodyHtml::SECTION_TARIFF, 'caption' => TariffAR::classCaption(), ]; } if (Central::$erpProfileChapters[ErpProfileDto::CHAPTER_CUSTOMER_MSG]) { $data[] = [ 'id' => BodyHtml::SECTION_MESSAGE, 'caption' => Lang::getPhrase(603), ]; } if (Central::$erpProfileChapters[ErpProfileDto::CHAPTER_ACCOUNTANCY]) { $data[] = [ 'id' => BodyHtml::SECTION_ACCOUNTANCY, 'caption' => Lang::getPhrase(607), ]; } if (Central::$erpProfileChapters[ErpProfileDto::CHAPTER_INTERFACE]) { $data[] = [ 'id' => BodyHtml::SECTION_INTERFACE, 'caption' => Lang::getPhrase(622), ]; } if (Central::$erpProfileChapters[ErpProfileDto::CHAPTER_NODE]) { $data[] = [ 'id' => BodyHtml::SECTION_NODE, 'caption' => NodeAR::classCaption(), ]; } if (Central::$erpProfileChapters[ErpProfileDto::CHAPTER_CABLE_LINE]) { $data[] = [ 'id' => BodyHtml::SECTION_CABLE, 'caption' => Lang::getPhrase(5864), ]; } if (Central::$erpProfileChapters[ErpProfileDto::CHAPTER_DEVICE]) { $data[] = [ 'id' => BodyHtml::SECTION_DEVICE, 'caption' => DeviceAR::classCaption(), ]; } if (Central::$erpProfileChapters[ErpProfileDto::CHAPTER_TASK]) { $data[] = [ 'id' => BodyHtml::SECTION_TASK, 'caption' => Lang::getPhrase(636), ]; } if (Central::$erpProfileChapters[ErpProfileDto::CHAPTER_WAREHOUSE]) { $data[] = [ 'id' => BodyHtml::SECTION_INVENTORY, 'caption' => Lang::getPhrase(639), ]; } if (Central::$erpProfileChapters[ErpProfileDto::CHAPTER_MAP]) { $data[] = [ 'id' => BodyHtml::SECTION_MAP, 'caption' => Lang::getPhrase(647), ]; } $data[] = [ 'id' => BodyHtml::SECTION_EMPLOYEE, 'caption' => Lang::getPhrase(652), ]; if (Central::$erpProfileChapters[ErpProfileDto::CHAPTER_ADVERTISEMENT]) { $data[] = [ 'id' => BodyHtml::SECTION_ADVERT, 'caption' => AdvertisementAR::classCaption() ]; } if (Central::$erpProfileChapters[ErpProfileDto::CHAPTER_NOTEPAD]) { $data[] = [ 'id' => BodyHtml::SECTION_NOTEPAD, 'caption' => Lang::getPhrase(660), ]; } if (Central::$erpProfileChapters[ErpProfileDto::CHAPTER_STATISTICS]) { $data[] = [ 'id' => BodyHtml::SECTION_STATISTICS, 'caption' => Lang::getPhrase(662), ]; } $data[] = [ 'id' => BodyHtml::SECTION_OPERATOR, 'caption' => Lang::getPhrase(664), ]; $data[] = [ 'id' => BodyHtml::SECTION_SETTINGS, 'caption' => Lang::getPhrase(669), ]; $data[] = [ 'id' => '_SMS_BLOCK', 'caption' => Lang::getPhrase(1075), ]; $maxPosition = 0; foreach ($data as $i => $value) { ++$maxPosition; $data[$i]['position'] = $maxPosition; } $customPageArray = CustomPageCache::getDataCat(PageAR::CATEGORY_LEFT_MENU); if (isset($customPageArray[0])) { foreach ($customPageArray[0] as $value) { ++$maxPosition; $data[] = [ 'id' => '_PAGE_' . $value['id'], 'caption' => $value['name'], 'position' => $maxPosition ]; } } $array = BodyHtml::getMenuOrder(); foreach ($data as $i => $value) { if (isset($array[$value['id']])) { $data[$i]['position'] = $array[$value['id']]; } } $data = Central::sort($data, 'position'); $content .= '
            <div class="info_block">' . Lang::getPhrase(4086) . '</div>
            <span id="saveResultId"></span>
            <div id="table_field_id">
                <ul id="div_sortable" onmouseup="menuReorder()">'; foreach ($data as $value) { $content .= '
                    <li class="ui-state-default div_sortable_class" id="' . $value['id'] . '">
                        <div style="position: relative;">
                            <div>
                                ' . $value['caption'] . '
                            </div>
                        </div>
                    </li>'; } $content .= '
                </ul>
            </div>
            <br>    
            <div class="div_space">
                <a id="linkMainMenuDefaultId" href="?core_section=settings_main&action=main_menu_save_position&data="><i class="us-icon fa-times"></i>' . Lang::getPhrase( 4029 ) . '</a>
            </div>'; return $content; } private static function mapTileDelete(): void { OperatorAccess::verifyRight(OperatorAccess::RIGHT_SETTING); $id = RequestData::$id; $result = MapTileAR::findOne($id)->tryDelete(); if ($result === true) { Html::location('?core_section=settings_main&action=map_tile', Html::TYPE_MSG_UPDOK); } else { Html::locationBackCancel(); } } private static function mapTileSave(): void { OperatorAccess::verifyRight(OperatorAccess::RIGHT_SETTING); $id = RequestData::$id; $urlPattern = RequestData::customTrue('url_pattern'); $parentId = RequestData::customInt('parent_id'); if ($id < 1) { $isNew = true; $mapTile = MapTileAR::create(RequestData::custom('name'), $urlPattern); $id = $mapTile->getId(); } else { $isNew = false; $mapTile = MapTileAR::findOne($id); if (!$mapTile) { Html::location('?core_section=settings_main&action=map_tile', Html::TYPE_MSG_CANCEL); } } $mapTile->edit( [ MapTileAR::F_NAME => RequestData::custom('name'), MapTileAR::F_IS_ENABLE => RequestData::customBoolean('is_use'), MapTileAR::F_SUBDOMAINS => RequestData::custom('subdomains'), MapTileAR::F_PARENT_MAP_TILE_ID => $parentId, MapTileAR::F_MAX_ZOOM => RequestData::customInt('max_zoom'), MapTileAR::F_IS_TMS => RequestData::customBoolean('is_tms'), MapTileAR::F_COPYRIGHT => RequestData::customTrue('copyright'), MapTileAR::F_COORDINATE_SYSTEM => RequestData::custom('coord_system') ] ); if ($isNew === false) { EmployeeActionLogSystem::writeLog(EmployeeHistoryType::T533, MapTileAR::OBJECT_TYPE_ID, $id); } Html::location('?core_section=settings_main&action=map_tile_edit&id=' . $id, Html::TYPE_MSG_UPDOK); } private static function mainMenuSavePosition(): string { Html::$isEmptyTemplate = true; OperatorAccess::verifyRight(OperatorAccess::RIGHT_SETTING); $data = RequestData::custom('data'); SettingAR::setByName(SettingsCatalog::MAIN_MENU_ORDER, serialize($data)); if ('' == $data) { Html::locationBackOk(); } return '<span class="green_text"><b>Save!</b></span>'; } private static function mapTileSavePosition(): string { Html::$isEmptyTemplate = true; OperatorAccess::verifyRight(OperatorAccess::RIGHT_SETTING); $data = RequestData::custom('data'); $array = explode(',', $data); $count = 0; foreach ($array as $mapTileId) { ++$count; $mapTile = MapTileAR::findOne((int)($mapTileId)); if ($mapTile) { $mapTile->edit( [ MapTileAR::F_POSITION => $count ] ); } else { return '<span class="red_text"><b>Bad MapTileId: ' . $mapTileId . '!</b></span>'; } } return '<span class="green_text"><b>Save!</b></span>'; } private static function mapTileEdit(): string { OperatorAccess::verifyRight(OperatorAccess::RIGHT_SETTING); $id = RequestData::$id; if ($id > 0) { $mapTile = MapTileAR::findOne($id); if (!$mapTile) { Html::location('?core_section=settings_main&action=map_tile', Html::TYPE_MSG_CANCEL); } } else { $mapTile = new MapTileAR(); } $content = '
            <a href="?core_section=settings_main&action=map_tile"><i class="us-icon fa-chevron-left"></i>' . Lang::getPhrase( 1580 ) . '</a><br>
            <br>
            <span class="label_h2">' . MapTileAR::classCaption() . '</span>
            <form method="post" name="form1" action="">
                <input type="hidden" name="core_section" value="settings_main">
                <input type="hidden" name="action" value="map_tile_save">
                <input type="hidden" name="id" value="' . $id . '">
                <div class="table_block">
                    <div class="item">
                        <div class="left_data">
    ' . Lang::getPhrase(1451) . ':
                        </div>
                        <div>
                            <input name="name" type="text" size=30 maxlength=255 class="input_box" value=\'' . ($id > 0 ? $mapTile->getName( ) : '') . '\'>
                        </div>
                    </div>
                    <div class="item">
                        <div class="left_data">
                            ' . Lang::getPhrase(837) . ':
                        </div>
                        <div>
                            <input name="is_use" type="checkbox"'; if ($id < 1 || true === $mapTile->getIsEnable()) { $content .= ' checked'; } $content .= ' value="1">
                        </div>
                    </div>
                    <div class="item">
                        <div class="left_data">
                            ' . Lang::getPhrase(5363) . ' URL:
                        </div>
                        <div>
                            <input name="url_pattern" type="text" size=80 class="input_box" value=\'' . ($id > 0 ? $mapTile->getUrlPattern( ) : '') . '\'><br>
                            <i>{x} - tile lat<br>
                            {y} - tile lon<br>
                            {z} - zoom<br>
                            {s} - subdomains<br>
                            {BBOX_x1}<br>
                            {BBOX_y1}<br>
                            {BBOX_x2}<br>
                            {BBOX_y2}<br>
                            </i>
                        </div>
                    </div>
                    <div class="item">
                        <div class="left_data">
                            ' . Lang::getPhrase(5745) . ':                            
                        </div>
                        <div>
                            <input name="subdomains" type="text" size=30 maxlength=255 class="input_box" value=\'' . ($id > 0 ? $mapTile->getSubdomains( ) : '') . '\'><br>
                            <i>' . Lang::getPhrase(3530) . '</i>
                        </div>
                    </div>
                    <div class="item">
                        <div class="left_data">
                            ' . Lang::getPhrase(5746) . ':                            
                        </div>
                        <div>
                            <input name="max_zoom" type="text" size=2 maxlength=2 class="input_box" value=\'' . ($id > 0 ? $mapTile->getMaxZoom( ) : '') . '\'>
                        </div>
                    </div>
                    <div class="item">
                        <div class="left_data">
                            <a href="https://leafletjs.com/examples/wms/wms.html">TMS</a>:
                        </div>
                        <div>
                            <input name="is_tms" type="checkbox"'; if ($id > 0 && true === $mapTile->getIsTms()) { $content .= ' checked'; } $content .= ' value="1">
                        </div>
                    </div>
                    <div class="item">
                        <div class="left_data">
                            ' . Lang::getPhrase(5747) . ':
                        </div>
                        <div>
                            <select name="coord_system" size="1">
                                <option value="' . MapTileAR::COORDINATE_SYSTEM_EPSG3857 . '">EPSG3857</option>
                                <option value="' . MapTileAR::COORDINATE_SYSTEM_EPSG3395 . '"'; if ($id > 0 && $mapTile->getCoordinateSystem() == MapTileAR::COORDINATE_SYSTEM_EPSG3395) { $content .= ' selected'; } $content .= '>EPSG3395</option>
                                <option value="' . MapTileAR::COORDINATE_SYSTEM_BBOX . '"'; if ($id > 0 && $mapTile->getCoordinateSystem() == MapTileAR::COORDINATE_SYSTEM_BBOX) { $content .= ' selected'; } $content .= '>BBOX</option>
                            <select>
                        </div>
                    </div>
                    <div class="item">
                        <div class="left_data">
                            ' . Lang::getPhrase(5748) . ':
                        </div>
                        <div>
                            <select name="parent_id" size="1">
                                <option value="0"></option>'; $mapTiles = MapTileAR::find() ->where( ['<>', 'id', $id] ) ->orderBy(MapTileAR::F_NAME) ->all(); foreach ($mapTiles as $mapTileTemp) { $content .= '
                                <option value="' . $mapTileTemp->getId() . '"'; if ($id > 0 && $mapTileTemp->getId() == $mapTile->getParentMapTileId()) { $content .= ' selected'; } $content .= '>' . $mapTileTemp->getName() . '</option>'; } $content .= '
                            <select>
                        </div>
                    </div>
                    <div class="item">
                        <div class="left_data">
                            Copyright:                            
                        </div>
                        <div>
                            <textarea name="copyright" rows="10" cols="50">' . ($id > 0 ? $mapTile->getCopyright( ) : '') . '</textarea>
                        </div>
                    </div>
                </div>
                ' . BodyHtml::formButton('save_cancel', '?core_section=settings_main&action=map_tile') . '
            </form>'; if ($id > 0) { $content .= BodyHtml::linkDeleteObject( $id, '?core_section=settings_main&action=map_tile_delete&id=' . $id, '', '', '', MapTileAR::OBJECT_TYPE_ID, count(MapTileAR::findOne($id)->checkDelete()) ); } return $content; } private static function ajaxLoadAdditionalFieldList(): string { Html::$isEmptyTemplate = true; return '<span id="spanAjaxLoadListId"></span>' . self::additionalFieldList(true); } private static function additionalFieldList(bool $isAjaxLoad = false): string { if (Central::$isUSOnline === false) { OperatorAccess::verifyRight(OperatorAccess::RIGHT_SETTING); } $search = RequestData::getSearch(); $content = ''; if ($isAjaxLoad !== true) { $content = '
                <a href="?' . BodyHtml::CORES_SECTION . '=' . BodyHtml::SECTION_SETTINGS_MAIN . '&item_id=' . self::ITEM_18 . '"><i class="us-icon fa-chevron-left"></i>' . Lang::getPhrase( 1443 ) . '</a><br>
                <br>
                <span class="label_h2">' . Lang::getPhrase(6118) . '</span><br>
                <br>
                <div class="div_space">
                    <a id="linkAddId" href="?' . BodyHtml::CORES_SECTION . '=' . BodyHtml::SECTION_SETTINGS_MAIN . '&action=' . self::A_ADDITIONAL_FIELD_EDIT . '"><i class="us-icon fa-plus"></i>' . Lang::getPhrase( 841 ) . '</a>
                </div>
                '; $content .= '
                    <script>
                        var URL_SEARCH_LOAD_LIST = "?' . BodyHtml::CORES_SECTION . '=' . BodyHtml::SECTION_SETTINGS_MAIN . '&action=' . self::A_AJAX_LOAD_ADDITIONAL_FIELD_LIST . '&search="; 
                    </script>
                    <div id="usersearch">
                        <form autocomplete="off">
                            <input type="hidden" name="' . BodyHtml::CORES_SECTION . '" value="' . BodyHtml::SECTION_SETTINGS_MAIN . '">
                            <input type="hidden" name="action" value="' . self::A_ADDITIONAL_FIELD_LIST . '">
                            <input name="search" id="search_field_id" class="field" value="' . $search . '" type="text" onkeyup="dataSearchWait(this.value)">
                            <input name="" type="submit" id="buttonSubmitSearchFieldId" class="button" value="">
                        </form>
                    </div>
                    <div id="dataSearchResultId">'; } $fieldTypeCatalog = AdditionalFieldAR::catalogFieldType(); $useArray = []; $additionalFieldValuesDto = Yii::$container ->get(AdditionalFieldValueFetcher::class) ->getByCondition( condition: [], selectFields: [ 'id' => AdditionalFieldValueDto::F_ADDITIONAL_FIELD_ID, 'counter' => 'COUNT(*)' ], groupBy: AdditionalFieldValueDto::F_ADDITIONAL_FIELD_ID ); foreach ($additionalFieldValuesDto as $additionalFieldValueDto) { $useArray[$additionalFieldValueDto->id] = $additionalFieldValueDto->counter; } if ($search !== '') { $condition = ['ILIKE', AdditionalFieldAR::F_NAME, $search]; } else { $condition = []; } $data = AdditionalFieldAR::find() ->select( [ 'id' => AdditionalFieldAR::F_ID, 'name' => AdditionalFieldAR::F_NAME, 'field_type' => AdditionalFieldAR::F_FIELD_TYPE, ] ) ->where($condition) ->asArray() ->all(); foreach ($data as $i => $value) { $data[$i]['field_type_name'] = $fieldTypeCatalog[$value['field_type']]; $data[$i]['counter'] = $useArray[$value['id']] ?? 0; } $field = [ [ 'SPECIAL' => '_number' ], [ 'NAME' => Lang::getPhrase(1451), 'ISSORT' => 1, 'ISSORTABC' => 1, 'EL' => 'name' ], [ 'NAME' => Lang::getPhrase(1124), 'ISSORT' => 1, 'ISSORTABC' => 1, 'EL' => 'field_type_name' ], [ 'NAME' => Lang::getPhrase(1129), 'ALIGN' => 'right', 'ISSORT' => 1, 'CONVERT' => 'floor2', 'EL' => 'counter' ] ]; $table = new Table(); $table->link = '?' . BodyHtml::CORES_SECTION . '=' . BodyHtml::SECTION_SETTINGS_MAIN . '&action=' . self::A_ADDITIONAL_FIELD_EDIT . '&id='; $table->sortDefault = 'name'; $table->isSortDefaultAbc = 1; if (true === $isAjaxLoad) { $table->ajaxBodyDivId = 'dataSearchResultId'; } $content .= $table->show($data, $field); if (true !== $isAjaxLoad) { $content .= '
                </div>'; } return $content; } private static function deviceProfileDelete(): void { OperatorAccess::verifyRight(OperatorAccess::RIGHT_SETTING); $id = RequestData::$id; DeviceSnmpProfileAR::findOne($id)->remove(); Html::location('?core_section=settings_main&action=device_profile', 'updok'); } private static function deviceProfileSave(): void { OperatorAccess::verifyRight(OperatorAccess::RIGHT_SETTING); $id = RequestData::$id; if ($id < 1) { $deviceProfile = DeviceSnmpProfileAR::create(RequestData::custom('name')); $id = $deviceProfile->getId(); } else { $deviceProfile = DeviceSnmpProfileAR::findOne($id); } $argArray2 = @json_decode($deviceProfile->getProperties(), 1); if (!is_array($argArray2)) { $argArray2 = []; } $argArray = []; $tempCount = 0; foreach ($argArray2 as $j => $value) { $nameTemp4 = RequestData::custom('name_id_' . $j); $oidId = RequestData::custom('oid_id_' . $j); $doId = RequestData::customInt('do_id_' . $j); $nameTemp4 = str_replace('|', '_', $nameTemp4); $nameTemp4 = str_replace('*', '_', $nameTemp4); $nameTemp4 = str_replace('[', '_', $nameTemp4); $oidId = str_replace('|', '_', $oidId); $oidId = str_replace('*', '_', $oidId); $oidId = str_replace('[', '_', $oidId); if ('' != $nameTemp4) { ++$tempCount; $argArray[$tempCount] = [ 'ID' => $tempCount, 'NAME' => $nameTemp4, 'OID' => $oidId, 'DO' => $doId ]; } } for ($j = 1; $j <= 20; ++$j) { $nameTemp4 = RequestData::custom('name_new_' . $j); $oidId = RequestData::custom('oid_new_' . $j); $doId = RequestData::custom('do_new_' . $j); $nameTemp4 = str_replace('|', '_', $nameTemp4); $nameTemp4 = str_replace('*', '_', $nameTemp4); $nameTemp4 = str_replace('[', '_', $nameTemp4); $oidId = str_replace('|', '_', $oidId); $oidId = str_replace('*', '_', $oidId); $oidId = str_replace('[', '_', $oidId); if ('' != $nameTemp4) { ++$tempCount; $argArray[$tempCount] = [ 'ID' => $tempCount, 'NAME' => $nameTemp4, 'OID' => $oidId, 'DO' => $doId ]; } } $deviceProfile->edit( [ DeviceSnmpProfileAR::F_NAME => RequestData::custom('name'), DeviceSnmpProfileAR::F_IS_POLLING_PORT => RequestData::customBoolean('isport'), DeviceSnmpProfileAR::F_PROPERTIES => json_encode($argArray) ] ); Html::location('?core_section=settings_main&action=device_profile_dialog_edit&id=' . $id, 'updok'); } private static function deviceProfileDialogAddEdit(): string { OperatorAccess::verifyRight(OperatorAccess::RIGHT_SETTING); $id = RequestData::$id; $ret = '?core_section=settings_main&action=device_profile'; if ($id > 0) { $deviceProfile = DeviceSnmpProfileAR::findOne($id); } else { $deviceProfile = new DeviceSnmpProfileAR(); } $argProfile = @json_decode($deviceProfile->getProperties(), 1); if (!is_array($argProfile)) { $argProfile = []; } $content = '
            <a href="' . $ret . '"><i class="us-icon fa-chevron-left"></i>' . Lang::getPhrase( 893 ) . '</a><br>
            <br>
            <span class="label_h2">' . Lang::getPhrase(4247) . '</span><br>
            <form method="post" name="form1" action="">
                <input type="hidden" name="core_section" value="settings_main">
                <input type="hidden" name="action" value="device_profile_save">
                <input type="hidden" name="id" value="' . $id . '">
                <div class="table_block">
                    <div class="item">
                        <div class="left_data">
                            ' . Lang::getPhrase(1451) . ':
                        </div>
                        <div>
                            <input name="name" type="text" size=30 maxlength=255 class="input_box" value=\'' . ($id > 0 ? $deviceProfile->getName( ) : '') . '\'>
                        </div>
                    </div>
                    <div class="item">
                        <div class="left_data">
                            ' . Lang::getPhrase(4249) . ':
                        </div>
                        <div>
                            <input name="isport" type="checkbox"'; if ($id > 0 && true === $deviceProfile->getIsPollingPort()) { $content .= ' checked'; } $content .= ' value="1">
                        </div>
                    </div>
                </div>
                <div class="label_h3_hr">' . Lang::getPhrase(4248) . '</div>
                <div class="table_block">'; if (count($argProfile) > 0) { foreach ($argProfile as $i => $value) { if ( !isset($value['NAME']) && isset($value['NAZV']) ) { $value['NAME'] = $value['NAZV']; } $content .= '
                    <div class="item">
                        <div class="left_data">
                            ' . Lang::getPhrase(833) . ':
                        </div>
                        <div>
                            <input name="name_id_' . $i . '" type="text" size=30 maxlength=255 class="input_box" value=\'' . $value['NAME'] . '\'>
                        </div>
                        <div class="left_data">
                            OID:
                        </div>
                        <div>
                            <input name="oid_id_' . $i . '" type="text" size=30 maxlength=255 class="input_box" value=\'' . $value['OID'] . '\'>
                        </div>
                        <div class="left_data">
                            ' . Lang::getPhrase(2225) . ':
                        </div>
                        <div>
                            <select name="do_id_' . $i . '" size="1">
                                <option value="0"></option>
                                <option value="' . DeviceSnmpProfileAR::TYPE_1 . '"'; if (DeviceSnmpProfileAR::TYPE_1 == $value['DO']) { $content .= ' selected'; } $content .= '>* 0.1</option>
                                <option value="' . DeviceSnmpProfileAR::TYPE_2 . '"'; if (DeviceSnmpProfileAR::TYPE_2 == $value['DO']) { $content .= ' selected'; } $content .= '>uptime</option>
                                <option value="' . DeviceSnmpProfileAR::TYPE_3 . '"'; if (DeviceSnmpProfileAR::TYPE_3 == $value['DO']) { $content .= ' selected'; } $content .= '>1/0</option>
                                <option value="' . DeviceSnmpProfileAR::TYPE_4 . '"'; if (DeviceSnmpProfileAR::TYPE_4 == $value['DO']) { $content .= ' selected'; } $content .= '>MAC</option>
                                <option value="' . DeviceSnmpProfileAR::TYPE_5 . '"'; if (DeviceSnmpProfileAR::TYPE_5 == $value['DO']) { $content .= ' selected'; } $content .= '>* 0.01</option>
                                <option value="' . DeviceSnmpProfileAR::TYPE_6 . '"'; if (DeviceSnmpProfileAR::TYPE_6 == $value['DO']) { $content .= ' selected'; } $content .= '>1/>1</option>
                    <option value="' . DeviceSnmpProfileAR::TYPE_7 . '"'; if (DeviceSnmpProfileAR::TYPE_7 == $value['DO']) { $content .= ' selected'; } $content .= '>* 0.001</option>
                            </select>
                        </div>
                    </div>'; } } for ($j = 1; $j <= 20; ++$j) { $content .= '
                    <div class="item">
                        <div class="left_data">
                            ' . Lang::getPhrase(833) . ':
                        </div>
                        <div>
                            <input name="name_new_' . $j . '" type="text" size=30 maxlength=255 class="input_box" value=\'\'>
                        </div>
                        <div class="left_data">
                            OID:
                        </div>
                        <div>
                            <input name="oid_new_' . $j . '" type="text" size=30 maxlength=255 class="input_box" value=\'\'>
                        </div>
                        <div class="left_data">
                            ' . Lang::getPhrase(2225) . ':
                        </div>
                        <div>
                            <select name="do_new_' . $j . '" size="1">
                                <option value="0"></option>
                                <option value="' . DeviceSnmpProfileAR::TYPE_1 . '">* 0.1</option>
                                <option value="' . DeviceSnmpProfileAR::TYPE_2 . '">uptime</option>
                                <option value="' . DeviceSnmpProfileAR::TYPE_3 . '">1/0</option>
                                <option value="' . DeviceSnmpProfileAR::TYPE_4 . '">MAC</option>
                                <option value="' . DeviceSnmpProfileAR::TYPE_5 . '">* 0.01</option>
                                <option value="' . DeviceSnmpProfileAR::TYPE_6 . '">1/>1</option>
                            </select>
                        </div>
                    </div>'; } $content .= '
                </div>
                ' . BodyHtml::formButton('save_cancel', $ret) . '
            </form>'; if ($id > 0) { $content .= ' ' . BodyHtml::linkConfirm( '?core_section=settings_main&action=device_profile_delete&id=' . $id, Lang::getPhrase(1415), Lang::getPhrase(1150) . '?', '<i class="us-icon us-icon-danger fa-close"></i>' . Lang::getPhrase(1415) , 'linkConfirmDeleteProfileId' ); } return $content; } private static function deviceProfile(): string { OperatorAccess::verifyRight(OperatorAccess::RIGHT_SETTING); $content = '
            <a href="?core_section=settings_main&item_id=' . self::ITEM_7 . '"><i class="us-icon fa-chevron-left"></i>' . Lang::getPhrase( 1443 ) . '</a><br>
            <div class="label_h2">' . Lang::getPhrase(4247) . '</div>
            <div class="div_space">
                <a id="linkAddId" href="?core_section=settings_main&action=device_profile_dialog_add"><i class="us-icon fa-plus"></i>' . Lang::getPhrase( 841 ) . '</a>
            </div>'; $data = []; $deviceProfiles = DeviceSnmpProfileAR::find()->all(); foreach ($deviceProfiles as $deviceProfile) { $data[$deviceProfile->getId()] = [ 'id' => $deviceProfile->getId(), 'name' => $deviceProfile->getName() ]; } $field = [ [ 'SPECIAL' => '_number' ], [ 'NAME' => Lang::getPhrase(1451), 'ISSORT' => 1, 'ISSORTABC' => 1, 'EL' => 'name' ] ]; $table = new Table(); $table->link = '?core_section=settings_main&action=device_profile_dialog_edit&id='; $table->sortDefault = 'name'; $table->isSortDefaultAbc = 1; $content .= $table->show($data, $field); return $content; } private static function deleteNodeTypeGroup(): void { OperatorAccess::verifyRight(OperatorAccess::RIGHT_SETTING); $uuid = RequestData::$uuid; if (false === NodeTypeGroupSystem::tryDelete($uuid)) { Html::locationBackCancel(); } else { Html::location( '?' . BodyHtml::CORES_SECTION . '=' . BodyHtml::SECTION_SETTINGS_MAIN . '&action=' . self::A_NODE_TYPE_GROUPS, Html::TYPE_MSG_DELETED ); } } private static function nodeTypeDelete(): void { if (Central::$isUSOnline === false) { OperatorAccess::verifyRight(OperatorAccess::RIGHT_SETTING); } $id = RequestData::$id; if ( Central::$isUSOnline === true && NodeTypeAR::findOne($id)->getAuthorEmployeeId() != Html::$currentEmployeeId ) { Html::locationForbidden(); } if (false === NodeTypeAR::findOne($id)->tryDelete()) { Html::locationBackCancel(); } else { Html::location( '?core_section=' . BodyHtml::SECTION_SETTINGS_MAIN . '&action=' . self::A_NODE_TYPES, Html::TYPE_MSG_UPDOK ); } } private static function nodeTypeSetDefaultCardExteriorField(): void { if (Central::$isUSOnline === false) { OperatorAccess::verifyRight(OperatorAccess::RIGHT_SETTING); } $id = RequestData::$id; $nodeType = NodeTypeAR::findOne($id); if ( Central::$isUSOnline === true && $nodeType->getAuthorEmployeeId() != Html::$currentEmployeeId ) { Html::locationForbidden(); } $nodeType->edit( [ NodeTypeAR::F_CARD_EXTERIOR => '' ] ); Html::locationBackOk(); } private static function nodeTypeSave(): void { if (Central::$isUSOnline === false) { OperatorAccess::verifyRight(OperatorAccess::RIGHT_SETTING); } $id = RequestData::$id; if ($id < 1) { $nodeType = NodeTypeAR::create(RequestData::custom('name')); $id = $nodeType->getId(); } else { $nodeType = NodeTypeAR::findOne($id); } if (!$nodeType) { Html::locationCancel(); } if ( Central::$isUSOnline === true && $nodeType->getAuthorEmployeeId() != Html::$currentEmployeeId ) { Html::locationForbidden(); } NodeTypeAdditionalFieldAR::removeByNodeTypeId($id); $styleArray = [ 'template' => RequestData::customInt('style_template'), 'opation' => RequestData::customInt('style_opation'), 'color' => RequestData::customColor('style_color'), 'color_plan' => RequestData::customColor('style_color_plan'), 'stroke_color' => RequestData::customColor('style_stroke_color'), 'stroke_color_plan' => RequestData::customColor('style_stroke_color_plan'), 'ico' => RequestData::customTrue('style_ico'), 'ico_plan' => RequestData::customTrue('style_ico_plan'), 'z' => RequestData::customInt('style_z'), 'size' => round(RequestData::custom('style_size'), 6) ]; $bundle = [ NodeTypeAR::F_NAME => RequestData::custom('name'), NodeTypeAR::F_POSITION => RequestData::customInt('position'), NodeTypeAR::F_DEFAULT_OWNER_ID => RequestData::customInt('default_owner_id'), NodeTypeAR::F_IS_CAN_PARENT => RequestData::customBoolean('is_can_parent'), NodeTypeAR::F_IS_LAYER_ON_MAP => RequestData::customBoolean('is_layer_on_map'), NodeTypeAR::F_IS_COMMUTATION => RequestData::customBoolean('is_commutation'), NodeTypeAR::F_IS_INSTALL_DEVICE => RequestData::customBoolean('is_install_device'), NodeTypeAR::F_STYLE => json_encode($styleArray, JSON_THROW_ON_ERROR), NodeTypeAR::F_CARD_EXTERIOR => BodyHtml::interfaceCardExteriorFieldsListRequestData(), NodeTypeAR::F_NODE_TYPE_GROUP_ID => RequestData::custom('node_type_group_id'), ]; if (NodeTypeCache::getPatternName($id) != RequestData::customTrue('pattern_name')) { $bundle[NodeTypeAR::F_PATTERN_NAME] = RequestData::customTrue('pattern_name'); } if (NodeTypeCache::getSingleName($id) != RequestData::customTrue('single_name')) { $bundle[NodeTypeAR::F_SINGLE_NAME] = RequestData::customTrue('single_name'); } $nodeType->edit($bundle); if (isset($_REQUEST['fields'])) { $fields = $_REQUEST['fields']; foreach ($fields as $value) { NodeTypeAdditionalFieldAR::create($id, $value); } } if (OperatorAccess::isAccess(OperatorAccess::RIGHT_OPERATOR) == 1) { EmployeeProfilesNodeTypesSystem::removeByNodeTypeId($id); $tempArray = []; if (isset($_REQUEST['operator_profile_access_write'])) { foreach ($_REQUEST['operator_profile_access_write'] as $operatorProfileId) { $tempArray[$operatorProfileId] = [ 'is_access_read' => true, 'is_access_write' => true ]; } } if (isset($_REQUEST['operator_profile_access_read'])) { foreach ($_REQUEST['operator_profile_access_read'] as $operatorProfileId) { if (!isset($tempArray[$operatorProfileId])) { $tempArray[$operatorProfileId] = [ 'is_access_read' => true, 'is_access_write' => false ]; } else { $tempArray[$operatorProfileId]['is_access_read'] = true; } } } foreach ($tempArray as $operatorProfileId => $value) { EmployeeProfilesNodeTypesSystem::create( $id, $operatorProfileId, $value['is_access_write'], $value['is_access_read'] ); } } EmployeeActionLogSystem::writeLog(EmployeeHistoryType::T545, NodeTypeAR::OBJECT_TYPE_ID, $id); Html::location( '?core_section=' . BodyHtml::SECTION_SETTINGS_MAIN . '&action=' . self::A_NODE_TYPE_ADD_EDIT . '&id=' . $id, Html::TYPE_MSG_UPDOK ); } private static function saveNodeTypeGroup(): void { OperatorAccess::verifyRight(OperatorAccess::RIGHT_SETTING); $uuid = RequestData::$uuid; $name = RequestData::custom('name'); $position = RequestData::customInt('position'); if ($uuid === '') { $uuid = NodeTypeGroupSystem::create( name: $name, position: $position ); } else { NodeTypeGroupSystem::edit( uuid: $uuid, bundle: [ NodeTypeGroupDto::F_NAME => $name, NodeTypeGroupDto::F_POSITION => $position, ] ); } Html::locationBackOk(); } private static function dialogNodeTypeGroup(): string { OperatorAccess::verifyRight(OperatorAccess::RIGHT_SETTING); Html::$pageId = 141; $uuid = RequestData::$uuid; if ($uuid !== '') { $nodeTypeGroupDto = Yii::$container ->get(NodeTypeGroupFetcher::class) ->getOneByCondition( [ NodeTypeGroupDto::F_ID => $uuid ] ); if (!$nodeTypeGroupDto) { Html::locationCancel(); } $ret = '?' . BodyHtml::CORES_SECTION . '=' . BodyHtml::SECTION_SETTINGS_MAIN . '&action=' . self::A_NODE_TYPE_GROUPS; $content = '
                <a href="' . $ret . '"><i class="us-icon fa-chevron-left"></i>' . Lang::getPhrase( 1580 ) . '</a><br>
                <div class="label_h2">' . NodeTypeGroupSystem::classCaption() . '</div>'; } else { Html::$isEmptyTemplate = true; $ret = ''; $content = '
                <div class="dialog_header"><span id="spanDialogNodeTypeGroupId">' . Lang::getPhrase( 3865 ) . '</span></div>
                <br>'; } $content .= '
            <form method="post" name="form1" action="">
                <input type="hidden" name="core_section" value="' . BodyHtml::SECTION_SETTINGS_MAIN . '">
                <input type="hidden" name="action" value="' . self::A_SAVE_NODE_TYPE_GROUP . '">
                <input type="hidden" name="uuid" value="' . $uuid . '">            
                <div class="table_block">
                    <div class="item">
                        <div class="left_data">
                            ' . Lang::getPhrase(1451) . ':
                        </div>
                        <div>
                            <input name="name" type="text" size=30 maxlength=255 class="input_box" value=\'' . ($uuid !== '' ? NodeTypeGroupCache::getName( $uuid ) : '') . '\'>
                        </div>
                    </div>
                    <div class="item">
                        <div class="left_data">
                            ' . Lang::getPhrase(3836) . ':
                        </div>
                        <div>
                            <input name="position" type="text" size=5 maxlength=5 class="input_box" value=\'' . ($uuid !== '' ? $nodeTypeGroupDto->position : '') . '\'>
                        </div>
                    </div>
                </div>
                ' . BodyHtml::formButton('save_cancel', $ret) . '
            </form>'; if ($uuid !== '') { $content .= BodyHtml::linkDeleteObject( id: null, linkDelete: '?' . BodyHtml::CORES_SECTION . '=' . BodyHtml::SECTION_SETTINGS_MAIN . '&action=' . self::A_DELETE_NODE_TYPE_GROUP . '&uuid=' . $uuid, objectTypeId: NodeTypeGroupDto::OBJECT_TYPE_ID, checkCountDelete: count(NodeTypeGroupSystem::checkDelete($uuid)), uuid: $uuid ); } return $content; } private static function nodeTypeAddEdit(): string { if (Central::$isUSOnline === false) { OperatorAccess::verifyRight(OperatorAccess::RIGHT_SETTING); } Html::$pageId = 141; $id = RequestData::$id; if ($id > 0) { $nodeType = NodeTypeAR::findOne($id); if (!$nodeType) { Html::locationCancel(); } if ( Central::$isUSOnline === true && $nodeType->getAuthorEmployeeId() != Html::$currentEmployeeId ) { Html::locationForbidden(); } } else { $nodeType = new NodeTypeAR(); } $ret = '?core_section=' . BodyHtml::SECTION_SETTINGS_MAIN . '&action=' . self::A_NODE_TYPES; $content = '
            <a href="' . $ret . '"><i class="us-icon fa-chevron-left"></i>' . Lang::getPhrase( 1443 ) . '</a><br>
            <div class="label_h2">' . NodeAR::classCaption() . '</div>
            <script src="../main/js/icolorpicker.js?t=' . time() . '"></script>
            <form method="post" name="form1" action="">
                <input type="hidden" name="core_section" value="' . BodyHtml::SECTION_SETTINGS_MAIN . '">
                <input type="hidden" name="action" value="' . self::A_NODE_TYPE_SAVE . '">
                <input type="hidden" name="id" value="' . $id . '">            
                <div class="table_block">
                    <div class="item">
                        <div class="left_data">
                            ' . Lang::getPhrase(1451) . ':
                        </div>
                        <div>'; $content .= '
                            <input name="name" type="text" size=30 maxlength=255 class="input_box" value="' . ($id > 0 ? NodeTypeCache::getName( $id ) : '') . '">'; $content .= '
                        </div>
                    </div>'; $content .= '
                    <div class="item">
                        <div class="left_data">
                            ' . Lang::getPhrase(5777) . ':
                        </div>
                        <div>
                            <input name="single_name" type="text" size=30 maxlength=255 class="input_box" value="' . ($id > 0 ? NodeTypeCache::getSingleName( $id ) : '') . '">
                        </div>
                    </div>
                    <div class="item">
                        <div class="left_data">
                            ' . NodeTypeGroupSystem::classCaptionSingle() . ':
                        </div>
                        <div>
                            <select name="node_type_group_id" size="1">
                                <option value="0"></option>'; $nodeTypeGroupsDto = Yii::$container ->get(NodeTypeGroupFetcher::class) ->getByCondition(); foreach ($nodeTypeGroupsDto as $nodeTypeGroupDto) { $content .= '
                                <option value="' . $nodeTypeGroupDto->id . '"'; if ( $id > 0 && $nodeTypeGroupDto->id === $nodeType->getNodeTypeGroupId() ) { $content .= ' selected'; } $content .= '>' . NodeTypeGroupCache::getName($nodeTypeGroupDto->id) . '</option>'; } $content .= '
                            </select>
                        </div>
                    </div>
                    <div class="item">
                        <div class="left_data">
                            ' . Lang::getPhrase(3836) . ':
                        </div>
                        <div>
                            <input name="position" type="text" size=5 maxlength=5 class="input_box" value=\'' . ($id > 0 ? $nodeType->getPosition( ) : '') . '\'>
                        </div>
                    </div>
                    <div class="item">
                        <div class="left_data">
                            ' . Lang::getPhrase(5778) . ':<br>
                            <i>(' . Lang::getPhrase(5779) . ')</i>
                        </div>
                        <div>
                            <input name="is_can_parent" type="checkbox" value="1"'; if ($id > 0 && $nodeType->getIsCanParent() === true) { $content .= ' checked'; } $content .= '>
                        </div>
                    </div>
                    <div class="item">
                        <div class="left_data">
                            ' . Lang::getPhrase(5452) . ':<br>
                            <i>(TWIG)<br>
                            ' . Lang::getPhrase( 740 ) . ':<br> {{ ' . NodeTypeAR::PATTERN_NAME_LOCATION_FULL . ' }}{% if ' . NodeTypeAR::PATTERN_NAME_NUMBER . ' %}, #{{ ' . NodeTypeAR::PATTERN_NAME_NUMBER . ' }} {% endif %}</i>
                        </div>
                        <div>
                            <input name="pattern_name" type="text" size=50 maxlength=255 class="input_box" value=\'' . ($id > 0 ? NodeTypeCache::getPatternName( $id ) : '') . '\'><br>
                            <div class="div_space">
                                {{ ' . NodeTypeAR::PATTERN_NAME_ADDRESS_NAME . ' }} - ' . Lang::getPhrase( 1186 ) . '<br>
                                {{ ' . NodeTypeAR::PATTERN_NAME_BUILDING_ENTRANCE . ' }} - ' . Lang::getPhrase( 3261 ) . '<br>
                                {{ ' . NodeTypeAR::PATTERN_NAME_BUILDING_LEVEL_NAME . ' }} - ' . Lang::getPhrase( 3262 ) . '<br>
                                {{ ' . NodeTypeAR::PATTERN_NAME_LOCATION . ' }} - ' . Lang::getPhrase( 2069 ) . '<br>
                                {{ ' . NodeTypeAR::PATTERN_NAME_LOCATION_FULL . ' }} - ' . Lang::getPhrase( 2069 ) . ' <i>(' . Lang::getPhrase( 1186 ) . ', ' . Lang::getPhrase(2069) . ', ' . Lang::getPhrase(3262) . '...)</i><br>
                                {{ ' . NodeTypeAR::PATTERN_NAME_NUMBER . ' }} - ' . Lang::getPhrase(875) . '<br>
                                {{ ' . NodeTypeAR::PATTERN_NAME_TYPE_NAME . ' }} - ' . Lang::getPhrase(863) . '
                            </div>
                        </div>
                    </div>
                    <div class="item">
                        <div class="left_data">
                            ' . Lang::getPhrase(6163) . ':<br>
                            <span class="info_block">(' . Lang::getPhrase(740) . ')</span>
                        </div>
                        <div>
                            <select name="default_owner_id" size="1">
                                <option value="0"></option>'; $owners = OwnerAR::getWithAddressVerify([], [], 0, 0, 'o.' . OwnerAR::F_NAME, false, false); foreach ($owners as $owner) { $content .= '
                                <option value="' . $owner->getId() . '"'; if ( $id > 0 && $owner->getId() === $nodeType->getDefaultOwnerId() ) { $content .= ' selected'; } $content .= '>' . OwnerCache::getName($owner->getId()) . '</option>'; } $content .= '
                            </select>
                        </div>
                    </div>
                    <div class="item">
                        <div class="left_data">
                            ' . Lang::getPhrase(5984) . ':
                        </div>
                        <div>
                            <input name="is_install_device" type="checkbox" value="1"'; if ($id > 0 && $nodeType->getIsInstallDevice() === true) { $content .= ' checked'; } $content .= '>
                        </div>
                    </div>
                    <div class="item">
                        <div class="left_data">
                            ' . Lang::getPhrase(5804) . ':
                        </div>
                        <div>
                            <input name="is_commutation" type="checkbox" value="1"'; if ($id > 0 && $nodeType->getIsCommutation() === true) { $content .= ' checked'; } $content .= '>
                        </div>
                    </div>
                    <div class="item">
                        <div class="left_data">
                            ' . Lang::getPhrase(3809) . ':
                        </div>
                        <div>'; $usedField = []; if ($id > 0) { $nodeTypeAdditionalFields = NodeTypeAdditionalFieldAR::find() ->where( [ NodeTypeAdditionalFieldAR::F_NODE_TYPE_ID => $nodeType->getId() ] ) ->all(); foreach ($nodeTypeAdditionalFields as $nodeTypeAdditionalField) { $additionalDataConfig = AdditionalFieldAR::findOne($nodeTypeAdditionalField->getAdditionalFieldId()); if ( Central::$isUSOnline === false || $additionalDataConfig->getAuthorEmployeeId() == Html::$currentEmployeeId ) { $usedField[$nodeTypeAdditionalField->getAdditionalFieldId()] = true; } } } $expr = ''; if (Central::$isUSOnline === true) { $expr = [ AdditionalFieldAR::F_AUTHOR_EMPLOYEE_ID => Html::$currentEmployeeId ]; } $additionalDataConfigs = AdditionalFieldAR::find() ->where(AdditionalFieldAR::F_CATEGORIES . " @> '[\"" . AdditionalFieldAR::CATEGORY_NODE . "\"]'") ->andWhere($expr) ->orderBy(AdditionalFieldAR::F_NAME) ->all(); foreach ($additionalDataConfigs as $additionalDataConfig) { $content .= '
                            <div class="div_space">
                                <input type="checkbox"'; if (isset($usedField[$additionalDataConfig->getId()])) { $content .= ' checked'; } $content .= ' name="fields[]" value="' . $additionalDataConfig->getId( ) . '"> ' . $additionalDataConfig->getName() . '
                            </div>'; } $content .= '
                        </div>
                    </div>
                </div>'; $style = $nodeType->getStyle(); $content .= '
                <span class="label_h2">' . Lang::getPhrase(729) . '</span>
                <div class="table_block">
                    <div class="item">
                        <div class="left_data">
                            ' . Lang::getPhrase(5330) . ':
                        </div>
                        <div>
                            <input name="is_layer_on_map" type="checkbox" value="1"'; if ($id > 0 && $nodeType->getIsLayerOnMap() === true) { $content .= ' checked'; } $content .= '>
                        </div>
                    </div>
                    <div class="item">
                        <div class="left_data">
                            ' . Lang::getPhrase(5801) . ':<br>
                            <i>(' . Lang::getPhrase(5802) . ')</i>
                        </div>
                        <div>
                            <input name="style_z" type="text" size=5 maxlength=3 class="input_box" value="' . $style['z'] . '"> 
                            <i>(' . Lang::getPhrase(5803) . ')</i>
                        </div>
                    </div>                
                    <div class="item">
                        <div class="left_data">
                            ' . Lang::getPhrase(5363) . ':
                        </div>
                        <div>
                            <select id="styleTemplateId" name="style_template" size="1" onchange="changeStyleTemplate(' . NodeTypeAR::STYLE_TEMPLATE_IMAGE . ',' . NodeTypeAR::STYLE_TEMPLATE_CIRCLE . ')">
                                <option value="' . NodeTypeAR::STYLE_TEMPLATE_TRIANGLE . '"'; if ($style['template'] == NodeTypeAR::STYLE_TEMPLATE_TRIANGLE) { $content .= " selected"; } $content .= '>' . Lang::getPhrase( 5798 ) . '</option>
                                <option value="' . NodeTypeAR::STYLE_TEMPLATE_SQUARE . '"'; if ($style['template'] == NodeTypeAR::STYLE_TEMPLATE_SQUARE) { $content .= " selected"; } $content .= '>' . Lang::getPhrase( 5924 ) . '</option>
                                <option value="' . NodeTypeAR::STYLE_TEMPLATE_RHOMBUS . '"'; if ($style['template'] == NodeTypeAR::STYLE_TEMPLATE_RHOMBUS) { $content .= " selected"; } $content .= '>' . Lang::getPhrase( 5925 ) . '</option>
                                <option value="' . NodeTypeAR::STYLE_TEMPLATE_CIRCLE . '"'; if ($style['template'] == NodeTypeAR::STYLE_TEMPLATE_CIRCLE) { $content .= " selected"; } $content .= '>' . Lang::getPhrase( 5799 ) . '</option>
                                <option value="' . NodeTypeAR::STYLE_TEMPLATE_IMAGE . '"'; if ($style['template'] == NodeTypeAR::STYLE_TEMPLATE_IMAGE) { $content .= " selected"; } $content .= '>' . Lang::getPhrase( 4335 ) . '</option>
                            </select>        
                        </div>
                    </div>
                    <div class="item" id="divSizeId">
                        <div class="left_data">
                            ' . Lang::getPhrase(5376) . ':
                        </div>
                        <div>
                            <input id="sizeId" name="style_size" type="text" size=3 maxlength=5 class="input_box" value="' . $style['size'] . '"> x
                        </div>
                    </div>
                    <div class="item" id="divColorId">
                        <div class="left_data">
                            ' . Lang::getPhrase(5250) . ':
                        </div>
                        <div>
                            <input id="colorId" name="style_color" type="text" size=8 maxlength=7 class="input_box iColorPicker" value="' . $style['color'] . '">
                            /
                            <input id="strokeColorId" name="style_stroke_color" type="text" size=8 maxlength=7 class="input_box iColorPicker" value="' . $style['stroke_color'] . '">
                        </div>
                    </div>
                    <div class="item" id="divColorPlanId">
                        <div class="left_data">
                            ' . Lang::getPhrase(5250) . ' (' . Lang::getPhrase( 5253 ) . '):
                        </div>
                        <div>
                            <input id="colorPlanId" name="style_color_plan" type="text" size=8 maxlength=7 class="input_box iColorPicker" value="' . $style['color_plan'] . '">
                            /
                            <input id="strokeColorPlanId" name="style_stroke_color_plan" type="text" size=8 maxlength=7 class="input_box iColorPicker" value="' . $style['stroke_color_plan'] . '">
                        </div>
                    </div>
                    <div class="item" id="divOpationId">
                        <div class="left_data">
                            ' . Lang::getPhrase(5930) . ':
                        </div>
                        <div>
                            <input id="opationId" name="style_opation" type="text" size=3 maxlength=3 class="input_box" value="' . $style['opation'] . '"> %
                        </div>
                    </div>
                    <div class="item" id="divIcoId">
                        <div class="left_data">
                            ' . Lang::getPhrase(5800) . ':<br>
                            <i>(URL)</i>
                        </div>
                        <div>
                            <input name="style_ico" type="text" size=40 maxlength=255 class="input_box" value="' . $style['ico'] . '">
                        </div>
                    </div>
                    <div class="item" id="divIcoPlanId">
                        <div class="left_data">
                            ' . Lang::getPhrase(5800) . ' (' . Lang::getPhrase( 5253 ) . '):<br>
                            <i>(URL)</i>
                        </div>
                        <div>
                            <input name="style_ico_plan" type="text" size=40 maxlength=255 class="input_box" value="' . $style['ico_plan'] . '">
                        </div>
                    </div>
                    <script>
                        changeStyleTemplate(' . NodeTypeAR::STYLE_TEMPLATE_IMAGE . ',' . NodeTypeAR::STYLE_TEMPLATE_CIRCLE . ');
                    </script>
                </div>'; if ($id > 0) { $tempExterior = $nodeType->getCardExterior(); } else { $tempExterior = []; } $content .= BodyHtml::interfaceCardExteriorFieldsListEdit( AdditionalFieldAR::CATEGORY_NODE, $tempExterior, NodeHtml::cardFieldDefaultCatalog(), '?core_section=' . BodyHtml::SECTION_SETTINGS_MAIN . '&action=' . self::A_NODE_TYPE_SET_DEFAULT_CARD_EXTERIOR_FIELD . '&id=' . $id ); if ( $id > 0 && OperatorAccess::isAccess(OperatorAccess::RIGHT_OPERATOR) == 1 ) { $currentArrayRights = []; $employeeProfilesNodeTypesDtos = Yii::$container ->get(EmployeeProfilesNodeTypesFetcher::class) ->getByCondition( [ EmployeeProfilesNodeTypesDto::F_NODE_TYPE_ID => $nodeType->getId() ] ); foreach ($employeeProfilesNodeTypesDtos as $employeeProfilesNodeTypesDto) { $currentArrayRights[$employeeProfilesNodeTypesDto->employee_profile_id] = [ 'is_access_read' => $employeeProfilesNodeTypesDto->is_access_read, 'is_access_write' => $employeeProfilesNodeTypesDto->is_access_write ]; } $content .= '
                <span class="label_h2">' . Lang::getPhrase(1132) . '</span>
                <div class="table_block">
                    <div class="item" style="text-align: center">
                        <div class="left_data">
                        </div>
                        <div>
                            ' . Lang::getPhrase(840) . '
                        </div>
                        <div>
                            ' . Lang::getPhrase(2390) . '
                        </div>
                    </div>'; $operatorProfiles = EmployeeProfileAR::find() ->orderBy(EmployeeProfileAR::F_NAME) ->all(); foreach ($operatorProfiles as $operatorProfile) { $content .= '
                    <div class="item">
                        <div class="left_data">
                            ' . EmployeeProfileCache::getName($operatorProfile->getId()) . '
                        </div>
                        <div class="div_center">
                            <input name="operator_profile_access_read[]" type="checkbox"'; if (isset( $currentArrayRights[$operatorProfile->getId()]['is_access_read'] ) && true === $currentArrayRights[$operatorProfile->getId()]['is_access_read']) { $content .= ' checked'; } $content .= ' value=' . $operatorProfile->getId() . '>                                        
                        </div>
                        <div class="div_center">
                            <input name="operator_profile_access_write[]" type="checkbox"'; if (isset( $currentArrayRights[$operatorProfile->getId()]['is_access_write'] ) && true === $currentArrayRights[$operatorProfile->getId()]['is_access_write']) { $content .= ' checked'; } $content .= ' value=' . $operatorProfile->getId() . '>                                        
                        </div>
                    </div>'; } $content .= '
                </div>'; } $content .= '
                ' . BodyHtml::formButton('save_cancel', $ret) . '
            </form>'; if ($id > 0) { $content .= BodyHtml::linkDeleteObject( $id, '?core_section=' . BodyHtml::SECTION_SETTINGS_MAIN . '&action=' . self::A_NODE_TYPE_DELETE . '&id=' . $id, '', '', '', NodeTypeAR::OBJECT_TYPE_ID, count(NodeTypeAR::findOne($id)->checkDelete()) ); } return $content; } private static function nodeTypeGroups(): string { OperatorAccess::verifyRight(OperatorAccess::RIGHT_SETTING); Html::$pageId = 141; $content = '
            <div class="div_space">
                <a id="linkNodeTypeId" href="?' . BodyHtml::CORES_SECTION . '=' . BodyHtml::SECTION_SETTINGS_MAIN . '&action=' . self::A_NODE_TYPES . '"><i class="us-icon fa-chevron-left"></i>' . NodeTypeAR::classCaption( ) . '</a>
            </div>
            <div class="label_h2">' . NodeTypeGroupSystem::classCaption() . '</div>
            <div class="div_space">
                <a id="linkAddId" class="link_dashed" href="javascript:ajaxWindow(\'?' . BodyHtml::CORES_SECTION . '=' . BodyHtml::SECTION_SETTINGS_MAIN . '&action=' . self::A_DIALOG_NODE_TYPE_GROUP . '\')"><i class="us-icon fa-plus"></i><span>' . Lang::getPhrase( 841 ) . '</span></a>
            </div>
            <br>'; $data = []; $nodeTypeGroupsDto = Yii::$container ->get(NodeTypeGroupFetcher::class) ->getByCondition(); foreach ($nodeTypeGroupsDto as $nodeTypeGroupDto) { $data[] = [ 'id' => $nodeTypeGroupDto->id, 'name' => NodeTypeGroupCache::getName($nodeTypeGroupDto->id), 'position' => $nodeTypeGroupDto->position, ]; } $field = [ [ 'SPECIAL' => '_number' ], [ 'NAME' => Lang::getPhrase(1451), 'ISSORT' => 1, 'ISSORTABC' => 1, 'EL' => 'name' ], [ 'NAME' => Lang::getPhrase(3836), 'ISSORT' => 1, 'ALIGN' => 'center', 'EL' => 'position' ] ]; $table = new Table(); $table->link = '?' . BodyHtml::CORES_SECTION . '=' . BodyHtml::SECTION_SETTINGS_MAIN . '&action=' . self::A_DIALOG_NODE_TYPE_GROUP . '&uuid='; $table->sortDefault = 'name'; $table->isSortDefaultAbc = 1; $content .= $table->show($data, $field); return $content; } private static function nodeTypes(): string { if (Central::$isUSOnline === false) { OperatorAccess::verifyRight(OperatorAccess::RIGHT_SETTING); } Html::$pageId = 141; $content = '
            <div class="label_h2">' . NodeTypeAR::classCaption() . '</div>'; $content .= '
                <div class="div_space">
                    <a id="linkNodeTypeGroupId" href="?' . BodyHtml::CORES_SECTION . '=' . BodyHtml::SECTION_SETTINGS_MAIN . '&action=' . self::A_NODE_TYPE_GROUPS . '"><i class="us-icon fa-bars"></i>' . NodeTypeGroupSystem::classCaption( ) . '</a>
                </div>
                <div class="div_space">
                    <a id="linkNodeIconListId" href="?core_section=settings_main&action=node_icon"><i class="us-icon fa-bars"></i>' . Lang::getPhrase( 4149 ) . '</a>
                </div>
                <br>
                <div class="div_space">
                    <a id="linkAddId" href="?core_section=' . BodyHtml::SECTION_SETTINGS_MAIN . '&action=' . self::A_NODE_TYPE_ADD_EDIT . '"><i class="us-icon fa-plus"></i>' . Lang::getPhrase( 841 ) . '</a>
                </div><br>'; $expr = ''; if (Central::$isUSOnline === true) { $expr = [ NodeTypeAR::F_AUTHOR_EMPLOYEE_ID => Html::$currentEmployeeId ]; } $data = []; $nodeTypes = NodeTypeAR::find() ->where($expr) ->all(); foreach ($nodeTypes as $nodeType) { $data[] = [ 'id' => $nodeType->getId(), 'name' => NodeTypeCache::getName($nodeType->getId()), 'position' => $nodeType->getPosition(), 'is_layer_on_map' => $nodeType->getIsLayerOnMap() === true ? 1 : 0, 'node_type_group_name' => NodeTypeGroupCache::getName($nodeType->getNodeTypeGroupId()), ]; } $field = [ [ 'SPECIAL' => '_number' ], [ 'NAME' => Lang::getPhrase(1451), 'ISSORT' => 1, 'ISSORTABC' => 1, 'EL' => 'name' ], [ 'NAME' => NodeTypeGroupSystem::classCaptionSingle(), 'EL' => 'node_type_group_name', 'ISSORT' => 1, 'ISSORTABC' => 1, ], [ 'NAME' => Lang::getPhrase(3836), 'ISSORT' => 1, 'ALIGN' => 'center', 'EL' => 'position' ], [ 'NAME' => Lang::getPhrase(2203), 'ISSORT' => 1, 'ALIGN' => 'center', 'CONVERT' => 'boolean', 'EL' => 'is_layer_on_map' ] ]; $table = new Table(); $table->link = '?core_section=' . BodyHtml::SECTION_SETTINGS_MAIN . '&action=' . self::A_NODE_TYPE_ADD_EDIT . '&id='; $table->sortDefault = 'name'; $table->isSortDefaultAbc = 1; $content .= $table->show($data, $field); return $content; } private static function nodeIconDelete(): void { OperatorAccess::verifyRight(OperatorAccess::RIGHT_SETTING); $id = RequestData::$id; MapNodeIconAR::findOne($id)->tryDelete(); Html::location('?core_section=settings_main&action=node_icon', 'updok'); } private static function nodeIconSave(): void { OperatorAccess::verifyRight(OperatorAccess::RIGHT_SETTING); $id = RequestData::$id; if ($id < 1) { $id = MapNodeIconAR::create(RequestData::custom('name'))->getId(); } else { $mapMarker = MapNodeIconAR::findOne($id); $mapMarker->edit( [ MapNodeIconAR::F_NAME => RequestData::custom('name') ] ); } EmployeeActionLogSystem::writeLog(EmployeeHistoryType::T402, MapNodeIconAR::OBJECT_TYPE_ID, $id); AttachHtml::save(AttachmentAR::TYPE_MAP_MARKER, $id, 0, 1); Html::location('?core_section=settings_main&action=node_icon_dialog_edit&id=' . $id, 'updok'); } private static function nodeIconDialogAddEdit(): string { OperatorAccess::verifyRight(OperatorAccess::RIGHT_SETTING); $id = RequestData::$id; if ($id > 0) { $mapMarker = MapNodeIconAR::findOne($id); $imageId = MapNodeIconCache::getImageIdById($id); } else { $mapMarker = new MapNodeIconAR(); $imageId = 0; } $content = '
            <a href="?core_section=settings_main&action=node_icon"><i class="us-icon fa-chevron-left"></i>' . Lang::getPhrase( 893 ) . '</a><br>
            <br>
            <span class="label_h2">' . Lang::getPhrase(4149) . '</span><br>'; if ($imageId > 0) { $content .= '
                <br>
                <div class="div_center">
                    <img alt="Icon" width="64" src="' . AttachmentAR::getViewUrl($imageId) . '"><br>
                </div>'; } $content .= '
            <form method="post" enctype="multipart/form-data" name="form1" action="">
                <input type="hidden" name="core_section" value="settings_main">
                <input type="hidden" name="action" value="node_icon_save">
                <input type="hidden" name="id" value="' . $id . '">
                <div class="table_block">
                    <div class="item">
                        <div class="left_data">
                            ' . Lang::getPhrase(1451) . ':
                        </div>
                        <div>
                            <input name="name" type="text" size=30 maxlength=255 class="input_box" value=\'' . ($id > 0 ? MapNodeIconCache::getNameById( $id ) : '') . '\'>
                        </div>
                    </div>
                    <div class="item">
                        <div class="left_data">
                            ' . Lang::getPhrase(4150) . ':<br>
                            <span class="info_block">' . Lang::getPhrase(880) . ' 16x16 px</span>
                        </div>
                        <div>
                            <input type="file" name="attach_file[]">
                        </div>
                    </div>
                </div>
                ' . BodyHtml::formButton('save_cancel', '?core_section=settings_main&action=node_icon') . '
            </form>'; if ($id > 0) { $content .= ' ' . BodyHtml::linkConfirm( '?core_section=settings_main&action=node_icon_delete&id=' . $id, Lang::getPhrase(1415), Lang::getPhrase(1150) . '?', '<i class="us-icon us-icon-danger fa-close"></i>' . Lang::getPhrase(1415) , 'linkConfirmDeleteIconId' ); } return $content; } private static function nodeIcon(): string { OperatorAccess::verifyRight(OperatorAccess::RIGHT_SETTING); $data = []; $mapNodeIcons = MapNodeIconAR::find() ->all(); foreach ($mapNodeIcons as $i => $mapNodeIcon) { $data[$i]['id'] = $mapNodeIcon->getId(); $data[$i]['name'] = MapNodeIconCache::getNameById($mapNodeIcon->getId()); $imageId = MapNodeIconCache::getImageIdById($mapNodeIcon->getId()); if ($imageId > 0) { $data[$i][103] = '<img src="' . AttachmentAR::getViewUrl($imageId) . '" width=16 height=16>'; } } $content = '
            <a href="?core_section=settings_main&item_id=' . self::ITEM_4 . '"><i class="us-icon fa-chevron-left"></i>' . Lang::getPhrase( 1443 ) . '</a><br>
            <div class="label_h2">' . Lang::getPhrase(4149) . '</div>
            <a id="linkAddId" href="?core_section=settings_main&action=node_icon_dialog_add"><i class="us-icon fa-plus"></i>' . Lang::getPhrase( 841 ) . '</a><br>'; $field = [ [ 'EL' => 103, 'ALIGN' => 'center' ], [ 'NAME' => Lang::getPhrase(1451), 'ISSORT' => 1, 'ISSORTABC' => 1, 'EL' => 'name' ] ]; $table = new Table(); $table->link = '?core_section=settings_main&action=node_icon_dialog_edit&id='; $table->sortDefault = MapNodeIconAR::F_NAME; $table->isSortDefaultAbc = 1; $content .= $table->show($data, $field); return $content; } private static function ldapSave(): void { OperatorAccess::verifyRight(OperatorAccess::RIGHT_SETTING); $isLdap = RequestData::customInt('is_ldap'); EmployeePropertyAR::ldapChangeStatus($isLdap); $ldap = LdapServer::find()->where('id > 0')->one(); if (!$ldap) { $ldap = new LdapServer(); $ldap->name = 'LDAP Server'; } $ldap->host = $_REQUEST['host']; $ldap->port = $_REQUEST['port']; $ldap->login = $_REQUEST['login']; $pass = $_REQUEST['pass']; if ('****' != $pass) { $ldap->password = $pass; } $ldap->tls = $_REQUEST['tls'] ?? 0; $ldap->base_dn = $_REQUEST['base_dn']; $ldap->filter = $_REQUEST['filter']; $ldap->attr_username = $_REQUEST['attr_username']; $ldap->attr_lastname = $_REQUEST['attr_lastname']; $ldap->attr_firstname = $_REQUEST['attr_firstname']; $ldap->save(); Html::locationBackOk(); } private static function ldap(): string { OperatorAccess::verifyRight(OperatorAccess::RIGHT_SETTING); $ldapServer = LdapServer::find() ->where('id > 0') ->one(); if (!$ldapServer) { $ldapServer = new LdapServer(); $pass = ''; } else { $pass = '****'; } $content = '
            <a href="?core_section=settings_main&item_id=' . self::ITEM_25 . '"><i class="us-icon fa-chevron-left"></i>' . Lang::getPhrase( 1443 ) . '</a><br>
            <div class="label_h2">LDAP</div>

            <form method="post" name="form1" action="">
                <input type="hidden" name="core_section" value="settings_main">
                <input type="hidden" name="action" value="ldap_save">
                <div class="table_block">
                    <div class="item">
                        <div class="left_data">
                            ' . Lang::getPhrase(837) . ':
                        </div>
                        <div>
                            <input name="is_ldap" type="checkbox"'; if (1 == SettingAR::getByNameInt(SettingsCatalog::EMPLOYEE_LDAP_IS_USE)) { $content .= ' checked'; } $content .= ' value="1">
                        </div>
                    </div>
                    <div class="item">
                        <div class="left_data">
                            Host:
                        </div>
                        <div>
                            <input type="text" class="input_box" required name="host" size="20" maxlength="255" value="' . $ldapServer->host . '">
                        </div>
                    </div>
                    <div class="item">
                        <div class="left_data">
                            Port:
                        </div>
                        <div>
                            <input type="text" class="input_box" required name="port" size="4" maxlength="5" value="' . $ldapServer->port . '">
                        </div>
                    </div>
                    <div class="item">
                        <div class="left_data">
                            TLS:
                        </div>
                        <div>
                            <input name="tls" type="checkbox"'; if ($ldapServer->tls === true) { $content .= ' checked'; } $content .= ' value="1">
                        </div>
                    </div>
                    <div class="item">
                        <div class="left_data">
                            LDAP Login:
                        </div>
                        <div>
                            <input type="text" class="input_box" required name="login" size="20" maxlength="255" value="' . $ldapServer->login . '">
                        </div>
                    </div>
                    <div class="item">
                        <div class="left_data">
                            LDAP Password:
                        </div>
                        <div>
                            <input type="password" class="input_box" required name="pass" size="20" maxlength="255" value="' . $pass . '">
                        </div>
                    </div>
                    <div class="item">
                        <div class="left_data">
                            Base DN:
                        </div>
                        <div>
                            <input type="text" class="input_box" required name="base_dn" size="40" maxlength="255" value="' . $ldapServer->base_dn . '">
                        </div>
                    </div>
                    <div class="item">
                        <div class="left_data">
                            Filter:
                        </div>
                        <div>
                            <input type="text" class="input_box" required name="filter" size="40" maxlength="255" value="' . $ldapServer->filter . '">
                        </div>
                    </div>
                    <div class="item">
                        <div class="left_data">
                            LDAP Attribute - Username:
                        </div>
                        <div>
                            <input type="text" class="input_box" required name="attr_username" size="20" maxlength="50" value="' . $ldapServer->attr_username . '">
                        </div>
                    </div>
                    <div class="item">
                        <div class="left_data">
                            LDAP Attribute - Firstname:
                        </div>
                        <div>
                            <input type="text" class="input_box" name="attr_firstname" size="20" maxlength="50" value="' . $ldapServer->attr_firstname . '">
                        </div>
                    </div>
                    <div class="item">
                        <div class="left_data">
                            LDAP Attribute - Lastname:
                        </div>
                        <div>
                            <input type="text" class="input_box" name="attr_lastname" size="20" maxlength="50" value="' . $ldapServer->attr_lastname . '">
                        </div>
                    </div>
                </div>
                ' . BodyHtml::formButton('save_cancel', '?core_section=settings_main') . '
            </form>'; return $content; } private static function searchFieldsSave(): void { OperatorAccess::verifyRight(OperatorAccess::RIGHT_SETTING); $sectionId = RequestData::customInt('section_id'); $data = []; if (isset($_REQUEST['enabled'])) { $array = $_REQUEST['enabled']; foreach ($array as $value) { $value = Central::escapeSymbol($value); if ('' !== $value) { $data[$value] = 1; } } } switch ($sectionId) { case 1: $arg = SettingsCatalog::FIELD_L_SEARCH; break; case 2: $arg = SettingsCatalog::FIELD_L_TOPSEARCH; break; default: throw new InvalidArgumentException( __CLASS__ . ' | ' . __FUNCTION__ . ' | SectionId #' . $sectionId . ' is unknown' ); } SettingAR::setByName($arg, json_encode($data, JSON_THROW_ON_ERROR)); Html::locationBackOk(); } private static function searchFields(): string { OperatorAccess::verifyRight(OperatorAccess::RIGHT_SETTING); $sectionId = RequestData::customInt('section_id'); $content = '
            <a href="?core_section=settings_main&item_id=' . self::ITEM_99 . '"><i class="us-icon fa-chevron-left"></i>' . Lang::getPhrase( 1443 ) . '</a><br>'; $caption = ''; switch ($sectionId) { case 1: $caption = Lang::getPhrase(3771); $fieldArray = []; if (Central::$erpProfileChapters[ErpProfileDto::CHAPTER_CUSTOMER]) { $fieldArray = [ [ 'name' => Lang::getPhrase(1072) . '. ' . Lang::getPhrase(5579), 'setting' => CustomerListHtml::SEARCH_FIELD_CUSTOMER_NAME ], [ 'name' => Lang::getPhrase(1072) . '. Id', 'setting' => CustomerListHtml::SEARCH_FIELD_CUSTOMER_ID ], [ 'name' => Lang::getPhrase(1072) . '. ' . Lang::getPhrase(821), 'setting' => CustomerListHtml::SEARCH_FIELD_CUSTOMER_LOGIN ], [ 'name' => Lang::getPhrase(1072) . '. ' . Lang::getPhrase(661), 'setting' => CustomerListHtml::SEARCH_FIELD_CUSTOMER_DESCRIPTION ], [ 'name' => Lang::getPhrase(1072) . '. ' . Lang::getPhrase(1010), 'setting' => CustomerListHtml::SEARCH_FIELD_CUSTOMER_PHONE ], [ 'name' => Lang::getPhrase(1072) . '. ' . Lang::getPhrase(1186), 'setting' => CustomerListHtml::SEARCH_FIELD_CUSTOMER_ADDRESS ], [ 'name' => Lang::getPhrase(1072) . '. ' . Lang::getPhrase(977), 'setting' => CustomerListHtml::SEARCH_FIELD_CUSTOMER_ACCOUNT ], [ 'name' => Lang::getPhrase(1072) . '. ' . Lang::getPhrase(3809), 'setting' => CustomerListHtml::SEARCH_FIELD_CUSTOMER_ADDITIONAL_FIELD ], [ 'name' => Lang::getPhrase(1072) . '. ' . Lang::getPhrase(5490), 'setting' => CustomerListHtml::SEARCH_FIELD_CUSTOMER_IP ], [ 'name' => Lang::getPhrase(1072) . '. ' . Lang::getPhrase(3776), 'setting' => CustomerListHtml::SEARCH_FIELD_CUSTOMER_AGREEMENT ] ]; } if (Central::$erpProfileChapters[ErpProfileDto::CHAPTER_DEVICE]) { $fieldArray[] = [ 'name' => Lang::getPhrase(624), 'setting' => CustomerListHtml::SEARCH_FIELD_DEVICE ]; $fieldArray[] = [ 'name' => Lang::getPhrase(3773), 'setting' => CustomerListHtml::SEARCH_FIELD_PELENG_MAC ]; } if (Central::$erpProfileChapters[ErpProfileDto::CHAPTER_TASK]) { $fieldArray[] = [ 'name' => Lang::getPhrase(1436) . '. ' . Lang::getPhrase(875), 'setting' => CustomerListHtml::SEARCH_FIELD_TASK_ID ]; $fieldArray[] = [ 'name' => Lang::getPhrase(1436) . '. ' . Lang::getPhrase(1184), 'setting' => CustomerListHtml::SEARCH_FIELD_TASK_DESCRIPTION ]; $fieldArray[] = [ 'name' => Lang::getPhrase(1436) . '. ' . Lang::getPhrase(3809), 'setting' => CustomerListHtml::SEARCH_FIELD_TASK_ADDITIONAL_FIELD ]; $fieldArray[] = [ 'name' => Lang::getPhrase(1436) . '. ' . Lang::getPhrase(1384), 'setting' => CustomerListHtml::SEARCH_FIELD_TASK_COMMENT ]; $fieldArray[] = [ 'name' => Lang::getPhrase(1436) . '. ' . Lang::getPhrase(5562), 'setting' => CustomerListHtml::SEARCH_FIELD_TASK_CLIENT ]; } if (Central::$erpProfileChapters[ErpProfileDto::CHAPTER_CUSTOMER]) { $fieldArray[] = [ 'name' => Lang::getPhrase(1072) . '. ' . Lang::getPhrase(4953), 'setting' => CustomerListHtml::SEARCH_FIELD_CUSTOMER_BILLING_ID ]; } break; case 2: $caption = Lang::getPhrase(3788); $fieldArray = []; if (Central::$erpProfileChapters[ErpProfileDto::CHAPTER_CUSTOMER]) { $fieldArray = [ [ 'name' => Lang::getPhrase(1072) . '. ' . Lang::getPhrase(5579), 'setting' => CustomerListHtml::SEARCH_FIELD_CUSTOMER_NAME ], [ 'name' => Lang::getPhrase(1072) . '. ' . Lang::getPhrase(821), 'setting' => CustomerListHtml::SEARCH_FIELD_CUSTOMER_LOGIN ], [ 'name' => Lang::getPhrase(1072) . '. ' . Lang::getPhrase(661), 'setting' => CustomerListHtml::SEARCH_FIELD_CUSTOMER_DESCRIPTION ], [ 'name' => Lang::getPhrase(1072) . '. ' . Lang::getPhrase(1010), 'setting' => CustomerListHtml::SEARCH_FIELD_CUSTOMER_PHONE ], [ 'name' => Lang::getPhrase(1072) . '. ' . Lang::getPhrase(1186), 'setting' => CustomerListHtml::SEARCH_FIELD_CUSTOMER_ADDRESS ], [ 'name' => Lang::getPhrase(1072) . '. ' . Lang::getPhrase(977), 'setting' => CustomerListHtml::SEARCH_FIELD_CUSTOMER_ACCOUNT ], [ 'name' => Lang::getPhrase(1072) . '. ' . Lang::getPhrase(3809), 'setting' => CustomerListHtml::SEARCH_FIELD_CUSTOMER_ADDITIONAL_FIELD ], [ 'name' => Lang::getPhrase(1072) . '. ' . Lang::getPhrase(5490), 'setting' => CustomerListHtml::SEARCH_FIELD_CUSTOMER_IP ], [ 'name' => Lang::getPhrase(1072) . '. ' . Lang::getPhrase(3776), 'setting' => CustomerListHtml::SEARCH_FIELD_CUSTOMER_AGREEMENT ] ]; } $fieldArray[] = [ 'name' => Lang::getPhrase(654), 'setting' => CustomerListHtml::SEARCH_FIELD_EMPLOYEE ]; if (Central::$erpProfileChapters[ErpProfileDto::CHAPTER_MAP]) { $fieldArray[] = [ 'name' => Lang::getPhrase(5482), 'setting' => CustomerListHtml::SEARCH_FIELD_BUILDING ]; } break; } $fieldArray = Central::sort( data: $fieldArray, sortElement: 'name', isSortAbc: true ); $content .= '
            <div class="label_h2">' . $caption . '</div>
            <div class="info_block">' . Lang::getPhrase( 3783 ) . '</div>'; $value = ''; switch ($sectionId) { case 1: $value = SettingAR::getByNameString(SettingsCatalog::FIELD_L_SEARCH); break; case 2: $value = SettingAR::getByNameString(SettingsCatalog::FIELD_L_TOPSEARCH); break; } if ('' === $value) { $valueCurrent = []; } else { $valueCurrent = @json_decode($value, true, 512, JSON_THROW_ON_ERROR); } if (is_array($valueCurrent)) { foreach ($valueCurrent as $i => $value) { foreach ($fieldArray as $j => $value2) { if ($i == $value2['setting']) { $fieldArray[$j]['is_enable'] = 1; } } } } $content .= '
                    <form method="post" name="form1" action="">
                        <input type="hidden" name="core_section" value="settings_main">
                        <input type="hidden" name="action" value="search_fields_save">
                        <input type="hidden" name="section_id" value="' . $sectionId . '">
                        <div class="table_block">'; foreach ($fieldArray as $value) { $content .= '
                            <div class="item">
                                <div class="left_data">
                                    ' . $value['name'] . ':
                                </div>
                                <div>
                                    <input id="fieldSearch' . $value['setting'] . 'Id" type="checkbox" name="enabled[]" value="' . $value['setting'] . '"'; if (isset($value['is_enable'])) { $content .= ' checked'; } $content .= '>
                                </div>
                            </div>'; } $content .= '
                            </div>
                        </div>
                        ' . BodyHtml::formButton('save_cancel', '?core_section=settings_main') . '
                    </form>'; return $content; } private static function tableClear(): string { OperatorAccess::verifyRight(OperatorAccess::RIGHT_SETTING); $content = '
            <a href="?core_section=settings_main&item_id=' . self::ITEM_99 . '"><i class="us-icon fa-chevron-left"></i>' . Lang::getPhrase( 1443 ) . '</a><br>
            <div class="label_h2">' . Lang::getPhrase(5400) . '</div>
            <spam class="info_block">' . Lang::getPhrase(5402) . '</spam>
            <div class="table_block" style="width: 100%;">'; $countAll = Yii::$container->get(EmployeeActionLogFetcher::class)->getCountByCondition( [ EmployeeActionLogDto::F_OBJECT_TYPE_ID => null ] ); $count30 = Yii::$container->get(EmployeeActionLogFetcher::class)->getCountByCondition( [ 'AND', [EmployeeActionLogDto::F_OBJECT_TYPE_ID => 0], ['<', EmployeeActionLogDto::F_DATE_OPERATION, time() - 86400 * 30] ] ); $content .= SettingsHtml::propertyDialog( SettingsCatalog::EMPLOYEE_HISTORY_CLEAR, 'VALUESTR', Lang::getPhrase(5403) , '>30: ' . $count30 . '<br>all: ' . $countAll ); if ( Central::$erpProfileChapters[ErpProfileDto::CHAPTER_CUSTOMER] && 1 == SettingAR::getByNameInt(SettingsCatalog::IS_US_STAT) ) { $countAll = CustomerActivityLogAR::find()->count(); $count30 = CustomerActivityLogAR::find()->where( ['<', CustomerActivityLogAR::F_DATE_ACTIVITY, strtotime(date('Y-m-d 00:00:00', (time() - 86400 * 30)))] )->count(); $content .= SettingsHtml::propertyDialog( SettingsCatalog::US_STATCLEAR, 'VALUESTR', Lang::getPhrase(5404) . ' usm_stat', '>30: ' . $count30 . '<br>all: ' . $countAll ); } if (1 == SettingAR::getByNameInt(SettingsCatalog::US_GPS)) { $countAll = GpsRouteAR::find()->count(); $count30 = GpsRouteAR::find() ->where( [ '<', GpsRouteAR::F_DATE_ADD, strtotime(date('Y-m-d 00:00:00', (time() - 86400 * 30))) ] ) ->count(); $content .= SettingsHtml::propertyDialog( SettingsCatalog::GPS_ROW_CLEAR, 'VALUESTR', Lang::getPhrase(5404) . ' usm_gps', '>30: ' . $count30 . '<br>all: ' . $countAll ); } if ( Central::$erpProfileChapters[ErpProfileDto::CHAPTER_DEVICE] && 1 == SettingAR::getByNameInt(SettingsCatalog::US_PELENG) ) { $countAll = DevicePelengLogAR::find()->count(); $count30 = DevicePelengLogAR::find() ->where( ['<', DevicePelengLogAR::F_DATE_ADD, strtotime(date('Y-m-d 00:00:00', (time() - 86400 * 30)))] ) ->count(); $content .= SettingsHtml::propertyDialog( SettingsCatalog::PELENG_ROW_CLEAR, 'VALUESTR', Lang::getPhrase(5404) . ' usm_peleng', '>30: ' . $count30 . '<br>all: ' . $countAll ); } if ( Central::$erpProfileChapters[ErpProfileDto::CHAPTER_DEVICE] && 1 == SettingAR::getByNameInt(SettingsCatalog::MODULE_USM_OBSERVER_IS_ACTIVE) ) { $countAll = DeviceObserverLogAR::find()->count(); $count30 = DeviceObserverLogAR::find() ->where( DeviceObserverLogAR::F_DATE_CHANGE . " < " . (time() - 86400 * 30) ) ->count(); $content .= SettingsHtml::propertyDialog( SettingsCatalog::CONTROL_ROW_CLEAR, 'VALUESTR', Lang::getPhrase(5404) . ' usm_observer', '>30: ' . $count30 . '<br>all: ' . $countAll ); } if (Central::$erpProfileChapters[ErpProfileDto::CHAPTER_DEVICE]) { $countAll2 = DevicePonLevelLogAR::find()->count(); $count30 = DevicePonLevelLogAR::find() ->where( DevicePonLevelLogAR::F_DATE_TO . " < " . strtotime(date('Y-m-d 00:00:00', (time() - 86400 * 30))) ) ->count(); $content .= SettingsHtml::propertyDialog( SettingsCatalog::PON_ROW_CLEAR, 'VALUESTR', Lang::getPhrase(5401) , '>30: ' . $count30 . '<br>all: ' . $countAll2 ); } if (Central::$erpProfileChapters[ErpProfileDto::CHAPTER_CUSTOMER]) { $countAll = Yii::$container ->get(MacsUnknownFetcher::class) ->getCountByCondition([]); $count30 = Yii::$container ->get(MacsUnknownFetcher::class) ->getCountByCondition( ['<', MacsUnknownDto::F_DATE_LAST, strtotime(date('Y-m-d 00:00:00', (time() - 86400 * 30)))] ); $content .= SettingsHtml::propertyDialog( SettingsCatalog::UNK_MAC_ROW_CLEAR, 'VALUESTR', Lang::getPhrase(591) , '>30: ' . $count30 . '<br>all: ' . $countAll ); } $content .= '
                </div>'; return $content; } private static function attach(): string { OperatorAccess::verifyRight(OperatorAccess::RIGHT_SETTING); $content = '
            <a href="?core_section=settings_main&item_id=' . self::ITEM_99 . '"><i class="us-icon fa-chevron-left"></i>' . Lang::getPhrase( 1443 ) . '</a><br>
            <div class="label_h2">' . Lang::getPhrase(1217) . '</div>'; $content .= FilterHtml::insertForm( filterArray: [ FilterHtml::F_PERIOD, FilterHtml::F_FILE_NAME, FilterHtml::F_COMMENT, FilterHtml::F_ATTACH_CATEGORY ], urlCancel: '?core_section=settings_main&action=attach' ); $date1 = 0; $date2 = time(); $usedFlter = FilterHtml::getUseFilter(); foreach ($usedFlter as $value) { switch ($value['filter']) { case FilterHtml::F_PERIOD: $date1 = strtotime($value['date1'] . ' 00:00:00'); $date2 = strtotime($value['date2'] . ' 23:59:59'); break; } } $offset = Html::$offset; $limit = Html::$perPage; $conditions = [ 'AND', ['BETWEEN', 'aa.uploaded_at', $date1, $date2] ]; foreach ($usedFlter as $value) { switch ($value['filter']) { case FilterHtml::F_FILE_NAME: $conditions[] = ['LIKE', 'LOWER(aa.filename_original)', strtolower($value['value'])]; break; case FilterHtml::F_COMMENT: $conditions[] = ['LIKE', 'LOWER(aa.comment)', strtolower($value['value'])]; break; case FilterHtml::F_ATTACH_CATEGORY: $conditions[] = ['=', AttachmentAR::F_OBJECT_TYPE, $value['value']]; break; } } $isDesc = RequestData::getDesc(); if ($isDesc == 1) { $isDesc = SORT_DESC; } else { $isDesc = SORT_ASC; } switch (strtolower(RequestData::getOrderBy())) { case 'name': $orderBy = [ 'aa.filename_original' => $isDesc ]; break; case 'size': $orderBy = [ 'aa.size' => $isDesc ]; break; case 'date_add': $orderBy = [ 'aa.uploaded_at' => $isDesc ]; break; default: $orderBy = [ 'aa.uploaded_at' => SORT_DESC ]; break; } $preLoadCountData = AttachmentAR::find() ->join( 'INNER JOIN', 'attachments AS aa', 'aa.id = ' . AttachmentAR::tableName() . '.' . AttachmentAR::F_EXT_UUID ) ->where( ['>', AttachmentAR::F_OBJECT_ID, 0] ) ->andWhere($conditions) ->count(); $allSize = AttachmentAR::find() ->join( 'INNER JOIN', 'attachments AS aa', 'aa.id = ' . AttachmentAR::tableName() . '.' . AttachmentAR::F_EXT_UUID ) ->select( [ 'amount' => 'SUM(aa.size)' ] ) ->where($conditions) ->asArray() ->all(); $allSize = $allSize[0]['amount']; $categoryCatalog = AttachmentAR::categoryCatalog(); $data = []; $attaches = AttachmentAR::find() ->join( 'INNER JOIN', 'attachments AS aa', 'aa.id = ' . AttachmentAR::tableName() . '.' . AttachmentAR::F_EXT_UUID ) ->where(['>', AttachmentAR::F_OBJECT_ID, 0]) ->andWhere($conditions) ->offset($offset) ->limit($limit) ->orderBy($orderBy); if (Html::$isDebug === true) { echo "attachesCommand:\n"; echo $attaches->createCommand()->rawSql . "\n\n"; } $attaches = $attaches->all(); foreach ($attaches as $i => $attach) { $data[$i]['name'] = '#' . $attach->getId() . ' <span class="red_text">(' . Lang::getPhrase( 3290 ) . ')</span>'; $attachment = Attachment::findOne($attach->ext_uuid); if ($attachment) { $fn = $attachment->filename_storage; $folder = __DIR__ . '/../../../../var/attachments' . $attachment->filepath; $fileForExist = $folder . $fn; if (file_exists($fileForExist)) { $data[$i]['name'] = $attachment->filename_original; $data[$i]['size'] = ceil(filesize($fileForExist) / 1024); $data[$i]['date_add'] = date('Y-m-d H:i:s', $attachment->uploaded_at); } else { $data[$i]['name'] = $attachment->filename_original . ' <span class="red_text">(' . Lang::getPhrase( 3290 ) . ')</span>'; } } $data[$i]['full_name'] = $attach->getObjectId(); if (isset($categoryCatalog[strtolower($attach->getObjectType())])) { $data[$i]['category_name'] = $categoryCatalog[strtolower($attach->getObjectType())]['name']; $link = ''; if ('' != $link) { $data[$i]['full_name'] = '<a href="' . $link . '" target=_blank>' . $attach->getObjectId() . '</a>'; } } } $content .= '
                <br>
                upload_max_filesize: <b>' . ini_get('upload_max_filesize') . '</b><br>
                post_max_size: <b>' . ini_get('post_max_size') . '</b><br>
                <br>
                ' . Lang::getPhrase(5377) . ': <b>' . $preLoadCountData . '</b><br>
                ' . Lang::getPhrase(5378) . ': <b>' . (int)($allSize / 1024 / 1024) . ' MB</b><br>'; $field = [ [ 'SPECIAL' => '_number' ], [ 'NAME' => Lang::getPhrase(1635), 'EL' => 'category_name' ], [ 'NAME' => Lang::getPhrase(4233), 'EL' => 'full_name' ], [ 'NAME' => Lang::getPhrase(2910), 'ISSORT' => 1, 'EL' => 'name' ], [ 'NAME' => Lang::getPhrase(5376) . ' (KB)', 'ALIGN' => 'right', 'ISSORT' => 1, 'EL' => 'size' ], [ 'NAME' => Lang::getPhrase(1033) , 'CONVERT' => 'cdaten', 'ISSORT' => 1, 'EL' => 'date_add' ] ]; $table = new Table(); $table->sortDefault = 'date_add'; $table->isSortDesc = 1; $table->preLoadCountData = $preLoadCountData; $table->doNotSort = 1; $content .= $table->show($data, $field); return $content; } private static function arpMac(): string { OperatorAccess::verifyRight(OperatorAccess::RIGHT_SETTING); $ip = RequestData::custom('userip'); return '
            <a href="?core_section=settings_main&item_id=' . self::ITEM_99 . '"><i class="us-icon fa-chevron-left"></i>' . Lang::getPhrase( 1443 ) . '</a><br>
            <div class="label_h2" id="divArpId">' . Lang::getPhrase(4793) . '</div>
            <iframe scrolling="no" style="border: none; overflow: auto;" src="?core_section=ping&action=ping_mac&ip=' . $ip . '&show_arg=1&fixed=1" height=1000 width=1000></iframe>'; } private static function satelliteTest(): string { OperatorAccess::verifyRight(OperatorAccess::RIGHT_SETTING); Html::$isEmptyTemplate = true; $id = RequestData::$id; $content = '
            <div class="dialog_header"><span id="spanSatelliteTestId">' . Lang::getPhrase(5949) . '</span></div>
            <br>'; try { $rabbitCollector = \Yii::$container->get(RabbitMqCollector::class); $queuesArray = []; foreach ($rabbitCollector->queues() as $queue) { if ($queue->name === 'usm_poller-sat-' . $id) { $queuesArray[] = [$queue->name, $queue->consumers, $queue->messages]; } } if (count($queuesArray) < 1) { $content .= '
                <div class="label_stop"><a href="javascript:showFullError()"><i class="us-icon us-icon-danger fa-exclamation-circle"></i></a>' . Lang::getPhrase( 3411 ) . ' &nbsp; &nbsp; &nbsp; </div>'; } else { $queuesArray = Central::sort( data: $queuesArray, sortElement: 0, isSortAbc: true ); foreach ($queuesArray as $value) { $content .= '
                        <div class="div_space2">
                            ' . $value[0] . ' | consumers: ' . $value[1] . ' |messages: ' . $value[2] . '
                        </div>'; } } } catch (Exception $e) { $content .= '
                    <div class="div_space2">
                        ' . $e->getMessage() . '
                    </div>'; } $content .= '
            <br>
            <a id="linkCancelId" href="javascript:hide_dialog()" class="link_dashed"><span>' . Lang::getPhrase( 386 ) . '</span></a>'; return $content; } private static function arp(): string { Html::$isEmptyTemplate = true; OperatorAccess::verifyRight(OperatorAccess::RIGHT_SETTING); return '
            <div class="dialog_header"><span id="spanArpId">' . Lang::getPhrase(4793) . '</span></div>
            <br>
            <form method="post" name="form1" action="">
                <input type="hidden" name="core_section" value="settings_main">
                <input type="hidden" name="action" value="arp_mac">
                <div class="table_block">
                    <div class="item">
                        <div class="left_data">
                            IP:
                        </div>
                        <div>
                            <input type="text" class="input_box" required name="userip" size="15" maxlength="15" value="">
                        </div>
                    </div>
                </div>
                ' . BodyHtml::formButton('save_cancel', BodyHtml::FORM_DIALOG_CLOSE, 'ARP') . '
            </form>'; } private static function pingIp(): string { OperatorAccess::verifyRight(OperatorAccess::RIGHT_SETTING); $ip = RequestData::custom('ip'); $content = '
            <a href="?core_section=settings_main&item_id=' . self::ITEM_99 . '"><i class="us-icon fa-chevron-left"></i>' . Lang::getPhrase( 1443 ) . '</a><br>
            <div class="label_h2" id="divPingId">' . Lang::getPhrase(3308) . ' ' . $ip . '</div>

            <span id="pollerResultPingData"></span>
            <script>
                function processingReloadPingData(taskId) {
                    $.post("", {
                        ' . BodyHtml::CORES_SECTION . ': "' . BodyHtml::SECTION_PING . '",
                        action: "reload_ping_data",
                        ip: "' . $ip . '",
                        task_id: taskId
                    }).done(function (content) {
                        content = JSON.parse(content);
                        $("#pollerResultPingData").html(content["content"]);
                    });
                }
                function processingPollerTableResult(data) {
                    if (data["device_ip"] == "' . $ip . '") {
                        if (data["status"] == "error") {
                            console.log(data);
                            $("#pollerResultPingData").html("<div class=\"label_stop\"><i class=\"us-icon us-icon-red fa-ban\"></i>Error: " + data["error_message"] + "</div>");
                        }
                        if (data["status"] == "ok") {
                            processingReloadPingData(data["task_id"]);
                        }
                    }
                }
                $(document).ready(function () {
                    processingReloadPingData();
                })
            </script>
            '; return $content; } private static function ping(): string { Html::$isEmptyTemplate = true; OperatorAccess::verifyRight(OperatorAccess::RIGHT_SETTING); return '
            <div class="dialog_header""><span id="spanPingId">' . Lang::getPhrase(3308) . '</span></div>
            <br>
            <form method="get" name="form1" action="">
                <input type="hidden" name="core_section" value="settings_main">
                <input type="hidden" name="action" value="ping_ip">
                <div class="table_block">
                    <div class="item">
                        <div class="left_data">
                            IP:
                        </div>
                        <div>
                            <input type="text" class="input_box" required name="ip" size="15" maxlength="15" value="">
                        </div>
                    </div>
                </div>
                ' . BodyHtml::formButton('save_cancel', BodyHtml::FORM_DIALOG_CLOSE, 'PING') . '
            </form>'; } private static function customerGroupDelete(): void { OperatorAccess::verifyRight(OperatorAccess::RIGHT_SETTING); $id = RequestData::$id; CustomerGroupAR::findOne($id)->remove(); Html::location('?core_section=settings_main&action=customer_group', 'updok'); } private static function customerGroupSave(): void { OperatorAccess::verifyRight(OperatorAccess::RIGHT_SETTING); $id = RequestData::$id; if ($id < 1) { $id = CustomerGroupAR::create(RequestData::custom('name'))->getId(); } else { $customerGroupConfig = CustomerGroupAR::findOne($id); $customerGroupConfig->edit( [ CustomerGroupAR::F_NAME => RequestData::custom('name') ] ); } EmployeeActionLogSystem::writeLogWithZeroTypeId(EmployeeHistoryType::T394, 0, $id); Html::location('?core_section=settings_main&action=customer_group_dialog_edit&id=' . $id, 'updok'); } private static function customerGroupDialogAddEdit(): string { OperatorAccess::verifyRight(OperatorAccess::RIGHT_SETTING); $id = RequestData::$id; if ($id < 1) { $customerGroupConfig = new CustomerGroupAR(); $ret = BodyHtml::FORM_DIALOG_CLOSE; $content = '
                <div class="dialog_header"><span id="spanAddGroupId">' . Lang::getPhrase(1971) . '</span></div>
                <br>'; } else { $customerGroupConfig = CustomerGroupAR::findOne($id); $ret = '?core_section=settings_main&action=customer_group'; $content = '
                <a href="' . $ret . '"><i class="us-icon fa-chevron-left"></i>' . Lang::getPhrase( 1443 ) . '</a><br>
                <br>
                <span class="label_h2">' . Lang::getPhrase(3955) . '</span><br>'; } $content .= '
            <form method="post" name="form1" action="">
                <input type="hidden" name="core_section" value="settings_main">
                <input type="hidden" name="action" value="customer_group_save">
                <input type="hidden" name="id" value="' . $id . '">
                <div class="table_block">
                    <div class="item">
                        <div class="left_data">
                            ' . Lang::getPhrase(1451) . ':
                        </div>
                        <div>
                            <input type="text" class="input_box" required name="name" size="40" maxlength="255" value=\'' . ($id > 0 ? $customerGroupConfig->getName( ) : '') . '\'>
                        </div>
                    </div>
                </div>
                ' . BodyHtml::formButton('save_cancel', $ret) . '
            </form>'; if ($id < 1) { Html::$isEmptyTemplate = true; return $content; } else { $content .= ' ' . BodyHtml::linkConfirm( '?core_section=settings_main&action=customer_group_delete&id=' . $id, Lang::getPhrase(1415), Lang::getPhrase(1150) . '?', '<i class="us-icon us-icon-danger fa-close"></i>' . Lang::getPhrase(1415) , 'linkConfirmDeleteGroupId' ); } return $content; } private static function customerGroup(): string { OperatorAccess::verifyRight(OperatorAccess::RIGHT_SETTING); $content = '
            <a href="?core_section=settings_main&item_id=' . self::ITEM_10 . '"><i class="us-icon fa-chevron-left"></i>' . Lang::getPhrase( 1443 ) . '</a><br>
            <br>
            <span class="label_h2">' . Lang::getPhrase(3955) . '</span><br>
            <br>
            <div class="div_space">
                <a id="linkAddId" href="javascript:ajaxWindow(\'?core_section=settings_main&action=customer_group_dialog_add\')" class="link_dashed"><i class="us-icon fa-plus"></i><span>' . Lang::getPhrase( 841 ) . '</span></a>
            </div>'; $data = []; $customerGroupConfigs = CustomerGroupAR::find()->all(); foreach ($customerGroupConfigs as $customerGroupConfig) { $data[] = [ 'id' => $customerGroupConfig->getId(), 'name' => $customerGroupConfig->getName() ]; } $field = [ [ 'SPECIAL' => '_number' ], [ 'NAME' => Lang::getPhrase(1451), 'ISSORT' => 1, 'ISSORTABC' => 1, 'EL' => 'name' ] ]; $table = new Table(); $table->link = '?core_section=settings_main&action=customer_group_dialog_edit&id='; $table->sortDefault = 'name'; $table->isSortDefaultAbc = 1; $content .= $table->show($data, $field); return $content; } private static function inventorySubaccountDelete(): void { OperatorAccess::verifyRight(OperatorAccess::RIGHT_SETTING); $id = RequestData::$id; InventorySubaccountAR::findOne($id)->tryDelete(); Html::location('?core_section=settings_main&action=inventory_sub_account', 'updok'); } private static function satelliteDelete(): void { OperatorAccess::verifyRight(OperatorAccess::RIGHT_SETTING); $id = RequestData::$id; SatelliteAR::findOne($id)->remove(); Html::location('?core_section=settings_main&action=satellite', 'updok'); } private static function satelliteSave(): void { OperatorAccess::verifyRight(OperatorAccess::RIGHT_SETTING); $id = RequestData::$id; $name = RequestData::custom('name'); if ($id < 1) { $satellite = SatelliteAR::create($name); $id = $satellite->getId(); } else { $satellite = SatelliteAR::findOne($id); if (!$satellite) { Html::locationForbidden(); } $satellite->edit( [ SatelliteAR::F_NAME => $name ] ); EmployeeActionLogSystem::writeLog(EmployeeHistoryType::T462, SatelliteAR::OBJECT_TYPE_ID, $id); } SatellitesAddressesSystem::removeByExpr($id); for ($i = 1; $i <= 10; ++$i) { $addressUnitId = RequestData::customInt('address_unit_id' . $i); if ($addressUnitId > 0) { SatellitesAddressesSystem::create( satelliteId: $id, addressUnitId: $addressUnitId ); } } Html::location('?core_section=settings_main&action=satellite_dialog_edit&id=' . $id, 'updok'); } private static function inventorySubaccountSave(): void { OperatorAccess::verifyRight(OperatorAccess::RIGHT_SETTING); $id = RequestData::$id; $name = RequestData::custom('name'); if ($id < 1) { $id = InventorySubaccountAR::create($name)->getId(); $isEdit = false; } else { $isEdit = true; $inventorySubaccount = InventorySubaccountAR::findOne($id); if (!$inventorySubaccount) { Html::locationBackCancel(); } $inventorySubaccount->edit( [ InventorySubaccountAR::F_NAME => $name ] ); } if ($isEdit === true) { EmployeeActionLogSystem::writeLog(EmployeeHistoryType::T597, SatelliteAR::OBJECT_TYPE_ID, $id); } Html::location('?core_section=settings_main&action=inventory_subaccount_dialog_edit&id=' . $id, 'updok'); } private static function satelliteDialogAddEdit(): string { OperatorAccess::verifyRight(OperatorAccess::RIGHT_SETTING); $id = RequestData::$id; if ($id < 1) { $content = '
                <div class="dialog_header"><span>' . Lang::getPhrase(1971) . '</span></div>
                <br>'; $ret = BodyHtml::FORM_DIALOG_CLOSE; $satellite = new SatelliteAR(); } else { $satellite = SatelliteAR::findOne($id); if (!$satellite) { Html::locationForbidden(); } $ret = '?core_section=settings_main&action=satellite'; $content = '
                <a href="' . $ret . '"><i class="us-icon fa-chevron-left"></i>' . Lang::getPhrase( 1443 ) . '</a><br>
                <br>
                <span class="label_h2">' . Lang::getPhrase(4959) . '</span><br>'; } if ($id > 0) { $content .= '
                <br>
                <a class="link_dashed" href="javascript:ajaxWindow(\'?core_section=settings_main&action=satellite_test&id=' . $id . '\')"><i class="us-icon fa-cogs"></i><span>' . Lang::getPhrase( 5949 ) . '</span></a><br>'; } $addressArray = AddressUnit::getByToken(AddressLocalityType::TOKEN_CITY); $addressArray = Central::sort( data: $addressArray, sortElement: 'name', isSortAbc: true ); $currentAddressesArray = []; $satellitesAddressesDtos = Yii::$container ->get(SatellitesAddressesFetcher::class) ->getByCondition( [ SatellitesAddressesDto::F_SATELLITE_ID => $id ] ); foreach ($satellitesAddressesDtos as $satelliteAddressDto) { $currentAddressesArray[] = $satelliteAddressDto->address_unit_id; } $content .= '
                <form method="post" name="form1" action="">
                    <input type="hidden" name="core_section" value="settings_main">
                    <input type="hidden" name="action" value="satellite_save">
                    <input type="hidden" name="id" value="' . $id . '">
                    <div class="table_block">
                        <div class="item">
                            <div class="left_data">
                                ' . Lang::getPhrase(1451) . ':
                            </div>
                            <div>
                                <input type="text" class="input_box" autocomplete="off" name="name" size="80" maxlength="255" value=\'' . ($id > 0 ? $satellite->getName( ) : '') . '\'>
                            </div>
                        </div>'; for ($i = 1; $i <= 10; ++$i) { $content .= '
                        <div class="item">
                            <div class="left_data">
                                ' . Lang::getPhrase(1186) . ' #' . $i . ':<br>'; if ($i > 1) { $content .= '<span class="info_block">' . Lang::getPhrase(1214) . '</span>'; } $content .= '
                            </div>
                            <div>
                                <select id="addressUnitId' . $i . 'Id" name="address_unit_id' . $i . '" size="1">'; if ($i > 1) { $content .= '
                                <option value="0"></option>'; } foreach ($addressArray as $value) { $content .= '
                                <option value="' . $value['id'] . '"'; if ( $id > 0 && isset($currentAddressesArray[$i - 1]) && $value['id'] == $currentAddressesArray[$i - 1] ) { $content .= ' selected'; } $content .= '>' . $value['name'] . '</option>'; } $content .= '
                                </select>
                            </div>
                        </div>'; } $content .= '
                    </div>
                    ' . BodyHtml::formButton('save_cancel', $ret) . '
                </form>'; if ($id < 1) { Html::$isEmptyTemplate = true; return $content; } else { $content .= ' ' . BodyHtml::linkConfirm( '?core_section=settings_main&action=satellite_delete&id=' . $id, Lang::getPhrase(1415), Lang::getPhrase(1150) . '?', '<i class="us-icon us-icon-danger fa-close"></i>' . Lang::getPhrase(1415) , 'linkConfirmDeleteSatelliteId' ); } return $content; } private static function inventorySubaccountDialogAddEdit(): string { OperatorAccess::verifyRight(OperatorAccess::RIGHT_SETTING); $id = RequestData::$id; if ($id < 1) { $content = '
                <div class="dialog_header"><span id="spanInventorySubAccountDialogAddId">' . Lang::getPhrase( 1971 ) . '</span></div>
                <br>'; $ret = BodyHtml::FORM_DIALOG_CLOSE; $inventorySubaccount = new InventorySubaccountAR(); } else { $inventorySubaccount = InventorySubaccountAR::findOne($id); if (!$inventorySubaccount) { Html::locationForbidden(); } $ret = '?core_section=settings_main&action=inventory_sub_account'; $content = '
                <a href="' . $ret . '"><i class="us-icon fa-chevron-left"></i>' . Lang::getPhrase( 1443 ) . '</a><br>
                <br>
                <span class="label_h2">' . Lang::getPhrase(6000) . '</span><br>'; } $content .= '
                <form method="post" name="form1" action="">
                    <input type="hidden" name="core_section" value="settings_main">
                    <input type="hidden" name="action" value="inventory_subaccount_save">
                    <input type="hidden" name="id" value="' . $id . '">
                    <div class="table_block">
                        <div class="item">
                            <div class="left_data">
                                ' . Lang::getPhrase(1451) . ':
                            </div>
                            <div>
                                <input type="text" class="input_box" autocomplete="off" required name="name" size="80" maxlength="255" value=\'' . $inventorySubaccount->getName( ) . '\'>
                            </div>
                        </div>
                    </div>
                    ' . BodyHtml::formButton('save_cancel', $ret) . '
                </form>'; if ($id < 1) { Html::$isEmptyTemplate = true; return $content; } else { $content .= BodyHtml::linkDeleteObject( $id, '?core_section=settings_main&action=inventory_subaccount_delete&id=' . $id, '', '', '', InventorySubaccountAR::OBJECT_TYPE_ID, count(InventorySubaccountAR::findOne($id)->checkDelete()) ); } return $content; } private static function satellite(): string { OperatorAccess::verifyRight(OperatorAccess::RIGHT_SETTING); $content = '
            <a href="?core_section=settings_main&item_id=' . self::ITEM_7 . '"><i class="us-icon fa-chevron-left"></i>' . Lang::getPhrase( 1443 ) . '</a><br>
            <br>
            <span class="label_h2">' . Lang::getPhrase(4959) . '</span><br>
            
            <br>
            <div class="div_space">
                <a href="https://wiki.userside.eu/satellite_wiki_link"><i class="us-icon fa-info-circle"></i><i>Wiki</i></a><br>
            </div>

            <div class="div_space" style="margin-top: 10px;">
                <a id="linkAddId" class="link_dashed" href="javascript:ajaxWindow(\'?core_section=settings_main&action=satellite_dialog_add\');"><i class="us-icon fa-plus"></i><span>' . Lang::getPhrase( 841 ) . '</span></a>
            </div>'; $data = []; $satellites = SatelliteAR::find()->all(); foreach ($satellites as $satellite) { $addressListName = ''; $satellitesAddressesDtos = Yii::$container ->get(SatellitesAddressesFetcher::class) ->getByCondition( [ SatellitesAddressesDto::F_SATELLITE_ID => $satellite->getId() ], [ SatellitesAddressesDto::F_ADDRESS_UNIT_ID => SORT_ASC ] ); foreach ($satellitesAddressesDtos as $satelliteAddressDto) { $addressListName .= AddressUnit::getNameById($satelliteAddressDto->address_unit_id) . "<br>"; } $data[] = [ 'id' => $satellite->getId(), 'id_full' => '<a href="?core_section=settings_main&action=satellite_dialog_edit&id=' . $satellite->getId( ) . '">' . $satellite->getId() . '</a>', 'name' => $satellite->getName(), 'address_name' => $addressListName ]; } $field = [ [ 'NAME' => 'ID', 'EL' => 'id_full', 'ISBREAK' => 1 ], [ 'NAME' => Lang::getPhrase(1186), 'EL' => 'address_name', 'ISSORT' => 1, 'ISSORTABC' => 1 ], [ 'NAME' => Lang::getPhrase(1451), 'EL' => 'name', 'ISSORT' => 1, 'ISSORTABC' => 1 ] ]; $table = new Table(); $table->link = '?core_section=settings_main&action=satellite_dialog_edit&id='; $table->sortDefault = 'address_name'; $table->isSortDefaultAbc = 1; $content .= $table->show($data, $field); return $content; } private static function inventorySubaccount(): string { OperatorAccess::verifyRight(OperatorAccess::RIGHT_SETTING); $content = '
            <a href="?core_section=settings_main&item_id=' . self::ITEM_24 . '"><i class="us-icon fa-chevron-left"></i>' . Lang::getPhrase( 1443 ) . '</a><br>
            <br>
            <span class="label_h2">' . Lang::getPhrase(6000) . '</span><br>
            <div class="div_space" style="margin-top: 10px;">
                <a id="linkAddId" class="link_dashed" href="javascript:ajaxWindow(\'?core_section=settings_main&action=inventory_subaccount_dialog_add\')"><i class="us-icon fa-plus"></i><span>' . Lang::getPhrase( 841 ) . '</span></a>
            </div>'; $data = []; $inventorySubAccounts = InventorySubaccountAR::find()->all(); foreach ($inventorySubAccounts as $inventorySubAccount) { $data[] = [ 'id' => $inventorySubAccount->getId(), 'id_full' => '<a href="?core_section=settings_main&action=inventory_subaccount_dialog_edit&id=' . $inventorySubAccount->getId( ) . '">' . $inventorySubAccount->getId() . '</a>', 'name' => $inventorySubAccount->getName(), 'is_special' => $inventorySubAccount->getIsSpecial() ]; } $field = [ [ 'NAME' => 'ID', 'EL' => 'id_full', 'ISBREAK' => 1 ], [ 'NAME' => Lang::getPhrase(1451), 'EL' => 'name' ], [ 'NAME' => Lang::getPhrase(5999), 'EL' => 'is_special', 'CONVERT' => 'boolean3' ] ]; $table = new Table(); $table->link = '?core_section=settings_main&action=inventory_subaccount_dialog_edit&id='; $table->sortDefault = 'id'; $content .= $table->show($data, $field); return $content; } private static function import(): string { OperatorAccess::verifyRight(OperatorAccess::RIGHT_SETTING); $content = ''; $objectType = RequestData::custom('object_type'); $step = RequestData::customInt('step'); $codepage = RequestData::custom('codepage'); $caption = ''; $arrayResult = []; $fieldArray = []; $fn = ''; $arg1 = ''; $arg2 = ''; $temp1 = ''; $temp2 = ''; switch ($objectType) { case 'customer': $caption = CustomerAR::classCaption(); $fieldArray = [ 1 => Lang::getPhrase(3841) , 2 => Lang::getPhrase(821) . '/' . Lang::getPhrase( 552 ) . '<b>*</b>', 3 => Lang::getPhrase(4711) . ' <b>*</b>', 4 => Lang::getPhrase(810) . ' <b>*</b>', 5 => Lang::getPhrase(2676) . ' <b>*</b>', 6 => Lang::getPhrase(2679) . ' <b>*</b>', 7 => Lang::getPhrase(1230) . ' <b>*</b>', 8 => Lang::getPhrase(1285) . ' <b>*</b>', 9 => Lang::getPhrase(5439) . ' <b>*</b>', 10 => Lang::getPhrase(3263) . ' <b>*</b>', 11 => Lang::getPhrase(2073) . ' <b>*</b>', 12 => Lang::getPhrase(3262) . ' <b>*</b>', 13 => Lang::getPhrase(1012) . ' <b>*</b>', 14 => Lang::getPhrase(809) . ' <b>*</b>', 15 => Lang::getPhrase(1010) . ' <b>*</b>', 16 => Lang::getPhrase(1010) . ' (2) <b>*</b>', 17 => 'E-mail <b>*</b>', 18 => 'IP <b>*</b>', 19 => 'MAC <b>*</b>', 20 => Lang::getPhrase(661) . ' <b>*</b>' ]; break; case 'address': $caption = Lang::getPhrase(3877); $fieldArray = [ 1 => Lang::getPhrase(1230), 2 => Lang::getPhrase(1285), 3 => Lang::getPhrase(5439), 4 => Lang::getPhrase(2179) . ' <b>*</b>', 5 => Lang::getPhrase(2181) . ' <b>*</b>', 6 => Lang::getPhrase(2180) . ' <b>*</b>', 7 => Lang::getPhrase(4614) . ' <b>*</b>', 8 => Lang::getPhrase(5808) . ' <b>*</b>', 9 => Lang::getPhrase(5609) . '-1 (ID) <b>*</b>', 10 => Lang::getPhrase(5609) . '-1 (' . Lang::getPhrase( 6197 ) . ') <b>*</b>', 11 => Lang::getPhrase(5609) . '-2 (ID) <b>*</b>', 12 => Lang::getPhrase(5609) . '-2 (' . Lang::getPhrase( 6197 ) . ') <b>*</b>', ]; break; case 'node': $caption = NodeAR::classCaption(); $fieldArray = [ 1 => Lang::getPhrase(1230) . ' <b>*</b>', 2 => Lang::getPhrase(1285) . ' <b>*</b>', 3 => Lang::getPhrase(5439) . ' <b>*</b>', 4 => Lang::getPhrase(2073) . ' <b>*</b>', 5 => Lang::getPhrase(3262) . ' <b>*</b>', 6 => Lang::getPhrase(2069) . ' <b>*</b>', 7 => Lang::getPhrase(4749) . ' <b>*</b>', 8 => Lang::getPhrase(3661) . ' <b>*</b>', 9 => Lang::getPhrase(1184) . ' <b>*</b>', 10 => Lang::getPhrase(5207) . ' <b>*</b>', 11 => Lang::getPhrase(5208) . ' <b>*</b>', 12 => Lang::getPhrase(5216) . ' <b>*</b>', 13 => Lang::getPhrase(4041) . ' <b>*</b>' ]; break; case 'device': $caption = Lang::getPhrase(627); $fieldArray = [ 1 => NodeAR::classCaptionSingle() . '. ' . Lang::getPhrase(1230), 2 => NodeAR::classCaptionSingle() . '. ' . Lang::getPhrase(1285), 3 => NodeAR::classCaptionSingle() . '. ' . Lang::getPhrase(5439), 4 => NodeAR::classCaptionSingle() . '. ' . Lang::getPhrase( 2073 ) . ' <b>*</b>', 5 => NodeAR::classCaptionSingle() . '. ' . Lang::getPhrase( 3262 ) . ' <b>*</b>', 6 => NodeAR::classCaptionSingle() . '. ' . Lang::getPhrase( 2069 ) . ' <b>*</b>', 7 => NodeAR::classCaptionSingle() . '. ' . Lang::getPhrase( 4749 ) . ' <b>*</b>', 8 => Lang::getPhrase(1552) . '. ' . Lang::getPhrase( 1016 ) . ' <b>*</b>', 9 => Lang::getPhrase(1552) . '. ' . Lang::getPhrase(1559), 10 => Lang::getPhrase(1552) . '. ' . Lang::getPhrase(1565), 11 => Lang::getPhrase(1552) . '. ' . Lang::getPhrase( 1660 ) . ' <b>*</b>', 12 => Lang::getPhrase(1552) . '. ' . Lang::getPhrase( 1045 ) . ' <b>*</b>', 13 => Lang::getPhrase(1552) . '. ' . Lang::getPhrase( 1637 ) . ' <b>*</b>', 14 => Lang::getPhrase(1552) . '. ' . Lang::getPhrase( 1638 ) . ' <b>*</b>' ]; break; case 'inventory': $caption = Lang::getPhrase(641); $fieldArray = [ 1 => Lang::getPhrase(1584), 2 => Lang::getPhrase(1582), 3 => Lang::getPhrase(1585), 4 => Lang::getPhrase(3556), 5 => Lang::getPhrase(3937), 6 => Lang::getPhrase(661) . ' <b>*</b>', 7 => Lang::getPhrase(1637) . ' <b>*</b>' ]; break; } if ( 3 == $step || 4 == $step ) { $arg1 = RequestData::custom('arg1'); $arg2 = RequestData::custom('arg2'); $fn = 'import_' . $arg1 . '_' . $arg2 . '.csv'; $fn = realpath(__DIR__) . '/../../../../var/log/' . $fn; if (file_exists($fn) == false) { if (4 == $step) { Html::location("?core_section=settings_main"); } Html::locationCancel(); } $isGood = 1; $fileTemp = fopen($fn, "r"); while (!feof($fileTemp)) { $temp1 = trim(fgets($fileTemp)); if ('' != $temp1) { if ('utf8' != $codepage) { $temp1 = iconv("WINDOWS-1251", "UTF-8", $temp1); } $arrayTemp = explode(';', $temp1); $arrayResult[] = $arrayTemp; if ('address' == $objectType && !isset($arrayTemp[3])) { $isGood = 0; } if ('node' == $objectType && !isset($arrayTemp[6])) { $isGood = 0; } if ('device' == $objectType && !isset($arrayTemp[9])) { $isGood = 0; } if ( 'customer' == $objectType && ( !isset($arrayTemp[0]) || $arrayTemp[0] == '' ) ) { $isGood = 0; } } } fclose($fileTemp); if (1 != $isGood) { unlink($fn); Html::location('?core_section=settings_main&action=import&object_type=' . $objectType, 'cancel'); } $content = '
                <a href="?core_section=settings_main&item_id=' . self::ITEM_20 . '"><i class="us-icon fa-chevron-left"></i>' . Lang::getPhrase( 1443 ) . '</a><br>
                <br>
                <span class="label_h2">' . Lang::getPhrase( 4743 ) . ' - ' . $caption . '</span><br>'; } if ($step < 1) { $ret = "?core_section=settings_main&item_id=" . self::ITEM_20; $content = '
                    <a href="' . $ret . '"><i class="us-icon fa-chevron-left"></i>' . Lang::getPhrase( 1443 ) . '</a><br>
                    <br>
                    <span class="label_h2">' . Lang::getPhrase(4743) . ' - ' . $caption . '</span><br>
                    <br>
                    <span class="red_text bold_text">' . Lang::getPhrase( 4748 ) . '</span><br><br>
                    ' . Lang::getPhrase( 4744 ) . ':<br>'; foreach ($fieldArray as $i => $value) { $content .= '
                    <div class="div_space">
                    &nbsp; &nbsp; &nbsp; <b>' . $i . '.</b> ' . $value . '
                    </div>'; } $content .= '
                <div class="div_space">
                    <b>*</b> - ' . Lang::getPhrase( 4750 ) . '
                </div>
                <div class="div_space">
                    ' . Lang::getPhrase(5154) . '
                </div>
                <form method="post" enctype="multipart/form-data" name="form1" action="">
                    <input type="hidden" name="core_section" value="settings_main">
                    <input type="hidden" name="action" value="import">
                    <input type="hidden" name="object_type" value="' . $objectType . '">
                    <input type="hidden" name="step" value="2">
                    <div class="table_block">
                        <div class="item">
                            <div class="left_data">
                                ' . Lang::getPhrase(1243) . ':<br>
                                <span class="info_block">' . Lang::getPhrase( 787 ) . ': csv</span>
                            </div>
                            <div>
                                <input type="file" name="fileTemp">
                            </div>
                        </div>
                        <div class="item">
                            <div class="left_data">
                                ' . Lang::getPhrase(5155) . ':
                            </div>
                            <div>
                                <select name="codepage" size="1">
                                    <option value="utf8">utf8</option>
                                    <option value="1251">1251</option>
                                </select>
                            </div>
                        </div>
                    </div>'; $isFail = 0; if (('device' == $objectType || 'inventory' == $objectType)) { if (1 > count(WarehousesEmployeesAccessAR::getWarehouseAccessList())) { $isFail = 1; $content .= '
                        <span class="red_text bold_text">' . Lang::getPhrase( 4969 ) . '</span><br>'; } } if (1 != $isFail) { $content .= BodyHtml::formButton('save_cancel', $ret, Lang::getPhrase(1830) ); } $content .= '
                    </form>'; } if (2 == $step) { $fileName = $_FILES["fileTemp"]["name"]; if ('' != $fileName) { $ext = str_replace('.', '', strtolower(substr($_FILES["fileTemp"]["name"], -4))); if ('csv' != $ext) { Html::locationBackCancel(); } $temp1 = mt_rand(); $temp2 = mt_rand(); $fileName = 'import_' . $temp1 . '_' . $temp2 . '.' . $ext; $folder = realpath(__DIR__) . '/../../../../var/log/'; if ('1' != copy($_FILES["fileTemp"]["tmp_name"], $folder . $fileName)) { Html::locationCancel(); } } else { Html::locationCancel(); } $url = "?core_section=settings_main&action=import&object_type=" . $objectType . "&step=3&arg1=" . $temp1 . "&arg2=" . $temp2 . "&codepage=" . $codepage; Html::location($url); } if (3 == $step) { $content .= '
                <form method="send" name="form1" action="">
                    <input type="hidden" name="core_section" value="settings_main">
                    <input type="hidden" name="action" value="import">
                    <input type="hidden" name="object_type" value="' . $objectType . '">
                    <input type="hidden" name="arg1" value="' . $arg1 . '">
                    <input type="hidden" name="arg2" value="' . $arg2 . '">
                    <input type="hidden" name="codepage" value="' . $codepage . '">
                    <input type="hidden" name="step" value="4">
                    <div class="table_block">
                        <div class="item">
                            <div class="left_data">
                                <input name="dont_first" type="checkbox" value="1">
                            </div>
                            <div>
                                ' . Lang::getPhrase(4746) . '
                            </div>
                        </div>'; if ('node' == $objectType) { $content .= '
                        <div class="item">
                            <div class="left_data">
                                ' . Lang::getPhrase(863) . '
                            </div>
                            <div>
                                <select name="node_type_id" size="1">'; $nodeTypes = NodeTypeAR::find() ->orderBy(NodeTypeAR::F_POSITION . ',' . NodeTypeAR::F_NAME) ->all(); foreach ($nodeTypes as $nodeType) { $content .= '
                                    <option value="' . $nodeType->getId() . '">' . NodeTypeCache::getName( $nodeType->getId() ) . '</option>'; } $content .= '
                                </select>
                            </div>
                        </div>'; } if ('inventory' == $objectType) { $content .= '
                        <div class="item">
                            <div class="left_data">
                                ' . Lang::getPhrase(639) . '
                            </div>
                            <div>
                                <select name="warehouse_id" size="1">'; $warehouses = WarehouseAR::find() ->where( [ WarehouseAR::F_ID => WarehousesEmployeesAccessAR::getWarehouseAccessList() ] ) ->orderBy(WarehouseAR::F_NAME) ->all(); foreach ($warehouses as $warehouse) { $content .= '
                                    <option value="' . $warehouse->getId() . '">' . $warehouse->getName() . '</option>'; } $content .= '
                                </select>
                            </div>
                        </div>
                        <div class="item">
                            <div class="left_data">
                                ' . Lang::getPhrase(1660) . '
                            </div>
                            <div>
                                <select name="trader_id" size="1" required>'; $traders = TraderAR::find() ->orderBy(TraderAR::F_NAME) ->all(); foreach ($traders as $trader) { $content .= '
                                    <option value="' . $trader->getId() . '">' . $trader->getName() . '</option>'; } $content .= '
                                </select>
                            </div>
                        </div>'; } if ('customer' == $objectType) { $content .= '
                        <div class="item">
                            <div class="left_data">
                                ' . Lang::getPhrase(2228) . '
                            </div>
                            <div>
                                <select name="billing_id" size="1">'; $billings = BillingAR::find() ->orderBy(BillingAR::F_NAME) ->all(); foreach ($billings as $billing) { $content .= '
                                    <option value="' . $billing->getId() . '">' . BillingCache::getName( $billing->getId() ) . '</option>'; } $content .= '
                                </select>
                            </div>
                        </div>'; } $content .= '
                    </div>
                    <div class="div_space">
                        <b>' . Lang::getPhrase(4745) . ':</b>
                    </div>'; $field = [ [ 'SPECIAL' => '_number' ] ]; foreach ($fieldArray as $i => $value) { $field[] = [ 'NAME' => $value, 'EL' => $i - 1 ]; } $table = new Table(); $table->customPerPage = 'all'; $content .= $table->show($arrayResult, $field); $content .= '
                    <br>
                    ' . BodyHtml::formButton( 'save_cancel', '?core_section=settings_main', Lang::getPhrase(1830) ) . '
                </form>'; } if (4 == $step) { if ($objectType !== 'inventory') { BuildingCache::flushData(); RedisCache::$arrayKeyExist['isAll'] = true; } $isDontFirst = RequestData::customInt('dont_first'); $nodeTypeId = RequestData::customInt('node_type_id'); $importResult = []; $count = 0; $arrayToImport = []; switch ($objectType) { case 'customer': $billingId = RequestData::customInt('billing_id'); foreach ($arrayResult as $value) { ++$count; if ( 1 < $count || 1 != $isDontFirst ) { $arrayToImport[] = [ 'billing_id' => $billingId, 'billing_customer_id' => $value[0] ?? '', 'login' => $value[1] ?? '', 'name' => $value[2] ?? '', 'tariff_name' => $value[3] ?? '', 'agreement_number' => $value[4] ?? '', 'agreement_date' => $value[5] ?? '', 'cityName' => $value[6] ?? '', 'streetName' => $value[7] ?? '', 'houseNumber' => $value[8] ?? '', 'apart' => $value[9] ?? '', 'entrance' => $value[10] ?? '', 'level' => $value[11] ?? '', 'date_connect' => $value[12] ?? '', 'balance' => $value[13] ?? '', 'phone' => $value[14] ?? '', 'phone2' => $value[15] ?? '', 'mail' => $value[16] ?? '', 'ip' => $value[17] ?? '', 'mac' => $value[18] ?? '', 'description' => $value[19] ?? '' ]; } } break; case 'inventory': $inventorySections = InventorySectionAR::find() ->orderBy(InventorySectionAR::F_NAME) ->all(); $inventoryAssortmentArray = []; $inventoryAssortments = InventoryAssortmentAR::find()->all(); foreach ($inventoryAssortments as $inventoryAssortment) { $uuid = $inventoryAssortment->getInventorySectionId() . '-US-' . mb_strtolower( $inventoryAssortment->getName() ); $inventoryAssortmentArray[$uuid] = $inventoryAssortment->getId(); } foreach ($arrayResult as $value) { ++$count; if ( 1 < $count || 1 != $isDontFirst ) { $categoryName = $value[0] ?? ''; $inventoryName = $value[1] ?? ''; $unitName = $value[2] ?? ''; $count = $value[3] ?? 0; $amount = $value[4] ?? 0; $comment = $value[5] ?? ''; $sn = $value[6] ?? ''; if ($count != 1) { $sn = ''; } $traderId = RequestData::customInt('trader_id'); $warehouseId = RequestData::custom('warehouse_id'); $categoryName = Central::escapeSymbol($categoryName); $inventoryName = Central::escapeSymbol($inventoryName); if ($count > 0) { $catId = 0; foreach ($inventorySections as $inventorySection) { if (mb_strtolower($categoryName) == mb_strtolower( InventorySectionCache::getName($inventorySection->getId()) )) { $catId = $inventorySection->getId(); break; } } if ($catId < 1) { $catId = InventorySectionAR::create( $categoryName, InventorySectionAR::T_0_OTHER )->getId(); } $uuid = $catId . '-US-' . mb_strtolower($inventoryName); $invId = $inventoryAssortmentArray[$uuid] ?? 0; if ($invId < 1) { $inventoryAssortment = InventoryAssortmentAR::create($catId, $inventoryName); $invId = $inventoryAssortment->getId(); $inventoryAssortment = InventoryAssortmentAR::findOne($invId); $inventoryAssortment->edit( [ InventoryAssortmentAR::F_NAME => $inventoryName, InventoryAssortmentAR::F_UNIT_NAME => $unitName ] ); $inventoryAssortmentArray = []; $inventoryAssortments = InventoryAssortmentAR::find()->all(); foreach ($inventoryAssortments as $inventoryAssortment2) { $uuid = InventoryAssortmentCache::getInventorySectionId( $inventoryAssortment2->getId() ) . '-US-' . mb_strtolower( InventoryAssortmentCache::getName($inventoryAssortment2->getId()) ); $inventoryAssortmentArray[$uuid] = $inventoryAssortment2->getId(); } } $inventory = InventoryAR::create( traderId: $traderId, inventoryAssortmentId: $invId, amount: $count, price: $amount, inventoryOperationId: -1, inventoryNumber: $sn, comment: $comment ); $inventory->moved( InventoryAR::ACCOUNT_WAREHOUSE, InventoryAR::SUB_ACCOUNT_3, $warehouseId ); $id = $inventory->getId(); $importResult[] = [ 'type' => Lang::getPhrase(641), 'caption' => '(' . $invId . ') <a href="' . $inventory->getUrl( ) . '">' . $inventoryName . '</a> (' . $unitName . ': ' . $count . ') - ' . $amount ]; } } } break; case 'address': case 'node': case 'device': foreach ($arrayResult as $value) { ++$count; if ( 1 < $count || 1 != $isDontFirst ) { $cityName = $value[0] ?? ''; $streetName = $value[1] ?? ''; $houseNumber = $value[2] ?? ''; $tempBundle = [ 'cityName' => $cityName, 'streetName' => $streetName, 'houseNumber' => $houseNumber ]; switch ($objectType) { case 'address': $tempBundle['entranceCount'] = isset($value[3]) ? (int)($value[3]) : 0; $tempBundle['levelCount'] = isset($value[4]) ? (int)($value[4]) : 0; $tempBundle['apartCount'] = isset($value[5]) ? (int)($value[5]) : 0; $tempBundle['isUnused'] = isset($value[6]) ? (int)($value[6]) : 0; $tempBundle['buildingTypeId'] = isset($value[7]) ? (int)($value[7]) : 0; $tempBundle['additionalData1Id'] = isset($value[8]) ? (int)($value[8]) : 0; $tempBundle['additionalData1Data'] = $value[9] ?? ''; $tempBundle['additionalData2Id'] = isset($value[10]) ? (int)($value[10]) : 0; $tempBundle['additionalData2Data'] = $value[11] ?? ''; break; case 'node': $tempBundle['nodeTypeId'] = $nodeTypeId; $tempBundle['nodeEntrance'] = isset($value[3]) ? (int)($value[3]) : 0; $tempBundle['nodeLevel'] = isset($value[4]) ? (int)($value[4]) : 0; $tempBundle['nodeLocation'] = $value[5] ?? ''; $tempBundle['nodeNumber'] = $value[6] ?? ''; $tempBundle['nodeCoord'] = $value[7] ?? ''; $tempBundle['nodeComment'] = $value[8] ?? ''; $tempBundle['nodeOwnerId'] = $value[9] ?? 0; $tempBundle['nodeMapMarkId'] = $value[10] ?? 0; $tempBundle['nodeLayerId'] = $value[11] ?? 0; $tempBundle['nodeInvNo'] = $value[12] ?? ''; break; case 'device': $tempBundle['nodeTypeId'] = NodeAR::TYPE_NODE; $tempBundle['nodeEntrance'] = isset($value[3]) ? (int)($value[3]) : 0; $tempBundle['nodeLevel'] = isset($value[4]) ? (int)($value[4]) : 0; $tempBundle['nodeLocation'] = $value[5] ?? ''; $tempBundle['nodeNumber'] = $value[6] ?? ''; $tempBundle['deviceIp'] = $value[7] ?? 0; $tempBundle['deviceModel'] = $value[8] ?? ''; $tempBundle['devicePort'] = $value[9] ?? 0; $tempBundle['deviceTrader'] = $value[10] ?? ''; $tempBundle['deviceMac'] = $value[11] ?? ''; $tempBundle['deviceSn'] = $value[12] ?? ''; $tempBundle['deviceInv'] = $value[13] ?? ''; break; } $arrayToImport[] = $tempBundle; } } break; } if ($objectType != 'inventory') { $importResult = Import::importData($arrayToImport); } unlink($fn); if ($isDontFirst == 1) { --$count; } $content .= '
                            <br>
                            <div class="div_space">
                                <b>' . Lang::getPhrase(1289) . ':</b><br>
                                &nbsp; &nbsp; &nbsp; &bull; &nbsp; ' . Lang::getPhrase( 4747 ) . ': <b>' . $count . '</b><br>
                                &nbsp; &nbsp; &nbsp; &bull; &nbsp; ' . Lang::getPhrase( 4678 ) . '/' . Lang::getPhrase( 4267 ) . ': <b>' . count($importResult) . '</b><br>
                            </div>'; foreach ($importResult as $i => $value) { $content .= '
                                <div class="div_space">
                                    ' . ($i + 1) . '. ' . $value['type'] . ' "<i>' . $value['caption'] . '</i>"
                                </div>'; } EmployeeActionLogSystem::writeLogWithZeroTypeId(EmployeeHistoryType::T440, 0, 0, $objectType); } return $content; } private static function tablePropertySave(): void { $typeId = RequestData::custom('id'); $employeeId = RequestData::customInt('employee_id'); if ($employeeId > 0) { $employeeId = Html::$currentEmployeeId; } else { OperatorAccess::verifyRight(OperatorAccess::RIGHT_SETTING); $employeeId = null; } $employeeTableSettingDto = Yii::$container ->get(EmployeeTableSettingFetcher::class) ->getOneByCondition( [ EmployeeTableSettingDto::F_EMPLOYEE_ID => $employeeId, EmployeeTableSettingDto::F_TABLE_TYPE => $typeId ] ); if (!$employeeTableSettingDto) { EmployeeTableSettingSystem::create($typeId, $employeeId); } if ('cancel' == RequestData::custom('data')) { EmployeeTableSettingSystem::removeByEmployeeTableType( $employeeId, $typeId ); } else { $fieldsListArray = []; $fieldList = RequestData::custom('field_list'); $arrayField = explode(',', $fieldList); $position = 0; foreach ($arrayField as $value) { if ('' != $value) { $field = str_replace('li_', '', $value); $field = str_replace('_id', '', $field); $width = RequestData::custom('w_' . $field); if (1 == RequestData::custom('check_' . $field)) { ++$position; $fieldsListArray[$field] = [ 'POS' => $position, 'W' => $width ]; } else { $fieldsListArray[$field] = [ 'POS' => -1, 'W' => $width ]; } } } EmployeeTableSettingSystem::editFieldList($typeId, $employeeId, $fieldsListArray); } Html::locationBackOk(); } public static function tableSettingCatalog($id, $employeeId = null): array { $catalog = EmployeeTableSettingSystem::getCatalog(); $field = []; $arrAddField = []; if (!isset($catalog[$id])) { Html::locationCancel(); } $fieldsArray = $catalog[$id]['fields']; foreach ($fieldsArray as $i => $value) { $field[$i]['NAME'] = $value; } if (isset($catalog[$id]['additional_field_category'])) { $arrAddField = AdditionalFieldAR::getByCategory($catalog[$id]['additional_field_category']); } if (count($arrAddField) > 0) { foreach ($arrAddField as $i => $value) { $field[(1000 + $i)]['NAME'] = Lang::getPhrase(3945) . ': ' . $value['name']; } } $tableData = EmployeeTableSettingSystem::getProperty($id, $employeeId); foreach ($field as $i => $value) { $field[$i]['ID'] = $i; $field[$i]['POS'] = -1; $field[$i]['W'] = ''; if (isset($tableData[$i])) { $field[$i]['POS'] = $tableData[$i]['POS']; $field[$i]['W'] = $tableData[$i]['W']; } } return [ 'field' => $field, 'additionalField' => $arrAddField ]; } private static function tableProperty(): string { OperatorAccess::verifyRight(OperatorAccess::RIGHT_SETTING); $id = RequestData::custom('id'); $ret = '?core_section=settings_main'; return self::tableSetting($id, $ret); } public static function tableSetting($tableId, $ret, $employeeId = null): string { $responce = self::tableSettingCatalog($tableId, $employeeId); $field = $responce['field']; $field = Central::sort($field, 'POS'); $content = '
            <a href="' . $ret . '"><i class="us-icon fa-chevron-left"></i>' . Lang::getPhrase( 1443 ) . '</a><br>
            <br>
            <span class="label_h2">' . Lang::getPhrase( 3833 ) . ' - ' . EmployeeTableSettingSystem::getCatalog()[$tableId]['name'] . '</span>
            <div class="info_block">' . Lang::getPhrase( 4028 ) . '</div>
            <form method="send" name="form1" action="">
                <input type="hidden" name="core_section" value="' . BodyHtml::SECTION_SETTINGS_MAIN . '">
                <input type="hidden" name="action" value="' . self::A_TABLE_PROPERTY_SAVE . '">
                <input type="hidden" id="field_list_id" name="field_list" value="">
                <input type="hidden" name="id" value="' . $tableId . '">
                <input type="hidden" name="employee_id" value="' . $employeeId . '">
                <div id="table_field_id">
                    <ul id="div_sortable">'; $fieldTempCount = 0; foreach ($field as $value) { ++$fieldTempCount; $content .= '
                        <li class="ui-state-default div_sortable_class" id="li_' . $value['ID'] . '_id">
                            <div style="position: relative;">
                                <div>
                                    <input id="checkField' . $fieldTempCount . 'Id" name="check_' . $value['ID'] . '" type="checkbox"'; if (-1 != $value['POS']) { $content .= ' checked'; } $content .= ' value="1">
                                    ' . $value['NAME'] . '
                                </div>
                                <div style="position: absolute; top: 0px; right: 0;">
                                    ' . Lang::getPhrase( 3837 ) . ' <input type="text" name="w_' . $value['ID'] . '" size="5" class="input_field" maxlength="5" value="' . $value['W'] . '">
                                </div>
                            </div>
                        </li>'; } $content .= '
                    </ul>
                </div>                
                <script>
                    reload_sort_position();
                </script>
                <br>    
                <div class="div_space">
                    <a href="?core_section=' . BodyHtml::SECTION_SETTINGS_MAIN . '&action=' . self::A_TABLE_PROPERTY_SAVE . '&id=' . $tableId . '&data=cancel&employee_id=' . $employeeId . '"><i class="us-icon fa-times"></i>' . Lang::getPhrase( 4029 ) . '</a>
                </div>    
                ' . BodyHtml::formButton('save_cancel', $ret) . '
            </form>'; return $content; } private static function customerStateDelete(): void { OperatorAccess::verifyRight(OperatorAccess::RIGHT_SETTING); $id = RequestData::$id; CustomerStatusAR::findOne($id)->remove(); Html::location('?core_section=settings_main&action=customer_state', 'updok'); } private static function customerStateSave(): void { OperatorAccess::verifyRight(OperatorAccess::RIGHT_SETTING); $id = RequestData::$id; $name = RequestData::custom('name'); if ($id < 1) { $customerState = CustomerStatusAR::create($name); $id = $customerState->getId(); } else { $customerState = CustomerStatusAR::findOne($id); $customerState->edit( [ CustomerStatusAR::F_NAME => $name ] ); } EmployeeActionLogSystem::writeLogWithZeroTypeId(EmployeeHistoryType::T459, 0, $id); Html::location('?core_section=settings_main&action=customer_state_dialog_edit&id=' . $id, 'updok'); } private static function customerStateDialogAddEdit(): string { OperatorAccess::verifyRight(OperatorAccess::RIGHT_SETTING); $id = RequestData::$id; if (RequestData::custom('id') != '') { $mode = 'edit'; } else { Html::$isEmptyTemplate = true; $mode = 'add'; } if ($mode == 'add') { $content = '
                <div class="dialog_header"><span id="spanAddStateId">' . Lang::getPhrase(1971) . '</span></div>
                <br>'; $ret = BodyHtml::FORM_DIALOG_CLOSE; } else { $ret = '?core_section=settings_main&action=customer_state'; $content = '
                <a href="' . $ret . '"><i class="us-icon fa-chevron-left"></i>' . Lang::getPhrase( 1443 ) . '</a><br>
                <br>
                <span class="label_h2">' . Lang::getPhrase(4924) . '</span><br>'; } $content .= '
                <form method="post" name="form1" action="">
                    <input type="hidden" name="core_section" value="settings_main">
                    <input type="hidden" name="action" value="customer_state_save">
                    <input type="hidden" name="id" value="' . $id . '">
                    <div class="table_block">
                        <div class="item">
                            <div class="left_data">
                                ' . Lang::getPhrase(1451) . ':
                            </div>
                            <div>'; if (0 < $id || 'add' == $mode) { $content .= '
                                <input type="text" class="input_box" required name="name" size="20" maxlength="255" value=\'' . CustomerStatusCache::getName( $id ) . '\'>'; } else { $content .= CustomerStatusCache::getName($id); } $content .= '
                            </div>
                        </div>
                    </div>'; if (0 < $id || 'add' == $mode) { $content .= BodyHtml::formButton('save_cancel', $ret); } $content .= '
                </form>'; if ('add' == $mode) { Html::$isEmptyTemplate = true; return $content; } elseif (2 < $id) { $content .= ' ' . BodyHtml::linkConfirm( '?core_section=settings_main&action=customer_state_delete&id=' . $id, Lang::getPhrase(1415), Lang::getPhrase(1150) . '?', '<i class="us-icon us-icon-danger fa-close"></i>' . Lang::getPhrase(1415) , 'linkConfirmDeleteStateId' ); } return $content; } private static function customerState(): string { OperatorAccess::verifyRight(OperatorAccess::RIGHT_SETTING); $content = '
            <a href="?core_section=settings_main&item_id=' . self::ITEM_10 . '"><i class="us-icon fa-chevron-left"></i>' . Lang::getPhrase( 1443 ) . '</a><br>
            <br>
            <span class="label_h2">' . Lang::getPhrase(4925) . '</span><br>
            <div class="div_space" style="margin-top: 10px;">
                <a id="linkAddId" href="javascript:ajaxWindow(\'?core_section=settings_main&action=customer_state_dialog_add\')" class="link_dashed"><i class="us-icon fa-plus"></i><span>' . Lang::getPhrase( 841 ) . '</span></a>
            </div>'; $data = CustomerStatusAR::getCatalog(); $field = [ [ 'SPECIAL' => '_number' ], [ 'NAME' => 'ID', 'EL' => 'id' ], [ 'NAME' => Lang::getPhrase(1451), 'ISSORT' => 1, 'ISSORTABC' => 1, 'EL' => 'name' ] ]; $table = new Table(); $table->link = '?core_section=settings_main&action=customer_state_dialog_edit&id='; $table->sortDefault = 'name'; $table->isSortDefaultAbc = 1; $content .= $table->show($data, $field); return $content; } private static function customPageSave(): void { if (Central::$isUSOnline === false) { OperatorAccess::verifyRight(OperatorAccess::RIGHT_SETTING); } $id = RequestData::$id; $category = RequestData::custom('category'); $name = RequestData::custom('name'); if ('' == $name) { $name = '_'; } if ($id < 1) { $customPage = PageAR::create($category, $name); $id = $customPage->getId(); } else { $customPage = PageAR::findOne($id); } if ( Central::$isUSOnline === true && $customPage->getAuthorEmployeeId() != Html::$currentEmployeeId ) { Html::locationForbidden(); } $customPage->edit( [ PageAR::F_NAME => $name, PageAR::F_CATEGORY => $category, PageAR::F_URL => RequestData::customTrue('links'), PageAR::F_BODY => RequestData::customTrue('comment'), PageAR::F_IS_FRAME => RequestData::customBoolean('is_frame'), PageAR::F_IS_BLANK => RequestData::customBoolean('is_blank'), PageAR::F_SECTION_TYPE => RequestData::custom('section_type'), PageAR::F_EXTERIOR => [ PageAR::EXTERIOR_ICON => RequestData::custom('exterior_icon') ], ] ); $currentAccess = EmployeeProfilePageAR::getByPageId($id); if (isset($_REQUEST['profile_access']) && is_array($_REQUEST['profile_access'])) { foreach ($_REQUEST['profile_access'] as $profileId) { if (!isset($currentAccess[$profileId])) { EmployeeProfilePageAR::create($id, $profileId); } else { unset($currentAccess[$profileId]); } } } foreach ($currentAccess as $profileId => $value) { EmployeeProfilePageAR::removeByPageProfileId($id, $profileId); } EmployeeActionLogSystem::writeLogWithZeroTypeId(EmployeeHistoryType::T99, 0, $id); CustomPageCache::flushData(); Html::location( '?core_section=' . BodyHtml::SECTION_SETTINGS_MAIN . '&action=' . self::A_CUSTOM_PAGE_DIALOG_EDIT . '&id=' . $id, 'updok' ); } private static function customPageDelete(): void { if (Central::$isUSOnline === false) { OperatorAccess::verifyRight(OperatorAccess::RIGHT_SETTING); } $id = RequestData::$id; $customPage = PageAR::findOne($id); if ( Central::$isUSOnline === true && $customPage->getAuthorEmployeeId() != Html::$currentEmployeeId ) { Html::locationForbidden(); } $customPage->remove(); Html::location( '?core_section=' . BodyHtml::SECTION_SETTINGS_MAIN . '&action=' . self::A_CUSTOM_PAGE_LIST . '&category=' . $customPage->getCategory( ), 'updok' ); } private static function customPageDialogAddEdit(): string { if (Central::$isUSOnline === false) { OperatorAccess::verifyRight(OperatorAccess::RIGHT_SETTING); } $id = RequestData::$id; if ($id < 1) { $category = RequestData::custom('category'); $customPage = new PageAR(); } else { $customPage = PageAR::findOne($id); if ( Central::$isUSOnline === true && $customPage->getAuthorEmployeeId() != Html::$currentEmployeeId ) { Html::locationForbidden(); } $category = $customPage->getCategory(); } switch ($category) { case PageAR::CATEGORY_CUSTOMER_CABINET: $caption = Lang::getPhrase(4127); break; case PageAR::CATEGORY_LEFT_MENU: $caption = Lang::getPhrase(5968); break; case PageAR::CATEGORY_CUSTOMER_CARD: $caption = Lang::getPhrase(5853); break; case PageAR::CATEGORY_TOP_MENU: $caption = Lang::getPhrase(5967); break; case PageAR::CATEGORY_DASHBOARD: $caption = Lang::getPhrase(6205); break; default: $caption = '???'; break; } $ret = '?core_section=' . BodyHtml::SECTION_SETTINGS_MAIN . '&action=' . self::A_CUSTOM_PAGE_LIST . '&category=' . $category; $content = '
            <a href="' . $ret . '"><i class="us-icon fa-chevron-left"></i>' . Lang::getPhrase( 893 ) . '</a><br>
            <div class="label_h2">' . $caption . '</div>
            <form method="post" name="form1" action="">
                <input type="hidden" name="core_section" value="' . BodyHtml::SECTION_SETTINGS_MAIN . '">
                <input type="hidden" name="action" value="' . self::A_CUSTOM_PAGE_SAVE . '">
                <input type="hidden" name="category" value="' . $category . '">
                <input type="hidden" name="id" value="' . $id . '">
                <div class="table_block">'; if ( PageAR::CATEGORY_LEFT_MENU == $category && Central::$isUSOnline === false ) { $content .= '
                    <div class="item">
                        <div class="left_data">
                            ' . Lang::getPhrase(5200) . ':
                        </div>
                        <div>
                            <select name="section_type" size="1">'; $arrayPage = PageAR::returnArrayPage(); $sectionType = $customPage->getSectionType(); foreach ($arrayPage as $tempSection => $value) { $content .= '
                                <option value="' . $tempSection . '"'; if ($tempSection == $sectionType) { $content .= ' selected'; } $content .= '>' . $value['name'] . '</option>'; } $content .= '
                            </select>
                        </div>
                    </div>'; } $content .= '
                    <div class="item">
                        <div class="left_data">
                            ' . Lang::getPhrase(833) . ':
                        </div>
                        <div>
                            <input name="name" type="text" size=80 maxlength=200 class="input_box" value=\'' . ($id > 0 ? $customPage->getName( ) : '') . '\'>
                        </div>
                    </div>
                    <div class="item">
                        <div class="left_data">
                            ' . Lang::getPhrase(3187) . ':
                        </div>
                        <div>
                            <input name="links" type="text" size=80 class="input_box" value=\'' . ($id > 0 ? $customPage->getUrl( ) : '') . '\'>
                        </div>
                    </div>'; if (PageAR::CATEGORY_DASHBOARD == $category) { $exterior = []; if ( $id > 0 && $customPage->getExterior() !== null ) { $exterior = json_decode($customPage->getExterior(), true); } $exteriorIcon = $exterior[PageAR::EXTERIOR_ICON] ?? ''; $content .= '
                    <div class="item">
                        <div class="left_data">
                            ' . Lang::getPhrase(4150) . ':
                        </div>
                        <div>
                            fa-<input name="exterior_icon" type="text" size=10 class="input_box" value=\'' . $exteriorIcon . '\'>
                            <a target="_blank" href="https://fontawesome.com/v4/icons/">icons</a>
                        </div>
                    </div>'; } $content .= '
                    <div class="item">
                        <div class="left_data">
                            ' . Lang::getPhrase(4708) . ':
                        </div>
                        <div>
                            <input name="is_frame" type="checkbox"'; if ( $id > 0 && true === $customPage->getIsFrame() ) { $content .= ' checked'; } $content .= ' value="1">
                        </div>
                    </div>
                    <div class="item">
                        <div class="left_data">
                            ' . Lang::getPhrase(6157) . ':
                        </div>
                        <div>
                            <input name="is_blank" type="checkbox"'; if ( $id > 0 && true === $customPage->getIsBlank() ) { $content .= ' checked'; } $content .= ' value="1">
                        </div>
                    </div>
                    <div class="item">
                        <div class="left_data">
                            ' . Lang::getPhrase(852) . '
                        </div>
                        <div>
                            <script src="../main/config/tiny_mce/tiny_mce.js"></script>
                            <script>
                                loadTinyMcePage();
                            </script>
                            <textarea name="comment" style="width: 100%; height: 600px;" rows="40">' . ($id > 0 ? $customPage->getBody( ) : '') . '</textarea>
                        </div>
                    </div>'; if ( ( PageAR::CATEGORY_LEFT_MENU == $category || PageAR::CATEGORY_TOP_MENU == $category || PageAR::CATEGORY_DASHBOARD == $category ) && Central::$isUSOnline === false ) { $content .= '
                    <div class="item">
                        <div class="left_data">
                            ' . Lang::getPhrase(5969) . ':
                        </div>
                        <div>'; $arrAccess = EmployeeProfilePageAR::getByPageId($id); $arrProfile = []; $operatorProfiles = EmployeeProfileAR::find()->all(); foreach ($operatorProfiles as $operatorProfile) { $arrProfile[] = [ 'id' => $operatorProfile->getId(), 'name' => EmployeeProfileCache::getName($operatorProfile->getId()) ]; } $arrProfile = Central::sort( data: $arrProfile, sortElement: 'name', isSortAbc: true ); foreach ($arrProfile as $value) { $content .= '
                            <div class="div_space">
                                <input name="profile_access[]" type="checkbox" value="' . $value['id'] . '"'; if ( isset($arrAccess[$value['id']]) || 1 > count($arrAccess) ) { $content .= ' checked'; } $content .= '>
                                ' . $value['name'] . '
                            </div>'; } $content .= '
                        </div>
                    </div>'; } $content .= '
                </div>
                ' . BodyHtml::formButton('save_cancel', $ret) . '
            </form>'; if ( $category == PageAR::CATEGORY_CUSTOMER_CABINET || $category == PageAR::CATEGORY_SUPPORT_INTERFACE ) { $content .= '            
                <div class="label_h3" style="margin-bottom: 3px; margin-top: 0px;">' . Lang::getPhrase( 2673 ) . '</div>
                <div class="info_block">' . Lang::getPhrase( 2674 ) . '</div>
                <div class="gray_block_light">
                    <div class="table_block">
                        <div class="item">
                            <div class="left_data">
                                [' . PageAR::D_DATE . ']
                            </div>
                            <div>
                                ' . Lang::getPhrase(2675) . ' ' . date( 'd.m.Y' ) . '
                            </div>
                        </div>
                        <div class="item">
                            <div class="left_data">
                                [' . PageAR::D_CUSTOMER_NAME . ']
                            </div>
                            <div>
                                ' . Lang::getPhrase(2682) . '
                            </div>
                        </div>
                        <div class="item">
                            <div class="left_data">
                                [' . PageAR::D_CUSTOMER_ACCOUNT_NUMBER . ']
                            </div>
                            <div>
                                ' . Lang::getPhrase(977) . '
                            </div>
                        </div>
                        <div class="item">
                            <div class="left_data">
                                [' . PageAR::D_CUSTOMER_IP . ']
                            </div>
                            <div>
                                ' . Lang::getPhrase(1016) . '
                            </div>
                        </div>
                    </div>
                </div>'; } if ( $category == PageAR::CATEGORY_CUSTOMER_CARD ) { $content .= '            
                <div class="label_h3" style="margin-bottom: 3px; margin-top: 0px;">' . Lang::getPhrase( 2673 ) . '</div>
                <div class="gray_block_light">
                    <div class="table_block">
                        <div class="item">
                            <div class="left_data">
                                [' . PageAR::D_AGREEMENT_NUMBER . ']
                            </div>
                            <div>
                                ' . Lang::getPhrase(2676) . '
                            </div>
                        </div>
                        <div class="item">
                            <div class="left_data">
                                [' . PageAR::D_BILLING_ID . ']
                            </div>
                            <div>
                                ' . Lang::getPhrase(5854) . '
                            </div>
                        </div>
                        <div class="item">
                            <div class="left_data">
                                [' . PageAR::D_BILLING_UID . ']
                            </div>
                            <div>
                                ' . Lang::getPhrase(3841) . '
                            </div>
                        </div>
                        <div class="item">
                            <div class="left_data">
                                [' . PageAR::D_ID . ']
                            </div>
                            <div>
                                ' . Lang::getPhrase(3784) . '
                            </div>
                        </div>
                        <div class="item">
                            <div class="left_data">
                                [' . PageAR::D_IP . ']
                            </div>
                            <div>
                                ' . Lang::getPhrase(2695) . '
                            </div>
                        </div>
                        <div class="item">
                            <div class="left_data">
                                [' . PageAR::D_LOGIN . ']
                            </div>
                            <div>
                                ' . Lang::getPhrase(821) . '
                            </div>
                        </div>
                        <div class="item">
                            <div class="left_data">
                                [' . PageAR::D_MAC . ']
                            </div>
                            <div>
                                ' . Lang::getPhrase(1045) . '
                            </div>
                        </div>
                        <div class="item">
                            <div class="left_data">
                                [' . PageAR::D_EMPLOYEE_ID . ']
                            </div>
                            <div>
                                ' . Lang::getPhrase(5936) . '
                            </div>
                        </div>
                         <div class="item">
                            <div class="left_data">
                                [' . PageAR::D_EMPLOYEE_HASH . ']
                            </div>
                            <div>
                                ' . Lang::getPhrase( 5856 ) . '
                            </div>
                        </div>
                    </div>
                </div>'; } if ($id > 0) { $content .= '
                <br>
                <div class="div_space">'; $content .= ' ' . BodyHtml::linkConfirm( '?core_section=' . BodyHtml::SECTION_SETTINGS_MAIN . '&action=' . self::A_CUSTOM_PAGE_DELETE . '&id=' . $id, Lang::getPhrase(1415), Lang::getPhrase(1150) . '?', '<i class="us-icon us-icon-danger fa-close"></i>' . Lang::getPhrase(1415) , 'linkConfirmDeletePageId' ); } return $content; } private static function customPageList(): string { if (Central::$isUSOnline === false) { OperatorAccess::verifyRight(OperatorAccess::RIGHT_SETTING); } $category = RequestData::custom('category'); if (Central::$isUSOnline === true) { if ( $category != PageAR::CATEGORY_LEFT_MENU && $category != PageAR::CATEGORY_TOP_MENU ) { $category = PageAR::CATEGORY_LEFT_MENU; } } switch ($category) { case PageAR::CATEGORY_LEFT_MENU: $caption = Lang::getPhrase(5968); break; case PageAR::CATEGORY_CUSTOMER_CARD: $caption = Lang::getPhrase(5853); break; case PageAR::CATEGORY_TOP_MENU: $caption = Lang::getPhrase(5967); break; case PageAR::CATEGORY_DASHBOARD: $caption = Lang::getPhrase(6205); break; case PageAR::CATEGORY_CUSTOMER_CABINET: $caption = Lang::getPhrase(3185); break; } $content = '
            <a href="?core_section=settings_main&item_id=' . self::ITEM_99 . '"><i class="us-icon fa-chevron-left"></i>' . Lang::getPhrase( 1443 ) . '</a><br>
            <div class="label_h2">' . $caption . '</div>
            <div class="div_space">
                <a id="linkAddId" href="?core_section=' . BodyHtml::SECTION_SETTINGS_MAIN . '&action=' . self::A_CUSTOM_PAGE_DIALOG_ADD . '&category=' . $category . '"><i class="us-icon fa-plus"></i>' . Lang::getPhrase( 841 ) . '</a>
            </div>'; $expr = ''; if (Central::$isUSOnline === true) { $expr = [ PageAR::F_AUTHOR_EMPLOYEE_ID => Html::$currentEmployeeId ]; } $data = []; $customPages = PageAR::find() ->where( [ PageAR::F_CATEGORY => $category ] ) ->andWhere($expr) ->indexBy(PageAR::F_ID) ->orderBy(PageAR::F_NAME) ->all(); foreach ($customPages as $i => $customPage) { if ('' != $customPage->getUrl()) { $data[$i][100] = Lang::getPhrase(3187); } else { $data[$i][100] = Lang::getPhrase(814); } $data[$i]['id'] = $customPage->getId(); $data[$i]['_name'] = Central::replaceSymbolCode($customPage->getName()); } $fieldArray = [ [ 'SPECIAL' => '_number' ], [ 'NAME' => Lang::getPhrase(1451), 'ISSORT' => 1, 'ISSORTABC' => 1, 'EL' => '_name' ], [ 'NAME' => Lang::getPhrase(863), 'EL' => 100, 'ISSORTABC' => 1 ] ]; $table = new Table(); $table->link = '?core_section=' . BodyHtml::SECTION_SETTINGS_MAIN . '&action=' . self::A_CUSTOM_PAGE_DIALOG_EDIT . '&id='; $table->sortDefault = 'NAME'; $table->isSortDefaultAbc = 1; $content .= $table->show($data, $fieldArray); return $content; } private static function repairInventoryDevice(): string { $id = RequestData::$id; Html::$isEmptyTemplate = true; OperatorAccess::verifyRight(OperatorAccess::RIGHT_SETTING); $device = DeviceAR::findOne($id); $inventoryId = $device->getInventoryId(); $customerId = $device->getCustomerId(); $accountSub = InventoryAR::SUB_ACCOUNT_3; if ($customerId > 0) { $accountType = InventoryAR::ACCOUNT_CUSTOMER; $accountObjectId = $customerId; } else { $accountType = InventoryAR::ACCOUNT_NODE; $accountObjectId = $device->getNodeId(); } InventoryOperationAR::create( $inventoryId, $accountType, $accountSub, $accountObjectId, null, null, null, 'REPAIR' ); return 'Doing!'; } private static function repairInventoryReload(): string { return self::repairInventoryReloadBody(RequestData::$id, RequestData::customInt('is_delete')); } private static function repairInventoryReloadBody($inventoryId): string { Html::$isEmptyTemplate = true; $inventory = InventoryAR::findOne($inventoryId); if (!$inventory) { return 'Bad Id!'; } OperatorAccess::verifyRight(OperatorAccess::RIGHT_SETTING); if (InventoryAR::ACCOUNT_CUSTOMER == $inventory->getAccountType()) { $customerId = $inventory->getAccountObjectId(); $nodeId = 0; } else { $customerId = 0; $nodeId = $inventory->getAccountObjectId(); } $inventorySubAccount = $inventory->getAccountSub(); $argArray = $inventory->getOptions(); $mac = $argArray['MAC'] ?? ''; $ip = null; $count = DeviceAR::find() ->where( [ DeviceAR::F_INVENTORY_ID => $inventoryId ] ) ->count(); if ($count < 1) { DeviceAR::create( 1, $inventoryId, $nodeId, $customerId, $ip, $mac, null, null, null, 'REPAIR', $inventorySubAccount, null, true ); $result = 'Doing!'; } else { $result = 'Yet!'; } return $result; } private static function repairInventory(): string { $id = RequestData::$id; Html::$isEmptyTemplate = true; OperatorAccess::verifyRight(OperatorAccess::RIGHT_SETTING); InventoryOperationAR::create( $id, InventoryAR::ACCOUNT_WAREHOUSE, InventoryAR::SUB_ACCOUNT_3, 1, null, null, null, 'REPAIR' ); return 'Doing!'; } private static function diagWebSocket(): string { Html::$isJsonTemplate = true; OperatorAccess::verifyRight(OperatorAccess::RIGHT_SETTING); $msg = RequestData::custom('msg'); $data = WebSocket::createBodyNotification($msg, 'f00'); return json_encode( [ 'responce' => WebSocket::sendMessage(Html::$currentEmployeeId, WebSocket::TYPE_NOTIFY, $data) ] ); } private static function diagNotify(): string { Html::$isEmptyTemplate = true; OperatorAccess::verifyRight(OperatorAccess::RIGHT_SETTING); $phone = RequestData::custom('phone'); $callerIdName = RequestData::custom('caller_id'); UsmAsterisk::createNotify(Html::$currentEmployeeId, $phone, 0, $callerIdName); return 'Create!'; } private static function exportToKmlSave(): void { OperatorAccess::verifyRight(OperatorAccess::RIGHT_SETTING); $nodeTypeData = []; $nodeTypes = NodeTypeAR::find()->all(); foreach ($nodeTypes as $nodeType) { if (1 == RequestData::customBooleanOld('node' . $nodeType->getId())) { $nodeTypeData[$nodeType->getId()] = $nodeType->getId(); } } $planMode = []; $plan2Mode = []; if (1 == RequestData::customBooleanOld('state_0')) { $planMode[0] = 0; $plan2Mode[] = false; } if (1 == RequestData::customBooleanOld('state_1')) { $planMode[1] = 1; $plan2Mode[] = true; } $ignoreLayer = []; if (isset($_REQUEST['ignore_layer'])) { foreach ($_REQUEST['ignore_layer'] as $layerId) { $ignoreLayer[$layerId] = $layerId; } } $cableLineType = []; if (isset($_REQUEST['cable_line_type'])) { foreach ($_REQUEST['cable_line_type'] as $cableLineTypeId) { $cableLineType[$cableLineTypeId] = $cableLineTypeId; } } $bundle = [ 'nodeType' => $nodeTypeData, 'cableLineType' => $cableLineType, 'planMode' => $planMode, 'plan2Mode' => $plan2Mode, 'is_planned' => RequestData::customBooleanOld('state_0'), 'is_not_planned' => RequestData::customBooleanOld('state_1'), 'ignoreLayer' => $ignoreLayer, 'is_cable_route' => RequestData::customBooleanOld('is_cable_route'), 'is_cable_duct' => RequestData::customBooleanOld('is_cable_duct') ]; $data = ExportKml::createEIT($bundle); header("Content-Disposition: attachment; filename=\"" . date('Y-m-d H:i:s') . ' - ERP.kml' . "\""); echo $data; Central::exitPoint(); } private static function exportToKml(): string { OperatorAccess::verifyRight(OperatorAccess::RIGHT_SETTING); $content = '
            <a href="?core_section=settings_main&item_id=' . self::ITEM_4 . '"><i class="us-icon fa-chevron-left"></i>' . Lang::getPhrase( 1443 ) . '</a><br>
            <div class="label_h2">' . Lang::getPhrase(5649) . ' (EIT)</div>
            <div class="div_space">
                <a target=_blank href="https://www.mtitc.government.bg/bg/category/46/edinna-informacionna-tochka"><i class="us-icon us-icon-normal fa-globe"></i><i>EIT</i></a>
                &middot;
                <a target=_blank href="https://sipbg.gov.bg/SIP.Experts/"><i>SIP</i></a>
            </div>

            <form method="post" name="form1" action="">
                <input type="hidden" name="core_section" value="settings_main">
                <input type="hidden" name="action" value="export_to_kml_save">
                <div class="table_block">
                    <div class="item">
                        <div class="left_data">
                            ' . Lang::getPhrase(1437) . ':
                        </div>
                        <div>
                            <input name="state_0" type="checkbox" value="1"> ' . Lang::getPhrase( 5546 ) . '<br>
                            <input name="state_1" type="checkbox" value="1"> ' . Lang::getPhrase( 5253 ) . '<br>
                        </div>
                    </div>
                    <div class="item">
                        <div class="left_data">
                            ' . Lang::getPhrase(5393) . ':
                        </div>
                        <div>

                            <div class="div_space">
                                <b>' . Lang::getPhrase(5740) . '</b>
                            </div>
                            <input name="is_cable_route" type="checkbox" value="1"> ' . Lang::getPhrase( 5614 ) . '<br>
                            <input name="is_cable_duct" type="checkbox" value="1"> ' . Lang::getPhrase( 5092 ) . '<br>
                            <div class="div_space">
                                <b>' . Lang::getPhrase(5741) . '</b>
                            </div>'; $nodeTypes = NodeTypeAR::find() ->orderBy(NodeTypeAR::F_POSITION) ->all(); foreach ($nodeTypes as $nodeType) { $content .= '
                            <input name="node' . $nodeType->getId( ) . '" type="checkbox" value="1"> ' . NodeTypeCache::getName($nodeType->getId()) . '<br>'; } $cableLineTypes = CableLineTypeAR::find() ->orderBy(CableLineTypeAR::F_NAME) ->all(); foreach ($cableLineTypes as $cableLineType) { $content .= '
                            <input name="cable_line_type[]" type="checkbox" value="' . $cableLineType->getId( ) . '"> ' . CableLineTypeCache::getName($cableLineType->getId()) . '<br>'; } $content .= '
                        </div>
                    </div>
                    <div class="item">
                        <div class="left_data">
                            ' . Lang::getPhrase(5394) . ':
                        </div>
                        <div>
                            <div class="div_space">
                                <b>' . Lang::getPhrase(3752) . '</b>
                            </div>'; $arrayMark = TagAR::find() ->orderBy(TagAR::F_NAME) ->indexBy(TagAR::F_ID) ->asArray() ->all(); foreach ($arrayMark as $tempId => $value) { $content .= '
                            <input name="ignore_layer[]" type="checkbox" value="' . $tempId . '"> ' . TagCache::getNameById( $tempId ) . '<br>'; } $content .= '
                        </div>
                    </div>
                </div>
                ' . BodyHtml::formButton('save', '', Lang::getPhrase(1414) ) . '
            </form>'; return $content; } private static function diag(): string { OperatorAccess::verifyRight(OperatorAccess::RIGHT_SETTING); $content = '
            <div class="div_space">
                <a href="?core_section=' . BodyHtml::SECTION_SETTINGS_PROFILE . '"><i class="us-icon fa-bars"></i>ERP Profile</a>            
            </div>
            <div class="label_h2">DIAG</div>
            <div class="div_space">
                <a id="linkWebSocketId" href="?core_section=settings_main&action=diag_web_socket&msg=test"><i class="us-icon fa-bars"></i>webSocket</a>            
            </div>
            <div class="div_space">
                <a id="linkNotifyId" href="?core_section=settings_main&action=diag_notify&phone=380671234567&caller_id=TestCaller"><i class="us-icon fa-bars"></i>operNotify</a>            
            </div>
            <div class="div_space">
                <a id="linkDeleteUnusedAddressId" href="?core_section=settings_main&action=diag_delete_unuse_address"><i class="us-icon fa-bars"></i>deleteUnusedAddress</a>            
            </div>
            <div class="div_space">
                <a id="linkReloadAddressId" href="?core_section=settings_main&action=diag_reload_building_address"><i class="us-icon fa-bars"></i>reloadBuildingAddress</a>            
            </div>
            <div class="div_space">
                <a id="linkFromAddressToAddressId" href="?core_section=settings_main&action=diag_merge_addresses"><i class="us-icon fa-bars"></i>mergeAddresses</a>            
            </div>
            <div class="div_space">
                <a id="linkSystemStatId" href="?core_section=settings_main&action=diag_system_stat"><i class="us-icon fa-bars"></i>systemStat</a>            
            </div>
            <div class="div_space">
                <a id="linkDBInfoId" href="?core_section=settings_main&action=diag_db_info"><i class="us-icon fa-bars"></i>dbInfo</a>            
            </div>
            <div class="div_space">
                <a id="linkFlushRedisCache" href="?core_section=settings_main&action=diag_flush_redis_cache"><i class="us-icon fa-bars"></i>flushRedisCache</a>            
            </div>
            <div class="div_space">
                <a id="checkErrorPage" href="?core_section=' . BodyHtml::SECTION_SETTINGS_MAIN . '&action=' . self::A_CHECK_ERROR_PAGE . '"><i class="us-icon fa-bars"></i>checkErrorPage</a>            
            </div>
            <div class="div_space">
                <a id="linkNotifLogId" href="?core_section=settings_main&action=var_log&file_type=notifications&limit=100"><i class="us-icon fa-bars"></i>/var/log/notifications.log</a>'; $fileName = realpath(__DIR__) . '/../../../../var/log/notifications.log'; if (file_exists($fileName) == false) { $content .= ' <i>(n/a)</i>'; } else { $content .= ' <i>(' . filesize($fileName) . ')</i>'; } $content .= '
            </div>
            <br>'; $content .= SettingsHtml::propertyDialog( SettingsCatalog::IS_LOG_ASTERISK, 'VALUEINT', 'Is Log Asterisk' ); $content .= '
            <div class="table_block">
                <div class="item">
                    <div class="left_data">
                        MainUrl:
                    </div>
                    <div>
                        ' . getenv('US_URL') . '
                    </div>
                </div>            
                <div class="item">
                    <div class="left_data">
                        OS:
                    </div>
                    <div>
                        ' . PHP_OS . '
                    </div>
                </div>
                <div class="item">
                    <div class="left_data">
                        PHP:
                    </div>
                    <div>
                        ' . PHP_VERSION; ob_start(); phpinfo(); $phpInfoData = ob_get_contents(); ob_get_clean(); $temp = explode('Loaded Configuration File </td><td class="v">', $phpInfoData); if (isset($temp[1])) { $temp = $temp[1]; $temp = explode('</td>', $temp); $iniPath = trim($temp[0]); $content .= '<br>' . $iniPath; } $postgesTime = '1970-01-01'; $stmt = Yii::$app->db->masterPdo->prepare("SELECT now()"); $stmt->execute(); while ($value = $stmt->fetch(PDO::FETCH_ASSOC)) { $postgesTime = date('d.m.Y H:i:s', strtotime($value['now'])); } $postgresVersion = ''; $stmt = Yii::$app->db->masterPdo->prepare("SELECT VERSION()"); $stmt->execute(); while ($value = $stmt->fetch(PDO::FETCH_ASSOC)) { $postgresVersion = $value['version']; } if (1 === RequestData::customInt('is_redis')) { echo print_r(RedisCache::getKeyList('*'), true); exit; } $content .= '
                    </div>
                </div>
                <div class="item">
                    <div class="left_data">
                        Postgres:
                    </div>
                    <div>
                        ' . $postgresVersion . '<br>
                        ' . Yii::$app->db->dsn . '<br>
                    </div>
                </div>
                <div class="item">
                    <div class="left_data">
                        Redis:
                    </div>
                    <div>
                        keys: ' . count(RedisCache::getKeyList('*')) . '
                    </div>
                </div>
                <div class="item">
                    <div class="left_data">
                        Date:
                    </div>
                    <div>
                        cli (cron): ' . date( 'd.m.Y H:i:s', strtotime(SettingAR::getByNameString(SettingsCatalog::CRON_SCRIPT)) ) . '<br>
                        cli: ' . date('d.m.Y H:i:s') . '<br>
                        DB: ' . $postgesTime . '<br>
                        act: ' . Central::$dateCustomerActiveUnix . ' / ' . date( 'd.m.Y H:i:s', Central::$dateCustomerActiveUnix ) . '<br>
                        act_e: ' . Central::$dateDeviceActiveUnix . ' / ' . date( 'd.m.Y H:i:s', Central::$dateDeviceActiveUnix ) . '
                    </div>
                </div>
                <div class="item">
                    <div class="left_data">
                        Path:
                    </div>
                    <div>
                        ' . $_SERVER["SCRIPT_FILENAME"] . '
                    </div>
                </div>
                <div class="item">
                    <div class="left_data">
                        Memory:
                    </div>
                    <div>
                        ' . ini_get("memory_limit") . '
                    </div>
                </div>
                <div class="item">
                    <div class="left_data">
                        Table:
                    </div>
                    <div>'; $stmt = Yii::$app->db->masterPdo->prepare( "
            SELECT 
                p1.relname AS table_name,
                p1.reltuples::bigint AS row_count
            FROM 
                 pg_catalog.pg_class AS p1 
            INNER JOIN 
                information_schema.tables AS t1 
            ON
                t1.table_name = p1.relname
            AND 
                t1.table_schema = 'erp'
            ORDER BY 
                 p1.reltuples DESC 
             LIMIT 10" ); $stmt->execute(); while ($value = $stmt->fetch(PDO::FETCH_ASSOC)) { $content .= $value['table_name'] . ': ~ ' . $value['row_count'] . '<br>'; } $content .= '
                    </div>
                </div>
                <div class="item">
                    <div class="left_data">
                        Logs:
                    </div>
                    <div>'; foreach (self::LOGS_ARRAY as $value) { $fileSrc = realpath(__DIR__) . '/../../../../var/log/' . $value . '.log'; if (file_exists($fileSrc) === true) { $sizeSrc = filesize($fileSrc); $dateSrc = filemtime($fileSrc); $content .= '
                        <div class="div_space">
                            <a id="linkShowLog' . $value . 'Id" href="?core_section=' . BodyHtml::SECTION_SETTINGS_MAIN . '&action=' . self::A_SHOW_LOG . '&type=' . $value . '">' . $value . '</a> (' . $sizeSrc . ' - ' . date( 'd.m.Y H:i:s', $dateSrc ) . ')
                        </div>'; } } $content .= '
                    </div>
                </div>
                <div class="item">
                    <div class="left_data">
                        Rabbit queues:
                    </div>
                    <div>
                        <script>
                            function showQueues() {
                                $("#queuesListId").show();
                                $("#linkShowQueId").hide();
                            }
                        </script>
                        <a class="link_dashed" href="javascript:showQueues();"><span id="linkShowQueId">show</span></a>
                        <span id="queuesListId" style="display: none">'; try { $rabbitCollector = \Yii::$container->get(RabbitMqCollector::class); $queuesArray = []; foreach ($rabbitCollector->queues() as $queue) { $queuesArray[] = [$queue->name, $queue->consumers, $queue->messages, $queue->consumerCapacity]; } $queuesArray = Central::sort( data: $queuesArray, sortElement: 0, isSortAbc: true ); foreach ($queuesArray as $value) { $content .= '
                    <div class="div_space2">
                        ' . $value[0] . ' | consumers: ' . $value[1] . ' | messages: ' . $value[2] . ' | consumerCapacity: ' . $value[3] . '%
                    </div>'; } } catch (Exception $e) { $content .= '
                    <div class="div_space2">
                        ' . $e->getMessage() . '
                    </div>'; } $content .= '
                        </span>
                    </div>
                </div>
                <div class="item">
                    <div class="left_data">
                        usm_poller:
                    </div>
                    <div>
                        <script>
                            function showServiceStatusLog() {
                                $("#serviceStatusLogId").show();
                                $("#linkserviceStatusLogId").hide();
                            }
                        </script>
                        <a class="link_dashed" href="javascript:showServiceStatusLog();"><span id="linkserviceStatusLogId">show</span></a>
                        <span id="serviceStatusLogId" style="display: none">'; $repo = Yii::$container->get(ExternalServiceRepository::class); $serviceLog = $repo->getAllPaginated( page: 1, pageSize: 50 ); $serviceStatusesDto = $serviceLog->getItems(); foreach ($serviceStatusesDto as $serviceStatus) { $content .= $serviceStatus->version . ' | '; $content .= $serviceStatus->status . ' | '; $content .= date('Y-m-d H:i:s', $serviceStatus->time) . '<br>'; } $content .= '
                        </span>
                    </div>
                </div>
                <div class="item">
                    <div class="left_data">
                        Building double:
                    </div>
                    <div>'; $isGood = true; $addressBuildingArray = BuildingAR::find() ->select( [ 'unit_id' => BuildingAR::F_ADDRESS_UNIT_ID, 'building_list' => 'ARRAY_AGG(' . BuildingAR::F_ID . ')', 'counter' => 'COUNT(*)' ] ) ->groupBy(BuildingAR::F_ADDRESS_UNIT_ID) ->asArray() ->all(); foreach ($addressBuildingArray as $value) { if ($value['counter'] > 1) { $isGood = false; $content .= '
                    <div class="div_space2">
                        AddressUnitId: ' . $value['unit_id'] . ' (count: ' . $value['counter'] . ') | ' . $value['building_list'] . '
                    </div>'; } } if ($isGood === true) { $content .= 'OK'; } $content .= '
                    </div>
                </div>
                <div class="item">
                    <div class="left_data">
                        Inventory on lost Warehouse:
                    </div>
                    <div>'; $inventories = InventoryAR::find() ->leftJoin( WarehouseAR::tableName() . ' AS w', InventoryAR::F_ACCOUNT_OBJECT_ID . ' = w.' . WarehouseAR::F_ID ) ->where( [ InventoryAR::F_ACCOUNT_TYPE => InventoryAR::ACCOUNT_WAREHOUSE ] ) ->andWhere('w.' . WarehouseAR::F_ID . ' IS NULL') ->all(); if (count($inventories) < 1) { $content .= "OK"; } else { foreach ($inventories as $inventory) { $url = $inventory->getUrl(); $content .= '
                    <div class="div_space">
                        <a href="' . $url . '"> #' . $inventory->getId() . '</a> (' . $inventory->getAccountObjectId() . ')
                    </div>'; } } $content .= '
                    </div>
                </div>
                <div class="item">
                    <div class="left_data">
                        Device lost INVENTORY:
                    </div>
                    <div>'; $data = []; $devices = DeviceAR::find() ->leftJoin(InventoryAR::tableName() . ' AS i', DeviceAR::F_INVENTORY_ID . ' = i.' . InventoryAR::F_ID) ->where(DeviceAR::F_INVENTORY_ID . ' IS NOT NULL') ->andWhere( '
                    i.' . InventoryAR::F_ID . ' IS NULL
                OR
                    COALESCE(' . DeviceAR::F_INVENTORY_ID . ', 0) = 0
                OR
                    i.' . InventoryAR::F_ACCOUNT_TYPE . ' NOT IN (' . InventoryAR::ACCOUNT_CUSTOMER . ',' . InventoryAR::ACCOUNT_NODE . ')
                OR
                    (
                        i.' . InventoryAR::F_ACCOUNT_TYPE . ' = ' . InventoryAR::ACCOUNT_CUSTOMER . '
                    AND
                        i.' . InventoryAR::F_ACCOUNT_OBJECT_ID . ' <> ' . DeviceAR::F_CUSTOMER_ID . '
                    )
                OR
                    (
                        i.' . InventoryAR::F_ACCOUNT_TYPE . ' = ' . InventoryAR::ACCOUNT_NODE . '
                    AND
                        i.' . InventoryAR::F_ACCOUNT_OBJECT_ID . ' <> ' . DeviceAR::F_NODE_ID . '
                    )
                    ' ) ->all(); if (Html::$isDebug === true) { echo "inventory - start - " . BodyHtml::show_usage_mem() . "\n\n"; } foreach ($devices as $device) { $data[$device->getId()] = true; if ($device->getInventoryId() > 0) { $inventory = InventoryAR::findOne($device->getInventoryId()); $url = $inventory->getUrl(); $urlCaption = $device->getInventoryId(); } else { $url = $device->getUrl(); $urlCaption = 'n/a'; } $content .= '
                <div class="div_space">
                    inventory: 
                    <a href="' . $url . '"> ' . $urlCaption . '</a>
                    - 
                    <a href="' . $device->getUrl() . '"> ' . $device->getName() . '</a> '; if ($device->getInventoryId() < 1) { $content .= ' - Unknown Inventory ID ' . $device->getInventoryId(); } else { $content .= '
                    -
                    <a id="linkRepairInvDevice' . $device->getId( ) . 'Id" href="?core_section=settings_main&action=repair_inventory_device&id=' . $device->getId( ) . '">repair</a>'; } $content .= '
                </div>'; } if (Html::$isDebug === true) { echo "inventory - finish - " . BodyHtml::show_usage_mem() . "\n\n"; } if (1 > count($data)) { $content .= 'OK'; } $content .= '
                    </div>
                </div>
                <div class="item">
                    <div class="left_data">
                        inventory lost Device - Inventory ID:
                    </div>
                    <div>'; $inventorySectionArray = InventorySectionAR::find() ->where( [ InventorySectionAR::F_TYPE_ID => [ InventorySectionAR::T_1_SWITCH, InventorySectionAR::T_2_RADIO, InventorySectionAR::T_16_CUSTOM ] ] ) ->indexBy(InventorySectionAR::F_ID) ->asArray() ->all(); $inventoryAssortArrayList = Central::getArrayListForAR( InventoryAssortmentAR::find() ->where( [ InventoryAssortmentAR::F_INVENTORY_SECTION_ID => Central::getArrayListForAR( $inventorySectionArray ) ] ) ->indexBy(InventoryAssortmentAR::F_ID) ->asArray() ->all() ); if (true === Html::$isDebug) { echo Central::getResourceInfo(); echo "InventoryAR-0\n"; } $arrayTemp = []; $arrayDevice = DeviceAR::find() ->where(DeviceAR::F_INVENTORY_ID . ' > 0') ->indexBy(DeviceAR::F_INVENTORY_ID) ->asArray() ->all(); if (true === Html::$isDebug) { echo Central::getResourceInfo(); echo "InventoryAR-0.5\n"; } foreach ($arrayDevice as $tempInventoryId => $value) { $arrayTemp[$tempInventoryId] = $tempInventoryId; } $inventoriesArray = InventoryAR::find() ->select( [ 'id' => InventoryAR::F_ID, 'inventory_assortment_id' => InventoryAR::F_INVENTORY_ASSORTMENT_ID, ] ) ->where( [ InventoryAR::F_ACCOUNT_TYPE => [ InventoryAR::ACCOUNT_NODE, InventoryAR::ACCOUNT_CUSTOMER ], InventoryAR::F_INVENTORY_ASSORTMENT_ID => $inventoryAssortArrayList ] ) ->orderBy(InventoryAR::F_ID) ->asArray() ->all(); foreach ($inventoriesArray as $i => $value) { if (isset($arrayTemp[$value['id']])) { unset($inventoriesArray[$i]); } } if (true === Html::$isDebug) { echo Central::getResourceInfo(); echo 'InventoryAR-1 | ' . count($inventories) . "\n"; } if (1 > count($inventoriesArray)) { $content .= 'OK'; } else { $tempCount = 0; foreach ($inventoriesArray as $value) { ++$tempCount; $content .= '
                        <div class="div_space">
                            inventory: ' . $value['id'] . ' 
                            - <a href="' . InventoryAR::getUrlById( $value['id'] ) . '">' . InventoryAssortmentCache::getName( $value['inventory_assortment_id'] ) . '</a>
                            -
                            <a id="linkRepairInventoryReload' . $value['id'] . 'Id" href="?core_section=settings_main&action=repair_inventory_reload&id=' . $value['id'] . '">repair</a>'; if ($tempCount < RequestData::customInt('realy')) { $content .= '(result: ' . self::repairInventoryReloadBody($value['id']) . ')'; } $content .= '
                        </div>'; } } $content .= '
                    </div>
                </div>
                <div class="item">
                    <div class="left_data">
                        ,    ,      :
                    </div>
                    <div>'; $inventories = InventoryAR::find() ->where( InventoryAR::F_ACCOUNT_TYPE . " <> " . InventoryAR::ACCOUNT_NODE . "
                and
                    " . InventoryAR::F_ACCOUNT_TYPE . " <> " . InventoryAR::ACCOUNT_CUSTOMER . "
                and
                    " . InventoryAR::F_ID . " IN (" . Central::getArrayList($arrayTemp) . ")" ) ->andWhere( [ InventoryAR::F_INVENTORY_ASSORTMENT_ID => $inventoryAssortArrayList ] ) ->all(); if (true === Html::$isDebug) { echo Central::getResourceInfo(); echo 'InventoryAR-2 | ' . count($inventories) . "\n"; } if (1 > count($inventories)) { $content .= 'OK'; } else { $tempCount = 0; foreach ($inventories as $inventory) { ++$tempCount; $device = DeviceAR::find() ->where( [ DeviceAR::F_INVENTORY_ID => $inventory->getId() ] ) ->one(); if ($device) { $deviceTempId = $device->getId(); } else { $deviceTempId = 0; } $content .= '
                        <div class="div_space">
                            inventory: ' . $inventory->getId() . ' 
                            - <a href="' . $inventory->getUrl() . '">' . InventoryAssortmentCache::getName( $inventory->getInventoryAssortmentId() ) . '</a>
                            - DEVICE: <a href="' . DeviceAR::url($deviceTempId) . '">' . DeviceAR::getFullNameById( $deviceTempId ) . '</a>
                            -
                            <a href="?core_section=settings_main&action=repair_inventory_reload&id=' . $inventory->getId( ) . '&is_delete=1" onclick="return confirm(\'Yes?\'); return true;">repair</a>'; if ($tempCount < RequestData::customInt('realy')) { $content .= '(result: ' . self::repairInventoryReloadBody($inventory->getId(), 1) . ')'; } $content .= '
                        </div>'; } } $content .= '
                    </div>
                </div>
                <div class="item">
                    <div class="left_data">
                        inventory lost Customer:
                    </div>
                    <div>'; $arrayCustomer = CustomerAR::find() ->select( [ 'id' => CustomerAR::F_ID ] ) ->indexBy('id') ->asArray() ->all(); $inventories = InventoryAR::find() ->where( [ InventoryAR::F_ACCOUNT_TYPE => InventoryAR::ACCOUNT_CUSTOMER ] ) ->all(); foreach ($inventories as $i => $inventory) { if (isset($arrayCustomer[$inventory->getAccountObjectId()])) { unset($inventories[$i]); } } if (1 > count($inventories)) { $content .= 'OK'; } else { foreach ($inventories as $inventory) { $content .= '
                    <div class="div_space">
                        inventory: ' . $inventory->getId() . ' - <a href="' . $inventory->getUrl( ) . '">' . InventoryAssortmentCache::getName($inventory->getInventoryAssortmentId()) . '</a>
                        -
                        <a id="linkRepairInventory' . $inventory->getId( ) . 'Id" href="?core_section=settings_main&action=repair_inventory&id=' . $inventory->getId() . '">repair</a>
                    </div>'; } } $content .= '
                    </div>
                </div>
                <div class="item">
                    <div class="left_data">
                           :
                    </div>
                    <div>'; $splittersArray = SplitterAR::find() ->select( [ 'id' => SplitterAR::F_ID, 'inventory_id' => SplitterAR::F_INVENTORY_ID ] ) ->where( ['>', 'inventory_id', 0] ) ->indexBy('inventory_id') ->asArray() ->all(); $inventories = InventoryAR::find() ->where( [ InventoryAR::F_ID => Central::getArrayListForAR($splittersArray) ] ) ->all(); foreach ($inventories as $i => $inventory) { if ( $inventory->getAccountType() == InventoryAR::ACCOUNT_NODE && $inventory->getAmount() == 1 ) { unset($inventories[$i]); } } if (1 > count($inventories)) { $content .= 'OK'; } else { $tempCount = 0; foreach ($inventories as $inventory) { ++$tempCount; $content .= '
                    <div class="div_space">
                        ' . $tempCount . '. Inventory: ' . $inventory->getId() . ' - <a href="' . $inventory->getUrl( ) . '">' . InventoryAssortmentCache::getName($inventory->getInventoryAssortmentId()) . '</a>
                        -
                        <a href="?core_section=' . BodyHtml::SECTION_SPLITTER . '&action=' . SplitterHtml::A_SHOW . '&id=' . $splittersArray[$inventory->getId( )]['id'] . '">Splitter</a>
                    </div>'; } } $content .= '
                    </div>
                </div>
                <div class="item">
                    <div class="left_data">
                          ""   :
                    </div>
                    <div>'; $tempArray = InventorySectionAR::find() ->where( [ InventorySectionAR::F_TYPE_ID => InventorySectionAR::T_4_SPLIT ] ) ->indexBy(InventorySectionAR::F_ID) ->asArray() ->all(); $tempArray2 = InventoryAssortmentAR::find() ->where( [ InventoryAssortmentAR::F_INVENTORY_SECTION_ID => Central::getArrayListForAR($tempArray) ] ) ->indexBy(InventoryAssortmentAR::F_ID) ->asArray() ->all(); $inventoriesArray = InventoryAR::find() ->where( [ InventoryAR::F_INVENTORY_ASSORTMENT_ID => Central::getArrayListForAR($tempArray2), InventoryAR::F_ACCOUNT_TYPE => InventoryAR::ACCOUNT_NODE ] ) ->indexBy(InventoryAR::F_ID) ->asArray() ->all(); $splittersArray = SplitterAR::find() ->select( [ 'id' => SplitterAR::F_ID, 'inventory_id' => SplitterAR::F_INVENTORY_ID ] ) ->where( ['>', 'inventory_id', 0] ) ->indexBy('inventory_id') ->asArray() ->all(); foreach ($splittersArray as $tempId => $value) { unset($inventoriesArray[$tempId]); } if (1 > count($inventoriesArray)) { $content .= 'OK'; } else { $tempCount = 0; foreach ($inventoriesArray as $tempId => $value) { ++$tempCount; $content .= '
                    <div class="div_space">
                        ' . $tempCount . '. TMC: ' . $tempId . ' - <a href="' . InventoryAR::getUrlById( $tempId ) . '">#' . $tempId . '</a>'; if ($value[InventoryAR::F_AMOUNT] < 2) { $content .= '
                     -
                        <a id="linkRepairSplitNode' . $tempId . 'Id" href="?core_section=settings_main&action=repair_inv_splitter_to_node&id=' . $tempId . '">repair</a>'; } else { $content .= ' (' . $value[InventoryAR::F_AMOUNT] . ' .)'; } $content .= '
                    </div>'; } } $content .= '
                    </div>
                </div>
                <div class="item">
                    <div class="left_data">
                            :
                    </div>
                    <div>'; $cableLineArray = CableLineAR::find() ->where(['IS', CableLineAR::F_NODE2_ID, null]) ->andWhere(['IS', CableLineAR::F_BUILDING2_ID, null]) ->andWhere(['IS', CableLineAR::F_CUSTOMER2_ID, null]) ->indexBy(CableLineAR::F_ID) ->asArray() ->all(); if (1 > count($cableLineArray)) { $content .= 'OK'; } else { $tempCount = 0; foreach ($cableLineArray as $tempId => $value) { ++$tempCount; $content .= '
                    <div class="div_space">
                        ' . $tempCount . '. <a href="' . CableLineAR::url($tempId) . '">#' . $tempId . '</a>
                    </div>'; } } $content .= '
                    </div>
                </div>
            </div>'; return $content; } private static function deviceAutocommutationOn(): void { OperatorAccess::verifyRight(OperatorAccess::RIGHT_SETTING); DeviceIfaceAutoLearningAR::removeAll(); $data = DeviceAR::find() ->alias('s') ->select( [ 's.' . DeviceAR::F_ID . ' AS id', 's.' . DeviceAR::F_IFACE_COUNT . ' AS port' ] ) ->join( 'INNER JOIN', IpAddressFetcher::TABLE_NAME . ' AS i', 'i.' . IpAddressDto::F_DEVICE_ID . ' = s.' . DeviceAR::F_ID ) ->leftJoin( InventoryAR::tableName() . ' as i2', 'i2.' . InventoryAR::F_ID . ' = s.' . DeviceAR::F_INVENTORY_ID ) ->leftJoin( InventoryAssortmentAR::tableName() . ' as ia', 'ia.' . InventoryAssortmentAR::F_ID . ' = i2.' . InventoryAR::F_INVENTORY_ASSORTMENT_ID ) ->leftJoin( InventorySectionAR::tableName() . ' as iss', 'iss.' . InventorySectionAR::F_ID . ' = ia.' . InventoryAssortmentAR::F_INVENTORY_SECTION_ID ) ->where( [ 'iss.' . InventorySectionAR::F_TYPE_ID => InventorySectionAR::T_1_SWITCH ] ) ->indexBy('id') ->asArray() ->all(); foreach ($data as $deviceId => $value) { for ($i = 1; $i <= $value['port']; ++$i) { DeviceIfaceAutoLearningAR::create($deviceId, $i); } } EmployeeActionLogSystem::writeLogWithZeroTypeId(EmployeeHistoryType::T255); Html::locationBackOk(); } private static function sql(): string { OperatorAccess::verifyRight(OperatorAccess::RIGHT_SETTING); if (true === Central::$isDemo) { $command = ''; } else { $command = $_POST['command'] ?? ''; } $content = '
            <a href="?core_section=settings_main&item_id=' . self::ITEM_99 . '"><i class="us-icon fa-chevron-left"></i>' . Lang::getPhrase( 1443 ) . '</a><br>
            <div class="label_h2">' . Lang::getPhrase(3281) . '</div>
            <form name="form_attach" method="post" action="">
                <input type="hidden" name="core_section" value="settings_main">
                <input type="hidden" name="action" value="sql">
                <div class="gray_block">
                    <div style="float: right; margin-top: 20px;">
                        ' . BodyHtml::formButton('save', '', Lang::getPhrase(1414) ) . '
                    </div>
                    <div style="margin-right: 120px;">
                        <span class="label_h3">' . Lang::getPhrase(3278) . '</span>
                        <div class="table_block" style="margin-top: 0px;">
                            <div class="item">
                                <div class="left_data">
                                    ' . Lang::getPhrase(3280) . ': 
                                </div>
                                <div>
                                    <input type="text" id="commandId" name="command" size="80" class="input_field" value="' . $command . '">
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </form>'; if ('' != $command) { EmployeeActionLogSystem::writeLogWithZeroTypeId( EmployeeHistoryType::T449, 0, 0, mb_substr($command, 0, 50) ); if (0 == stripos($command, 'elect', 0)) { try { Yii::$app->db->masterPdo->query($command); $content .= '
                        <div class="div_space div_bold green_text">
                            ' . Lang::getPhrase(3282) . '
                        </div>'; } catch (Exception $e) { echo '<pre>'; echo $e->getMessage(); echo '</pre>'; Central::exitPoint(); } } else { $bundle = []; try { $bundle = Yii::$app->db->masterPdo->query($command, PDO::FETCH_ASSOC); if (!is_bool($bundle)) { $bundle = $bundle->fetchAll(); } } catch (Exception $e) { echo '<pre>'; echo $e->getMessage(); echo '</pre>'; Central::exitPoint(); } $content .= '
                    <div class="div_space">
                        ' . Lang::getPhrase(3283) . ': <b>' . count($bundle) . '</b>
                    </div>'; if (0 < count($bundle)) { foreach ($bundle as $i => $value) { foreach ($value as $j => $value2) { if ($bundle[$i][$j] === null) { $bundle[$i][$j] = ''; } $bundle[$i][$j] = str_replace('<', '&lt;', $bundle[$i][$j]); $bundle[$i][$j] = str_replace('>', '&gt;', $bundle[$i][$j]); if ( ( 'log_time' == $j || 'created_at' == $j || 'accepted_at' == $j ) && '' != $bundle[$i][$j] ) { $bundle[$i][$j] .= '<br><b>' . date('d.m.Y H:i:s', $bundle[$i][$j]) . '</b>'; } } } $arrayFields = []; foreach ($bundle[0] as $i => $value) { $arrayFields[] = [ 'EL' => $i, 'NAME' => $i ]; } $table = new Table(); $content .= $table->show($bundle, $arrayFields); } } } return $content; } private static function phpinfo(): void { OperatorAccess::verifyRight(OperatorAccess::RIGHT_SETTING); echo phpinfo(); Central::exitPoint(); } private static function verifikFiles(): string { OperatorAccess::verifyRight(OperatorAccess::RIGHT_SETTING); $content = '
            <a href="?core_section=settings_main&item_id=' . self::ITEM_99 . '"><i class="us-icon fa-chevron-left"></i>' . Lang::getPhrase( 1443 ) . '</a><br>
            <div class="label_h2">' . Lang::getPhrase(3288) . '</div>
            ver: <b>' . Central::$currentVer . '</b><br>'; $responce = self::verifikator(); if ('ERROR' == $responce['result']) { $content .= '
                    <div class="div_bold red_text div_space">
                        ' . $responce['error_text'] . '
                    </div>'; } else { if (0 < count($responce['ArrayBad'])) { $content .= '
                    <div class="label_h3 red_text">
                        ' . Lang::getPhrase(3292) . '
                    </div>'; $field = [ [ 'SPECIAL' => '_number' ], [ 'NAME' => Lang::getPhrase(3293), 'EL' => 'name' ], [ 'NAME' => Lang::getPhrase(3295), 'ALIGN' => 'right', 'CONVERT' => 'floor2', 'EL' => 'size' ], [ 'NAME' => Lang::getPhrase(3297), 'CONVERT' => 'daten', 'EL' => 'date' ] ]; $table = new Table(); $table->sortDefault = 'name'; $table->isSortDefaultAbc = 1; $content .= $table->show($responce['ArrayBad'], $field); } $content .= '
                ' . Lang::getPhrase(3298) . ': <b>' . (count( $responce['ArrayGood'] ) + count($responce['ArrayBad'])) . '</b><br>
                ' . Lang::getPhrase(3299) . ': <b>' . count($responce['ArrayGood']) . '</b><br>
                ' . Lang::getPhrase(3300) . ': <b>' . count($responce['ArrayBad']) . '</b><br>'; } return $content; } private static function verifikator(): array { $arrayBad = []; $arrayGood = []; $filename = realpath(__DIR__) . '/../../../../.checksum'; if (file_exists($filename) == false) { return [ 'result' => 'ERROR', 'error_text' => Lang::getPhrase( 3290 ) . ' ' . $filename . '<br>' . Lang::getPhrase( 3291 ) ]; } else { $file = fopen($filename, "r"); while (!feof($file)) { $string = trim(fgets($file)); if (strlen($string) > 32) { $crc = substr($string, 0, 32); $filePath = trim(substr($string, 33, strlen($string))); if ('/.release' != $filePath) { $fileSrc = realpath(__DIR__) . '/../../../..' . $filePath; if (file_exists($fileSrc) == false) { $sizeSrc = 0; $dateSrc = 0; $crcSrc = ''; } else { $sizeSrc = filesize($fileSrc); $dateSrc = filemtime($fileSrc); $crcSrc = md5(file_get_contents($fileSrc)); } if ($crcSrc != $crc) { $arrayBad[] = [ 'name' => $filePath, 'size' => $sizeSrc, 'date' => date('Y-m-d H:i:s', $dateSrc) ]; } else { $arrayGood[] = [ 'name' => $filePath . ' - OK', 'size' => $sizeSrc, 'date' => date('Y-m-d H:i:s', $dateSrc) ]; } } } } fclose($file); } return [ 'result' => 'OK', 'ArrayGood' => $arrayGood, 'ArrayBad' => $arrayBad ]; } private static function objectMarkDelete(): void { if (Central::$isUSOnline === false) { OperatorAccess::verifyRight(OperatorAccess::RIGHT_SETTING); } $id = RequestData::$id; if ( Central::$isUSOnline === true && TagAR::findOne($id)->getAuthorEmployeeId() != Html::$currentEmployeeId ) { Html::locationForbidden(); } if (TagAR::findOne($id)->tryDelete() !== true) { Html::locationBackCancel(); } else { Html::location( '?core_section=' . BodyHtml::SECTION_SETTINGS_MAIN . '&action=' . self::A_OBJECT_MARK_PAGE, 'updok' ); } } private static function objectMarkSave(): void { if (Central::$isUSOnline === false) { OperatorAccess::verifyRight(OperatorAccess::RIGHT_SETTING); } $id = RequestData::$id; $name = RequestData::custom('name'); if ($id < 1) { $tag = TagAR::create($name); $id = $tag->getId(); } else { $tag = TagAR::findOne($id); } if ( Central::$isUSOnline === true && $tag->getAuthorEmployeeId() !== Html::$currentEmployeeId ) { Html::locationForbidden(); } $objectArray = TagsObjectTypesAR::getObjectListByTagId($id); $array = $_REQUEST['object_types'] ?? []; foreach ($array as $idx) { if (isset($objectArray[$idx])) { $objectArray[$idx]['is_use'] = true; } else { TagsObjectTypesAR::create($id, $idx); } } $array = $_REQUEST['object_type_nodes'] ?? []; foreach ($array as $objectTypeSecond) { $idx = TagObjectAR::OBJECT_TYPE_NODE . '-' . $objectTypeSecond; if (isset($objectArray[$idx])) { $objectArray[$idx]['is_use'] = true; } else { TagsObjectTypesAR::create( tagId: $id, objectType: TagObjectAR::OBJECT_TYPE_NODE, objectTypeSecond: $objectTypeSecond ); } } $array = $_REQUEST['object_type_cable_lines'] ?? []; foreach ($array as $objectTypeSecond) { $idx = TagObjectAR::OBJECT_TYPE_CABLE_LINE . '-' . $objectTypeSecond; if (isset($objectArray[$idx])) { $objectArray[$idx]['is_use'] = true; } else { TagsObjectTypesAR::create( tagId: $id, objectType: TagObjectAR::OBJECT_TYPE_CABLE_LINE, objectTypeSecond: $objectTypeSecond ); } } $array = $_REQUEST['object_type_devices'] ?? []; foreach ($array as $objectTypeSecond) { $idx = TagObjectAR::OBJECT_TYPE_DEVICE . '-' . $objectTypeSecond; if (isset($objectArray[$idx])) { $objectArray[$idx]['is_use'] = true; } else { TagsObjectTypesAR::create( tagId: $id, objectType: TagObjectAR::OBJECT_TYPE_DEVICE, objectTypeSecond: $objectTypeSecond ); } } foreach ($objectArray as $value) { if (!isset($value['is_use'])) { TagsObjectTypesAR::removeByObjectType( tagId: $id, objectType: $value['object_type'], objectTypeSecond: $value['object_type_second'] ); } } $lineType = RequestData::custom('property_line'); $color = RequestData::customColor('property_color'); if ('' != $color) { $color = '#' . $color; } $textColor = RequestData::customColor('property_text_color'); if ('' != $textColor) { $textColor = '#' . $textColor; } $styleArray = [ 'COLOR' => $color, 'TEXT_COLOR' => $textColor, 'LINE' => $lineType ]; $tag->edit( [ TagAR::F_NAME => $name, TagAR::F_IS_ON_MAP_BY_DEFAULT => RequestData::customBoolean('onmapdef'), TagAR::F_EXTERIOR => json_encode($styleArray) ] ); AttachHtml::save(AttachmentAR::TYPE_TAG, $id, 0, 1); EmployeeActionLogSystem::writeLog(EmployeeHistoryType::T376, TagAR::OBJECT_TYPE_ID, $id); Html::location( '?core_section=' . BodyHtml::SECTION_SETTINGS_MAIN . '&action=' . self::A_OBJECT_MARK_DIALOG_EDIT . '&id=' . $id, 'updok' ); } private static function useTagLabel(array $useArray, int $objectType, bool $isAdditional = false): string { if (isset($useArray[$objectType])) { $label = ' <i><b>(' . $useArray[$objectType]; if ($isAdditional === true) { $label .= '*'; } $label .= ')</b></i>'; return $label; } return ''; } private static function objectMarkDialogAddEdit(): string { if (Central::$isUSOnline === false) { OperatorAccess::verifyRight(OperatorAccess::RIGHT_SETTING); } $id = RequestData::$id; $property = []; if ($id > 0) { $property = TagCache::getStyle($id); $tag = TagAR::findOne($id); if ( Central::$isUSOnline === true && $tag->getAuthorEmployeeId() != Html::$currentEmployeeId ) { Html::locationForbidden(); } } else { $tag = new TagAR(); } $textColor = $property['TEXT_COLOR'] ?? ''; $color = $property['COLOR'] ?? ''; $lineType = $property['LINE'] ?? ''; $content = '
            <a href="?core_section=' . BodyHtml::SECTION_SETTINGS_MAIN . '&action=' . self::A_OBJECT_MARK_PAGE . '"><i class="us-icon fa-chevron-left"></i>' . Lang::getPhrase( 893 ) . '</a><br>
            <br>
            <span class="label_h2">' . Lang::getPhrase(3745) . '</span><br>'; if ($id > 0) { $imageId = TagCache::getImageById($id); if ($imageId > 0) { $content .= '
                        <br>
                        <div class="div_center">
                            <img src="' . AttachmentAR::getViewUrl($imageId) . '" alt="' . Lang::getPhrase( 3018 ) . '"></a><br>
                            <br>'; $content .= ' ' . BodyHtml::linkConfirm( '?core_section=settings_main&action=tag_delete_image&id=' . $id, Lang::getPhrase(1415), Lang::getPhrase(1150) . '?', '<i class="us-icon us-icon-danger fa-close"></i>' . Lang::getPhrase(1415) , 'linkConfirmDeleteTagImageId' ); $content .= '
                        </div>'; } } $content .= '
            <form name="form1" method="post" enctype="multipart/form-data" action="">
                <input type="hidden" name="core_section" value="' . BodyHtml::SECTION_SETTINGS_MAIN . '">
                <input type="hidden" name="action" value="' . self::A_OBJECT_MARK_SAVE . '">
                <input type="hidden" name="id" value="' . $id . '">
                <div class="table_block">
                    <div class="item">
                        <div class="left_data">
                            ' . Lang::getPhrase(1451) . ':
                        </div>
                        <div>
                            <input name="name" type="text" size=30 maxlength=255 class="input_box" value=\'' . ($id > 0 ? TagCache::getNameById( $id ) : '') . '\'>
                        </div>
                    </div>
                    <div class="item">
                        <div class="left_data">
                            ' . Lang::getPhrase(847) . ':
                        </div>
                        <div>
                            <input type="file" name="attach_file[]">
                        </div>
                    </div>
                    <div class="item">
                        <div class="left_data">
                            ' . Lang::getPhrase(3748) . ':
                        </div>
                        <div>
                            <script src="../main/js/icolorpicker.js?t=' . time() . '"></script>
                            <input id="property_color_id" name="property_color" type="text" size=10 maxlength=7 class="input_field iColorPicker" value="' . $color . '">
                        </div>
                    </div>
                     <div class="item">
                        <div class="left_data">
                            ' . Lang::getPhrase(1110) . ':<br>
                            <span class="info_block">' . Lang::getPhrase(6139) . '</span>
                        </div>
                        <div>
                            <input id="property_text_color_id" name="property_text_color" type="text" size=10 maxlength=7 class="input_field iColorPicker" value="' . $textColor . '">
                        </div>
                    </div>
                    <div class="item">
                        <div class="left_data">
                            ' . Lang::getPhrase(5006) . ':
                        </div>
                        <div>
                            <select name="onmapdef" size="1">
                                <option value="0"></option>
                                <option value="1"'; if ($id > 0 && true === $tag->getIsOnMapByDefault()) { $content .= ' selected'; } $content .= '>' . Lang::getPhrase(5007) . '</option>
                            </select>
                        </div>
                    </div>
                    <div class="item">
                        <div class="left_data">
                            ' . Lang::getPhrase(3749) . ':
                        </div>
                        <div>
                            <select name="property_line" size="1">
                                <option value="0">' . Lang::getPhrase(3750) . '</option>
                                <option value="1"'; if (1 == $lineType) { $content .= ' selected'; } $content .= '>' . Lang::getPhrase(3751) . '</option>
                                <option value="2"'; if (2 == $lineType) { $content .= ' selected'; } $content .= '>' . Lang::getPhrase(3761) . '</option>
                            </select>
                        </div>
                    </div>'; $objectArray = TagsObjectTypesAR::getObjectListByTagId($id); $content .= '
                    <div class="item">
                        <div class="left_data">
                            ' . Lang::getPhrase(4339) . ':
                        </div>
                        <div>'; $useArray = []; $tempArray = TagObjectAR::find() ->where( [ TagObjectAR::F_TAG_ID => $id ] ) ->asArray() ->all(); foreach ($tempArray as $value) { $useArray[$value[TagObjectAR::F_OBJECT_TYPE]] = isset($useArray[$value[TagObjectAR::F_OBJECT_TYPE]]) ? ++$useArray[$value[TagObjectAR::F_OBJECT_TYPE]] : 1; } if (Central::$isUSOnline === false) { if (Central::$erpProfileChapters[ErpProfileDto::CHAPTER_CUSTOMER]) { $content .= '
                            <input name="object_types[]" type="checkbox" value="' . TagObjectAR::OBJECT_TYPE_CUSTOMER . '"'; if (isset($objectArray[TagObjectAR::OBJECT_TYPE_CUSTOMER])) { $content .= ' checked'; } $content .= '> ' . CustomerAR::classCaption() . self::useTagLabel( $useArray, TagObjectAR::OBJECT_TYPE_CUSTOMER ) . '<br>'; } if (Central::$erpProfileChapters[ErpProfileDto::CHAPTER_TASK]) { $content .= '
                            <input name="object_types[]" type="checkbox" value="' . TagObjectAR::OBJECT_TYPE_TASK . '"'; if (isset($objectArray[TagObjectAR::OBJECT_TYPE_TASK])) { $content .= ' checked'; } $content .= '> ' . TaskAR::classCaption() . self::useTagLabel( $useArray, TagObjectAR::OBJECT_TYPE_TASK ) . '<br>'; } } if (Central::$erpProfileChapters[ErpProfileDto::CHAPTER_MAP]) { $content .= '
                            <input name="object_types[]" type="checkbox" value="' . TagObjectAR::OBJECT_TYPE_BUILDING . '"'; if (isset($objectArray[TagObjectAR::OBJECT_TYPE_BUILDING])) { $content .= ' checked'; } $content .= '> ' . BuildingAR::classCaption() . self::useTagLabel( $useArray, TagObjectAR::OBJECT_TYPE_BUILDING ) . '<br>'; } $expr = ''; if (Central::$isUSOnline === true) { $expr = [ CableLineTypeAR::F_AUTHOR_EMPLOYEE_ID => Html::$currentEmployeeId ]; } if (Central::$erpProfileChapters[ErpProfileDto::CHAPTER_NODE]) { $nodeTypes = NodeTypeAR::find() ->where($expr) ->orderBy( [ NodeTypeAR::F_NAME => SORT_ASC ] ) ->all(); foreach ($nodeTypes as $nodeType) { $content .= '
                            <input name="object_type_nodes[]" type="checkbox" value="' . $nodeType->getId() . '"'; if (isset($objectArray[TagObjectAR::OBJECT_TYPE_NODE . '-' . $nodeType->getId()])) { $content .= ' checked'; } $content .= '> ' . NodeAR::classCaption() . ':  ' . NodeTypeCache::getName( $nodeType->getId() ) . self::useTagLabel( $useArray, TagObjectAR::OBJECT_TYPE_NODE, true ) . '<br>'; } } if (Central::$erpProfileChapters[ErpProfileDto::CHAPTER_CABLE_LINE]) { $expr = ''; if (Central::$isUSOnline === true) { $expr = [ CableLineTypeAR::F_AUTHOR_EMPLOYEE_ID => Html::$currentEmployeeId ]; } $cableLineTypes = CableLineTypeAR::find() ->where($expr) ->orderBy( [ CableLineTypeAR::F_NAME => SORT_ASC ] ) ->all(); foreach ($cableLineTypes as $cableLineType) { $content .= '
                            <input name="object_type_cable_lines[]" type="checkbox" value="' . $cableLineType->getId( ) . '"'; if (isset($objectArray[TagObjectAR::OBJECT_TYPE_CABLE_LINE . '-' . $cableLineType->getId()])) { $content .= ' checked'; } $content .= '> ' . CableLineAR::classCaption() . ': ' . CableLineTypeCache::getName( $cableLineType->getId() ) . self::useTagLabel( $useArray, TagObjectAR::OBJECT_TYPE_CABLE_LINE, true ) . '<br>'; } } if ( Central::$isUSOnline === false && Central::$erpProfileChapters[ErpProfileDto::CHAPTER_DEVICE] ) { $content .= '
                            <input name="object_type_devices[]" id="checkDevice' . InventorySectionAR::T_0_OTHER . 'Id" type="checkbox" value="0"'; if (isset($objectArray[TagObjectAR::OBJECT_TYPE_DEVICE . '-' . InventorySectionAR::T_0_OTHER])) { $content .= ' checked'; } $content .= '> ' . DeviceAR::classCaption() . ': ' . Lang::getPhrase( 633 ) . self::useTagLabel($useArray, TagObjectAR::OBJECT_TYPE_DEVICE, true) . '<br>
                            <input name="object_type_devices[]" id="checkDevice' . InventorySectionAR::T_1_SWITCH . 'Id" type="checkbox" value="' . InventorySectionAR::T_1_SWITCH . '"'; if (isset($objectArray[TagObjectAR::OBJECT_TYPE_DEVICE . '-' . InventorySectionAR::T_1_SWITCH])) { $content .= ' checked'; } $content .= '> ' . DeviceAR::classCaption() . ': ' . Lang::getPhrase( 627 ) . self::useTagLabel($useArray, TagObjectAR::OBJECT_TYPE_DEVICE, true) . '<br>
                            <input name="object_type_devices[]" id="checkDevice' . InventorySectionAR::T_2_RADIO . 'Id" type="checkbox" value="' . InventorySectionAR::T_2_RADIO . '"'; if (isset($objectArray[TagObjectAR::OBJECT_TYPE_DEVICE . '-' . InventorySectionAR::T_2_RADIO])) { $content .= ' checked'; } $content .= '> ' . DeviceAR::classCaption() . ': ' . Lang::getPhrase( 1553 ) . self::useTagLabel($useArray, TagObjectAR::OBJECT_TYPE_DEVICE, true) . '<br>
                            <input name="object_type_devices[]" id="checkDevice' . InventorySectionAR::T_3_MEDIC . 'Id" type="checkbox" value="' . InventorySectionAR::T_3_MEDIC . '"'; if (isset($objectArray[TagObjectAR::OBJECT_TYPE_DEVICE . '-' . InventorySectionAR::T_3_MEDIC])) { $content .= ' checked'; } $content .= '> ' . DeviceAR::classCaption() . ': ' . Lang::getPhrase( 628 ) . self::useTagLabel($useArray, TagObjectAR::OBJECT_TYPE_DEVICE, true) . '<br>
                            <input name="object_type_devices[]" id="checkDevice' . InventorySectionAR::T_16_CUSTOM . 'Id" type="checkbox" value="' . InventorySectionAR::T_16_CUSTOM . '"'; if (isset($objectArray[TagObjectAR::OBJECT_TYPE_DEVICE . '-' . InventorySectionAR::T_16_CUSTOM])) { $content .= ' checked'; } $content .= '> ' . DeviceAR::classCaption() . ': ' . Lang::getPhrase( 5018 ) . self::useTagLabel( $useArray, TagObjectAR::OBJECT_TYPE_DEVICE, true ) . '<br>'; } if (Central::$erpProfileChapters[ErpProfileDto::CHAPTER_CABLE_LINE]) { $content .= '
                            <input name="object_types[]" type="checkbox" value="' . TagObjectAR::OBJECT_TYPE_CROSS . '"'; if (isset($objectArray[TagObjectAR::OBJECT_TYPE_CROSS])) { $content .= ' checked'; } $content .= '> ' . CrossAR::classCaption() . self::useTagLabel($useArray, TagObjectAR::OBJECT_TYPE_CROSS) . '<br>

                            <input name="object_types[]" type="checkbox" value="' . TagObjectAR::OBJECT_TYPE_SPLITTER . '"'; if (isset($objectArray[TagObjectAR::OBJECT_TYPE_SPLITTER])) { $content .= ' checked'; } $content .= '> ' . SplitterAR::classCaption() . self::useTagLabel( $useArray, TagObjectAR::OBJECT_TYPE_SPLITTER ) . '<br>
            
                            <input name="object_types[]" type="checkbox" value="' . TagObjectAR::OBJECT_TYPE_MULTIPLEXER . '"'; if (isset($objectArray[TagObjectAR::OBJECT_TYPE_MULTIPLEXER])) { $content .= ' checked'; } $content .= '> ' . MultiplexerAR::classCaption() . self::useTagLabel( $useArray, TagObjectAR::OBJECT_TYPE_MULTIPLEXER ) . '<br>'; $content .= '
                            <input name="object_types[]" type="checkbox" value="' . TagObjectAR::OBJECT_TYPE_CABLE_ROUTE . '"'; if (isset($objectArray[TagObjectAR::OBJECT_TYPE_CABLE_ROUTE])) { $content .= ' checked'; } $content .= '> ' . CableRouteAR::classCaption() . self::useTagLabel( $useArray, TagObjectAR::OBJECT_TYPE_CABLE_ROUTE ) . '<br>

                            <input name="object_types[]" type="checkbox" value="' . TagObjectAR::OBJECT_TYPE_CABLE_LINE_TRUNK . '"'; if (isset($objectArray[TagObjectAR::OBJECT_TYPE_CABLE_LINE_TRUNK])) { $content .= ' checked'; } $content .= '> ' . CableLineTrunkAR::classCaption() . self::useTagLabel( $useArray, TagObjectAR::OBJECT_TYPE_CABLE_LINE_TRUNK ) . '<br>'; } if (Central::$erpProfileChapters[ErpProfileDto::CHAPTER_NODE]) { $content .= '
                            <input name="object_types[]" type="checkbox" value="' . TagObjectAR::OBJECT_TYPE_RACK . '"'; if (isset($objectArray[TagObjectAR::OBJECT_TYPE_RACK])) { $content .= ' checked'; } $content .= '> ' . RackSystem::classCaption() . self::useTagLabel( $useArray, TagObjectAR::OBJECT_TYPE_RACK ) . '<br>'; } $content .= '

                        </div>
                    </div>
                </div>
                ' . BodyHtml::formButton( 'save_cancel', '?core_section=' . BodyHtml::SECTION_SETTINGS_MAIN . '&action=' . self::A_OBJECT_MARK_PAGE ) . '
            </form>'; if ($id > 0) { $count = TagObjectAR::find() ->where( [ TagObjectAR::F_TAG_ID => $id ] ) ->count(); if (0 < $count) { $content .= '
                    <div class="div_space">            
                        <span class="info_block">' . Lang::getPhrase(6074) . ': <b>' . $count . '</b></span>
                    </div>
                    <br>'; } $smsListConditionsDto = Yii::$container ->get(SmsListConditionFetcher::class) ->getByCondition( [ SmsListConditionDto::F_CONDITION_TYPE => SmsListConditionDto::CONDITION_TYPE_TAG, SmsListConditionDto::F_BODY => $id, ] ); foreach ($smsListConditionsDto as $smsListConditionDto) { $content .= '
                    <div class="div_space">            
                        <span class="info_block">' . Lang::getPhrase( 6074 ) . ': <a href="?core_section=' . BodyHtml::SECTION_SMS_LIST . '&action=dialog_edit&id=' . $smsListConditionDto->smslist_id . '"><b>' . Lang::getPhrase( 592 ) . '</b></a></span>
                    </div>
                    <br>'; } $content .= ' ' . BodyHtml::linkConfirm( url: '?core_section=' . BodyHtml::SECTION_SETTINGS_MAIN . '&action=' . self::A_OBJECT_MARK_DELETE . '&id=' . $id, caption: Lang::getPhrase(1415), confirmText: Lang::getPhrase(1150) . '?', linkBodyFull: '<i class="us-icon us-icon-danger fa-close"></i>' . Lang::getPhrase(1415) , linkTextId: 'linkConfirmDeleteMarkId' ); } return $content; } private static function objectMarkPage(): string { if (Central::$isUSOnline === false) { OperatorAccess::verifyRight(OperatorAccess::RIGHT_SETTING); } $content = '
                <a href="?core_section=settings_main&item_id=' . self::ITEM_4 . '"><i class="us-icon fa-chevron-left"></i>' . Lang::getPhrase( 1443 ) . '</a><br>
                <div class="label_h2">' . TagAR::classCaption() . '</div>
                <a id="linkAddId" href="?core_section=' . BodyHtml::SECTION_SETTINGS_MAIN . '&action=' . self::A_OBJECT_MARK_DIALOG_ADD . '"><i class="us-icon fa-plus"></i>' . Lang::getPhrase( 841 ) . '</a><br>'; $expr = ''; if (Central::$isUSOnline === true) { $expr = [ TagAR::F_AUTHOR_EMPLOYEE_ID => Html::$currentEmployeeId ]; } $data = []; $layers = TagAR::find() ->where($expr) ->all(); foreach ($layers as $layer) { $data[$layer->getId()] = [ 'id' => $layer->getId(), 'name' => TagCache::getNameById($layer->getId()) ]; $textColor = TagCache::getTextColorById($layer->getId()); $color = TagCache::getColorById($layer->getId()); if ($textColor === '') { $textColor = '#fff'; } if ($color === '') { $color = '#000'; } $data[$layer->getId()][101] = 'color: ' . $textColor . ';'; $data[$layer->getId()][101] .= 'background: ' . $color . ';'; $imageId = TagCache::getImageById($layer->getId()); if ($imageId > 0) { $data[$layer->getId()]['image'] = '<img src="' . AttachmentAR::getViewUrl( $imageId ) . '" alt="' . Lang::getPhrase( 3018 ) . '">'; } } $field = [ [ 'SPECIAL' => '_number' ], [ 'ALIGN' => 'center', 'EL' => 'image' ], [ 'NAME' => Lang::getPhrase(1451), 'ISSORT' => 1, 'ISSORTABC' => 1, 'EL' => 'name' ] ]; $table = new Table(); $table->link = '?core_section=' . BodyHtml::SECTION_SETTINGS_MAIN . '&action=' . self::A_OBJECT_MARK_DIALOG_EDIT . '&id='; $table->sortDefault = 'name'; $table->isSortDefaultAbc = 1; $table->elementWithStyle = 101; $content .= $table->show($data, $field); return $content; } private static function tagDeleteImage(): void { OperatorAccess::verifyRight(OperatorAccess::RIGHT_SETTING); $id = RequestData::$id; TagAR::deleteImage($id); Html::location('?core_section=settings_main&action=object_mark_dialog_edit&id=' . $id, 'updok'); } private static function addObjectLimitData($caption, $objCount, $maxLimit = 0, $limitLink = ''): string { if ( $maxLimit < 1 && Central::$isUSOnline === false ) { $maxLimit = Central::$erpLimitCounter; } if ($limitLink != '') { $caption = '<a href="' . $limitLink . '">' . $caption . '</a>'; } $content = '
            <div class="item">
                <div style="text-align: right">
                    ' . $caption . ':
                </div>
                <div>
                    <b>' . $objCount . '</b> &nbsp; '; if ($maxLimit > $objCount) { $content .= '<span class="green_text">(+' . ($maxLimit - $objCount) . ')</span>'; } if ($maxLimit < $objCount) { $content .= '<span class="red_text">(' . ($maxLimit - $objCount) . ')</span>'; } $content .= '
                </div>
            </div>'; return $content; } public static function tableSettingList($url = '?core_section=settings_main&action=table_property'): string { $profileRight = Html::$currentEmployeeRight; $content = ''; $isRightSetting = OperatorAccess::isAccess(OperatorAccess::RIGHT_SETTING); if ( 1 != SettingAR::getByNameInt(SettingsCatalog::IS_EMPLOYEE_TABLE_SET) && 1 != $isRightSetting ) { Html::locationCancel(); } $arrayTable = []; if ( Central::$erpProfileChapters[ErpProfileDto::CHAPTER_CABLE_LINE] && ( 1 == $isRightSetting || true === FiberHtml::verifySectionRight('read', false) ) ) { $cableLineTypes = CableLineTypeAR::find() ->orderBy(CableLineTypeAR::F_NAME) ->all(); foreach ($cableLineTypes as $cableLineType) { if (true == FiberHtml::verifyRight($cableLineType->getId(), 'read', false)) { $arrayTable[] = [ 'id' => EmployeeTableSettingDto::KAT_CABLE_LINE_TYPE . $cableLineType->getId(), 'name' => CableLineAR::classCaption() . ' - ' . CableLineTypeCache::getName( $cableLineType->getId() ) ]; } } $arrayTable[] = [ 'id' => EmployeeTableSettingDto::KAT_CABLE_LINE_ROUTE, 'name' => CableLineTrunkAR::classCaption() ]; $arrayTable[] = [ 'id' => EmployeeTableSettingDto::KAT_CABLE_DUCT, 'name' => CableDuctAR::classCaption() ]; } if ( Central::$erpProfileChapters[ErpProfileDto::CHAPTER_DEVICE] && ( 1 == $isRightSetting || isset($profileRight[EmployeeProfileAR::T_INVENTORY_SECTION_TYPE][InventorySectionAR::T_1_SWITCH]) ) ) { $arrayTable[] = [ 'id' => EmployeeTableSettingDto::KAT_DEVICE_SWITCH, 'name' => Lang::getPhrase(627) ]; } if ( Central::$erpProfileChapters[ErpProfileDto::CHAPTER_DEVICE] && ( 1 == $isRightSetting || isset($profileRight[EmployeeProfileAR::T_INVENTORY_SECTION_TYPE][InventorySectionAR::T_2_RADIO]) ) ) { $arrayTable[] = [ 'id' => EmployeeTableSettingDto::KAT_DEVICE_RADIO, 'name' => Lang::getPhrase(1553) ]; } if ( Central::$erpProfileChapters[ErpProfileDto::CHAPTER_TASK] && ( 1 == $isRightSetting || 1 == OperatorAccess::isAccess(OperatorAccess::RIGHT_TASK_READ) ) ) { $arrayTable[] = [ 'id' => EmployeeTableSettingDto::KAT_TASK, 'name' => Lang::getPhrase(638) ]; $arrayTable[] = [ 'id' => EmployeeTableSettingDto::KAT_TASK_XLS, 'name' => Lang::getPhrase(638) . ' (Excel)' ]; } if ( 1 == $isRightSetting || 1 == OperatorAccess::isAccess(OperatorAccess::RIGHT_EMPLOYEE) ) { $arrayTable[] = [ 'id' => EmployeeTableSettingDto::KAT_STAFF, 'name' => EmployeePropertyAR::classCaption() ]; $arrayTable[] = [ 'id' => EmployeeTableSettingDto::KAT_EMPLOYEE_TIMESHEET, 'name' => Lang::getPhrase(655) ]; $arrayTable[] = [ 'id' => EmployeeTableSettingDto::KAT_TRANSPORT, 'name' => TransportAR::classCaption() ]; } if ( Central::$erpProfileChapters[ErpProfileDto::CHAPTER_CUSTOMER] && ( 1 == $isRightSetting || 1 == OperatorAccess::isAccess(OperatorAccess::RIGHT_CUSTOMER_LIST) ) ) { $arrayTable[] = [ 'id' => EmployeeTableSettingDto::KAT_CUSTOMER, 'name' => CustomerAR::classCaption() ]; $arrayTable[] = [ 'id' => EmployeeTableSettingDto::KAT_CUSTOMER_BUILDING, 'name' => CustomerAR::classCaption() . ' (' . Lang::getPhrase( 5566 ) . ')' ]; $arrayTable[] = [ 'id' => EmployeeTableSettingDto::KAT_CUSTOMER_TARIFF_REQUEST, 'name' => CustomerAR::classCaption() . ' (' . Lang::getPhrase(615) . ')' ]; } $isNodeRight = false; $nodeTypes = NodeTypeAR::find() ->orderBy(NodeTypeAR::F_NAME) ->all(); foreach ($nodeTypes as $nodeType) { if ( Central::$erpProfileChapters[ErpProfileDto::CHAPTER_NODE] && ( 1 == $isRightSetting || true === NodeHtml::verifyRight($nodeType->getId(), 'read', false) ) ) { $isNodeRight = true; $arrayTable[] = [ 'id' => EmployeeTableSettingDto::KAT_NODE_TYPE . $nodeType->getId(), 'name' => NodeAR::classCaption() . ' - ' . NodeTypeCache::getName($nodeType->getId()) ]; } } if ( Central::$erpProfileChapters[ErpProfileDto::CHAPTER_CABLE_LINE] && ( 1 == $isRightSetting || isset($profileRight[EmployeeProfileAR::T_CROSS]) ) ) { $arrayTable[] = [ 'id' => EmployeeTableSettingDto::KAT_CROSS, 'name' => CrossAR::classCaption() ]; } if ( Central::$erpProfileChapters[ErpProfileDto::CHAPTER_CABLE_LINE] && ( 1 == $isRightSetting || isset($profileRight[EmployeeProfileAR::T_SPLITTER]) ) ) { $arrayTable[] = [ 'id' => EmployeeTableSettingDto::KAT_SPLITTER, 'name' => SplitterAR::classCaption() ]; } if ( Central::$erpProfileChapters[ErpProfileDto::CHAPTER_DEVICE] && ( 1 == $isRightSetting || isset($profileRight[EmployeeProfileAR::T_DEVICE][EmployeeProfileAR::T2_DEVICE_VLAN]) ) ) { $arrayTable[] = [ 'id' => EmployeeTableSettingDto::KAT_VLAN, 'name' => VlanSystem::classCaption() ]; } if ( Central::$erpProfileSubChapters[ErpProfileDto::SUB_CHAPTER_MAP_KEY] && ( 1 == $isRightSetting || 1 == OperatorAccess::isAccess(OperatorAccess::RIGHT_KEY) ) ) { $arrayTable[] = [ 'id' => EmployeeTableSettingDto::KAT_KEYS, 'name' => KeyAR::classCaption() ]; } if ( Central::$erpProfileSubChapters[ErpProfileDto::SUB_CHAPTER_MAP_OWNER] && ( 1 == $isRightSetting || 1 == OperatorAccess::isAccess(OperatorAccess::RIGHT_MAP) ) ) { $arrayTable[] = [ 'id' => EmployeeTableSettingDto::KAT_OWNERS, 'name' => OwnerAR::classCaption() ]; } if ( Central::$erpProfileChapters[ErpProfileDto::CHAPTER_NODE] && true === $isNodeRight ) { $arrayTable[] = [ 'id' => EmployeeTableSettingDto::KAT_RACK, 'name' => RackSystem::classCaption() ]; } if ( Central::$erpProfileChapters[ErpProfileDto::CHAPTER_WAREHOUSE] && ( 1 == $isRightSetting || 1 == OperatorAccess::isAccess(OperatorAccess::RIGHT_INVENTORY) ) ) { $arrayTable[] = [ 'id' => EmployeeTableSettingDto::KAT_INVENTORY, 'name' => InventoryAR::classCaption() ]; } $arrayTable = Central::sort( data: $arrayTable, sortElement: 'name', isSortAbc: true ); foreach ($arrayTable as $value) { $content .= '
                <div class="div_space">
                    <a id="linkSetSet' . $value['id'] . 'Id" href="' . $url . '&id=' . $value['id'] . '"><i class="us-icon fa-bars"></i>' . $value['name'] . '</a>
                </div>'; } return $content; } private static function editSettingsOption($section): string { EmployeePropertyAR::saveSessionCashe(EmployeePropertyAR::CACHE_36, $section); if ( Central::$isUSOnline === true && $section != self::ITEM_18 && $section != self::ITEM_98 && $section != self::ITEM_99 ) { $section = self::ITEM_98; } switch ($section) { case self::ITEM_2: $sectionName = Lang::getPhrase(720); $sectionContent = '
                    <div class="div_space">
                        <a href="?core_section=' . BodyHtml::SECTION_SETTINGS_MAIN . '&action=' . self::A_CUSTOM_PAGE_LIST . '&category=' . PageAR::CATEGORY_CUSTOMER_CABINET . '"><i class="us-icon fa-bars"></i>' . Lang::getPhrase( 3185 ) . '</a>
                    </div>
                    <br>'; $sectionContent .= SettingsHtml::propertyDialog( SettingsCatalog::CUSTOMER_IS_ACTIVE_CUSTOMER_AREA, 'VALUEINT', Lang::getPhrase(5486) ); $sectionContent .= SettingsHtml::propertyDialog( SettingsCatalog::CUSTOMER_AREA_DEFAULT_LANGUAGE, 'VALUESTR', Lang::getPhrase(3381) , '(' . Lang::getPhrase(740) . ': RU)', SettingsCatalog::CUSTOMER_IS_ACTIVE_CUSTOMER_AREA ); $sectionContent .= SettingsHtml::propertyDialog( SettingsCatalog::CUSTOMER_AREA_ENTER_TYPE, 'VALUESTR', Lang::getPhrase(5487) , '', SettingsCatalog::CUSTOMER_IS_ACTIVE_CUSTOMER_AREA ); $sectionContent .= SettingsHtml::propertyDialog( SettingsCatalog::CUSTOMER_IS_ENCRYPT_PASSWORD, 'VALUEINT', Lang::getPhrase(5491) , '', SettingsCatalog::CUSTOMER_AREA_ENTER_TYPE . ',' . SettingsCatalog::CUSTOMER_IS_ACTIVE_CUSTOMER_AREA ); $sectionContent .= SettingsHtml::propertyDialog( SettingsCatalog::CUSTOMER_IS_ALLOW_CHANGE_PASSWORD_IN_CUSTOMER_AREA, 'VALUEINT', Lang::getPhrase(5492) , '', SettingsCatalog::CUSTOMER_AREA_ENTER_TYPE . ',' . SettingsCatalog::CUSTOMER_IS_ACTIVE_CUSTOMER_AREA ); $sectionContent .= SettingsHtml::propertyDialog( SettingsCatalog::CUSTOMER_IS_ALLOW_REGISTRATION, 'VALUEINT', Lang::getPhrase(5463) , '', SettingsCatalog::CUSTOMER_IS_ACTIVE_CUSTOMER_AREA ); $sectionContent .= SettingsHtml::propertyDialog( SettingsCatalog::CUSTOMET_REGISTER_TASK_ORDER_NUMBER, 'VALUEINT', Lang::getPhrase(3691) , '', SettingsCatalog::CUSTOMER_IS_ALLOW_REGISTRATION . ',' . SettingsCatalog::CUSTOMER_IS_ACTIVE_CUSTOMER_AREA ); $sectionContent .= SettingsHtml::propertyDialog( SettingsCatalog::CUSTOMER_MSG_IS_SEND_EMAIL_ON_RECEIVE, 'VALUEINT', Lang::getPhrase(3528) , '', SettingsCatalog::CUSTOMER_IS_ACTIVE_CUSTOMER_AREA ); $sectionContent .= SettingsHtml::propertyDialog( SettingsCatalog::CUSTOMER_MSG_EMAIL_FOR_RECEIVE, 'VALUESTR', Lang::getPhrase(5493) , '(' . Lang::getPhrase(5494) . ')', SettingsCatalog::CUSTOMER_IS_ACTIVE_CUSTOMER_AREA . ',' . SettingsCatalog::CUSTOMER_MSG_IS_SEND_EMAIL_ON_RECEIVE ); $sectionContent .= SettingsHtml::propertyDialog( SettingsCatalog::CUSTOMER_MSG_EMAIL_THEME, 'VALUESTR', Lang::getPhrase(5495) , '', SettingsCatalog::CUSTOMER_IS_ACTIVE_CUSTOMER_AREA . ',' . SettingsCatalog::CUSTOMER_MSG_IS_SEND_EMAIL_ON_RECEIVE ); $sectionContent .= SettingsHtml::propertyDialog( SettingsCatalog::CUSTOMER_IS_ALLOW_DISABLE_RECEIVE_SMS, 'VALUEINT', Lang::getPhrase(5496) , '', SettingsCatalog::CUSTOMER_IS_ACTIVE_CUSTOMER_AREA ); break; case self::ITEM_3: $sectionName = Lang::getPhrase(607); $sectionContent = SettingsHtml::propertyDialog( SettingsCatalog::CUSTOMER_SUSPECT_DURATION, 'VALUESTR', Lang::getPhrase(5471) , '', '', '(' . Lang::getPhrase(2234) . ')' ); $sectionContent .= SettingsHtml::propertyDialog( SettingsCatalog::CUSTOMER_HOPELESS_DURATION, 'VALUESTR', Lang::getPhrase(5472) , '', '', '(' . Lang::getPhrase(2234) . ')' ); $sectionContent .= SettingsHtml::propertyDialog( SettingsCatalog::ACCOUNTANCY_BILLING_BALANCE, 'VALUEINT', Lang::getPhrase(4583) , '(' . Lang::getPhrase(5473) . ')' ); $sectionContent .= SettingsHtml::propertyDialog( SettingsCatalog::CUSTOMER_CHILD_BALANCE_INDIVIDUAL, 'VALUEINT', Lang::getPhrase(5179) ); $sectionContent .= SettingsHtml::propertyDialog( SettingsCatalog::CUSTOMER_IS_LOCKED_CORPORATE_CUSTOMER, 'VALUEINT', Lang::getPhrase(5474) , '(' . Lang::getPhrase(5475) . ')' ); break; case self::ITEM_4: $sectionName = Lang::getPhrase(647); $sectionContent = ''; if (Central::$erpProfileChapters[ErpProfileDto::CHAPTER_NODE]) { $sectionContent = '
                    <div class="div_space">
                        <a id="linkNodeIconListId" href="?core_section=settings_main&action=node_icon"><i class="us-icon fa-bars"></i>' . Lang::getPhrase( 4149 ) . '</a>
                    </div>'; } if (Central::$erpProfileChapters[ErpProfileDto::CHAPTER_NODE]) { $sectionContent .= '
                    <div class="div_space">
                        <a id="linkExportKmlId" href="?core_section=settings_main&action=export_to_kml"><i class="us-icon fa-bars"></i>' . Lang::getPhrase( 5649 ) . ' (EIT)</a>
                    </div>'; } $sectionContent .= '
                    <div class="div_space">
                        <a id="linkLayerId" href="?core_section=' . BodyHtml::SECTION_SETTINGS_MAIN . '&action=' . self::A_OBJECT_MARK_PAGE . '"><i class="us-icon fa-bars"></i>' . TagAR::classCaption( ) . '</a>
                    </div>'; $sectionContent .= '
                        <div class="div_space">
                            <a id="linkTilesId" href="?core_section=settings_main&action=map_tile"><i class="us-icon fa-bars"></i>' . MapTileAR::classCaption( ) . '</a>
                        </div>'; $sectionContent .= '
                    <br>'; $sectionContent .= SettingsHtml::propertyDialog( SettingsCatalog::MAP_CACHE_IS_ENABLE, 'VALUEINT', Lang::getPhrase(5430) ); $sectionContent .= SettingsHtml::propertyDialog( SettingsCatalog::BUILDING_DEFAULT_TYPE, 'VALUESTR', Lang::getPhrase(5808) , '(' . Lang::getPhrase(740) . ')' ); $sectionContent .= SettingsHtml::propertyDialog( SettingsCatalog::MAP_NEWWINDOW, 'VALUEINT', Lang::getPhrase( 3435 ) ); $sectionContent .= SettingsHtml::propertyDialog( SettingsCatalog::MAP_TIMEUPDATE, 'VALUESTR', Lang::getPhrase(5499) , '(refresh. ' . Lang::getPhrase(740) . ': 300)', '', '(' . Lang::getPhrase(5500) . ')' ); $sectionContent .= SettingsHtml::propertyDialog( SettingsCatalog::MAP_BUILDING_POLYGON_SIZE, 'VALUESTR', Lang::getPhrase(4929) , '(' . Lang::getPhrase(740) . ': 0.0005)' ); $sectionContent .= SettingsHtml::propertyDialog( SettingsCatalog::MAP_IS_OTHER_OBJECT_ON_MAP_WHEN_BUILDING_EDIT, 'VALUEINT', Lang::getPhrase(5760) ); $sectionContent .= SettingsHtml::propertyDialog( SettingsCatalog::MAP_IS_MARKER_STYLE_312, 'VALUEINT', Lang::getPhrase(5696) , '(' . Lang::getPhrase(5697) . ')' ); $sectionContent .= SettingsHtml::propertyDialog( SettingsCatalog::MAP_LABEL_CANVAS, 'VALUEINT', Lang::getPhrase(5942) ); if (Central::$erpProfileChapters[ErpProfileDto::CHAPTER_CABLE_LINE]) { $sectionContent .= SettingsHtml::propertyDialog( SettingsCatalog::MAP_SHOW_CABLE_STOCK, 'VALUEINT', Lang::getPhrase(5821) ); } if (Central::$erpProfileChapters[ErpProfileDto::CHAPTER_NODE]) { $sectionContent .= SettingsHtml::propertyDialog( SettingsCatalog::MAP_SHOW_LBL, 'VALUEINT', Lang::getPhrase(5502) , '(' . Lang::getPhrase(5503) . ')' ); $sectionContent .= SettingsHtml::propertyDialog( SettingsCatalog::MAP_SHOW_LBL_NODE_SH, 'VALUESTR', Lang::getPhrase(5398) , '(' . Lang::getPhrase(740) . ': number)', SettingsCatalog::MAP_SHOW_LBL ); $sectionContent .= SettingsHtml::propertyDialog( arg: SettingsCatalog::MAP_IS_NODE_PREVIEW, argType: 'VALUEINT', caption: Lang::getPhrase( 6104 ) ); $sectionContent .= SettingsHtml::propertyDialog( arg: SettingsCatalog::MAP_NODE_PREVIEW_SIZE, argType: 'VALUESTR', caption: Lang::getPhrase(6105), parentArg: SettingsCatalog::MAP_IS_NODE_PREVIEW ); } if (Central::$erpProfileChapters[ErpProfileDto::CHAPTER_CABLE_LINE]) { $sectionContent .= SettingsHtml::propertyDialog( arg: SettingsCatalog::MAP_IS_CABLE_LINE_TO_TOP_ON_HOVER, argType: 'VALUEINT', caption: Lang::getPhrase( 6196 ) ); } $sectionContent .= SettingsHtml::propertyDialog( SettingsCatalog::MAP_IS_SHOW_BUILDING_LABEL, 'VALUEINT', Lang::getPhrase(5504) , '(' . Lang::getPhrase(5505) . ')' ); $sectionContent .= SettingsHtml::propertyDialog( SettingsCatalog::MAP_BUILDING_LABEL_TEMPLATE, 'VALUESTR', Lang::getPhrase(5506) , '(' . Lang::getPhrase(740) . ': number)', SettingsCatalog::MAP_IS_SHOW_BUILDING_LABEL ); if (Central::$erpProfileChapters[ErpProfileDto::CHAPTER_DEVICE]) { $sectionContent .= SettingsHtml::propertyDialog( SettingsCatalog::MAP_BUILDING_ACTIVITY_BY_DEVICE, 'VALUEINT', Lang::getPhrase(5508) , '(' . Lang::getPhrase(5509) . ')' ); } $sectionContent .= SettingsHtml::propertyDialog( SettingsCatalog::ADDRESS_BUILDING_MANUAL_ADD_IS_NOT_USE, 'VALUEINT', Lang::getPhrase(6154) ); $sectionContent .= SettingsHtml::propertyDialog( SettingsCatalog::MAP_BATCH_OBJECT, 'VALUESTR', Lang::getPhrase(5834) , '(' . Lang::getPhrase(740) . ': 100)' ); $sectionContent .= '
                    <br>
                    <div class="item" style="text-align: center; font-weight: bold">
                        ' . Lang::getPhrase(5829) . '
                    </div>'; $sectionContent .= SettingsHtml::propertyDialog( SettingsCatalog::MAP_GOOGLE_API_KEY, 'VALUESTR', 'Google API Key', '<a target=_blank href="https://wiki.' . Central::$erpMainDomain . '/Google_API_Key">WiKi</a>' ); $sectionContent .= SettingsHtml::propertyDialog( SettingsCatalog::MAP_NOMINATIM, 'VALUEINT', Lang::getPhrase(5501) . ' "OpenStreetMap Nominatim"' ); $sectionContent .= SettingsHtml::propertyDialog( SettingsCatalog::MAP_YANDEX_GEO, 'VALUEINT', Lang::getPhrase(5501) . ' "Yandex Geocoder"' ); $sectionContent .= SettingsHtml::propertyDialog( SettingsCatalog::YANDEX_KEY, 'VALUESTR', 'Yandex API Key', '<a target=_blank href="https://developer.tech.yandex.ru/">developer.tech.yandex.ru</a>', SettingsCatalog::MAP_YANDEX_GEO ); $sectionContent .= SettingsHtml::propertyDialog( SettingsCatalog::IS_DADATA_GEOCODER, 'VALUEINT', Lang::getPhrase(5501) . ' "DaData.ru"' ); $sectionContent .= SettingsHtml::propertyDialog( SettingsCatalog::MAP_IS_DADATA_SEARCH, 'VALUEINT', Lang::getPhrase(5739) , '<a target=_blank href="https://dadata.ru/?ref=61885">https://dadata.ru</a>' ); $sectionContent .= SettingsHtml::propertyDialog( SettingsCatalog::DADATA_API_KEY, 'VALUESTR', 'DaData.ru API Key', '<a target=_blank href="https://dadata.ru/?ref=61885">https://dadata.ru</a>' ); $sectionContent .= SettingsHtml::propertyDialog( SettingsCatalog::DADATA_X_KEY, 'VALUESTR', 'DaData.ru SECRET Key', '<a target=_blank href="https://dadata.ru/?ref=61885">https://dadata.ru</a>' ); if (Central::$erpProfileChapters[ErpProfileDto::CHAPTER_CUSTOMER]) { $sectionContent .= '
                    <br>
                    <div class="item" style="text-align: center; font-weight: bold">
                        ' . Lang::getPhrase(5838) . '
                    </div>'; $sectionContent .= SettingsHtml::propertyDialog( SettingsCatalog::IS_BUILDING_LOGIC_SCHEME_CUSTOMER_BILLING_ICO, 'VALUEINT', Lang::getPhrase(6026) ); } break; case self::ITEM_7: $sectionName = Lang::getPhrase(624); $sectionContent = '
                        <div class="div_space">
                            <a id="linkProfileId" href="?core_section=settings_main&action=device_profile"><i class="us-icon fa-bars"></i>' . Lang::getPhrase( 4247 ) . '</a>
                        </div>
                        <div class="div_space">
                            <a id="linkSatelliteId" href="?core_section=settings_main&action=satellite"><i class="us-icon fa-bars"></i>' . Lang::getPhrase( 4959 ) . '</a>
                        </div>
                        <div class="div_space">
                            <a href="?core_section=' . BodyHtml::SECTION_SETTINGS_MAIN . '&action=' . self::A_OBJECT_MARK_PAGE . '"><i class="us-icon fa-bars"></i>' . TagAR::classCaption( ) . '</a>
                        </div>                        
                        <div class="div_space">'; $sectionContent .= ' ' . BodyHtml::linkConfirm( '?core_section=settings_main&action=device_autocommutation_on', Lang::getPhrase(5193), Lang::getPhrase(4131) . '?', '<i class="us-icon fa-wrench"></i>' . Lang::getPhrase( 5193 ) , 'linkConfirmPortOnId' ); $sectionContent .= '
                        </div>
                        <br>'; $sectionContent .= SettingsHtml::propertyDialog( SettingsCatalog::NODE_NUMBER, 'VALUEINT', Lang::getPhrase(5759) ); $sectionContent .= SettingsHtml::propertyDialog( SettingsCatalog::E_NUMBER_RULE, 'VALUEINT', Lang::getPhrase(4052) ); $sectionContent .= SettingsHtml::propertyDialog( SettingsCatalog::ADDRESS_IS_SORT_NODE_IN_BUILDING_CARD_BY_NUMBER, 'VALUEINT', Lang::getPhrase(5749) ); $sectionContent .= SettingsHtml::propertyDialog( SettingsCatalog::CROSS_ADAPTER_TYPE, 'VALUESTR', Lang::getPhrase(3317) ); $sectionContent .= SettingsHtml::propertyDialog( SettingsCatalog::CROSS_IS_ALLOW_DOUBLE_COMMUTATION, 'VALUEINT', Lang::getPhrase(5805) ); $sectionContent .= SettingsHtml::propertyDialog( SettingsCatalog::STRUCTURE_SCHEME_HOPS, 'VALUESTR', Lang::getPhrase(5826), '(' . Lang::getPhrase(740) . ': 40)' ); $sectionContent .= SettingsHtml::propertyDialog( SettingsCatalog::DEVICE_IS_SEND_ONLY_UNACTIVITY, 'VALUEINT', Lang::getPhrase(5242) , '(' . Lang::getPhrase(5243) . ')' ); $sectionContent .= SettingsHtml::propertyDialog( SettingsCatalog::IS_QR_ONE_PER_PAGE, 'VALUEINT', Lang::getPhrase(5375) ); $sectionContent .= SettingsHtml::propertyDialog( SettingsCatalog::EQUIPMENT_CARD_FAST_LINK_1, 'VALUESTR', Lang::getPhrase(5359) . ' #1' ); $sectionContent .= SettingsHtml::propertyDialog( SettingsCatalog::EQUIPMENT_CARD_FAST_LINK_2, 'VALUESTR', Lang::getPhrase(5359) . ' #2' ); $sectionContent .= SettingsHtml::propertyDialog( SettingsCatalog::EQUIPMENT_CARD_FAST_LINK_3, 'VALUESTR', Lang::getPhrase(5359) . ' #3' ); $sectionContent .= SettingsHtml::propertyDialog( SettingsCatalog::EQUIPMENT_CARD_FAST_LINK_4, 'VALUESTR', Lang::getPhrase(5359) . ' #4' ); $sectionContent .= SettingsHtml::propertyDialog( SettingsCatalog::DEVICE_IS_FAST_LINK_IN_COMMUTATION, 'VALUEINT', Lang::getPhrase( 6194 ) ); $sectionContent .= SettingsHtml::propertyDialog( SettingsCatalog::E_MAC_DEL_DAY, 'VALUESTR', Lang::getPhrase(4387) ); $sectionContent .= SettingsHtml::propertyDialog( SettingsCatalog::DEVICE_LEFT_MENU_FIND_BY_ID, 'VALUEINT', Lang::getPhrase(6151) ); $sectionContent .= SettingsHtml::propertyDialog( SettingsCatalog::DEVICE_LEFT_MENU_FIND_BY_INVENTORY_NUMBER, 'VALUEINT', Lang::getPhrase(6152) ); $sectionContent .= '
                    <br>
                    <div class="item" style="text-align: center; font-weight: bold">
                        SNMP / Telnet
                    </div>'; $sectionContent .= SettingsHtml::propertyDialog( SettingsCatalog::TELNET_NAME, 'VALUESTR', Lang::getPhrase(3321) ); $sectionContent .= SettingsHtml::propertyDialog( SettingsCatalog::TELNET_PASS, 'VALUESTR', Lang::getPhrase(3322) ); $sectionContent .= SettingsHtml::propertyDialog( SettingsCatalog::SNMP_DATA_CACHE_TIMEOUT, 'VALUESTR', 'SNMP. Data cache timeout', '(' . Lang::getPhrase(740) . ': 600)' ); $sectionContent .= SettingsHtml::propertyDialog( SettingsCatalog::SNMP_COMUNITY, 'VALUESTR', 'Default ro-community', '(' . Lang::getPhrase(740) . ': public)' ); $sectionContent .= SettingsHtml::propertyDialog( SettingsCatalog::SNMP_COMUNITY2, 'VALUESTR', 'Default rw-community', '(' . Lang::getPhrase(740) . ': private)' ); $sectionContent .= SettingsHtml::propertyDialog( SettingsCatalog::SNMP_DEFAULT_SECURITY_NAME, 'VALUESTR', 'Default v3 security name' ); $sectionContent .= SettingsHtml::propertyDialog( SettingsCatalog::SNMP_DEFAULT_SECURITY_LEVEL, 'VALUESTR', 'Default v3 security level' ); $sectionContent .= SettingsHtml::propertyDialog( SettingsCatalog::SNMP_DEFAULT_AUTH_PROTOCOL, 'VALUESTR', 'Default v3 authentification protocol' ); $sectionContent .= SettingsHtml::propertyDialog( SettingsCatalog::SNMP_DEFAULT_AUTH_PASSPHRASE, 'VALUESTR', 'Default v3 authentification passphrase' ); $sectionContent .= SettingsHtml::propertyDialog( SettingsCatalog::SNMP_DEFAULT_PRIV_PROTOCOL, 'VALUESTR', 'Default v3 privacy protocol' ); $sectionContent .= SettingsHtml::propertyDialog( SettingsCatalog::SNMP_DEFAULT_PRIV_PASSPHRASE, 'VALUESTR', 'Default v3 privacy passphrase' ); $sectionContent .= '
                    <br>
                    <div class="item" style="text-align: center; font-weight: bold">
                        PING
                    </div>'; $sectionContent .= SettingsHtml::propertyDialog( SettingsCatalog::PING_ENABLE, 'VALUEINT', Lang::getPhrase(783) ); $sectionContent .= SettingsHtml::propertyDialog( SettingsCatalog::PING_TIMEOUT, 'VALUESTR', 'Timeout', '(' . Lang::getPhrase(740) . ': 4)', SettingsCatalog::PING_ENABLE, ' (s)' ); $sectionContent .= SettingsHtml::propertyDialog( SettingsCatalog::EQUIPMENT_IS_DEVICE_PING, 'VALUEINT', Lang::getPhrase(5550) , '', SettingsCatalog::PING_ENABLE ); $sectionContent .= SettingsHtml::propertyDialog( SettingsCatalog::IS_GETMAC, 'VALUEINT', Lang::getPhrase(776) , '', SettingsCatalog::PING_ENABLE ); $sectionContent .= SettingsHtml::propertyDialog( SettingsCatalog::NIX_ARPPATH, 'VALUESTR', Lang::getPhrase(3354) . ' arp', '', SettingsCatalog::PING_ENABLE ); $sectionContent .= '
                    <br>
                    <div class="item" style="text-align: center; font-weight: bold">
                        ' . Lang::getPhrase(5534) . '
                    </div>'; $sectionContent .= SettingsHtml::propertyDialog( SettingsCatalog::DEVICE_IS_UPDATE_IFACE_INFO_IN_CARD, 'VALUEINT', Lang::getPhrase(5530) ); $sectionContent .= SettingsHtml::propertyDialog( SettingsCatalog::DEVICE_IS_IFACE_ANIMATION, 'VALUEINT', Lang::getPhrase(5539) ); $sectionContent .= SettingsHtml::propertyDialog( SettingsCatalog::EQUIP_NAME, 'VALUEINT', Lang::getPhrase(5543) , '(ifName)' ); $sectionContent .= SettingsHtml::propertyDialog( SettingsCatalog::EQUIP_PORTDESC, 'VALUEINT', Lang::getPhrase(5540) , '(ifDescr)' ); $sectionContent .= SettingsHtml::propertyDialog( SettingsCatalog::EQUIP_ERROR, 'VALUEINT', Lang::getPhrase(5542) , '(ifInErrors/ifOutErrors)' ); $sectionContent .= '
                    <br>
                    <div class="item" style="text-align: center; font-weight: bold">
                        ARP/FDB
                    </div>'; $sectionContent .= SettingsHtml::propertyDialog( SettingsCatalog::FDP_TABLETELNET, 'VALUESTR', Lang::getPhrase(5531) , '(' . Lang::getPhrase(740) . ')' ); $sectionContent .= SettingsHtml::propertyDialog( SettingsCatalog::DEVICE_IS_USE_MAC_FROM_UPLINK, 'VALUEINT', Lang::getPhrase(5535) ); $sectionContent .= SettingsHtml::propertyDialog( SettingsCatalog::DEVICE_IS_USE_MAC_FROM_DOWNLINK, 'VALUEINT', Lang::getPhrase(5536) ); $sectionContent .= SettingsHtml::propertyDialog( SettingsCatalog::DEVICE_IS_UPDATE_CUSTOMER_ACTIVITY_BY_FDB, 'VALUEINT', Lang::getPhrase(5532) ); $sectionContent .= SettingsHtml::propertyDialog( SettingsCatalog::IS_UPDATE_MAC_BY_ARP, 'VALUEINT', Lang::getPhrase( 6048 ) ); $sectionContent .= SettingsHtml::propertyDialog( SettingsCatalog::EQUIPMENT_FLOOD_COUNTER, 'VALUESTR', Lang::getPhrase(5728) , '(' . Lang::getPhrase(740) . ': 500)' ); $sectionContent .= '
                    <br>
                    <div class="item" style="text-align: center; font-weight: bold">
                        ' . Lang::getPhrase(1553) . '
                    </div>'; $sectionContent .= SettingsHtml::propertyDialog( SettingsCatalog::E_RADIO_LVL_MAX, 'VALUESTR', Lang::getPhrase(5039) ); $sectionContent .= SettingsHtml::propertyDialog( SettingsCatalog::E_RADIO_LVL_MIN, 'VALUESTR', Lang::getPhrase(5040) ); $sectionContent .= SettingsHtml::propertyDialog( SettingsCatalog::DEVICE_RADIO_SECTOR_COLOR, 'VALUESTR', Lang::getPhrase(3685) , '(' . Lang::getPhrase(740) . ': #008080)', '', '', 1 ); $sectionContent .= '
                    <br>
                    <div class="item" style="text-align: center; font-weight: bold">
                        PON
                    </div>'; $sectionContent .= SettingsHtml::propertyDialog( arg: SettingsCatalog::DEVICE_IS_PON_ONU_TX, argType: 'VALUEINT', caption: Lang::getPhrase(6176) . ' ONU-TX', tooltip: '(' . Lang::getPhrase(6177) . ')' ); $sectionContent .= SettingsHtml::propertyDialog( arg: SettingsCatalog::DEVICE_IS_PON_OLT_RX, argType: 'VALUEINT', caption: Lang::getPhrase(6176) . ' OLT-RX', tooltip: '(' . Lang::getPhrase(6177) . ')' ); $sectionContent .= SettingsHtml::propertyDialog( arg: SettingsCatalog::DEVICE_IS_PON_OLT_TX, argType: 'VALUEINT', caption: Lang::getPhrase(6176) . ' OLT-TX', tooltip: '(' . Lang::getPhrase(6177) . ')' ); $sectionContent .= SettingsHtml::propertyDialog( SettingsCatalog::DEVICE_IS_PON_0_IS_BAD, 'VALUEINT', Lang::getPhrase(5431) ); $sectionContent .= SettingsHtml::propertyDialog( SettingsCatalog::DBM_MAX, 'VALUESTR', Lang::getPhrase(3994) . '. ' . Lang::getPhrase(5544) , '(' . Lang::getPhrase(740) . ': -10)', '', '(dBm)' ); $sectionContent .= SettingsHtml::propertyDialog( SettingsCatalog::DBM_MIN, 'VALUESTR', Lang::getPhrase(3994) . '. ' . Lang::getPhrase(5545) , '(' . Lang::getPhrase(740) . ': -27)', '', '(dBm)' ); $sectionContent .= SettingsHtml::propertyDialog( SettingsCatalog::DEVICE_SFP_ATT, 'VALUESTR', Lang::getPhrase(4689) , '', '', '(dBm)' ); $sectionContent .= SettingsHtml::propertyDialog( SettingsCatalog::PON_LEVEL_CHANGE_FIX, 'VALUESTR', Lang::getPhrase(5786) , '(' . Lang::getPhrase(740) . ': 0.2)', '', '(dBm)' ); break; case self::ITEM_10: $sectionName = Lang::getPhrase(595); $sectionContent = '
                    <div class="div_space">
                        <a id="linkGroupId" href="?core_section=settings_main&action=customer_group"><i class="us-icon fa-bars"></i>' . Lang::getPhrase( 3955 ) . '</a>
                    </div>
                    <div class="div_space">
                        <a id="linkStateId" href="?core_section=settings_main&action=customer_state"><i class="us-icon fa-bars"></i>' . Lang::getPhrase( 4925 ) . '</a>
                    </div>
                    <div class="div_space">
                        <a id="linkCustomerMarkId" href="?core_section=settings_main&action=object_mark_page"><i class="us-icon fa-bars"></i>' . Lang::getPhrase( 6076 ) . '</a>
                    </div>
                    <div class="div_space">
                        <a id="linkCustomerTabId" href="?core_section=' . BodyHtml::SECTION_SETTINGS_MAIN . '&action=' . self::A_CUSTOM_PAGE_LIST . '&category=' . PageAR::CATEGORY_CUSTOMER_CARD . '"><i class="us-icon fa-bars"></i>' . Lang::getPhrase( 5853 ) . '</a>
                    </div>
                    <br>'; $sectionContent .= SettingsHtml::propertyDialog( SettingsCatalog::CUSTOMER_IS_ALLOW_DELETE, 'VALUEINT', Lang::getPhrase(5476) ); $sectionContent .= SettingsHtml::propertyDialog( SettingsCatalog::CUSTOMER_IS_ALLOW_DELETE_POTENTIAL_CUSTOMER, 'VALUEINT', Lang::getPhrase(5811) ); $sectionContent .= SettingsHtml::propertyDialog( SettingsCatalog::CUSTOMER_IS_ALLOW_UNLINK, 'VALUEINT', Lang::getPhrase(5479) ); $sectionContent .= SettingsHtml::propertyDialog( SettingsCatalog::CUSTOMER_IS_ALLOW_CHANGE_TYPE, 'VALUEINT', Lang::getPhrase(5480) , '(' . Lang::getPhrase(5481) . ')' ); $sectionContent .= SettingsHtml::propertyDialog( SettingsCatalog::CUSTOMER_HISTORY_ORDER, 'VALUEINT', Lang::getPhrase(3993) ); $sectionContent .= SettingsHtml::propertyDialog( SettingsCatalog::TAB_SUPPNEWWINDOW, 'VALUEINT', Lang::getPhrase(3509) ); if (true == BillingCache::isHasManualBilling()) { $sectionContent .= SettingsHtml::propertyDialog( SettingsCatalog::CUSTOMER_STATUS_AT_ADD, 'VALUESTR', Lang::getPhrase(4857) ); $sectionContent .= SettingsHtml::propertyDialog( SettingsCatalog::CUSTOMER_TARIFF_AT_ADD, 'VALUESTR', Lang::getPhrase(4751) ); } $sectionContent .= SettingsHtml::propertyDialog( SettingsCatalog::EXCEL_CUSTOMER_ALLOW, 'VALUEINT', Lang::getPhrase(5325) ); $sectionContent .= SettingsHtml::propertyDialog( SettingsCatalog::EXCEL_UNLOCK, 'VALUEINT', Lang::getPhrase(5043) , '', SettingsCatalog::EXCEL_CUSTOMER_ALLOW ); $sectionContent .= SettingsHtml::propertyDialog( SettingsCatalog::CUSTOMER_DAY_DISCONNECT_NOTIFY, 'VALUESTR', Lang::getPhrase(3355) , '(' . Lang::getPhrase(740) . ': 30)' ); $sectionContent .= SettingsHtml::propertyDialog( SettingsCatalog::PING_DEMAND, 'VALUEINT', Lang::getPhrase(3646) ); $sectionContent .= SettingsHtml::propertyDialog( SettingsCatalog::MSG_BILLING_LINK, 'VALUESTR', Lang::getPhrase(5060) ); break; case self::ITEM_18: $sectionName = Lang::getPhrase(3809); $sectionContent = '
                    <div class="div_space">
                        <a id="linkListAllFieldId" href="?' . BodyHtml::CORES_SECTION . '=' . BodyHtml::SECTION_SETTINGS_MAIN . '&action=' . self::A_ADDITIONAL_FIELD_LIST . '"><i class="us-icon fa-list"></i>' . Lang::getPhrase( 6118 ) . '</a>
                    </div>
                    <div class="div_space">
                        <a href="?' . BodyHtml::CORES_SECTION . '=' . BodyHtml::SECTION_SETTINGS_MAIN . '&action=' . self::A_OBJECT_MARK_PAGE . '"><i class="us-icon fa-tags"></i>' . TagAR::classCaption( ) . '</a>
                    </div>
                    <br>'; if (Central::$isUSOnline == false) { $sectionContent .= '
                        <div class="div_space">
                            <a id="linkChangeAdditionalValueId" href="?core_section=settings_main&action=change_additional_field_value"><i class="us-icon fa-cogs"></i>' . Lang::getPhrase( 5990 ) . '</a>
                        </div>
                        <br>'; $sectionContent .= '
                        <div class="div_space">
                            <a id="linkTransferAdditionalValueId" href="?' . BodyHtml::CORES_SECTION . '=' . BodyHtml::SECTION_SETTINGS_MAIN . '&action=' . self::A_ADDITIONAL_FIELD_MERGE . '"><i class="us-icon fa-cogs"></i>' . Lang::getPhrase( 6120 ) . '</a>
                        </div>
                        <br>'; } break; case self::ITEM_19: $sectionName = Lang::getPhrase(3833); $sectionContent = self::tableSettingList(); break; case self::ITEM_20: $sectionName = Lang::getPhrase(4743); $sectionContent = '
                        <div class="div_space">
                            <a id="linkImportAddressId" href="?core_section=settings_main&action=import&object_type=address"><i class="us-icon fa-bars"></i>' . Lang::getPhrase( 3877 ) . '</a>
                        </div>'; if (Central::$erpProfileChapters[ErpProfileDto::CHAPTER_NODE]) { $sectionContent .= '
                        <div class="div_space">
                            <a href="?core_section=settings_main&action=import&object_type=node"><i class="us-icon fa-bars"></i>' . NodeAR::classCaption( ) . '</a>
                        </div>'; } if (Central::$erpProfileChapters[ErpProfileDto::CHAPTER_DEVICE]) { $sectionContent .= '
                        <div class="div_space">
                            <a href="?core_section=settings_main&action=import&object_type=device"><i class="us-icon fa-bars"></i>' . Lang::getPhrase( 627 ) . '</a>
                        </div>'; } if (Central::$erpProfileChapters[ErpProfileDto::CHAPTER_WAREHOUSE]) { $sectionContent .= '
                        <div class="div_space">
                            <a href="?core_section=settings_main&action=import&object_type=inventory"><i class="us-icon fa-bars"></i>' . Lang::getPhrase( 641 ) . '</a>
                        </div>'; } if (Central::$erpProfileChapters[ErpProfileDto::CHAPTER_CUSTOMER]) { $sectionContent .= '
                        <div class="div_space">
                            <a href="?core_section=' . BodyHtml::SECTION_SETTINGS_MAIN . '&action=import&object_type=customer"><i class="us-icon fa-bars"></i>' . CustomerAR::classCaption( ) . '</a>
                        </div>'; } break; case self::ITEM_21: $sectionName = Lang::getPhrase(4805); $sectionContent = SettingsHtml::propertyDialog( SettingsCatalog::NEWIN_IS, 'VALUEINT', Lang::getPhrase(5497) , '<a href="https://www.' . Central::$erpMainDomain . '/manual.php?page_id=25">Wiki</a>' ); $sectionContent .= SettingsHtml::propertyDialog( SettingsCatalog::J_NEW_INTYPE, 'VALUESTR', Lang::getPhrase(4810) , '', SettingsCatalog::NEWIN_IS ); $sectionContent .= SettingsHtml::propertyDialog( SettingsCatalog::REQUEST_CONNECTION_DESCRIPTION, 'VALUEMEMO', Lang::getPhrase(5498) , '', SettingsCatalog::NEWIN_IS ); break; case self::ITEM_23: $sectionName = Lang::getPhrase(5365); $sectionContent = MapHtml::insertMapEditObject('saveWeatherCoord'); $weatherCoord = SettingAR::getByNameString(SettingsCatalog::WEATHER_COORD); $weatherCoord = explode(',', $weatherCoord); if (isset($weatherCoord[1])) { $lat = Central::roundConvert($weatherCoord[0], 6); $lon = Central::roundConvert($weatherCoord[1], 6); } else { $lat = '50'; $lon = '40'; } $sectionContent .= SettingsHtml::propertyDialog( SettingsCatalog::WEATHER_COORD, 'VALUESTR', Lang::getPhrase(3661) , '<a class="link_dashed" id="linkWeatherSelectId" href="javascript:chooseMapWeather(\'' . $lat . '\',\'' . $lon . '\')"><span> ' . Lang::getPhrase( 1742 ) . '</span></a>' ); $sectionContent .= SettingsHtml::propertyDialog( SettingsCatalog::WEATHER_IS_USE, 'VALUEINT', Lang::getPhrase(838) ); $sectionContent .= SettingsHtml::propertyDialog( SettingsCatalog::WEATHER_API_KEY, 'VALUESTR', 'OpenWeatherMap API key', ' <a href="https://home.openweathermap.org/api_keys">https://home.openweathermap.org/api_keys</a>', SettingsCatalog::WEATHER_IS_USE ); if (Central::$erpProfileChapters[ErpProfileDto::CHAPTER_TASK]) { $sectionContent .= SettingsHtml::propertyDialog( SettingsCatalog::WEATHER_IS_IN_CALENDAR, 'VALUEINT', Lang::getPhrase(5366) , '', SettingsCatalog::WEATHER_IS_USE ); } break; case self::ITEM_24: $sectionName = Lang::getPhrase(639); $sectionContent = '
                    <div class="div_space">
                        <a href="?core_section=settings_main&action=inventory_sub_account"><i class="us-icon fa-bars"></i>' . Lang::getPhrase( 6000 ) . '</a>
                    </div>
                    <br>'; $sectionContent .= SettingsHtml::propertyDialog( SettingsCatalog::INVENTORY_WAREHOUSE_IS_TRANSIT_CONFIRM, 'VALUEINT', Lang::getPhrase(4434) ); $sectionContent .= SettingsHtml::propertyDialog( SettingsCatalog::INVENTORY_WAREHOUSE_IS_CONFIRM_ON_READ, 'VALUEINT', Lang::getPhrase(5320) ); $sectionContent .= SettingsHtml::propertyDialog( SettingsCatalog::INVENTORY_WAREHOUSE_ADDITIONAL_INFORMATION, 'VALUEINT', Lang::getPhrase(5239) ); $sectionContent .= SettingsHtml::propertyDialog( SettingsCatalog::INVENTORY_IS_BARCODE_PRINT_DELIMITER, 'VALUEINT', Lang::getPhrase( 5205 ) ); $sectionContent .= SettingsHtml::propertyDialog( SettingsCatalog::INVENTORY_IS_SEND_INFO_TO_EMPLOYEE_ABOUT_TRANSFER, 'VALUEINT', Lang::getPhrase( 5395 ) ); $sectionContent .= SettingsHtml::propertyDialog( SettingsCatalog::INVENTORY_ADD_INVENTORY_NUMBER_ON_ADD, 'VALUEINT', Lang::getPhrase(4406) ); $sectionContent .= SettingsHtml::propertyDialog( SettingsCatalog::WAREHOUSE_CUSTOMER_MOVED, 'VALUESTR', Lang::getPhrase(4698) ); $sectionContent .= SettingsHtml::propertyDialog( SettingsCatalog::IS_QR_ONE_PER_PAGE, 'VALUEINT', Lang::getPhrase(5375) ); $sectionContent .= SettingsHtml::propertyDialog( SettingsCatalog::OPERATION_BLANK, 'VALUESTR', Lang::getPhrase(3540) . ' #1' ); $sectionContent .= SettingsHtml::propertyDialog( SettingsCatalog::OPERATION_BLANK2, 'VALUESTR', Lang::getPhrase(3540) . ' #2' ); $sectionContent .= SettingsHtml::propertyDialog( SettingsCatalog::OPERATION_BLANK3, 'VALUESTR', Lang::getPhrase(3540) . ' #3' ); $sectionContent .= SettingsHtml::propertyDialog( SettingsCatalog::INVENTORY_LIMIT_ADD, 'VALUESTR', Lang::getPhrase(5828) , '(' . Lang::getPhrase(740) . ': 100)' ); $sectionContent .= SettingsHtml::propertyDialog( SettingsCatalog::INVENTORY_INTEGRATE_ONE_PER_IFACE, 'VALUEINT', Lang::getPhrase(5908) ); $sectionContent .= SettingsHtml::propertyDialog( SettingsCatalog::IS_INVENTORY_NUMBER_SORT_AS_TEXT, 'VALUEINT', Lang::getPhrase(6027) ); $sectionContent .= SettingsHtml::propertyDialog( SettingsCatalog::INVENTORY_IS_SELECT_ALL_CATEGORY_DEFAULT, 'VALUEINT', Lang::getPhrase(6171) ); break; case self::ITEM_25: $sectionName = Lang::getPhrase(652); $sectionContent = '
                        <div class="div_space">
                            <a id="linkLdapId" href="?core_section=settings_main&action=ldap"><i class="us-icon fa-bars"></i>LDAP</a>
                        </div>
                        <br>'; $sectionContent .= SettingsHtml::propertyDialog( SettingsCatalog::EMPLOYEE_IS_USE_FULLNAME, 'VALUEINT', Lang::getPhrase(3858) , '(' . Lang::getPhrase(3859) . ')' ); $sectionContent .= SettingsHtml::propertyDialog( SettingsCatalog::P_BIRTH_ONMAIN, 'VALUEINT', Lang::getPhrase(5000) ); if (Central::$erpProfileSubChapters[ErpProfileDto::SUB_CHAPTER_EMPLOYEE_TIMESHEET]) { $sectionContent .= SettingsHtml::propertyDialog( SettingsCatalog::EMPLOYEE_IS_ALLOW_EDIT_TABEL_LAST_DAY, 'VALUEINT', Lang::getPhrase(5549) ); } $sectionContent .= SettingsHtml::propertyDialog( SettingsCatalog::EMPLOYEE_SESSION_TIMEOUT_INTERVAL, 'VALUESTR', Lang::getPhrase(6059) , '(' . Lang::getPhrase(740) . ': 43200)', '', '(' . Lang::getPhrase(5466) . ')' ); $sectionContent .= SettingsHtml::propertyDialog( SettingsCatalog::EMPLOYEE_UNACTIVE_LOCKED_DAY, 'VALUESTR', Lang::getPhrase(5668) , '(' . Lang::getPhrase(740) . ': 45)', '', '(' . Lang::getPhrase(2234) . ')' ); $sectionContent .= SettingsHtml::propertyDialog( SettingsCatalog::EMPLOYEE_ALLOW_DEBUG_FOR_ALL, 'VALUEINT', Lang::getPhrase(789) ); $sectionContent .= SettingsHtml::propertyDialog( SettingsCatalog::IS_EMPLOYEE_TABLE_SET, 'VALUEINT', Lang::getPhrase(5827) ); $sectionContent .= SettingsHtml::propertyDialog( SettingsCatalog::IS_EMPLOYEE_TABLE_SET_ADMIN, 'VALUEINT', Lang::getPhrase( 6141 ) ); $sectionContent .= SettingsHtml::propertyDialog( SettingsCatalog::TIME_SINCE_EMPLOYEE_DISMISS, 'VALUESTR', Lang::getPhrase(6046) , '(' . Lang::getPhrase(740) . ': 90)' ); $sectionContent .= '
                    <div class="item" style="text-align: center; font-weight: bold">
                        ' . Lang::getPhrase(5548) . '
                    </div>'; $sectionContent .= SettingsHtml::propertyDialog( SettingsCatalog::ALLOW_SAVELOGIN, 'VALUEINT', Lang::getPhrase(3506) ); $sectionContent .= SettingsHtml::propertyDialog( SettingsCatalog::EMPLOYEE_CHANGE_PASSWORD_INTERVAL, 'VALUESTR', Lang::getPhrase(5485) , '', '', '(' . Lang::getPhrase(2234) . ')' ); $sectionContent .= SettingsHtml::propertyDialog( SettingsCatalog::EMPLOYEE_PASSWORD_MIN_LENGTH, 'VALUESTR', Lang::getPhrase(5134) ); $sectionContent .= SettingsHtml::propertyDialog( SettingsCatalog::EMPLOYEE_PASSWORD_REQUIRED_DIGITAL, 'VALUEINT', Lang::getPhrase(5131) ); $sectionContent .= SettingsHtml::propertyDialog( SettingsCatalog::EMPLOYEE_PASSWORD_REQUIRED_CAPITAL_LETTER, 'VALUEINT', Lang::getPhrase(5132) ); $sectionContent .= SettingsHtml::propertyDialog( SettingsCatalog::EMPLOYEE_PASSWORD_REQUIRED_SMALL_LETTER, 'VALUEINT', Lang::getPhrase(5133) ); $sectionContent .= SettingsHtml::propertyDialog( SettingsCatalog::EMPLOYEE_PASSWORD_MUST_INDIVIDUAL, 'VALUEINT', Lang::getPhrase(5136) ); break; case self::ITEM_26: $sectionName = Lang::getPhrase(3802); $sectionContent = SettingsHtml::propertyDialog( SettingsCatalog::NODE_SCHEME_DEVICE_LABEL, 'VALUESTR', Lang::getPhrase(627) . '. ' . Lang::getPhrase(5373) , 'name<br>ip<br>hostname<br>comment<br>add_field_XXX' ); $sectionContent .= SettingsHtml::propertyDialog( SettingsCatalog::SCHEME_SPLIT_LABEL, 'VALUESTR', Lang::getPhrase(4138) . '. ' . Lang::getPhrase( 5373 ) , 'comment<br>dataXXX' ); $sectionContent .= SettingsHtml::propertyDialog( SettingsCatalog::SCHEME_CROSS_LABEL, 'VALUESTR', Lang::getPhrase(3794) . '. ' . Lang::getPhrase(5373) , 'comment<br>number' ); $sectionContent .= SettingsHtml::propertyDialog( SettingsCatalog::NODE_IS_HIDE_FULL_COMMUTATION_ON_SCHEME, 'VALUEINT', Lang::getPhrase(5079) ); $sectionContent .= SettingsHtml::propertyDialog( SettingsCatalog::COMMUTATION_SCHEME_IS_MODULE_NUMBER, 'VALUEINT', Lang::getPhrase( 5931 ) ); $sectionContent .= SettingsHtml::propertyDialog( SettingsCatalog::COMMUTATION_SCHEME_IS_COLOR_NAME_MODULE, 'VALUEINT', Lang::getPhrase( 5840 ) ); $sectionContent .= SettingsHtml::propertyDialog( SettingsCatalog::COMMUTATION_SCHEME_LINE_SIZE, 'VALUESTR', Lang::getPhrase(5844) , '(' . Lang::getPhrase(740) . ': 5)' ); $sectionContent .= SettingsHtml::propertyDialog( SettingsCatalog::COMMUTATION_SCHEME_IS_NET, 'VALUEINT', Lang::getPhrase(5845) ); $sectionContent .= SettingsHtml::propertyDialog( SettingsCatalog::COMMUTATION_SCHEME_NET_COLOR, 'VALUESTR', Lang::getPhrase(5846) , '(' . Lang::getPhrase(740) . ': #efefef)', SettingsCatalog::COMMUTATION_SCHEME_IS_NET, '', 1 ); $sectionContent .= SettingsHtml::propertyDialog( SettingsCatalog::COMMUTATION_SCHEME_IS_SCROLL, 'VALUEINT', Lang::getPhrase(5537) ); $sectionContent .= SettingsHtml::propertyDialog( SettingsCatalog::COMMUTATION_SCHEME_VOK_WIDTH, 'VALUESTR', Lang::getPhrase(5932) , '(' . Lang::getPhrase(740) . ': 100)' ); $sectionContent .= SettingsHtml::propertyDialog( SettingsCatalog::COMMUTATION_SCHEME_VOK_MIN_HEIGHT, 'VALUESTR', Lang::getPhrase(5933) , '(' . Lang::getPhrase(740) . ': 0)' ); $sectionContent .= SettingsHtml::propertyDialog( SettingsCatalog::CABLE_LINE_CORE_CONNECTION_INFORMATION, 'VALUEINT', Lang::getPhrase(6002) ); $sectionContent .= SettingsHtml::propertyDialog( arg: SettingsCatalog::CABLE_LINE_CORE_CONNECTION_INFORMATION_TEMPLATE, argType: 'VALUESTR', caption: Lang::getPhrase(6003) , tooltip: '(' . Lang::getPhrase( 740 ) . ': ' . CommutationScheme::TEMPLATE_CONNECT_INFORMATION_NODE_NAME . ')<br>' . CommutationScheme::TEMPLATE_CONNECT_INFORMATION_NODE_NAME . ' | ' . CommutationScheme::TEMPLATE_CONNECT_INFORMATION_DEVICE_NAME . ' | ' . CommutationScheme::TEMPLATE_CONNECT_INFORMATION_DEVICE_PORT . ' | ' . CommutationScheme::TEMPLATE_CONNECT_INFORMATION_DEVICE_HOSTNAME . ' | ' . CommutationScheme::TEMPLATE_CONNECT_INFORMATION_DEVICE_IP, parentArg: SettingsCatalog::CABLE_LINE_CORE_CONNECTION_INFORMATION ); $sectionContent .= SettingsHtml::propertyDialog( arg: SettingsCatalog::CABLE_LINE_CORE_CONNECTION_INFORMATION_WIDTH, argType: 'VALUESTR', caption: Lang::getPhrase(6004) , tooltip: '(' . Lang::getPhrase(740) . ': 200)', parentArg: SettingsCatalog::CABLE_LINE_CORE_CONNECTION_INFORMATION ); $sectionContent .= SettingsHtml::propertyDialog( arg: SettingsCatalog::NODE_SCHEME_IS_SPLITTER_SHOW_LEVEL, argType: 'VALUEINT', caption: Lang::getPhrase( 6206 ) ); break; case self::ITEM_27: $sectionName = 'WebSocket'; $sectionContent = SettingsHtml::propertyDialog( arg: SettingsCatalog::WEB_SOCKET_USER, argType: 'VALUESTR', caption: Lang::getPhrase(5624) , tooltip: '(WebSTOMP)' ); $sectionContent .= SettingsHtml::propertyDialog( arg: SettingsCatalog::WEB_SOCKET_PASSWORD, argType: 'VALUESTR', caption: Lang::getPhrase(553) , tooltip: '(WebSTOMP)' ); $sectionContent .= SettingsHtml::propertyDialog( arg: SettingsCatalog::WEB_SOCKET_NOTIFY_TIMEOUT, argType: 'VALUESTR', caption: Lang::getPhrase(5234) ); $sectionContent .= SettingsHtml::propertyDialog( arg: SettingsCatalog::IS_WEBSTOMP_DEBUG, argType: 'VALUEINT', caption: 'Debug Mode' ); break; case self::ITEM_28: $sectionName = Lang::getPhrase(6068); $sectionContent = '
                    <div class="div_space">
                        <a href="?' . BodyHtml::CORES_SECTION . '=' . BodyHtml::SECTION_SETTINGS_NOTIFICATION . '"><i class="us-icon fa-bars"></i>' . Lang::getPhrase(669) . ' - ' . Lang::getPhrase(5312) . '</a>
                    </div>
                    <br>'; $sectionContent .= SettingsHtml::propertyDialog( SettingsCatalog::SMS_FORMAT, 'VALUESTR', Lang::getPhrase(3052) , '(' . Lang::getPhrase(3053) . ': +380XXXXXXXXX)' ); $sectionContent .= SettingsHtml::propertyDialog( SettingsCatalog::IS_PHONE_NUMBER_CONVERT, 'VALUEINT', Lang::getPhrase( 4827 ) ); $sectionContent .= SettingsHtml::propertyDialog( SettingsCatalog::PHONE_ADDITIONAL_URL, 'VALUESTR', Lang::getPhrase( 4917 ) ); $sectionContent .= SettingsHtml::propertyDialog( SettingsCatalog::IS_SMS, 'VALUEINT', Lang::getPhrase(3325) . ' SMS' ); $sectionContent .= SettingsHtml::propertyDialog( SettingsCatalog::SMS_LEFTBLOCK, 'VALUEINT', Lang::getPhrase(4404) , '', SettingsCatalog::IS_SMS ); break; case self::ITEM_98: $sectionName = Lang::getPhrase(5383); $sectionContent = ''; if (Central::$isUSOnline === false) { $sectionContent .= '
                    <div class="item">
                        <div style="text-align: right; width: 250px">
                            ' . Lang::getPhrase(5427) . ':
                        </div>
                        <div>
                            <b>' . Central::$erpCustomerName . '</b>
                        </div>
                    </div>
                    <div class="item">
                        <div style="text-align: right">
                            ' . Lang::getPhrase(5425) . ':
                        </div>
                        <div>
                            <b>' . Central::dateFormatShortByUnix(strtotime(Central::$erpCustomerDateSupport)) . '</b>
                        </div>
                    </div>                    
                    <div class="item">
                        <div style="text-align: right">
                            ' . Lang::getPhrase(5384) . ':
                            <br><br><br>
                            <b>' . Lang::getPhrase(5385) . '</b>
                        </div>
                        <div>
                            <b>' . Central::$erpLimitCounter . '</b>
                        </div>
                    </div>'; if (Central::$erpProfileChapters[ErpProfileDto::CHAPTER_CUSTOMER]) { $sectionContent .= self::addObjectLimitData( Lang::getPhrase(595) , CustomerAR::find() ->where( [ CustomerAR::F_ACTUAL_STATUS => CustomerAR::ACTUAL_STATUS_NORMAL ] ) ->count() ); } if (Central::$erpProfileChapters[ErpProfileDto::CHAPTER_NODE]) { $nodeTypes = NodeTypeAR::find() ->orderBy( [ NodeTypeAR::F_NAME => SORT_ASC ] )->all(); foreach ($nodeTypes as $nodeType) { $count2 = NodeAR::find() ->where( [ NodeAR::F_NODE_TYPE_ID => $nodeType->getId() ] ) ->count(); $sectionContent .= self::addObjectLimitData( NodeTypeCache::getName($nodeType->getId()), $count2 ); } } if (Central::$erpProfileChapters[ErpProfileDto::CHAPTER_DEVICE]) { $sectionContent .= self::addObjectLimitData( Lang::getPhrase(633) , DeviceAR::find() ->where(DeviceAR::F_INVENTORY_ID . ' IS NULL') ->count() ); $sectionContent .= self::addObjectLimitData( Lang::getPhrase(627) , DeviceAR::find() ->innerJoin( InventoryAR::tableName() . ' as i', 'i.' . InventoryAR::F_ID . ' = ' . DeviceAR::tableName( ) . '.' . DeviceAR::F_INVENTORY_ID ) ->innerJoin( InventoryAssortmentAR::tableName() . ' as ia', 'ia.' . InventoryAssortmentAR::F_ID . ' = i.' . InventoryAR::F_INVENTORY_ASSORTMENT_ID ) ->innerJoin( InventorySectionAR::tableName() . ' as iss', 'iss.' . InventorySectionAR::F_ID . ' = ia.' . InventoryAssortmentAR::F_INVENTORY_SECTION_ID ) ->where( [ 'iss.' . InventorySectionAR::F_TYPE_ID => InventorySectionAR::T_1_SWITCH ] ) ->count() ); $sectionContent .= self::addObjectLimitData( Lang::getPhrase(1553) , DeviceAR::find() ->innerJoin( InventoryAR::tableName() . ' as i', 'i.' . InventoryAR::F_ID . ' = ' . DeviceAR::tableName( ) . '.' . DeviceAR::F_INVENTORY_ID ) ->innerJoin( InventoryAssortmentAR::tableName() . ' as ia', 'ia.' . InventoryAssortmentAR::F_ID . ' = i.' . InventoryAR::F_INVENTORY_ASSORTMENT_ID ) ->innerJoin( InventorySectionAR::tableName() . ' as iss', 'iss.' . InventorySectionAR::F_ID . ' = ia.' . InventoryAssortmentAR::F_INVENTORY_SECTION_ID ) ->where( [ 'iss.' . InventorySectionAR::F_TYPE_ID => InventorySectionAR::T_2_RADIO ] ) ->count() ); $sectionContent .= self::addObjectLimitData( Lang::getPhrase(628) , DeviceAR::find() ->innerJoin( InventoryAR::tableName() . ' as i', 'i.' . InventoryAR::F_ID . ' = ' . DeviceAR::tableName( ) . '.' . DeviceAR::F_INVENTORY_ID ) ->innerJoin( InventoryAssortmentAR::tableName() . ' as ia', 'ia.' . InventoryAssortmentAR::F_ID . ' = i.' . InventoryAR::F_INVENTORY_ASSORTMENT_ID ) ->innerJoin( InventorySectionAR::tableName() . ' as iss', 'iss.' . InventorySectionAR::F_ID . ' = ia.' . InventoryAssortmentAR::F_INVENTORY_SECTION_ID ) ->where( [ 'iss.' . InventorySectionAR::F_TYPE_ID => InventorySectionAR::T_3_MEDIC ] ) ->count() ); } if (Central::$erpProfileChapters[ErpProfileDto::CHAPTER_MAP]) { $sectionContent .= self::addObjectLimitData( BuildingAR::classCaption(), BuildingAR::find()->count() ); } if (Central::$erpProfileChapters[ErpProfileDto::CHAPTER_CABLE_LINE]) { $sectionContent .= self::addObjectLimitData( CableLineAR::classCaption(), CableLineAR::find()->count() ); } } else { $employee = Yii::$app->user->identity; $sectionContent .= '
                        <div class="item">
                            <div style="text-align: right; width: 250px">
                            </div>
                            <div>
                                <b>' . $employee->employeeProperty->getShortName() . '</b>
                            </div>
                        </div>'; $limits = EmployeeProfileAR::findOne(Html::$currentOperatorProfileId)->getUSOnlineLimit(); $addressArray = AddressUnit::getAllChildById( EmployeeCache::getCurrentAccessAddressId($employee->getId()) ); $cableLineTypesArray = CableLineTypeAR::find() ->where( [ CableLineTypeAR::F_AUTHOR_EMPLOYEE_ID => Html::$currentEmployeeId ] ) ->indexBy(CableLineTypeAR::F_ID) ->asArray() ->all(); $cableRouteArray = CableRouteAR::find() ->where( [ CableRouteAR::F_AUTHOR_EMPLOYEE_ID => Html::$currentEmployeeId ] ) ->indexBy(CableRouteAR::F_ID) ->asArray() ->all(); $sectionContent .= self::addObjectLimitData( Lang::getPhrase(3877) , count($addressArray), $limits[EmployeeProfileAR::USO_ADDRESS], '?core_section=' . BodyHtml::SECTION_SETTINGS_ADDRESS ); $sectionContent .= self::addObjectLimitData( NodeTypeAR::classCaption(), NodeTypeAR::find() ->where( [ NodeTypeAR::F_AUTHOR_EMPLOYEE_ID => Html::$currentEmployeeId ] ) ->count(), $limits[EmployeeProfileAR::USO_NODE_TYPE], '?core_section=' . BodyHtml::SECTION_SETTINGS_MAIN . '&action=' . SettingsMainHtml::A_NODE_TYPES ); $sectionContent .= self::addObjectLimitData( NodeAR::classCaption(), NodeAR::find() ->where( [ NodeAR::F_AUTHOR_EMPLOYEE_ID => Html::$currentEmployeeId ] ) ->count(), $limits[EmployeeProfileAR::USO_NODE] ); $sectionContent .= self::addObjectLimitData( CableLineTypeAR::classCaption(), count($cableLineTypesArray), $limits[EmployeeProfileAR::USO_CABLE_LINE_TYPE], '?core_section=' . BodyHtml::SECTION_SETTINGS_CABLE_LINE ); $sectionContent .= self::addObjectLimitData( Lang::getPhrase(5703) , CableColorAR::find() ->where( [ CableColorAR::F_AUTHOR_EMPLOYEE_ID => Html::$currentEmployeeId ] ) ->count(), $limits[EmployeeProfileAR::USO_CABLE_LINE_COLOR], '?core_section=' . BodyHtml::SECTION_SETTINGS_CABLE_LINE . '&action=' . SettingsCableLineHtml::A_FIBER_COLOR ); $sectionContent .= self::addObjectLimitData( CableCatalogAR::classCaption(), CableCatalogAR::find() ->where( [ CableCatalogAR::F_CABLE_LINE_TYPE_ID => Central::getArrayListForAR( $cableLineTypesArray ) ] ) ->count(), $limits[EmployeeProfileAR::USO_CABLE_CATALOG], '?core_section=' . BodyHtml::SECTION_SETTINGS_CABLE_LINE . '&action=' . SettingsCableLineHtml::A_FIBER_CABLE_CATALOG ); $sectionContent .= self::addObjectLimitData( CableLineAR::classCaption(), CableLineAR::find() ->where( [ CableLineAR::F_AUTHOR_EMPLOYEE_ID => Html::$currentEmployeeId ] ) ->count(), $limits[EmployeeProfileAR::USO_CABLE_LINE] ); $sectionContent .= self::addObjectLimitData( CableLineTrunkAR::classCaption(), CableLineTrunkAR::find() ->where( [ CableLineTrunkAR::F_AUTHOR_EMPLOYEE_ID => Html::$currentEmployeeId ] ) ->count(), $limits[EmployeeProfileAR::USO_CABLE_LINE_MAG], '?core_section=' . BodyHtml::SECTION_FIBER_MAG ); $sectionContent .= self::addObjectLimitData( CableRouteAR::classCaption(), count($cableRouteArray), $limits[EmployeeProfileAR::USO_CABLE_ROUTE], '?core_section=' . BodyHtml::SECTION_DUCT . '&action=' . DuctHtml::A_ROUTE_LIST ); $sectionContent .= self::addObjectLimitData( CableDuctAR::classCaption(), CableDuctAR::find() ->where( [ CableDuctAR::F_CABLE_ROUTE_ID => Central::getArrayListForAR( $cableRouteArray ) ] ) ->count(), $limits[EmployeeProfileAR::USO_CABLE_LINE_MAG], '?core_section=' . BodyHtml::SECTION_DUCT . '&action=' . DuctHtml::A_DUCT_LIST ); $sectionContent .= self::addObjectLimitData( CrossAR::classCaption(), CrossAR::find() ->where( [ CrossAR::F_AUTHOR_EMPLOYEE_ID => Html::$currentEmployeeId ] ) ->count(), $limits[EmployeeProfileAR::USO_CROSS], '?core_section=' . BodyHtml::SECTION_CROSS ); $sectionContent .= self::addObjectLimitData( SplitterAR::classCaption(), SplitterAR::find() ->where( [ SplitterAR::F_AUTHOR_EMPLOYEE_ID => Html::$currentEmployeeId ] ) ->count(), $limits[EmployeeProfileAR::USO_SPLITTER], '?core_section=' . BodyHtml::SECTION_SPLITTER ); $sectionContent .= self::addObjectLimitData( Lang::getPhrase(6053) , MapObjectAR::find() ->where( [ MapObjectAR::F_AUTHOR_EMPLOYEE_ID => Html::$currentEmployeeId, MapObjectAR::F_OBJECT_TYPE => MapObjectAR::OBJECT_TYPE_POLYGON ] ) ->count(), $limits[EmployeeProfileAR::USO_MAP_POLYGON] ); $sectionContent .= self::addObjectLimitData( Lang::getPhrase(1217) , AttachmentAR::find() ->where( [ AttachmentAR::F_EMPLOYEE_ID => Html::$currentEmployeeId ] ) ->count(), $limits[EmployeeProfileAR::USO_ATTACH] ); $sectionContent .= self::addObjectLimitData( OwnerAR::classCaption(), OwnerAR::find() ->where( [ OwnerAR::F_AUTHOR_EMPLOYEE_ID => Html::$currentEmployeeId ] ) ->count(), $limits[EmployeeProfileAR::USO_OWNER], '?core_section=' . BodyHtml::SECTION_OWNER ); $sectionContent .= self::addObjectLimitData( Lang::getPhrase(6051) , PageAR::find() ->where( [ PageAR::F_AUTHOR_EMPLOYEE_ID => Html::$currentEmployeeId ] ) ->count(), $limits[EmployeeProfileAR::USO_CUSTOM_PAGE], '?core_section=' . BodyHtml::SECTION_SETTINGS_MAIN . '&action=' . self::A_CUSTOM_PAGE_LIST . '&category=' . PageAR::CATEGORY_LEFT_MENU ); $sectionContent .= self::addObjectLimitData( Lang::getPhrase(6052) , MapObjectAR::find() ->where( [ MapObjectAR::F_AUTHOR_EMPLOYEE_ID => Html::$currentEmployeeId ] ) ->andWhere( ['<>', MapObjectAR::F_OBJECT_TYPE, MapObjectAR::OBJECT_TYPE_POLYGON] ) ->count(), $limits[EmployeeProfileAR::USO_MAP_OBJECT] ); $sectionContent .= self::addObjectLimitData( TagAR::classCaption(), TagAR::find() ->where( [ TagAR::F_AUTHOR_EMPLOYEE_ID => Html::$currentEmployeeId ] ) ->count(), $limits[EmployeeProfileAR::USO_LAYER], '?core_section=' . BodyHtml::SECTION_SETTINGS_MAIN . '&action=' . self::A_OBJECT_MARK_PAGE ); $sectionContent .= self::addObjectLimitData( AdditionalFieldAR::classCaption(), AdditionalFieldAR::find() ->where( [ TagAR::F_AUTHOR_EMPLOYEE_ID => Html::$currentEmployeeId ] ) ->count(), $limits[EmployeeProfileAR::USO_ADDITIONAL_DATA_CONFIG], '?core_section=' . BodyHtml::SECTION_SETTINGS_MAIN . '&item_id=' . self::ITEM_18 ); } break; case self::ITEM_99: $sectionName = Lang::getPhrase(730); $sectionContent = ''; if (Central::$isUSOnline === false) { $sectionContent .= '
                    <div class="div_space">
                        <a id="linkSqlCommandId" href="?core_section=settings_main&action=sql"><i class="us-icon fa-bars"></i>' . Lang::getPhrase( 3281 ) . '</a>
                    </div>'; if ( Central::$erpProfileChapters[ErpProfileDto::CHAPTER_CUSTOMER] || Central::$erpProfileChapters[ErpProfileDto::CHAPTER_DEVICE] ) { $sectionContent .= '
                    <div class="div_space">
                        <a id="linkPingIpId" class="link_dashed" href="javascript:ajaxWindow(\'?core_section=settings_main&action=ping\');"><i class="us-icon fa-bars"></i><span>' . Lang::getPhrase( 3308 ) . '</span></a>
                    </div>
                    <div class="div_space">
                        <a id="linkArpId" class="link_dashed" href="javascript:ajaxWindow(\'?core_section=settings_main&action=arp\');"><i class="us-icon fa-bars"></i><span>' . Lang::getPhrase( 4793 ) . '</span></a>
                    </div>'; } if (true !== Central::$isDemo) { $sectionContent .= '
                    <div class="div_space">
                        <a id="linkPhpInfoId" href="?core_section=settings_main&action=phpinfo"><i class="us-icon fa-bars"></i>phpinfo()</a>
                    </div>'; } } $sectionContent .= '
                    <div class="div_space">
                        <a id="linkCustomPageId" href="?core_section=' . BodyHtml::SECTION_SETTINGS_MAIN . '&action=' . self::A_CUSTOM_PAGE_LIST . '&category=' . PageAR::CATEGORY_LEFT_MENU . '"><i class="us-icon fa-bars"></i>' . Lang::getPhrase( 5968 ) . '</a>
                    </div>
                    <div class="div_space">
                        <a id="linkCustomPageId" href="?core_section=' . BodyHtml::SECTION_SETTINGS_MAIN . '&action=' . self::A_CUSTOM_PAGE_LIST . '&category=' . PageAR::CATEGORY_TOP_MENU . '"><i class="us-icon fa-bars"></i>' . Lang::getPhrase( 5967 ) . '</a>
                    </div>'; if (Central::$isUSOnline === false) { $sectionContent .= '
                    <div class="div_space">
                        <a id="linkMainMenuId" href="?core_section=settings_main&action=main_menu"><i class="us-icon fa-bars"></i>' . Lang::getPhrase( 5962 ) . '</a>
                    </div>'; } if (Central::$isUSOnline === false) { $sectionContent .= '
                    <div class="div_space">
                        <a id="linkTableClearId" href="?core_section=settings_main&action=table_clear"><i class="us-icon fa-bars"></i>' . Lang::getPhrase( 5400 ) . '</a>
                    </div>
                    <div class="div_space">
                        <a id="linkAttachId" href="?core_section=settings_main&action=attach"><i class="us-icon fa-bars"></i>' . Lang::getPhrase( 1217 ) . '</a>
                    </div>
                    <div class="div_space">
                        <a id="linkFieldSearchGlobalId" href="?core_section=settings_main&action=search_fields&section_id=1"><i class="us-icon fa-bars"></i>' . Lang::getPhrase( 3771 ) . '</a>
                    </div>
                    <div class="div_space">
                        <a href="?core_section=settings_main&action=search_fields&section_id=2"><i class="us-icon fa-bars"></i>' . Lang::getPhrase( 3788 ) . '</a>
                    </div>'; } $sectionContent .= '
                    <br>'; if (Central::$isUSOnline === false) { $sectionContent .= SettingsHtml::propertyDialog( SettingsCatalog::SYSTEM_ROW_PER_PAGE, 'VALUESTR', Lang::getPhrase(3359) , '(' . Lang::getPhrase(740) . ': 100)' ); if ( Central::$erpProfileChapters[ErpProfileDto::CHAPTER_CUSTOMER] || Central::$erpProfileChapters[ErpProfileDto::CHAPTER_DEVICE] ) { $sectionContent .= SettingsHtml::propertyDialog( SettingsCatalog::MAC_TYPE, 'VALUESTR', Lang::getPhrase(3362) ); } $sectionContent .= SettingsHtml::propertyDialog( SettingsCatalog::IS_QR_ONE_PER_PAGE, 'VALUEINT', Lang::getPhrase(5375) ); $sectionContent .= SettingsHtml::propertyDialog( SettingsCatalog::ANIMATE_SPEED, 'VALUESTR', Lang::getPhrase(3438) , '(' . Lang::getPhrase(740) . ': 400)' ); $sectionContent .= SettingsHtml::propertyDialog( SettingsCatalog::DATE_FULL_TEMPLATE, 'VALUESTR', Lang::getPhrase(5939) . ' d.m.Y H:i:s' ); $sectionContent .= SettingsHtml::propertyDialog( SettingsCatalog::DATE_MIDDLE_TEMPLATE, 'VALUESTR', Lang::getPhrase(5939) . ' d.m.Y H:i' ); $sectionContent .= SettingsHtml::propertyDialog( SettingsCatalog::DATE_SHORT_TEMPLATE, 'VALUESTR', Lang::getPhrase(5939) . ' d.m.Y' ); $sectionContent .= '
                    <div class="item" style="text-align: center; font-weight: bold">
                        ' . Lang::getPhrase(1217) . '
                    </div>'; $sectionContent .= SettingsHtml::propertyDialog( SettingsCatalog::ATTACH_IS_CONVERT_TO_JPEG, 'VALUEINT', Lang::getPhrase(5954) ); $sectionContent .= SettingsHtml::propertyDialog( SettingsCatalog::ATTACH_JPEG_QUALITY, 'VALUESTR', Lang::getPhrase(5955) , '(0-100)', SettingsCatalog::ATTACH_IS_CONVERT_TO_JPEG ); $sectionContent .= SettingsHtml::propertyDialog( SettingsCatalog::ATTACH_RESIZE_TO, 'VALUESTR', Lang::getPhrase(5956) , '(' . Lang::getPhrase(5957) . ')', SettingsCatalog::ATTACH_IS_CONVERT_TO_JPEG ); } break; case self::ITEM_1: default: $sectionName = Lang::getPhrase(719); $sectionContent = SettingsHtml::propertyDialog( SettingsCatalog::NET_NAME, 'VALUESTR', Lang::getPhrase(5427) ); $sectionContent .= SettingsHtml::propertyDialog( SettingsCatalog::MAIN_LANG, 'VALUESTR', Lang::getPhrase(5470) , '(' . Lang::getPhrase(740) . ': English)' ); if (1 != SettingAR::getByNameInt(SettingsCatalog::CUSTOMER_IS_ACTIVE_CUSTOMER_AREA)) { $sectionContent .= SettingsHtml::propertyDialog( SettingsCatalog::ENTER_TYPE, 'VALUESTR', Lang::getPhrase(738) , '<a target=_blank href="' . Central::$mainUrl . '">' . Central::$mainUrl . '</a>' ); } $sectionContent .= SettingsHtml::propertyDialog( SettingsCatalog::SYSTEM_CURRENCY, 'VALUESTR', Lang::getPhrase(5468) ); if ( Central::$erpProfileChapters[ErpProfileDto::CHAPTER_CUSTOMER] || Central::$erpProfileChapters[ErpProfileDto::CHAPTER_DEVICE] ) { $sectionContent .= SettingsHtml::propertyDialog( SettingsCatalog::ACTIVE_TIME, 'VALUESTR', Lang::getPhrase(5465) , '(' . Lang::getPhrase(740) . ': 15)', '', '(' . Lang::getPhrase(5466) . ')' ); } if (Central::$erpProfileChapters[ErpProfileDto::CHAPTER_DEVICE]) { $sectionContent .= SettingsHtml::propertyDialog( SettingsCatalog::ACTIVE_TIME_E, 'VALUESTR', Lang::getPhrase(5467) , '(' . Lang::getPhrase(740) . ': 15)', '', '(' . Lang::getPhrase(5466) . ')' ); } break; } return '
            <span class="label_h2">' . $sectionName . '</span>
            <div class="table_block" style="width: 100%;">
                ' . $sectionContent . '
            </div>'; } public static function sliderSetting() { $content = "
                <script>
                    $(document).ready(function () {
                        lc_switch('input[type=checkbox]', {
                            on_color : '#1871A5',
                            on_txt : '" . Lang::getPhrase(731) . "',
                            off_txt : '" . Lang::getPhrase(732) . "'
                        });
                        document.querySelectorAll('input').forEach(function(el) {
                            el.addEventListener('lcs-statuschange', (e) => {
                                if (el.checked == true) {
                                    must_value = 1;
                                } else {
                                    must_value = 0;
                                }
                                var url = '?" . BodyHtml::CORES_SECTION . "=" . BodyHtml::SECTION_SETTINGS . "&action=change_boolean_value&option=' + el.value + '&must_value=' + must_value;
                                $.ajax({
                                    url: url,
                                    async: true,
                                    success: function (data) {
                                        $('div').each(function (i, elem) {
                                            if ($(this).hasClass('classSet_' + el.value)) {
                                                if (el.checked == true) {
                                                    $(elem).show();
                                                } else {
                                                    $(elem).hide();
                                                }
                                            }
                                        });
                                    },
                                    error: function (data) {
                                        console.log('Error', data);
                                        window.alert('Error!');
                                    }
                                });
                            });
                        });
                    });
                </script>"; return $content; } private static function mainPage(): string { $itemId = RequestData::custom('item_id'); $currentItem = EmployeePropertyAR::getSessionCashe(EmployeePropertyAR::CACHE_36); if ( $itemId === '' || $itemId === '0' ) { if ( $currentItem !== '' && $currentItem !== '0' ) { $itemId = $currentItem; } else { $itemId = self::ITEM_1; $currentItem = $itemId; } } $currentItem = $itemId; EmployeePropertyAR::saveSessionCashe(EmployeePropertyAR::CACHE_36, $itemId); $content = ''; $menuArray = []; if (1 === OperatorAccess::isAccess(OperatorAccess::RIGHT_SETTING)) { $menuArray[] = [ 1 => '!', 2 => self::ITEM_1 ]; if (Central::$erpProfileChapters[ErpProfileDto::CHAPTER_MAP]) { $menuArray[] = [ 1 => Lang::getPhrase(647), 2 => self::ITEM_4 ]; } if (Central::$erpProfileChapters[ErpProfileDto::CHAPTER_DEVICE]) { $menuArray[] = [ 1 => Lang::getPhrase(624), 2 => self::ITEM_7 ]; } } if ( Central::$isUSOnline === true || 1 === OperatorAccess::isAccess(OperatorAccess::RIGHT_SETTING) ) { $menuArray[] = [ 1 => Lang::getPhrase(3809), 2 => self::ITEM_18 ]; } if (1 === OperatorAccess::isAccess(OperatorAccess::RIGHT_SETTING)) { $menuArray[] = [ 1 => Lang::getPhrase(3833), 2 => self::ITEM_19 ]; $menuArray[] = [ 1 => Lang::getPhrase(4743), 2 => self::ITEM_20 ]; if (Central::$erpProfileChapters[ErpProfileDto::CHAPTER_CUSTOMER]) { $menuArray[] = [ 1 => Lang::getPhrase(720), 2 => self::ITEM_2 ]; } if (Central::$erpProfileChapters[ErpProfileDto::CHAPTER_ACCOUNTANCY]) { $menuArray[] = [ 1 => Lang::getPhrase(607), 2 => self::ITEM_3 ]; } if (Central::$erpProfileChapters[ErpProfileDto::CHAPTER_CUSTOMER]) { $menuArray[] = [ 1 => Lang::getPhrase(595), 2 => self::ITEM_10 ]; } if ( Central::$erpProfileChapters[ErpProfileDto::CHAPTER_CUSTOMER] && 1 === SettingAR::getByNameInt(SettingsCatalog::NEWIN_IS) ) { $menuArray[] = [ 1 => Lang::getPhrase(4805), 2 => self::ITEM_21 ]; } $menuArray[] = [ 1 => Lang::getPhrase(5365), 2 => self::ITEM_23 ]; if (Central::$erpProfileChapters[ErpProfileDto::CHAPTER_WAREHOUSE]) { $menuArray[] = [ 1 => Lang::getPhrase(639), 2 => self::ITEM_24 ]; } $menuArray[] = [ 1 => Lang::getPhrase(652), 2 => self::ITEM_25 ]; if (Central::$erpProfileChapters[ErpProfileDto::CHAPTER_NODE]) { $menuArray[] = [ 1 => Lang::getPhrase(3802), 2 => self::ITEM_26 ]; } $menuArray[] = [ 1 => Lang::getPhrase(6068), 2 => self::ITEM_28 ]; $menuArray[] = [ 1 => 'WebSocket', 2 => self::ITEM_27 ]; } $menuArray = Central::sort( data: $menuArray, sortElement: 1, isSortAbc: true ); if ( Central::$isUSOnline === true || 1 === OperatorAccess::isAccess(OperatorAccess::RIGHT_SETTING) ) { if (Central::$isUSOnline !== true) { $menuArray[0] = [ 1 => Lang::getPhrase(719), 2 => self::ITEM_1 ]; } $menuArray[] = [ 1 => Lang::getPhrase(5383), 2 => self::ITEM_98 ]; $menuArray[] = [ 1 => Lang::getPhrase(730), 2 => self::ITEM_99 ]; } $isFind = false; foreach ($menuArray as $value) { if ((string)$value[2] === $itemId) { $isFind = true; } } if ($isFind === false) { EmployeePropertyAR::saveSessionCashe(EmployeePropertyAR::CACHE_36, self::ITEM_1); Html::locationCancel(); } $content .= '
            <div>
                <script>
                    function menu_set_change(ps_razdel) {
                        for (var i = 0; i < 100; i++) {
                            $("#element_menu_f_" + i).hide();
                            $("#element_menu_s_" + i).show();
                        }
                        hideel("element_menu_s_" + ps_razdel);
                        showel("element_menu_f_" + ps_razdel);
                        $("#menu_set_body").load("?core_section=settings_main&action=load_menu_body&id=" + ps_razdel);
                    }
                </script>            
                <div class="menu_div_leftblock">
                    <ul>'; foreach ($menuArray as $value) { $content .= '
                            <li '; if ((string)$value[2] !== $currentItem) { $content .= 'style="display:none" '; } $content .= 'id="element_menu_f_' . $value[2] . '">
                            <span class="select_punkt">' . $value[1] . '</span>
                        </li>
                        <li '; if ((string)$value[2] === (string)$currentItem) { $content .= 'style="display:none" '; } $content .= 'id="element_menu_s_' . $value[2] . '">
                            <a id="linkMenuSet' . $value[2] . 'Id" href="javascript:menu_set_change(\'' . $value[2] . '\')" class="link_dashed"><span>' . $value[1] . '</span></a>
                        </li>'; } $content .= '
                    </ul>
                </div>
                <div class="menu_div_rightblock">
                    <div id="menu_set_body" style="width: 100%;">'; $content .= self::editSettingsOption($currentItem) . '</div>
                </div>
            </div>'; return $content; } } 
/* cust:td:A30283E6_Z5aa2Kens54vGy/zwT9ZZNvyCm5SK8Ql */

Function Calls

None

Variables

None

Stats

MD5 dd49942a94232fc4263e2f19fbf1a1ca
Eval Count 0
Decode Time 354 ms