Added resultview and more logic

This commit is contained in:
Andreas Kristiansen
2025-05-26 16:23:17 +02:00
parent d27cea5b5d
commit be13a4d26a
5 changed files with 85 additions and 2 deletions

View File

@@ -319,9 +319,23 @@ class Statistics extends CI_Controller {
// Set Page Title
$data['page_title'] = __("EME Initials");
$footerData = [];
$footerData['scripts'] = [
'assets/js/sections/initials.js?' . filemtime(realpath(__DIR__ . "/../../assets/js/sections/initials.js")),
];
// Load Views
$this->load->view('interface_assets/header', $data);
$this->load->view('statistics/initials');
$this->load->view('interface_assets/footer');
$this->load->view('interface_assets/footer', $footerData);
}
public function getInitials() {
$band = xss_clean($this->input->post('band'));
$mode = xss_clean($this->input->post('mode'));
$this->load->model('stats');
$data['intials_array'] = $this->stats->getInitialsFromDb($band, $mode);
$this->load->view('statistics/initialresult', $data);
}
}

View File

@@ -918,6 +918,10 @@
return $this->db->get($this->config->item('table_name'));
}
public function getInitialsFromDb($band, $mode) {
}
}
?>

View File

@@ -0,0 +1,32 @@
<?php
if ($intials_array) {
echo '<br />
<table style="width:100%" class="qsotable table-sm table table-bordered table-hover table-striped table-condensed text-center">
<thead>';
echo '<tr><th></th>';
foreach($bands as $band) {
echo '<th>' . $band . '</th>';
}
echo '<th>'.__("Total").'</th>';
echo '</tr>
</thead>
<tbody>';
foreach ($qsoarray as $mode => $value) {
echo '<tr>
<th>'. $mode .'</th>';
foreach ($value as $key => $val) {
echo '<td>' . $val . '</td>';
}
echo '<th>' . $modetotal[$mode] . '</th>';
echo '</tr>';
}
echo '</tbody><tfoot><tr><th>'.__("Total").'</th>';
$grandtotal = 0;
foreach ($bandtotal as $band => $value) {
echo '<th>' . $value . '</th>';
$grandtotal += $value;
}
echo '<th>' . $grandtotal . '</th>';
echo '</tr></tfoot></table>';
}

View File

@@ -39,8 +39,9 @@
<div class="mb-3 row">
<label class="col-md-1 control-label" for="button1id"></label>
<div class="col-md-10">
<button id="showinitials();" type="button" name="button1id" class="btn btn-primary"><?= __("Show") ?></button>
<button onclick="showinitials();" type="button" name="button1id" class="btn btn-primary"><?= __("Show") ?></button>
</div>
</div>
</form>
<div class="resulttable"></div>
</div>

View File

@@ -0,0 +1,32 @@
$(".activatorstable").DataTable({
pageLength: 25,
responsive: false,
ordering: false,
scrollY: "500px",
scrollCollapse: true,
paging: false,
scrollX: true,
language: {
url: getDataTablesLanguageUrl(),
},
dom: "Bfrtip",
buttons: ["csv"],
});
function showinitials() {
var data = {
mode: $('#band').val(),
band: $('#mode').val()
};
$.ajax({
url: base_url + "index.php/statistics/getInitials",
type: "post",
data: data,
success: function (html) {
$(".resulttable").empty();
$(".resulttable").html(html);
$(".qsotable").DataTable();
},
});
}