Do stuff only if config is set (+re-add line at dashboard)

This commit is contained in:
int2001
2025-04-16 19:10:22 +00:00
parent 32f6ffa23e
commit 8ef85db129
3 changed files with 26 additions and 17 deletions

View File

@@ -172,6 +172,7 @@ class Dashboard extends CI_Controller {
}
$data['total_countries_needed'] = count($dxcc->result()) - $current;
$this->load->view('interface_assets/header', $data);
$this->load->view('dashboard/index');
$this->load->view('interface_assets/footer', $footerData);

View File

@@ -67,11 +67,13 @@
$data['mode_rx'] = NULL;
}
$this->load->library('Mh');
$eventdata=$data;
$h_user=$this->User_model->get_by_id($user_id);
$eventdata['user_name']=$h_user->row()->user_name;
$eventdata['user_id']=$h_user->row()->user_id ?? '';
if (($this->config->item('mqtt_server') ?? '') != '') {
$h_user=$this->User_model->get_by_id($user_id);
$this->load->library('Mh');
$eventdata=$data;
$eventdata['user_name']=$h_user->row()->user_name;
$eventdata['user_id']=$h_user->row()->user_id ?? '';
}
if ($query->num_rows() > 0) {
// Update the record
foreach ($query->result() as $row) {
@@ -79,7 +81,9 @@
$this->db->where('id', $radio_id);
$this->db->where('user_id', $user_id);
$this->db->update('cat', $data);
$this->mh->wl_event('cat/'.$user_id, json_encode(array_merge($data,$eventdata)));
if (($this->ci->config->item('mqtt_server') ?? '') != '') {
$this->mh->wl_event('cat/'.$user_id, json_encode(array_merge($data,$eventdata)));
}
}
} else {
// Add a new record
@@ -87,7 +91,9 @@
$data['user_id'] = $user_id;
$data['operator'] = $operator;
$this->db->insert('cat', $data);
$this->mh->wl_event('cat/'.$user_id, json_encode(array_merge($data,$eventdata)));
if (($this->ci->config->item('mqtt_server') ?? '') != '') {
$this->mh->wl_event('cat/'.$user_id, json_encode(array_merge($data,$eventdata)));
}
}
unset($eventdata);
unset($h_user);

View File

@@ -444,15 +444,17 @@ class Logbook_model extends CI_Model {
}
$this->add_qso($data, $skipexport = false);
$this->load->model('stations');
$this->load->library('Mh');
$h_user=$this->stations->get_user_from_station($station_id);
$event_data=$data;
$event_data['user_name']=$h_user->user_name;
$event_data['user_id']=$h_user->user_id;
$this->mh->wl_event('qso/logged/'.($h_user->user_id ?? ''), json_encode($event_data));
unset($event_data);
unset($h_user);
if (($this->config->item('mqtt_server') ?? '') != '') {
$this->load->model('stations');
$this->load->library('Mh');
$h_user=$this->stations->get_user_from_station($station_id);
$event_data=$data;
$event_data['user_name']=$h_user->user_name;
$event_data['user_id']=$h_user->user_id;
$this->mh->wl_event('qso/logged/'.($h_user->user_id ?? ''), json_encode($event_data));
unset($event_data);
unset($h_user);
}
unset($data);
}
@@ -4603,7 +4605,7 @@ class Logbook_model extends CI_Model {
}
}
if ($apicall) {
if ($apicall && (($this->config->item('mqtt_server') ?? '') != '')) {
$this->load->model('stations');
$this->load->library('Mh');
$h_user=$this->stations->get_user_from_station($station_id);