return true;
}
+ function response_summary($question, $state, $length = 80) {
+ $responses = $this->get_actual_response($question, $state);
+ $response = reset($responses);
+ return shorten_text($response, $length);
+ }
+
/**
* Backup the extra information specific to an essay question - over and above
* what is in the mdl_question table.
}
function response_summary($question, $state, $length=80) {
- // This should almost certainly be overridden
- return substr(implode(', ', $this->get_actual_response($question, $state)), 0, $length);
+ return shorten_text(implode(', ', $this->get_actual_response($question, $state)), $length);
}
/**
}
/**
* Return the actual response to the question in a given state
- * for the question
+ * for the question.
*
* @return mixed An array containing the response or reponses (multiple answer, match)
* given by the user in a particular attempt.
$table->data[] = array (
$link,
$b.get_string('event'.$st->event, 'quiz').$be,
- $b.s($this->response_summary($question, $st)).$be,
+ $b.$this->response_summary($question, $st).$be,
$b.userdate($st->timestamp, get_string('timestr', 'quiz')).$be,
$b.question_format_grade($cmoptions, $st->raw_grade).$be,
$b.question_format_grade($cmoptions, $st->grade).$be
$table->data[] = array (
$link,
$b.get_string('event'.$st->event, 'quiz').$be,
- $b.s($this->response_summary($question, $st)).$be,
+ $b.$this->response_summary($question, $st).$be,
$b.userdate($st->timestamp, get_string('timestr', 'quiz')).$be,
);
}
*
* This function returns a short string of no more than a given length that
* summarizes the student's response in the given $state. This is used for
- * example in the response history table
+ * example in the response history table. This string should already be,
+ * for output.
* @return string The summary of the student response
* @param object $question
* @param object $state The state whose responses are to be summarized
$responses = array();
}
if (is_array($responses)) {
- $responses = implode(',', $responses);
+ $responses = implode(',', array_map('s', $responses));
}
- return substr($responses, 0, $length);
+ return shorten_text($responses, $length);
}
/**