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

这个提交包含在:
Andreas 2021-08-09 15:10:37 +02:00
父节点 d24eeafcdf
当前提交 ffbc7c4b6d
共有 2 个文件被更改,包括 20 次插入13 次删除

查看文件

@ -14,8 +14,8 @@ class Options extends CI_Controller {
$this->load->model('user_model'); $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'); } 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 // Default /options view just gives some text to explain the options area
function index() { function index() {
@ -23,14 +23,14 @@ class Options extends CI_Controller {
//echo $this->config->item('option_theme'); //echo $this->config->item('option_theme');
//echo $this->optionslib->get_option('theme'); //echo $this->optionslib->get_option('theme');
$data['page_title'] = "Cloudlog Options"; $data['page_title'] = "Cloudlog Options";
$this->load->view('interface_assets/header', $data); $this->load->view('interface_assets/header', $data);
$this->load->view('options/index'); $this->load->view('options/index');
$this->load->view('interface_assets/footer'); $this->load->view('interface_assets/footer');
} }
// function used to display the /appearance url // function used to display the /appearance url
function appearance() { function appearance() {
@ -41,6 +41,10 @@ class Options extends CI_Controller {
$data['page_title'] = "Cloudlog Options"; $data['page_title'] = "Cloudlog Options";
$data['sub_heading'] = "Appearance"; $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('interface_assets/header', $data);
$this->load->view('options/appearance'); $this->load->view('options/appearance');
$this->load->view('interface_assets/footer'); $this->load->view('interface_assets/footer');
@ -101,10 +105,10 @@ class Options extends CI_Controller {
// function used to display the /radio url // function used to display the /radio url
function radio() { function radio() {
$data['page_title'] = "Cloudlog Options"; $data['page_title'] = "Cloudlog Options";
$data['sub_heading'] = "Radio Settings"; $data['sub_heading'] = "Radio Settings";
$this->load->view('interface_assets/header', $data); $this->load->view('interface_assets/header', $data);
$this->load->view('options/radios'); $this->load->view('options/radios');
$this->load->view('interface_assets/footer'); $this->load->view('interface_assets/footer');

查看文件

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