Merge pull request #2771 from phl0/Subdivisions

Naming of subdivisions
这个提交包含在:
Andreas Kristiansen 2023-12-13 08:16:02 +01:00 提交者 GitHub
当前提交 fa49d31b79
找不到此签名对应的密钥
GPG 密钥 ID: 4AEE18F83AFDEB23
共有 3 个文件被更改,包括 104 次插入5 次删除

查看文件

@ -702,6 +702,7 @@ class Logbook extends CI_Controller {
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);
@ -715,6 +716,8 @@ 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');

查看文件

@ -0,0 +1,96 @@
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
/*
Lookup functions for subdivisions
*/
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':
case '32':
case '100':
case '137':
case '163':
case '206':
case '209':
case '212':
case '225':
case '248':
case '263':
case '269':
case '281':
case '284':
case '318':
case '375':
case '386':
return 'Province';
case '27':
case '15':
case '54':
case '61':
case '126':
case '151':
case '288':
return 'Oblast';
case '112':
return 'Region';
case '132':
case '144':
case '227':
return 'Department';
case '170':
return 'Region';
case '224':
return 'Municipality';
case '230':
return 'Federal State';
case '239':
case '245':
case '275':
case '497':
return 'County';
case '272':
case '503':
case '504':
return 'District';
case '287':
return 'Canton';
case '291':
return 'US State';
case '318':
case '339':
return 'Prefecture';
}
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';
}
}

查看文件

@ -161,16 +161,16 @@
<?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 } ?>
<?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) { ?>