diff --git a/web/models/User.model.php b/web/models/User.model.php index b53d5cc..8ab06b9 100644 --- a/web/models/User.model.php +++ b/web/models/User.model.php @@ -15,9 +15,10 @@ class User extends Model { 'token' => ['type'=>'text','required','unique','autoValMethod'=>'uuid4'], 'timezone' => ['type'=>'int'], 'dogs' => ['type'=> 'array','default'=>[]], - 'tournaments' => ['type'=> 'array','default'=>[]], - 'photo' => ['type'=>'text','default'=>'https://pictshare.net/pj7vzx.jpg'], - 'active' => ['type'=>'int','default'=>0] + 'tournaments' =>['type'=> 'array','default'=>[]], + 'photo' => ['type'=>'text','default'=>'https://pictshare.net/pj7vzx.jpg'], + 'theme' => ['type'=>'text','default'=>'light'], //light/dark + 'active' => ['type'=>'int','default'=>0] ); protected $hidden = ['password','token']; diff --git a/web/pages/settings/controller.php b/web/pages/settings/controller.php new file mode 100644 index 0000000..bebfce3 --- /dev/null +++ b/web/pages/settings/controller.php @@ -0,0 +1,34 @@ +set('userdata', $_SESSION['user']->data); + $this->set('template', "settings.html"); + } + + function edit() + { + $theme = $_REQUEST['theme']; + switch($theme) + { + case 'light': + case 'dark': + $_SESSION['user']->data['theme'] = $theme; + $_SESSION['user']->save(); + $this->redirect('/settings'); + break; + default: + return partial('error.html', ['errorMessage' => 'Dieses Theme existiert nicht']); + } + + + } + + function maySeeThisPage(){ + if($_SESSION['user']) + return true; + else return false; + } +} \ No newline at end of file diff --git a/web/pages/settings/settings.html b/web/pages/settings/settings.html new file mode 100644 index 0000000..6c66f1f --- /dev/null +++ b/web/pages/settings/settings.html @@ -0,0 +1,13 @@ +
\ No newline at end of file diff --git a/web/templates/mainpage.html b/web/templates/mainpage.html index fdf2a32..6e0fab1 100644 --- a/web/templates/mainpage.html +++ b/web/templates/mainpage.html @@ -1,5 +1,5 @@ - + @@ -35,7 +35,7 @@ - + theme)): ?> \ No newline at end of file