ver. 0.273 - ShopProducer refactor + cleanup 6 factory facades
- Domain\Producer\ProducerRepository (CRUD + frontend) - admin\Controllers\ShopProducerController (DI) - Nowe widoki: producers-list, producer-edit (table-list/form-edit) - shop\Producer -> fasada do ProducerRepository - Przepiecie ShopProduct factory na TransportRepository - Usuniete 6 pustych factory facades: Languages, Newsletter, Scontainers, ShopProducer, ShopTransport, Layouts - Usuniete legacy: controls\ShopProducer, stare szablony - Testy: 338 tests, 1063 assertions OK
This commit is contained in:
@@ -1,37 +0,0 @@
|
||||
<?
|
||||
namespace admin\controls;
|
||||
class ShopProducer
|
||||
{
|
||||
static public function delete()
|
||||
{
|
||||
if ( \admin\factory\ShopProducer::delete( \S::get( 'id' ) ) )
|
||||
\S::alert( 'Producent został usunięty' );
|
||||
header( 'Location: /admin/shop_producer/list/' );
|
||||
exit;
|
||||
}
|
||||
|
||||
static public function save()
|
||||
{
|
||||
$response = [ 'status' => 'error', 'msg' => 'Podczas zapisywania producenta wystąpił błąd. Proszę spróbować ponownie.' ];
|
||||
$values = json_decode( \S::get( 'values' ), true );
|
||||
|
||||
if ( $producer_id = \admin\factory\ShopProducer::save( $values['id'], $values['name'], $values['status'] == 'on' ? 1 : 0, $values['img'], $values['description'], $values['data'], $values['meta_title'] ) )
|
||||
$response = [ 'status' => 'ok', 'msg' => 'Producent został zapisany.', 'id' => $producer_id ];
|
||||
|
||||
echo json_encode( $response );
|
||||
exit;
|
||||
}
|
||||
|
||||
static public function edit()
|
||||
{
|
||||
return \Tpl::view( 'shop-producer/edit', [
|
||||
'producer' => \S::get( 'id' ) ? new \shop\Producer( \S::get( 'id' ) ) : null,
|
||||
'languages' => ( new \Domain\Languages\LanguagesRepository( $GLOBALS['mdb'] ) )->languagesList()
|
||||
] );
|
||||
}
|
||||
|
||||
static public function list()
|
||||
{
|
||||
return \Tpl::view( 'shop-producer/list' );
|
||||
}
|
||||
}
|
||||
@@ -248,7 +248,7 @@ class ShopProduct
|
||||
'products' => \admin\factory\ShopProduct::products_list(),
|
||||
'dlang' => \front\factory\Languages::default_language(),
|
||||
'sets' => \shop\ProductSet::sets_list(),
|
||||
'producers' => \admin\factory\ShopProducer::all(),
|
||||
'producers' => ( new \Domain\Producer\ProducerRepository( $mdb ) )->allProducers(),
|
||||
'units' => ( new \Domain\Dictionaries\DictionariesRepository( $mdb ) ) -> allUnits(),
|
||||
'user' => $user
|
||||
] );
|
||||
@@ -262,12 +262,6 @@ class ShopProduct
|
||||
return is_array( $rows ) ? $rows : [];
|
||||
}
|
||||
|
||||
if ( class_exists( '\admin\factory\Layouts' ) )
|
||||
{
|
||||
$rows = \admin\factory\Layouts::layouts_list();
|
||||
return is_array( $rows ) ? $rows : [];
|
||||
}
|
||||
|
||||
return [];
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user