Compare commits

..

4 Commits

2 changed files with 6 additions and 8 deletions

View File

@ -5,7 +5,6 @@ namespace app\modules\module_shop\controllers;
use app\modules\module_shop\models\forms\CreateModuleShopForm;
use app\modules\module_shop\models\ModuleShop;
use app\modules\module_shop\services\ModuleShopService;
use Cassandra\Date;
use JetBrains\PhpStorm\NoReturn;
use kernel\AdminController;
use kernel\app_modules\tag\services\TagService;
@ -13,7 +12,6 @@ use kernel\FileUpload;
use kernel\Flash;
use kernel\helpers\Debug;
use kernel\services\ModuleService;
use mysql_xdevapi\Exception;
use ZipArchive;
class ModuleShopController extends AdminController
@ -41,7 +39,7 @@ class ModuleShopController extends AdminController
$moduleShopForm->load($_REQUEST);
if (isset($_FILES['path_to_archive']) && $_FILES['path_to_archive']['error'] === UPLOAD_ERR_OK) {
$file = new FileUpload($_FILES['path_to_archive'], ['zip', 'rar', 'itguild']);
$file = new FileUpload($_FILES['path_to_archive'], ['zip', 'rar', 'igm']);
$file->upload();
$moduleShopForm->setItem('path_to_archive', $file->getUploadFile());
}
@ -90,7 +88,7 @@ class ModuleShopController extends AdminController
$module = ModuleShop::find($id);
if (!$module) {
throw new Exception("The module not found");
throw new \Exception("The module not found");
}
$this->cgView->render("view.php", ['module' => $module]);
}
@ -100,7 +98,7 @@ class ModuleShopController extends AdminController
{
$module = ModuleShop::find($id);
if (!$module) {
throw new Exception("The module not found");
throw new \Exception("The module not found");
}
$name = $module->name;
@ -113,7 +111,7 @@ class ModuleShopController extends AdminController
{
$module = ModuleShop::find($id);
if (!$module) {
throw new Exception("The module not found");
throw new \Exception("The module not found");
}
$this->moduleShopService->packModule($module);
}

View File

@ -22,7 +22,7 @@ class ModuleShopService extends ModuleService
$model->status = $form_model->getItem("status");
$model->path_to_archive = $form_model->getItem("path_to_archive");
$model->dependence = $form_model->getItem("dependence");
$model->slug = Slug::url_slug($model->name, ['transliterate' => true, 'lowercase' => true]);
$model->slug = $form_model->getItem("slug");
if ($model->save()) {
return $model;
@ -40,7 +40,7 @@ class ModuleShopService extends ModuleService
$model->status = $form_model->getItem("status");
$model->path_to_archive = $form_model->getItem("path_to_archive");
$model->dependence = $form_model->getItem("dependence");
$model->slug = Slug::url_slug($model->name, ['transliterate' => true, 'lowercase' => true]);
$model->slug = $form_model->getItem("slug");
if ($model->save()) {
return $model;