mirror of
https://github.com/wavelog/wavelog.git
synced 2026-03-22 10:24:14 +00:00
Colors matching new logic
This commit is contained in:
@@ -2395,6 +2395,7 @@ class Awards extends CI_Controller {
|
||||
|
||||
$this->load->model('award_pl_polska');
|
||||
$this->load->model('bands');
|
||||
$this->load->library('Genfunctions');
|
||||
|
||||
// Define valid bands for Polska award (per PZK rules)
|
||||
// https://awards.pzk.org.pl/polish-awards/polska.html
|
||||
@@ -2424,14 +2425,21 @@ class Awards extends CI_Controller {
|
||||
// Add confirmed key for gen_qsl_from_postdata function compatibility
|
||||
$postdata['confirmed'] = 1;
|
||||
|
||||
// Generate QSL string for displayContacts links
|
||||
$data['qsl_string'] = $this->genfunctions->gen_qsl_from_postdata($postdata);
|
||||
|
||||
if ($logbooks_locations_array) {
|
||||
$location_list = "'".implode("','",$logbooks_locations_array)."'";
|
||||
|
||||
// Simplified data - just confirmed counts
|
||||
// Worked data (all QSOs, not just confirmed)
|
||||
$data['polska_worked'] = $this->award_pl_polska->get_polska_worked_by_modes($location_list);
|
||||
$data['polska_worked_bands'] = $this->award_pl_polska->get_polska_worked_by_bands($data['worked_bands'], $location_list);
|
||||
|
||||
// Confirmed data
|
||||
$data['polska_array'] = $this->award_pl_polska->get_polska_simple_by_modes($postdata, $location_list);
|
||||
$data['polska_totals'] = $this->award_pl_polska->get_polska_totals_by_modes($postdata, $location_list);
|
||||
|
||||
// Band-based data (simplified)
|
||||
// Band-based confirmed data
|
||||
$data['polska_array_bands'] = $this->award_pl_polska->get_polska_simple_by_bands($data['worked_bands'], $postdata, $location_list);
|
||||
$data['polska_totals_bands'] = $this->award_pl_polska->get_polska_totals_by_bands($data['worked_bands'], $postdata, $location_list);
|
||||
|
||||
@@ -2456,6 +2464,8 @@ class Awards extends CI_Controller {
|
||||
}
|
||||
} else {
|
||||
$location_list = null;
|
||||
$data['polska_worked'] = null;
|
||||
$data['polska_worked_bands'] = null;
|
||||
$data['polska_array'] = null;
|
||||
$data['polska_totals'] = null;
|
||||
$data['polska_array_bands'] = null;
|
||||
@@ -2464,6 +2474,9 @@ class Awards extends CI_Controller {
|
||||
$data['polska_classes_bands'] = null;
|
||||
}
|
||||
|
||||
// Pass postdata for use in view
|
||||
$data['postdata'] = $postdata;
|
||||
|
||||
// Render page
|
||||
$data['page_title'] = sprintf(__("Awards - %s"), __('"Polska" Award'));
|
||||
$data['user_map_custom'] = $this->optionslib->get_map_custom();
|
||||
|
||||
@@ -151,6 +151,33 @@ class Award_pl_polska extends CI_Model {
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get worked (not confirmed) QSO counts by mode categories
|
||||
*/
|
||||
function get_polska_worked_by_modes($location_list) {
|
||||
$result = array();
|
||||
|
||||
foreach ($this->voivodeship_names as $code => $name) {
|
||||
$result[$code] = array_fill_keys($this->MODE_CATEGORIES, 0);
|
||||
}
|
||||
|
||||
foreach ($this->MODE_CATEGORIES as $category) {
|
||||
$voivData = $this->queryVoivodeships($location_list, array(
|
||||
'mode_category' => $category,
|
||||
'confirmed' => false,
|
||||
'withCount' => true
|
||||
));
|
||||
|
||||
foreach ($voivData as $line) {
|
||||
if (isset($result[$line->COL_STATE])) {
|
||||
$result[$line->COL_STATE][$category] = (int)$line->qso_count;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get confirmed QSO counts by mode categories
|
||||
*/
|
||||
@@ -179,6 +206,33 @@ class Award_pl_polska extends CI_Model {
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get worked (not confirmed) QSO counts by bands
|
||||
*/
|
||||
function get_polska_worked_by_bands($bands, $location_list) {
|
||||
$result = array();
|
||||
|
||||
foreach ($this->voivodeship_names as $code => $name) {
|
||||
$result[$code] = array_fill_keys($bands, 0);
|
||||
}
|
||||
|
||||
foreach ($bands as $band) {
|
||||
$voivData = $this->queryVoivodeships($location_list, array(
|
||||
'band' => $band,
|
||||
'confirmed' => false,
|
||||
'withCount' => true
|
||||
));
|
||||
|
||||
foreach ($voivData as $line) {
|
||||
if (isset($result[$line->COL_STATE])) {
|
||||
$result[$line->COL_STATE][$band] = (int)$line->qso_count;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get confirmed QSO counts by bands
|
||||
*/
|
||||
|
||||
@@ -3,6 +3,9 @@
|
||||
var lang_polish_voivodeship = "<?= __("Polish Voivodeships"); ?>";
|
||||
var lang_hover_over_voivodeship = "<?= __("Hover over a voivodeship"); ?>";
|
||||
</script>
|
||||
<script>
|
||||
let user_map_custom = JSON.parse('<?php echo $user_map_custom; ?>');
|
||||
</script>
|
||||
|
||||
<style>
|
||||
#polska-map {
|
||||
@@ -224,9 +227,15 @@ if ($polska_array) {
|
||||
<td style="text-align: left">' . $voivodeship_name . '</td>
|
||||
<td>' . $voivodeship_code . '</td>';
|
||||
foreach ($mode_categories as $category) {
|
||||
$count = isset($value[$category]) ? $value[$category] : 0;
|
||||
if ($count > 0) {
|
||||
echo '<td><div class="bg-success text-white">' . $count . '</div></td>';
|
||||
$confirmed_count = isset($value[$category]) ? $value[$category] : 0;
|
||||
$worked_count = isset($polska_worked[$voivodeship_code][$category]) ? $polska_worked[$voivodeship_code][$category] : 0;
|
||||
|
||||
if ($confirmed_count > 0) {
|
||||
// Confirmed - show confirmed count (green)
|
||||
echo '<td><div class="bg-success awardsBgSuccess"><a href=\'javascript:displayContacts("' . $voivodeship_code . '","All","All","All","' . $category . '","POLSKA", "' . $qsl_string . '")\'>' . $confirmed_count . '</a></div></td>';
|
||||
} elseif ($worked_count > 0) {
|
||||
// Only worked (not confirmed) - show worked count (orange)
|
||||
echo '<td><div class="bg-danger awardsBgWarning"><a href=\'javascript:displayContacts("' . $voivodeship_code . '","All","All","All","' . $category . '","POLSKA", "")\'>' . $worked_count . '</a></div></td>';
|
||||
} else {
|
||||
echo '<td>-</td>';
|
||||
}
|
||||
@@ -290,9 +299,15 @@ if ($polska_array) {
|
||||
<td style="text-align: left">' . $voivodeship_name . '</td>
|
||||
<td>' . $voivodeship_code . '</td>';
|
||||
foreach ($worked_bands as $band) {
|
||||
$count = isset($value[$band]) ? $value[$band] : 0;
|
||||
if ($count > 0) {
|
||||
echo '<td><div class="bg-success text-white">' . $count . '</div></td>';
|
||||
$confirmed_count = isset($value[$band]) ? $value[$band] : 0;
|
||||
$worked_count = isset($polska_worked_bands[$voivodeship_code][$band]) ? $polska_worked_bands[$voivodeship_code][$band] : 0;
|
||||
|
||||
if ($confirmed_count > 0) {
|
||||
// Confirmed - show confirmed count (green)
|
||||
echo '<td><div class="bg-success awardsBgSuccess"><a href=\'javascript:displayContacts("' . $voivodeship_code . '","' . $band . '","All","All","All","POLSKA", "' . $qsl_string . '")\'>' . $confirmed_count . '</a></div></td>';
|
||||
} elseif ($worked_count > 0) {
|
||||
// Only worked (not confirmed) - show worked count (orange)
|
||||
echo '<td><div class="bg-danger awardsBgWarning"><a href=\'javascript:displayContacts("' . $voivodeship_code . '","' . $band . '","All","All","All","POLSKA", "")\'>' . $worked_count . '</a></div></td>';
|
||||
} else {
|
||||
echo '<td>-</td>';
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user