-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathresults-student.php
152 lines (132 loc) · 6.9 KB
/
results-student.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
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
<?php
require_once('../config.php');
require_once('dao/PP_DAO.php');
use \Tsugi\Core\LTIX;
use \PP\DAO\PP_DAO;
// Retrieve the launch data if present
$LAUNCH = LTIX::requireData();
$p = $CFG->dbprefix;
$PP_DAO = new PP_DAO($PDOX, $p);
include("menu.php");
$mainInfo = $PP_DAO->getMainInfo($_SESSION["main_id"]);
$students = $PP_DAO->getUsersWithAnswers($_SESSION["main_id"]);
$studentAndDate = array();
foreach($students as $student) {
$studentAndDate[$student["user_id"]] = new DateTime($PP_DAO->getMostRecentAnswerDate($_SESSION["main_id"], $student["user_id"]));
}
// Start of the output
$OUTPUT->header();
include("tool-header.html");
$OUTPUT->bodyStart();
$OUTPUT->topNav($menu);
echo('<div class="container-fluid">');
$OUTPUT->flashMessages();
$OUTPUT->pageTitle("Results <small>by Question</small>", true);
?>
<section id="studentResponses">
<div class="panel panel-info">
<div class="panel-heading response-panel-header">
<div class="row">
<div class="col-xs-3">
<h4 class="results-table-hdr">Student Name</h4>
</div>
<div class="col-xs-3 text-center">
<h4 class="results-table-hdr">Pre-Question</h4>
</div>
<div class="col-xs-3 text-center">
<h4 class="results-table-hdr">Post-Question</h4>
</div>
<div class="col-xs-3 text-center">
<h4 class="results-table-hdr">Wrap-Up Question</h4>
</div>
</div>
</div>
<div class="list-group">
<?php
// Sort students by mostRecentDate desc
arsort($studentAndDate);
foreach ($studentAndDate as $student_id => $mostRecentDate) {
if (!$PP_DAO->isUserInstructor($CONTEXT->id, $student_id)) {
$responses = $PP_DAO->getStudentResponses($_SESSION["main_id"], $student_id);
$formattedPreDate = '';
$formattedPostDate = '';
$formattedWrapDate = '';
if ($responses["pre_modified"]) {
$preDate = new DateTime($responses["pre_modified"]);
$formattedPreDate = $preDate->format("m/d/y") . " | " . $preDate->format("h:i A");
}
if ($responses["post_modified"]) {
$postDate = new DateTime($responses["post_modified"]);
$formattedPostDate = $postDate->format("m/d/y") . " | " . $postDate->format("h:i A");
}
if ($responses["wrap_modified"]) {
$wrapDate = new DateTime($responses["wrap_modified"]);
$formattedWrapDate = $wrapDate->format("m/d/y") . " | " . $wrapDate->format("h:i A");
}
?>
<div class="list-group-item response-list-group-item">
<div class="row">
<div class="col-xs-3 header-col">
<a href="#responses<?= $student_id ?>" class="h4 response-collapse-link" data-toggle="collapse">
<?= $PP_DAO->findDisplayName($student_id) ?>
<span class="fa fa-chevron-down rotate" aria-hidden="true"></span>
</a>
</div>
<div class="col-xs-3 text-center header-col">
<span class="h5 inline"><?= $formattedPreDate ?></span>
</div>
<div class="col-xs-3 text-center header-col">
<span class="h5 inline"><?= $formattedPostDate ?></span>
</div>
<div class="col-xs-3 text-center header-col">
<span class="h5 inline"><?= $formattedWrapDate ?></span>
</div>
<div id="responses<?= $student_id ?>" class="col-xs-12 results-collapse collapse">
<div class="row response-row">
<div class="col-sm-3">
<h4 class="small-hdr hdr-notop-mrgn">
<small>Pre-Question</small>
</h4>
<h5 class="sub-hdr"><?= $mainInfo["pre_question"] ?></h5>
</div>
<div class="col-sm-offset-1 col-sm-8">
<p class="response-text"><?= $responses["pre_answer"] ?></p>
</div>
</div>
<div class="row response-row">
<div class="col-sm-3">
<h4 class="small-hdr hdr-notop-mrgn">
<small>Post-Question</small>
</h4>
<h5 class="sub-hdr"><?= $mainInfo["post_question"] ?></h5>
</div>
<div class="col-sm-offset-1 col-sm-8">
<p class="response-text"><?= $responses["post_answer"] ?></p>
</div>
</div>
<div class="row response-row">
<div class="col-sm-3">
<h4 class="small-hdr hdr-notop-mrgn">
<small>Wrap-Up Question</small>
</h4>
<h5 class="sub-hdr"><?= $mainInfo["wrap_question"] ?></h5>
</div>
<div class="col-sm-offset-1 col-sm-8">
<p class="response-text"><?= $responses["wrap_answer"] ?></p>
</div>
</div>
</div>
</div>
</div>
<?php
}
}
?>
</div>
</div>
</section>
<?php
include("help.php");
$OUTPUT->footerStart();
include("tool-footer.html");
$OUTPUT->footerEnd();