ver. 0.251 - migrate Dictionaries to Domain/Controller and remove legacy classes
This commit is contained in:
@@ -1,39 +0,0 @@
|
||||
<?php
|
||||
namespace admin\controls;
|
||||
|
||||
class Dictionaries {
|
||||
public static function view_list()
|
||||
{
|
||||
return \Tpl::view( 'dictionaries/units-list' );
|
||||
}
|
||||
|
||||
public static function unit_edit()
|
||||
{
|
||||
return \Tpl::view( 'dictionaries/unit-edit', [
|
||||
'unit' => \admin\factory\Dictionaries::unit_details( \S::get( 'id' )),
|
||||
'languages' => \admin\factory\Languages::languages_list(),
|
||||
] );
|
||||
}
|
||||
|
||||
static public function unit_save()
|
||||
{
|
||||
$response = [ 'status' => 'error', 'msg' => 'Podczas zapisywania jednostki miary wystąpił błąd. Proszę spróbować ponownie.' ];
|
||||
$values = json_decode( \S::get( 'values' ), true );
|
||||
|
||||
if ( $id = \admin\factory\Dictionaries::unit_save( $values['id'], $values['text']) )
|
||||
$response = [ 'status' => 'ok', 'msg' => 'Jednostka miary została zapisana.', 'id' => $id ];
|
||||
|
||||
echo json_encode( $response );
|
||||
exit;
|
||||
|
||||
}
|
||||
|
||||
static public function unit_delete()
|
||||
{
|
||||
if ( \admin\factory\Dictionaries::unit_delete( \S::get( 'id' ) ) )
|
||||
\S::alert( 'Jesdnostka miary została usunięta.' );
|
||||
|
||||
header( 'Location: /admin/dictionaries/view_list/' );
|
||||
exit;
|
||||
}
|
||||
}
|
||||
@@ -230,7 +230,7 @@ class ShopProduct
|
||||
|
||||
// edycja produktu
|
||||
public static function product_edit() {
|
||||
global $user;
|
||||
global $user, $mdb;
|
||||
|
||||
if ( !$user ) {
|
||||
header( 'Location: /admin/' );
|
||||
@@ -249,7 +249,7 @@ class ShopProduct
|
||||
'dlang' => \front\factory\Languages::default_language(),
|
||||
'sets' => \shop\ProductSet::sets_list(),
|
||||
'producers' => \admin\factory\ShopProducer::all(),
|
||||
'units' => \admin\factory\Dictionaries::all_units(),
|
||||
'units' => ( new \Domain\Dictionaries\DictionariesRepository( $mdb ) ) -> allUnits(),
|
||||
'user' => $user
|
||||
] );
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user