Permalink
Browse files

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

... but hide it in a collapsible region.
  • Loading branch information...
timhunt committed May 14, 2012
1 parent e16e230 commit 802f8d2af4b405e2855707ac5cd6caf55b104a31
Showing with 28 additions and 4 deletions.
  1. +6 −1 lang/en/question.php
  2. +18 −3 question/preview.php
  3. +4 −0 theme/base/style/question.css
View
@@ -298,7 +298,7 @@
$string['answersaved'] = 'Answer saved';
$string['attemptfinished'] = 'Attempt finished';
$string['attemptfinishedsubmitting'] = 'Attempt finished submitting: ';
-$string['behaviourbeingused'] = 'behaviour being used: {$a}';
+$string['behaviourbeingused'] = 'Behaviour being used: {$a}';
$string['cannotloadquestion'] = 'Could not load question';
$string['cannotpreview'] = 'You can\'t preview these questions!';
$string['category'] = 'Category';
@@ -403,6 +403,11 @@
$string['submit'] = 'Submit';
$string['submitandfinish'] = 'Submit and finish';
$string['submitted'] = 'Submit: {$a}';
+$string['technicalinfo'] = 'Technical information';
+$string['technicalinfominfraction'] = 'Minimum fraction: {$a}';
+$string['technicalinfoquestionsummary'] = 'Question summary: {$a}';
+$string['technicalinforightsummary'] = 'Right answer summary: {$a}';
+$string['technicalinfostate'] = 'Question state: {$a}';
$string['unknownbehaviour'] = 'Unknown behaviour: {$a}.';
$string['unknownquestion'] = 'Unknown question: {$a}.';
$string['unknownquestioncatregory'] = 'Unknown question category: {$a}.';
View
@@ -220,6 +220,16 @@
$restartdisabled = ' disabled="disabled"';
}
+// Prepare technical info to be output.
+$qa = $quba->get_question_attempt($slot);
+$technical = array();
+$technical[] = get_string('behaviourbeingused', 'question',
+ question_engine::get_behaviour_name($qa->get_behaviour_name()));
+$technical[] = get_string('technicalinfominfraction', 'question', $qa->get_min_fraction());
+$technical[] = get_string('technicalinfoquestionsummary', 'question', s($qa->get_question_summary()));
+$technical[] = get_string('technicalinforightsummary', 'question', s($qa->get_right_answer_summary()));
+$technical[] = get_string('technicalinfostate', 'question', '' . $qa->get_state());
+
// Output
$title = get_string('previewquestion', 'question', format_string($question->name));
$headtags = question_engine::initialise_js() . $quba->render_question_head_html($slot);
@@ -238,9 +248,6 @@
// Output the question.
echo $quba->render_question($slot, $options, $displaynumber);
-echo '<p class="notifytiny">' . get_string('behaviourbeingused', 'question',
- question_engine::get_behaviour_name(
- $quba->get_question_attempt($slot)->get_behaviour_name())) . '</p>';
// Finish the question form.
echo '<div id="previewcontrols" class="controls">';
echo '<input type="submit" name="restart"' . $restartdisabled .
@@ -253,6 +260,14 @@
echo '</div>';
echo '</form>';
+// Output the technical info.
+print_collapsible_region_start('', 'techinfo', get_string('technicalinfo', 'question'),
+ 'core_question_preview_techinfo_collapsed', true);
+foreach ($technical as $info) {
+ echo '<p class="notifytiny">' . $info . '</p>';
+}
+print_collapsible_region_end();
+
// Display the settings form.
$optionsform->display();
@@ -87,6 +87,10 @@ body.jsenabled #qtypechoicecontainer {display: block;}
.importerror {margin-top: 10px;border-bottom: 1px solid #555;}
.mform .que.comment .fitemtitle {width: 20%;}
+#page-question-preview #techinfo {
+ margin: 1em 0;
+}
+
/** Overide for RTL layout **/
.dir-rtl #qtypechoicecontainer #chooseqtype .instruction,
.dir-rtl #qtypechoicecontainer #chooseqtype .qtypesummary {right: 60%;left: 0%; border-left:0;border-right: 1px solid grey;}

0 comments on commit 802f8d2

Please sign in to comment.