### Eclipse Workspace Patch 1.0 #P moodle20 Index: mod/lesson/pagetypes/multichoice.php =================================================================== RCS file: /cvsroot/moodle/moodle/mod/lesson/pagetypes/multichoice.php,v retrieving revision 1.16 diff -u -r1.16 multichoice.php --- mod/lesson/pagetypes/multichoice.php 28 Jul 2010 13:38:27 -0000 1.16 +++ mod/lesson/pagetypes/multichoice.php 29 Jul 2010 09:17:30 -0000 @@ -488,8 +488,15 @@ $i = 0; foreach ($answers as $answer) { - $mform->addElement('html', '
'); - $mform->addElement('radio','answerid',null,format_text($answer->answer, $answer->answerformat, $options),$answer->id); + $answertext = $answer->answer; + $matches = null; + $count = preg_match_all('|

.*

|U', $answertext, $matches); + if ($count == 1) { + $answertext = preg_replace('|^

(.*)

$|', "\\1", trim($answertext)); + } + $answertext = " ".$answertext; + $mform->addElement('html', '
'); + $mform->addElement('radio','answerid',null,format_text($answertext, $answer->answerformat, $options),$answer->id); $mform->setType('answer'.$i, PARAM_INT); if (isset($USER->modattempts[$lessonid]) && $answer->id == $attempt->answerid) { $mform->setDefault('answerid', true); @@ -526,9 +533,16 @@ $mform->setType('pageid', PARAM_INT); foreach ($answers as $answer) { - $mform->addElement('html', '
'); + $answertext = $answer->answer; + $matches = null; + $count = preg_match_all('|

.*

|U', $answertext, $matches); + if ($count == 1) { + $answertext = preg_replace('|^

(.*)

$|', "\\1", trim($answertext)); + } + $answertext = " ".$answertext; + $mform->addElement('html', '
'); // NOTE: our silly checkbox supports only value '1' - we can not use it like the radiobox above!!!!!! - $mform->addElement('checkbox','answer['.$answer->id.']',null,format_text($answer->answer, $answer->answerformat, $options)); + $mform->addElement('checkbox','answer['.$answer->id.']',null,format_text($answertext, $answer->answerformat, $options)); $mform->setType('answer['.$answer->id.']', PARAM_INT); if (isset($USER->modattempts[$lessonid]) && $answer->id == $attempt->answerid) { $mform->setDefault('answer['.$answer->id.']', true);