-
Notifications
You must be signed in to change notification settings - Fork 2
/
report.php
133 lines (115 loc) · 5.02 KB
/
report.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
<?php
// This file is part of Questournament activity for Moodle http://moodle.org/
//
// Questournament for Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Questournament for Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* Module developed at the University of Valladolid.
* Designed and directed by Juan Pablo de Castro with the effort of many other
* students of telecommunciation engineering
* this module is provides as-is without any guarantee. Use it as your own risk.
* @author Juan Pablo de Castro and many others.
* @license http://www.gnu.org/copyleft/gpl.html GNU Public License.
* @package quest
*/
// This page prints a long report of this QUEST.
require_once("../../config.php");
require_once("lib.php");
require_once("locallib.php");
$cmid = required_param('id', PARAM_INT); // Course Module ID.
global $DB, $PAGE, $OUTPUT;
$timenow = time();
list($course, $cm) = get_course_and_cm_from_cmid($cmid, "quest");
$quest = $DB->get_record("quest", array("id" => $cm->instance), '*', MUST_EXIST);
// Print the page header and check login.
require_login($course->id, false, $cm);
$context = context_module::instance($cm->id);
require_capability('mod/quest:downloadlogs', $context);
if ($cm->visible == 0 && !has_capability('moodle/course:viewhiddenactivities', $context)) {
print_error("modulehiddenerror.", 'quest', "view.php?id=$cmid");
}
$url = new moodle_url('/mod/quest/report.php', array('id' => $cmid));
$PAGE->set_url($url);
$PAGE->set_title(format_string($quest->name));
$PAGE->set_heading($course->fullname);
$strquests = get_string("modulenameplural", "quest");
$strquest = get_string("modulename", "quest");
// Log..
if ($CFG->version >= 2014051200) {
require_once( 'classes/event/quest_viewed.php');
\mod_quest\event\briefting_viewed::create_from_parts($USER, $quest, $cm)->trigger();
} else {
add_to_log($course->id, "quest", "report", "report.php?id=$cm->id", "$quest->id", "$cm->id");
}
echo $OUTPUT->header();
quest_print_quest_heading($quest);
echo $OUTPUT->box(format_module_intro('quest', $quest, $cm->id));
echo '<br/>';
// ...iterate through submissions..
if ($submissions = quest_get_submissions($quest)) {
foreach ($submissions as $submission) {
echo $OUTPUT->heading("Challenge: " . $submission->title, 1);
echo $OUTPUT->box_start();
// Output a submission.
$user = get_complete_user_data('id', $submission->userid);
echo "<b>Author:</b>";
if ($user) {
// User Name Surname.
echo $OUTPUT->user_picture($user);
echo "<a name=\"userid->id\" href=\"{$CFG->wwwroot}/user/view.php?id=$user->id&course=$course->id\">" .
fullname($user) . '</a>';
} else {
echo "Unknown ($submission->userid)";
}
echo '</td><td width="100%">';
echo '<table border="0"><tr><td>';
quest_print_submission_info($quest, $submission);
echo '</td><td>';
/*
* INCRUSTA GRÁFICO DE EVOLUCION DE PUNTOS
*/
quest_print_score_graph($quest, $submission);
echo '</td></tr></table>';
echo $OUTPUT->heading($submission->title);
/*
* Wording of the challenge
*/
quest_print_submission($quest, $submission);
echo $OUTPUT->box_end();
echo '<br/>';
// ...list answers..
$sort = optional_param('sort', 'dateanswer', PARAM_ALPHA);
$dir = optional_param('dir', "ASC", PARAM_ALPHA);
if ($answers = quest_get_submission_answers($submission)) {
echo $OUTPUT->heading("Answers of challenge: $submission->title", 2);
echo $OUTPUT->box_start();
quest_print_table_answers($quest, $submission, $course, $cm, $sort, $dir);
echo '<br/>';
foreach ($answers as $answer) {
$user = get_complete_user_data('id', $answer->userid);
echo '<table border="0"><tr><td>';
// User Name Surname..
echo $OUTPUT->user_picture($user);
echo "<a name=\"userid->id\" href=\"{$CFG->wwwroot}/user/view.php?id=$user->id&course=$course->id\">" .
fullname($user) . '</a>';
echo '</td><td width="100%">';
echo $OUTPUT->heading("Answer: " . $answer->title, 3);
quest_print_answer_info($quest, $answer);
quest_print_answer($quest, $answer);
echo '</td></tr></table>';
}
echo $OUTPUT->box_end();
}
echo '<br/>';
}
}