diff --git a/app/modules/module_shop/controllers/ModuleShopController.php b/app/modules/module_shop/controllers/ModuleShopController.php
index 1f64435..e161b0b 100644
--- a/app/modules/module_shop/controllers/ModuleShopController.php
+++ b/app/modules/module_shop/controllers/ModuleShopController.php
@@ -84,42 +84,14 @@ class ModuleShopController extends AdminController
public function actionView(int $id): void
{
- $module = ModuleShop::find($id);
+ $module = ModuleShop::find($id);
if (!$module) {
throw new Exception("The module not found");
}
$this->cgView->render("view.php", ['module' => $module]);
}
- public function actionUpdate(int $id): void
- {
- $model = ModuleShop::find($id);
-
- if (!$model) {
- throw new Exception("The module not found");
- }
-
- $this->cgView->render("form.php", ['model' => $model]);
- }
-
- public function actionEdit(int $id): void
- {
- $module = ModuleShop::find($id);
-
- if (!$module) {
- throw new Exception("The module not found");
- }
- $moduleForm = new CreateModuleShopForm();
- $moduleForm->load($_REQUEST);
- if ($moduleForm->validate()) {
- $module = $this->moduleShopService->update($moduleForm, $module);
- if ($module) {
- $this->redirect("/admin/module_shop/" . $module->id);
- }
- }
- $this->redirect("/admin/module_shop/update/" . $id);
- }
public function actionDelete(int $id): void
{
diff --git a/app/modules/module_shop/models/ModuleShop.php b/app/modules/module_shop/models/ModuleShop.php
index acf631d..dbc05b1 100644
--- a/app/modules/module_shop/models/ModuleShop.php
+++ b/app/modules/module_shop/models/ModuleShop.php
@@ -22,7 +22,7 @@ class ModuleShop extends Model
protected $table = "module_shop";
- protected $fillable = ['name', 'slug', 'version', 'description', 'author', 'status', 'path_to_archive', 'dependence'];
+ protected $fillable = ['name', 'slug', 'version', 'description', 'author', 'status', 'dependence'];
public static function labels(): array
{
@@ -33,7 +33,6 @@ class ModuleShop extends Model
'author' => 'Автор',
'status' => 'Статус',
'slug' => 'Slug',
- 'path_to_archive' => 'Путь к файлу модуля',
'dependence' => 'Зависимости',
];
}
diff --git a/app/modules/module_shop/services/ModuleShopService.php b/app/modules/module_shop/services/ModuleShopService.php
index ab03f9d..33c6ac1 100644
--- a/app/modules/module_shop/services/ModuleShopService.php
+++ b/app/modules/module_shop/services/ModuleShopService.php
@@ -50,27 +50,4 @@ class ModuleShopService extends ModuleService
return false;
}
- public function packModule($module): void
- {
- $tmpModuleDir = md5(time());
- $authorSlug = Slug::createSlug($module->author);
- $nameSlug = Slug::createSlug($module->name);
- $tmpModuleDirFull = RESOURCES_DIR . '/tmp/modules/' . $tmpModuleDir . '/';
-
- $fileHelper = new Files();
- Debug::dd(APP_DIR . '/modules/' . $nameSlug);
- $fileHelper->copy_folder(APP_DIR . '/modules/' . $nameSlug, $tmpModuleDirFull . 'app/');
-// $fileHelper->copy_folder(KERNEL_APP_MODULES_DIR . '/' . $nameSlug, $tmpModuleDirFull . 'kernel/');
-
- $fileHelper->pack(
- $tmpModuleDirFull,
- RESOURCES_DIR . '/module_shop/' .
- $authorSlug . '/' .
- $module->slug . '/' .
- $module->version . '/' .
- $nameSlug . '.itguild'
- );
-
- $fileHelper->recursiveRemoveDir($tmpModuleDirFull);
- }
}
\ No newline at end of file
diff --git a/app/modules/module_shop/table/columns/ModuleShopDeleteActionColumn.php b/app/modules/module_shop/table/columns/ModuleShopDeleteActionColumn.php
deleted file mode 100644
index 375c0c4..0000000
--- a/app/modules/module_shop/table/columns/ModuleShopDeleteActionColumn.php
+++ /dev/null
@@ -1,16 +0,0 @@
-baseUrl . $this->prefix . $this->id;
- return " Удалить ";
- }
-}
\ No newline at end of file
diff --git a/app/modules/module_shop/table/columns/ModuleShopEditActionColumn.php b/app/modules/module_shop/table/columns/ModuleShopEditActionColumn.php
deleted file mode 100644
index 7a8794f..0000000
--- a/app/modules/module_shop/table/columns/ModuleShopEditActionColumn.php
+++ /dev/null
@@ -1,16 +0,0 @@
-baseUrl . $this->prefix . $this->id;
- return " Редактировать ";
- }
-}
\ No newline at end of file
diff --git a/app/modules/module_shop/table/columns/ModuleShopPackActionColumn.php b/app/modules/module_shop/table/columns/ModuleShopPackActionColumn.php
deleted file mode 100644
index b76a666..0000000
--- a/app/modules/module_shop/table/columns/ModuleShopPackActionColumn.php
+++ /dev/null
@@ -1,16 +0,0 @@
-baseUrl . $this->prefix . $this->id;
- return " Заархивировать ";
- }
-}
\ No newline at end of file
diff --git a/app/modules/module_shop/table/columns/ModuleShopViewActionColumn.php b/app/modules/module_shop/table/columns/ModuleShopViewActionColumn.php
deleted file mode 100644
index 3c5601d..0000000
--- a/app/modules/module_shop/table/columns/ModuleShopViewActionColumn.php
+++ /dev/null
@@ -1,16 +0,0 @@
-baseUrl . $this->prefix . $this->id;
- return " Просмотр ";
- }
-}
\ No newline at end of file
diff --git a/app/modules/module_shop/views/form.php b/app/modules/module_shop/views/form.php
index fad7789..a5a6a20 100644
--- a/app/modules/module_shop/views/form.php
+++ b/app/modules/module_shop/views/form.php
@@ -6,7 +6,7 @@
use app\modules\module_shop\models\ModuleShop;
$form = new \itguild\forms\ActiveForm();
-$form->beginForm(isset($model) ? "/admin/module_shop/edit/" . $model->id : "/admin/module_shop", enctype: 'multipart/form-data');
+$form->beginForm("/admin/module_shop", enctype: 'multipart/form-data');
diff --git a/app/modules/module_shop/views/index.php b/app/modules/module_shop/views/index.php
index b00b819..c2898b3 100644
--- a/app/modules/module_shop/views/index.php
+++ b/app/modules/module_shop/views/index.php
@@ -7,11 +7,9 @@
use app\modules\module_shop\models\ModuleShop;
use Itguild\EloquentTable\EloquentDataProvider;
use Itguild\EloquentTable\ListEloquentTable;
+use kernel\IGTabel\action_column\DeleteActionColumn;
+use kernel\IGTabel\action_column\ViewActionColumn;
use kernel\IGTabel\btn\PrimaryBtn;
-use kernel\models\Menu;
-use kernel\modules\menu\table\columns\MenuDeleteActionColumn;
-use kernel\modules\menu\table\columns\MenuEditActionColumn;
-use kernel\modules\menu\table\columns\MenuViewActionColumn;
$table = new ListEloquentTable(new EloquentDataProvider(\app\modules\module_shop\models\ModuleShop::class, [
'currentPage' => $page_number,
@@ -29,8 +27,7 @@ $table->beforePrint(function () {
return PrimaryBtn::create("Создать", "/admin/module_shop/create")->fetch();
//return (new PrimaryBtn("Создать", "/admin/user/create"))->fetch();
});
-$table->addAction(\app\modules\module_shop\table\columns\ModuleShopViewActionColumn::class);
-$table->addAction(\app\modules\module_shop\table\columns\ModuleShopEditActionColumn::class);
-$table->addAction(\app\modules\module_shop\table\columns\ModuleShopDeleteActionColumn::class);
+$table->addAction(ViewActionColumn::class);
+$table->addAction(DeleteActionColumn::class);
$table->create();
$table->render();
\ No newline at end of file
diff --git a/app/modules/module_shop/views/view.php b/app/modules/module_shop/views/view.php
index 48960df..576e7f0 100644
--- a/app/modules/module_shop/views/view.php
+++ b/app/modules/module_shop/views/view.php
@@ -18,7 +18,6 @@ $table = new ViewEloquentTable(new ViewJsonTableEloquentModel($module, [
]));
$table->beforePrint(function () use ($module) {
$btn = PrimaryBtn::create("Список", "/admin/module_shop")->fetch();
- $btn .= SuccessBtn::create("Редактировать", "/admin/module_shop/update/" . $module->id)->fetch();
$btn .= DangerBtn::create("Удалить", "/admin/module_shop/delete/" . $module->id)->fetch();
return $btn;
});
diff --git a/kernel/app_modules/tag/views/index.php b/kernel/app_modules/tag/views/index.php
index 0d5503f..ceacd8f 100644
--- a/kernel/app_modules/tag/views/index.php
+++ b/kernel/app_modules/tag/views/index.php
@@ -8,10 +8,6 @@ use Itguild\EloquentTable\EloquentDataProvider;
use Itguild\EloquentTable\ListEloquentTable;
use kernel\app_modules\tag\models\Tag;
use kernel\IGTabel\btn\PrimaryBtn;
-use kernel\models\Menu;
-use kernel\modules\menu\table\columns\MenuDeleteActionColumn;
-use kernel\modules\menu\table\columns\MenuEditActionColumn;
-use kernel\modules\menu\table\columns\MenuViewActionColumn;
$table = new ListEloquentTable(new EloquentDataProvider(Tag::class, [
'currentPage' => $page_number,
diff --git a/kernel/modules/menu/table/columns/MenuDeleteActionColumn.php b/kernel/modules/menu/table/columns/MenuDeleteActionColumn.php
deleted file mode 100644
index c47f86a..0000000
--- a/kernel/modules/menu/table/columns/MenuDeleteActionColumn.php
+++ /dev/null
@@ -1,17 +0,0 @@
-baseUrl . $this->prefix . $this->id;
- return " Удалить ";
- }
-}
\ No newline at end of file
diff --git a/kernel/modules/menu/table/columns/MenuEditActionColumn.php b/kernel/modules/menu/table/columns/MenuEditActionColumn.php
deleted file mode 100644
index b7de57e..0000000
--- a/kernel/modules/menu/table/columns/MenuEditActionColumn.php
+++ /dev/null
@@ -1,17 +0,0 @@
-baseUrl . $this->prefix . $this->id;
- return " Редактировать ";
- }
-}
\ No newline at end of file
diff --git a/kernel/modules/menu/table/columns/MenuViewActionColumn.php b/kernel/modules/menu/table/columns/MenuViewActionColumn.php
deleted file mode 100644
index bb9f3ad..0000000
--- a/kernel/modules/menu/table/columns/MenuViewActionColumn.php
+++ /dev/null
@@ -1,17 +0,0 @@
-baseUrl . $this->prefix . $this->id;
- return " Просмотр ";
- }
-}
\ No newline at end of file
diff --git a/kernel/modules/menu/views/index.php b/kernel/modules/menu/views/index.php
index f9cd7c9..4f445df 100644
--- a/kernel/modules/menu/views/index.php
+++ b/kernel/modules/menu/views/index.php
@@ -6,11 +6,11 @@
use Itguild\EloquentTable\EloquentDataProvider;
use Itguild\EloquentTable\ListEloquentTable;
+use kernel\IGTabel\action_column\DeleteActionColumn;
+use kernel\IGTabel\action_column\EditActionColumn;
+use kernel\IGTabel\action_column\ViewActionColumn;
use kernel\IGTabel\btn\PrimaryBtn;
use kernel\models\Menu;
-use kernel\modules\menu\table\columns\MenuDeleteActionColumn;
-use kernel\modules\menu\table\columns\MenuEditActionColumn;
-use kernel\modules\menu\table\columns\MenuViewActionColumn;
$table = new ListEloquentTable(new EloquentDataProvider(Menu::class, [
'currentPage' => $page_number,
@@ -28,8 +28,8 @@ $table->beforePrint(function () {
return PrimaryBtn::create("Создать", "/admin/settings/menu/create")->fetch();
//return (new PrimaryBtn("Создать", "/admin/user/create"))->fetch();
});
-$table->addAction(MenuViewActionColumn::class);
-$table->addAction(MenuEditActionColumn::class);
-$table->addAction(MenuDeleteActionColumn::class);
+$table->addAction(ViewActionColumn::class);
+$table->addAction(EditActionColumn::class);
+$table->addAction(DeleteActionColumn::class);
$table->create();
$table->render();
\ No newline at end of file
diff --git a/kernel/modules/option/table/columns/OptionDeleteActionColumn.php b/kernel/modules/option/table/columns/OptionDeleteActionColumn.php
deleted file mode 100644
index e7fda5b..0000000
--- a/kernel/modules/option/table/columns/OptionDeleteActionColumn.php
+++ /dev/null
@@ -1,16 +0,0 @@
-baseUrl . $this->prefix . $this->id;
- return " Удалить ";
- }
-}
\ No newline at end of file
diff --git a/kernel/modules/option/table/columns/OptionEditActionColumn.php b/kernel/modules/option/table/columns/OptionEditActionColumn.php
deleted file mode 100644
index 0ad8bfc..0000000
--- a/kernel/modules/option/table/columns/OptionEditActionColumn.php
+++ /dev/null
@@ -1,16 +0,0 @@
-baseUrl . $this->prefix . $this->id;
- return " Редактировать ";
- }
-}
\ No newline at end of file
diff --git a/kernel/modules/option/table/columns/OptionViewActionColumn.php b/kernel/modules/option/table/columns/OptionViewActionColumn.php
deleted file mode 100644
index 5c12242..0000000
--- a/kernel/modules/option/table/columns/OptionViewActionColumn.php
+++ /dev/null
@@ -1,18 +0,0 @@
-baseUrl . $this->prefix . $this->id;
- return " Просмотр ";
- }
-
-}
\ No newline at end of file
diff --git a/kernel/modules/option/views/index.php b/kernel/modules/option/views/index.php
index db334b7..00ad1fc 100644
--- a/kernel/modules/option/views/index.php
+++ b/kernel/modules/option/views/index.php
@@ -6,11 +6,11 @@
use Itguild\EloquentTable\EloquentDataProvider;
use Itguild\EloquentTable\ListEloquentTable;
+use kernel\IGTabel\action_column\DeleteActionColumn;
+use kernel\IGTabel\action_column\EditActionColumn;
+use kernel\IGTabel\action_column\ViewActionColumn;
use kernel\IGTabel\btn\PrimaryBtn;
use kernel\modules\option\models\Option;
-use kernel\modules\option\table\columns\OptionDeleteActionColumn;
-use kernel\modules\option\table\columns\OptionEditActionColumn;
-use kernel\modules\option\table\columns\OptionViewActionColumn;
$table = new ListEloquentTable(new EloquentDataProvider(Option::class, [
'current_page' => $page_number,
@@ -31,8 +31,8 @@ $table->columns([
}]
]);
-$table->addAction(OptionViewActionColumn::class);
-$table->addAction(OptionEditActionColumn::class);
-$table->addAction(OptionDeleteActionColumn::class);
+$table->addAction(ViewActionColumn::class);
+$table->addAction(EditActionColumn::class);
+$table->addAction(DeleteActionColumn::class);
$table->create();
$table->render();
\ No newline at end of file
diff --git a/kernel/modules/post/table/columns/PostDeleteActionColumn.php b/kernel/modules/post/table/columns/PostDeleteActionColumn.php
deleted file mode 100644
index c04ee6b..0000000
--- a/kernel/modules/post/table/columns/PostDeleteActionColumn.php
+++ /dev/null
@@ -1,16 +0,0 @@
-baseUrl . $this->prefix . $this->id;
- return " Удалить ";
- }
-}
\ No newline at end of file
diff --git a/kernel/modules/post/table/columns/PostEditActionColumn.php b/kernel/modules/post/table/columns/PostEditActionColumn.php
deleted file mode 100644
index d2802bb..0000000
--- a/kernel/modules/post/table/columns/PostEditActionColumn.php
+++ /dev/null
@@ -1,16 +0,0 @@
-baseUrl . $this->prefix . $this->id;
- return " Редактировать ";
- }
-}
\ No newline at end of file
diff --git a/kernel/modules/post/table/columns/PostViewActionColumn.php b/kernel/modules/post/table/columns/PostViewActionColumn.php
deleted file mode 100644
index ecdec5d..0000000
--- a/kernel/modules/post/table/columns/PostViewActionColumn.php
+++ /dev/null
@@ -1,16 +0,0 @@
-baseUrl . $this->prefix . $this->id;
- return " Просмотр ";
- }
-}
\ No newline at end of file
diff --git a/kernel/modules/post/views/index.php b/kernel/modules/post/views/index.php
index 03e22a0..26eb926 100644
--- a/kernel/modules/post/views/index.php
+++ b/kernel/modules/post/views/index.php
@@ -5,14 +5,11 @@
* @var int $page_number
*/
+use kernel\IGTabel\action_column\DeleteActionColumn;
+use kernel\IGTabel\action_column\EditActionColumn;
+use kernel\IGTabel\action_column\ViewActionColumn;
use kernel\modules\post\models\Post;
-use kernel\modules\post\table\columns\PostDeleteActionColumn;
-use kernel\modules\post\table\columns\PostEditActionColumn;
-use kernel\modules\post\table\columns\PostViewActionColumn;
use kernel\modules\user\models\User;
-//use app\tables\columns\post\PostDeleteActionColumn;
-//use app\tables\columns\post\PostEditActionColumn;
-//use app\tables\columns\post\PostViewActionColumn;
use Itguild\EloquentTable\EloquentDataProvider;
use Itguild\EloquentTable\ListEloquentTable;
use kernel\IGTabel\btn\PrimaryBtn;
@@ -46,8 +43,8 @@ $table->beforePrint(function () {
return PrimaryBtn::create("Создать", "/admin/post/create")->fetch();
//return (new PrimaryBtn("Создать", "/admin/user/create"))->fetch();
});
-$table->addAction(PostViewActionColumn::class);
-$table->addAction(PostEditActionColumn::class);
-$table->addAction(PostDeleteActionColumn::class);
+$table->addAction(ViewActionColumn::class);
+$table->addAction(EditActionColumn::class);
+$table->addAction(DeleteActionColumn::class);
$table->create();
$table->render();
\ No newline at end of file
diff --git a/kernel/modules/user/table/columns/UserDeleteActionColumn.php b/kernel/modules/user/table/columns/UserDeleteActionColumn.php
deleted file mode 100644
index 641b26c..0000000
--- a/kernel/modules/user/table/columns/UserDeleteActionColumn.php
+++ /dev/null
@@ -1,16 +0,0 @@
-baseUrl . $this->prefix . $this->id;
- return " Удалить ";
- }
-}
\ No newline at end of file
diff --git a/kernel/modules/user/table/columns/UserEditActionColumn.php b/kernel/modules/user/table/columns/UserEditActionColumn.php
deleted file mode 100644
index 5dcdea3..0000000
--- a/kernel/modules/user/table/columns/UserEditActionColumn.php
+++ /dev/null
@@ -1,16 +0,0 @@
-baseUrl . $this->prefix . $this->id;
- return " Редактировать ";
- }
-}
\ No newline at end of file
diff --git a/kernel/modules/user/table/columns/UserViewActionColumn.php b/kernel/modules/user/table/columns/UserViewActionColumn.php
deleted file mode 100644
index aae3524..0000000
--- a/kernel/modules/user/table/columns/UserViewActionColumn.php
+++ /dev/null
@@ -1,16 +0,0 @@
-baseUrl . $this->prefix . $this->id;
- return " Просмотр ";
- }
-}
\ No newline at end of file
diff --git a/kernel/modules/user/views/index.php b/kernel/modules/user/views/index.php
index 2b51add..5876e6c 100644
--- a/kernel/modules/user/views/index.php
+++ b/kernel/modules/user/views/index.php
@@ -7,11 +7,11 @@
use Itguild\EloquentTable\EloquentDataProvider;
use Itguild\EloquentTable\ListEloquentTable;
+use kernel\IGTabel\action_column\DeleteActionColumn;
+use kernel\IGTabel\action_column\EditActionColumn;
+use kernel\IGTabel\action_column\ViewActionColumn;
use kernel\IGTabel\btn\PrimaryBtn;
use kernel\modules\user\models\User;
-use kernel\modules\user\table\columns\UserDeleteActionColumn;
-use kernel\modules\user\table\columns\UserEditActionColumn;
-use kernel\modules\user\table\columns\UserViewActionColumn;
$table = new ListEloquentTable(new EloquentDataProvider(User::class, [
'currentPage' => $page_number,
@@ -45,8 +45,8 @@ $table->beforePrint(function () {
return PrimaryBtn::create("Создать", "/admin/user/create")->fetch();
//return (new PrimaryBtn("Создать", "/admin/user/create"))->fetch();
});
-$table->addAction(UserViewActionColumn::class);
-$table->addAction(UserEditActionColumn::class);
-$table->addAction(UserDeleteActionColumn::class);
+$table->addAction(ViewActionColumn::class);
+$table->addAction(EditActionColumn::class);
+$table->addAction(DeleteActionColumn::class);
$table->create();
$table->render();
\ No newline at end of file
diff --git a/kernel/services/ModuleService.php b/kernel/services/ModuleService.php
index 7467221..80b140c 100644
--- a/kernel/services/ModuleService.php
+++ b/kernel/services/ModuleService.php
@@ -346,6 +346,9 @@ class ModuleService
$fileHelper->copy_folder(APP_DIR . '/modules/' . $moduleName, $tmpModuleDirFull . 'app/');
$fileHelper->copy_folder(KERNEL_APP_MODULES_DIR . '/' . $moduleName, $tmpModuleDirFull . 'kernel/');
+ if (!is_dir(RESOURCES_DIR . '/tmp/module')) {
+ mkdir(RESOURCES_DIR . '/tmp/modules', 0777, true);
+ }
$fileHelper->pack($tmpModuleDirFull, RESOURCES_DIR . '/tmp/modules/' . $moduleName . '.itguild');
$fileHelper->recursiveRemoveDir($tmpModuleDirFull);