mirror of
https://github.com/wavelog/wavelog.git
synced 2026-03-22 10:24:14 +00:00
[Options][Appearance] You can now select the default language.
This commit is contained in:
@@ -33,6 +33,11 @@ class Options extends CI_Controller {
|
||||
|
||||
// function used to display the /appearance url
|
||||
function appearance() {
|
||||
|
||||
// Get Language Options
|
||||
$directory = 'application/language';
|
||||
$data['language_options'] = array_diff(scandir($directory), array('..', '.'));
|
||||
|
||||
$data['page_title'] = "Cloudlog Options";
|
||||
$data['sub_heading'] = "Appearance";
|
||||
|
||||
@@ -43,6 +48,11 @@ class Options extends CI_Controller {
|
||||
|
||||
// Handles saving the appreance options to the options system.
|
||||
function appearance_save() {
|
||||
|
||||
// Get Language Options
|
||||
$directory = 'application/language';
|
||||
$data['language_options'] = array_diff(scandir($directory), array('..', '.'));
|
||||
|
||||
$data['page_title'] = "Cloudlog Options";
|
||||
$data['sub_heading'] = "Appearance";
|
||||
|
||||
@@ -68,6 +78,14 @@ class Options extends CI_Controller {
|
||||
$this->session->set_flashdata('success', 'Theme changed to '.$this->input->post('theme'));
|
||||
}
|
||||
|
||||
// Update Lang choice within the options system
|
||||
$lang_update_status = $this->optionslib->update('language', $this->input->post('language'));
|
||||
|
||||
// If Lang update is complete set a flashsession with a success note
|
||||
if($lang_update_status == TRUE) {
|
||||
$this->session->set_flashdata('success', 'Language changed to '.ucfirst($this->input->post('language')));
|
||||
}
|
||||
|
||||
// Redirect back to /appearance
|
||||
redirect('/options/appearance');
|
||||
}
|
||||
|
||||
@@ -33,6 +33,16 @@
|
||||
<?php } ?>
|
||||
|
||||
<?php echo form_open('options/appearance_save'); ?>
|
||||
<div class="form-group">
|
||||
<label for="themeSelect">Language</label>
|
||||
<select class="custom-select" id="langSelect" name="language" aria-describedby="langHelp" required>
|
||||
<?php foreach ($language_options as &$lang_opt) { ?>
|
||||
<option value='<?php echo $lang_opt; ?>' <?php if($this->optionslib->get_option('language')== $lang_opt) { echo "selected=\"selected\""; } ?>><?php echo ucfirst($lang_opt); ?></option>
|
||||
<?php } ?>
|
||||
</select>
|
||||
<small id="langHelp" class="form-text text-muted">Select the default language for Cloudlog.</small>
|
||||
</div>
|
||||
|
||||
<!-- Form options for selecting global theme choice -->
|
||||
<div class="form-group">
|
||||
<label for="themeSelect">Theme</label>
|
||||
|
||||
Reference in New Issue
Block a user