diff --git a/kernel/modules/module_shop_client/controllers/ModuleShopClientController.php b/kernel/modules/module_shop_client/controllers/ModuleShopClientController.php index d4d4102..68a96f2 100644 --- a/kernel/modules/module_shop_client/controllers/ModuleShopClientController.php +++ b/kernel/modules/module_shop_client/controllers/ModuleShopClientController.php @@ -42,13 +42,31 @@ class ModuleShopClientController extends AdminController */ public function actionIndex(int $page_number = 1): void { - if ($this->moduleService->issetModuleShopToken()) { if ($this->moduleService->isServerAvailable()) { + $request = new Request(); + $filters = $request->get(); + $per_page = 8; - $modules_info = RESTClient::request($_ENV['MODULE_SHOP_URL'] . '/api/module_shop/gb_slug'); - $modules_info = json_decode($modules_info->getBody()->getContents(), true); + $modules = RESTClient::request($_ENV['MODULE_SHOP_URL'] . '/api/module_shop/gb_slug'); + $modules = json_decode($modules->getBody()->getContents(), true); + if ($filters) { + $modules_info = []; + foreach ($modules as $module) { + foreach ($filters as $key => $value) { + if ($value === '') continue; + if ($module[$key] !== $value) { + break; + } + + $modules_info[] = $module; + } + } + } else { + $modules_info = $modules; + } + $module_count = count($modules_info); $modules_info = array_slice($modules_info, $per_page * ($page_number - 1), $per_page); diff --git a/kernel/modules/module_shop_client/services/ModuleShopClientService.php b/kernel/modules/module_shop_client/services/ModuleShopClientService.php new file mode 100644 index 0000000..9fbb496 --- /dev/null +++ b/kernel/modules/module_shop_client/services/ModuleShopClientService.php @@ -0,0 +1,16 @@ +getBody()->getContents(), true); +// $module_count = count($modules_info); +// $modules_info = array_slice($modules_info, $per_page * ($page_number - 1), $per_page); + } +} \ No newline at end of file diff --git a/kernel/modules/post/views/index.php b/kernel/modules/post/views/index.php index 045feb1..5cd2ee8 100644 --- a/kernel/modules/post/views/index.php +++ b/kernel/modules/post/views/index.php @@ -19,7 +19,8 @@ $table = new ListEloquentTable(new EloquentDataProvider(Post::class, [ 'currentPage' => $page_number, 'perPage' => 3, 'params' => ["class" => "table table-bordered", "border" => "2"], - 'baseUrl' => "/admin/post" + 'baseUrl' => "/admin/post", + 'showFiltersRow' => false, ])); $view->setTitle("Список постов"); diff --git a/kernel/services/AdminThemeService.php b/kernel/services/AdminThemeService.php index a0816f0..f8d5aea 100644 --- a/kernel/services/AdminThemeService.php +++ b/kernel/services/AdminThemeService.php @@ -117,7 +117,7 @@ class AdminThemeService $modulesInfo = json_decode($modulesInfo->getBody()->getContents(), true); $themeInfo = $this->getAdminThemeInfo($slug); - Debug::dd($themeInfo); +// Debug::dd($themeInfo); foreach ($modulesInfo as $mod) { if ($mod['slug'] === $themeInfo['slug'] && $mod['version'] === $themeInfo['version']) { return true;