mirror of
https://github.com/wavelog/wavelog.git
synced 2026-03-22 10:24:14 +00:00
Use html view to load result instead
This commit is contained in:
@@ -899,13 +899,12 @@ class Logbookadvanced extends CI_Controller {
|
||||
$type = $this->input->post('type', true);
|
||||
$this->load->model('logbookadvanced_model');
|
||||
|
||||
$data['result'] = $this->logbookadvanced_model->runCheckDb($type);
|
||||
if ($type == 'checkstate') {
|
||||
$data['result'] = $this->logbookadvanced_model->runCheckDb($type);
|
||||
$this->load->view('logbookadvanced/checkresult', $data);
|
||||
$this->load->view('logbookadvanced/statecheckresult', $data);
|
||||
} else {
|
||||
$result = $this->logbookadvanced_model->runCheckDb($type);
|
||||
header("Content-Type: application/json");
|
||||
echo json_encode($result);
|
||||
$data['type'] = $type;
|
||||
$this->load->view('logbookadvanced/checkresult', $data);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,45 +1,46 @@
|
||||
<?php if (isset($result) && is_array($result) && count($result) > 0): ?>
|
||||
<div class="col-md-12 result">
|
||||
<h5><?= __("State Check Results"); ?></h5>
|
||||
<p><?= __("QSOs with missing state and gridsquares with 6 or more characters found for the following DXCC's:"); ?></p>
|
||||
<?php
|
||||
switch ($type) {
|
||||
case 'checkdistance':
|
||||
check_missing_distance($result);
|
||||
break;
|
||||
case 'checkcontinent':
|
||||
check_qsos_missing_continent($result);
|
||||
break;
|
||||
case 'checkdxcc':
|
||||
check_missing_dxcc($result);
|
||||
break;
|
||||
case 'checkcqzones':
|
||||
check_missing_cq_zones($result);
|
||||
break;
|
||||
case 'checkituzones':
|
||||
check_missing_itu_zones($result);
|
||||
break;
|
||||
default:
|
||||
// Invalid type
|
||||
break;
|
||||
}
|
||||
|
||||
<div class="table-responsive" style="max-height:50vh; overflow:auto;">
|
||||
<table class="table table-sm table-striped table-bordered table-condensed mb-0">
|
||||
<thead>
|
||||
<tr>
|
||||
<th><?= __("Prefix"); ?></th>
|
||||
<th><?= __("DXCC"); ?></th>
|
||||
<th><?= __("QSOs"); ?></th>
|
||||
<th><?= __("Action"); ?></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php foreach ($result as $index => $item): ?>
|
||||
<?php
|
||||
$rawName = isset($item->dxcc_name) ? $item->dxcc_name : '';
|
||||
$formattedName = ucwords(strtolower($rawName), "- (/");
|
||||
$name = htmlspecialchars($formattedName, ENT_QUOTES, 'UTF-8');
|
||||
$qsos = isset($item->count) ? intval($item->count) : 0;
|
||||
?>
|
||||
<tr>
|
||||
<td><?php echo $item->prefix; ?></td>
|
||||
<td><?php echo $name; ?></td>
|
||||
<td><?php echo $qsos; ?></td>
|
||||
<td>
|
||||
<button type="button" class="btn btn-sm btn-primary ld-ext-right" id="fixStateBtn_<?php echo $item->col_dxcc; ?>" onclick="fixState(<?php echo $item->col_dxcc; ?>)">
|
||||
<?= __("Run fix") ?><div class="ld ld-ring ld-spin"></div>
|
||||
</button>
|
||||
<button id="openStateListBtn_<?php echo $item->col_dxcc; ?>" onclick="openStateList(<?php echo $item->col_dxcc; ?>)" class="btn btn-sm btn-success"><i class="fas fa-search"></i></button>
|
||||
</td>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
<?php else: ?>
|
||||
<div class="col-md-12 result">
|
||||
<h5></h5><?= __("State Check Results"); ?></h5>
|
||||
<p><?= __("No QSOs were found where state information can be fixed."); ?></p>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
function check_missing_distance($result) { ?>
|
||||
<h5>Distance Check Results</h5>
|
||||
QSOs to update found: <?php echo $result[0]->count; ?>
|
||||
<?php }
|
||||
|
||||
function check_qsos_missing_continent($result) { ?>
|
||||
<h5>Continent Check Results</h5>
|
||||
QSOs to update found: <?php echo $result[0]->count; ?>
|
||||
<?php }
|
||||
|
||||
function check_missing_dxcc($result) { ?>
|
||||
<h5>DXCC Check Results</h5>
|
||||
QSOs to update found: <?php echo $result[0]->count; ?>
|
||||
<?php }
|
||||
|
||||
function check_missing_cq_zones($result) { ?>
|
||||
<h5>CQ Zone Check Results</h5>
|
||||
QSOs to update found: <?php echo $result[0]->count; ?>
|
||||
<?php }
|
||||
|
||||
function check_missing_itu_zones($result) { ?>
|
||||
<h5>ITU Zone Check Results</h5>
|
||||
QSOs to update found: <?php echo $result[0]->count; ?>
|
||||
<?php }
|
||||
|
||||
45
application/views/logbookadvanced/statecheckresult.php
Normal file
45
application/views/logbookadvanced/statecheckresult.php
Normal file
@@ -0,0 +1,45 @@
|
||||
<?php if (isset($result) && is_array($result) && count($result) > 0): ?>
|
||||
<div class="col-md-12 result">
|
||||
<h5><?= __("State Check Results"); ?></h5>
|
||||
<p><?= __("QSOs with missing state and gridsquares with 6 or more characters found for the following DXCC's:"); ?></p>
|
||||
|
||||
<div class="table-responsive" style="max-height:50vh; overflow:auto;">
|
||||
<table class="table table-sm table-striped table-bordered table-condensed mb-0">
|
||||
<thead>
|
||||
<tr>
|
||||
<th><?= __("Prefix"); ?></th>
|
||||
<th><?= __("DXCC"); ?></th>
|
||||
<th><?= __("QSOs"); ?></th>
|
||||
<th><?= __("Action"); ?></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php foreach ($result as $index => $item): ?>
|
||||
<?php
|
||||
$rawName = isset($item->dxcc_name) ? $item->dxcc_name : '';
|
||||
$formattedName = ucwords(strtolower($rawName), "- (/");
|
||||
$name = htmlspecialchars($formattedName, ENT_QUOTES, 'UTF-8');
|
||||
$qsos = isset($item->count) ? intval($item->count) : 0;
|
||||
?>
|
||||
<tr>
|
||||
<td><?php echo $item->prefix; ?></td>
|
||||
<td><?php echo $name; ?></td>
|
||||
<td><?php echo $qsos; ?></td>
|
||||
<td>
|
||||
<button type="button" class="btn btn-sm btn-primary ld-ext-right" id="fixStateBtn_<?php echo $item->col_dxcc; ?>" onclick="fixState(<?php echo $item->col_dxcc; ?>)">
|
||||
<?= __("Run fix") ?><div class="ld ld-ring ld-spin"></div>
|
||||
</button>
|
||||
<button id="openStateListBtn_<?php echo $item->col_dxcc; ?>" onclick="openStateList(<?php echo $item->col_dxcc; ?>)" class="btn btn-sm btn-success"><i class="fas fa-search"></i></button>
|
||||
</td>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
<?php else: ?>
|
||||
<div class="col-md-12 result">
|
||||
<h5></h5><?= __("State Check Results"); ?></h5>
|
||||
<p><?= __("No QSOs were found where state information can be fixed."); ?></p>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
@@ -2032,7 +2032,6 @@ function saveOptions() {
|
||||
$('#checkUpdateDistancesBtn').prop("disabled", true).addClass("running");
|
||||
$('#closeButton').prop("disabled", true);
|
||||
|
||||
|
||||
$.ajax({
|
||||
url: base_url + 'index.php/logbookadvanced/checkDb',
|
||||
data: {
|
||||
@@ -2042,23 +2041,20 @@ function saveOptions() {
|
||||
success: function(response) {
|
||||
$('#checkUpdateDistancesBtn').prop("disabled", false).removeClass("running");
|
||||
$('#closeButton').prop("disabled", false);
|
||||
// Create a nice display for the results
|
||||
let resultHtml = '<h5>Distance Check Results</h5>';
|
||||
resultHtml += '<p>QSO to update found: ' + (response[0].count) + '</p>';
|
||||
|
||||
$('.result').html(resultHtml);
|
||||
$('.result').html(response);
|
||||
},
|
||||
error: function(xhr, status, error) {
|
||||
$('#checkUpdateDistancesBtn').prop('disabled', false).text('<?= __("Check") ?>');
|
||||
$('#checkUpdateDistancesBtn').prop("disabled", false).removeClass("running");
|
||||
$('#closeButton').prop('disabled', false);
|
||||
|
||||
let errorMsg = '<?= __("Error checking distance information") ?>';
|
||||
let errorMsg = 'Error checking distance information';
|
||||
if (xhr.responseJSON && xhr.responseJSON.message) {
|
||||
errorMsg += ': ' + xhr.responseJSON.message;
|
||||
}
|
||||
|
||||
BootstrapDialog.alert({
|
||||
title: '<?= __("Error") ?>',
|
||||
title: 'Error',
|
||||
message: errorMsg,
|
||||
type: BootstrapDialog.TYPE_DANGER
|
||||
});
|
||||
@@ -2070,7 +2066,6 @@ function saveOptions() {
|
||||
$('#checkMissingDxccsBtn').prop("disabled", true).addClass("running");
|
||||
$('#closeButton').prop("disabled", true);
|
||||
|
||||
|
||||
$.ajax({
|
||||
url: base_url + 'index.php/logbookadvanced/checkDb',
|
||||
data: {
|
||||
@@ -2080,23 +2075,19 @@ function saveOptions() {
|
||||
success: function(response) {
|
||||
$('#checkMissingDxccsBtn').prop("disabled", false).removeClass("running");
|
||||
$('#closeButton').prop("disabled", false);
|
||||
// Create a nice display for the results
|
||||
let resultHtml = '<h5>DXCC Check Results</h5>';
|
||||
resultHtml += '<p>QSOs without DXCC information found: ' + (response[0].count) + '</p>';
|
||||
|
||||
$('.result').html(resultHtml);
|
||||
$('.result').html(response);
|
||||
},
|
||||
error: function(xhr, status, error) {
|
||||
$('#checkMissingDxccsBtn').prop('disabled', false).text('<?= __("Check") ?>');
|
||||
$('#closeButton').prop('disabled', false);
|
||||
|
||||
let errorMsg = '<?= __("Error checking distance information") ?>';
|
||||
let errorMsg = 'Error checking DXCC information';
|
||||
if (xhr.responseJSON && xhr.responseJSON.message) {
|
||||
errorMsg += ': ' + xhr.responseJSON.message;
|
||||
}
|
||||
|
||||
BootstrapDialog.alert({
|
||||
title: '<?= __("Error") ?>',
|
||||
title: 'Error',
|
||||
message: errorMsg,
|
||||
type: BootstrapDialog.TYPE_DANGER
|
||||
});
|
||||
@@ -2117,23 +2108,19 @@ function saveOptions() {
|
||||
success: function(response) {
|
||||
$('#checkFixContinentBtn').prop("disabled", false).removeClass("running");
|
||||
$('#closeButton').prop("disabled", false);
|
||||
// Create a nice display for the results
|
||||
let resultHtml = '<h5>Continent Check Results</h5>';
|
||||
resultHtml += '<p>QSOs with missing or invalid continent information found: ' + (response[0].count) + '</p>';
|
||||
|
||||
$('.result').html(resultHtml);
|
||||
$('.result').html(response);
|
||||
},
|
||||
error: function(xhr, status, error) {
|
||||
$('#checkFixContinentBtn').prop('disabled', false).text('<?= __("Check") ?>');
|
||||
$('#closeButton').prop('disabled', false);
|
||||
|
||||
let errorMsg = '<?= __("Error checking distance information") ?>';
|
||||
let errorMsg = 'Error checking continent information';
|
||||
if (xhr.responseJSON && xhr.responseJSON.message) {
|
||||
errorMsg += ': ' + xhr.responseJSON.message;
|
||||
}
|
||||
|
||||
BootstrapDialog.alert({
|
||||
title: '<?= __("Error") ?>',
|
||||
title: 'Error',
|
||||
message: errorMsg,
|
||||
type: BootstrapDialog.TYPE_DANGER
|
||||
});
|
||||
@@ -2161,13 +2148,13 @@ function saveOptions() {
|
||||
$('#checkFixStateBtn').prop('disabled', false).text('<?= __("Check") ?>');
|
||||
$('#closeButton').prop('disabled', false);
|
||||
|
||||
let errorMsg = '<?= __("Error checking distance information") ?>';
|
||||
let errorMsg = 'Error checking state information';
|
||||
if (xhr.responseJSON && xhr.responseJSON.message) {
|
||||
errorMsg += ': ' + xhr.responseJSON.message;
|
||||
}
|
||||
|
||||
BootstrapDialog.alert({
|
||||
title: '<?= __("Error") ?>',
|
||||
title: 'Error',
|
||||
message: errorMsg,
|
||||
type: BootstrapDialog.TYPE_DANGER
|
||||
});
|
||||
@@ -2188,11 +2175,7 @@ function saveOptions() {
|
||||
success: function(response) {
|
||||
$('#checkFixCqZonesBtn').prop("disabled", false).removeClass("running");
|
||||
$('#closeButton').prop("disabled", false);
|
||||
// Create a nice display for the results
|
||||
let resultHtml = '<h5>CQ Zone Check Results</h5>';
|
||||
resultHtml += '<p>QSOs with missing CQ zone information found: ' + (response[0].count) + '</p>';
|
||||
|
||||
$('.result').html(resultHtml);
|
||||
$('.result').html(response);
|
||||
},
|
||||
error: function(xhr, status, error) {
|
||||
$('#checkFixCqZonesBtn').prop('disabled', false).text('<?= __("Check") ?>');
|
||||
@@ -2204,7 +2187,7 @@ function saveOptions() {
|
||||
}
|
||||
|
||||
BootstrapDialog.alert({
|
||||
title: '<?= __("Error") ?>',
|
||||
title: 'Error',
|
||||
message: errorMsg,
|
||||
type: BootstrapDialog.TYPE_DANGER
|
||||
});
|
||||
@@ -2225,11 +2208,7 @@ function saveOptions() {
|
||||
success: function(response) {
|
||||
$('#checkFixItuZonesBtn').prop("disabled", false).removeClass("running");
|
||||
$('#closeButton').prop("disabled", false);
|
||||
// Create a nice display for the results
|
||||
let resultHtml = '<h5>ITU Zone Check Results</h5>';
|
||||
resultHtml += '<p>QSOs with missing ITU zone information found: ' + (response[0].count) + '</p>';
|
||||
|
||||
$('.result').html(resultHtml);
|
||||
$('.result').html(response);
|
||||
},
|
||||
error: function(xhr, status, error) {
|
||||
$('#checkFixItuZonesBtn').prop('disabled', false).text('<?= __("Check") ?>');
|
||||
@@ -2241,7 +2220,7 @@ function saveOptions() {
|
||||
}
|
||||
|
||||
BootstrapDialog.alert({
|
||||
title: '<?= __("Error") ?>',
|
||||
title: 'Error',
|
||||
message: errorMsg,
|
||||
type: BootstrapDialog.TYPE_DANGER
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user