From 3cc92683faf3e103d0bccbb3f56c2979caa6d391 Mon Sep 17 00:00:00 2001 From: Chewbaka69 Date: Wed, 21 Nov 2018 14:43:32 +0100 Subject: [PATCH] Prepare settings form --- fuel/app/classes/controller/settings.php | 27 ++++++++++++++-- fuel/app/classes/model/settings.php | 19 ++++++++++++ fuel/app/views/settings/index.php | 39 ++++++++++++------------ 3 files changed, 63 insertions(+), 22 deletions(-) create mode 100644 fuel/app/classes/model/settings.php diff --git a/fuel/app/classes/controller/settings.php b/fuel/app/classes/controller/settings.php index 53b3276..6e31542 100644 --- a/fuel/app/classes/controller/settings.php +++ b/fuel/app/classes/controller/settings.php @@ -1,6 +1,7 @@ _user = Session::get('user'); - if(!$user) + if(!$this->_user) Response::redirect('/login'); - $this->template->user = Session::get('user'); + $this->template->user = $this->_user; $this->template->js_bottom = []; } public function action_index() { + $settings = Model_Settings::find_one_by('user_id', Session::get('user')->id); + + $is_submit = Input::post('submit'); + + if(isset($is_submit)) { + $settings = !empty($settings) ? $settings : new Model_Settings(); + $settings->set([ + 'user_id' => $this->_user->id, + 'language' => Input::post('language'), + 'trailer_type'=> Input::post('typeTrailer'), + 'trailer' => Input::post('trailerCount'), + 'subtitle' => Input::post('subtitleSize'), + 'quality' => Input::post('remoteQuality') + ]); + $settings->save(); + } + $body = View::forge('settings/index'); + $body->set('settings', $settings); $this->template->body = $body; } diff --git a/fuel/app/classes/model/settings.php b/fuel/app/classes/model/settings.php new file mode 100644 index 0000000..811fe46 --- /dev/null +++ b/fuel/app/classes/model/settings.php @@ -0,0 +1,19 @@ + 'required', + ); + protected static $_properties = array( + 'id', + 'user_id', + 'language', + 'trailer_type', + 'trailer', + 'subtitle', + 'quality', + ); +} \ No newline at end of file diff --git a/fuel/app/views/settings/index.php b/fuel/app/views/settings/index.php index 6517b20..e667e13 100644 --- a/fuel/app/views/settings/index.php +++ b/fuel/app/views/settings/index.php @@ -10,28 +10,19 @@
-
+
-

Version 0.1A

+

Version 0.62

- +

- Aidez-nous à traduire cette application dans votre langue ici. +

-
- - -

Number in second, you want to check new content on server.

-

Sub Account

@@ -61,7 +52,7 @@

Streaming

- @@ -79,7 +70,7 @@ quality is set too high, videos will start slowly and pause frequently.

- @@ -89,8 +80,15 @@

Bonus

- - + + + +
+
+ +