diff --git a/kernel/admin_themes/default/layout/main.php b/kernel/admin_themes/default/layout/main.php index a8646d7..98be7fb 100644 --- a/kernel/admin_themes/default/layout/main.php +++ b/kernel/admin_themes/default/layout/main.php @@ -26,10 +26,13 @@
-
- - -
+
+ + +
- +
diff --git a/kernel/filters/BootstrapSelectFilter.php b/kernel/filters/BootstrapSelectFilter.php index 26e01d6..86daceb 100644 --- a/kernel/filters/BootstrapSelectFilter.php +++ b/kernel/filters/BootstrapSelectFilter.php @@ -13,8 +13,9 @@ class BootstrapSelectFilter extends Filter { $select = SelectBuilder::build($this->name, [ 'class' => 'form-control', - 'options' => $this->param, + 'options' => $this->params['options'], 'value' => $this->value, + 'prompt' => $this->params['prompt'] ?? null, ]); return "" . $select->create()->fetch() . ""; diff --git a/kernel/filters/BootstrapSelectFilterWithPrompt.php b/kernel/filters/BootstrapSelectFilterWithPrompt.php deleted file mode 100644 index 4b4f974..0000000 --- a/kernel/filters/BootstrapSelectFilterWithPrompt.php +++ /dev/null @@ -1,23 +0,0 @@ -name, [ - 'class' => 'form-control', - 'options' => $this->param, - 'value' => $this->value, - 'prompt' => "Не выбрано" - ]); - - return "" . $select->create()->fetch() . ""; - } -} \ No newline at end of file diff --git a/kernel/modules/module_shop_client/controllers/ModuleShopClientController.php b/kernel/modules/module_shop_client/controllers/ModuleShopClientController.php index cc74f32..13c4e6c 100644 --- a/kernel/modules/module_shop_client/controllers/ModuleShopClientController.php +++ b/kernel/modules/module_shop_client/controllers/ModuleShopClientController.php @@ -156,24 +156,71 @@ class ModuleShopClientController extends AdminController $this->redirect('/admin/module_shop_client', 302); } +// public function actionSearch(int $page_number = 1): void +// { +// $request = new Request(); +// $filters = $request->get(); +//// Debug::dd($filters); +// if ($this->moduleService->issetModuleShopToken()) { +// if ($this->moduleService->isServerAvailable()) { +// $modules_info = []; +// $per_page = 8; +// $modules = RESTClient::request($_ENV['MODULE_SHOP_URL'] . '/api/module_shop/gb_slug'); +// $modules = json_decode($modules->getBody()->getContents(), true); +// foreach ($modules as $module) { +// foreach ($filters as $key => $value) { +// if ($value === '') continue; +// if ($module[$key] !== $value) { +// break; +// } +// +// $modules_info[] = $module; +// } +// } +// $module_count = count($modules_info); +// $modules_info = array_slice($modules_info, $per_page * ($page_number - 1), $per_page); +// +// $this->cgView->render("index.php", [ +// 'modules_info' => $modules_info, +// 'moduleService' => $this->moduleService, +// 'page_number' => $page_number, +// 'module_count' => $module_count, +// 'per_page' => $per_page, +// 'kernelService' => new KernelService(), +// 'adminThemeService' => new AdminThemeService(), +// 'filterValues' => $filters +// ]); +// } else { +// $this->cgView->render("module_shop_error_connection.php"); +// } +// +// } else { +// $this->cgView->render("login_at_module_shop.php"); +// } +// } + public function actionSearch(int $page_number = 1): void { $request = new Request(); $filters = $request->get(); if ($this->moduleService->issetModuleShopToken()) { if ($this->moduleService->isServerAvailable()) { - $modules_info = []; +// $modules_info = []; $per_page = 8; - $modules = RESTClient::request($_ENV['MODULE_SHOP_URL'] . '/api/module_shop/gb_slug'); - $modules = json_decode($modules->getBody()->getContents(), true); - foreach ($modules as $module) { - foreach ($filters as $key => $value) { + $modules_info = RESTClient::request($_ENV['MODULE_SHOP_URL'] . '/api/module_shop/gb_slug'); + $modules_info = json_decode($modules_info->getBody()->getContents(), true); + foreach ($modules_info as $key => $module) { + foreach ($filters as $column => $value) { if ($value === '') continue; - if ($module[$key] !== $value) { - break; + if (is_numeric($value)) { + if ($module[$column] !== $value) { + unset($modules_info[$key]); + } + } elseif (is_string($value)) { + if (!str_contains($module[$column], $value)) { + unset($modules_info[$key]); + } } - - $modules_info[] = $module; } } $module_count = count($modules_info); @@ -209,7 +256,7 @@ class ModuleShopClientController extends AdminController $moduleShopService = new ModuleShopService(); $result = $moduleShopService->email_auth($address); - if ($result['status'] == 'success'){ + if ($result['status'] == 'success') { $this->cgView->render('enter_code.php', ['email' => $address]); } @@ -224,7 +271,7 @@ class ModuleShopClientController extends AdminController $moduleShopService = new ModuleShopService(); $result = $moduleShopService->code_check($code); - if (isset($result['access_token'])){ + if (isset($result['access_token'])) { $envFile = \EnvEditor\EnvFile::loadFrom(ROOT_DIR . "/.env"); diff --git a/kernel/modules/module_shop_client/views/index.php b/kernel/modules/module_shop_client/views/index.php index b0bdf4c..f3474d4 100644 --- a/kernel/modules/module_shop_client/views/index.php +++ b/kernel/modules/module_shop_client/views/index.php @@ -12,6 +12,7 @@ use Itguild\Tables\ListJsonTable; use kernel\widgets\ActionButtonWidget; + $meta = []; $meta['columns'] = [ "name" => "Название", @@ -42,10 +43,13 @@ $table->addAction(function ($row, $url) use ($moduleService) { $table->columns([ 'type' => [ 'filter' => [ - 'class' => \kernel\filters\BootstrapSelectFilterWithPrompt::class, - 'param' => [ - 'kernel' => 'kernel', - 'entity' => 'entity', + 'class' => \kernel\filters\BootstrapSelectFilter::class, + 'params' => [ + 'options' => [ + 'kernel' => 'kernel', + 'entity' => 'entity', + ], + 'prompt' => 'Не выбрано' ], 'value' => $filterValues['type'] ?? '' ], diff --git a/kernel/modules/post/views/index.php b/kernel/modules/post/views/index.php index b3a1067..4b47124 100644 --- a/kernel/modules/post/views/index.php +++ b/kernel/modules/post/views/index.php @@ -26,8 +26,6 @@ $table = new ListEloquentTable(new EloquentDataProvider(Post::class, [ 'searchParams' => $get, ])); -//\kernel\helpers\Debug::dd((new \kernel\Request())->get()); - $view->setTitle("Список постов"); $view->setMeta([ 'description' => 'Список постов системы' @@ -72,12 +70,13 @@ $table->columns([ return User::find($data)->username; }, 'filter' => [ - 'class' => \kernel\filters\BootstrapSelectFilterWithPrompt::class, - 'param' => \kernel\modules\user\service\UserService::createUsernameArr(), + 'class' => \kernel\filters\BootstrapSelectFilter::class, + 'params' => [ + 'options' => \kernel\modules\user\service\UserService::createUsernameArr(), + 'prompt' => 'Не выбрано' + ], 'value' => $get['user_id'] ?? '', - 'prompt' => 'dsds' ], - 'prompt' => 'dsds' ] ]); diff --git a/kernel/modules/user/controllers/UserController.php b/kernel/modules/user/controllers/UserController.php index dc5f028..ddf0651 100644 --- a/kernel/modules/user/controllers/UserController.php +++ b/kernel/modules/user/controllers/UserController.php @@ -144,4 +144,13 @@ class UserController extends AdminController $this->redirect("/admin/user/"); } + public function actionProfile(): void + { + $user = UserService::getAuthUser(); + if (!$user){ + throw new Exception(message: "The user not found"); + } + $this->cgView->render("view.php", ['user' => $user]); + } + } \ No newline at end of file diff --git a/kernel/modules/user/routs/user.php b/kernel/modules/user/routs/user.php index 5572c92..7360b89 100644 --- a/kernel/modules/user/routs/user.php +++ b/kernel/modules/user/routs/user.php @@ -17,6 +17,7 @@ App::$collector->group(["prefix" => "admin"], function (RouteCollector $router){ App::$collector->any('/update/{id}', [\kernel\modules\user\controllers\UserController::class, 'actionUpdate']); App::$collector->any("/edit/{id}", [\kernel\modules\user\controllers\UserController::class, 'actionEdit']); App::$collector->get('/delete/{id}', [\kernel\modules\user\controllers\UserController::class, 'actionDelete']); + App::$collector->get('/profile', [\kernel\modules\user\controllers\UserController::class, 'actionProfile']); }); }); }); \ No newline at end of file diff --git a/resources/admin_theme/scss/bootstrap/_images.scss b/resources/admin_theme/scss/bootstrap/_images.scss index cb9795e..5986757 100755 --- a/resources/admin_theme/scss/bootstrap/_images.scss +++ b/resources/admin_theme/scss/bootstrap/_images.scss @@ -1,9 +1,9 @@ -// Responsive images (ensure images don't scale beyond their parents) +// Responsive default_user_photo (ensure default_user_photo don't scale beyond their parents) // // This is purposefully opt-in via an explicit class rather than being the default for all ``s. -// We previously tried the "images are responsive by default" approach in Bootstrap v2, +// We previously tried the "default_user_photo are responsive by default" approach in Bootstrap v2, // and abandoned it in Bootstrap v3 because it breaks lots of third-party widgets (including Google Maps) -// which weren't expecting the images within themselves to be involuntarily resized. +// which weren't expecting the default_user_photo within themselves to be involuntarily resized. // See also https://github.com/twbs/bootstrap/issues/18178 .img-fluid { @include img-fluid; diff --git a/resources/admin_theme/scss/bootstrap/_reboot.scss b/resources/admin_theme/scss/bootstrap/_reboot.scss index c55d42e..3a55596 100755 --- a/resources/admin_theme/scss/bootstrap/_reboot.scss +++ b/resources/admin_theme/scss/bootstrap/_reboot.scss @@ -249,7 +249,7 @@ figure { img { vertical-align: middle; - border-style: none; // Remove the border on images inside links in IE 10-. + border-style: none; // Remove the border on default_user_photo inside links in IE 10-. } svg { diff --git a/resources/admin_theme/scss/bootstrap/mixins/_image.scss b/resources/admin_theme/scss/bootstrap/mixins/_image.scss index a76a608..e6ee7a7 100755 --- a/resources/admin_theme/scss/bootstrap/mixins/_image.scss +++ b/resources/admin_theme/scss/bootstrap/mixins/_image.scss @@ -5,12 +5,12 @@ // Responsive image // -// Keep images from scaling beyond the width of their parents. +// Keep default_user_photo from scaling beyond the width of their parents. @mixin img-fluid { // Part 1: Set a maximum relative to the parent max-width: 100%; - // Part 2: Override the height to auto, otherwise images will be stretched + // Part 2: Override the height to auto, otherwise default_user_photo will be stretched // when setting a width and height attribute on the img element. height: auto; } diff --git a/resources/custom/scss/bootstrap/_images.scss b/resources/custom/scss/bootstrap/_images.scss index cb9795e..5986757 100755 --- a/resources/custom/scss/bootstrap/_images.scss +++ b/resources/custom/scss/bootstrap/_images.scss @@ -1,9 +1,9 @@ -// Responsive images (ensure images don't scale beyond their parents) +// Responsive default_user_photo (ensure default_user_photo don't scale beyond their parents) // // This is purposefully opt-in via an explicit class rather than being the default for all ``s. -// We previously tried the "images are responsive by default" approach in Bootstrap v2, +// We previously tried the "default_user_photo are responsive by default" approach in Bootstrap v2, // and abandoned it in Bootstrap v3 because it breaks lots of third-party widgets (including Google Maps) -// which weren't expecting the images within themselves to be involuntarily resized. +// which weren't expecting the default_user_photo within themselves to be involuntarily resized. // See also https://github.com/twbs/bootstrap/issues/18178 .img-fluid { @include img-fluid; diff --git a/resources/custom/scss/bootstrap/_reboot.scss b/resources/custom/scss/bootstrap/_reboot.scss index c55d42e..3a55596 100755 --- a/resources/custom/scss/bootstrap/_reboot.scss +++ b/resources/custom/scss/bootstrap/_reboot.scss @@ -249,7 +249,7 @@ figure { img { vertical-align: middle; - border-style: none; // Remove the border on images inside links in IE 10-. + border-style: none; // Remove the border on default_user_photo inside links in IE 10-. } svg { diff --git a/resources/custom/scss/bootstrap/mixins/_image.scss b/resources/custom/scss/bootstrap/mixins/_image.scss index a76a608..e6ee7a7 100755 --- a/resources/custom/scss/bootstrap/mixins/_image.scss +++ b/resources/custom/scss/bootstrap/mixins/_image.scss @@ -5,12 +5,12 @@ // Responsive image // -// Keep images from scaling beyond the width of their parents. +// Keep default_user_photo from scaling beyond the width of their parents. @mixin img-fluid { // Part 1: Set a maximum relative to the parent max-width: 100%; - // Part 2: Override the height to auto, otherwise images will be stretched + // Part 2: Override the height to auto, otherwise default_user_photo will be stretched // when setting a width and height attribute on the img element. height: auto; } diff --git a/resources/default/scss/bootstrap/_images.scss b/resources/default/scss/bootstrap/_images.scss index cb9795e..5986757 100755 --- a/resources/default/scss/bootstrap/_images.scss +++ b/resources/default/scss/bootstrap/_images.scss @@ -1,9 +1,9 @@ -// Responsive images (ensure images don't scale beyond their parents) +// Responsive default_user_photo (ensure default_user_photo don't scale beyond their parents) // // This is purposefully opt-in via an explicit class rather than being the default for all ``s. -// We previously tried the "images are responsive by default" approach in Bootstrap v2, +// We previously tried the "default_user_photo are responsive by default" approach in Bootstrap v2, // and abandoned it in Bootstrap v3 because it breaks lots of third-party widgets (including Google Maps) -// which weren't expecting the images within themselves to be involuntarily resized. +// which weren't expecting the default_user_photo within themselves to be involuntarily resized. // See also https://github.com/twbs/bootstrap/issues/18178 .img-fluid { @include img-fluid; diff --git a/resources/default/scss/bootstrap/_reboot.scss b/resources/default/scss/bootstrap/_reboot.scss index c55d42e..3a55596 100755 --- a/resources/default/scss/bootstrap/_reboot.scss +++ b/resources/default/scss/bootstrap/_reboot.scss @@ -249,7 +249,7 @@ figure { img { vertical-align: middle; - border-style: none; // Remove the border on images inside links in IE 10-. + border-style: none; // Remove the border on default_user_photo inside links in IE 10-. } svg { diff --git a/resources/default/scss/bootstrap/mixins/_image.scss b/resources/default/scss/bootstrap/mixins/_image.scss index a76a608..e6ee7a7 100755 --- a/resources/default/scss/bootstrap/mixins/_image.scss +++ b/resources/default/scss/bootstrap/mixins/_image.scss @@ -5,12 +5,12 @@ // Responsive image // -// Keep images from scaling beyond the width of their parents. +// Keep default_user_photo from scaling beyond the width of their parents. @mixin img-fluid { // Part 1: Set a maximum relative to the parent max-width: 100%; - // Part 2: Override the height to auto, otherwise images will be stretched + // Part 2: Override the height to auto, otherwise default_user_photo will be stretched // when setting a width and height attribute on the img element. height: auto; } diff --git a/resources/images/noPhoto.png b/resources/default_user_photo/noPhoto.png similarity index 100% rename from resources/images/noPhoto.png rename to resources/default_user_photo/noPhoto.png diff --git a/resources/simple/scss/bootstrap/_images.scss b/resources/simple/scss/bootstrap/_images.scss index cb9795e..5986757 100755 --- a/resources/simple/scss/bootstrap/_images.scss +++ b/resources/simple/scss/bootstrap/_images.scss @@ -1,9 +1,9 @@ -// Responsive images (ensure images don't scale beyond their parents) +// Responsive default_user_photo (ensure default_user_photo don't scale beyond their parents) // // This is purposefully opt-in via an explicit class rather than being the default for all ``s. -// We previously tried the "images are responsive by default" approach in Bootstrap v2, +// We previously tried the "default_user_photo are responsive by default" approach in Bootstrap v2, // and abandoned it in Bootstrap v3 because it breaks lots of third-party widgets (including Google Maps) -// which weren't expecting the images within themselves to be involuntarily resized. +// which weren't expecting the default_user_photo within themselves to be involuntarily resized. // See also https://github.com/twbs/bootstrap/issues/18178 .img-fluid { @include img-fluid; diff --git a/resources/simple/scss/bootstrap/_reboot.scss b/resources/simple/scss/bootstrap/_reboot.scss index c55d42e..3a55596 100755 --- a/resources/simple/scss/bootstrap/_reboot.scss +++ b/resources/simple/scss/bootstrap/_reboot.scss @@ -249,7 +249,7 @@ figure { img { vertical-align: middle; - border-style: none; // Remove the border on images inside links in IE 10-. + border-style: none; // Remove the border on default_user_photo inside links in IE 10-. } svg { diff --git a/resources/simple/scss/bootstrap/mixins/_image.scss b/resources/simple/scss/bootstrap/mixins/_image.scss index a76a608..e6ee7a7 100755 --- a/resources/simple/scss/bootstrap/mixins/_image.scss +++ b/resources/simple/scss/bootstrap/mixins/_image.scss @@ -5,12 +5,12 @@ // Responsive image // -// Keep images from scaling beyond the width of their parents. +// Keep default_user_photo from scaling beyond the width of their parents. @mixin img-fluid { // Part 1: Set a maximum relative to the parent max-width: 100%; - // Part 2: Override the height to auto, otherwise images will be stretched + // Part 2: Override the height to auto, otherwise default_user_photo will be stretched // when setting a width and height attribute on the img element. height: auto; }