Compare commits
No commits in common. "d84f23c756fd56c38fb4d50533bdd151e8834d4b" and "bff1cb798f02bd42c7ce6dc4367cdbe17074448c" have entirely different histories.
d84f23c756
...
bff1cb798f
@ -5,6 +5,7 @@ namespace app\modules\module_shop\controllers;
|
|||||||
use app\modules\module_shop\models\forms\CreateModuleShopForm;
|
use app\modules\module_shop\models\forms\CreateModuleShopForm;
|
||||||
use app\modules\module_shop\models\ModuleShop;
|
use app\modules\module_shop\models\ModuleShop;
|
||||||
use app\modules\module_shop\services\ModuleShopService;
|
use app\modules\module_shop\services\ModuleShopService;
|
||||||
|
use Cassandra\Date;
|
||||||
use JetBrains\PhpStorm\NoReturn;
|
use JetBrains\PhpStorm\NoReturn;
|
||||||
use kernel\AdminController;
|
use kernel\AdminController;
|
||||||
use kernel\app_modules\tag\services\TagService;
|
use kernel\app_modules\tag\services\TagService;
|
||||||
@ -12,6 +13,7 @@ use kernel\FileUpload;
|
|||||||
use kernel\Flash;
|
use kernel\Flash;
|
||||||
use kernel\helpers\Debug;
|
use kernel\helpers\Debug;
|
||||||
use kernel\services\ModuleService;
|
use kernel\services\ModuleService;
|
||||||
|
use mysql_xdevapi\Exception;
|
||||||
use ZipArchive;
|
use ZipArchive;
|
||||||
|
|
||||||
class ModuleShopController extends AdminController
|
class ModuleShopController extends AdminController
|
||||||
@ -39,7 +41,7 @@ class ModuleShopController extends AdminController
|
|||||||
$moduleShopForm->load($_REQUEST);
|
$moduleShopForm->load($_REQUEST);
|
||||||
|
|
||||||
if (isset($_FILES['path_to_archive']) && $_FILES['path_to_archive']['error'] === UPLOAD_ERR_OK) {
|
if (isset($_FILES['path_to_archive']) && $_FILES['path_to_archive']['error'] === UPLOAD_ERR_OK) {
|
||||||
$file = new FileUpload($_FILES['path_to_archive'], ['zip', 'rar', 'igm']);
|
$file = new FileUpload($_FILES['path_to_archive'], ['zip', 'rar', 'itguild']);
|
||||||
$file->upload();
|
$file->upload();
|
||||||
$moduleShopForm->setItem('path_to_archive', $file->getUploadFile());
|
$moduleShopForm->setItem('path_to_archive', $file->getUploadFile());
|
||||||
}
|
}
|
||||||
@ -88,7 +90,7 @@ class ModuleShopController extends AdminController
|
|||||||
|
|
||||||
$module = ModuleShop::find($id);
|
$module = ModuleShop::find($id);
|
||||||
if (!$module) {
|
if (!$module) {
|
||||||
throw new \Exception("The module not found");
|
throw new Exception("The module not found");
|
||||||
}
|
}
|
||||||
$this->cgView->render("view.php", ['module' => $module]);
|
$this->cgView->render("view.php", ['module' => $module]);
|
||||||
}
|
}
|
||||||
@ -98,7 +100,7 @@ class ModuleShopController extends AdminController
|
|||||||
{
|
{
|
||||||
$module = ModuleShop::find($id);
|
$module = ModuleShop::find($id);
|
||||||
if (!$module) {
|
if (!$module) {
|
||||||
throw new \Exception("The module not found");
|
throw new Exception("The module not found");
|
||||||
}
|
}
|
||||||
$name = $module->name;
|
$name = $module->name;
|
||||||
|
|
||||||
@ -111,7 +113,7 @@ class ModuleShopController extends AdminController
|
|||||||
{
|
{
|
||||||
$module = ModuleShop::find($id);
|
$module = ModuleShop::find($id);
|
||||||
if (!$module) {
|
if (!$module) {
|
||||||
throw new \Exception("The module not found");
|
throw new Exception("The module not found");
|
||||||
}
|
}
|
||||||
$this->moduleShopService->packModule($module);
|
$this->moduleShopService->packModule($module);
|
||||||
}
|
}
|
||||||
|
@ -22,7 +22,7 @@ class ModuleShopService extends ModuleService
|
|||||||
$model->status = $form_model->getItem("status");
|
$model->status = $form_model->getItem("status");
|
||||||
$model->path_to_archive = $form_model->getItem("path_to_archive");
|
$model->path_to_archive = $form_model->getItem("path_to_archive");
|
||||||
$model->dependence = $form_model->getItem("dependence");
|
$model->dependence = $form_model->getItem("dependence");
|
||||||
$model->slug = $form_model->getItem("slug");
|
$model->slug = Slug::url_slug($model->name, ['transliterate' => true, 'lowercase' => true]);
|
||||||
|
|
||||||
if ($model->save()) {
|
if ($model->save()) {
|
||||||
return $model;
|
return $model;
|
||||||
@ -40,7 +40,7 @@ class ModuleShopService extends ModuleService
|
|||||||
$model->status = $form_model->getItem("status");
|
$model->status = $form_model->getItem("status");
|
||||||
$model->path_to_archive = $form_model->getItem("path_to_archive");
|
$model->path_to_archive = $form_model->getItem("path_to_archive");
|
||||||
$model->dependence = $form_model->getItem("dependence");
|
$model->dependence = $form_model->getItem("dependence");
|
||||||
$model->slug = $form_model->getItem("slug");
|
$model->slug = Slug::url_slug($model->name, ['transliterate' => true, 'lowercase' => true]);
|
||||||
|
|
||||||
if ($model->save()) {
|
if ($model->save()) {
|
||||||
return $model;
|
return $model;
|
||||||
|
Loading…
Reference in New Issue
Block a user