[Location list] A very early draft

This commit is contained in:
Andreas Kristiansen
2025-10-28 08:13:24 +01:00
parent 4e5ab0e629
commit 8565f86cd2
4 changed files with 48 additions and 1 deletions

View File

@@ -519,4 +519,13 @@ class Stationsetup extends CI_Controller {
$this->user_options_model->set_option('ExportMapOptions', 'qsocount', array($slug => xss_clean($this->input->post('qsocount'))));
$this->user_options_model->set_option('ExportMapOptions', 'band', array($slug => xss_clean($this->input->post('band'))));
}
public function list_locations() {
$this->load->model('stationsetup_model');
$data['locations'] = $this->stationsetup_model->list_all_locations()->result();
$data['page_title'] = __("Station location list");
$this->load->view('interface_assets/header');
$this->load->view('stationsetup/locationlist', $data);
$this->load->view('interface_assets/footer');
}
}

View File

@@ -232,6 +232,15 @@ class Stationsetup_model extends CI_Model {
return $this->db->get();
}
function list_all_locations() {
$sql = "select station_profile_name, station_gridsquare, station_city, station_iota, station_sota, station_callsign, station_power, station_dxcc, station_cnty, station_cq, station_itu, station_active, eqslqthnickname, state, county, station_sig, station_sig_info, qrzrealtime, station_wwff, station_pota, oqrs, oqrs_text, oqrs_email, webadifrealtime, clublogrealtime, clublogignore, hrdlogrealtime, creation_date, last_modified
from station_profile
where user_id = ?";
$query = $this->db->query($sql, array($this->session->userdata('user_id')));
return $query;
}
}
?>

View File

@@ -0,0 +1,27 @@
<h1><?= $page_title ?></h1>
<?php if (!empty($locations)): ?>
<table style="width:100%" class="table-sm table table-bordered table-hover table-striped table-condensed text-center">
<thead>
<tr>
<?php
// Dynamically create table headers based on object keys
$first_row = (array)$locations[0];
foreach (array_keys($first_row) as $key): ?>
<th><?= ucfirst(str_replace('_', ' ', $key)) ?></th>
<?php endforeach; ?>
</tr>
</thead>
<tbody>
<?php foreach ($locations as $loc): ?>
<tr>
<?php foreach ((array)$loc as $val): ?>
<td><?php echo $val; ?></td>
<?php endforeach; ?>
</tr>
<?php endforeach; ?>
</tbody>
</table>
<?php else: ?>
<div class="no-data">No locations found.</div>
<?php endif; ?>

View File

@@ -101,7 +101,9 @@
<?= __("The 'Linked' column shows if the station location is linked with the Active Logbook selected above."); ?>
</p>
<p><a href="<?php echo site_url('station/create'); ?>" class="btn btn-sm btn-primary"><i class="fas fa-plus"></i> <?= __("Create a Station Location"); ?></a> <button onclick="filterlocations();" class="btn btn-sm btn-success"><?= __("Show only locations from the active logbook"); ?></button> <button onclick="removefilterlocations();" class="btn btn-sm btn-success"><?= __("Show all locations"); ?></button></p>
<p><a href="<?php echo site_url('station/create'); ?>" class="btn btn-sm btn-primary"><i class="fas fa-plus"></i> <?= __("Create a Station Location"); ?></a> <button onclick="filterlocations();" class="btn btn-sm btn-success"><?= __("Show only locations from the active logbook"); ?></button>
<button onclick="removefilterlocations();" class="btn btn-sm btn-success"><?= __("Show all locations"); ?></button>
<a href="<?php echo site_url('stationsetup/list_locations'); ?>" class="btn btn-sm btn-success"><?= __("Show a location list"); ?></a></p>
<?php if($current_active == 0) { ?>
<div class="alert alert-danger" role="alert">