Add functions for secondary subdivisions

This commit is contained in:
phl0 2023-12-12 14:31:39 +01:00
parent 0fe31f2c23
commit 6d647fe736
No known key found for this signature in database
GPG Key ID: 48EA1E640798CA9A
3 changed files with 30 additions and 4 deletions

View File

@ -717,6 +717,7 @@ class Logbook extends CI_Controller {
$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['secondary_subdivision'] = $this->subdivisions->get_secondary_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

@ -8,6 +8,7 @@
class Subdivisions {
public function get_primary_subdivision_name($dxcc) {
// ref. http://adif.org.uk/314/ADIF_314_annotated.htm#Primary_Administrative_Subdivision
switch($dxcc) {
case '1':
case '29':
@ -68,4 +69,28 @@ class Subdivisions {
return 'State';
}
public function get_secondary_subdivision_name($dxcc) {
// ref. http://adif.org.uk/314/ADIF_314_annotated.htm#Secondary_Administrative_Subdivision
switch($dxcc) {
case '6':
case '110':
case '291':
return 'US County';
case '15':
case '54':
case '61':
case '126':
case '151':
case '288':
return 'District';
case '21':
case '29':
case '32':
case '281':
return 'DME';
case '339':
return 'City / Ku / Gun';
}
return 'County';
}
}

View File

@ -167,10 +167,10 @@
<?php } ?>
<?php if($row->COL_CNTY != null && $row->COL_CNTY != ",") { ?>
<tr>
<td>USA County:</td>
<td><?php echo $row->COL_CNTY; ?></td>
</tr>
<tr>
<td><?php echo $secondary_subdivision ?>:</td>
<td><?php echo $row->COL_CNTY; ?></td>
</tr>
<?php } ?>
<?php if($row->COL_NAME != null) { ?>