-
Notifications
You must be signed in to change notification settings - Fork 0
/
questions.php
88 lines (88 loc) · 2.81 KB
/
questions.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
<?php
session_start();
require_once "includer.php";
require_once "includes/check_logged.php";
if(!is_admin()){
redirect("adminlogin.php");
}
function process(){
}
?>
<?php
//print_r($_SESSION['user_type'] === "hod");
$questions = Question::all();
?>
<html>
<head>
<title>Questions</title>
<?php
include_once "includes/styles.php";
?>
<style type="text/css">
.center{
margin-top: 23vh;
}
</style>
</head>
<body>
<?php
if(is_admin()){
include_once "includes/admin_nav_logged_in.php";
} else{
include_once "includes/hod_logged_in.php";
}
?>
<div class="col-md-8 offset-2 mt-4">
<?php if(!zero($questions)){
?>
<h4 class="text-center text-secondary">Questions</h4>
<?php if(is_admin()) {?>
<a href="addquiz.php" class="float-right btn btn-success btn-sm">Add question <i class="fa fa-plus-circle"></i> </a>
<?php } ?>
<div class="clearfix"></div><br>
<table class="table table-responsive-lg table-hover">
<thead>
<tr class="bg-primary text-white">
<th>Number</th>
<th>Question text</th>
<th>Type</th>
<th>Actions</th>
</tr>
</thead>
<tbody>
<?php $i = 1; foreach ($questions as $question){ ?>
<tr>
<td><?= $i ?></td>
<td><?= $question->getContent() ?></td>
<?php if(is_admin()) {
$quiz = $question->getQuestionType();
$ans = intval($quiz) === 1 ? "Multiple choice" : "Open Ended";
?>
<td><?= $ans ?></td>
<?php } ?>
<td class="flex-row">
<?php if(is_admin()) {?>
<a href="editquiz.php?quiz=<?= $question->getId() ?>" class="btn btn-primary btn-sm" title="View units"><i class="fa fa-edit"></i> </a>
<a href="deletequiz.php?quiz=<?= $question->getId() ?>" class="btn btn-danger btn-sm" title="Delete quiz"><i class="fa fa-trash"></i> </a>
<?php } ?>
</td>
</tr>
<?php $i++;} ?>
</tbody>
</table>
<?php } else {?>
<div class="col-mod-4 offset-2">
<h2 class="text-warning text-center center">Sorry</h2>
<p class="text-center"><small class="font-weight-light text-center font-italic">There are currently no questions available</small></p>
<?php
if(is_admin()){
?>
<a class="btn btn-primary btn-sm offset-5" href="addquiz.php">Add some <i class="fa fa-plus-circle"></i> </a>
<?php } }?>
</div>
</div>
<?php
include_once "includes/scripts.php";
?>
</body>
</html>