-
Notifications
You must be signed in to change notification settings - Fork 0
/
records.php
163 lines (109 loc) · 3.6 KB
/
records.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
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
<?php
include 'dbcon.php';
include 'layout.php';
?>
<html>
<head>
<meta charset="utf-8">
<title>CHAPEL RECORDS</title>
</head>
<body>
<!-- <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css"> -->
<script src="lib/jquery.min"></script>
<script src="lib/popper.min"></script>
<script src="lib/bootstrap.min"></script>
<div class="container_content" id= "table-id" align="center">
<br>
<br>
<br>
<br>
<br>
<label for="Search"><b>Search</b></label>
<input type="text" name="search" id="search" placeholder="search..." size="115px" class="table-filter" data-table="order-table" align="center" />
<table class="order-table" align="center" >
<tr><b>
<th>Date</th><th>Preacher</th>
<th>Sermon</th>
<th>Readings</th></b>
</tr>
<?php
class TableRows extends RecursiveIteratorIterator {
function __construct($it) {
parent::__construct($it, self::LEAVES_ONLY);
}
function current() {
return "<td style='width: 150px; border: 1px solid black;'>" . parent::current(). "</td>";
}
function beginChildren() {
echo "<tr>";
}
function endChildren() {
echo "</tr>" . "\n";
}
}
try { $sql = 'SELECT * from lists ORDER BY ttimes DESC' ;
$result = mysqli_query($conn, $sql);
$i = 1;
while ($row = mysqli_fetch_assoc($result )) {
$recsermon=$row['Sermon'];
$recteaching=$row['Teachings'];
echo '<td>'. $row['ttimes'].'</td>';
echo '<td>'. $row['Preacher'].'</td>';
echo '<td><button type="button" class="btn btn-info" data-toggle="modal" data-target="#myModal'.$row['id'].'" > '.$row['Sermon']. '</button> </td>';
echo '<td>'. $row['Readings'].'</td>';
?>
<?php
include 'modal.php';
$i++;
echo'</tr>';
}
}
catch(PDOException $e) {
echo "Error: " . $e->getMessage();
}
echo'</table>';
?>
<script>
(function() {
'use strict';
var TableFilter = (function() {
var Arr = Array.prototype;
var input;
function onInputEvent(e) {
input = e.target;
var table1 = document.getElementsByClassName(input.getAttribute('data-table'));
Arr.forEach.call(table1, function(table) {
Arr.forEach.call(table.tBodies, function(tbody) {
Arr.forEach.call(tbody.rows, filter);
});
});
}
function filter(row) {
var text = row.textContent.toLowerCase();
//console.log(text);
var val = input.value.toLowerCase();
//console.log(val);
row.style.display = text.indexOf(val) === -1 ? 'none' : 'table-row';
}
return {
init: function() {
var inputs = document.getElementsByClassName('table-filter');
Arr.forEach.call(inputs, function(input) {
input.oninput = onInputEvent;
});
}
};
})();
/*console.log(document.readyState);
document.addEventListener('readystatechange', function() {
if (document.readyState === 'complete') {
console.log(document.readyState);
TableFilter.init();
}
}); */
TableFilter.init();
})();
</script>
</table>
</body>
</html>