// ULPGC ecastro
function get_actual_response($question, $state) {
$answers = $question->options->answers;
+ $responses = array();
if (!empty($state->responses)) {
foreach ($state->responses as $aid =>$rid){
- $responses[] = (!empty($answers[$rid]) ? $answers[$rid]->answer : '');
+ if (!empty($answers[$rid])) {
+ $responses[] = $this->format_text($answers[$rid]->answer, $question->questiontextformat);
+ }
}
} else {
$responses[] = '';
return $responses;
}
+ function response_summary($question, $state, $length = 80) {
+ return implode(',', $this->get_actual_response($question, $state));
+ }
+
/// BACKUP FUNCTIONS ////////////////////////////
/*
* @param object $cmoptions the context the string is being displayed in. Only $cmoptions->course is used.
* @return string the formatted text.
*/
- function format_text($text, $textformat, $cmoptions) {
+ function format_text($text, $textformat, $cmoptions = NULL) {
$formatoptions = new stdClass;
$formatoptions->noclean = true;
$formatoptions->para = false;
- return format_text($text, $textformat, $formatoptions, $cmoptions->course);
+ return format_text($text, $textformat, $formatoptions, $cmoptions === NULL ? NULL : $cmoptions->course);
}
/// BACKUP FUNCTIONS ////////////////////////////