[Dashboard] Added VUCC

pull/1598/head
Andreas 2022-09-10 11:39:59 +02:00
rodzic 442fcc25ae
commit 7765740b02
3 zmienionych plików z 92 dodań i 1 usunięć

Wyświetl plik

@ -50,6 +50,7 @@ class Dashboard extends CI_Controller {
//
$this->load->model('cat');
$this->load->model('vucc');
$data['radio_status'] = $this->cat->recent_status();
@ -81,6 +82,8 @@ 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['page_title'] = "Dashboard";
$this->load->model('dxcc');

Wyświetl plik

@ -16,7 +16,7 @@ class VUCC extends CI_Model
}
/*
* Builds the array to display worked/confirmed vucc on awward page
* Builds the array to display worked/confirmed vucc on award page
*/
function fetchVucc($data) {
$totalGridConfirmed = array();
@ -329,5 +329,74 @@ class VUCC extends CI_Model
return $workedGridArray;
}
/*
* Builds the array to display worked/confirmed vucc on dashboard page
*/
function fetchVuccSummary() {
$totalGridConfirmed = array();
$totalGridWorked = array();
// Getting all the worked grids
$col_gridsquare_worked = $this->get_vucc_summary('All', 'none');
$workedGridArray = array();
foreach ($col_gridsquare_worked as $workedgrid) {
array_push($workedGridArray, $workedgrid['gridsquare']);
if(!in_array($workedgrid['gridsquare'], $totalGridWorked)){
array_push($totalGridWorked, $workedgrid['gridsquare']);
}
}
$col_vucc_grids_worked = $this->get_vucc_summary_col_vucc('All', 'none');
foreach ($col_vucc_grids_worked as $gridSplit) {
$grids = explode(",", $gridSplit['col_vucc_grids']);
foreach($grids as $key) {
$grid_four = strtoupper(substr(trim($key),0,4));
if(!in_array($grid_four, $workedGridArray)){
array_push($workedGridArray, $grid_four);
}
if(!in_array($grid_four, $totalGridWorked)){
array_push($totalGridWorked, $grid_four);
}
}
}
// Getting all the confirmed grids
$col_gridsquare_confirmed = $this->get_vucc_summary('All', 'both');
$confirmedGridArray = array();
foreach ($col_gridsquare_confirmed as $confirmedgrid) {
array_push($confirmedGridArray, $confirmedgrid['gridsquare']);
if(!in_array($confirmedgrid['gridsquare'], $totalGridConfirmed)){
array_push($totalGridConfirmed, $confirmedgrid['gridsquare']);
}
}
$col_vucc_grids_confirmed = $this->get_vucc_summary_col_vucc('All', 'both');
foreach ($col_vucc_grids_confirmed as $gridSplit) {
$grids = explode(",", $gridSplit['col_vucc_grids']);
foreach($grids as $key) {
$grid_four = strtoupper(substr(trim($key),0,4));
if(!in_array($grid_four, $confirmedGridArray)){
array_push($confirmedGridArray, $grid_four);
}
if(!in_array($grid_four, $totalGridConfirmed)){
array_push($totalGridConfirmed, $grid_four);
}
}
}
$vuccArray['All']['worked'] = count($totalGridWorked);
$vuccArray['All']['confirmed'] = count($totalGridConfirmed);
return $vuccArray;
}
}
?>

Wyświetl plik

@ -261,6 +261,25 @@ function echoQrbCalcLink($mygrid, $grid, $vucc) {
</tr>
</table>
<?php } ?>
<?php if((($this->config->item('use_auth') && ($this->session->userdata('user_type') >= 2)) || $this->config->item('use_auth') === FALSE)) { ?>
<table class="table table-striped">
<tr class="titles">
<td colspan="2"><i class="fas fa-globe-europe"></i> VHF/UHF Century Club (VUCC)</td>
</tr>
<tr>
<td width="50%">Worked</td>
<td width="50%"><?php echo $vucc['All']['worked']; ?></td>
</tr>
<tr>
<td width="50%">Confirmed</td>
<td width="50%"><?php echo $vucc['All']['confirmed']; ?></td>
</tr>
</table>
<?php } ?>
</div>
</div>
</div>