MDL-49364 quiz statistics: escape output in the response analysis

This commit is contained in:
Tim Hunt
2015-03-03 18:01:20 +00:00
parent 316670bfe1
commit 71aeb8a9cb
@@ -142,4 +142,21 @@ class quiz_statistics_question_table extends flexible_table {
return $this->format_percentage($response->count / $this->s);
}
/**
* If there is not a col_{column name} method then we call this method. If it returns null
* that means just output the property as in the table raw data. If this returns none null
* then this is the output for this cell of the table.
*
* @param string $colname The name of this column.
* @param object $response The raw data for this row.
* @return string|null The value for this cell of the table or null means use raw data.
*/
public function other_cols($colname, $response) {
if ($colname == 'part' || $colname == 'responseclass' || $colname == 'response') {
return s($response->$colname);
} else {
return null;
}
}
}