Files
globelus.pl/autoload/admin/controls/class.Globelus.php
2024-11-11 15:28:20 +01:00

54 lines
1.5 KiB
PHP

<?php
namespace admin\controls;
class Globelus
{
public static function main_page_save()
{
global $mdb;
if ( \S::get( 'main_page_status' ) )
$main_page_to = date( 'Y-m-d', strtotime( "+10 days") );
else
$main_page_to = null;
$mdb -> update( 'globelus_adverts', [ 'main_page' => \S::get( 'main_page_status' ), 'main_page_to' => $main_page_to ], [ 'id' => \S::get( 'advert_id' ) ] );
$response = [ 'status' => 'ok', 'main_page_to' => $main_page_to ];
echo json_encode( $response );
exit;
}
public static function highlight_save()
{
global $mdb;
if ( \S::get( 'highlight_status' ) )
$highlight_to = date( 'Y-m-d', strtotime( "+10 days") );
else
$highlight_to = null;
$mdb -> update( 'globelus_adverts', [ 'highlight' => \S::get( 'highlight_status' ), 'highlight_to' => $highlight_to ], [ 'id' => \S::get( 'advert_id' ) ] );
$response = [ 'status' => 'ok', 'highlight_to' => $highlight_to ];
echo json_encode( $response );
exit;
}
public static function save_to_db()
{
$response = [ 'status' => 'bad' ];
if ( $id = \admin\factory\Globelus::save_to_db(
\S::get( 'table' ),
\S::get( 'column_id' ),
\S::get( 'row_id' ),
\S::get( 'column' ),
\S::get( 'operation' ),
\S::get( 'value' ),
\S::get( 'values' )
) )
$response = [ 'status' => 'ok', 'id' => $id ];
echo json_encode( $response );
exit;
}
}