diff --git a/application/controllers/Eqsl.php b/application/controllers/Eqsl.php index 2268d553..5f9715cb 100644 --- a/application/controllers/Eqsl.php +++ b/application/controllers/Eqsl.php @@ -8,6 +8,23 @@ class eqsl extends CI_Controller { $this->load->helper(array('form', 'url')); } + // Default view when loading controller. + public function index() { + + $this->lang->load('qslcard'); + $folder_name = "assets/qslcard"; + $data['storage_used'] = $this->sizeFormat($this->folderSize($folder_name)); + + // Render Page + $data['page_title'] = "eQSL Cards"; + + $this->load->model('eqsl_images'); + $data['qslarray'] = $this->eqsl_images->eqsl_qso_list(); + + $this->load->view('interface_assets/header', $data); + $this->load->view('eqslcard/index'); + $this->load->view('interface_assets/footer'); + } public function import() { $this->load->model('user_model'); if(!$this->user_model->authorize(2)) { $this->session->set_flashdata('notice', 'You\'re not allowed to do that!'); redirect('dashboard'); } @@ -535,6 +552,22 @@ class eqsl extends CI_Controller { $this->load->view('interface_assets/footer'); } + public function download() { + // Check logged in + $this->load->model('user_model'); + if(!$this->user_model->authorize(2)) { $this->session->set_flashdata('notice', 'You\'re not allowed to do that!'); redirect('dashboard'); } + + $data['page_title'] = "eQSL Card Image Download"; + $this->load->model('eqslmethods_model'); + + $data['custom_date_format'] = $this->session->userdata('user_date_format'); + $data['qslsnotdownloaded'] = $this->eqslmethods_model->eqsl_not_yet_downloaded(); + + $this->load->view('interface_assets/header', $data); + $this->load->view('eqsl/download'); + $this->load->view('interface_assets/footer'); + } + public function mark_all_sent() { // Check logged in $this->load->model('user_model'); @@ -599,5 +632,49 @@ class eqsl extends CI_Controller { $status = $this->uploadQso($adif, $qsl); } } - + +// Functions for storage, these need shifted to a libary to use across Cloudlog + function folderSize($dir){ + $count_size = 0; + $count = 0; + $dir_array = scandir($dir); + foreach($dir_array as $key=>$filename){ + if($filename!=".." && $filename!="."){ + if(is_dir($dir."/".$filename)){ + $new_foldersize = foldersize($dir."/".$filename); + $count_size = $count_size+ $new_foldersize; + }else if(is_file($dir."/".$filename)){ + $count_size = $count_size + filesize($dir."/".$filename); + $count++; + } + } + } + return $count_size; + } + + function sizeFormat($bytes){ + $kb = 1024; + $mb = $kb * 1024; + $gb = $mb * 1024; + $tb = $gb * 1024; + + if (($bytes >= 0) && ($bytes < $kb)) { + return $bytes . ' B'; + + } elseif (($bytes >= $kb) && ($bytes < $mb)) { + return ceil($bytes / $kb) . ' KB'; + + } elseif (($bytes >= $mb) && ($bytes < $gb)) { + return ceil($bytes / $mb) . ' MB'; + + } elseif (($bytes >= $gb) && ($bytes < $tb)) { + return ceil($bytes / $gb) . ' GB'; + + } elseif ($bytes >= $tb) { + return ceil($bytes / $tb) . ' TB'; + } else { + return $bytes . ' B'; + } + } + } // end class diff --git a/application/language/english/general_words_lang.php b/application/language/english/general_words_lang.php index a93002c7..03f911d1 100644 --- a/application/language/english/general_words_lang.php +++ b/application/language/english/general_words_lang.php @@ -48,6 +48,7 @@ $lang['general_word_qslcard_bureau'] = 'Bureau'; $lang['general_word_qslcard_electronic'] = 'Electronic'; $lang['general_word_qslcard_manager'] = 'Manager'; $lang['general_word_qslcard_via'] = 'Via'; +$lang['general_word_eqslcard'] = 'eQSL Card'; $lang['general_word_eqslcards'] = 'eQSL Cards'; $lang['general_word_lotw'] = 'Logbook of the World'; diff --git a/application/language/english/menu_lang.php b/application/language/english/menu_lang.php index 5a2ebcb2..1c626fea 100644 --- a/application/language/english/menu_lang.php +++ b/application/language/english/menu_lang.php @@ -14,6 +14,7 @@ $lang['menu_post_qso'] = 'Post QSO'; $lang['menu_live_contest_logging'] = 'Live Contest Logging'; $lang['menu_post_contest_logging'] = 'Post Contest Logging'; $lang['menu_view_qsl'] = 'View QSL'; +$lang['menu_view_eqsl'] = 'View eQSL'; $lang['menu_analytics'] = 'Analytics'; $lang['menu_statistics'] = 'Statistics'; @@ -75,4 +76,4 @@ $lang['menu_api_keys'] = 'API Keys'; $lang['menu_hardware_interfaces'] = 'Hardware Interfaces'; $lang['menu_help'] = 'Help'; $lang['menu_forum'] = 'Forum'; -$lang['menu_logout'] = 'Logout'; \ No newline at end of file +$lang['menu_logout'] = 'Logout'; diff --git a/application/language/german/general_words_lang.php b/application/language/german/general_words_lang.php index f7dbeb42..9b58e4fa 100644 --- a/application/language/german/general_words_lang.php +++ b/application/language/german/general_words_lang.php @@ -47,6 +47,7 @@ $lang['general_word_qslcard_direct'] = 'Direkt'; $lang['general_word_qslcard_bureau'] = 'Büro'; $lang['general_word_qslcard_electronic'] = 'Elektronisch'; $lang['general_word_qslcard_via'] = 'Via'; +$lang['general_word_eqslcard'] = 'eQSL Karte'; $lang['general_word_eqslcards'] = 'eQSL Karten'; $lang['general_word_lotw'] = 'Logbook of the World'; diff --git a/application/language/german/menu_lang.php b/application/language/german/menu_lang.php index bf8a6939..788dda7b 100644 --- a/application/language/german/menu_lang.php +++ b/application/language/german/menu_lang.php @@ -14,6 +14,7 @@ $lang['menu_post_qso'] = 'Zeitversetztes QSO'; $lang['menu_live_contest_logging'] = 'Live Contest Logging'; $lang['menu_post_contest_logging'] = 'Zeitversetztes Contest Logging'; $lang['menu_view_qsl'] = 'QSL Ansicht'; +$lang['menu_view_eqsl'] = 'eQSL Ansicht'; $lang['menu_analytics'] = 'Analysen'; $lang['menu_statistics'] = 'Statistik'; diff --git a/application/models/Dxcc.php b/application/models/Dxcc.php index cfa3b65c..a440c592 100644 --- a/application/models/Dxcc.php +++ b/application/models/Dxcc.php @@ -87,7 +87,7 @@ class DXCC extends CI_Model { $dxccMatrix[$dxcc->adif]['name'] = ucwords(strtolower($dxcc->name), "- (/"); $dxccMatrix[$dxcc->adif]['Dxccprefix'] = $dxcc->prefix; if ($postdata['includedeleted']) - $dxccMatrix[$dxcc->adif]['Deleted'] = isset($dxcc->Enddate) ? "
Y
" : ''; + $dxccMatrix[$dxcc->adif]['Deleted'] = isset($dxcc->Enddate) ? 1 : 0; $dxccMatrix[$dxcc->adif][$band] = '-'; } diff --git a/application/models/Eqsl_images.php b/application/models/Eqsl_images.php index 88137b01..31a89b37 100644 --- a/application/models/Eqsl_images.php +++ b/application/models/Eqsl_images.php @@ -24,6 +24,17 @@ class Eqsl_images extends CI_Model { $this->db->insert('eQSL_images', $data); } + function eqsl_qso_list() { + $this->load->model('logbooks_model'); + $logbooks_locations_array = $this->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook')); + $this->db->select('qso_id, COL_CALL, COL_MODE, , COL_SUBMODE, COL_TIME_ON, COL_BAND, COL_SAT_NAME, image_file'); + $this->db->join($this->config->item('table_name'), 'qso_id = COL_PRIMARY_KEY', 'left outer'); + $this->db->join('station_profile', $this->config->item('table_name').'.station_id = station_profile.station_id', 'left outer'); + $this->db->where_in('station_profile.station_id', $logbooks_locations_array); + $this->db->order_by('COL_TIME_ON', 'DESC'); + return $this->db->get('eQSL_images'); + } + } -?> \ No newline at end of file +?> diff --git a/application/models/Eqslmethods_model.php b/application/models/Eqslmethods_model.php index eb7546f5..ff83f5bd 100644 --- a/application/models/Eqslmethods_model.php +++ b/application/models/Eqslmethods_model.php @@ -49,7 +49,7 @@ class Eqslmethods_model extends CI_Model { array_push($logbooks_locations_array, $row->station_id); } } - + $this->db->select('station_profile.*, '.$this->config->item('table_name').'.COL_PRIMARY_KEY, '.$this->config->item('table_name').'.COL_TIME_ON, '.$this->config->item('table_name').'.COL_CALL, '.$this->config->item('table_name').'.COL_MODE, '.$this->config->item('table_name').'.COL_SUBMODE, '.$this->config->item('table_name').'.COL_BAND, '.$this->config->item('table_name').'.COL_COMMENT, '.$this->config->item('table_name').'.COL_RST_SENT, '.$this->config->item('table_name').'.COL_PROP_MODE, '.$this->config->item('table_name').'.COL_SAT_NAME, '.$this->config->item('table_name').'.COL_SAT_MODE, '.$this->config->item('table_name').'.COL_QSLMSG'); $this->db->from('station_profile'); $this->db->join($this->config->item('table_name'),'station_profile.station_id = '.$this->config->item('table_name').'.station_id'); @@ -63,7 +63,34 @@ class Eqslmethods_model extends CI_Model { $this->db->or_where($this->config->item('table_name').'.COL_EQSL_QSL_SENT', 'N'); $this->db->group_end(); $this->db->where_in('station_profile.station_id', $logbooks_locations_array); - + + return $this->db->get(); + } + + // Show all QSOs whose eQSL card images we did not download yet + function eqsl_not_yet_downloaded($userid = null) { + $CI =& get_instance(); + if ($userid == null) { + $CI->load->model('logbooks_model'); + $logbooks_locations_array = $CI->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook')); + } else { + $stations = $this->get_all_user_locations($userid); + $logbooks_locations_array = array(); + foreach ($stations->result() as $row) { + array_push($logbooks_locations_array, $row->station_id); + } + } + + $this->db->select('station_profile.station_id, '.$this->config->item('table_name').'.COL_PRIMARY_KEY, '.$this->config->item('table_name').'.COL_TIME_ON, '.$this->config->item('table_name').'.COL_CALL, '.$this->config->item('table_name').'.COL_MODE, '.$this->config->item('table_name').'.COL_SUBMODE, '.$this->config->item('table_name').'.COL_BAND, '.$this->config->item('table_name').'.COL_PROP_MODE, '.$this->config->item('table_name').'.COL_SAT_NAME, '.$this->config->item('table_name').'.COL_SAT_MODE, '.$this->config->item('table_name').'.COL_QSLMSG, eQSL_images.qso_id'); + $this->db->from('station_profile'); + $this->db->join($this->config->item('table_name'),'station_profile.station_id = '.$this->config->item('table_name').'.station_id'); + $this->db->join('eQSL_images','eQSL_images.qso_id = '.$this->config->item('table_name').'.COL_PRIMARY_KEY','left outer'); + //$this->db->where("coalesce(station_profile.eqslqthnickname, '') <> ''"); + $this->db->where($this->config->item('table_name').'.COL_CALL !=', ''); + $this->db->where($this->config->item('table_name').'.COL_EQSL_QSL_RCVD', 'Y'); + $this->db->where('qso_id', NULL); + $this->db->where_in('station_profile.station_id', $logbooks_locations_array); + return $this->db->get(); } @@ -165,4 +192,4 @@ class Eqslmethods_model extends CI_Model { } -?> \ No newline at end of file +?> diff --git a/application/models/Logbook_model.php b/application/models/Logbook_model.php index 692803aa..bfed414a 100755 --- a/application/models/Logbook_model.php +++ b/application/models/Logbook_model.php @@ -1296,11 +1296,12 @@ class Logbook_model extends CI_Model { function get_qso($id) { $this->db->select($this->config->item('table_name').'.*, station_profile.*, dxcc_entities.*, dxcc_entities_2.name as station_country, dxcc_entities_2.end as station_end'); - $this->db->select($this->config->item('table_name').'.*, station_profile.*, dxcc_entities.*, coalesce(dxcc_entities_2.name, "- NONE -") as station_country, dxcc_entities_2.end as station_end'); + $this->db->select($this->config->item('table_name').'.*, station_profile.*, dxcc_entities.*, coalesce(dxcc_entities_2.name, "- NONE -") as station_country, dxcc_entities_2.end as station_end, eQSL_images.image_file as eqsl_image_file'); $this->db->from($this->config->item('table_name')); $this->db->join('dxcc_entities', $this->config->item('table_name').'.col_dxcc = dxcc_entities.adif', 'left'); $this->db->join('station_profile', 'station_profile.station_id = '.$this->config->item('table_name').'.station_id', 'left'); $this->db->join('dxcc_entities as dxcc_entities_2', 'station_profile.station_dxcc = dxcc_entities_2.adif', 'left outer'); + $this->db->join('eQSL_images', $this->config->item('table_name').'.COL_PRIMARY_KEY = eQSL_images.qso_id', 'left outer'); $this->db->where('COL_PRIMARY_KEY', $id); return $this->db->get(); @@ -3794,4 +3795,4 @@ function validateADIFDate($date, $format = 'Ymd') $d = DateTime::createFromFormat($format, $date); return $d && $d->format($format) == $date; } -?> \ No newline at end of file +?> diff --git a/application/views/awards/dxcc/index.php b/application/views/awards/dxcc/index.php index 54aa3dab..d2c41b97 100644 --- a/application/views/awards/dxcc/index.php +++ b/application/views/awards/dxcc/index.php @@ -198,9 +198,6 @@ # DXCC Name Prefix'; - if ($this->input->post('includedeleted')) - echo ' - Deleted'; foreach($bands as $band) { echo '' . $band . ''; } @@ -210,8 +207,14 @@ foreach ($dxcc_array as $dxcc => $value) { // Fills the table with the data echo ' '. $i++ .''; - foreach ($value as $key) { - echo '' . $key . ''; + foreach ($value as $name => $key) { + if (isset($value['Deleted']) && $value['Deleted'] == 1 && $name == "name") { + echo '' . $key . ' '.lang('gen_hamradio_deleted_dxcc').''; + } else if ($name == "Deleted") { + continue; + } else { + echo '' . $key . ''; + } } echo ''; } diff --git a/application/views/eqsl/analysis.php b/application/views/eqsl/analysis.php index c2230d3e..ab3246e4 100644 --- a/application/views/eqsl/analysis.php +++ b/application/views/eqsl/analysis.php @@ -16,6 +16,9 @@ $custom_date_format = $this->session->userdata('user_date_format'); + diff --git a/application/views/eqsl/download.php b/application/views/eqsl/download.php new file mode 100644 index 00000000..6da35457 --- /dev/null +++ b/application/views/eqsl/download.php @@ -0,0 +1,70 @@ + +
+

+
+
+
eQSL Card Image Download
+ +
+ +
+ load->view('layout/messages'); ?> + +result())) { +?> +

Below is a table of QSOs that have been confirmed on eQSL but QSL images have not been downloaded yet.

+ + + + + + + + + + + + +result_array() as $qsl) { + echo ""; + $timestamp = strtotime($qsl['COL_TIME_ON']); + echo ""; + echo ""; + echo ""; + echo ""; + if(isset($qsl['COL_SUBMODE'])) { + echo ""; + } else { + echo ""; + } + echo ""; + echo ""; +} + echo ""; +?> +
DateTimeCallModeSubmodeBandAction
".date($custom_date_format, $timestamp)."".date('H:i', $timestamp)."".str_replace("0","Ø",$qsl['COL_CALL'])."".$qsl['COL_MODE']."".$qsl['COL_SUBMODE']."".$qsl['COL_BAND']."View/Download
+ +There are no QSOs whose eQSL card images have not yet been downloaded. Go log some more QSOs!

"; + } +?> +
+ +
+
diff --git a/application/views/eqsl/export.php b/application/views/eqsl/export.php index 39e1b2d9..4a094a22 100644 --- a/application/views/eqsl/export.php +++ b/application/views/eqsl/export.php @@ -14,6 +14,9 @@ + diff --git a/application/views/eqsl/import.php b/application/views/eqsl/import.php index 2a6d8634..d745e1b4 100644 --- a/application/views/eqsl/import.php +++ b/application/views/eqsl/import.php @@ -14,6 +14,9 @@ +
diff --git a/application/views/eqsl/tools.php b/application/views/eqsl/tools.php index fa6e0948..d099525c 100644 --- a/application/views/eqsl/tools.php +++ b/application/views/eqsl/tools.php @@ -15,6 +15,10 @@ + +
diff --git a/application/views/eqslcard/index.php b/application/views/eqslcard/index.php new file mode 100644 index 00000000..979f4ee3 --- /dev/null +++ b/application/views/eqslcard/index.php @@ -0,0 +1,59 @@ +
+ +
+ +

lang->line('general_word_eqslcards'); ?>

+ + + + session->userdata('user_date_format')) { + // If Logged in and session exists + $custom_date_format = $this->session->userdata('user_date_format'); + } else { + // Get Default date format from /config/cloudlog.php + $custom_date_format = $this->config->item('qso_date_format'); + } + + if (is_array($qslarray->result())) { + echo ' + + + + + + + + + + + '; + + foreach ($qslarray->result() as $qsl) { + echo ''; + echo ''; + echo ''; + echo ''; + echo ''; + echo ''; + echo ''; + echo ''; + echo ''; + } + + echo '
'.$this->lang->line('gen_hamradio_callsign').''.$this->lang->line('gen_hamradio_mode').''.$this->lang->line('general_word_date').''.$this->lang->line('general_word_time').''.$this->lang->line('gen_hamradio_band').''.$this->lang->line('gen_hamradio_qsl').'
' . $qsl->COL_CALL . ''; + echo $qsl->COL_SUBMODE==null?$qsl->COL_MODE:$qsl->COL_SUBMODE; + echo ''; + $timestamp = strtotime($qsl->COL_TIME_ON); echo date($custom_date_format, $timestamp); + echo ''; + $timestamp = strtotime($qsl->COL_TIME_ON); echo date('H:i', $timestamp); + echo ''; + if($qsl->COL_SAT_NAME != null) { echo $qsl->COL_SAT_NAME; } else { echo strtolower($qsl->COL_BAND); }; + echo '' . $qsl->image_file . '
'; + } + ?> + +
diff --git a/application/views/interface_assets/footer.php b/application/views/interface_assets/footer.php index cb38dd17..202b8787 100644 --- a/application/views/interface_assets/footer.php +++ b/application/views/interface_assets/footer.php @@ -2123,7 +2123,7 @@ $(document).ready(function(){ -uri->segment(1) == "qsl") { +uri->segment(1) == "qsl" || $this->uri->segment(1) == "eqsl") { // Get Date format if($this->session->userdata('user_date_format')) { // If Logged in and session exists @@ -2244,6 +2244,31 @@ function deleteQsl(id) { }); } +