Refactor admin lists and migrate legacy archive/filemanager controllers
This commit is contained in:
@@ -1,30 +0,0 @@
|
||||
<?
|
||||
namespace admin\controls;
|
||||
|
||||
/**
|
||||
* @deprecated Użyj \admin\Controllers\ProductArchiveController
|
||||
* Klasa zachowana jako fallback dla starego URL /admin/archive/products_list/
|
||||
*/
|
||||
class Archive {
|
||||
static public function products_list() {
|
||||
|
||||
$current_page = \S::get_session( 'archive_products_list_current_page' );
|
||||
|
||||
if ( !$current_page ) {
|
||||
$current_page = 1;
|
||||
\S::set_session( 'archive_products_list_current_page', $current_page );
|
||||
}
|
||||
|
||||
$query = \S::get_session( 'archive_products_list_query' );
|
||||
if ( $query ) {
|
||||
$query_array = [];
|
||||
parse_str( $query, $query_array );
|
||||
}
|
||||
|
||||
return \Tpl::view( 'product_archive/products-list', [
|
||||
'current_page' => $current_page,
|
||||
'query_array' => $query_array,
|
||||
'pagination_max' => ceil( \admin\factory\ShopProduct::count_product() / 10 )
|
||||
] );
|
||||
}
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
<?php
|
||||
namespace admin\controls;
|
||||
|
||||
class Filemanager
|
||||
{
|
||||
static public function draw()
|
||||
{
|
||||
return \Tpl::view( 'filemanager/filemanager' );
|
||||
}
|
||||
}
|
||||
?>
|
||||
@@ -257,23 +257,11 @@ class ShopProduct
|
||||
// ajax_load_products ARCHIVE
|
||||
static public function ajax_load_products_archive()
|
||||
{
|
||||
$response = [ 'status' => 'error', 'msg' => 'Podczas ładowania produktów wystąpił błąd. Proszę spróbować ponownie.' ];
|
||||
|
||||
\S::set_session( 'products_list_current_page', \S::get( 'current_page' ) );
|
||||
\S::set_session( 'products_list_query', \S::get( 'query' ) );
|
||||
|
||||
if ( $products = \admin\factory\ShopProduct::ajax_products_list_archive( \S::get_session( 'products_list_current_page' ), \S::get_session( 'products_list_query' ) ) ) {
|
||||
$response = [
|
||||
'status' => 'ok',
|
||||
'pagination_max' => ceil( $products['products_count'] / 10 ),
|
||||
'html' => \Tpl::view( 'product_archive/products-list-table', [
|
||||
'products' => $products['products'],
|
||||
'current_page' => \S::get( 'current_page' ),
|
||||
] )
|
||||
];
|
||||
}
|
||||
|
||||
echo json_encode( $response );
|
||||
echo json_encode( [
|
||||
'status' => 'deprecated',
|
||||
'msg' => 'Endpoint nie jest juz wspierany. Uzyj /admin/product_archive/products_list/.',
|
||||
'redirect_url' => '/admin/product_archive/products_list/'
|
||||
] );
|
||||
exit;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user