[Custom CSS Theme Support] Added fetching of theme list in options as well.

This commit is contained in:
Andreas 2021-08-09 15:10:37 +02:00
parent d24eeafcdf
commit ffbc7c4b6d
2 changed files with 20 additions and 13 deletions

View File

@ -14,8 +14,8 @@ class Options extends CI_Controller {
$this->load->model('user_model');
if(!$this->user_model->authorize(99)) { $this->session->set_flashdata('notice', 'You\'re not allowed to do that!'); redirect('dashboard'); }
}
// Default /options view just gives some text to explain the options area
function index() {
@ -23,14 +23,14 @@ class Options extends CI_Controller {
//echo $this->config->item('option_theme');
//echo $this->optionslib->get_option('theme');
$data['page_title'] = "Cloudlog Options";
$this->load->view('interface_assets/header', $data);
$this->load->view('options/index');
$this->load->view('interface_assets/footer');
}
// function used to display the /appearance url
function appearance() {
@ -41,6 +41,10 @@ class Options extends CI_Controller {
$data['page_title'] = "Cloudlog Options";
$data['sub_heading'] = "Appearance";
$this->load->model('Themes_model');
$data['themes'] = $this->Themes_model->getThemes();
$this->load->view('interface_assets/header', $data);
$this->load->view('options/appearance');
$this->load->view('interface_assets/footer');
@ -101,10 +105,10 @@ class Options extends CI_Controller {
// function used to display the /radio url
function radio() {
$data['page_title'] = "Cloudlog Options";
$data['sub_heading'] = "Radio Settings";
$this->load->view('interface_assets/header', $data);
$this->load->view('options/radios');
$this->load->view('interface_assets/footer');

View File

@ -47,12 +47,15 @@
<div class="form-group">
<label for="themeSelect">Theme</label>
<select class="custom-select" id="themeSelect" name="theme" aria-describedby="themeHelp" required>
<option value='default' <?php if($this->optionslib->get_option('theme') == "default") { echo "selected=\"selected\""; } ?>>Default</option>
<option value='blue' <?php if($this->optionslib->get_option('theme')== "blue") { echo "selected=\"selected\""; } ?>>Blue</option>
<option value='cosmo' <?php if($this->optionslib->get_option('theme') == "cosmo") { echo "selected=\"selected\""; } ?>>Cosmo</option>
<option value='cyborg' <?php if($this->optionslib->get_option('theme') == "cyborg") { echo "selected=\"selected\""; } ?>>Cyborg (Dark)</option>
<option value='darkly' <?php if($this->optionslib->get_option('theme') == "darkly") { echo "selected=\"selected\""; } ?>> Darkly (Dark)</option>
<option value='superhero' <?php if($this->optionslib->get_option('theme') == "superhero") { echo "selected=\"selected\""; } ?>>Superhero (Dark)</option>
<?php
foreach ($themes as $theme) {
echo '<option value="' . $theme->foldername . '"';
if ($this->optionslib->get_option('theme') == $theme->foldername) {
echo 'selected="selected"';
}
echo '>' . $theme->name . '</option>';
}
?>
</select>
<small id="themeHelp" class="form-text text-muted">Global Theme Choice, this is used when users arent logged in.</small>
</div>
@ -74,4 +77,4 @@
</div>
</div>
</div>
</div>