Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

MDL-32087 question preview: make more technical info available.

... but hide it in a collapsible region.
  • Loading branch information...
commit 802f8d2af4b405e2855707ac5cd6caf55b104a31 1 parent e16e230
Tim Hunt authored May 14, 2012
7  lang/en/question.php
@@ -298,7 +298,7 @@
298 298
 $string['answersaved'] = 'Answer saved';
299 299
 $string['attemptfinished'] = 'Attempt finished';
300 300
 $string['attemptfinishedsubmitting'] = 'Attempt finished submitting: ';
301  
-$string['behaviourbeingused'] = 'behaviour being used: {$a}';
  301
+$string['behaviourbeingused'] = 'Behaviour being used: {$a}';
302 302
 $string['cannotloadquestion'] = 'Could not load question';
303 303
 $string['cannotpreview'] = 'You can\'t preview these questions!';
304 304
 $string['category'] = 'Category';
@@ -403,6 +403,11 @@
403 403
 $string['submit'] = 'Submit';
404 404
 $string['submitandfinish'] = 'Submit and finish';
405 405
 $string['submitted'] = 'Submit: {$a}';
  406
+$string['technicalinfo'] = 'Technical information';
  407
+$string['technicalinfominfraction'] = 'Minimum fraction: {$a}';
  408
+$string['technicalinfoquestionsummary'] = 'Question summary: {$a}';
  409
+$string['technicalinforightsummary'] = 'Right answer summary: {$a}';
  410
+$string['technicalinfostate'] = 'Question state: {$a}';
406 411
 $string['unknownbehaviour'] = 'Unknown behaviour: {$a}.';
407 412
 $string['unknownquestion'] = 'Unknown question: {$a}.';
408 413
 $string['unknownquestioncatregory'] = 'Unknown question category: {$a}.';
21  question/preview.php
@@ -220,6 +220,16 @@
220 220
     $restartdisabled = ' disabled="disabled"';
221 221
 }
222 222
 
  223
+// Prepare technical info to be output.
  224
+$qa = $quba->get_question_attempt($slot);
  225
+$technical = array();
  226
+$technical[] = get_string('behaviourbeingused', 'question',
  227
+        question_engine::get_behaviour_name($qa->get_behaviour_name()));
  228
+$technical[] = get_string('technicalinfominfraction',     'question', $qa->get_min_fraction());
  229
+$technical[] = get_string('technicalinfoquestionsummary', 'question', s($qa->get_question_summary()));
  230
+$technical[] = get_string('technicalinforightsummary',    'question', s($qa->get_right_answer_summary()));
  231
+$technical[] = get_string('technicalinfostate',           'question', '' . $qa->get_state());
  232
+
223 233
 // Output
224 234
 $title = get_string('previewquestion', 'question', format_string($question->name));
225 235
 $headtags = question_engine::initialise_js() . $quba->render_question_head_html($slot);
@@ -238,9 +248,6 @@
238 248
 // Output the question.
239 249
 echo $quba->render_question($slot, $options, $displaynumber);
240 250
 
241  
-echo '<p class="notifytiny">' . get_string('behaviourbeingused', 'question',
242  
-        question_engine::get_behaviour_name(
243  
-        $quba->get_question_attempt($slot)->get_behaviour_name())) . '</p>';
244 251
 // Finish the question form.
245 252
 echo '<div id="previewcontrols" class="controls">';
246 253
 echo '<input type="submit" name="restart"' . $restartdisabled .
@@ -253,6 +260,14 @@
253 260
 echo '</div>';
254 261
 echo '</form>';
255 262
 
  263
+// Output the technical info.
  264
+print_collapsible_region_start('', 'techinfo', get_string('technicalinfo', 'question'),
  265
+        'core_question_preview_techinfo_collapsed', true);
  266
+foreach ($technical as $info) {
  267
+    echo '<p class="notifytiny">' . $info . '</p>';
  268
+}
  269
+print_collapsible_region_end();
  270
+
256 271
 // Display the settings form.
257 272
 $optionsform->display();
258 273
 
4  theme/base/style/question.css
@@ -87,6 +87,10 @@ body.jsenabled #qtypechoicecontainer {display: block;}
87 87
 .importerror {margin-top: 10px;border-bottom: 1px solid #555;}
88 88
 .mform .que.comment .fitemtitle {width: 20%;}
89 89
 
  90
+#page-question-preview #techinfo {
  91
+    margin: 1em 0;
  92
+}
  93
+
90 94
 /** Overide for RTL layout **/
91 95
 .dir-rtl #qtypechoicecontainer #chooseqtype .instruction,
92 96
 .dir-rtl #qtypechoicecontainer #chooseqtype .qtypesummary {right: 60%;left: 0%; border-left:0;border-right: 1px solid grey;}

0 notes on commit 802f8d2

Please sign in to comment.
Something went wrong with that request. Please try again.