From a512a984aaf24e4b576a20966595078e037acdad Mon Sep 17 00:00:00 2001 From: Andreas <6977712+AndreasK79@users.noreply.github.com> Date: Mon, 9 Aug 2021 13:13:41 +0200 Subject: [PATCH] [Custom CSS Theme Support] Added support for fetching list of themes from database. --- application/controllers/User.php | 6 ++++++ application/models/User_model.php | 8 ++++++++ application/views/user/add.php | 15 +++++++++------ application/views/user/edit.php | 15 +++++++++------ 4 files changed, 32 insertions(+), 12 deletions(-) diff --git a/application/controllers/User.php b/application/controllers/User.php index 976ea38e..97059f73 100644 --- a/application/controllers/User.php +++ b/application/controllers/User.php @@ -42,6 +42,9 @@ class User extends CI_Controller { $this->form_validation->set_rules('user_locator', 'Locator', 'required'); $this->form_validation->set_rules('user_timezone', 'Timezone', 'required'); + // Get themes list + $data['themes'] = $this->user_model->getThemes(); + // Get timezones $data['timezones'] = $this->user_model->timezones(); @@ -158,6 +161,9 @@ class User extends CI_Controller { $this->form_validation->set_rules('user_locator', 'Locator', 'required|xss_clean'); $this->form_validation->set_rules('user_timezone', 'Timezone', 'required'); + // Get themes list + $data['themes'] = $this->user_model->getThemes(); + // Get timezones $data['timezones'] = $this->user_model->timezones(); diff --git a/application/models/User_model.php b/application/models/User_model.php index ab368d51..ece9bc8c 100644 --- a/application/models/User_model.php +++ b/application/models/User_model.php @@ -370,6 +370,14 @@ class User_Model extends CI_Model { return $ts; } + // FUNCTION: array getThemes() + // Returns a list of themes + function getThemes() { + $result = $this->db->query('SELECT * FROM themes order by name'); + + return $result->result(); + } + // FUNCTION: bool _auth($password, $hash) // Checks a password against the stored hash private function _auth($password, $hash) { diff --git a/application/views/user/add.php b/application/views/user/add.php index 7157053f..f6b9f09b 100644 --- a/application/views/user/add.php +++ b/application/views/user/add.php @@ -111,12 +111,15 @@
diff --git a/application/views/user/edit.php b/application/views/user/edit.php index 3b879e71..20f7c379 100644 --- a/application/views/user/edit.php +++ b/application/views/user/edit.php @@ -94,12 +94,15 @@