-
Notifications
You must be signed in to change notification settings - Fork 0
/
modal.php
71 lines (65 loc) · 3.28 KB
/
modal.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
<?php
include "internal_api.php";
if($_POST["data"]) {
echo '
<div class="modal fade" id="myModal'.$_POST["data"].'">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header" style="background:#28547a;">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
<h4 class="modal-title" style="background:#28547a">
'.$_POST["fname"].'\'s Progress
</h4>
</div>
<div class="modal-body">';
echo '<div class="adjust"><div class="table-responsive"><table><tr><th align="center">Topic Name</th><th align="center">Total Answered</th><th align="center">Total Correct</th><th align="center">% Correct</th></tr>';
$topics=array();
$topics=getTopics();
foreach($topics as $t) {
$topicID=$t["topicID"];
$topicName=$t["topic"];
$uprogress=array();
$cellcolor="#ffffff";
$uprogress=getUserProgress($topicID, $_POST["data"]);
if (empty($uprogress)) {
echo '<tr><td><a style="color:#28547a;" href="topic?id=' . $topicID . '">'.$topicName.'</td>';
$temp_count=array();
$temp_count=getQuestionCount($topicID);
foreach($temp_count as $question_count){
echo '<td align="center">0/'.$question_count["count"].'</td>';
}
echo '<td align="center">0</td>';
echo '<td align="center">0%</td>';
}
else {
foreach($uprogress as $item) {
echo '<tr><td><a style="color:#28547a;" href="topic?id=' . $topicID . '">'.$topicName.'</td>';
echo '<td align="center">'.$item["totalanswered"].'/'.$item["totalquestions"]. '</td>';
echo '<td align="center">'.$item["totalcorrect"].'</td>';
$score=str_replace('%', '', $item["percentageCorrect"]) / 100;
if ($score < 0.7) {
$cellcolor='salmon';
}
elseif ($score >=0.7 and $score < 0.9) {
$cellcolor='#ffe37a';
}
else {
$cellcolor='#7affa0';
}
echo '<td align="center" style="color: #ffffff; background:'.$cellcolor.'">' .$item["percentageCorrect"].'%</td></tr>';
}
}
}
echo '</table></div></div><br>';
echo '</div><!--.modal-body-->
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
</div>
</div><!-- /.modal-content -->
</div><!-- /.modal-dialog -->
</div><!-- /.modal -->';
}
else {
echo "Open Modal Failed!!";
}
?>