28 lines
513 B
PHP
28 lines
513 B
PHP
<?php
|
|
|
|
namespace HermannTelser\Gutachten\Settings;
|
|
|
|
use HermannTelser\Gutachten\DB\DbFunction;
|
|
|
|
class ToggleTheme
|
|
{
|
|
/**
|
|
* @param mixed $id
|
|
*
|
|
* @return bool
|
|
*/
|
|
public static function toggle()
|
|
{
|
|
$theme = $GLOBALS['TSFE']->fe_user->user['tx_nuh_layout'];
|
|
$userid = $GLOBALS['TSFE']->fe_user->user['uid'];
|
|
|
|
$update_array = [];
|
|
$update_array['tx_nuh_layout'] = 'light' == $theme ? 'dark' : 'light';
|
|
|
|
DbFunction::secureUpdate('fe_users', $update_array, ['uid' => $userid]);
|
|
|
|
echo 1;
|
|
exit;
|
|
}
|
|
}
|