Fix form visibility and mode handling for visitor gridmap

Co-authored-by: magicbug <84308+magicbug@users.noreply.github.com>
copilot/fix-3325
copilot-swe-agent[bot] 2025-08-19 16:17:02 +00:00
rodzic 251fe3cc35
commit 499e752dbd
2 zmienionych plików z 24 dodań i 5 usunięć

Wyświetl plik

@ -262,13 +262,26 @@ class Visitor extends CI_Controller {
// Get available modes
$modes_query = $this->db->query(
"SELECT distinct col_mode FROM ".$this->config->item('table_name')." WHERE station_id in (" . $location_list . ") and coalesce(col_mode, '') <> '' and col_mode <> 'SSB' ORDER BY col_mode"
"SELECT distinct col_mode FROM ".$this->config->item('table_name')." WHERE station_id in (" . $location_list . ") and coalesce(col_mode, '') <> '' ORDER BY col_mode"
);
$modes = array();
foreach($modes_query->result() as $row){
$modes[] = (object) ['mode' => $row->col_mode, 'submode' => ''];
if (!in_array($row->col_mode, $modes)) {
array_push($modes, $row->col_mode);
}
}
// Get submodes as well
$submodes_query = $this->db->query(
"SELECT distinct col_submode FROM ".$this->config->item('table_name')." WHERE station_id in (" . $location_list . ") and coalesce(col_submode, '') <> '' ORDER BY col_submode"
);
foreach($submodes_query->result() as $row){
if (!in_array($row->col_submode, $modes)) {
array_push($modes, $row->col_submode);
}
}
asort($modes);
$data['bands'] = $bands;
$data['sats_available'] = $sats_available;
$data['modes'] = $modes;

Wyświetl plik

@ -46,7 +46,6 @@
<h2><?php echo $page_title; ?></h2>
<?php if ($visitor == false) { ?>
<form class="d-flex align-items-center">
<label class="my-1 me-2" for="band"><?php echo lang('gridsquares_band'); ?></label>
<select class="form-select my-1 me-sm-2 w-auto" id="band">
@ -75,12 +74,19 @@
<option value="All"><?php echo lang('general_word_all')?></option>
<?php
foreach($modes as $mode){
if ($mode->submode ?? '' == '') {
if (is_object($mode)) {
// Handle object format (from gridmap_model->get_worked_modes())
if ($mode->submode ?? '' == '') {
echo '<option value="' . $mode->mode . '">' . strtoupper($mode->mode) . '</option>'."\n";
}
} else {
// Handle simple string format (from visitor implementation)
echo '<option value="' . $mode . '">' . strtoupper($mode) . '</option>'."\n";
}
}
?>
</select>
<?php if ($visitor == false) { ?>
<label class="my-1 me-2"><?php echo lang('gridsquares_confirmation'); ?></label>
<div>
<div class="form-check-inline">
@ -116,11 +122,11 @@
<label class="form-check-label" for="qrz">QRZ.com</label>
</div>
</div>
<?php } ?>
<button id="plot" type="button" name="plot" class="btn btn-primary me-1 ld-ext-right ld-ext-right-plot" onclick="gridPlot(this.form,<?php echo $visitor == true ? "true" : "false"; ?>)"><?php echo lang('gridsquares_button_plot'); ?><div class="ld ld-ring ld-spin"></div></button>
<button id="clear" type="button" name="clear" class="btn btn-primary me-1 ld-ext-right ld-ext-right-clear" onclick="clearMarkers()"><?php echo lang('gridsquares_button_clear_markers'); ?><div class="ld ld-ring ld-spin"></div></button>
</form>
<?php } ?>
<?php if($this->session->flashdata('message')) { ?>
<!-- Display Message -->