some fix
This commit is contained in:
parent
d2028e926b
commit
faf0217b52
38
app/modules/tag/TagModule.php
Normal file
38
app/modules/tag/TagModule.php
Normal file
@ -0,0 +1,38 @@
|
||||
<?php
|
||||
|
||||
namespace app\modules\tag;
|
||||
|
||||
use kernel\Module;
|
||||
use kernel\modules\menu\service\MenuService;
|
||||
use kernel\services\MigrationService;
|
||||
|
||||
class TagModule extends Module
|
||||
{
|
||||
|
||||
public MenuService $menuService;
|
||||
public MigrationService $migrationService;
|
||||
public function __construct()
|
||||
{
|
||||
$this->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");
|
||||
}
|
||||
}
|
13
app/modules/tag/controllers/TagController.php
Normal file
13
app/modules/tag/controllers/TagController.php
Normal file
@ -0,0 +1,13 @@
|
||||
<?php
|
||||
|
||||
namespace app\modules\tag\controllers;
|
||||
|
||||
class TagController extends \kernel\app_modules\tag\controllers\TagController
|
||||
{
|
||||
|
||||
public function actionByEntity()
|
||||
{
|
||||
// TODO
|
||||
}
|
||||
|
||||
}
|
12
app/modules/tag/manifest.json
Normal file
12
app/modules/tag/manifest.json
Normal file
@ -0,0 +1,12 @@
|
||||
{
|
||||
"name": "Tags",
|
||||
"version": "0.1",
|
||||
"author": "ITGuild",
|
||||
"slug": "tag",
|
||||
"description": "Tags module",
|
||||
"app_module_path": "{APP}/modules/{slug}",
|
||||
"module_class": "app\\modules\\tag\\TagModule",
|
||||
"module_class_file": "{APP}/modules/tag/TagModule.php",
|
||||
"routs": "routs/tag.php",
|
||||
"dependence": "menu"
|
||||
}
|
2
app/modules/tag/routs/tag.php
Normal file
2
app/modules/tag/routs/tag.php
Normal file
@ -0,0 +1,2 @@
|
||||
<?php
|
||||
include KERNEL_APP_MODULES_DIR . "/tag/routs/tag.php";
|
@ -105,9 +105,6 @@ class MenuService
|
||||
$child = self::getChild($id);
|
||||
if (!$child->isEmpty()){
|
||||
foreach ($child as $item){
|
||||
// if ($item->url === \kernel\Request::getUrlPath()){
|
||||
// return true;
|
||||
// }
|
||||
if (strripos(Request::getUrlPath(), $item->url) !== false) {
|
||||
return true;
|
||||
}
|
||||
|
@ -47,10 +47,10 @@ $table->addAction(function ($row, $url) use ($moduleService) {
|
||||
return "<a class='btn btn-primary' href='$url/view/?slug=$slug' style='margin: 3px; width: 150px;' >Просмотр</a>";
|
||||
});
|
||||
|
||||
$table->addAction(function ($row, $url) use ($moduleService) {
|
||||
$slug = $row['slug'];
|
||||
return "<a class='btn btn-primary' href='$url/update/?slug=$slug' style='margin: 3px; width: 150px;' >Обновить</a>";
|
||||
});
|
||||
//$table->addAction(function ($row, $url) use ($moduleService) {
|
||||
// $slug = $row['slug'];
|
||||
// return "<a class='btn btn-primary' href='$url/update/?slug=$slug' style='margin: 3px; width: 150px;' >Обновить</a>";
|
||||
//});
|
||||
|
||||
$table->create();
|
||||
|
||||
|
@ -18,7 +18,7 @@
|
||||
</ul>
|
||||
</li>
|
||||
<?php else: ?>
|
||||
<li class="<?= $item->url === \kernel\Request::getUrlPath() ? "active" : "" ?>">
|
||||
<li class="<?= $item->url === \kernel\Request::getUrlPath() || $item->url . "/module_shop_client" === \kernel\Request::getUrlPath() ? "active" : "" ?>">
|
||||
<a href="<?= $item->url ?>"><?= $item->label ?></a>
|
||||
</li>
|
||||
<?php endif; ?>
|
||||
|
Loading…
Reference in New Issue
Block a user