-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathallreports.php
115 lines (99 loc) · 4.02 KB
/
allreports.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
<?php require_once('include/top.php');
if (!isset($_SESSION['username'])) {
header('Location: login.php');
}
?>
<?php require_once('include/config.php');?>
<?php include_once('dao/quizDao.php');?>
<?php
$quizDao = new quizDao($db);
if (isset($_GET['delete'])) {
$delete_id = $_GET['delete'];
$delete_answers= "delete from registration.answers where assessment_id=$delete_id;";;
if (mysqli_query($db,$delete_answers)) {
$msg = "Answers has been deleted";
}
else{
$error = "Answers has not been deleted";
}
$delete_questions = "delete from registration.questions where assessment_id=$delete_id;";
if (mysqli_query($db,$delete_questions)) {
$msg = "Questions has been deleted";
}
else{
$error = "Questions has not been deleted";
}
$delete_assessments = "delete from registration.assessments where id=$delete_id;";
if (mysqli_query($db,$delete_assessments)) {
$msg = "Assessments has been deleted";
}
else{
$error = "Assessments has not been deleted";
}
}
?>
</head>
<body>
<div id="wrapper">
<?php require_once('include/header.php'); ?>
<div class="container-fluid body-section">
<div class="row">
<div class="col-md-3">
<?php require_once('include/left-sidebar.php'); ?>
</div>
<div class="col-md-9">
<h1><i class="fa fa-graduation-cap" aria-hidden="true"></i> Assessments <small>All Quizzes</small></h1><hr>
<ol class="breadcrumb">
<li><a href="home.php"><i class="fa fa-tachometer"></i> Dashboard</a></li>
<li><a href="assessments.php"><i class="fa fa-folder-open"></i> Assessments</a></li>
<li class="active"><i class="fa fa-folder-open"></i> All Quizzes</li>
</ol>
</div>
<?php
if (isset($error)) {
echo "<span style='color:red;' class='pull-right'>$error</span>";
}
elseif (isset($msg)) {
echo "<span style='color:green;' class='pull-right'>$msg</span>";
}
?>
<div class="col-md-5">
<table class="table table-hover table-bordered table-striped">
<thead>
<tr>
<th>Num #</th>
<th>Module</th>
<th>Quiz</th>
<th>Run</th>
<th>Edit</th>
<th>Delete</th>
</tr>
</thead>
<tbody>
<?php
$query = "select m.module_name, a.name, a.id_module, a.id from registration.modules m
join registration.assessments a on m.id = a.id_module;";
if ($result = $db->query($query)) {
/* fetch associative array */
$i=1;
while ($row = $result->fetch_assoc()) {
?>
<tr>
<td><?=$i++?></td>
<td><?=$row['module_name']?></td>
<td><a href="newquiz.php?assessment_name=<?=$row['name'] ?>"><?=$row['name']?></td>
<td><a href="test_run.php?assessment_name=<?=$row['name'] ?>"><i class="fa fa-caret-square-o-right"></i></a></td>
<td><a href="newquiz.php?assessment_name=<?=$row['name'] ?>"><i class="fa fa-pencil"></i></a></td>
<td><a href="allreports.php?delete=<?=$row['id'] ?>"><i class="fa fa-times"></i></a></td>
</tr>
<?php
}
/* free result set */
$result->free();
}?>
</tbody>
</table>
</div>
</div>
</div>
<?php require_once('include/footer.php'); ?>