From 804d664acfa676a9d3f9709a01ee691ada531d12 Mon Sep 17 00:00:00 2001 From: mark-nielsen Date: Tue, 11 Apr 2006 02:20:58 +0000 Subject: [PATCH] [BugFix] Bug #5072: user name now links to user profile, Attempts column 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. --- mod/quiz/report/grading/report.php | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/mod/quiz/report/grading/report.php b/mod/quiz/report/grading/report.php index dee349ec64..5ced060742 100644 --- a/mod/quiz/report/grading/report.php +++ b/mod/quiz/report/grading/report.php @@ -187,8 +187,8 @@ class quiz_report extends quiz_default_report { $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 @@ class quiz_report extends quiz_default_report { $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 @@ class quiz_report extends quiz_default_report { $picture = print_user_picture($attempt->userid, $quiz->course, $attempt->picture, false, true); - // link here... grades all for this student - $userlink = "id&questionid=$question->id&userid=$attempt->userid\">". + // link to student profile + $userlink = "wwwroot/user/view.php?id=$attempt->userid&course=$quiz->course\">". fullname($attempt, true).''; if (!$this->is_graded($question, $attempt)) { @@ -263,9 +265,13 @@ class quiz_report extends quiz_default_report { // link for the attempt $attemptlink = "id&questionid=$question->id&attemptid=$attempt->attemptid\">". - userdate($attempt->timestart, get_string('strftimedatetime')).''; + userdate($attempt->timefinish, get_string('strftimedatetime')).''; + + // grade all attempts for this user + $gradelink = "id&questionid=$question->id&userid=$attempt->userid\">". + get_string('grade').''; - $table->add_data( array($picture, $userlink, $attemptlink) ); + $table->add_data( array($picture, $userlink, $attemptlink, $gradelink) ); } } -- 2.39.5