-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathprint_bp.php
99 lines (81 loc) · 2.67 KB
/
print_bp.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
<?php
require_once 'assets/config/config.php';
require_once "vendor/autoload.php";
use PhotoTech\Measure;
use PhotoTech\Pagination as Pagination;
$perPage = $totalCount = Measure::countByUser(2);
$currentPage = $_GET['page'] ?? 1;
if (($currentPage < 1)) {
$currentPage = 1;
} elseif ($currentPage > ceil($totalCount / $perPage)) {
$currentPage = ceil($totalCount / $perPage);
}
/* Send the 3 variables to the Pagination class to be processed */
$pagination = new Pagination($currentPage, $perPage, $totalCount);
/* Grab the offset (page) location from using the offset method */
$offset = $pagination->offset();
$records = Measure::records($perPage, $offset);
//echo "<pre>" . print_r($records, 1) . "</pre>";
//die();
?>
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport"
content="width=device-width, user-scalable=yes, initial-scale=1.0">
<title>Print Blood Pressure</title>
<link rel="stylesheet" media="all" href="assets/css/bpCSS.css">
</head>
<body>
<header class="header">
<h2>Blood Pressure Data</h2>
</header>
<main>
<div class="table-wrapper" tabindex="0">
<table>
<thead>
<tr>
<th>Date</th>
<th>Systolic</th>
<th>Diastolic</th>
<th>Pulse</th>
</tr>
</thead>
<tbody>
<?php
$totalSystolic = 0;
$totalDiastolic = 0;
$totalPulse = 0;
$totalMiles = 0;
$x = 1;
foreach ($records as $record) {
echo "<tr>" . "\n";
echo "<td>" . htmlspecialchars(Measure::bpDate($record['date_taken'])) . "</td>\n";
$x++;
echo "<td>" . $record['systolic'] . "</td>\n";
$totalSystolic = $totalSystolic + $record['systolic'];
echo "<td>" . $record['diastolic'] . "</td>\n";
$totalDiastolic = $totalDiastolic + $record['diastolic'];
echo "<td>" . $record['pulse'] . "</td>\n";
$totalPulse = $totalPulse + $record['pulse'];
echo "</tr>\n";
}
?>
</tbody>
<tfoot>
<?php
echo "<tr>";
echo "<td>Averages</td>";
echo "<td>" . round($totalSystolic / count($records)) . "</td>";
echo "<td>" . round($totalDiastolic / count($records)) . "</td>";
echo "<td>" . round($totalPulse / count($records)) . "</td>";
echo "</tr>";
?>
</tfoot>
</table>
</div>
<footer>
</footer>
</body>
</html>