diff --git a/application/controllers/Clublog.php b/application/controllers/Clublog.php index 67e86fa96..61a2479f5 100644 --- a/application/controllers/Clublog.php +++ b/application/controllers/Clublog.php @@ -89,4 +89,30 @@ class Clublog extends CI_Controller // echo ucfirst(strtolower($data['Name'])); return $data; } + + /* + * Used for displaying the uid for manually selecting log for upload to qrz + */ + public function export() { + $this->load->model('user_model'); + if(!$this->user_model->authorize(2) || !clubaccess_check(9)) { $this->session->set_flashdata('error', __("You're not allowed to do that!")); redirect('dashboard'); } + + $this->load->model('clublog_model'); + $this->load->model('stations'); + + $data['page_title'] = __("Clublog"); + + $data['station_profiles'] = $this->stations->all_of_user(); + + $data['station_profile'] = $this->clublog_model->stations_with_clublog_enabled(); + $data['callsigns'] = $this->stations->callsigns_of_user($this->session->userdata('user_id')); + + $this->load->model('cron_model'); + $data['next_run_up'] = $this->cron_model->get_next_run("clublog_upload"); + $data['next_run_down'] = $this->cron_model->get_next_run("clublog_download"); + + $this->load->view('interface_assets/header', $data); + $this->load->view('clublog/export'); + $this->load->view('interface_assets/footer'); + } } diff --git a/application/models/Clublog_model.php b/application/models/Clublog_model.php index 34bc8c94d..6eea7cb2d 100644 --- a/application/models/Clublog_model.php +++ b/application/models/Clublog_model.php @@ -288,7 +288,7 @@ class Clublog_model extends CI_Model } function all_enabled($userid) { - $sql = "select sp.station_callsign, group_concat(sp.station_id) as station_ids from station_profile sp + $sql = "select sp.station_callsign, group_concat(sp.station_id) as station_ids from station_profile sp inner join users u on (u.user_id=sp.user_id) where u.user_clublog_name is not null and u.user_clublog_password is not null and sp.clublogignore=0 and u.user_id=? group by sp.station_callsign"; @@ -312,4 +312,35 @@ class Clublog_model extends CI_Model return $this->db->get(); } + + function stations_with_clublog_enabled() { + $bindings=[]; + $sql = "SELECT station_profile.station_id, station_profile.station_profile_name, station_profile.station_callsign, modc.modcount, notc.notcount, totc.totcount + FROM station_profile + LEFT OUTER JOIN ( + SELECT count(*) modcount, station_id + FROM ". $this->config->item('table_name') . + " WHERE COL_CLUBLOG_QSO_UPLOAD_STATUS = 'M' + group by station_id + ) as modc on station_profile.station_id = modc.station_id + LEFT OUTER JOIN ( + SELECT count(*) notcount, station_id + FROM " . $this->config->item('table_name') . + " WHERE (coalesce(COL_CLUBLOG_QSO_UPLOAD_STATUS, '') = '' + or COL_CLUBLOG_QSO_UPLOAD_STATUS = 'N') + group by station_id + ) as notc on station_profile.station_id = notc.station_id + LEFT OUTER JOIN ( + SELECT count(*) totcount, station_id + FROM " . $this->config->item('table_name') . + " WHERE COL_CLUBLOG_QSO_UPLOAD_STATUS = 'Y' + group by station_id + ) as totc on station_profile.station_id = totc.station_id + WHERE coalesce(station_profile.clublogignore, 1) = 0 + AND station_profile.user_id = ?"; + $bindings[]=$this->session->userdata('user_id'); + $query = $this->db->query($sql, $bindings); + + return $query; + } } diff --git a/application/views/clublog/export.php b/application/views/clublog/export.php new file mode 100644 index 000000000..3065ce97c --- /dev/null +++ b/application/views/clublog/export.php @@ -0,0 +1,115 @@ + +
+ +

+ +
+
+ + +
+ +
+
+
+ ".__("The next automatic Upload to Clublog will happen at: ").$next_run_up."

"; } ?> +

+

+ config->item('disable_manual_clublog'))) { echo '

Warning This might take a while as QSO uploads are processed sequentially.

'; } ?> + +result()) { + echo ' + + + + + + + + + + + + '; + foreach ($station_profile->result() as $station) { // Fills the table with the data + echo ''; + echo ''; + echo ''; + echo ''; + echo ''; + echo ''; + if (!($this->config->item('disable_manual_clublog'))) { + echo ''; + } else { + echo ''; + } + echo ''; + } + echo '
' . __("Profile name") . '' . __("Station callsign") . '' . __("Edited QSOs not uploaded") . '' . __("Total QSOs not uploaded") . '' . __("Total QSOs uploaded") . '' . __("Actions") . '
' . $station->station_profile_name . '' . $station->station_callsign . '' . $station->modcount . '' . $station->notcount . '' . $station->totcount . ' 
'; + + } + else { + echo ''; + } + ?> + +
+ config->item('disable_manual_clublog'))) { ?> +
+ +
+ ".__("The next automatic Download from Clublog-QSLs will happen at: ").$next_run_down."

"; } ?> +

+
+
+ + +
+
+
+ +
+
+ +
+ +
+ +

+
+
+ + +
+ +
+ + +
+
+
+ +
+
+
+
+
+
diff --git a/application/views/interface_assets/header.php b/application/views/interface_assets/header.php index 6ef849ca2..8b14b3ffb 100644 --- a/application/views/interface_assets/header.php +++ b/application/views/interface_assets/header.php @@ -376,13 +376,13 @@ + session->userdata('user_type') === '99') { ?> @@ -471,6 +471,7 @@
  • +
  • @@ -593,7 +594,7 @@ - +