Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

[BugFix] Bug #5072: user name now links to user profile, Attempts col…

…umn changed to Completed On, new column with link Grade to grade all attempts. Other table changes include collapsible columns and its id has been changed to attempts to reuse styles for the attempts table.
  • Loading branch information...
commit 804d664acfa676a9d3f9709a01ee691ada531d12 1 parent 6e63c77
mark-nielsen authored
Showing with 15 additions and 9 deletions.
  1. +15 −9 mod/quiz/report/grading/report.php
View
24 mod/quiz/report/grading/report.php
@@ -187,8 +187,8 @@ function view_question($quiz, $question) {
$usercount = count($users);
// set up table
- $tablecolumns = array('picture', 'fullname', 'attempt');
- $tableheaders = array('', get_string('fullname'), get_string("attempts", "quiz"));
+ $tablecolumns = array('picture', 'fullname', 'attempt', 'grade');
+ $tableheaders = array('', get_string('fullname'), get_string("completedon", "quiz"), '');
$table = new flexible_table('mod-quiz-report-grading');
@@ -199,24 +199,26 @@ function view_question($quiz, $question) {
$table->sortable(true);
$table->initialbars($usercount>20); // will show initialbars if there are more than 20 users
$table->pageable(true);
+ $table->collapsible(true);
$table->column_suppress('fullname');
$table->column_suppress('picture');
+ $table->column_suppress('grade');
$table->column_class('picture', 'picture');
// attributes in the table tag
$table->set_attribute('cellspacing', '0');
- $table->set_attribute('id', 'grading');
+ $table->set_attribute('id', 'attempts');
$table->set_attribute('class', 'generaltable generalbox');
$table->set_attribute('align', 'center');
- $table->set_attribute('width', '50%');
+ //$table->set_attribute('width', '50%');
// get it ready!
$table->setup();
// this sql is a join of the attempts table and the user table. I do this so I can sort by user name and attempt number (not id)
- $select = 'SELECT '.$db->Concat('u.id', '\'#\'', $db->IfNull('qa.attempt', '0')).' AS userattemptid, qa.id AS attemptid, qa.uniqueid, qa.attempt, qa.timestart, u.id AS userid, u.firstname, u.lastname, u.picture ';
+ $select = 'SELECT '.$db->Concat('u.id', '\'#\'', $db->IfNull('qa.attempt', '0')).' AS userattemptid, qa.id AS attemptid, qa.uniqueid, qa.attempt, qa.timefinish, u.id AS userid, u.firstname, u.lastname, u.picture ';
$from = 'FROM '.$CFG->prefix.'user u LEFT JOIN '.$CFG->prefix.'quiz_attempts qa ON (u.id = qa.userid AND qa.quiz = '.$quiz->id.') ';
$where = 'WHERE u.id IN ('.$userids.') ';
$where .= 'AND '.$db->IfNull('qa.attempt', '0').' != 0 ';
@@ -251,8 +253,8 @@ function view_question($quiz, $question) {
$picture = print_user_picture($attempt->userid, $quiz->course, $attempt->picture, false, true);
- // link here... grades all for this student
- $userlink = "<a href=\"report.php?mode=grading&amp;action=grade&amp;q=$quiz->id&amp;questionid=$question->id&amp;userid=$attempt->userid\">".
+ // link to student profile
+ $userlink = "<a href=\"$CFG->wwwroot/user/view.php?id=$attempt->userid&amp;course=$quiz->course\">".
fullname($attempt, true).'</a>';
if (!$this->is_graded($question, $attempt)) {
@@ -263,9 +265,13 @@ function view_question($quiz, $question) {
// link for the attempt
$attemptlink = "<a $style href=\"report.php?mode=grading&amp;action=grade&amp;q=$quiz->id&amp;questionid=$question->id&amp;attemptid=$attempt->attemptid\">".
- userdate($attempt->timestart, get_string('strftimedatetime')).'</a>';
+ userdate($attempt->timefinish, get_string('strftimedatetime')).'</a>';
+
+ // grade all attempts for this user
+ $gradelink = "<a href=\"report.php?mode=grading&amp;action=grade&amp;q=$quiz->id&amp;questionid=$question->id&amp;userid=$attempt->userid\">".
+ get_string('grade').'</a>';
- $table->add_data( array($picture, $userlink, $attemptlink) );
+ $table->add_data( array($picture, $userlink, $attemptlink, $gradelink) );
}
}

0 comments on commit 804d664

Please sign in to comment.
Something went wrong with that request. Please try again.