Skip to content

Commit

Permalink
quiz reports MDL-25206 Make it more obvious how to review the student…
Browse files Browse the repository at this point in the history
…s responses.
  • Loading branch information
timhunt committed Nov 15, 2010
1 parent c0b7391 commit 6577832
Show file tree
Hide file tree
Showing 6 changed files with 68 additions and 65 deletions.
1 change: 1 addition & 0 deletions mod/quiz/lang/en/quiz.php
Original file line number Diff line number Diff line change
Expand Up @@ -713,6 +713,7 @@
$string['review'] = 'Review';
$string['reviewafter'] = 'Allow review after quiz is closed';
$string['reviewalways'] = 'Allow review at any time';
$string['reviewattempt'] = 'Review attempt';
$string['reviewbefore'] = 'Allow review while quiz is open';
$string['reviewclosed'] = 'After the quiz is closed';
$string['reviewimmediately'] = 'Immediately after the attempt';
Expand Down
86 changes: 42 additions & 44 deletions mod/quiz/report/overview/overview_table.php
Original file line number Diff line number Diff line change
Expand Up @@ -129,31 +129,26 @@ function col_picture($attempt){
return $OUTPUT->user_picture($user);
}

function col_fullname($attempt){
$html = parent::col_fullname($attempt);
if ($this->is_downloading()) {
return $html;
}

return $html . '<br /><a class="reviewlink" href="review.php?q='.$this->quiz->id.'&amp;attempt='.$attempt->attempt.
'">'.get_string('reviewattempt', 'quiz').'</a>';
}

function col_timestart($attempt){
if ($attempt->attempt) {
$startdate = userdate($attempt->timestart, $this->strtimeformat);
if (!$this->is_downloading()) {
return '<a href="review.php?q='.$this->quiz->id.'&amp;attempt='.$attempt->attempt.'">'.$startdate.'</a>';
} else {
return $startdate;
}
return userdate($attempt->timestart, $this->strtimeformat);
} else {
return '-';
}
}
function col_timefinish($attempt){
if ($attempt->attempt) {
if ($attempt->timefinish) {
$timefinish = userdate($attempt->timefinish, $this->strtimeformat);
if (!$this->is_downloading()) {
return '<a href="review.php?q='.$this->quiz->id.'&amp;attempt='.$attempt->attempt.'">'.$timefinish.'</a>';
} else {
return $timefinish;
}
} else {
return '-';
}
if ($attempt->attempt && $attempt->timefinish) {
return userdate($attempt->timefinish, $this->strtimeformat);
} else {
return '-';
}
Expand All @@ -168,37 +163,40 @@ function col_duration($attempt){
return '-';
}
}

function col_sumgrades($attempt){
if ($attempt->timefinish) {
$grade = quiz_rescale_grade($attempt->sumgrades, $this->quiz);
if (!$this->is_downloading()) {
if (isset($this->regradedqs[$attempt->attemptuniqueid])){
$newsumgrade = 0;
$oldsumgrade = 0;
foreach ($this->questions as $question){
if (isset($this->regradedqs[$attempt->attemptuniqueid][$question->id])){
$newsumgrade += $this->regradedqs[$attempt->attemptuniqueid][$question->id]->newgrade;
$oldsumgrade += $this->regradedqs[$attempt->attemptuniqueid][$question->id]->oldgrade;
} else {
$newsumgrade += $this->gradedstatesbyattempt[$attempt->attemptuniqueid][$question->id]->grade;
$oldsumgrade += $this->gradedstatesbyattempt[$attempt->attemptuniqueid][$question->id]->grade;
}
}
$newsumgrade = quiz_rescale_grade($newsumgrade, $this->quiz);
$oldsumgrade = quiz_rescale_grade($oldsumgrade, $this->quiz);
$grade = "<del>$oldsumgrade</del><br />$newsumgrade";
}
$gradehtml = '<a href="review.php?q='.$this->quiz->id.'&amp;attempt='.$attempt->attempt.'">'.$grade.'</a>';
if ($this->qmsubselect && $attempt->gradedattempt){
$gradehtml = '<div class="highlight">'.$gradehtml.'</div>';
if (!$attempt->timefinish) {
return '-';
}

$grade = quiz_rescale_grade($attempt->sumgrades, $this->quiz);
if ($this->is_downloading()) {
return $grade;
}

if (isset($this->regradedqs[$attempt->attemptuniqueid])){
$newsumgrade = 0;
$oldsumgrade = 0;
foreach ($this->questions as $question){
if (isset($this->regradedqs[$attempt->attemptuniqueid][$question->id])){
$newsumgrade += $this->regradedqs[$attempt->attemptuniqueid][$question->id]->newgrade;
$oldsumgrade += $this->regradedqs[$attempt->attemptuniqueid][$question->id]->oldgrade;
} else {
$newsumgrade += $this->gradedstatesbyattempt[$attempt->attemptuniqueid][$question->id]->grade;
$oldsumgrade += $this->gradedstatesbyattempt[$attempt->attemptuniqueid][$question->id]->grade;
}
return $gradehtml;
} else {
return $grade;
}
} else {
return '-';
$newsumgrade = quiz_rescale_grade($newsumgrade, $this->quiz);
$oldsumgrade = quiz_rescale_grade($oldsumgrade, $this->quiz);
$grade = "<del>$oldsumgrade</del><br />$newsumgrade";
}

$gradehtml = '<a href="review.php?q='.$this->quiz->id.'&amp;attempt='.$attempt->attempt.
'" title="'.get_string('reviewattempt', 'quiz').'">'.$grade.'</a>';
if ($this->qmsubselect && $attempt->gradedattempt){
$gradehtml = '<div class="highlight">'.$gradehtml.'</div>';
}
return $gradehtml;
}

/**
Expand Down
4 changes: 0 additions & 4 deletions mod/quiz/report/overview/report.php
Original file line number Diff line number Diff line change
Expand Up @@ -378,10 +378,6 @@ function display($quiz, $cm, $course) {

$table->collapsible(true);

$table->column_suppress('picture');
$table->column_suppress('fullname');
$table->column_suppress('idnumber');

$table->no_sorting('feedbacktext');

$table->column_class('picture', 'picture');
Expand Down
4 changes: 0 additions & 4 deletions mod/quiz/report/responses/report.php
Original file line number Diff line number Diff line change
Expand Up @@ -315,10 +315,6 @@ function display($quiz, $cm, $course) {

$table->collapsible(true);

$table->column_suppress('picture');
$table->column_suppress('fullname');
$table->column_suppress('idnumber');

$table->no_sorting('feedbacktext');

$table->column_class('picture', 'picture');
Expand Down
37 changes: 24 additions & 13 deletions mod/quiz/report/responses/responses_table.php
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,15 @@ function col_picture($attempt){
return $OUTPUT->user_picture($user);
}

function col_fullname($attempt){
$html = parent::col_fullname($attempt);
if ($this->is_downloading()) {
return $html;
}

return $html . '<br /><a class="reviewlink" href="review.php?q='.$this->quiz->id.'&amp;attempt='.$attempt->attempt.
'">'.get_string('reviewattempt', 'quiz').'</a>';
}

function col_timestart($attempt){
if ($attempt->attempt) {
Expand Down Expand Up @@ -126,21 +135,23 @@ function col_duration($attempt){
}

function col_sumgrades($attempt){
if ($attempt->timefinish) {
$grade = quiz_rescale_grade($attempt->sumgrades, $this->quiz);
if (!$this->is_downloading()) {
$gradehtml = '<a href="review.php?q='.$this->quiz->id.'&amp;attempt='.$attempt->attempt.'">'.$grade.'</a>';
if ($this->qmsubselect && $attempt->gradedattempt){
$gradehtml = '<div class="highlight">'.$gradehtml.'</div>';
}
return $gradehtml;
} else {
return $grade;
}
} else {
if (!$attempt->timefinish) {
return '-';
}

$grade = quiz_rescale_grade($attempt->sumgrades, $this->quiz);
if ($this->is_downloading()) {
return $grade;
}

$gradehtml = '<a href="review.php?q='.$this->quiz->id.'&amp;attempt='.$attempt->attempt.
'" title="'.get_string('reviewattempt', 'quiz').'">'.$grade.'</a>';
if ($this->qmsubselect && $attempt->gradedattempt){
$gradehtml = '<div class="highlight">'.$gradehtml.'</div>';
}
return $gradehtml;
}

function other_cols($colname, $attempt){
global $QTYPES, $OUTPUT;
static $states =array();
Expand Down Expand Up @@ -170,7 +181,7 @@ function other_cols($colname, $attempt){
if ($summary){
$link = new moodle_url("/mod/quiz/reviewquestion.php?attempt=$attempt->attempt&question=$question->id");
$action = new popup_action('click', $link, 'reviewquestion', array('height' => 450, 'width' => 650));
$summary = $OUTPUT->action_link($link, $summary, $action, array('title'=>$question->formattedname));
$summary = $OUTPUT->action_link($link, $summary, $action, array('title'=>get_string('reviewresponsetoq', 'quiz', $question->formattedname)));

if (question_state_is_graded($stateforqinattempt)
&& ($question->maxgrade > 0)){
Expand Down
1 change: 1 addition & 0 deletions mod/quiz/styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@ table#categoryquestions td,
#page-mod-quiz-report fieldset.felement.fgroup {margin: 0;}
#page-mod-quiz-report #cachingnotice {margin-bottom: 1em; padding: 0.2em; }
#page-mod-quiz-report #cachingnotice .singlebutton {margin: 0.5em 0 0;}
#page-mod-quiz-report .bold .reviewlink {font-weight: normal;}

/** Mod quiz grading **/
#page-mod-quiz-grading table#grading {width: 80%;margin: 20px auto;}
Expand Down

0 comments on commit 6577832

Please sign in to comment.