Refactor Scontainers management

- Removed legacy Scontainers controller and view files, transitioning to a new controller structure.
- Introduced ScontainersController to handle CRUD operations with improved dependency injection.
- Created ScontainersRepository for database interactions, encapsulating logic for container management.
- Updated container edit and list views to utilize new templating system.
- Added unit tests for ScontainersRepository and ScontainersController to ensure functionality.
- Enhanced form handling for container editing, including validation and error management.
This commit is contained in:
2026-02-12 23:54:56 +01:00
parent 36fe8412e7
commit 42e4396064
15 changed files with 816 additions and 353 deletions

View File

@@ -66,11 +66,28 @@ class Pages
'parent_id' => \S::get( 'pid' ),
'menu_id' => \S::get( 'menu_id' ),
'menus' => \admin\factory\Pages::menu_lists(),
'layouts' => \admin\factory\Layouts::layouts_list(),
'layouts' => self::layouts_for_page_edit( $GLOBALS['mdb'] ),
'languages' => ( new \Domain\Languages\LanguagesRepository( $GLOBALS['mdb'] ) )->languagesList()
] );
}
private static function layouts_for_page_edit( $db )
{
if ( class_exists( '\Domain\Layouts\LayoutsRepository' ) )
{
$rows = ( new \Domain\Layouts\LayoutsRepository( $db ) ) -> listAll();
return is_array( $rows ) ? $rows : [];
}
if ( class_exists( '\admin\factory\Layouts' ) )
{
$rows = \admin\factory\Layouts::layouts_list();
return is_array( $rows ) ? $rows : [];
}
return [];
}
public static function menu_save()
{
$response = [ 'status' => 'error', 'msg' => 'Podczas zapisywania menu wystąpił błąd. Proszę spróbować ponownie.' ];