first commit
This commit is contained in:
37
autoload/admin/controls/class.ShopProducer.php
Normal file
37
autoload/admin/controls/class.ShopProducer.php
Normal file
@@ -0,0 +1,37 @@
|
||||
<?
|
||||
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['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' => \admin\factory\Languages::languages_list()
|
||||
] );
|
||||
}
|
||||
|
||||
static public function list()
|
||||
{
|
||||
return \Tpl::view( 'shop-producer/list' );
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user