From 3d0121df173abd207bc110c8aef9388741417026 Mon Sep 17 00:00:00 2001 From: Andreas Kristiansen <6977712+AndreasK79@users.noreply.github.com> Date: Sun, 14 Apr 2024 14:09:52 +0200 Subject: [PATCH] [Exportmap] Defaults if icons are not set in user_options --- application/controllers/Visitor.php | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/application/controllers/Visitor.php b/application/controllers/Visitor.php index a893cee51..57b6cb35d 100644 --- a/application/controllers/Visitor.php +++ b/application/controllers/Visitor.php @@ -507,12 +507,28 @@ class Visitor extends CI_Controller { $this->load->model('user_options_model'); - $result=$this->user_options_model->get_options('map_custom', null, $userid); - $jsonout=[]; + $result = $this->user_options_model->get_options('map_custom', null, $userid); + $jsonout = []; foreach($result->result() as $options) { if ($options->option_name=='icon') $jsonout[$options->option_key]=json_decode($options->option_value,true); else $jsonout[$options->option_name.'_'.$options->option_key]=$options->option_value; } + + if (count($jsonout) == 0) { + $jsonout['qso'] = array( + "icon" => "fas fa-dot-circle", + "color" => "#ff0000" + ); + $jsonout['qsoconfirm'] = array( + "icon" => "fas fa-dot-circle", + "color" => "#00aa00" + ); + $jsonout['station'] = array( + "icon" => "fas fa-broadcast-tower", + "color" => "#0000ff" + ); + } + $jsonout['gridsquare_layer'] = $this->user_options_model->get_options('ExportMapOptions',array('option_name'=>'gridsquare_layer','option_key'=>$slug), $userid)->row()->option_value ?? true; $jsonout['path_lines'] = $this->user_options_model->get_options('ExportMapOptions',array('option_name'=>'path_lines','option_key'=>$slug), $userid)->row()->option_value ?? true; $jsonout['cqzone_layer'] = $this->user_options_model->get_options('ExportMapOptions',array('option_name'=>'cqzone_layer','option_key'=>$slug), $userid)->row()->option_value ?? true;