From faf0217b522a22e19de5e57eba94eb5b531aae0a Mon Sep 17 00:00:00 2001 From: stasbilay02 Date: Mon, 18 Nov 2024 13:56:00 +0300 Subject: [PATCH] some fix --- app/modules/tag/TagModule.php | 38 +++++++++++++++++++ app/modules/tag/controllers/TagController.php | 13 +++++++ app/modules/tag/manifest.json | 12 ++++++ app/modules/tag/routs/tag.php | 2 + kernel/modules/menu/service/MenuService.php | 3 -- kernel/views/module/index.php | 8 ++-- views/widgets/admin/menu.php | 2 +- 7 files changed, 70 insertions(+), 8 deletions(-) create mode 100644 app/modules/tag/TagModule.php create mode 100644 app/modules/tag/controllers/TagController.php create mode 100644 app/modules/tag/manifest.json create mode 100644 app/modules/tag/routs/tag.php diff --git a/app/modules/tag/TagModule.php b/app/modules/tag/TagModule.php new file mode 100644 index 0000000..b2f0ffd --- /dev/null +++ b/app/modules/tag/TagModule.php @@ -0,0 +1,38 @@ +menuService = new MenuService(); + $this->migrationService = new MigrationService(); + } + + /** + * @throws \Exception + */ + public function init(): void + { + $this->migrationService->runAtPath("{KERNEL_APP_MODULES}/tag/migrations"); + + $this->menuService->createItem([ + "label" => "Тэги", + "url" => "/admin/tag", + "slug" => "tag", + ]); + } + + public function deactivate(): void + { + $this->menuService->removeItemBySlug("tag"); + } +} \ No newline at end of file diff --git a/app/modules/tag/controllers/TagController.php b/app/modules/tag/controllers/TagController.php new file mode 100644 index 0000000..e0212a2 --- /dev/null +++ b/app/modules/tag/controllers/TagController.php @@ -0,0 +1,13 @@ +isEmpty()){ foreach ($child as $item){ -// if ($item->url === \kernel\Request::getUrlPath()){ -// return true; -// } if (strripos(Request::getUrlPath(), $item->url) !== false) { return true; } diff --git a/kernel/views/module/index.php b/kernel/views/module/index.php index 3fcff21..8bf0051 100644 --- a/kernel/views/module/index.php +++ b/kernel/views/module/index.php @@ -47,10 +47,10 @@ $table->addAction(function ($row, $url) use ($moduleService) { return "Просмотр"; }); -$table->addAction(function ($row, $url) use ($moduleService) { - $slug = $row['slug']; - return "Обновить"; -}); +//$table->addAction(function ($row, $url) use ($moduleService) { +// $slug = $row['slug']; +// return "Обновить"; +//}); $table->create(); diff --git a/views/widgets/admin/menu.php b/views/widgets/admin/menu.php index fe5773b..124c239 100644 --- a/views/widgets/admin/menu.php +++ b/views/widgets/admin/menu.php @@ -18,7 +18,7 @@ -
  • "> +
  • "> label ?>