]> git.mjollnir.org Git - moodle.git/commitdiff
Changed the get_actual_responses() method to truncate at 40 characters, contributed...
authorgustav_delius <gustav_delius>
Tue, 28 Mar 2006 08:27:56 +0000 (08:27 +0000)
committergustav_delius <gustav_delius>
Tue, 28 Mar 2006 08:27:56 +0000 (08:27 +0000)
question/type/questiontype.php

index cf9c6f6efd39f6a6312af71ac7b661c6f2a610b7..59dd70a20574ba80649b2b41342a9808cb64c9ec 100644 (file)
@@ -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