basic oqrs widget

This commit is contained in:
HB9HIL
2024-07-23 13:38:33 +02:00
parent fa216ec7fa
commit a8c6f5c7a6
5 changed files with 171 additions and 5 deletions

View File

@@ -18,7 +18,7 @@ class Widgets extends CI_Controller {
public function qsos($logbook_slug = null) {
if($logbook_slug == null) {
show_error('Unknown Public Page, please make sure the public slug is correct.');
show_error(__("Unknown Public Page, please make sure the public slug is correct."));
}
$this->load->model('logbook_model');
@@ -33,11 +33,11 @@ class Widgets extends CI_Controller {
$logbooks_locations_array = $this->logbooks_model->list_logbook_relationships($logbook_id);
if (!$logbooks_locations_array) {
show_404('Empty Logbook');
show_404(__("Empty Logbook"));
}
} else {
log_message('error', $logbook_slug.' has no associated station locations');
show_404('Unknown Public Page.');
show_404(__("Unknown Public Page."));
}
$data['last_five_qsos'] = $this->logbook_model->get_last_qsos(15, $logbooks_locations_array);
@@ -45,4 +45,39 @@ class Widgets extends CI_Controller {
$this->load->view('widgets/qsos', $data);
}
}
public function oqrs($logbook_slug = null) {
if ($logbook_slug == null || !$this->logbooks_model->public_slug_exists($logbook_slug)) {
show_404(__("Unknown Public Page, please make sure the public slug is correct."));
return;
}
$logbook_id = $this->logbooks_model->public_slug_exists_logbook_id($logbook_slug);
if ($logbook_id == false) {
show_404(__("Unknown Public Page, please make sure the public slug is correct."));
return;
}
$this->load->model('user_model');
$this->load->model('stationsetup_model');
$user_callsign = $this->user_model->get_by_id($this->stationsetup_model->public_slug_exists_userid($logbook_slug))->row()->user_callsign;
if ($user_callsign == false) {
log_message('error', 'No user_id or user_callsign for public slug: '. $logbook_slug);
show_404(__("Can't find any users for this public slug."));
return;
}
$this->load->model('oqrs_model');
$stations = $this->oqrs_model->get_oqrs_stations();
if ($stations->result() === NULL) {
show_404(__("No stations found that are using Wavelog OQRS."));
return;
}
$data['slug'] = $logbook_slug;
$data['user_callsign'] = $user_callsign;
$data['groupedSearch'] = $this->optionslib->get_option('groupedSearch');
$this->load->view('oqrs/oqrs_widget', $data);
}
}