diff --git a/Admin/Install/db.json b/Admin/Install/db.json index 710b826..e9e4e32 100755 --- a/Admin/Install/db.json +++ b/Admin/Install/db.json @@ -19,9 +19,7 @@ "name": "organization_unit_image", "type": "INT", "default": null, - "null": true, - "foreignTable": "media", - "foreignKey": "media_id" + "null": true }, "organization_unit_description": { "name": "organization_unit_description", diff --git a/Controller/BackendController.php b/Controller/BackendController.php index 950b6e3..bd216a1 100755 --- a/Controller/BackendController.php +++ b/Controller/BackendController.php @@ -56,7 +56,10 @@ final class BackendController extends Controller $view->setTemplate('/Modules/Organization/Theme/Backend/unit-list'); $view->addData('nav', $this->app->moduleManager->get('Navigation')->createNavigationMid(1004703001, $request, $response)); - $mapper = UnitMapper::getAll()->with('parent')->with('image')->limit(25); + $mapper = UnitMapper::getAll() + ->with('parent') + ->with('image') + ->limit(25); if ($request->getData('ptype') === 'p') { $view->setData('units', $mapper->where('id', (int) ($request->getData('id') ?? 0), '<')->execute()); @@ -90,7 +93,14 @@ final class BackendController extends Controller $selectorView = new \Modules\Organization\Theme\Backend\Components\UnitTagSelector\UnitTagSelectorView($this->app->l11nManager, $request, $response); $view->addData('unit-selector', $selectorView); - $view->addData('unit', UnitMapper::get()->with('parent')->with('image')->where('id', (int) $request->getData('id'))->execute()); + + $unit = UnitMapper::get() + ->with('parent') + ->with('image') + ->where('id', (int) $request->getData('id')) + ->execute(); + + $view->addData('unit', $unit); $editor = new \Modules\Editor\Theme\Backend\Components\Editor\BaseView($this->app->l11nManager, $request, $response); $view->addData('editor', $editor); diff --git a/Theme/Backend/img/org_default.png b/Theme/Backend/img/org_default.png new file mode 100644 index 0000000..2354ccf Binary files /dev/null and b/Theme/Backend/img/org_default.png differ diff --git a/Theme/Backend/unit-create.tpl.php b/Theme/Backend/unit-create.tpl.php index 486b8da..6f49083 100755 --- a/Theme/Backend/unit-create.tpl.php +++ b/Theme/Backend/unit-create.tpl.php @@ -28,7 +28,8 @@ echo $this->getData('nav')->render(); ?> - + getData('media-preview-upload')->render('fUnitCreate', 'logo', '/Modules/Organization'); ?> getData('unit-selector')->render('iParent', 'parent', false); ?> diff --git a/Theme/Backend/unit-list.tpl.php b/Theme/Backend/unit-list.tpl.php index 60f207c..2a251b9 100755 --- a/Theme/Backend/unit-list.tpl.php +++ b/Theme/Backend/unit-list.tpl.php @@ -88,8 +88,8 @@ echo $this->getData('nav')->render(); ?> getId(); ?> <?= $this->getHtml('IMG_alt_profile'); ?> + UriFactory::build('Modules/Organization/Theme/Backend/img/org_default.png') : + UriFactory::build($value->image->getPath()); ?>"> printHtml($value->name); ?> printHtml($value->parent->name); ?> diff --git a/Theme/Backend/unit-profile.tpl.php b/Theme/Backend/unit-profile.tpl.php index c56e076..e896b81 100755 --- a/Theme/Backend/unit-profile.tpl.php +++ b/Theme/Backend/unit-profile.tpl.php @@ -38,8 +38,8 @@ echo $this->getData('nav')->render(); ?> itemprop="logo" loading="lazy" src="image instanceof NullMedia ? - UriFactory::build('Web/Backend/img/user_default_' . \mt_rand(1, 6) .'.png') : - UriFactory::build('{/lang}/{/app}/' . $unit->image->getPath()); ?>" + UriFactory::build('Modules/Organization/Theme/Backend/img/org_default.png') : + UriFactory::build($unit->image->getPath()); ?>" width="40x"> diff --git a/info.json b/info.json index c5965e0..4818e55 100755 --- a/info.json +++ b/info.json @@ -16,10 +16,11 @@ }, "description": "The business module.", "directory": "Organization", + "asset-dependencies": { + "Modules/Editor": "*" + }, "dependencies": { - "Admin": "1.0.0", - "Editor": "1.0.0", - "Media": "1.0.0" + "Admin": "1.0.0" }, "providing": { "Navigation": "*",