Skip to content

Commit

Permalink
Merge pull request #3204 from DanielBausset/custom-map-dates
Browse files Browse the repository at this point in the history
Custom maps: set dates to full logbook range + submodes filter fix + some wording fixes
  • Loading branch information
magicbug authored Oct 30, 2024
2 parents 191f559 + d11ff35 commit de543c8
Show file tree
Hide file tree
Showing 19 changed files with 75 additions and 20 deletions.
13 changes: 10 additions & 3 deletions application/controllers/Map.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ function index() {
function custom()
{
$this->load->model('bands');
$this->load->model('modes');
$this->load->model('gridmap_model');

$data['worked_bands'] = $this->bands->get_worked_bands(); // Used in the view for band select
$data['modes'] = $this->modes->active(); // Used in the view for mode select
$data['worked_bands'] = $this->bands->get_worked_bands(); // Used in the view for band select
$data['modes'] = $this->gridmap_model->get_worked_modes(); // Used in the view for mode select

if ($this->input->post('band') != NULL) { // Band is not set when page first loads.
if ($this->input->post('band') == 'All') { // Did the user specify a band? If not, use all bands
Expand Down Expand Up @@ -99,4 +99,11 @@ public function map_plot_json() {
}

}

// Function to fetch the date of the oldest QSO in the log
public function get_oldest_qso_date() {
$this->load->model('logbook_model');
$oldestQSOdate = $this->logbook_model->get_oldest_qso_date();
echo $oldestQSOdate;
}
}
2 changes: 2 additions & 0 deletions application/language/bulgarian/general_words_lang.php
Original file line number Diff line number Diff line change
Expand Up @@ -230,3 +230,5 @@
$lang['hams_at_no_activations_found'] = 'No upcoming activations found. Please check back later.';

$lang['datatables_language'] = "en-GB";

$lang['set_log_to_full_dates'] = "Set log to full dates";
Original file line number Diff line number Diff line change
Expand Up @@ -230,3 +230,5 @@
$lang['hams_at_no_activations_found'] = '未找到即将进行的激活。 请稍后再回来查看。';

$lang['datatables_language'] = "en-GB";

$lang['set_log_to_full_dates'] = "Set log to full dates";
2 changes: 2 additions & 0 deletions application/language/czech/general_words_lang.php
Original file line number Diff line number Diff line change
Expand Up @@ -225,3 +225,5 @@
$lang['hams_at_no_activations_found'] = 'No upcoming activations found. Please check back later.';

$lang['datatables_language'] = "en-GB";

$lang['set_log_to_full_dates'] = "Set log to full dates";
2 changes: 2 additions & 0 deletions application/language/dutch/general_words_lang.php
Original file line number Diff line number Diff line change
Expand Up @@ -230,3 +230,5 @@
$lang['hams_at_no_activations_found'] = 'No upcoming activations found. Please check back later.';

$lang['datatables_language'] = "en-GB";

$lang['set_log_to_full_dates'] = "Set log to full dates";
2 changes: 2 additions & 0 deletions application/language/english/general_words_lang.php
Original file line number Diff line number Diff line change
Expand Up @@ -230,3 +230,5 @@
$lang['hams_at_no_activations_found'] = 'No upcoming activations found. Please check back later.';

$lang['datatables_language'] = "en-GB";

$lang['set_log_to_full_dates'] = "Set log to full dates";
2 changes: 2 additions & 0 deletions application/language/finnish/general_words_lang.php
Original file line number Diff line number Diff line change
Expand Up @@ -230,3 +230,5 @@
$lang['hams_at_no_activations_found'] = 'No upcoming activations found. Please check back later.';

$lang['datatables_language'] = "en-GB";

$lang['set_log_to_full_dates'] = "Set log to full dates";
2 changes: 2 additions & 0 deletions application/language/french/general_words_lang.php
Original file line number Diff line number Diff line change
Expand Up @@ -230,3 +230,5 @@
$lang['hams_at_no_activations_found'] = "Aucune activation à venir trouvée. Veuillez revenir plus tard.";

$lang['datatables_language'] = "fr-FR";

$lang['set_log_to_full_dates'] = "Dates du log complet";
2 changes: 2 additions & 0 deletions application/language/german/general_words_lang.php
Original file line number Diff line number Diff line change
Expand Up @@ -230,3 +230,5 @@
$lang['hams_at_no_activations_found'] = 'Keine bevorstehenden Aktivierungen gefunden. Bitte später noch einmal vorbeischauen.';

$lang['datatables_language'] = "de-DE";

$lang['set_log_to_full_dates'] = "Set log to full dates";
2 changes: 2 additions & 0 deletions application/language/greek/general_words_lang.php
Original file line number Diff line number Diff line change
Expand Up @@ -230,3 +230,5 @@
$lang['hams_at_no_activations_found'] = 'No upcoming activations found. Please check back later.';

$lang['datatables_language'] = "en-GB";

$lang['set_log_to_full_dates'] = "Set log to full dates";
2 changes: 2 additions & 0 deletions application/language/italian/general_words_lang.php
Original file line number Diff line number Diff line change
Expand Up @@ -229,3 +229,5 @@
$lang['hams_at_no_activations_found'] = 'Nessuna attivazione imminente trovata. Per favore controllare più tardi.';

$lang['datatables_language'] = "it-IT";

$lang['set_log_to_full_dates'] = "Set log to full dates";
2 changes: 2 additions & 0 deletions application/language/polish/general_words_lang.php
Original file line number Diff line number Diff line change
Expand Up @@ -225,3 +225,5 @@
$lang['hams_at_no_activations_found'] = 'No upcoming activations found. Please check back later.';

$lang['datatables_language'] = "en-GB";

$lang['set_log_to_full_dates'] = "Set log to full dates";
2 changes: 2 additions & 0 deletions application/language/russian/general_words_lang.php
Original file line number Diff line number Diff line change
Expand Up @@ -231,3 +231,5 @@
$lang['hams_at_no_activations_found'] = 'не найдены предстоящие активации. Проверьте позже.';

$lang['datatables_language'] = "ru-RU";

$lang['set_log_to_full_dates'] = "Set log to full dates";
2 changes: 2 additions & 0 deletions application/language/spanish/general_words_lang.php
Original file line number Diff line number Diff line change
Expand Up @@ -231,3 +231,5 @@
$lang['hams_at_no_activations_found'] = 'No hay activaciones próximas. Por favor vuelve a revisar más tarde.';

$lang['datatables_language'] = "es-ES";

$lang['set_log_to_full_dates'] = "Set log to full dates";
2 changes: 2 additions & 0 deletions application/language/swedish/general_words_lang.php
Original file line number Diff line number Diff line change
Expand Up @@ -232,3 +232,5 @@
$lang['hams_at_no_activations_found'] = 'No upcoming activations found. Please check back later.';

$lang['datatables_language'] = "en-GB";

$lang['set_log_to_full_dates'] = "Set log to full dates";
2 changes: 2 additions & 0 deletions application/language/turkish/general_words_lang.php
Original file line number Diff line number Diff line change
Expand Up @@ -228,3 +228,5 @@
$lang['hams_at_no_activations_found'] = 'Yakın gelecekte aktivasyon bulunamadı. Sonra tekrar deneyin.';

$lang['datatables_language'] = "tr-TR";

$lang['set_log_to_full_dates'] = "Set log to full dates";
9 changes: 9 additions & 0 deletions application/models/Logbook_model.php
Original file line number Diff line number Diff line change
Expand Up @@ -4855,6 +4855,15 @@ public function get_plot_array_for_map($qsos_result, $isVisitor = false)
}
return $json;
}

public function get_oldest_qso_date()
{
$query = $this->db->query('SELECT DATE(min(col_time_on)) as oldest_qso_date FROM TABLE_HRD_CONTACTS_V01');
$row = $query->row();
if (isset($row)) {
return $row->oldest_qso_date;
}
}
}

function validateADIFDate($date, $format = 'Ymd')
Expand Down
15 changes: 13 additions & 2 deletions application/views/interface_assets/footer.php
Original file line number Diff line number Diff line change
Expand Up @@ -797,9 +797,20 @@ function showActivatorsMap(call, count, grids) {
};
initplot(qso_loc, customdata);
})


});

function get_oldest_qso_date() {
$.ajax({
url: base_url + 'index.php/map/get_oldest_qso_date',
type: 'post',
success: function(data) {
document.getElementById('from').value = data;
document.getElementById('to').value = new Date().toISOString().split('T')[0];
},
error: function() {
},
});
}
</script>
<?php } ?>

Expand Down
28 changes: 13 additions & 15 deletions application/views/map/custom_date.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<div class="container custom-map-QSOs">
<br>
<h2><?php echo $logbook_name ?> logbook QSOs (Custom Date)</h2>
<h2><?php echo $logbook_name; echo strpos($logbook_name, 'logbook') ? '' : ' logbook'; ?> QSOs (Custom Dates)</h2>

<?php if ($this->session->flashdata('notice')) { ?>
<div class="alert alert-info" role="alert">
Expand All @@ -19,6 +19,10 @@
<label for="to"><?php echo lang('gen_to_date') . ": " ?></label>
<input name="to" id="to" type="date" class="form-control w-auto" value="<?php echo $date_to; ?>" max="<?php echo $date_to; ?>">
</div>

<div class="mb-3 col-md-3 d-flex align-items-end">
<input class="btn btn-secondary" type="button" value="<?php echo lang('set_log_to_full_dates'); ?>" onclick="get_oldest_qso_date();">
</div>
</div>

<div class="row">
Expand All @@ -34,21 +38,14 @@
</select>
</div>


<div class="mb-3 col-md-3">
<label for="mode">Mode</label>
<select id="mode" name="mode" class="form-select">
<option value="All" <?php if ($this->input->post('mode') == "All" || $this->input->method() !== 'post') echo ' selected'; ?>>All</option>
<option value="All" <?php if ($this->input->post('mode') == "All" || $this->input->method() !== 'post') echo ' selected'; ?>><?php echo lang('general_word_all') ?></option>
<?php
foreach ($modes->result() as $mode) {
if ($mode->submode == null) {
echo '<option value="' . $mode->mode . '"';
if ($this->input->post('mode') == $mode->mode) echo ' selected';
echo '>' . $mode->mode . '</option>' . "\n";
} else {
echo '<option value="' . $mode->submode . '"';
if ($this->input->post('mode') == $mode->submode) echo ' selected';
echo '>' . $mode->submode . '</option>' . "\n";
foreach ($modes as $mode) {
if ($mode->submode ?? '' == '') {
echo '<option value="' . $mode . '">' . strtoupper($mode) . '</option>'."\n";
}
}
?>
Expand All @@ -58,7 +55,8 @@
<div class="mb-3 col-md-3">
<label for="selectPropagation">Propagation Mode</label>
<select class="form-select" id="selectPropagation" name="prop_mode">
<option value="All" <?php if ($this->input->post('prop_mode') == "All" || $this->input->method() !== 'post') echo ' selected'; ?>>All</option>
<option value="All" <?php if ($this->input->post('prop_mode') == "All" || $this->input->method() !== 'post') echo ' selected'; ?>><?php echo lang('general_word_all') ?></option>
<option value="" <?php if ($this->input->post('prop_mode') == "" && $this->input->method() == 'post') echo ' selected'; ?>><?php echo lang('general_word_undefined') ?></option>
<option value="AS" <?php if ($this->input->post('prop_mode') == "AS") echo ' selected'; ?>>Aircraft Scatter</option>
<option value="AUR" <?php if ($this->input->post('prop_mode') == "AUR") echo ' selected'; ?>>Aurora</option>
<option value="AUE" <?php if ($this->input->post('prop_mode') == "AUE") echo ' selected'; ?>>Aurora-E</option>
Expand All @@ -82,7 +80,7 @@
</div>

<div class="row">
<div class="mb-1 col-md-1">
<div class="mb-2 col-md-2">
<input class="btn btn-primary btn_submit_map_custom" type="button" value="Load Map">
</div>
<div class="mb-4 col-md-4">
Expand All @@ -96,4 +94,4 @@
<!-- Map -->
<div id="custommap" class="map-leaflet mt-2" style="width: 100%; height: 1000px;"></div>

<div class="alert alert-success" role="alert">Showing QSOs for Custom Date for Active Logbook <?php echo $logbook_name ?></div>
<div class="alert alert-success" role="alert">Showing QSOs for Custom Dates for Active Logbook <?php echo $logbook_name ?></div>

0 comments on commit de543c8

Please sign in to comment.