summaryrefslogtreecommitdiff
path: root/sqlbox
diff options
context:
space:
mode:
Diffstat (limited to 'sqlbox')
-rw-r--r--sqlbox/report.php22
1 files changed, 11 insertions, 11 deletions
diff --git a/sqlbox/report.php b/sqlbox/report.php
index c39114d..ad907a2 100644
--- a/sqlbox/report.php
+++ b/sqlbox/report.php
@@ -27,24 +27,24 @@ $PAGE->set_context($context);
echo $OUTPUT->header();
-$sql = "SELECT u.*, s.*
+$sql = "SELECT
+ u.id,
+ translate(to_char(s.correct, 'FM9'), '01', '☒☑'),
+ (u.firstname || ' ' || u.lastname),
+ s.query
FROM {user} u, {sqlbox_solutions} s
WHERE
u.id = s.userid and
s.sqlboxid = :id";
$records = $DB->get_records_sql($sql, array('id' => $sqlbox->id));
+$table = new html_table;
+$table->head = array("Lösung", "Nutzer", "Anfrage");
+$table->align = array("center", "left", "left");
if ($records) {
- $table = new html_table;
- $table->head = array("Lösung", "Nutzer", "Anfrage");
- foreach ($records as $record) {
- $table->data[] = array(
- ($record->correct == 1) ? '☑' : '☒',
- $record->firstname . ' ' . $record->lastname,
- $record->query
- );
- }
- echo html_writer::table($table);
+ foreach ($records as $record)
+ $table->data[] = array_slice((array)$record, 1);
}
+echo html_writer::table($table);
echo $OUTPUT->footer();