Merge pull request #18 from phl0/fixEmptyUserOptions
Handle initial case when user options are empty
这个提交包含在:
当前提交
84929400c5
共有 2 个文件被更改,包括 15 次插入 和 4 次删除
|
|
@ -42,7 +42,9 @@ class Logbookadvanced extends CI_Controller {
|
||||||
$data['hasDatePicker'] = true;
|
$data['hasDatePicker'] = true;
|
||||||
|
|
||||||
$userOptions = $this->user_options_model->get_options('LogbookAdvanced')->result();
|
$userOptions = $this->user_options_model->get_options('LogbookAdvanced')->result();
|
||||||
|
if (isset($userOptions[0])) {
|
||||||
$data['options'] = $userOptions[0]->option_value;
|
$data['options'] = $userOptions[0]->option_value;
|
||||||
|
}
|
||||||
|
|
||||||
$pageData = [];
|
$pageData = [];
|
||||||
$pageData['datePlaceholder'] = 'DD/MM/YYYY';
|
$pageData['datePlaceholder'] = 'DD/MM/YYYY';
|
||||||
|
|
@ -412,7 +414,11 @@ class Logbookadvanced extends CI_Controller {
|
||||||
public function userOptions() {
|
public function userOptions() {
|
||||||
$this->load->model('user_options_model');
|
$this->load->model('user_options_model');
|
||||||
$userOptions = $this->user_options_model->get_options('LogbookAdvanced')->result();
|
$userOptions = $this->user_options_model->get_options('LogbookAdvanced')->result();
|
||||||
|
if (isset($userOptions[0])) {
|
||||||
$data['options'] = $options = json_decode($userOptions[0]->option_value);
|
$data['options'] = $options = json_decode($userOptions[0]->option_value);
|
||||||
|
} else {
|
||||||
|
$data['options'] = null;
|
||||||
|
}
|
||||||
$this->load->view('logbookadvanced/useroptions', $data);
|
$this->load->view('logbookadvanced/useroptions', $data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,12 @@
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
var custom_date_format = "<?php echo $custom_date_format ?>";
|
var custom_date_format = "<?php echo $custom_date_format ?>";
|
||||||
<?php echo "var user_options = $options;"; ?>
|
<?php
|
||||||
|
if (!isset($options)) {
|
||||||
|
$options = "{\"datetime\":{\"show\":\"true\"},\"de\":{\"show\":\"true\"},\"dx\":{\"show\":\"true\"},\"mode\":{\"show\":\"true\"},\"rstr\":{\"show\":\"true\"},\"rsts\":{\"show\":\"true\"},\"band\":{\"show\":\"true\"},\"myrefs\":{\"show\":\"true\"},\"refs\":{\"show\":\"true\"},\"name\":{\"show\":\"true\"},\"qslvia\":{\"show\":\"true\"},\"qsl\":{\"show\":\"true\"},\"lotw\":{\"show\":\"true\"},\"eqsl\":{\"show\":\"true\"},\"qslmsg\":{\"show\":\"true\"},\"dxcc\":{\"show\":\"true\"},\"state\":{\"show\":\"true\"},\"cqzone\":{\"show\":\"true\"},\"iota\":{\"show\":\"true\"}}";
|
||||||
|
}
|
||||||
|
echo "var user_options = $options;";
|
||||||
|
?>
|
||||||
</script>
|
</script>
|
||||||
<style>
|
<style>
|
||||||
/*Legend specific*/
|
/*Legend specific*/
|
||||||
|
|
|
||||||
正在加载…
在新工单中引用