Skip to content

Commit

Permalink
MDL-32087 question preview: make more technical info available.
Browse files Browse the repository at this point in the history
... but hide it in a collapsible region.
  • Loading branch information
timhunt committed May 14, 2012
1 parent e16e230 commit 802f8d2
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 4 deletions.
7 changes: 6 additions & 1 deletion lang/en/question.php
Expand Up @@ -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';
Expand Down Expand Up @@ -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}.';
Expand Down
21 changes: 18 additions & 3 deletions question/preview.php
Expand Up @@ -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);
Expand All @@ -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 .
Expand All @@ -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();

Expand Down
4 changes: 4 additions & 0 deletions theme/base/style/question.css
Expand Up @@ -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;}
Expand Down

0 comments on commit 802f8d2

Please sign in to comment.