Server IP : 80.87.202.40 / Your IP : 216.73.216.169 Web Server : Apache System : Linux rospirotorg.ru 5.14.0-539.el9.x86_64 #1 SMP PREEMPT_DYNAMIC Thu Dec 5 22:26:13 UTC 2024 x86_64 User : bitrix ( 600) PHP Version : 8.2.27 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : ON Directory : /home/bitrix/ext_www/cvetdv.ru/bitrix/modules/wbs24.ozonapinew/admin/ |
Upload File : |
<?php use Bitrix\Main\Grid\Options as GridOptions; use Bitrix\Main\UI\PageNavigation; use Bitrix\Main\Loader; use Wbs24\Ozonapinew\Logger\Table as LoggerTable; use Bitrix\Main\Localization\Loc; require_once($_SERVER["DOCUMENT_ROOT"]."/bitrix/modules/main/include/prolog_admin_before.php"); require_once ($_SERVER["DOCUMENT_ROOT"]."/bitrix/modules/main/include/prolog_admin_after.php"); Loc::loadMessages(__FILE__); $gridId = 'WBS24_OZONAPINEW_LOG_LIST'; $gridOptions = new GridOptions($gridId); $navParams = $gridOptions->GetNavParams(); $nav = new PageNavigation($gridId); $nav->allowAllRecords(false) ->setPageSize($navParams['nPageSize']) ->initFromUri() ; if ($nav->allRecordsShown()) { $navParams = false; } else { $navParams['iNumPage'] = $nav->getCurrentPage(); } $fields = [ 'id', "account_index", 'timestamp', 'entity_type', 'log_type', 'api_method', 'message', 'api_request', 'api_response', ]; $getListOptions = array( "select" => $fields, "order" => ["id" => "DESC"], "filter" => [], 'limit' => $navParams['nPageSize'], 'offset' => $navParams['nPageSize'] * ($navParams['iNumPage'] - 1), 'count_total' => true ); $queryResult = LoggerTable::getList($getListOptions); $logsCount = $queryResult->getCount(); $logsData = $queryResult->fetchAll(); $nav->setRecordCount($logsCount); $list = []; foreach($logsData as $k => $row) { foreach ($fields as $field) { if ($field == 'entity_type') { $temp['data'][$field] = Loc::getMessage("WBS24.OZONAPINEW.".strtoupper($row[$field])); continue; } if ($field == 'log_type') { $temp['data'][$field] = Loc::getMessage("WBS24.OZONAPINEW.".strtoupper($row[$field])); continue; } $temp['data'][$field] = $row[$field]; } $list[] = $temp; $temp = []; } $columns = []; $i = 0; foreach ($fields as $field) { $columns[] = [ 'id' => $field, 'name' => Loc::getMessage("WBS24.OZONAPINEW.".strtoupper($field)), 'content' => Loc::getMessage("WBS24.OZONAPINEW.".strtoupper($field)), 'title' => Loc::getMessage("WBS24.OZONAPINEW.".strtoupper($field)), 'column_sort' => 100 + $i, 'default' => true ]; $i += 100; } $gridParams = [ 'GRID_ID' => $gridId, 'COLUMNS' => $columns, 'ROWS' => $list, 'FOOTER' => [ 'TOTAL_ROWS_COUNT' => $logsCount, ], 'SHOW_ROW_CHECKBOXES' => false, 'NAV_OBJECT' => $nav, 'AJAX_MODE' => 'Y', 'AJAX_ID' => \CAjax::getComponentID('bitrix:main.ui.grid', '.default', ''), 'PAGE_SIZES' => [ ['NAME' => "5", 'VALUE' => '5'], ['NAME' => '10', 'VALUE' => '10'], ['NAME' => '20', 'VALUE' => '20'], ['NAME' => '50', 'VALUE' => '50'], ['NAME' => '100', 'VALUE' => '100'] ], 'AJAX_OPTION_JUMP' => 'N', 'SHOW_CHECK_ALL_CHECKBOXES' => false, 'SHOW_ROW_ACTIONS_MENU' => true, 'SHOW_GRID_SETTINGS_MENU' => true, 'SHOW_NAVIGATION_PANEL' => true, 'SHOW_PAGINATION' => true, 'SHOW_SELECTED_COUNTER' => false, 'SHOW_TOTAL_COUNTER' => true, 'SHOW_PAGESIZE' => true, 'SHOW_ACTION_PANEL' => false, 'ALLOW_COLUMNS_SORT' => false, 'ALLOW_COLUMNS_RESIZE' => true, 'ALLOW_HORIZONTAL_SCROLL' => true, 'ALLOW_SORT' => true, 'ALLOW_PIN_HEADER' => true, 'AJAX_OPTION_HISTORY' => 'N', 'ACTION_PANEL' => [], ]; $APPLICATION->IncludeComponent('bitrix:main.ui.grid', '', $gridParams);