some fix
This commit is contained in:
parent
9af44ca95f
commit
5285acae12
@ -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
|
||||
{
|
||||
|
@ -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' => 'Зависимости',
|
||||
];
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
@ -1,16 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace app\modules\module_shop\table\columns;
|
||||
|
||||
use Itguild\Tables\ActionColumn\ActionColumn;
|
||||
|
||||
class ModuleShopDeleteActionColumn extends ActionColumn
|
||||
{
|
||||
protected string $prefix = "/delete/";
|
||||
|
||||
public function fetch()
|
||||
{
|
||||
$link = $this->baseUrl . $this->prefix . $this->id;
|
||||
return " <a href='$link' class='btn btn-danger'>Удалить</a> ";
|
||||
}
|
||||
}
|
@ -1,16 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace app\modules\module_shop\table\columns;
|
||||
|
||||
use Itguild\Tables\ActionColumn\ActionColumn;
|
||||
|
||||
class ModuleShopEditActionColumn extends ActionColumn
|
||||
{
|
||||
protected string $prefix = "/update/";
|
||||
|
||||
public function fetch(): string
|
||||
{
|
||||
$link = $this->baseUrl . $this->prefix . $this->id;
|
||||
return " <a href='$link' class='btn btn-success'>Редактировать</a> ";
|
||||
}
|
||||
}
|
@ -1,16 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace app\modules\module_shop\table\columns;
|
||||
|
||||
use Itguild\Tables\ActionColumn\ActionColumn;
|
||||
|
||||
class ModuleShopPackActionColumn extends ActionColumn
|
||||
{
|
||||
protected string $prefix = "/pack/";
|
||||
|
||||
public function fetch()
|
||||
{
|
||||
$link = $this->baseUrl . $this->prefix . $this->id;
|
||||
return " <a href='$link' class='btn btn-info'>Заархивировать</a> ";
|
||||
}
|
||||
}
|
@ -1,16 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace app\modules\module_shop\table\columns;
|
||||
|
||||
use Itguild\Tables\ActionColumn\ActionColumn;
|
||||
|
||||
class ModuleShopViewActionColumn extends actionColumn
|
||||
{
|
||||
protected string $prefix = "/";
|
||||
|
||||
public function fetch(): string
|
||||
{
|
||||
$link = $this->baseUrl . $this->prefix . $this->id;
|
||||
return " <a href='$link' class='btn btn-primary'>Просмотр</a> ";
|
||||
}
|
||||
}
|
@ -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');
|
||||
|
||||
|
||||
|
||||
|
@ -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();
|
@ -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;
|
||||
});
|
||||
|
@ -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,
|
||||
|
@ -1,17 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace kernel\modules\menu\table\columns;
|
||||
|
||||
use Itguild\Tables\ActionColumn\ActionColumn;
|
||||
|
||||
class MenuDeleteActionColumn extends ActionColumn
|
||||
{
|
||||
|
||||
protected string $prefix = "/delete/";
|
||||
|
||||
public function fetch(): string
|
||||
{
|
||||
$link = $this->baseUrl . $this->prefix . $this->id;
|
||||
return " <a href='$link' class='btn btn-danger'>Удалить</a> ";
|
||||
}
|
||||
}
|
@ -1,17 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace kernel\modules\menu\table\columns;
|
||||
|
||||
use Itguild\Tables\ActionColumn\ActionColumn;
|
||||
|
||||
class MenuEditActionColumn extends ActionColumn
|
||||
{
|
||||
|
||||
protected string $prefix = "/update/";
|
||||
|
||||
public function fetch(): string
|
||||
{
|
||||
$link = $this->baseUrl . $this->prefix . $this->id;
|
||||
return " <a href='$link' class='btn btn-success'>Редактировать</a> ";
|
||||
}
|
||||
}
|
@ -1,17 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace kernel\modules\menu\table\columns;
|
||||
|
||||
use Itguild\Tables\ActionColumn\ActionColumn;
|
||||
|
||||
class MenuViewActionColumn extends ActionColumn
|
||||
{
|
||||
|
||||
protected string $prefix = "/";
|
||||
|
||||
public function fetch(): string
|
||||
{
|
||||
$link = $this->baseUrl . $this->prefix . $this->id;
|
||||
return " <a href='$link' class='btn btn-primary'>Просмотр</a> ";
|
||||
}
|
||||
}
|
@ -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();
|
@ -1,16 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace kernel\modules\option\table\columns;
|
||||
|
||||
use Itguild\Tables\ActionColumn\ActionColumn;
|
||||
|
||||
class OptionDeleteActionColumn extends ActionColumn
|
||||
{
|
||||
protected string $prefix = "/delete/";
|
||||
|
||||
public function fetch(): string
|
||||
{
|
||||
$link = $this->baseUrl . $this->prefix . $this->id;
|
||||
return " <a href='$link' class='btn btn-danger'>Удалить</a> ";
|
||||
}
|
||||
}
|
@ -1,16 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace kernel\modules\option\table\columns;
|
||||
|
||||
use Itguild\Tables\ActionColumn\ActionColumn;
|
||||
|
||||
class OptionEditActionColumn extends ActionColumn
|
||||
{
|
||||
protected string $prefix = "/update/";
|
||||
|
||||
public function fetch(): string
|
||||
{
|
||||
$link = $this->baseUrl . $this->prefix . $this->id;
|
||||
return " <a href='$link' class='btn btn-success'>Редактировать</a> ";
|
||||
}
|
||||
}
|
@ -1,18 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace kernel\modules\option\table\columns;
|
||||
|
||||
use Itguild\Tables\ActionColumn\ActionColumn;
|
||||
|
||||
class OptionViewActionColumn extends ActionColumn
|
||||
{
|
||||
|
||||
protected string $prefix = "/";
|
||||
|
||||
public function fetch()
|
||||
{
|
||||
$link = $this->baseUrl . $this->prefix . $this->id;
|
||||
return " <a href='$link' class='btn btn-primary'>Просмотр</a> ";
|
||||
}
|
||||
|
||||
}
|
@ -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();
|
@ -1,16 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace kernel\modules\post\table\columns;
|
||||
|
||||
use Itguild\Tables\ActionColumn\ActionColumn;
|
||||
|
||||
class PostDeleteActionColumn extends ActionColumn
|
||||
{
|
||||
protected string $prefix = "/delete/";
|
||||
|
||||
public function fetch(): string
|
||||
{
|
||||
$link = $this->baseUrl . $this->prefix . $this->id;
|
||||
return " <a href='$link' class='btn btn-danger'>Удалить</a> ";
|
||||
}
|
||||
}
|
@ -1,16 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace kernel\modules\post\table\columns;
|
||||
|
||||
use Itguild\Tables\ActionColumn\ActionColumn;
|
||||
|
||||
class PostEditActionColumn extends ActionColumn
|
||||
{
|
||||
protected string $prefix = "/update/";
|
||||
|
||||
public function fetch(): string
|
||||
{
|
||||
$link = $this->baseUrl . $this->prefix . $this->id;
|
||||
return " <a href='$link' class='btn btn-success'>Редактировать</a> ";
|
||||
}
|
||||
}
|
@ -1,16 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace kernel\modules\post\table\columns;
|
||||
|
||||
use Itguild\Tables\ActionColumn\ActionColumn;
|
||||
|
||||
class PostViewActionColumn extends actionColumn
|
||||
{
|
||||
protected string $prefix = "/";
|
||||
|
||||
public function fetch(): string
|
||||
{
|
||||
$link = $this->baseUrl . $this->prefix . $this->id;
|
||||
return " <a href='$link' class='btn btn-primary'>Просмотр</a> ";
|
||||
}
|
||||
}
|
@ -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();
|
@ -1,16 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace kernel\modules\user\table\columns;
|
||||
|
||||
use Itguild\Tables\ActionColumn\ActionColumn;
|
||||
|
||||
class UserDeleteActionColumn extends ActionColumn
|
||||
{
|
||||
protected string $prefix = "/delete/";
|
||||
|
||||
public function fetch(): string
|
||||
{
|
||||
$link = $this->baseUrl . $this->prefix . $this->id;
|
||||
return " <a href='$link' class='btn btn-danger'>Удалить</a> ";
|
||||
}
|
||||
}
|
@ -1,16 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace kernel\modules\user\table\columns;
|
||||
|
||||
use Itguild\Tables\ActionColumn\ActionColumn;
|
||||
|
||||
class UserEditActionColumn extends ActionColumn
|
||||
{
|
||||
protected string $prefix = "/update/";
|
||||
|
||||
public function fetch(): string
|
||||
{
|
||||
$link = $this->baseUrl . $this->prefix . $this->id;
|
||||
return " <a href='$link' class='btn btn-success'>Редактировать</a> ";
|
||||
}
|
||||
}
|
@ -1,16 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace kernel\modules\user\table\columns;
|
||||
|
||||
use Itguild\Tables\ActionColumn\ActionColumn;
|
||||
|
||||
class UserViewActionColumn extends ActionColumn
|
||||
{
|
||||
protected string $prefix = "/";
|
||||
|
||||
public function fetch(): string
|
||||
{
|
||||
$link = $this->baseUrl . $this->prefix . $this->id;
|
||||
return " <a href='$link' class='btn btn-primary'>Просмотр</a> ";
|
||||
}
|
||||
}
|
@ -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();
|
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user