51 lines
1.4 KiB
PHP
51 lines
1.4 KiB
PHP
<?php
|
|
namespace admin\controls;
|
|
|
|
class Scontainers
|
|
{
|
|
public static function container_delete()
|
|
{
|
|
if ( \admin\factory\Scontainers::container_delete( \S::get( 'id' ) ) )
|
|
\S::alert( 'Kontener został usunięty.' );
|
|
header( 'Location: /admin/scontainers/view_list/' );
|
|
exit;
|
|
}
|
|
|
|
public static function container_save()
|
|
{
|
|
$response = [ 'status' => 'error', 'msg' => 'Podczas zapisywania kontenera wystąpił błąd. Proszę spróbować ponownie.' ];
|
|
$values_tmp = json_decode( \S::get( 'values' ), true );
|
|
|
|
$values = [];
|
|
|
|
foreach ( $values_tmp as $item )
|
|
{
|
|
$name = $item['name'];
|
|
$value = $item['value'];
|
|
$keys = \S::parse_name( $name );
|
|
\S::set_array_value( $values, $keys, $value );
|
|
}
|
|
|
|
if ( $id = \admin\factory\Scontainers::container_save( $values['id'], $values['title'], $values['text'], $values['status'], $values['show_title'] ) )
|
|
$response = [ 'status' => 'ok', 'msg' => 'Kontener został zapisany.', 'id' => $id ];
|
|
|
|
echo json_encode( $response );
|
|
exit;
|
|
}
|
|
|
|
public static function container_edit()
|
|
{
|
|
return \admin\view\Scontainers::container_edit(
|
|
\admin\factory\Scontainers::container_details(
|
|
\S::get( 'id' )
|
|
),
|
|
\admin\factory\Languages::languages_list()
|
|
);
|
|
}
|
|
|
|
public static function view_list()
|
|
{
|
|
return \admin\view\Scontainers::containers_list();
|
|
}
|
|
}
|