-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathview-answers.php
More file actions
96 lines (77 loc) · 2.79 KB
/
view-answers.php
File metadata and controls
96 lines (77 loc) · 2.79 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
<?php
require_once('../config.php');
require_once('dao/QW_DAO.php');
use QW\DAO\QW_DAO;
use Tsugi\Core\LTIX;
// Retrieve the launch data if present
$LAUNCH = LTIX::requireData();
$p = $CFG->dbprefix;
$QW_DAO = new QW_DAO($PDOX, $p);
if (!isset($_GET["question_id"])) {
header( 'Location: '.addSession('instructor-home.php') ) ;
}
$question_id = $_GET["question_id"];
$question = $QW_DAO->getQuestionById($question_id);
$answers = $QW_DAO->getAllAnswersToQuestion($question_id);
$totalAnswers = count($answers);
// Start of the output
$OUTPUT->header();
include("tool-header.html");
?>
<style type="text/css">
body {
background: #efefef;
}
</style>
<?php
$OUTPUT->bodyStart();
?>
<div class="container-fluid">
<ol class="breadcrumb">
<li><a href="instructor-home.php">Home</a></li>
<li class="active">Answers</li>
</ol>
<div class="row">
<div class="col-sm-10 col-sm-offset-1">
<h3>Answers (<?php echo($totalAnswers); ?>)</h3>
<div class="list-group fadeInFast" id="qwContentContainer">
<div class="list-group-item">
<h4><?php echo($question["question_txt"]); ?></h4>
</div>
<?php
foreach ($answers as $answer) {
?>
<div class="list-group-item">
<div class="row">
<div class="col-sm-2">
<p>
<strong><?php echo($QW_DAO->findDisplayName($answer["user_id"])); ?></strong>
<?php
$formattedAnswerDate = '';
if ($answer) {
$answerDateTime = new DateTime($answer['modified']);
$formattedAnswerDate = $answerDateTime->format("m-d-y") . " at " . $answerDateTime->format("h:i A");
echo('<br /><small>'.$formattedAnswerDate).'</small>';
}
?>
</p>
</div>
<div class="col-sm-10">
<p>
<?php echo($answer["answer_txt"]); ?>
</p>
</div>
</div>
</div>
<?php
}
?>
</div>
<a href="instructor-home.php" class="btn btn-primary big-shadow fadeInFast">Back</a>
</div>
</div>
</div>
<?php
$OUTPUT->footerStart();
include("tool-footer.html");
$OUTPUT->footerEnd();