[Dashboard|User] Control over what cards are shown on the dashboard

pull/3018/head
Peter Goodhall 2024-03-19 14:38:33 +00:00
rodzic 7f48eb7140
commit abda7fb663
4 zmienionych plików z 1249 dodań i 727 usunięć

Wyświetl plik

@ -89,6 +89,64 @@ class Dashboard extends CI_Controller
$data['total_countries_confirmed_eqsl'] = $CountriesBreakdown['Countries_Worked_EQSL'];
$data['total_countries_confirmed_lotw'] = $CountriesBreakdown['Countries_Worked_LOTW'];
$data['dashboard_upcoming_dx_card'] = false;
$data['dashboard_qslcard_card'] = false;
$data['dashboard_eqslcard_card'] = false;
$data['dashboard_lotw_card'] = false;
$data['dashboard_vuccgrids_card'] = false;
$dashboard_options = $this->user_options_model->get_options('dashboard')->result();
foreach ($dashboard_options as $item) {
$option_name = $item->option_name;
$option_key = $item->option_key;
$option_value = $item->option_value;
if ($option_name == 'dashboard_upcoming_dx_card' && $option_key == 'enabled') {
if($option_value == 'true') {
$data['dashboard_upcoming_dx_card'] = true;
} else {
$data['dashboard_upcoming_dx_card'] = false;
}
}
if ($option_name == 'dashboard_qslcards_card' && $option_key == 'enabled') {
if($item->option_value == 'true') {
$data['dashboard_qslcard_card'] = true;
} else {
$data['dashboard_qslcard_card'] = false;
}
}
if ($option_name == 'dashboard_eqslcards_card' && $option_key == 'enabled') {
if($item->option_value == 'true') {
$data['dashboard_eqslcard_card'] = true;
} else {
$data['dashboard_eqslcard_card'] = false;
}
}
if ($option_name == 'dashboard_lotw_card' && $option_key == 'enabled') {
if($item->option_value == 'true') {
$data['dashboard_lotw_card'] = true;
} else {
$data['dashboard_lotw_card'] = false;
}
}
if ($option_name == 'dashboard_vuccgrids_card' && $option_key == 'enabled') {
if($item->option_value == 'true') {
$data['dashboard_vuccgrids_card'] = true;
$data['vucc'] = $this->vucc->fetchVuccSummary();
$data['vuccSAT'] = $this->vucc->fetchVuccSummary('SAT');
} else {
$data['dashboard_vuccgrids_card'] = false;
}
}
}
$QSLStatsBreakdownArray = $this->logbook_model->get_QSLStats($logbooks_locations_array);
$data['total_qsl_sent'] = $QSLStatsBreakdownArray['QSL_Sent'];
@ -115,9 +173,6 @@ class Dashboard extends CI_Controller
$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');
$data['page_title'] = "Dashboard";
$this->load->model('dxcc');

Wyświetl plik

@ -519,6 +519,63 @@ class User extends CI_Controller {
}
}
// Get Settings for Dashboard
// Set defaults
$data['dashboard_upcoming_dx_card'] = false;
$data['dashboard_qslcard_card'] = false;
$data['dashboard_eqslcard_card'] = false;
$data['dashboard_lotw_card'] = false;
$data['dashboard_vuccgrids_card'] = false;
$dashboard_options = $this->user_options_model->get_options('dashboard')->result();
foreach ($dashboard_options as $item) {
$option_name = $item->option_name;
$option_key = $item->option_key;
$option_value = $item->option_value;
if ($option_name == 'dashboard_upcoming_dx_card' && $option_key == 'enabled') {
if($item->option_value == 'true') {
$data['dashboard_upcoming_dx_card'] = true;
} else {
$data['dashboard_upcoming_dx_card'] = false;
}
}
if ($option_name == 'dashboard_qslcards_card' && $option_key == 'enabled') {
if($item->option_value == 'true') {
$data['dashboard_qslcard_card'] = true;
} else {
$data['dashboard_qslcard_card'] = false;
}
}
if ($option_name == 'dashboard_eqslcards_card' && $option_key == 'enabled') {
if($item->option_value == 'true') {
$data['dashboard_eqslcard_card'] = true;
} else {
$data['dashboard_eqslcard_card'] = false;
}
}
if ($option_name == 'dashboard_lotw_card' && $option_key == 'enabled') {
if($item->option_value == 'true') {
$data['dashboard_lotw_card'] = true;
} else {
$data['dashboard_lotw_card'] = false;
}
}
if ($option_name == 'dashboard_vuccgrids_card' && $option_key == 'enabled') {
if($item->option_value == 'true') {
$data['dashboard_vuccgrids_card'] = true;
} else {
$data['dashboard_vuccgrids_card'] = false;
}
}
}
// [MAP Custom] GET user options //
$this->load->model('user_options_model');
$options_object = $this->user_options_model->get_options('map_custom')->result();
@ -581,6 +638,36 @@ class User extends CI_Controller {
$this->input->set_cookie($cookie);
}
if($this->session->userdata('user_id') == $this->input->post('id', true)) {
if (isset($_POST['user_dashboard_enable_dxpedition_card'])) {
$this->user_options_model->set_option('dashboard', 'dashboard_upcoming_dx_card', array('enabled' => 'true'));
} else {
$this->user_options_model->set_option('dashboard', 'dashboard_upcoming_dx_card', array('enabled' => 'false'));
}
if (isset($_POST['user_dashboard_enable_qslcards_card'])) {
$this->user_options_model->set_option('dashboard', 'dashboard_qslcards_card', array('enabled' => 'true'));
} else {
$this->user_options_model->set_option('dashboard', 'dashboard_qslcards_card', array('enabled' => 'false'));
}
if (isset($_POST['user_dashboard_enable_eqslcards_card'])) {
$this->user_options_model->set_option('dashboard', 'dashboard_eqslcards_card', array('enabled' => 'true'));
} else {
$this->user_options_model->set_option('dashboard', 'dashboard_eqslcards_card', array('enabled' => 'false'));
}
if (isset($_POST['user_dashboard_enable_lotw_card'])) {
$this->user_options_model->set_option('dashboard', 'dashboard_lotw_card', array('enabled' => 'true'));
} else {
$this->user_options_model->set_option('dashboard', 'dashboard_lotw_card', array('enabled' => 'false'));
}
if (isset($_POST['user_dashboard_enable_vuccgrids_card'])) {
$this->user_options_model->set_option('dashboard', 'dashboard_vuccgrids_card', array('enabled' => 'true'));
} else {
$this->user_options_model->set_option('dashboard', 'dashboard_vuccgrids_card', array('enabled' => 'false'));
}
// [MAP Custom] ADD to user options //
$array_icon = array('station','qso','qsoconfirm');
foreach ($array_icon as $icon) {
@ -608,7 +695,6 @@ 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);
$data['user_email'] = $this->input->post('user_email', true);
@ -644,6 +730,9 @@ 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');
$this->load->view('user/edit');
$this->load->view('interface_assets/footer');
}

Wyświetl plik

@ -296,8 +296,10 @@ function echoQrbCalcLink($mygrid, $grid, $vucc)
<div id="radio_display" hx-get="<?php echo site_url('visitor/radio_display_component'); ?>" hx-trigger="load, every 5s"></div>
<div>
<div id="upcoming_dxccs_component" hx-get="<?php echo site_url('dashboard/upcoming_dxcc_component'); ?>" hx-trigger="load" hx-indicator="#loading_upcoming_dxcc"></div>
<div id="loading_upcoming_dxcc" style="display: none;">Loading Upcoming DXPeditions.</div>
<?php if ($dashboard_upcoming_dx_card != false) { ?>
<div id="upcoming_dxccs_component" hx-get="<?php echo site_url('dashboard/upcoming_dxcc_component'); ?>" hx-trigger="load" hx-indicator="#loading_upcoming_dxcc"></div>
<div id="loading_upcoming_dxcc" style="display: none;">Loading Upcoming DXPeditions.</div>
<?php } ?>
</div>
<table class="table table-striped border-top">
<tr class="titles">
@ -345,7 +347,8 @@ function echoQrbCalcLink($mygrid, $grid, $vucc)
<td width="50%"><?php echo $total_countries_needed; ?></td>
</tr>
</table>
<?php if ($dashboard_qslcard_card != false) { ?>
<?php if ((($this->config->item('use_auth') && ($this->session->userdata('user_type') >= 2)) || $this->config->item('use_auth') === FALSE) && ($total_qsl_sent != 0 || $total_qsl_rcvd != 0 || $total_qsl_requested != 0)) { ?>
<table class="table table-striped border-top">
<tr class="titles">
@ -372,7 +375,9 @@ function echoQrbCalcLink($mygrid, $grid, $vucc)
</tr>
</table>
<?php } ?>
<?php } ?>
<?php if ($dashboard_eqslcard_card != false) { ?>
<?php if ((($this->config->item('use_auth') && ($this->session->userdata('user_type') >= 2)) || $this->config->item('use_auth') === FALSE) && ($total_eqsl_sent != 0 || $total_eqsl_rcvd != 0)) { ?>
<table class="table table-striped border-top">
<tr class="titles">
@ -393,7 +398,9 @@ function echoQrbCalcLink($mygrid, $grid, $vucc)
</tr>
</table>
<?php } ?>
<?php } ?>
<?php if ($dashboard_lotw_card != false) { ?>
<?php if ((($this->config->item('use_auth') && ($this->session->userdata('user_type') >= 2)) || $this->config->item('use_auth') === false) && ($total_lotw_sent != 0 || $total_lotw_rcvd != 0)) { ?>
<table class="table table-striped border-top">
<tr class="titles">
@ -414,6 +421,7 @@ function echoQrbCalcLink($mygrid, $grid, $vucc)
</tr>
</table>
<?php } ?>
<?php } ?>
<?php if ((($this->config->item('use_auth') && ($this->session->userdata('user_type') >= 2)) || $this->config->item('use_auth') === false) && ($total_qrz_sent != 0 || $total_qrz_rcvd != 0)) { ?>
<table class="table table-striped border-top">
@ -436,6 +444,7 @@ function echoQrbCalcLink($mygrid, $grid, $vucc)
</table>
<?php } ?>
<?php if ($dashboard_vuccgrids_card != false) { ?>
<?php if ((($this->config->item('use_auth') && ($this->session->userdata('user_type') >= 2)) || $this->config->item('use_auth') === FALSE)) { ?>
<table class="table table-striped border-top">
<tr class="titles">
@ -457,6 +466,7 @@ function echoQrbCalcLink($mygrid, $grid, $vucc)
</table>
<?php } ?>
<?php } ?>
</div>
</div>
</div>