diff --git a/application/controllers/Dashboard.php b/application/controllers/Dashboard.php index e74ceda30..191ce2046 100644 --- a/application/controllers/Dashboard.php +++ b/application/controllers/Dashboard.php @@ -1,9 +1,7 @@ user_options_model->get_options( - 'dashboard', - array('option_name' => 'last_qso_count', 'option_key' => 'count'), - $this->uri->segment(3) - )->result(); - if (count($last_qso_count_opt) > 0) { - // value found in user options - use it - $last_qso_count = $last_qso_count_opt[0]->option_value; - } else { - // value not found in user options - use default value - $last_qso_count = \Dashboard::DEFAULT_QSOS_COUNT; - } - $data['last_qsos_list'] = $this->logbook_model->get_last_qsos($last_qso_count, $logbooks_locations_array); + $data['last_five_qsos'] = $this->logbook_model->get_last_qsos('18', $logbooks_locations_array); $data['vucc'] = $this->vucc->fetchVuccSummary(); $data['vuccSAT'] = $this->vucc->fetchVuccSummary('SAT'); diff --git a/application/controllers/Qso.php b/application/controllers/Qso.php index 1f6256526..fbe2b8f69 100644 --- a/application/controllers/Qso.php +++ b/application/controllers/Qso.php @@ -2,8 +2,6 @@ class QSO extends CI_Controller { - const LAST_QSOS_COUNT = 5; // max number of most recent qsos to be displayed on a qso page - function __construct() { parent::__construct(); @@ -36,7 +34,7 @@ class QSO extends CI_Controller { $data['stations'] = $this->stations->all_of_user(); $data['radios'] = $this->cat->radios(true); $data['radio_last_updated'] = $this->cat->last_updated()->row(); - $data['query'] = $this->logbook_model->last_custom(self::LAST_QSOS_COUNT); + $data['query'] = $this->logbook_model->last_custom('5'); $data['dxcc'] = $this->logbook_model->fetchDxcc(); $data['iota'] = $this->logbook_model->fetchIota(); $data['modes'] = $this->modes->active(); @@ -603,7 +601,7 @@ class QSO extends CI_Controller { $this->load->model('logbook_model'); session_write_close(); - $data['query'] = $this->logbook_model->last_custom(self::LAST_QSOS_COUNT); + $data['query'] = $this->logbook_model->last_custom('5'); // Load view $this->load->view('qso/components/previous_contacts', $data); diff --git a/application/controllers/User.php b/application/controllers/User.php index a053ec7ab..af67c9b24 100644 --- a/application/controllers/User.php +++ b/application/controllers/User.php @@ -1,7 +1,5 @@ form_validation->set_rules('user_email', 'E-mail', 'required'); $this->form_validation->set_rules('user_password', 'Password', 'required'); $this->form_validation->set_rules('user_type', 'Type', 'required'); + // $this->form_validation->set_rules('user_firstname', 'First name', 'required'); + // $this->form_validation->set_rules('user_lastname', 'Last name', 'required'); $this->form_validation->set_rules('user_callsign', 'Callsign', 'required'); $this->form_validation->set_rules('user_locator', 'Locator', 'required'); $this->form_validation->set_rules('user_locator', 'Locator', 'callback_check_locator'); @@ -373,14 +373,10 @@ class User extends CI_Controller { // Get timezones $data['timezones'] = $this->user_model->timezones(); - // Max value to be present in the "dashboard last QSO count" selectbox - $data['dashboard_last_qso_count_limit'] = \Dashboard::MAX_QSOS_COUNT_LIMIT; - - $data['page_title'] = __("Edit User"); - if ($this->form_validation->run() == FALSE) { - // Prepare data and render the user options view + $data['page_title'] = __("Edit User"); + $q = $query->row(); $data['id'] = $q->user_id; @@ -756,29 +752,10 @@ class User extends CI_Controller { $data['user_locations_quickswitch'] = ($this->user_options_model->get_options('header_menu', array('option_name'=>'locations_quickswitch'), $this->uri->segment(3))->row()->option_value ?? 'false'); $data['user_utc_headermenu'] = ($this->user_options_model->get_options('header_menu', array('option_name'=>'utc_headermenu'), $this->uri->segment(3))->row()->option_value ?? 'false'); - if($this->input->post('user_dashboard_last_qso_count', true)) { - $data['user_dashboard_last_qso_count'] = $this->input->post('user_dashboard_last_qso_count', true); - } else { - // Determine last (recent) QSO count to preselect into the selectbox - $last_qso_count_opt = $this->user_options_model->get_options( - 'dashboard', - array('option_name' => 'last_qso_count', 'option_key' => 'count'), - $this->uri->segment(3) - )->result(); - if (count($last_qso_count_opt) > 0) { - // value found in user options - use it - $data['user_dashboard_last_qso_count'] = $last_qso_count_opt[0]->option_value; - } else { - // value not found in user options - use default value - $data['user_dashboard_last_qso_count'] = \Dashboard::DEFAULT_QSOS_COUNT; - } - } - $this->load->view('interface_assets/header', $data); $this->load->view('user/edit', $data); $this->load->view('interface_assets/footer', $footerData); } else { - // Data was submitted for saving - save updated options in DB unset($data); switch($this->user_model->edit($this->input->post())) { // Check for errors @@ -831,6 +808,7 @@ class User extends CI_Controller { } return; } + $data['page_title'] = __("Edit User"); $this->load->view('interface_assets/header', $data); $data['user_name'] = $this->input->post('user_name', true); @@ -869,7 +847,6 @@ class User extends CI_Controller { $data['user_winkey'] = $this->input->post('user_winkey'); $data['user_hamsat_key'] = $this->input->post('user_hamsat_key'); $data['user_hamsat_workable_only'] = $this->input->post('user_hamsat_workable_only'); - $data['user_dashboard_last_qso_count'] = $this->input->post('user_dashboard_last_qso_count', true); $this->load->view('user/edit'); $this->load->view('interface_assets/footer'); } diff --git a/application/controllers/Widgets.php b/application/controllers/Widgets.php index 9b207a5b6..4bf1fa2e0 100644 --- a/application/controllers/Widgets.php +++ b/application/controllers/Widgets.php @@ -8,17 +8,14 @@ class Widgets extends CI_Controller { - const LAST_QSOS_COUNT = 15; // number of of qsos to be displayed in the last qsos widget - const LAST_QSOS_MAX_LIMIT = 40; // if user requests more than this limit, qsos will be capped to this number - public function index() { // Show a help page } - // Can be used to embed last self::LAST_QSOS_COUNT QSOs in a iframe or javascript include. - public function qsos($logbook_slug = null, $qso_count = self::LAST_QSOS_COUNT) { + // Can be used to embed last 11 QSOs in a iframe or javascript include. + public function qsos($logbook_slug = null) { if($logbook_slug == null) { show_error(__("Unknown Public Page, please make sure the public slug is correct.")); @@ -43,14 +40,7 @@ class Widgets extends CI_Controller { show_404(__("Unknown Public Page.")); } - if ($qso_count > self::LAST_QSOS_MAX_LIMIT) { - $qso_count = self::LAST_QSOS_MAX_LIMIT; - } - - $data['last_qsos_list'] = $this->logbook_model->get_last_qsos( - $qso_count, - $logbooks_locations_array, - ); + $data['last_five_qsos'] = $this->logbook_model->get_last_qsos(15, $logbooks_locations_array); $this->load->view('widgets/qsos', $data); } diff --git a/application/models/Logbook_model.php b/application/models/Logbook_model.php index 7640426a1..ff9234b62 100644 --- a/application/models/Logbook_model.php +++ b/application/models/Logbook_model.php @@ -1564,6 +1564,19 @@ class Logbook_model extends CI_Model { $this->db->update($this->config->item('table_name'), $data); } + /* Return last 10 QSOs */ + function last_ten() { + $this->load->model('logbooks_model'); + $logbooks_locations_array = $this->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook')); + + $this->db->select('COL_CALL, COL_BAND, COL_FREQ, COL_TIME_ON, COL_RST_RCVD, COL_RST_SENT, COL_MODE, COL_SUBMODE, COL_NAME, COL_COUNTRY, COL_PRIMARY_KEY, COL_SAT_NAME'); + $this->db->where_in('station_id', $logbooks_locations_array); + $this->db->order_by("COL_TIME_ON", "desc"); + $this->db->limit(10); + + return $this->db->get($this->config->item('table_name')); + } + /* Show custom number of qsos */ function last_custom($num) { $this->load->model('logbooks_model'); diff --git a/application/models/User_model.php b/application/models/User_model.php index ce8d82e0c..23aa6df9b 100644 --- a/application/models/User_model.php +++ b/application/models/User_model.php @@ -1,7 +1,5 @@ xss_clean($fields['user_winkey']), ); - // Hard limit for last (recent) QSO count setting - $dashboard_last_qso_count = xss_clean($fields['user_dashboard_last_qso_count']); - $dashboard_last_qso_count = $dashboard_last_qso_count > \Dashboard::MAX_QSOS_COUNT_LIMIT ? \Dashboard::MAX_QSOS_COUNT_LIMIT : $dashboard_last_qso_count; - $this->db->query("replace into user_options (user_id, option_type, option_name, option_key, option_value) values (" . $fields['id'] . ", 'hamsat','hamsat_key','api','".xss_clean($fields['user_hamsat_key'])."');"); $this->db->query("replace into user_options (user_id, option_type, option_name, option_key, option_value) values (" . $fields['id'] . ", 'hamsat','hamsat_key','workable','".xss_clean($fields['user_hamsat_workable_only'])."');"); $this->db->query("replace into user_options (user_id, option_type, option_name, option_key, option_value) values (" . $fields['id'] . ", 'qso_tab','iota','show',".(xss_clean($fields['user_iota_to_qso_tab'] ?? 'off') == "on" ? 1 : 0).");"); @@ -339,7 +333,6 @@ class User_Model extends CI_Model { $this->db->query("replace into user_options (user_id, option_type, option_name, option_key, option_value) values (" . $fields['id'] . ", 'qso_tab','pota','show',".(xss_clean($fields['user_pota_to_qso_tab'] ?? 'off') == "on" ? 1 : 0).");"); $this->db->query("replace into user_options (user_id, option_type, option_name, option_key, option_value) values (" . $fields['id'] . ", 'qso_tab','sig','show',".(xss_clean($fields['user_sig_to_qso_tab'] ?? 'off') == "on" ? 1 : 0).");"); $this->db->query("replace into user_options (user_id, option_type, option_name, option_key, option_value) values (" . $fields['id'] . ", 'qso_tab','dok','show',".(xss_clean($fields['user_dok_to_qso_tab'] ?? 'off') == "on" ? 1 : 0).");"); - $this->db->query("replace into user_options (user_id, option_type, option_name, option_key, option_value) values (" . $fields['id'] . ", 'dashboard','last_qso_count','count','".$dashboard_last_qso_count."');"); // Check to see if the user is allowed to change user levels if($this->session->userdata('user_type') == 99) { diff --git a/application/views/dashboard/index.php b/application/views/dashboard/index.php index 4bd5a2bcb..735edb8a7 100644 --- a/application/views/dashboard/index.php +++ b/application/views/dashboard/index.php @@ -214,7 +214,7 @@ function getDistance($distance) {
- +
@@ -235,8 +235,8 @@ function getDistance($distance) { 0) { - foreach ($last_qsos_list->result() as $row) { ?> + if(!empty($last_five_qsos) > 0) { + foreach ($last_five_qsos->result() as $row) { ?> COL_PRIMARY_KEY.'" class="tr'.($i & 1).'">'; ?>
- - user_options_model->get_options( - 'dashboard', - array('option_name' => 'last_qso_count', 'option_key' => 'count'), - $this->uri->segment(3) - )->result(); - if (count($last_qso_count_opt) > 0) { - // value found in user options - use it - $last_qso_count = $last_qso_count_opt[0]->option_value; - } else { - // value not found in user options - use default value - $last_qso_count = \Dashboard::DEFAULT_QSOS_COUNT; - } - ?> - -
diff --git a/application/views/interface_assets/footer.php b/application/views/interface_assets/footer.php index 6079305f9..1a0ce412e 100644 --- a/application/views/interface_assets/footer.php +++ b/application/views/interface_assets/footer.php @@ -830,24 +830,7 @@ function showActivatorsMap(call, count, grids) { var grid = "No"; - - user_options_model->get_options( - 'dashboard', - array('option_name' => 'last_qso_count', 'option_key' => 'count'), - $this->uri->segment(3) - )->result(); - if (count($last_qso_count_opt) > 0) { - // value found in user options - use it - $last_qso_count = $last_qso_count_opt[0]->option_value; - } else { - // value not found in user options - use default value - $last_qso_count = \Dashboard::DEFAULT_QSOS_COUNT; - } - ?> - - initmap(grid,'map',{'dataPost':{'nb_qso': dashboard_qso_count}}); + initmap(grid,'map',{'dataPost':{'nb_qso':'18'}}); $('#firstLoginWizardModal').modal('show'); diff --git a/application/views/qso/index.php b/application/views/qso/index.php index 254165e96..799d322f5 100644 --- a/application/views/qso/index.php +++ b/application/views/qso/index.php @@ -776,7 +776,7 @@
- + diff --git a/application/views/user/edit.php b/application/views/user/edit.php index 33607edd1..3e6b5c17d 100644 --- a/application/views/user/edit.php +++ b/application/views/user/edit.php @@ -487,9 +487,9 @@ + session->userdata('user_id') == $this->uri->segment(3)) { ?>
-
@@ -564,23 +564,6 @@
- -
-
-
-
-
- - -
-
-
-
diff --git a/application/views/widgets/qsos.php b/application/views/widgets/qsos.php index 832b75a76..2391ed7f8 100644 --- a/application/views/widgets/qsos.php +++ b/application/views/widgets/qsos.php @@ -45,7 +45,7 @@ } $i = 0; - foreach ($last_qsos_list->result() as $row) { ?> + foreach ($last_five_qsos->result() as $row) { ?> '; ?> COL_TIME_ON); echo date($custom_date_format, $timestamp); ?>