58 lines
1.4 KiB
PHP
58 lines
1.4 KiB
PHP
<?
|
|
namespace admin\controls;
|
|
class ContactsMaps
|
|
{
|
|
static public function view_list()
|
|
{
|
|
global $user;
|
|
|
|
if ( !\admin\factory\Users::check_privileges( 'scontainers_administration', $user['id'] ) )
|
|
return \S::alert( 'Nie masz uprawnień' );
|
|
|
|
return \Tpl::view( 'contacts-maps/view-list' );
|
|
}
|
|
|
|
static public function edit()
|
|
{
|
|
global $user;
|
|
|
|
if (!\admin\factory\Users::check_privileges('scontainers_administration', $user['id']))
|
|
return \S::alert('Nie masz uprawnień');
|
|
|
|
return \Tpl::view('contacts-maps/element-edit', [
|
|
'item' => \admin\factory\ContactsMaps::get(\S::get('id')),
|
|
'products' => \admin\factory\ContactsMaps::products(),
|
|
'provinces' => \admin\factory\ContactsMaps::provinces(),
|
|
]);
|
|
}
|
|
|
|
static public function save()
|
|
{
|
|
global $user;
|
|
|
|
if (!\admin\factory\Users::check_privileges('scontainers_administration', $user['id']))
|
|
return;
|
|
|
|
$values = \S::json_to_array(\S::get('values'));
|
|
|
|
$id = \admin\factory\ContactsMaps::save($values);
|
|
|
|
echo json_encode([
|
|
'status' => $id ? 'ok' : 'error',
|
|
'id' => $id
|
|
]);
|
|
exit;
|
|
}
|
|
|
|
static public function delete()
|
|
{
|
|
global $user;
|
|
|
|
if (!\admin\factory\Users::check_privileges('scontainers_administration', $user['id']))
|
|
return;
|
|
|
|
\admin\factory\ContactsMaps::delete(\S::get('id'));
|
|
header('Location: /admin/contacts_maps/view_list/');
|
|
exit;
|
|
}
|
|
} |