some
This commit is contained in:
parent
de690dfd39
commit
c23b84bcea
@ -42,13 +42,31 @@ class ModuleShopClientController extends AdminController
|
|||||||
*/
|
*/
|
||||||
public function actionIndex(int $page_number = 1): void
|
public function actionIndex(int $page_number = 1): void
|
||||||
{
|
{
|
||||||
|
|
||||||
if ($this->moduleService->issetModuleShopToken()) {
|
if ($this->moduleService->issetModuleShopToken()) {
|
||||||
if ($this->moduleService->isServerAvailable()) {
|
if ($this->moduleService->isServerAvailable()) {
|
||||||
|
|
||||||
|
$request = new Request();
|
||||||
|
$filters = $request->get();
|
||||||
|
|
||||||
$per_page = 8;
|
$per_page = 8;
|
||||||
$modules_info = RESTClient::request($_ENV['MODULE_SHOP_URL'] . '/api/module_shop/gb_slug');
|
$modules = RESTClient::request($_ENV['MODULE_SHOP_URL'] . '/api/module_shop/gb_slug');
|
||||||
$modules_info = json_decode($modules_info->getBody()->getContents(), true);
|
$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);
|
$module_count = count($modules_info);
|
||||||
$modules_info = array_slice($modules_info, $per_page * ($page_number - 1), $per_page);
|
$modules_info = array_slice($modules_info, $per_page * ($page_number - 1), $per_page);
|
||||||
|
|
||||||
|
@ -0,0 +1,16 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace kernel\modules\module_shop_client\services;
|
||||||
|
|
||||||
|
use kernel\helpers\RESTClient;
|
||||||
|
|
||||||
|
class ModuleShopClientService
|
||||||
|
{
|
||||||
|
public function getModulesInfo(string $url)
|
||||||
|
{
|
||||||
|
// $modules_info = RESTClient::request($url);
|
||||||
|
// $modules_info = json_decode($modules_info->getBody()->getContents(), true);
|
||||||
|
// $module_count = count($modules_info);
|
||||||
|
// $modules_info = array_slice($modules_info, $per_page * ($page_number - 1), $per_page);
|
||||||
|
}
|
||||||
|
}
|
@ -19,7 +19,8 @@ $table = new ListEloquentTable(new EloquentDataProvider(Post::class, [
|
|||||||
'currentPage' => $page_number,
|
'currentPage' => $page_number,
|
||||||
'perPage' => 3,
|
'perPage' => 3,
|
||||||
'params' => ["class" => "table table-bordered", "border" => "2"],
|
'params' => ["class" => "table table-bordered", "border" => "2"],
|
||||||
'baseUrl' => "/admin/post"
|
'baseUrl' => "/admin/post",
|
||||||
|
'showFiltersRow' => false,
|
||||||
]));
|
]));
|
||||||
|
|
||||||
$view->setTitle("Список постов");
|
$view->setTitle("Список постов");
|
||||||
|
@ -117,7 +117,7 @@ class AdminThemeService
|
|||||||
$modulesInfo = json_decode($modulesInfo->getBody()->getContents(), true);
|
$modulesInfo = json_decode($modulesInfo->getBody()->getContents(), true);
|
||||||
|
|
||||||
$themeInfo = $this->getAdminThemeInfo($slug);
|
$themeInfo = $this->getAdminThemeInfo($slug);
|
||||||
Debug::dd($themeInfo);
|
// Debug::dd($themeInfo);
|
||||||
foreach ($modulesInfo as $mod) {
|
foreach ($modulesInfo as $mod) {
|
||||||
if ($mod['slug'] === $themeInfo['slug'] && $mod['version'] === $themeInfo['version']) {
|
if ($mod['slug'] === $themeInfo['slug'] && $mod['version'] === $themeInfo['version']) {
|
||||||
return true;
|
return true;
|
||||||
|
Loading…
Reference in New Issue
Block a user