mirror of
https://github.com/wavelog/wavelog.git
synced 2026-03-22 10:24:14 +00:00
Merge pull request #876 from phl0/oqrsCount
Show open and total number of OQRS requests
This commit is contained in:
@@ -366,10 +366,21 @@ class Oqrs_model extends CI_Model {
|
||||
|
||||
public function oqrs_requests($location_list) {
|
||||
if ($location_list != "") {
|
||||
$sql = 'SELECT COUNT(*) AS number FROM oqrs JOIN station_profile ON oqrs.station_id = station_profile.station_id WHERE oqrs.station_id IN ('.$location_list.') AND status < 2';
|
||||
$sql = 'SELECT status, COUNT(*) AS number FROM oqrs JOIN station_profile ON oqrs.station_id = station_profile.station_id WHERE oqrs.station_id IN ('.$location_list.') GROUP BY status';
|
||||
$query = $this->db->query($sql);
|
||||
$row = $query->row();
|
||||
return $row->number;
|
||||
$sum = 0;
|
||||
$open = 0;
|
||||
foreach ($query->result_array() as $row) {
|
||||
$sum += $row['number'];
|
||||
if ($row['status'] == 1) {
|
||||
$open += $row['number'];
|
||||
}
|
||||
}
|
||||
if ($open == 0 && $sum == 0) {
|
||||
return 0;
|
||||
} else {
|
||||
return $open."/".$sum;
|
||||
}
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -416,7 +416,7 @@
|
||||
?>
|
||||
<li><a class="dropdown-item" href="<?php echo site_url('oqrs/requests'); ?>" title="OQRS Requests"><i class="fa fa-id-card"></i> <?= __("OQRS Requests"); ?>
|
||||
<?php if ($oqrs_requests > 0) {
|
||||
echo "<span class=\"badge text-bg-light\">" . $oqrs_requests . "</span>";
|
||||
echo "<span id=\"oqrs_requests\" class=\"badge text-bg-light\">" . $oqrs_requests . "</span>";
|
||||
} ?></a></li>
|
||||
<?php } ?>
|
||||
<li><a class="dropdown-item" href="<?php echo site_url('qslprint'); ?>" title="<?= __("QSL Queue"); ?>"><i class="fas fa-print"></i> <?= __("QSL Queue"); ?></a></li>
|
||||
|
||||
Reference in New Issue
Block a user