From 8cc274defcc473e1a8dd0e8b69b93d8d3462551b Mon Sep 17 00:00:00 2001 From: gustav_delius Date: Tue, 28 Mar 2006 08:27:56 +0000 Subject: [PATCH] Changed the get_actual_responses() method to truncate at 40 characters, contributed by Jean-Michel. --- question/type/questiontype.php | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/question/type/questiontype.php b/question/type/questiontype.php index cf9c6f6efd..59dd70a205 100644 --- a/question/type/questiontype.php +++ b/question/type/questiontype.php @@ -384,15 +384,16 @@ class default_questiontype { * type specific information is included. */ // ULPGC ecastro - function get_actual_response(&$question, &$state) { - /* The default implementation only returns the raw ->responses. - may be overridden by each type*/ - //unset($resp); - if (isset($state->responses)) { - return $state->responses; - } else { - return null; - } + function get_actual_response($question, $state) { + // change length to truncate responses here if you want + $lmax = 40; + if (!empty($state->responses)) { + $responses[] = (strlen($state->responses['']) > $lmax) ? + substr($state->responses[''], 0, $lmax).'...' : $state->responses['']; + } else { + $responses[] = ''; + } + return $responses; } // ULPGC ecastro -- 2.39.5