-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstatistics.php
More file actions
130 lines (122 loc) · 4.15 KB
/
Copy pathstatistics.php
File metadata and controls
130 lines (122 loc) · 4.15 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
<?php
session_start ();
if(!(isset($_SESSION['user']))){
header('location: index.php');
}
include_once 'database/database_infos.php';
include_once 'database/Database.php';
$user = unserialize($_SESSION['user']);
$rightFalse = Database::getInstance()->getRightFalse($user->__get('userID'));
$pointsQuiz = Database::getInstance()->getPointsQuiz($user->__get('userID'));
$answered = Database::getInstance()->getAnsweredQuestions($user->__get('userID'));
$answeredRight = Database::getInstance()->getAnsweredRightQuestions($user->__get('userID'));
?>
<!DOCTYPE html>
<html>
<head>
<?php include_once 'includes/head.php'; ?>
<script type="text/javascript"
src="https://www.gstatic.com/charts/loader.js"></script>
<!-- Chart Richtig Falsch -->
<script type="text/javascript">
google.charts.load('current', {'packages':['corechart']});
google.charts.setOnLoadCallback(drawChart);
function drawChart() {
var data = google.visualization.arrayToDataTable([
['', ''],
['Richtig', <?php echo $rightFalse[0]?>],
['Falsch', <?php echo $rightFalse[1]?>],
]);
var options = {
title: 'Richtig/Falsch beantwortet'
};
var chart = new google.visualization.PieChart(document.getElementById('correct'));
chart.draw(data, options);
}
</script>
<!-- Chart Punkteentwicklung pro Quiz -->
<script type="text/javascript">
google.charts.setOnLoadCallback(drawChart);
function drawChart() {
var data = google.visualization.arrayToDataTable([
['Quiz', 'Punkte'],
<?php foreach ($pointsQuiz as $points){?>
[<?php echo $points['0']?>, <?php echo $points['1']?>],
<?php }?>
]);
var options = {
title: 'Punkte Entwicklung pro Quiz',
hAxis: {title: 'Quiz', titleTextStyle: {color: '#333'}},
vAxis: {minValue: 0}
};
var chart = new google.visualization.AreaChart(document.getElementById('points'));
chart.draw(data, options);
}
</script>
<!-- Chart Answered -->
<script type="text/javascript">
google.charts.setOnLoadCallback(drawChart);
function drawChart() {
var data = google.visualization.arrayToDataTable([
['', ''],
['beantwortet', <?php echo $answered?>],
['nicht gelöst', <?php echo 100 - $answered?>],
]);
var options = {
title: 'Beantwortete Fragen'
};
var chart = new google.visualization.PieChart(document.getElementById('answered'));
chart.draw(data, options);
}
</script>
<!-- Chart AnsweredCorrect -->
<script type="text/javascript">
google.charts.setOnLoadCallback(drawChart);
function drawChart() {
var data = google.visualization.arrayToDataTable([
['', ''],
['richtig beantwortet', <?php echo $answeredRight?>],
['falsch beantowrtet', <?php echo 100 - $answeredRight?>],
]);
var options = {
title: 'Beantwortete Fragen'
};
var chart = new google.visualization.PieChart(document.getElementById('answeredCorrect'));
chart.draw(data, options);
}
</script>
</head>
<body>
<?php include_once 'resources/form_controller.php';
include_once 'resources/navigation.php'; ?>
<div class="container">
<div class="col-md-12">
<h1>Dein Statistiken</h1>
<hr>
</div>
<div class="col-md-12">
<h3>
<?php echo "Dein Punktzahl: " . $user->__get('points') . " Punkte";?>
</h3>
</div>
<row>
<div class="col-md-4">
<div id="correct" style="width: auto; height: 200px;"></div>
</div>
<div class="col-md-4">
<div id="answered" style="width: auto; height: 200px;"></div>
</div>
<div class="col-md-4">
<div id="answeredCorrect" style="width: auto; height: 200px;"></div>
</div>
</row>
<row>
<div class="col-md-6">
<div id="points" style="width: auto; height: 350px;"></div>
</div>
</row>
</div>
<hr />
<?php include_once 'resources/footer.php';?>
</body>
</html>