first commit
This commit is contained in:
53
autoload/admin/controls/class.Globelus.php
Normal file
53
autoload/admin/controls/class.Globelus.php
Normal file
@@ -0,0 +1,53 @@
|
||||
<?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;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user