diff --git a/PROJECT_STRUCTURE.md b/PROJECT_STRUCTURE.md
index 4d4640f..7b07d2c 100644
--- a/PROJECT_STRUCTURE.md
+++ b/PROJECT_STRUCTURE.md
@@ -471,3 +471,11 @@ Aktualnie w suite są też testy modułów `Dictionaries`, `Articles` i `Users`
- **UPDATE:** potwierdzenia usuwania zdjec i zalacznikow w edycji artykulu ujednolicone wizualnie z dialogiem usuwania z listy (jquery-confirm, `table-list-confirm-dialog`).
- **FIX:** dodane ladowanie biblioteki `jquery-impromptu` w widoku edycji artykulu (kompatybilnosc dla `$.prompt`).
- Testy: 178 tests, 443 assertions.
+
+## Aktualizacja 2026-02-13 (Pages)
+- NOWE: `Domain\\Pages\\PagesRepository` (menu/page CRUD, drzewo stron, sortowanie, SEO, endpointy pomocnicze).
+- NOWE: `admin\\Controllers\\PagesController` (DI) dla modulu `/admin/pages/*`.
+- UPDATE: widoki `admin/templates/pages/*` dzialaja bez `admin\\factory\\Pages` i `admin\\view\\Pages`.
+- UPDATE: routing DI (`admin\\Site`) ma fabryke kontrolera `Pages`.
+- UPDATE: zalezne endpointy `cookie_*` i `generate_seo_link` przepiete na `/admin/pages/*`.
+- CLEANUP: usuniete legacy pliki `autoload/admin/controls/class.Pages.php`, `autoload/admin/view/class.Pages.php`, `autoload/admin/factory/class.Pages.php`, `admin/ajax/pages.php`.
diff --git a/REFACTORING_PLAN.md b/REFACTORING_PLAN.md
index 031b0c2..2addebf 100644
--- a/REFACTORING_PLAN.md
+++ b/REFACTORING_PLAN.md
@@ -682,3 +682,21 @@ Gdy `persist = true`:
- UPDATE: potwierdzenia usuwania zdjec i zalacznikow przepiete na `jquery-confirm` ze stylem `table-list-confirm-dialog` (jak na liscie artykulow).
- FIX: dolaczona biblioteka `jquery-impromptu` w widoku edycji artykulu dla kompatybilnosci.
- Testy po zmianie: **178 tests, 443 assertions**.
+
+## Plan 2026-02-13 - Refaktoryzacja `/admin/pages/`
+- [x] Dodac `Domain\Pages\PagesRepository` (CRUD menu/stron, drzewo stron, sortowanie, SEO, operacje AJAX).
+- [x] Dodac `admin\Controllers\PagesController` (DI) i przepiac routing `/admin/pages/*` na nowy kontroler.
+- [x] Przebudowac widoki `admin/templates/pages/*` tak, aby nie korzystaly z `admin\factory\Pages` i `admin\view\Pages`.
+- [x] Przepiac endpointy AJAX z `/admin/ajax.php?a=*` na `/admin/pages/*` (`save_pages_order`, `save_articles_order`, `generate_seo_link`, `cookie_*`).
+- [x] Przeszukac i zaktualizowac zaleznosci w innych modulach (`articles`, `layouts`, helpery) powiazane z Pages.
+- [x] Usunac legacy klasy/pliki Pages (`autoload/admin/controls/class.Pages.php`, `autoload/admin/view/class.Pages.php`, `autoload/admin/factory/class.Pages.php`, `admin/ajax/pages.php`) po odpieciu zaleznosci.
+- [x] Dodac/uzupelnic testy (`PagesRepository`, `PagesController`) i uruchomic testy.
+
+## Aktualizacja 2026-02-13 - Pages (/admin/pages)
+- NOWE: `Domain\Pages\PagesRepository` (CRUD menu/stron, drzewo stron, porzadkowanie, SEO link, URL preview, cookies tree-state).
+- NOWE: `admin\Controllers\PagesController` (DI) dla akcji: `view_list/list`, `browse_list`, `pages_url_browser`, `menu_*`, `page_*`, `save_*_order`, `generate_seo_link`, `cookie_*`.
+- UPDATE: `/admin/pages/*` dziala bez legacy `admin\controls\Pages` i `admin\view\Pages`.
+- UPDATE: widoki `admin/templates/pages/*` przepiete na dane z kontrolera/repozytorium (bez `admin\factory\Pages`).
+- UPDATE: endpointy zalezne od Pages w innych modulach (`articles`, `layouts`, `shop-category`, `shop-product`) przepiete z `admin/ajax.php?a=*` na `/admin/pages/*`.
+- CLEANUP: usuniete `autoload/admin/controls/class.Pages.php`, `autoload/admin/view/class.Pages.php`, `autoload/admin/factory/class.Pages.php`, `admin/ajax/pages.php`; `admin/ajax.php` nie includuje juz `ajax/pages.php`.
+- Testy: **OK (186 tests, 478 assertions)**.
diff --git a/TESTING.md b/TESTING.md
index c971739..7978a3b 100644
--- a/TESTING.md
+++ b/TESTING.md
@@ -267,3 +267,17 @@ OK (178 tests, 443 assertions)
Nowe testy/rozszerzenia 2026-02-13:
- `tests/Unit/Domain/Article/ArticleRepositoryTest.php` (nowe przypadki dla `saveFilesOrder`)
+
+## Aktualizacja suite (Pages migration)
+Ostatnio zweryfikowano: 2026-02-13
+
+```text
+OK (186 tests, 478 assertions)
+```
+
+Nowe testy dodane 2026-02-13:
+- `tests/Unit/Domain/Pages/PagesRepositoryTest.php`
+- `tests/Unit/admin/Controllers/PagesControllerTest.php`
+
+Zaktualizowane testy 2026-02-13:
+- `tests/Unit/admin/Controllers/ArticlesControllerTest.php` (konstruktor z `Domain\\Pages\\PagesRepository`)
diff --git a/admin/ajax.php b/admin/ajax.php
index eeef67c..601c666 100644
--- a/admin/ajax.php
+++ b/admin/ajax.php
@@ -37,7 +37,6 @@ $mdb = new medoo( [
'charset' => 'utf8'
] );
-require_once 'ajax/pages.php';
require_once 'ajax/shop-category.php';
require_once 'ajax/users.php';
require_once 'ajax/shop.php';
diff --git a/admin/ajax/pages.php b/admin/ajax/pages.php
deleted file mode 100644
index c0d92d0..0000000
--- a/admin/ajax/pages.php
+++ /dev/null
@@ -1,63 +0,0 @@
- 'error', 'msg' => 'Podczas zapisywania kolejności wyświetlania artykułów wystąpił błąd. Proszę spróbować ponownie.' ];
-
- if ( \admin\factory\Pages::save_articles_order( \S::get( 'page_id' ), \S::get( 'articles' ) ) )
- $response = [ 'status' => 'ok' ];
-
- echo json_encode( $response );
- exit;
-}
-
-if ( $a == 'save_pages_order' )
-{
- $response = [ 'status' => 'error', 'msg' => 'Podczas zapisywania kolejności stron wystąpił błąd. Proszę spróbować ponownie.' ];
-
- if ( \admin\factory\Pages::save_pages_order( \S::get( 'menu_id' ), \S::get( 'pages' ) ) )
- $response = [ 'status' => 'ok' ];
-
- echo json_encode( $response );
- exit;
-}
-
-if ( $a == 'generate_seo_link' )
-{
- $response = [ 'status' => 'error', 'msg' => 'Podczas generowania pola "seo link" wystąpił błąd. Proszę spróbować ponownie.' ];
-
- if ( $seo_link = \admin\factory\Pages::generate_seo_link( \S::get( 'title' ), \S::get( 'page_id' ), \S::get( 'article_id' ), \S::get( 'category_id' ) ) )
- $response = [ 'status' => 'ok', 'seo_link' => $seo_link ];
-
- echo json_encode( $response );
- exit;
-}
-
-if ( $a == 'cookie_menus' )
-{
- $array = unserialize( $_COOKIE[ 'cookie_menus' ] );
-
- if ( $array[ \S::get( 'menu_id' ) ] == 0 )
- $array[ \S::get( 'menu_id' ) ] = 1;
- else
- $array[ \S::get( 'menu_id' ) ] = 0;
-
- $array = serialize( $array );
-
- setcookie( 'cookie_menus', $array, time() + 3600 * 24 * 365 );
-}
-
-if ( $a == 'cookie_pages' )
-{
- $array = unserialize( $_COOKIE[ 'cookie_pages' ] );
-
- if ( $array[ \S::get( 'page_id' ) ] == 0 )
- $array[ \S::get( 'page_id' ) ] = 1;
- else
- $array[ \S::get( 'page_id' ) ] = 0;
-
- $array = serialize( $array );
-
- setcookie( 'cookie_pages', $array, time() + 3600 * 24 * 365 );
-}
diff --git a/admin/templates/articles/article-edit-custom-script.php b/admin/templates/articles/article-edit-custom-script.php
index 51a0b71..964f801 100644
--- a/admin/templates/articles/article-edit-custom-script.php
+++ b/admin/templates/articles/article-edit-custom-script.php
@@ -225,7 +225,7 @@ if (!empty($_COOKIE['cookie_menus'])) {
$.ajax({
type: 'POST',
cache: false,
- url: '/admin/articles/gallery_order_save/',
+ url: '/admin/articles/galleryOrderSave/',
data: {
article_id: article_id,
order: order
@@ -256,7 +256,7 @@ if (!empty($_COOKIE['cookie_menus'])) {
$.ajax({
type: 'POST',
cache: false,
- url: '/admin/articles/files_order_save/',
+ url: '/admin/articles/filesOrderSave/',
data: {
article_id: article_id,
order: order
@@ -404,20 +404,18 @@ if (!empty($_COOKIE['cookie_menus'])) {
$.ajax({
type: 'POST',
cache: false,
- url: '/admin/ajax.php',
+ url: '/admin/pages/cookieMenus/',
data: {
- a: 'cookie_menus',
menu_id: menu_id
}
});
} else {
- var page_id = $(this).parent('div').parent('li').attr('id');
+ var page_id = $(this).parent('div').parent('li').attr('id').replace('list_', '');
$.ajax({
type: 'POST',
cache: false,
- url: '/admin/ajax.php',
+ url: '/admin/pages/cookiePages/',
data: {
- a: 'cookie_pages',
page_id: page_id
}
});
@@ -438,7 +436,7 @@ if (!empty($_COOKIE['cookie_menus'])) {
$.ajax({
type: 'POST',
cache: false,
- url: '/admin/articles/article_image_alt_change/',
+ url: '/admin/articles/imageAltChange/',
data: {
image_id: image_id,
image_alt: image_alt
@@ -463,7 +461,7 @@ if (!empty($_COOKIE['cookie_menus'])) {
$.ajax({
type: 'POST',
cache: false,
- url: '/admin/articles/article_file_name_change/',
+ url: '/admin/articles/fileNameChange/',
data: {
file_id: file_id,
file_name: file_name
@@ -489,7 +487,7 @@ if (!empty($_COOKIE['cookie_menus'])) {
$.ajax({
type: 'POST',
cache: false,
- url: '/admin/articles/article_file_delete/',
+ url: '/admin/articles/fileDelete/',
data: {
file_id: file_id
},
@@ -519,7 +517,7 @@ if (!empty($_COOKIE['cookie_menus'])) {
$.ajax({
type: 'POST',
cache: false,
- url: '/admin/articles/article_image_delete/',
+ url: '/admin/articles/imageDelete/',
data: {
image_id: image_id
},
@@ -555,9 +553,8 @@ if (!empty($_COOKIE['cookie_menus'])) {
$.ajax({
type: 'POST',
cache: false,
- url: '/admin/ajax.php',
+ url: '/admin/pages/generateSeoLink/',
data: {
- a: 'generate_seo_link',
title: title,
article_id: article_id
},
@@ -581,3 +578,4 @@ if (!empty($_COOKIE['cookie_menus'])) {
});
}
+
diff --git a/admin/templates/banners/banner-edit.php b/admin/templates/banners/banner-edit.php
index 469abb8..21fc5a3 100644
--- a/admin/templates/banners/banner-edit.php
+++ b/admin/templates/banners/banner-edit.php
@@ -150,8 +150,8 @@ $grid -> fields = [
];
$grid -> external_code = $out;
$grid -> actions = [
- 'save' => [ 'url' => '/admin/banners/banner_save/', 'back_url' => '/admin/banners/view_list/' ],
- 'cancel' => [ 'url' => '/admin/banners/view_list/' ]
+ 'save' => [ 'url' => '/admin/banners/save/', 'back_url' => '/admin/banners/list/' ],
+ 'cancel' => [ 'url' => '/admin/banners/list/' ]
];
$grid -> persist_edit = true;
$grid -> id_param = 'id';
diff --git a/admin/templates/layouts/layout-edit.php b/admin/templates/layouts/layout-edit.php
index 0c3f5ed..2de458c 100644
--- a/admin/templates/layouts/layout-edit.php
+++ b/admin/templates/layouts/layout-edit.php
@@ -92,9 +92,8 @@
{
type: 'POST',
cache: false,
- url: '/admin/ajax.php',
+ url: '/admin/pages/cookieMenus/',
data: {
- a: 'cookie_menus',
menu_id: menu_id
}
});
@@ -107,10 +106,9 @@
{
type: 'POST',
cache: false,
- url: '/admin/ajax.php',
+ url: '/admin/pages/cookiePages/',
data: {
- a: 'cookie_pages',
- page_id: page_id
+ page_id: page_id.replace( 'list_', '' )
}
});
}
@@ -159,14 +157,14 @@ ob_start();
);?>
= \Html::input_switch(
array(
- 'label' => 'Szablon domyślny',
+ 'label' => 'Szablon domyślny',
'name' => 'status',
'checked' => $this -> layout['status'] == 1 ? true : false
)
);?>
= \Html::input_switch(
array(
- 'label' => 'Szablon domyślny (kategorie)',
+ 'label' => 'Szablon domyślny (kategorie)',
'name' => 'categories_default',
'checked' => $this -> layout['categories_default'] == 1 ? true : false
)
@@ -246,8 +244,8 @@ $grid -> fields = [
]
];
$grid -> actions = [
- 'save' => [ 'url' => '/admin/layouts/layout_save/', 'back_url' => '/admin/layouts/view_list/' ],
- 'cancel' => [ 'url' => '/admin/layouts/view_list/' ]
+ 'save' => [ 'url' => '/admin/layouts/save/', 'back_url' => '/admin/layouts/list/' ],
+ 'cancel' => [ 'url' => '/admin/layouts/list/' ]
];
$grid -> external_code = $out;
$grid -> persist_edit = true;
@@ -255,3 +253,4 @@ $grid -> id_param = 'id';
echo $grid -> draw();
?>
+
diff --git a/admin/templates/pages/menu-edit.php b/admin/templates/pages/menu-edit.php
index dc74f28..5fe1611 100644
--- a/admin/templates/pages/menu-edit.php
+++ b/admin/templates/pages/menu-edit.php
@@ -1,42 +1 @@
- gdb_opt = $gdb;
-$grid -> include_plugins = true;
-$grid -> title = 'Zapisz menu';
-$grid -> fields = [
- [
- 'db' => 'id',
- 'type' => 'hidden',
- 'value' => $this -> menu['id']
- ],
- [
- 'name' => 'Nazwa',
- 'db' => 'name',
- 'type' => 'text',
- 'value' => $this -> menu['name'],
- 'params' => [ 'class' => 'require' ]
- ],
- [
- 'name' => 'Aktywne',
- 'db' => 'status',
- 'type' => 'input_switch',
- 'checked' => $this -> menu['status'] ? true : false,
- 'replace' => [ 'array' => [ 0 => 'nie', 1 => 'tak' ] ]
- ]
- ];
-$grid -> actions = [
- 'save' => [ 'url' => '/admin/pages/menu_save/', 'back_url' => '/admin/pages/view_list/' ],
- 'cancel' => [ 'url' => '/admin/pages/view_list/' ]
- ];
-$grid -> persist_edit = true;
-$grid -> id_param = 'id';
-echo $grid -> draw();
-?>
-
\ No newline at end of file
+= \Tpl::view('components/form-edit', ['form' => $this->form]); ?>
diff --git a/admin/templates/pages/page-articles.php b/admin/templates/pages/page-articles.php
index 33d6ba2..8e32fab 100644
--- a/admin/templates/pages/page-articles.php
+++ b/admin/templates/pages/page-articles.php
@@ -1,89 +1,87 @@
-
+page_id ?? 0);
+$articles = is_array($this->articles ?? null) ? $this->articles : [];
+
ob_start();
?>
-
-
- if ( is_array( $this -> articles ) ) foreach ( $this -> articles as $article )
- {
- ?>
- -
-
= $article['title'];?>
-
-
- }
+
+
+
-
-
+ -
+
= htmlspecialchars($title, ENT_QUOTES, 'UTF-8'); ?>
+
+
+
+ gdb_opt = $gdb;
-$grid -> include_plugins = true;
-$grid -> default_buttons = false;
-$grid -> external_code = $out;
-$grid -> title = 'Lista artykułów';
-$grid -> buttons = [
- [
- 'label' => 'Wstecz',
- 'url' => '/admin/pages/view_list/',
- 'icon' => 'fa-reply',
- 'class' => 'btn-dark'
- ]
- ];
-echo $grid -> draw();
+$grid->gdb_opt = $gdb;
+$grid->include_plugins = true;
+$grid->default_buttons = false;
+$grid->external_code = $out;
+$grid->title = 'Lista artykułów';
+$grid->buttons = [
+ [
+ 'label' => 'Wstecz',
+ 'url' => '/admin/pages/list/',
+ 'icon' => 'fa-reply',
+ 'class' => 'btn-dark',
+ ],
+];
+echo $grid->draw();
?>
\ No newline at end of file
+
+
+
diff --git a/admin/templates/pages/page-edit.php b/admin/templates/pages/page-edit.php
index f2857c8..5fe1611 100644
--- a/admin/templates/pages/page-edit.php
+++ b/admin/templates/pages/page-edit.php
@@ -1,400 +1 @@
-
-
-global $db;
-
-ob_start();
-?>
-
-
- - Treść
- - Ustawienia
- - SEO
-
-
-
-
-
-
-
- if ( is_array( $this -> languages ) ): foreach ( $this -> languages as $lg ):?>
- if ( $lg['status'] ):?>
-
- = \Html::input(
- array(
- 'label' => 'Nazwa strony',
- 'name' => 'title[' . $lg['id'] . ']',
- 'id' => 'title_' . $lg['id'],
- 'value' => $this -> page[ 'languages' ][ $lg['id'] ]['title'],
- )
- );?>
-
- endif;?>
- endforeach; endif;?>
-
-
-
-
-
-
- if ( is_array( $this -> menus ) ): foreach ( $this -> menus as $menu ):
- $menus[ $menu['id'] ] = $menu['name'];
- endforeach; endif;
- ?>
- = \Html::select(
- array(
- 'label' => 'Menu',
- 'name' => 'menu_id',
- 'values' => $menus,
- 'value' => $this -> page['id'] ? $this -> page['menu_id'] : $this -> menu_id
- )
- );?>
- = \Html::select(
- array(
- 'label' => 'Typ strony',
- 'name' => 'page_type',
- 'id' => 'page_type',
- 'values' => \admin\factory\Pages::$_page_types,
- 'value' => $this -> page['page_type']
- )
- );?>
-
-
-
-
-
- if ( is_array( $this -> languages ) ): foreach ( $this -> languages as $lg ):?>
- if ( $lg['status'] ):?>
-
- = \Html::input_icon( [
- 'label' => 'Link',
- 'name' => 'link[' . $lg['id'] . ']',
- 'id' => 'link_' . $lg['id'],
- 'value' => $this -> page['languages'][$lg['id']]['link'],
- 'icon_class' => 'fa fa-link',
- 'icon_js' => 'pages_url_browser( "' . $lg['id'] . '");'
- ] );
- ?>
-
- endif;?>
- endforeach; endif;?>
-
-
-
-
-
-
- = \Html::input(
- array(
- 'type' => 'hidden',
- 'name' => 'category_id',
- 'id' => 'category_id',
- 'value' => $this -> page['category_id']
- )
- );
- ?>
- = \Html::input_icon(
- array(
- 'label' => 'Kategoria',
- 'name' => 'category_title',
- 'id' => 'category_title',
- 'value' => $this -> page['category_id'] ? \admin\factory\ShopCategory::category_title( $this -> page['category_id'] ) : '',
- 'icon_class' => 'fa fa-link',
- 'icon_js' => 'category_url_browser();'
- )
- );
- ?>
-
-
- = \Html::select(
- array(
- 'label' => 'Sortowanie artykułów',
- 'name' => 'sort_type',
- 'id' => 'sort_type',
- 'values' => \admin\factory\Pages::$_sort_types,
- 'value' => $this -> page['sort_type']
- )
- );?>
-
- $layouts[''] = '---- szablon ----';
- if ( is_array( $this -> layouts ) ): foreach ( $this -> layouts as $layout ):
- $layouts[ $layout['id'] ] = $layout['name'];
- endforeach; endif;
- ?>
- = \Html::select(
- array(
- 'label' => 'Szablon',
- 'name' => 'layout_id',
- 'id' => 'layout_id',
- 'values' => $layouts,
- 'value' => $this -> page['layout_id']
- )
- );?>
- = \Html::input(
- array(
- 'label' => 'Liczba artykułów na stronę',
- 'name' => 'articles_limit',
- 'id' => 'articles_limit',
- 'value' => $this -> page['articles_limit'] ? $this -> page['articles_limit'] : 2
- )
- );?>
- = \Html::input_switch(
- array(
- 'label' => 'Pokaż tytuł',
- 'name' => 'show_title',
- 'checked' => $this -> page['show_title'] == 1 or !$this -> page['id'] ? true : false
- )
- );?>
- = \Html::input_switch(
- array(
- 'label' => 'Aktywna',
- 'name' => 'status',
- 'checked' => $this -> page['status'] == 1 or !$this -> page['id'] ? true : false
- )
- );?>
- = \Html::input_switch(
- array(
- 'label' => 'Strona startowa',
- 'name' => 'start',
- 'checked' => $this -> page['start'] == 1 ? true : false
- )
- );?>
-
-
-
-
-
-
- if ( is_array( $this -> languages ) ): foreach ( $this -> languages as $lg ):?>
- if ( $lg['status'] ):?>
-
- = \Html::input_icon( [
- 'label' => 'Link SEO',
- 'name' => 'seo_link[' . $lg['id'] . ']',
- 'id' => 'seo_link_' . $lg['id'],
- 'value' => $this -> page['languages' ][ $lg['id'] ]['seo_link'],
- 'icon_content' => 'generuj',
- 'icon_js' => 'generate_seo_links( "' . $lg['id'] . '", $( "#title_' . $lg['id'] . '" ).val(), ' . (int)$this -> page['id'] . ' );'
- ] );?>
- = \Html::input( [
- 'label' => 'Tytuł strony (h1)',
- 'name' => 'page_title[' . $lg['id'] . ']',
- 'id' => 'page_title_' . $lg['id'],
- 'value' => $this -> page['languages' ][ $lg['id'] ]['page_title']
- ] );?>
- = \Html::input( [
- 'label' => 'Meta title',
- 'name' => 'meta_title[' . $lg['id'] . ']',
- 'id' => 'meta_title_' . $lg['id'],
- 'value' => $this -> page['languages'][ $lg['id'] ]['meta_title']
- ] );?>
- = \Html::textarea( [
- 'label' => 'Meta description',
- 'name' => 'meta_description[' . $lg['id'] . ']',
- 'id' => 'meta_description_' . $lg['id'],
- 'value' => $this -> page['languages'][ $lg['id'] ]['meta_description']
- ] );?>
- = \Html::textarea( [
- 'label' => 'Meta keywords',
- 'name' => 'meta_keywords[' . $lg['id'] . ']',
- 'id' => 'meta_keywords_' . $lg['id'],
- 'value' => $this -> page['languages'][ $lg['id'] ]['meta_keywords']
- ] );?>
- = \Html::select( [
- 'label' => 'Blokuj indeksację',
- 'name' => 'noindex[' . $lg['id'] . ']',
- 'id' => 'noindex_' . $lg['id'],
- 'values' => [ 0 => 'nie', 1 => 'tak' ],
- 'value' => $this -> page['languages'][ $lg['id'] ]['noindex'] == 1 ? 1 : 0
- ] );?>
- = \Html::input( [
- 'label' => 'Rel canonical',
- 'name' => 'canonical[' . $lg['id'] . ']',
- 'id' => 'canonical_' . $lg['id'],
- 'value' => $this -> page['languages'][ $lg['id'] ]['canonical']
- ] );?>
-
- endif;?>
- endforeach; endif;?>
-
-
-
-
-
-
-
-$out = ob_get_clean();
-
-$grid = new \gridEdit;
-$grid -> id = 'page-edit';
-$grid -> gdb_opt = $gdb;
-$grid -> include_plugins = true;
-$grid -> title = 'Edycja strony';
-$grid -> fields = [
- [
- 'db' => 'id',
- 'type' => 'hidden',
- 'value' => $this -> page['id']
- ],
- [
- 'db' => 'parent_id',
- 'type' => 'hidden',
- 'value' => $this -> page['id'] ? $this -> page['parent_id'] : $this -> parent_id
- ]
- ];
-$grid -> actions = [
- 'save' => [ 'url' => '/admin/pages/page_save/', 'back_url' => '/admin/pages/view_list/' ],
- 'cancel' => [ 'url' => '/admin/pages/view_list/' ]
- ];
-$grid -> external_code = $out;
-$grid -> persist_edit = true;
-$grid -> id_param = 'id';
-
-echo $grid -> draw();
-?>
\ No newline at end of file
+= \Tpl::view('components/form-edit', ['form' => $this->form]); ?>
diff --git a/admin/templates/pages/pages-browse-list.php b/admin/templates/pages/pages-browse-list.php
index d7077fb..2cbe209 100644
--- a/admin/templates/pages/pages-browse-list.php
+++ b/admin/templates/pages/pages-browse-list.php
@@ -1,48 +1,57 @@
-
+ menus ) ) foreach ( $this -> menus as $menu )
- {
- ?>
-
-
- }
+$menus = is_array($this->menus ?? null) ? $this->menus : [];
+$modal = !empty($this->modal);
+$cookiePages = is_array($this->cookie_pages ?? null) ? $this->cookie_pages : [];
+$cookieMenus = is_array($this->cookie_menus ?? null) ? $this->cookie_menus : [];
+ob_start();
+foreach ($menus as $menu):
+ $menuId = (int)($menu['id'] ?? 0);
+ $menuName = (string)($menu['name'] ?? '');
+ $menuStatus = (int)($menu['status'] ?? 0);
+?>
+
+ id = 'pages-list';
-$grid -> gdb_opt = $gdb;
-$grid -> include_plugins = true;
-$grid -> title = 'Lista stron';
-$grid -> default_buttons = false;
-$grid -> external_code = $out;
+$grid->id = 'pages-list';
+$grid->gdb_opt = $gdb;
+$grid->include_plugins = true;
+$grid->title = 'Lista stron';
+$grid->default_buttons = false;
+$grid->external_code = $out;
-echo $grid -> draw();
+echo $grid->draw();
?>
\ No newline at end of file
+
+
diff --git a/admin/templates/pages/pages-list.php b/admin/templates/pages/pages-list.php
index 0219d50..12549f8 100644
--- a/admin/templates/pages/pages-list.php
+++ b/admin/templates/pages/pages-list.php
@@ -1,208 +1,249 @@
-
+ menus ) ) foreach ( $this -> menus as $menu )
- {
- ?>
-
-
- }
+$menus = is_array($this->menus ?? null) ? $this->menus : [];
+$cookiePages = is_array($this->cookie_pages ?? null) ? $this->cookie_pages : [];
+$cookieMenus = is_array($this->cookie_menus ?? null) ? $this->cookie_menus : [];
+ob_start();
+foreach ($menus as $menu):
+ $menuId = (int)($menu['id'] ?? 0);
+ $menuName = (string)($menu['name'] ?? '');
+ $menuStatus = (int)($menu['status'] ?? 0);
+?>
+
+ id = 'pages-list';
-$grid -> gdb_opt = $gdb;
-$grid -> include_plugins = true;
-$grid -> title = 'Lista stron';
-$grid -> default_buttons = false;
-$grid -> buttons = [
- [
- 'label' => 'Dodaj menu',
- 'url' => '/admin/pages/menu_edit/',
- 'icon' => 'fa-plus-circle',
- 'class' => 'btn-success'
- ]
- ];
-$grid -> external_code = $out;
+$grid->id = 'pages-list';
+$grid->gdb_opt = $gdb;
+$grid->include_plugins = true;
+$grid->title = 'Lista stron';
+$grid->default_buttons = false;
+$grid->buttons = [
+ [
+ 'label' => 'Dodaj menu',
+ 'url' => '/admin/pages/menuEdit/',
+ 'icon' => 'fa-plus-circle',
+ 'class' => 'btn-success',
+ ],
+];
+$grid->external_code = $out;
-echo $grid -> draw();
+echo $grid->draw();
?>
+
\ No newline at end of file
+
+
+
diff --git a/admin/templates/pages/subpages-browse-list.php b/admin/templates/pages/subpages-browse-list.php
index 0602642..8c14390 100644
--- a/admin/templates/pages/subpages-browse-list.php
+++ b/admin/templates/pages/subpages-browse-list.php
@@ -1,77 +1,60 @@
- if ( is_array( $this -> pages ) ):?>
- $settings = \front\factory\Settings::settings_details();?>
-
- foreach ( $this -> pages as $page ):?>
- -
-
-
-
- if ( !$page['status'] )
- echo '
';
+pages ?? null) ? $this->pages : [];
+$step = (int)($this->step ?? 1);
- if ( $page['start'] )
- echo '
';
-
- echo $page['title'];
-
- if ( is_array( $page['languages'] ) ):
- echo '
';
- foreach ( $page['languages'] as $lg )
- echo '

';
- echo '
';
- endif;
-
- $default_language = \front\factory\Languages::default_language();
- if ( is_array( $page['languages'] ) ):
- foreach ( $page['languages'] as $lg ):
- echo '
';
- endforeach;
- endif;
- ?>
-
-
- if ( is_array( $page['subpages'] ) )
- echo \admin\view\Pages::subpages_browse_list( $page['subpages'],
- $page['id'], $this -> step + 1 );
+if (empty($pages)) {
+ return;
+}
+?>
+
+
+
-
- endforeach;?>
-
- endif;?>
\ No newline at end of file
+
+
+
+
+
+ = htmlspecialchars($title, ENT_QUOTES, 'UTF-8'); ?>
+
+
+
+
+
+
+
; ?>.jpg)
+
+
+
+
+
+
+
+
+
+
+
+ = \Tpl::view('pages/subpages-browse-list', [
+ 'pages' => $page['subpages'] ?? [],
+ 'step' => $step + 1,
+ ]); ?>
+
+
+
diff --git a/admin/templates/pages/subpages-list.php b/admin/templates/pages/subpages-list.php
index 1c9c0e8..fd85e11 100644
--- a/admin/templates/pages/subpages-list.php
+++ b/admin/templates/pages/subpages-list.php
@@ -1,60 +1,75 @@
- if ( is_array( $this -> pages ) ):?>
-
- foreach ( $this -> pages as $page ):?>
- -
-
-
+ = \Tpl::view('pages/subpages-list', [
+ 'pages' => $page['subpages'] ?? [],
+ 'step' => $step + 1,
+ ]); ?>
+
+
+
+
diff --git a/admin/templates/settings/settings.php b/admin/templates/settings/settings.php
index 1f2337a..37274e3 100644
--- a/admin/templates/settings/settings.php
+++ b/admin/templates/settings/settings.php
@@ -361,7 +361,7 @@ $grid -> gdb_opt = $gdb;
$grid -> include_plugins = true;
$grid -> title = 'Edycja ustawień';
$grid -> actions = [
- 'save' => [ 'url' => '/admin/settings/settings_save/', 'back_url' => '' ],
+ 'save' => [ 'url' => '/admin/settings/save/', 'back_url' => '' ],
];
$grid -> persist_edit = true;
$grid -> external_code = $out;
@@ -378,4 +378,4 @@ echo $grid -> draw();
html: true
});
});
-
\ No newline at end of file
+
diff --git a/admin/templates/shop-category/category-edit.php b/admin/templates/shop-category/category-edit.php
index 0b0cb95..9ef6831 100644
--- a/admin/templates/shop-category/category-edit.php
+++ b/admin/templates/shop-category/category-edit.php
@@ -36,9 +36,8 @@
{
type: 'POST',
cache: false,
- url: '/admin/ajax.php',
+ url: '/admin/pages/generateSeoLink/',
data: {
- a: 'generate_seo_link',
title: title,
category_id: category_id
},
@@ -67,7 +66,7 @@ ob_start();
?>
- - Treść
+ - Treść
- Ustawienia
- SEO
@@ -77,7 +76,7 @@ ob_start();
if ( is_array( $this -> languages ) ): foreach ( $this -> languages as $lg ):?>
if ( $lg['status'] ):?>
- - if ( $lg['id'] == \front\factory\Languages::default_language() ) echo ' ';?>= $lg['name'];?>
+ - if ( $lg['id'] == \front\factory\Languages::default_language() ) echo ' ';?>= $lg['name'];?>
endif;?>
endforeach; endif;?>
@@ -105,7 +104,7 @@ ob_start();
);?>
= \Html::textarea(
array(
- 'label' => 'Opis kategorii (rozwinięcie)',
+ 'label' => 'Opis kategorii (rozwinięcie)',
'name' => 'text_hidden[' . $lg['id'] . ']',
'id' => 'text_hidden_' . $lg['id'],
'value' => $this -> category['languages'][ $lg['id'] ]['text_hidden'],
@@ -144,7 +143,7 @@ ob_start();
);?>
= \Html::select(
[
- 'label' => 'Sortowanie produktów',
+ 'label' => 'Sortowanie produktĂłw',
'name' => 'sort_type',
'id' => 'sort_type',
'values' => \admin\factory\ShopCategory::$_sort_types,
@@ -153,7 +152,7 @@ ob_start();
);?>
= \Html::input_switch(
array(
- 'label' => 'Wyświetlić podkategorie',
+ 'label' => 'Wyświetlić podkategorie',
'name' => 'view_subcategories',
'checked' => $this -> category['view_subcategories'] == 1 ? true : false
)
@@ -164,7 +163,7 @@ ob_start();
if ( is_array( $this -> languages ) ): foreach ( $this -> languages as $lg ):?>
if ( $lg['status'] ):?>
- - if ( $lg['id'] == \front\factory\Languages::default_language() ) echo ' ';?>= $lg['name'];?>
+ - if ( $lg['id'] == \front\factory\Languages::default_language() ) echo ' ';?>= $lg['name'];?>
endif;?>
endforeach; endif;?>
@@ -184,7 +183,7 @@ ob_start();
);?>
= \Html::input(
array(
- 'label' => 'Tytuł kategorii (h1)',
+ 'label' => 'Tytuł kategorii (h1)',
'name' => 'category_title[' . $lg['id'] . ']',
'id' => 'category_title_' . $lg['id'],
'value' => $this -> category['languages' ][ $lg['id'] ]['category_title']
@@ -216,7 +215,7 @@ ob_start();
);?>
= \Html::select(
array(
- 'label' => 'Blokuj indeksację',
+ 'label' => 'Blokuj indeksacjÄ™',
'name' => 'noindex[' . $lg['id'] . ']',
'id' => 'noindex_' . $lg['id'],
'values' => array(
@@ -263,4 +262,5 @@ $grid -> persist_edit = true;
$grid -> id_param = 'id';
echo $grid -> draw();
-?>
\ No newline at end of file
+?>
+
diff --git a/admin/templates/shop-product/product-edit.php b/admin/templates/shop-product/product-edit.php
index e4a216a..e5a07a3 100644
--- a/admin/templates/shop-product/product-edit.php
+++ b/admin/templates/shop-product/product-edit.php
@@ -21,15 +21,15 @@ ob_start();
- Opis
- - Zakładki
+ - Zakładki
- Cena
- Magazyn
- Ustawienia
- SEO
- - Wyświetlanie
+ - Wyświetlanie
- Galeria
- - Załączniki
- - Produkty powiązane
+ - Załączniki
+ - Produkty powiÄ…zane
- XML
- Dodatkowe pola
- GPSR
@@ -40,7 +40,7 @@ ob_start();
if (is_array($this->languages)) : foreach ($this->languages as $lg) : ?>
if ($lg['status']) : ?>
- - if ($lg['id'] == \front\factory\Languages::default_language()) echo ' '; ?>= $lg['name']; ?>
+ - if ($lg['id'] == \front\factory\Languages::default_language()) echo ' '; ?>= $lg['name']; ?>
endif; ?>
endforeach;
@@ -52,7 +52,7 @@ ob_start();
$languages = array();
- $languages[''] = '---- wersja językowa ----';
+ $languages[''] = '---- wersja językowa ----';
if (is_array($this->languages))
foreach ($this->languages as $lg_tmp)
{
@@ -65,7 +65,7 @@ ob_start();
=
\Html::select(
array(
- 'label' => 'Wyświetlaj treść z wersji',
+ 'label' => 'Wyświetlaj treść z wersji',
'name' => 'copy_from[' . $lg['id'] . ']',
'values' => $languages,
'value' => $this->product['languages'][$lg['id']]['copy_from'],
@@ -86,7 +86,7 @@ ob_start();
=
\Html::input(
array(
- 'label' => 'Komunikat gdy stan magazynowy równy 0',
+ 'label' => 'Komunikat gdy stan magazynowy rĂłwny 0',
'name' => 'warehouse_message_zero[' . $lg['id'] . ']',
'id' => 'warehouse_message_zero_' . $lg['id'],
'value' => $this->product['languages'][$lg['id']]['warehouse_message_zero'],
@@ -97,7 +97,7 @@ ob_start();
=
\Html::input(
array(
- 'label' => 'Komunikat gdy stan magazynowy większy niż 0',
+ 'label' => 'Komunikat gdy stan magazynowy większy niż 0',
'name' => 'warehouse_message_nonzero[' . $lg['id'] . ']',
'id' => 'warehouse_message_nonzero_' . $lg['id'],
'value' => $this->product['languages'][$lg['id']]['warehouse_message_nonzero'],
@@ -108,7 +108,7 @@ ob_start();
=
\Html::textarea(
array(
- 'label' => 'Krótki opis',
+ 'label' => 'KrĂłtki opis',
'name' => 'short_description[' . $lg['id'] . ']',
'id' => 'short_description_' . $lg['id'],
'value' => $this->product['languages'][$lg['id']]['short_description'],
@@ -154,7 +154,7 @@ ob_start();
if (is_array($this->languages)) : foreach ($this->languages as $lg) : ?>
if ($lg['status']) : ?>
- - if ($lg['id'] == \front\factory\Languages::default_language()) echo ' '; ?>= $lg['name']; ?>
+ - if ($lg['id'] == \front\factory\Languages::default_language()) echo ' '; ?>= $lg['name']; ?>
endif; ?>
endforeach;
@@ -166,7 +166,7 @@ ob_start();
$languages = array();
- $languages[''] = '---- wersja językowa ----';
+ $languages[''] = '---- wersja językowa ----';
if (is_array($this->languages))
foreach ($this->languages as $lg_tmp)
{
@@ -179,7 +179,7 @@ ob_start();
=
\Html::input(
array(
- 'label' => 'Nazwa zakładki (1)',
+ 'label' => 'Nazwa zakładki (1)',
'name' => 'tab_name_1[' . $lg['id'] . ']',
'id' => 'tab_name_1_' . $lg['id'],
'value' => $this->product['languages'][$lg['id']]['tab_name_1'],
@@ -190,7 +190,7 @@ ob_start();
=
\Html::textarea(
array(
- 'label' => 'Zawartość zakładki (1)',
+ 'label' => 'Zawartość zakładki (1)',
'name' => 'tab_description_1[' . $lg['id'] . ']',
'id' => 'tab_description_1_' . $lg['id'],
'value' => $this->product['languages'][$lg['id']]['tab_description_1'],
@@ -201,7 +201,7 @@ ob_start();
=
\Html::input(
array(
- 'label' => 'Nazwa zakładki (2)',
+ 'label' => 'Nazwa zakładki (2)',
'name' => 'tab_name_2[' . $lg['id'] . ']',
'id' => 'tab_name_2_' . $lg['id'],
'value' => $this->product['languages'][$lg['id']]['tab_name_2'],
@@ -212,7 +212,7 @@ ob_start();
=
\Html::textarea(
array(
- 'label' => 'Zawartość zakładki (2)',
+ 'label' => 'Zawartość zakładki (2)',
'name' => 'tab_description_2[' . $lg['id'] . ']',
'id' => 'tab_description_2_' . $lg['id'],
'value' => $this->product['languages'][$lg['id']]['tab_description_2'],
@@ -305,7 +305,7 @@ ob_start();
?>
- $units[] = '--- wybierze jednostkę miary ---';
+ $units[] = '--- wybierze jednostkÄ™ miary ---';
foreach ($this->units as $unit)
$units[$unit['id']] = $unit['text'];
?>
@@ -317,7 +317,7 @@ ob_start();
'value' => $this->product['product_unit_id']
]); ?>
= \Html::input([
- 'label' => 'Waga/pojemność',
+ 'label' => 'Waga/pojemność',
'name' => 'weight',
'id' => 'weight',
'class' => 'number-format',
@@ -336,14 +336,14 @@ ob_start();
?>
=
\Html::input_switch([
- 'label' => 'Pozwól zamawiać gdy stan 0',
+ 'label' => 'Pozwól zamawiać gdy stan 0',
'name' => 'stock_0_buy',
'checked' => $this->product['stock_0_buy'] == 1 ? true : false
]);
?>
=
\Html::input([
- 'label' => 'Współczynnik WP',
+ 'label' => 'Współczynnik WP',
'name' => 'wp',
'id' => 'wp',
'class' => 'number-format',
@@ -382,7 +382,7 @@ ob_start();
?>
=
\Html::input([
- 'label' => 'Nowość do dnia',
+ 'label' => 'Nowość do dnia',
'name' => 'new_to_date',
'id' => 'new_to_date',
'class' => 'date',
@@ -390,19 +390,19 @@ ob_start();
]);
?>
= \Html::input_switch([
- 'label' => 'Wyświetlaj pole na dodatkową wiadomość',
+ 'label' => 'Wyświetlaj pole na dodatkową wiadomość',
'name' => 'additional_message',
'checked' => $this->product['additional_message'] == 1 ? true : false
]);
?>
= \Html::input_switch([
- 'label' => 'Dodatkowa wiadomość jest wymagana',
+ 'label' => 'Dodatkowa wiadomość jest wymagana',
'name' => 'additional_message_required',
'checked' => $this->product['additional_message_required'] == 1 ? true : false
]);
?>
= \Html::input([
- 'label' => 'Dodatkowa wiadomość (treść komunikatu)',
+ 'label' => 'Dodatkowa wiadomość (treść komunikatu)',
'name' => 'additional_message_text',
'id' => 'additional_message_text',
'value' => $this->product['additional_message_text']
@@ -414,7 +414,7 @@ ob_start();
if (is_array($this->languages)) : foreach ($this->languages as $lg) : ?>
if ($lg['status']) : ?>
- - if ($lg['id'] == \front\factory\Languages::default_language()) echo ' '; ?>= $lg['name']; ?>
+ - if ($lg['id'] == \front\factory\Languages::default_language()) echo ' '; ?>= $lg['name']; ?>
endif; ?>
endforeach;
@@ -481,7 +481,7 @@ ob_start();
- $layouts[''] = '---- szablon domyślny ----';
+ $layouts[''] = '---- szablon domyślny ----';
if (is_array($this->layouts)) : foreach ($this->layouts as $layout) :
$layouts[$layout['id']] = $layout['name'];
endforeach;
@@ -497,7 +497,7 @@ ob_start();
]);
?>