-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathquestions_list.php
More file actions
195 lines (174 loc) · 7.08 KB
/
questions_list.php
File metadata and controls
195 lines (174 loc) · 7.08 KB
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
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
<?php
require 'bin/functions.php';
require 'db_configuration.php';
$query = "SELECT * FROM questions";
$GLOBALS['data'] = mysqli_query($db, $query);
// $GLOBALS['topic'] = mysqli_query($db, $query);
// $GLOBALS['question'] = mysqli_query($db, $query);
// $GLOBALS['choice_1'] = mysqli_query($db, $query);
// $GLOBALS['choice_2'] = mysqli_query($db, $query);
// $GLOBALS['choice_3'] = mysqli_query($db, $query);
// $GLOBALS['choice_4'] = mysqli_query($db, $query);
// $GLOBALS['answer'] = mysqli_query($db, $query);
// $GLOBALS['image_name'] = mysqli_query($db, $query);
?>
<?php $page_title = 'Quiz Master > Questions'; ?>
<?php include('header.php');
$page="questions_list.php";
verifyLogin($page);
?>
<style>
#title {
text-align: center;
color: darkgoldenrod;
}
thead input {
width: 100%;
}
.thumbnailSize{
height: 100px;
width: 100px;
transition:transform 0.25s ease;
}
.thumbnailSize:hover {
-webkit-transform:scale(3.5);
transform:scale(3.5);
}
</style>
<!-- Page Content -->
<br><br>
<div class="container-fluid">
<?php
if(isset($_GET['createQuestion'])){
if($_GET["createQuestion"] == "Success"){
echo '<br><h3>Success! Your question has been added!</h3>';
}
}
if(isset($_GET['questionUpdated'])){
if($_GET["questionUpdated"] == "Success"){
echo '<br><h3>Success! Your question has been modified!</h3>';
}
}
if(isset($_GET['questionDeleted'])){
if($_GET["questionDeleted"] == "Success"){
echo '<br><h3>Success! Your question has been deleted!</h3>';
}
}
if(isset($_GET['createTopic'])){
if($_GET["createTopic"] == "Success"){
echo '<br><h3>Success! Your topic has been added!</h3>';
}
}
?>
<h2 id="title">Question List</h2><br>
<div id="customerTableView">
<button><a class="btn btn-sm" href="createQuestion.php">Create a Question</a></button>
<table class="display" id="ceremoniesTable" style="width:100%">
<div class="table responsive">
<thead>
<tr>
<th>ID</th>
<th>Topic</th>
<th>Question</th>
<th>Choice 1</th>
<th>Choice 2</th>
<th>Choice 3</th>
<th>Choice 4</th>
<th>Answer</th>
<th>Image Name</th>
<th>Display</th>
<th>Modify</th>
<th>Delete</th>
</tr>
</thead>
<tbody>
<?php
// fetch the data from $_GLOBALS
if ($data->num_rows > 0) {
// output data of each row
while($row = $data->fetch_assoc()) {
echo '<tr>
<td><a href="question_display.php?id='.$row["id"].'"> '.$row["id"].' </a></td>
<td>'.$row["topic"].' </span> </td>
<td>'.$row["question"].'</td>
<td>'.$row["choice_1"].'</td>
<td>'.$row["choice_2"].' </span> </td>
<td>'.$row["choice_3"].'</td>
<td>'.$row["choice_4"].'</td>
<td>'.$row["answer"].' </span> </td>
<td><img class="thumbnailSize" src="' .$row["image_name"]. '" alt="'.$row["image_name"].'"></td>
<td><a class="btn btn-warning btn-sm" href="question_display.php?id='.$row["id"].'">Display</a></td>
<td><a class="btn btn-warning btn-sm" href="modifyQuestion.php?id='.$row["id"].'">Modify</a></td>
<td><a class="btn btn-danger btn-sm" href="deleteQuestion.php?id='.$row["id"].'">Delete</a></td>
</tr>';
}//end while
}//end if
else {
echo "0 results";
}//end else
?>
</tbody>
</div>
</table>
</div>
</div>
<!-- /.container -->
<!-- Footer -->
<footer class="page-footer text-center">
<p>Created for ICS 499 Summer Project "Team Bears"</p>
</footer>
<!--JQuery-->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<!--Data Table-->
<script type="text/javascript" charset="utf8"
src="https://code.jquery.com/jquery-3.3.1.js"></script>
<script type="text/javascript" charset="utf8"
src="https://cdn.datatables.net/1.10.19/js/jquery.dataTables.min.js"></script>
<script type="text/javascript" charset="utf8"
src="https://cdn.datatables.net/fixedheader/3.1.5/js/dataTables.fixedHeader.min.js"></script>
<script type="text/javascript" charset="utf8"
src="https://cdn.datatables.net/1.10.19/js/jquery.dataTables.js"></script>
<script type="text/javascript" charset="utf8"
src="https://cdn.datatables.net/buttons/1.5.2/js/dataTables.buttons.min.js"></script>
<script type="text/javascript" charset="utf8"
src="https://cdn.datatables.net/buttons/1.5.2/js/buttons.flash.min.js"></script>
<script type="text/javascript" charset="utf8"
src="https://cdn.datatables.net/buttons/1.5.2/js/buttons.html5.min.js"></script>
<script type="text/javascript" charset="utf8"
src="https://cdnjs.cloudflare.com/ajax/libs/jszip/3.1.3/jszip.min.js"></script>
<script type="text/javascript" charset="utf8"
src="https://cdn.datatables.net/buttons/1.5.2/js/buttons.flash.min.js"></script>
<script type="text/javascript" charset="utf8"
src="https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.1.36/pdfmake.min.js"></script>
<script type="text/javascript" charset="utf8"
src="https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.1.36/vfs_fonts.js"></script>
<script type="text/javascript" language="javascript">
$(document).ready( function () {
$('#ceremoniesTable').DataTable( {
dom: 'lfrtBip',
buttons: [
'copy', 'excel', 'csv', 'pdf'
] }
);
$('#ceremoniesTable thead tr').clone(true).appendTo( '#ceremoniesTable thead' );
$('#ceremoniesTable thead tr:eq(1) th').each( function (i) {
var title = $(this).text();
$(this).html( '<input type="text" placeholder="Search '+title+'" />' );
$( 'input', this ).on( 'keyup change', function () {
if ( table.column(i).search() !== this.value ) {
table
.column(i)
.search( this.value )
.draw();
}
} );
} );
var table = $('#ceremoniesTable').DataTable( {
orderCellsTop: true,
fixedHeader: true,
retrieve: true
} );
} );
</script>
</body>
</html>