Skip to content

Commit a7c4750

Browse files
authored
'2.6.5
2 parents 9a814e2 + 0c5a2ec commit a7c4750

18 files changed

Lines changed: 1016 additions & 395 deletions

File tree

application/config/migration.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
|
2323
*/
2424

25-
$config['migration_version'] = 171;
25+
$config['migration_version'] = 172;
2626

2727
/*
2828
|--------------------------------------------------------------------------

application/controllers/Dashboard.php

Lines changed: 47 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
1-
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
1+
<?php if (!defined('BASEPATH')) exit('No direct script access allowed');
22

3-
class Dashboard extends CI_Controller {
3+
class Dashboard extends CI_Controller
4+
{
45

56
public function index()
67
{
78
// If environment is set to development then show the debug toolbar
8-
if(ENVIRONMENT == 'development') {
9-
$this->output->enable_profiler(TRUE);
10-
}
9+
if (ENVIRONMENT == 'development') {
10+
$this->output->enable_profiler(TRUE);
11+
}
1112

1213
// Load language files
1314
$this->lang->load('lotw');
@@ -19,13 +20,13 @@ public function index()
1920
// LoTW infos
2021
$this->load->model('LotwCert');
2122

22-
if($this->optionslib->get_option('version2_trigger') == "false") {
23+
if ($this->optionslib->get_option('version2_trigger') == "false") {
2324
redirect('welcome');
2425
}
2526

2627
// Check if users logged in
2728

28-
if($this->user_model->validate_session() == 0) {
29+
if ($this->user_model->validate_session() == 0) {
2930
// user is not logged in
3031
redirect('user/login');
3132
}
@@ -34,19 +35,19 @@ public function index()
3435
$logbooks_locations_array = $this->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook'));
3536

3637
// Calculate Lat/Lng from Locator to use on Maps
37-
if($this->session->userdata('user_locator')) {
38-
$this->load->library('qra');
39-
40-
$qra_position = $this->qra->qra2latlong($this->session->userdata('user_locator'));
41-
if ($qra_position) {
42-
$data['qra'] = "set";
43-
$data['qra_lat'] = $qra_position[0];
44-
$data['qra_lng'] = $qra_position[1];
45-
} else {
46-
$data['qra'] = "none";
47-
}
48-
} else {
38+
if ($this->session->userdata('user_locator')) {
39+
$this->load->library('qra');
40+
41+
$qra_position = $this->qra->qra2latlong($this->session->userdata('user_locator'));
42+
if ($qra_position) {
43+
$data['qra'] = "set";
44+
$data['qra_lat'] = $qra_position[0];
45+
$data['qra_lng'] = $qra_position[1];
46+
} else {
4947
$data['qra'] = "none";
48+
}
49+
} else {
50+
$data['qra'] = "none";
5051
}
5152

5253
$this->load->model('stations');
@@ -60,7 +61,7 @@ public function index()
6061

6162
$setup_required = false;
6263

63-
if($setup_required) {
64+
if ($setup_required) {
6465
$data['page_title'] = "Cloudlog Setup Checklist";
6566

6667
$this->load->view('interface_assets/header', $data);
@@ -88,7 +89,7 @@ public function index()
8889
$data['total_countries_confirmed_eqsl'] = $CountriesBreakdown['Countries_Worked_EQSL'];
8990
$data['total_countries_confirmed_lotw'] = $CountriesBreakdown['Countries_Worked_LOTW'];
9091

91-
$QSLStatsBreakdownArray =$this->logbook_model->get_QSLStats($logbooks_locations_array);
92+
$QSLStatsBreakdownArray = $this->logbook_model->get_QSLStats($logbooks_locations_array);
9293

9394
$data['total_qsl_sent'] = $QSLStatsBreakdownArray['QSL_Sent'];
9495
$data['total_qsl_rcvd'] = $QSLStatsBreakdownArray['QSL_Received'];
@@ -130,15 +131,38 @@ public function index()
130131
$this->load->view('dashboard/index');
131132
$this->load->view('interface_assets/footer');
132133
}
133-
134134
}
135135

136-
function radio_display_component() {
136+
function radio_display_component()
137+
{
137138
$this->load->model('cat');
138139

139140
$data['radio_status'] = $this->cat->recent_status();
140141
$this->load->view('components/radio_display_table', $data);
141142
}
142143

144+
function upcoming_dxcc_component()
145+
{
146+
147+
$this->load->model('Workabledxcc_model');
148+
149+
$this->load->driver('cache', array('adapter' => 'file', 'backup' => 'file'));
150+
151+
// Get the user ID from the session data
152+
$userID = $this->session->userdata('user_id');
153+
154+
155+
$thisWeekRecords = $this->Workabledxcc_model->GetThisWeek();
156+
157+
158+
$data['thisWeekRecords'] = $thisWeekRecords;
159+
160+
usort($data['thisWeekRecords'], function ($a, $b) {
161+
$dateA = new DateTime($a['1']);
162+
$dateB = new DateTime($b['1']);
163+
return $dateA <=> $dateB;
164+
});
143165

166+
$this->load->view('components/upcoming_dxccs', $data);
144167
}
168+
}
Lines changed: 170 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,170 @@
1+
<?php if (!defined('BASEPATH')) exit('No direct script access allowed');
2+
3+
/*
4+
Controller to interact with the Cloudlog DXPed Aggregator
5+
*/
6+
7+
class Workabledxcc extends CI_Controller
8+
{
9+
10+
function __construct()
11+
{
12+
parent::__construct();
13+
14+
$this->load->model('user_model');
15+
if (!$this->user_model->authorize(2)) {
16+
$this->session->set_flashdata('notice', 'You\'re not allowed to do that!');
17+
redirect('dashboard');
18+
}
19+
}
20+
21+
public function index()
22+
{
23+
// Load public view
24+
$data['page_title'] = "Upcoming DXPeditions";
25+
$this->load->view('interface_assets/header', $data);
26+
$this->load->view('/workabledxcc/index');
27+
$this->load->view('interface_assets/footer');
28+
}
29+
30+
public function dxcclist()
31+
{
32+
33+
$json = file_get_contents('https://cdn.cloudlog.org/read_ng3k_dxped_list.php');
34+
35+
// Decode the JSON data into a PHP array
36+
$dataResult = json_decode($json, true);
37+
38+
// Initialize an empty array to store the required data
39+
$requiredData = array();
40+
41+
// Get Date format
42+
if ($this->session->userdata('user_date_format')) {
43+
// If Logged in and session exists
44+
$custom_date_format = $this->session->userdata('user_date_format');
45+
} else {
46+
// Get Default date format from /config/cloudlog.php
47+
$custom_date_format = $this->config->item('qso_date_format');
48+
}
49+
50+
// Iterate through the decoded JSON data
51+
foreach ($dataResult as $item) {
52+
// Create a new array with the required fields and add it to the main array
53+
$oldStartDate = DateTime::createFromFormat('Y-m-d', $item['0']);
54+
55+
$StartDate = $oldStartDate->format($custom_date_format);
56+
57+
$oldEndDate = DateTime::createFromFormat('Y-m-d', $item['1']);
58+
59+
$EndDate = $oldEndDate->format($custom_date_format);
60+
61+
$this->load->model('logbook_model');
62+
$dxccInfo = $this->logbook_model->dxcc_lookup($item['callsign'], $StartDate);
63+
64+
// Call DXCC Worked function to check if the DXCC has been worked before
65+
if (isset($dxccInfo['entity'])) {
66+
$dxccWorked = $this->dxccWorked($dxccInfo['entity']);
67+
} else {
68+
// Handle the case where 'entity' is not set in $dxccInfo
69+
$dxccWorked = array(
70+
'workedBefore' => false,
71+
'confirmed' => false,
72+
);
73+
}
74+
75+
$requiredData[] = array(
76+
'clean_date' => $item['0'],
77+
'start_date' => $StartDate,
78+
'end_date' => $EndDate,
79+
'country' => $item['2'],
80+
'notes' => $item['6'],
81+
'callsign' => $item['callsign'],
82+
'workedBefore' => $dxccWorked['workedBefore'],
83+
'confirmed' => $dxccWorked['confirmed'],
84+
);
85+
}
86+
87+
$data['dxcclist'] = $requiredData;
88+
89+
// Return the array with the required data
90+
91+
$this->load->view('/workabledxcc/components/dxcclist', $data);
92+
}
93+
94+
function dxccWorked($country)
95+
{
96+
97+
$return = [
98+
"workedBefore" => false,
99+
"confirmed" => false,
100+
];
101+
102+
$user_default_confirmation = $this->session->userdata('user_default_confirmation');
103+
$this->load->model('logbooks_model');
104+
$logbooks_locations_array = $this->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook'));
105+
$this->load->model('logbook_model');
106+
107+
if (!empty($logbooks_locations_array)) {
108+
$this->db->where('COL_PROP_MODE !=', 'SAT');
109+
110+
$this->db->where_in('station_id', $logbooks_locations_array);
111+
$this->db->where('COL_COUNTRY', urldecode($country));
112+
113+
$query = $this->db->get($this->config->item('table_name'), 1, 0);
114+
foreach ($query->result() as $workedBeforeRow) {
115+
$return['workedBefore'] = true;
116+
}
117+
118+
$extrawhere = '';
119+
if (isset($user_default_confirmation) && strpos($user_default_confirmation, 'Q') !== false) {
120+
$extrawhere = "COL_QSL_RCVD='Y'";
121+
}
122+
if (isset($user_default_confirmation) && strpos($user_default_confirmation, 'L') !== false) {
123+
if ($extrawhere != '') {
124+
$extrawhere .= " OR";
125+
}
126+
$extrawhere .= " COL_LOTW_QSL_RCVD='Y'";
127+
}
128+
if (isset($user_default_confirmation) && strpos($user_default_confirmation, 'E') !== false) {
129+
if ($extrawhere != '') {
130+
$extrawhere .= " OR";
131+
}
132+
$extrawhere .= " COL_EQSL_QSL_RCVD='Y'";
133+
}
134+
135+
if (isset($user_default_confirmation) && strpos($user_default_confirmation, 'Z') !== false) {
136+
if ($extrawhere != '') {
137+
$extrawhere .= " OR";
138+
}
139+
$extrawhere .= " COL_QRZCOM_QSO_DOWNLOAD_STATUS='Y'";
140+
}
141+
142+
143+
$this->load->model('logbook_model');
144+
$this->db->where('COL_PROP_MODE !=', 'SAT');
145+
if ($extrawhere != '') {
146+
$this->db->where('(' . $extrawhere . ')');
147+
} else {
148+
$this->db->where("1=0");
149+
}
150+
151+
152+
$this->db->where_in('station_id', $logbooks_locations_array);
153+
$this->db->where('COL_COUNTRY', urldecode($country));
154+
155+
$query = $this->db->get($this->config->item('table_name'), 1, 0);
156+
foreach ($query->result() as $workedBeforeRow) {
157+
$return['confirmed'] = true;
158+
}
159+
160+
return $return;
161+
} else {
162+
$return['workedBefore'] = false;
163+
$return['confirmed'] = false;
164+
165+
166+
return $return;;
167+
}
168+
}
169+
170+
}

application/libraries/DxccFlag.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -411,6 +411,10 @@ class DxccFlag
411411

412412
public function get($dxcc)
413413
{
414-
return $this->dxccFlags[$dxcc];
414+
if (!isset($this->dxccFlags[$dxcc])) {
415+
return null;
416+
} else {
417+
return $this->dxccFlags[$dxcc];
418+
}
415419
}
416420
}
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
<?php
2+
3+
defined('BASEPATH') OR exit('No direct script access allowed');
4+
5+
/*
6+
* Tag Cloudlog as 2.6.5
7+
*/
8+
9+
class Migration_tag_2_6_5 extends CI_Migration {
10+
11+
public function up()
12+
{
13+
14+
// Tag Cloudlog 2.6.3
15+
$this->db->where('option_name', 'version');
16+
$this->db->update('options', array('option_value' => '2.6.5'));
17+
18+
// Trigger Version Info Dialog
19+
$this->db->where('option_type', 'version_dialog');
20+
$this->db->where('option_name', 'confirmed');
21+
$this->db->update('user_options', array('option_value' => 'false'));
22+
23+
}
24+
25+
public function down()
26+
{
27+
$this->db->where('option_name', 'version');
28+
$this->db->update('options', array('option_value' => '2.6.4'));
29+
}
30+
}

0 commit comments

Comments
 (0)