[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

@ -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');

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>