PoC for subdivision naming

This commit is contained in:
phl0
2023-12-04 14:43:07 +01:00
parent 48ddcf0ada
commit 5b577a432a
3 changed files with 25 additions and 1 deletions

View File

@@ -670,6 +670,7 @@ function worked_grid_before($gridsquare, $type, $band, $mode)
if(!$this->user_model->authorize($this->config->item('auth_mode'))) { return; }
$this->load->library('qra');
$this->load->library('subdivisions');
$this->load->model('logbook_model');
$data['query'] = $this->logbook_model->get_qso($id);
@@ -683,6 +684,7 @@ function worked_grid_before($gridsquare, $type, $band, $mode)
$this->load->model('Qsl_model');
$data['qslimages'] = $this->Qsl_model->getQslForQsoId($id);
$data['primary_subdivision'] = $this->subdivisions->get_primary_subdivision_name($data['query']->result()[0]->COL_DXCC);
$data['max_upload'] = ini_get('upload_max_filesize');
$this->load->view('interface_assets/mini_header', $data);
$this->load->view('view_log/qso');

View File

@@ -0,0 +1,22 @@
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
/*
Lookup functions for subdivisions
*/
class Subdivisions {
public function get_primary_subdivision_name($dxcc) {
switch($dxcc) {
case '1':
return 'Province';
case '291':
return 'US State';
case '339':
return 'Prefecture';
}
return 'State';
}
}

View File

@@ -161,7 +161,7 @@
<?php if($row->COL_STATE != null) { ?>
<tr>
<td>USA State:</td>
<td><?php echo $primary_subdivision ?>:</td>
<td><?php echo $row->COL_STATE; ?></td>
</tr>
<?php } ?>