Merge pull request #1932 from phl0/reworkDOKstats

Rework DOK stats and add some eye candy
pull/1942/head
Andreas Kristiansen 2023-01-18 09:57:16 +01:00 zatwierdzone przez GitHub
commit 5ca3ea2d7e
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 4AEE18F83AFDEB23
5 zmienionych plików z 498 dodań i 120 usunięć

Wyświetl plik

@ -31,17 +31,63 @@ class Awards extends CI_Controller {
public function dok ()
{
$CI =& get_instance();
$CI->load->model('logbooks_model');
$logbooks_locations_array = $CI->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook'));
$this->load->model('dok');
$this->load->model('bands');
$this->load->model('modes');
if($this->input->method() === 'post') {
$postdata['doks'] = $this->input->post('doks');
} else {
$postdata['doks'] = 'both';
}
$data['doks'] = $this->dok->show_stats($postdata);
$data['worked_bands'] = $this->bands->get_worked_bands_dok(); // Used in the view for band select
$data['worked_bands'] = $this->bands->get_worked_bands('dok');
$data['modes'] = $this->modes->active();
if ($this->input->post('band') != NULL) {
if ($this->input->post('band') == 'All') {
$bands = $data['worked_bands'];
} else {
$bands[] = $this->input->post('band');
}
} else {
$bands = $data['worked_bands'];
}
$data['bands'] = $bands;
if($this->input->method() === 'post') {
$postdata['qsl'] = $this->input->post('qsl');
$postdata['lotw'] = $this->input->post('lotw');
$postdata['eqsl'] = $this->input->post('eqsl');
$postdata['worked'] = $this->input->post('worked');
$postdata['confirmed'] = $this->input->post('confirmed');
$postdata['band'] = $this->input->post('band');
$postdata['mode'] = $this->input->post('mode');
} else {
$postdata['qsl'] = 1;
$postdata['lotw'] = 1;
$postdata['eqsl'] = 0;
$postdata['worked'] = 1;
$postdata['confirmed'] = 1;
$postdata['band'] = 'All';
$postdata['mode'] = 'All';
}
if ($logbooks_locations_array) {
$location_list = "'".implode("','",$logbooks_locations_array)."'";
$data['dok_array'] = $this->dok->get_dok_array($bands, $postdata, $location_list);
$data['dok_summary'] = $this->dok->get_dok_summary($bands, $postdata, $location_list);
} else {
$location_list = null;
$data['dok_array'] = null;
$data['dok_summary'] = null;
}
// Render Page
$data['page_title'] = "Awards - DOK";
@ -66,9 +112,6 @@ class Awards extends CI_Controller {
$arguments["order"] = '';
$arguments["join_station_profile"] = true;
// print_r($arguments);
// return;
// Load the API and Logbook models
$this->load->model('api_model');
$this->load->model('logbook_model');
@ -81,7 +124,7 @@ class Awards extends CI_Controller {
// Render Page
$data['page_title'] = "Log View - DOK";
$data['filter'] = str_replace("(and)", ", ", $q);//implode(", ", array_keys($a));
$data['filter'] = str_replace("(and)", ", ", $q);
$this->load->view('awards/details', $data);
}
@ -206,8 +249,9 @@ class Awards extends CI_Controller {
$band = str_replace('"', "", $this->input->post("Band"));
$mode = str_replace('"', "", $this->input->post("Mode"));
$type = $this->input->post('Type');
$qsl = $this->input->post('QSL') == null ? '' : $this->input->post('QSL');
$data['results'] = $this->logbook_model->qso_details($searchphrase, $band, $mode, $type);
$data['results'] = $this->logbook_model->qso_details($searchphrase, $band, $mode, $type, $qsl);
// This is done because we have two different ways to get dxcc info in Cloudlog. Once is using the name (in awards), and the other one is using the ADIF DXCC.
// We replace the values to make it look a bit nicer
@ -217,9 +261,23 @@ class Awards extends CI_Controller {
$searchphrase = $dxccname['name'];
}
$qsltype = [];
if (strpos($qsl, "Q") !== false) {
$qsltype[] = "QSL";
}
if (strpos($qsl, "L") !== false) {
$qsltype[] = "LotW";
}
if (strpos($qsl, "E") !== false) {
$qsltype[] = "eQSL";
}
// Render Page
$data['page_title'] = "Log View - " . $type;
$data['filter'] = $type . " " . $searchphrase . " and band ".$band . " and mode ".$mode;
if (!empty($qsltype)) {
$data['filter'] .= " and ".implode('/', $qsltype);
}
$this->load->view('awards/details', $data);
}
@ -733,4 +791,4 @@ class Awards extends CI_Controller {
}
}
}
}
}

Wyświetl plik

@ -2,93 +2,250 @@
class DOK extends CI_Model {
function show_stats($postdata) {
$CI =& get_instance();
$CI->load->model('logbooks_model');
$logbooks_locations_array = $CI->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook'));
function get_dok_array($bands, $postdata, $location_list) {
$doks = array();
if (!$logbooks_locations_array) {
return null;
$list = $this->getDoksFromDB($location_list);
foreach ($this->getSdoksFromDB($location_list) as $sdok) {
$list[] = $sdok;
}
foreach ($list as $dok) {
$doks[$dok->COL_DARC_DOK]['count'] = 0;
}
$this->load->model('bands');
$qsl = "";
if ($postdata['confirmed'] != NULL) {
if ($postdata['qsl'] != NULL ) {
$qsl .= "Q";
}
if ($postdata['lotw'] != NULL ) {
$qsl .= "L";
}
if ($postdata['eqsl'] != NULL ) {
$qsl .= "E";
}
}
$location_list = "'".implode("','",$logbooks_locations_array)."'";
$sql = "select upper(COL_DARC_DOK) as COL_DARC_DOK, COL_MODE, lcase(COL_BAND) as COL_BAND, count(COL_DARC_DOK) as cnt from ".$this->config->item('table_name')." WHERE station_id in (" . $location_list . ") AND COL_DARC_DOK IS NOT NULL AND COL_DARC_DOK != '' AND COL_DXCC = 230";
foreach ($bands as $band) {
foreach ($list as $dok) {
$bandDok[$dok->COL_DARC_DOK][$band] = '-';
}
if ($postdata['worked'] != NULL) {
$dokBand = $this->getDokWorked($location_list, $band, $postdata);
foreach ($dokBand as $line) {
if (array_key_exists($line->COL_DARC_DOK, $bandDok)) { /* For now ignore DOKs which are logged but not existing in the official lists any more */
$bandDok[$line->COL_DARC_DOK][$band] = '<div class="alert-danger"><a href=\'javascript:displayContacts("' . $line->COL_DARC_DOK . '","' . $band . '","' . $postdata['mode'] . '","DOK", "")\'>W</a></div>';
$doks[$line->COL_DARC_DOK]['count']++;
}
}
}
if ($postdata['confirmed'] != NULL) {
$dokBand = $this->getDokConfirmed($location_list, $band, $postdata);
foreach ($dokBand as $line) {
if (array_key_exists($line->COL_DARC_DOK, $bandDok)) { /* For now ignore DOKs which are logged but not existing in the official lists any more */
$bandDok[$line->COL_DARC_DOK][$band] = '<div class="alert-success"><a href=\'javascript:displayContacts("' . $line->COL_DARC_DOK . '","' . $band . '","' . $postdata['mode'] . '","DOK", "'.$qsl.'")\'>C</a></div>';
$doks[$line->COL_DARC_DOK]['count']++;
}
}
}
// We want to remove the worked DOKs in the list, since we do not want to display them
if ($postdata['worked'] == NULL) {
$dokBand = $this->getDokWorked($location_list, $postdata['band'], $postdata);
foreach ($dokBand as $line) {
unset($bandDok[$line->COL_DARC_DOK]);
}
}
// We want to remove the worked DOKs in the list, since we do not want to display them
if ($postdata['confirmed'] == NULL) {
$dokBand = $this->getDokConfirmed($location_list, $postdata['band'], $postdata);
foreach ($dokBand as $line) {
unset($bandDok[$line->COL_DARC_DOK]);
}
}
}
foreach ($list as $dok) {
if($doks[$dok->COL_DARC_DOK]['count'] == 0) {
unset($bandDok[$dok->COL_DARC_DOK]);
}
}
// We want to hide NM as marking not having a DOK at all
if (isset($bandDok['NM'])) {
unset($bandDok['NM']);
}
if (isset($bandDok)) {
return $bandDok;
} else {
return 0;
}
}
function getDokWorked($location_list, $band, $postdata) {
$sql = "SELECT DISTINCT COL_DARC_DOK FROM " . $this->config->item('table_name') . " thcv
WHERE station_id IN (" . $location_list . ") AND COL_DARC_DOK <> '' AND COL_DARC_DOK <> 'NM'";
if ($postdata['mode'] != 'All') {
$sql .= " AND (COL_MODE = '" . $postdata['mode'] . "' OR COL_SUBMODE = '" . $postdata['mode'] . "')";
}
$sql .= $this->addDokTypeToQuery($postdata['doks']);
$sql .= $this->addBandToQuery($band);
$sql .= " AND NOT EXISTS (SELECT 1 from " . $this->config->item('table_name') .
" WHERE station_id in (" . $location_list .
") AND COL_DARC_DOK = thcv.COL_DARC_DOK AND COL_DARC_DOK <> '' AND COL_DARC_DOK <> 'NM' ";
$sql .= $this->addDokTypeToQuery($postdata['doks']);
$sql .= $this->addBandToQuery($band);
$sql .= $this->addQslToQuery($postdata);
$sql .= ")";
$query = $this->db->query($sql);
return $query->result();
}
function getDokConfirmed($location_list, $band, $postdata) {
$sql = "SELECT DISTINCT COL_DARC_DOK FROM " . $this->config->item('table_name') . " thcv
WHERE station_id IN (" . $location_list . ") AND COL_DARC_DOK <> '' AND COL_DARC_DOK <> '' AND COL_DARC_DOK <> 'NM'";
if ($postdata['mode'] != 'All') {
$sql .= " AND (COL_MODE = '" . $postdata['mode'] . "' or COL_SUBMODE = '" . $postdata['mode'] . "')";
}
$sql .= $this->addDokTypeToQuery($postdata['doks']);
$sql .= $this->addBandToQuery($band);
$sql .= $this->addQslToQuery($postdata);
$query = $this->db->query($sql);
return $query->result();
}
function addQslToQuery($postdata) {
$sql = '';
$qsl = array();
if ($postdata['lotw'] != NULL || $postdata['qsl'] != NULL || $postdata['eqsl'] != NULL) {
$sql .= 'and (';
if ($postdata['qsl'] != NULL) {
array_push($qsl, "col_qsl_rcvd = 'Y'");
}
if ($postdata['lotw'] != NULL) {
array_push($qsl, "col_lotw_qsl_rcvd = 'Y'");
}
if ($postdata['eqsl'] != NULL) {
array_push($qsl, "col_eqsl_qsl_rcvd = 'Y'");
}
$sql .= implode(' or ', $qsl);
$sql .= ')';
}
return $sql;
}
function addBandToQuery($band) {
$sql = '';
if ($band != 'All') {
if ($band == 'SAT') {
$sql .= " AND COL_PROP_MODE ='" . $band . "'";
} else {
$sql .= " AND COL_PROP_MODE !='SAT'";
$sql .= " AND col_BAND ='" . $band . "'";
}
}
return $sql;
}
function addDokTypeToQuery($doks) {
$sql = '';
if ($doks == 'dok') {
$sql .= " AND COL_DARC_DOK REGEXP '^[A-Z][0-9]{2}$'";
} else if ($doks == 'sdok') {
$sql .= " AND COL_DARC_DOK NOT REGEXP '^[A-Z][0-9]{2}$'";
}
return $sql;
}
function get_dok_summary($bands, $postdata, $location_list) {
foreach ($bands as $band) {
$worked = $this->getSummaryByBand($band, $postdata, $location_list);
$confirmed = $this->getSummaryByBandConfirmed($band, $postdata, $location_list);
$dokSummary['worked'][$band] = $worked[0]->count;
$dokSummary['confirmed'][$band] = $confirmed[0]->count;
}
$workedTotal = $this->getSummaryByBand($postdata['band'], $postdata, $location_list);
$confirmedTotal = $this->getSummaryByBandConfirmed($postdata['band'], $postdata, $location_list);
$dokSummary['worked']['Total'] = $workedTotal[0]->count;
$dokSummary['confirmed']['Total'] = $confirmedTotal[0]->count;
return $dokSummary;
}
function getSummaryByBand($band, $postdata, $location_list) {
$sql = "SELECT count(distinct thcv.COL_DARC_DOK) AS count FROM " . $this->config->item('table_name') . " thcv";
$sql .= " WHERE station_id IN (" . $location_list . ') AND COL_DARC_DOK != "" AND COL_DARC_DOK <> "NM"';
if ($band == 'SAT') {
$sql .= " AND thcv.COL_PROP_MODE ='" . $band . "'";
} else if ($band == 'All') {
$this->load->model('bands');
$bandslots = $this->bands->get_worked_bands('dok');
$bandslots_list = "'".implode("','",$bandslots)."'";
$sql .= " AND thcv.COL_BAND in (" . $bandslots_list . ")";
} else {
$sql .= " AND thcv.COL_PROP_MODE !='SAT'";
$sql .= " AND thcv.COL_BAND ='" . $band . "'";
}
if ($postdata['doks'] == 'dok') {
$sql .= " AND COL_DARC_DOK REGEXP '^[A-Z][0-9]{2}$'";
} else if ($postdata['doks'] == 'sdok') {
$sql .= " AND COL_DARC_DOK NOT REGEXP '^[A-Z][0-9]{2}$'";
}
$sql .= " group by COL_DARC_DOK, COL_MODE, COL_BAND";
$sql .= " order by COL_DARC_DOK asc";
$data = $this->db->query($sql);
$results = array();
$last_dok = "";
foreach($data->result() as $row){
if ($last_dok != $row->COL_DARC_DOK){
// new row
$results[$row->COL_DARC_DOK] = $this->bands->bandslots;
$last_dok = $row->COL_DARC_DOK;
}
// update stats
if (!isset($results[$row->COL_DARC_DOK]))
$results[$row->COL_DARC_DOK] = [];
if (!isset($results[$row->COL_DARC_DOK][$row->COL_BAND]))
$results[$row->COL_DARC_DOK][$row->COL_BAND] = 0;
$results[$row->COL_DARC_DOK][$row->COL_BAND] += $row->cnt;
}
return $results;
$query = $this->db->query($sql);
return $query->result();
}
/**
* Function: mostactive
* Information: Returns the most active band
**/
function info($callsign)
{
$exceptions = $this->db->query('
SELECT *
FROM `dxcc_exceptions`
WHERE `prefix` = \''.$callsign.'\'
LIMIT 1
');
if ($exceptions->num_rows() > 0)
{
return $exceptions;
function getSummaryByBandConfirmed($band, $postdata, $location_list){
$sql = "SELECT count(distinct thcv.COL_DARC_DOK) AS count FROM " . $this->config->item('table_name') . " thcv";
$sql .= " WHERE station_id IN (" . $location_list . ') AND COL_DARC_DOK != "" AND COL_DARC_DOK <> "NM"';
if ($band == 'SAT') {
$sql .= " AND thcv.COL_PROP_MODE ='" . $band . "'";
} else if ($band == 'All') {
$this->load->model('bands');
$bandslots = $this->bands->get_worked_bands('dok');
$bandslots_list = "'".implode("','",$bandslots)."'";
$sql .= " AND thcv.COL_BAND in (" . $bandslots_list . ")";
} else {
$query = $this->db->query('
SELECT *
FROM dxcc_entities
WHERE prefix = SUBSTRING( \''.$callsign.'\', 1, LENGTH( prefix ) )
ORDER BY LENGTH( prefix ) DESC
LIMIT 1
');
return $query;
$sql .= " AND thcv.COL_PROP_MODE !='SAT'";
$sql .= " AND thcv.COL_BAND ='" . $band . "'";
}
if ($postdata['doks'] == 'dok') {
$sql .= " AND COL_DARC_DOK REGEXP '^[A-Z][0-9]{2}$'";
} else if ($postdata['doks'] == 'sdok') {
$sql .= " AND COL_DARC_DOK NOT REGEXP '^[A-Z][0-9]{2}$'";
}
$sql .= $this->addQslToQuery($postdata);
$query = $this->db->query($sql);
return $query->result();
}
function search(){
print_r($this->input->get());
return;
}
function empty_table($table) {
$this->db->empty_table($table);
function getDoksFromDB($location_list) {
$sql = 'SELECT DISTINCT `COL_DARC_DOK` FROM '.$this->config->item('table_name');
$sql .= " WHERE station_id IN (" . $location_list . ') AND COL_DARC_DOK != "" AND COL_DARC_DOK <> "NM"';
$sql .= " AND COL_DARC_DOK REGEXP '^[A-Z][0-9]{2}$'";
$sql .= " ORDER BY COL_DARC_DOK ASC";
$query = $this->db->query($sql);
return $query->result();
}
function list() {
$this->db->order_by('name', 'ASC');
return $this->db->get('dxcc_entities');
function getSdoksFromDB($location_list) {
$sql = 'SELECT DISTINCT `COL_DARC_DOK` FROM '.$this->config->item('table_name');
$sql .= " WHERE station_id IN (" . $location_list . ') AND COL_DARC_DOK != "" AND COL_DARC_DOK <> "NM"';
$sql .= " AND COL_DARC_DOK NOT REGEXP '^[A-Z][0-9]{2}$'";
$sql .= " ORDER BY COL_DARC_DOK ASC";
$query = $this->db->query($sql);
return $query->result();
}
}
?>

Wyświetl plik

@ -257,7 +257,7 @@ class Logbook_model extends CI_Model {
/*
* Used to fetch QSOs from the logbook in the awards
*/
public function qso_details($searchphrase, $band, $mode, $type){
public function qso_details($searchphrase, $band, $mode, $type, $qsl){
$CI =& get_instance();
$CI->load->model('logbooks_model');
$logbooks_locations_array = $CI->logbooks_model->list_logbook_relationships($this->session->userdata('active_station_logbook'));
@ -292,6 +292,9 @@ class Logbook_model extends CI_Model {
case 'POTA':
$this->db->where('COL_POTA_REF', $searchphrase);
break;
case 'DOK':
$this->db->where('COL_DARC_DOK', $searchphrase);
break;
}
$this->db->where_in($this->config->item('table_name').'.station_id', $logbooks_locations_array);
@ -305,6 +308,21 @@ class Logbook_model extends CI_Model {
}
}
if (!empty($qsl)) {
$qslfilter = array();
if (strpos($qsl, "Q") !== false) {
$qslfilter[] = 'COL_QSL_RCVD = "Y"';
}
if (strpos($qsl, "L") !== false) {
$qslfilter[] = 'COL_LOTW_QSL_RCVD = "Y"';
}
if (strpos($qsl, "E") !== false) {
$qslfilter[] = 'COL_EQSL_QSL_RCVD = "Y"';
}
$sql = "(".implode(' OR ', $qslfilter).")";
$this->db->where($sql);
}
if ($mode != 'All') {
$this->db->where("(COL_MODE='" . $mode . "' OR COL_SUBMODE='" . $mode ."')");
}

Wyświetl plik

@ -1,11 +1,11 @@
<div class="container">
<h2><?php echo $page_title; ?></h2>
<form class="form" action="<?php echo site_url('awards/dok'); ?>" method="post" enctype="multipart/form-data">
<fieldset>
<h2><?php echo $page_title?></h2>
<form class="form" action="<?php echo site_url('awards/dok'); ?>" method="post" enctype="multipart/form-data">
<fieldset>
<div class="form-group row">
<label class="col-md-2 control-label" for="dok">Type</label>
<label class="col-md-2 control-label" for="band">DOK / SDOK</label>
<div class="col-md-2">
<select id="doks" name="doks" class="form-control custom-select-sm">
<option value="both" <?php if ($this->input->post('doks') == "both" || $this->input->method() !== 'post') echo ' selected'; ?> >DOK + SDOK</option>
@ -20,51 +20,163 @@
</select>
</div>
</div>
<div class="form-group row">
<div class="col-md-2" for="checkboxes">Worked / Confirmed</div>
<div class="col-md-10">
<div class="form-check-inline">
<input class="form-check-input" type="checkbox" name="worked" id="worked" value="1" <?php if ($this->input->post('worked') || $this->input->method() !== 'post') echo ' checked="checked"'; ?> >
<label class="form-check-label" for="worked">Show worked</label>
</div>
<div class="form-check-inline">
<input class="form-check-input" type="checkbox" name="confirmed" id="confirmed" value="1" <?php if ($this->input->post('confirmed') || $this->input->method() !== 'post') echo ' checked="checked"'; ?> >
<label class="form-check-label" for="confirmed">Show confirmed</label>
</div>
</div>
</div>
<div class="form-group row">
<div class="col-md-2">QSL / LoTW</div>
<div class="col-md-10">
<div class="form-check-inline">
<input class="form-check-input" type="checkbox" name="qsl" value="1" id="qsl" <?php if ($this->input->post('qsl') || $this->input->method() !== 'post') echo ' checked="checked"'; ?> >
<label class="form-check-label" for="qsl">QSL</label>
</div>
<div class="form-check-inline">
<input class="form-check-input" type="checkbox" name="lotw" value="1" id="lotw" <?php if ($this->input->post('lotw') || $this->input->method() !== 'post') echo ' checked="checked"'; ?> >
<label class="form-check-label" for="lotw">LoTW</label>
</div>
<div class="form-check-inline">
<input class="form-check-input" type="checkbox" name="eqsl" value="1" id="eqsl" <?php if ($this->input->post('eqsl')) echo ' checked="checked"'; ?> >
<label class="form-check-label" for="eqsl">eQSL</label>
</div>
</div>
</div>
<div class="form-group row">
<label class="col-md-2 control-label" for="band">Band</label>
<div class="col-md-2">
<select id="band2" name="band" class="form-control custom-select-sm">
<option value="All" <?php if ($this->input->post('band') == "All" || $this->input->method() !== 'post') echo ' selected'; ?> >Every band</option>
<?php foreach($worked_bands as $band) {
echo '<option value="' . $band . '"';
if ($this->input->post('band') == $band) echo ' selected';
echo '>' . $band . '</option>'."\n";
} ?>
</select>
</div>
</div>
<div class="form-group row">
<label class="col-md-2 control-label" for="mode">Mode</label>
<div class="col-md-2">
<select id="mode" name="mode" class="form-control custom-select-sm">
<option value="All" <?php if ($this->input->post('mode') == "All" || $this->input->method() !== 'mode') echo ' selected'; ?>>All</option>
<?php
foreach($modes->result() as $mode){
if ($mode->submode == null) {
echo '<option value="' . $mode->mode . '"';
if ($this->input->post('mode') == $mode->mode) echo ' selected';
echo '>'. $mode->mode . '</option>'."\n";
} else {
echo '<option value="' . $mode->submode . '"';
if ($this->input->post('mode') == $mode->submode) echo ' selected';
echo '>' . $mode->submode . '</option>'."\n";
}
}
?>
</select>
</div>
</div>
<?php
$doks = array();
if ($dok_array) {
foreach ($dok_array as $dok => $value) {
if (preg_match('/^[A-Z][0-9]{2}$/', $dok)) {
$doks[] = $dok;
}
}
}
?>
<div class="form-group row">
<label class="col-md-2 control-label" for="button1id"></label>
<div class="col-md-10">
<button id="button2id" type="reset" name="button2id" class="btn-sm btn-warning">Reset</button>
<button id="button1id" type="submit" name="button1id" class="btn-sm btn-primary">Show</button>
<button id="button2id" type="reset" name="button2id" class="btn btn-sm btn-warning">Reset</button>
<button id="button1id" type="submit" name="button1id" class="btn btn-sm btn-primary">Show</button>
<button id="button3id" type="button" name="button3id" class="btn btn-sm btn-info" onclick=" window.open('https://dd3ah.de/dokmap/dokonly.html?zoom=9&dokonly=<?php print implode(',', $doks); ?>','_blank')"><i class="fas fa-globe-americas"></i> Map</button>
</div>
</div>
</fieldset>
</form>
<table class="table table-sm table-striped table-hover">
<?php
if ($worked_bands) {
?>
<thead>
<br />
<div class="tab-content" id="myTabContent">
<div class="tab-pane fade" id="dokmaptab" role="tabpanel" aria-labelledby="home-tab">
<br />
</div>
<div class="tab-pane fade show active" id="table" role="tabpanel" aria-labelledby="table-tab">
<?php
if ($dok_array) {
echo '
<table style="width:100%" id="doktable" class="table table-sm table-bordered table-hover table-striped table-condensed text-center">
<thead>
<tr>
<td style="width:225px">DOKs (<?php echo count($doks)?>)</td>
<?php
foreach ($worked_bands as $slot) {
echo " <td style=\"text-align: center;\">$slot</td>\n";
}
?>
</tr>
</thead>
<tbody>
<?php
foreach($doks as $dok=>$val){
print("<tr><td>$dok</td>");
foreach($val as $band=>$count){
if (in_array($band, $worked_bands)) {
if ($count == 0){
print("<td style=\"text-align: right; padding-right: 2em\">&nbsp;</td>");
}else{
printf("<td style=\"text-align: right; padding-right: 2em\"><a href='javascript:displayDokContacts(\"%s\",\"%s\")'>%d</a></td>", str_replace("&", "%26", $dok), $band, $count);
}
}
<th>DOK</th>';
foreach($bands as $band) {
echo '<th>' . $band . '</th>';
}
print("</tr>");
echo '</tr>
</thead>
<tbody>';
foreach ($dok_array as $dok => $value) { // Fills the table with the data
echo '<tr>
<td>'. $dok .'</td>';
foreach ($value as $key) {
echo '<td style="text-align: center">' . $key . '</td>';
}
echo '</tr>';
}
echo '</table>
<h2>Summary</h2>
<table class="table-sm tablesummary table table-bordered table-hover table-striped table-condensed text-center">
<thead>
<tr><td></td>';
foreach($bands as $band) {
echo '<td>' . $band . '</td>';
}
echo '<td>Total</td></tr>
</thead>
<tbody>
<tr><td>Total worked</td>';
foreach ($dok_summary['worked'] as $dxcc) { // Fills the table with the data
echo '<td style="text-align: center">' . $dxcc . '</td>';
}
?>
</tbody>
echo '</tr><tr>
<td>Total confirmed</td>';
foreach ($dok_summary['confirmed'] as $dxcc) { // Fills the table with the data
echo '<td style="text-align: center">' . $dxcc . '</td>';
}
</table>
<?php } else {
echo '</tr>
</table>
</div>';
}
else {
echo '<div class="alert alert-danger" role="alert"><a href="#" class="close" data-dismiss="alert" aria-label="close">&times;</a>Nothing found!</div>';
} ?>
}
?>
</div>
</div>
</div>

Wyświetl plik

@ -2568,7 +2568,7 @@ function deleteQsl(id) {
/*
* Used to fetch QSOs from the logbook in the awards
*/
function displayContacts(searchphrase, band, mode, type) {
function displayContacts(searchphrase, band, mode, type, qsl) {
var baseURL = "<?php echo base_url();?>";
$.ajax({
url: baseURL + 'index.php/awards/qso_details_ajax',
@ -2577,7 +2577,8 @@ function deleteQsl(id) {
'Searchphrase': searchphrase,
'Band': band,
'Mode': mode,
'Type': type
'Type': type,
'QSL' : qsl
},
success: function (html) {
BootstrapDialog.show({
@ -3214,6 +3215,38 @@ function deleteQsl(id) {
$('[class*="buttons"]').css("color", "white");
}
</script>
<?php } else if ($this->uri->segment(2) == "dok") { ?>
<script>
$.fn.dataTable.ext.buttons.clear = {
className: 'buttons-clear',
action: function ( e, dt, node, config ) {
dt.search('').draw();
}
};
$('#doktable').DataTable({
"pageLength": 25,
responsive: false,
ordering: false,
"scrollY": "500px",
"scrollCollapse": true,
"paging": false,
"scrollX": true,
dom: 'Bfrtip',
buttons: [
{
extend: 'csv'
},
{
extend: 'clear',
text: 'Clear'
}
]
});
// change color of csv-button if dark mode is chosen
if (isDarkModeTheme()) {
$('[class*="buttons"]').css("color", "white");
}
</script>
<?php } ?>
<?php } ?>