2023-08-01 11:25:36 +00:00
|
|
|
<?php
|
|
|
|
use Cloudlog\Dxcc\Dxcc;
|
|
|
|
|
|
|
|
if ( ! defined('BASEPATH')) exit('No direct script access allowed');
|
2023-02-01 12:57:50 +00:00
|
|
|
|
|
|
|
class Calltester extends CI_Controller {
|
2023-08-01 11:25:36 +00:00
|
|
|
function __construct() {
|
|
|
|
parent::__construct();
|
|
|
|
|
|
|
|
$this->load->model('user_model');
|
|
|
|
if(!$this->user_model->authorize(99)) { $this->session->set_flashdata('notice', 'You\'re not allowed to do that!'); redirect('dashboard'); }
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2023-02-01 12:57:50 +00:00
|
|
|
public function db() {
|
|
|
|
set_time_limit(3600);
|
|
|
|
|
|
|
|
// Starting clock time in seconds
|
|
|
|
$start_time = microtime(true);
|
2023-08-01 11:25:36 +00:00
|
|
|
|
2023-02-01 12:57:50 +00:00
|
|
|
$this->load->model('logbook_model');
|
|
|
|
|
|
|
|
$sql = 'select distinct col_country, col_call, col_dxcc, date(col_time_on) date from ' . $this->config->item('table_name');
|
|
|
|
$query = $this->db->query($sql);
|
|
|
|
|
|
|
|
$callarray = $query->result();
|
|
|
|
|
|
|
|
$result = array();
|
2023-08-01 11:25:36 +00:00
|
|
|
|
2023-02-01 12:57:50 +00:00
|
|
|
$i = 0;
|
|
|
|
|
|
|
|
foreach ($callarray as $call) {
|
|
|
|
$i++;
|
|
|
|
$dxcc = $this->logbook_model->dxcc_lookup($call->col_call, $call->date);
|
|
|
|
|
|
|
|
$dxcc['adif'] = (isset($dxcc['adif'])) ? $dxcc['adif'] : 0;
|
|
|
|
$dxcc['entity'] = (isset($dxcc['entity'])) ? $dxcc['entity'] : 0;
|
2023-08-01 11:25:36 +00:00
|
|
|
|
2023-02-01 12:57:50 +00:00
|
|
|
if ($call->col_dxcc != $dxcc['adif']) {
|
|
|
|
$result[] = array(
|
2023-08-01 11:25:36 +00:00
|
|
|
'Callsign' => $call->col_call,
|
|
|
|
'Expected country' => $call->col_country,
|
|
|
|
'Expected adif' => $call->col_dxcc,
|
2023-02-01 12:57:50 +00:00
|
|
|
'Result country' => ucwords(strtolower($dxcc['entity']), "- (/"),
|
|
|
|
'Result adif' => $dxcc['adif'],
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
2023-08-01 11:25:36 +00:00
|
|
|
|
2023-02-01 12:57:50 +00:00
|
|
|
// End clock time in seconds
|
|
|
|
$end_time = microtime(true);
|
|
|
|
|
|
|
|
// Calculate script execution time
|
|
|
|
$execution_time = ($end_time - $start_time);
|
2023-08-01 11:25:36 +00:00
|
|
|
|
2023-02-01 12:57:50 +00:00
|
|
|
echo " Execution time of script = ".$execution_time." sec <br/>";
|
|
|
|
echo $i . " calls tested. <br/>";
|
|
|
|
$count = 0;
|
|
|
|
|
|
|
|
if ($result) {
|
|
|
|
$this->array_to_table($result);
|
|
|
|
}
|
2023-08-01 11:25:36 +00:00
|
|
|
|
2023-02-01 12:57:50 +00:00
|
|
|
}
|
|
|
|
|
2023-08-01 11:25:36 +00:00
|
|
|
|
|
|
|
function array_to_table($table) {
|
2023-02-01 12:57:50 +00:00
|
|
|
echo '<style>
|
|
|
|
table {
|
|
|
|
font-family: Arial, Helvetica, sans-serif;
|
|
|
|
border-collapse: collapse;
|
|
|
|
width: 100%;
|
|
|
|
}
|
|
|
|
|
|
|
|
table td, table th {
|
|
|
|
border: 1px solid #ddd;
|
|
|
|
padding: 4px;
|
|
|
|
}
|
|
|
|
|
|
|
|
table tr:nth-child(even){background-color: #f2f2f2;}
|
|
|
|
|
|
|
|
table tr:hover {background-color: #ddd;}
|
|
|
|
|
|
|
|
table th {
|
|
|
|
padding-top: 4px;
|
|
|
|
padding-bottom: 4px;
|
|
|
|
text-align: left;
|
|
|
|
background-color: #04AA6D;
|
|
|
|
color: white;
|
|
|
|
}
|
|
|
|
</style> ';
|
|
|
|
|
|
|
|
echo '<table>';
|
2023-08-01 11:25:36 +00:00
|
|
|
|
2023-02-01 12:57:50 +00:00
|
|
|
// Table header
|
|
|
|
foreach ($table[0] as $key=>$value) {
|
|
|
|
echo "<th>".$key."</th>";
|
|
|
|
}
|
2023-08-01 11:25:36 +00:00
|
|
|
|
2023-02-01 12:57:50 +00:00
|
|
|
// Table body
|
|
|
|
foreach ($table as $value) {
|
|
|
|
echo "<tr>";
|
|
|
|
foreach ($value as $val) {
|
|
|
|
echo "<td>".$val."</td>";
|
2023-08-01 11:25:36 +00:00
|
|
|
}
|
2023-02-01 12:57:50 +00:00
|
|
|
echo "</tr>";
|
2023-08-01 11:25:36 +00:00
|
|
|
}
|
2023-02-01 12:57:50 +00:00
|
|
|
echo "</table>";
|
|
|
|
}
|
|
|
|
|
|
|
|
function csv() {
|
|
|
|
set_time_limit(3600);
|
|
|
|
|
|
|
|
// Starting clock time in seconds
|
|
|
|
$start_time = microtime(true);
|
2023-08-01 11:25:36 +00:00
|
|
|
|
2023-02-01 12:57:50 +00:00
|
|
|
$this->load->model('logbook_model');
|
|
|
|
|
|
|
|
$file = 'uploads/calls.csv';
|
|
|
|
$handle = fopen($file,"r");
|
2023-08-01 11:25:36 +00:00
|
|
|
|
2023-02-01 12:57:50 +00:00
|
|
|
$data = fgetcsv($handle,1000,","); // Skips firsts line, usually that is the header
|
|
|
|
$data = fgetcsv($handle,1000,",");
|
2023-08-01 11:25:36 +00:00
|
|
|
|
2023-02-01 12:57:50 +00:00
|
|
|
$result = array();
|
2023-08-01 11:25:36 +00:00
|
|
|
|
2023-02-01 12:57:50 +00:00
|
|
|
$i = 0;
|
|
|
|
|
|
|
|
do {
|
|
|
|
if ($data[0]) {
|
|
|
|
// COL_CALL,COL_DXCC,COL_TIME_ON
|
|
|
|
$i++;
|
|
|
|
|
|
|
|
$dxcc = $this->logbook_model->dxcc_lookup($data[0], $data[2]);
|
|
|
|
|
|
|
|
$dxcc['adif'] = (isset($dxcc['adif'])) ? $dxcc['adif'] : 0;
|
|
|
|
$dxcc['entity'] = (isset($dxcc['entity'])) ? $dxcc['entity'] : 0;
|
|
|
|
|
|
|
|
$data[1] = $data[1] == "NULL" ? 0 : $data[1];
|
2023-08-01 11:25:36 +00:00
|
|
|
|
2023-02-01 12:57:50 +00:00
|
|
|
if ($data[1] != $dxcc['adif']) {
|
|
|
|
$result[] = array(
|
2023-08-01 11:25:36 +00:00
|
|
|
'Callsign' => $data[0],
|
|
|
|
'Expected country' => '',
|
|
|
|
'Expected adif' => $data[1],
|
2023-02-01 12:57:50 +00:00
|
|
|
'Result country' => ucwords(strtolower($dxcc['entity']), "- (/"),
|
|
|
|
'Result adif' => $dxcc['adif'],
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} while ($data = fgetcsv($handle,1000,","));
|
|
|
|
|
|
|
|
// End clock time in seconds
|
|
|
|
$end_time = microtime(true);
|
|
|
|
|
|
|
|
// Calculate script execution time
|
|
|
|
$execution_time = ($end_time - $start_time);
|
2023-08-01 11:25:36 +00:00
|
|
|
|
2023-02-01 12:57:50 +00:00
|
|
|
echo " Execution time of script = ".$execution_time." sec <br/>";
|
|
|
|
echo $i . " calls tested. <br/>";
|
|
|
|
$count = 0;
|
|
|
|
|
|
|
|
if ($result) {
|
|
|
|
$this->array_to_table($result);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Uses check_dxcc_table - written to check if that function works
|
|
|
|
*/
|
|
|
|
function csv2() {
|
|
|
|
set_time_limit(3600);
|
|
|
|
|
|
|
|
// Starting clock time in seconds
|
|
|
|
$start_time = microtime(true);
|
2023-08-01 11:25:36 +00:00
|
|
|
|
2023-02-01 12:57:50 +00:00
|
|
|
$this->load->model('logbook_model');
|
|
|
|
|
|
|
|
$file = 'uploads/calls.csv';
|
|
|
|
$handle = fopen($file,"r");
|
2023-08-01 11:25:36 +00:00
|
|
|
|
2023-02-01 12:57:50 +00:00
|
|
|
$data = fgetcsv($handle,1000,","); // Skips firsts line, usually that is the header
|
|
|
|
$data = fgetcsv($handle,1000,",");
|
2023-08-01 11:25:36 +00:00
|
|
|
|
2023-02-01 12:57:50 +00:00
|
|
|
$result = array();
|
2023-08-01 11:25:36 +00:00
|
|
|
|
2023-02-01 12:57:50 +00:00
|
|
|
$i = 0;
|
|
|
|
|
|
|
|
do {
|
|
|
|
if ($data[0]) {
|
|
|
|
// COL_CALL,COL_DXCC,COL_TIME_ON
|
|
|
|
$i++;
|
|
|
|
|
|
|
|
$dxcc = $this->logbook_model->check_dxcc_table($data[0], $data[2]);
|
|
|
|
|
|
|
|
$data[1] = $data[1] == "NULL" ? 0 : $data[1];
|
2023-08-01 11:25:36 +00:00
|
|
|
|
2023-02-01 12:57:50 +00:00
|
|
|
if ($data[1] != $dxcc[0]) {
|
|
|
|
$result[] = array(
|
2023-08-01 11:25:36 +00:00
|
|
|
'Callsign' => $data[0],
|
|
|
|
'Expected country' => '',
|
|
|
|
'Expected adif' => $data[1],
|
2023-02-01 12:57:50 +00:00
|
|
|
'Result country' => ucwords(strtolower($dxcc[1]), "- (/"),
|
|
|
|
'Result adif' => $dxcc[0],
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} while ($data = fgetcsv($handle,1000,","));
|
|
|
|
|
|
|
|
// End clock time in seconds
|
|
|
|
$end_time = microtime(true);
|
|
|
|
|
|
|
|
// Calculate script execution time
|
|
|
|
$execution_time = ($end_time - $start_time);
|
2023-08-01 11:25:36 +00:00
|
|
|
|
2023-02-01 12:57:50 +00:00
|
|
|
echo " Execution time of script = ".$execution_time." sec <br/>";
|
|
|
|
echo $i . " calls tested. <br/>";
|
|
|
|
$count = 0;
|
|
|
|
|
|
|
|
if ($result) {
|
|
|
|
$this->array_to_table($result);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
function call() {
|
|
|
|
$testarray = array();
|
|
|
|
|
|
|
|
$testarray[] = array(
|
|
|
|
'Callsign' => 'VE3EY/VP9',
|
2023-08-01 11:25:36 +00:00
|
|
|
'Country' => 'Bermuda',
|
|
|
|
'Adif' => 64,
|
2023-02-01 12:57:50 +00:00
|
|
|
'Date' => $date = date('Ymd', time())
|
|
|
|
);
|
|
|
|
|
|
|
|
$testarray[] = array(
|
|
|
|
'Callsign' => 'VP2MDG',
|
2023-08-01 11:25:36 +00:00
|
|
|
'Country' => 'Montserrat',
|
|
|
|
'Adif' => 96,
|
2023-02-01 12:57:50 +00:00
|
|
|
'Date' => $date = date('Ymd', time())
|
|
|
|
);
|
|
|
|
|
|
|
|
$testarray[] = array(
|
|
|
|
'Callsign' => 'VP2EY',
|
2023-08-01 11:25:36 +00:00
|
|
|
'Country' => 'Anguilla',
|
|
|
|
'Adif' => 12,
|
2023-02-01 12:57:50 +00:00
|
|
|
'Date' => $date = date('Ymd', time())
|
|
|
|
);
|
|
|
|
|
|
|
|
$testarray[] = array(
|
|
|
|
'Callsign' => 'VP2VI',
|
2023-08-01 11:25:36 +00:00
|
|
|
'Country' => 'British Virgin Islands.',
|
|
|
|
'Adif' => 65,
|
2023-02-01 12:57:50 +00:00
|
|
|
'Date' => $date = date('Ymd', time())
|
|
|
|
);
|
|
|
|
|
|
|
|
$testarray[] = array(
|
|
|
|
'Callsign' => 'VP2V/AA7V',
|
2023-08-01 11:25:36 +00:00
|
|
|
'Country' => 'British Virgin Islands',
|
|
|
|
'Adif' => 65,
|
2023-02-01 12:57:50 +00:00
|
|
|
'Date' => $date = date('Ymd', time())
|
|
|
|
);
|
|
|
|
|
|
|
|
$testarray[] = array(
|
|
|
|
'Callsign' => 'W8LR/R',
|
2023-08-01 11:25:36 +00:00
|
|
|
'Country' => 'United States Of America',
|
|
|
|
'Adif' => 291,
|
2023-02-01 12:57:50 +00:00
|
|
|
'Date' => $date = date('Ymd', time())
|
|
|
|
);
|
|
|
|
|
|
|
|
$testarray[] = array(
|
|
|
|
'Callsign' => 'SO1FH',
|
2023-08-01 11:25:36 +00:00
|
|
|
'Country' => 'Poland',
|
|
|
|
'Adif' => 269,
|
2023-02-01 12:57:50 +00:00
|
|
|
'Date' => $date = date('Ymd', time())
|
|
|
|
);
|
|
|
|
|
|
|
|
$testarray[] = array(
|
|
|
|
'Callsign' => 'KZ1H/PP',
|
2023-08-01 11:25:36 +00:00
|
|
|
'Country' => 'Brazil',
|
|
|
|
'Adif' => 108,
|
2023-02-01 12:57:50 +00:00
|
|
|
'Date' => $date = date('Ymd', time())
|
|
|
|
);
|
|
|
|
|
|
|
|
$testarray[] = array(
|
|
|
|
'Callsign' => 'K1KW/AM',
|
2023-08-01 11:25:36 +00:00
|
|
|
'Country' => 'None',
|
|
|
|
'Adif' => 0,
|
2023-02-01 12:57:50 +00:00
|
|
|
'Date' => $date = date('Ymd', time())
|
|
|
|
);
|
|
|
|
|
|
|
|
$testarray[] = array(
|
|
|
|
'Callsign' => 'K1KW/MM',
|
2023-08-01 11:25:36 +00:00
|
|
|
'Country' => 'None',
|
|
|
|
'Adif' => 0,
|
2023-02-01 12:57:50 +00:00
|
|
|
'Date' => $date = date('Ymd', time())
|
|
|
|
);
|
|
|
|
|
|
|
|
$testarray[] = array(
|
|
|
|
'Callsign' => 'TF/DL2NWK/P',
|
2023-08-01 11:25:36 +00:00
|
|
|
'Country' => 'Iceland',
|
|
|
|
'Adif' => 242,
|
2023-02-01 12:57:50 +00:00
|
|
|
'Date' => $date = date('Ymd', time())
|
|
|
|
);
|
|
|
|
|
|
|
|
$testarray[] = array(
|
|
|
|
'Callsign' => 'OZ1ALS/A',
|
2023-08-01 11:25:36 +00:00
|
|
|
'Country' => 'Denmark',
|
|
|
|
'Adif' => 221,
|
2023-02-01 12:57:50 +00:00
|
|
|
'Date' => $date = date('Ymd', time())
|
|
|
|
);
|
|
|
|
|
|
|
|
$testarray[] = array(
|
|
|
|
'Callsign' => 'LA1K',
|
2023-08-01 11:25:36 +00:00
|
|
|
'Country' => 'Norway',
|
|
|
|
'Adif' => 266,
|
2023-02-01 12:57:50 +00:00
|
|
|
'Date' => $date = date('Ymd', time())
|
|
|
|
);
|
|
|
|
|
|
|
|
$testarray[] = array(
|
|
|
|
'Callsign' => 'K1KW/M',
|
2023-08-01 11:25:36 +00:00
|
|
|
'Country' => 'United States Of America',
|
|
|
|
'Adif' => 291,
|
2023-02-01 12:57:50 +00:00
|
|
|
'Date' => $date = date('Ymd', time())
|
|
|
|
);
|
|
|
|
|
|
|
|
$testarray[] = array(
|
|
|
|
'Callsign' => 'TF/DL2NWK/M',
|
2023-08-01 11:25:36 +00:00
|
|
|
'Country' => 'Iceland',
|
|
|
|
'Adif' => 242,
|
2023-02-01 12:57:50 +00:00
|
|
|
'Date' => $date = date('Ymd', time())
|
|
|
|
);
|
|
|
|
|
|
|
|
$testarray[] = array(
|
|
|
|
'Callsign' => 'TF/DL2NWK/MM',
|
2023-08-01 11:25:36 +00:00
|
|
|
'Country' => 'None',
|
|
|
|
'Adif' => 0,
|
2023-02-01 12:57:50 +00:00
|
|
|
'Date' => $date = date('Ymd', time())
|
|
|
|
);
|
|
|
|
|
|
|
|
$testarray[] = array(
|
|
|
|
'Callsign' => 'TF/DL2NWK/P',
|
2023-08-01 11:25:36 +00:00
|
|
|
'Country' => 'Iceland',
|
|
|
|
'Adif' => 242,
|
2023-02-01 12:57:50 +00:00
|
|
|
'Date' => $date = date('Ymd', time())
|
|
|
|
);
|
|
|
|
|
|
|
|
$testarray[] = array(
|
|
|
|
'Callsign' => '2M0SQL/P',
|
2023-08-01 11:25:36 +00:00
|
|
|
'Country' => 'Scotland',
|
|
|
|
'Adif' => 279,
|
2023-02-01 12:57:50 +00:00
|
|
|
'Date' => $date = date('Ymd', time())
|
|
|
|
);
|
|
|
|
|
|
|
|
$testarray[] = array(
|
|
|
|
'Callsign' => 'FT8WW',
|
2023-08-01 11:25:36 +00:00
|
|
|
'Country' => 'Crozet Island',
|
|
|
|
'Adif' => 41,
|
|
|
|
'Date' => 20230314
|
2023-02-01 12:57:50 +00:00
|
|
|
);
|
|
|
|
|
|
|
|
$testarray[] = array(
|
|
|
|
'Callsign' => 'RV0AL/0/P',
|
2023-08-01 11:25:36 +00:00
|
|
|
'Country' => 'Asiatic Russia',
|
|
|
|
'Adif' => 15,
|
2023-02-01 12:57:50 +00:00
|
|
|
'Date' => $date = date('Ymd', time())
|
|
|
|
);
|
|
|
|
|
|
|
|
$testarray[] = array(
|
|
|
|
'Callsign' => 'OH/DJ1YFK',
|
2023-08-01 11:25:36 +00:00
|
|
|
'Country' => 'Finland',
|
|
|
|
'Adif' => 224,
|
2023-02-01 12:57:50 +00:00
|
|
|
'Date' => $date = date('Ymd', time())
|
|
|
|
);
|
|
|
|
|
|
|
|
$testarray[] = array(
|
|
|
|
'Callsign' => 'N6TR/7',
|
2023-08-01 11:25:36 +00:00
|
|
|
'Country' => 'United States Of America',
|
|
|
|
'Adif' => 291,
|
2023-02-01 12:57:50 +00:00
|
|
|
'Date' => $date = date('Ymd', time())
|
|
|
|
);
|
|
|
|
|
|
|
|
$testarray[] = array(
|
|
|
|
'Callsign' => 'KH0CW',
|
2023-08-01 11:25:36 +00:00
|
|
|
'Country' => 'United States Of America',
|
|
|
|
'Adif' => 291,
|
2023-02-01 12:57:50 +00:00
|
|
|
'Date' => $date = date('Ymd', time())
|
|
|
|
);
|
|
|
|
|
|
|
|
$testarray[] = array(
|
|
|
|
'Callsign' => 'R2FM/P',
|
2023-08-01 11:25:36 +00:00
|
|
|
'Country' => 'kaliningrad',
|
|
|
|
'Adif' => 126,
|
2023-02-01 12:57:50 +00:00
|
|
|
'Date' => $date = date('Ymd', time())
|
|
|
|
);
|
|
|
|
|
|
|
|
$testarray[] = array(
|
|
|
|
'Callsign' => 'R2FM',
|
2023-08-01 11:25:36 +00:00
|
|
|
'Country' => 'kaliningrad',
|
|
|
|
'Adif' => 126,
|
2023-02-01 12:57:50 +00:00
|
|
|
'Date' => $date = date('Ymd', time())
|
|
|
|
);
|
|
|
|
|
|
|
|
$testarray[] = array(
|
|
|
|
'Callsign' => 'FT5XO',
|
2023-08-01 11:25:36 +00:00
|
|
|
'Country' => 'Kerguelen Island',
|
|
|
|
'Adif' => 131,
|
2023-02-01 12:57:50 +00:00
|
|
|
'Date' => 20050320
|
|
|
|
);
|
|
|
|
|
|
|
|
$testarray[] = array(
|
|
|
|
'Callsign' => 'VP8CTR',
|
2023-08-01 11:25:36 +00:00
|
|
|
'Country' => 'Antarctica',
|
|
|
|
'Adif' => 13,
|
2023-02-01 12:57:50 +00:00
|
|
|
'Date' => 19970207
|
|
|
|
);
|
|
|
|
|
|
|
|
$testarray[] = array(
|
|
|
|
'Callsign' => 'FO0AAA',
|
2023-08-01 11:25:36 +00:00
|
|
|
'Country' => 'Clipperton',
|
|
|
|
'Adif' => 36,
|
2023-02-01 12:57:50 +00:00
|
|
|
'Date' => '20000302'
|
|
|
|
);
|
2023-08-01 11:25:36 +00:00
|
|
|
|
2023-02-01 12:57:50 +00:00
|
|
|
$testarray[] = array(
|
|
|
|
'Callsign' => 'CX/PR8KW',
|
2023-08-01 11:25:36 +00:00
|
|
|
'Country' => 'Uruguay',
|
|
|
|
'Adif' => 144,
|
2023-02-01 12:57:50 +00:00
|
|
|
'Date' => $date = date('Ymd', time())
|
|
|
|
);
|
|
|
|
|
|
|
|
$testarray[] = array(
|
|
|
|
'Callsign' => 'IQ3MV/LH',
|
2023-08-01 11:25:36 +00:00
|
|
|
'Country' => 'Italy',
|
|
|
|
'Adif' => 248,
|
2023-02-01 12:57:50 +00:00
|
|
|
'Date' => $date = date('Ymd', time())
|
|
|
|
);
|
|
|
|
|
|
|
|
$testarray[] = array(
|
|
|
|
'Callsign' => 'LA1K/QRP',
|
2023-08-01 11:25:36 +00:00
|
|
|
'Country' => 'Norway',
|
|
|
|
'Adif' => 266,
|
2023-02-01 12:57:50 +00:00
|
|
|
'Date' => $date = date('Ymd', time())
|
|
|
|
);
|
|
|
|
|
|
|
|
$testarray[] = array(
|
|
|
|
'Callsign' => 'LA1K/LGT',
|
2023-08-01 11:25:36 +00:00
|
|
|
'Country' => 'Norway',
|
|
|
|
'Adif' => 266,
|
2023-02-01 12:57:50 +00:00
|
|
|
'Date' => $date = date('Ymd', time())
|
|
|
|
);
|
|
|
|
|
|
|
|
$testarray[] = array(
|
|
|
|
'Callsign' => 'SM1K/LH',
|
2023-08-01 11:25:36 +00:00
|
|
|
'Country' => 'Sweden',
|
|
|
|
'Adif' => 284,
|
|
|
|
'Date' => $date = date('Ymd', time())
|
|
|
|
);
|
|
|
|
|
|
|
|
$testarray[] = array(
|
|
|
|
'Callsign' => 'KG4W',
|
|
|
|
'Country' => 'United States Of America',
|
|
|
|
'Adif' => 291,
|
|
|
|
'Date' => $date = date('Ymd', time())
|
|
|
|
);
|
|
|
|
|
|
|
|
$testarray[] = array(
|
|
|
|
'Callsign' => 'KG4WW',
|
|
|
|
'Country' => 'Guantanamo Bay',
|
|
|
|
'Adif' => 105,
|
|
|
|
'Date' => $date = date('Ymd', time())
|
|
|
|
);
|
|
|
|
|
|
|
|
$testarray[] = array(
|
|
|
|
'Callsign' => 'KG4WWW',
|
|
|
|
'Country' => 'United States Of America',
|
|
|
|
'Adif' => 291,
|
2023-02-01 12:57:50 +00:00
|
|
|
'Date' => $date = date('Ymd', time())
|
|
|
|
);
|
|
|
|
|
|
|
|
set_time_limit(3600);
|
|
|
|
|
|
|
|
// Starting clock time in seconds
|
|
|
|
$start_time = microtime(true);
|
2023-08-01 11:25:36 +00:00
|
|
|
|
2023-02-01 12:57:50 +00:00
|
|
|
$this->load->model('logbook_model');
|
|
|
|
|
|
|
|
$result = array();
|
2023-08-01 11:25:36 +00:00
|
|
|
|
2023-02-01 12:57:50 +00:00
|
|
|
$i = 0;
|
|
|
|
|
|
|
|
foreach ($testarray as $call) {
|
|
|
|
$i++;
|
|
|
|
$dxcc = $this->logbook_model->dxcc_lookup($call['Callsign'], $call['Date']);
|
|
|
|
|
|
|
|
$dxcc['adif'] = (isset($dxcc['adif'])) ? $dxcc['adif'] : 0;
|
|
|
|
$dxcc['entity'] = (isset($dxcc['entity'])) ? $dxcc['entity'] : 0;
|
2023-08-01 11:25:36 +00:00
|
|
|
|
2023-02-01 12:57:50 +00:00
|
|
|
if ($call['Adif'] != $dxcc['adif']) {
|
|
|
|
$result[] = array(
|
2023-08-01 11:25:36 +00:00
|
|
|
'Callsign' => $call['Callsign'],
|
|
|
|
'Expected country' => $call['Country'],
|
|
|
|
'Expected adif' => $call['Adif'],
|
2023-02-01 12:57:50 +00:00
|
|
|
'Result country' => ucwords(strtolower($dxcc['entity']), "- (/"),
|
|
|
|
'Result adif' => $dxcc['adif'],
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
2023-08-01 11:25:36 +00:00
|
|
|
|
2023-02-01 12:57:50 +00:00
|
|
|
// End clock time in seconds
|
|
|
|
$end_time = microtime(true);
|
|
|
|
|
|
|
|
// Calculate script execution time
|
|
|
|
$execution_time = ($end_time - $start_time);
|
2023-08-01 11:25:36 +00:00
|
|
|
|
2023-02-01 12:57:50 +00:00
|
|
|
echo " Execution time of script = ".$execution_time." sec <br/>";
|
|
|
|
echo $i . " calls tested. <br/>";
|
|
|
|
$count = 0;
|
|
|
|
|
|
|
|
if ($result) {
|
|
|
|
$this->array_to_table($result);
|
|
|
|
}
|
|
|
|
}
|
2023-08-01 11:25:36 +00:00
|
|
|
}
|