diff --git a/question/export_form.php b/question/export_form.php
index 006e334472c..4f7ce0bcbc5 100644
--- a/question/export_form.php
+++ b/question/export_form.php
@@ -38,6 +38,8 @@ require_once($CFG->libdir . '/formslib.php');
class question_export_form extends moodleform {
protected function definition() {
+ global $OUTPUT;
+
$mform = $this->_form;
$defaultcategory = $this->_customdata['defaultcategory'];
@@ -45,21 +47,24 @@ class question_export_form extends moodleform {
// Choice of format, with help.
$mform->addElement('header', 'fileformat', get_string('fileformat', 'question'));
+
$fileformatnames = get_import_export_formats('export');
$radioarray = array();
- $i = 0 ;
+ $separators = array();
foreach ($fileformatnames as $shortname => $fileformatname) {
- $currentgrp1 = array();
- $currentgrp1[] = $mform->createElement('radio', 'format', '', $fileformatname, $shortname);
- $mform->addGroup($currentgrp1, "formathelp[{$i}]", '', array('
'), false);
+ $radioarray[] = $mform->createElement('radio', 'format', '', $fileformatname, $shortname);
+ $separator = '';
if (get_string_manager()->string_exists('pluginname_help', 'qformat_' . $shortname)) {
- $mform->addHelpButton("formathelp[{$i}]", 'pluginname', 'qformat_' . $shortname);
+ $separator .= $OUTPUT->help_icon('pluginname', 'qformat_' . $shortname);
}
-
- $i++ ;
+ $separator .= '
';
+ $separators[] = $separator;
}
- $mform->addRule("formathelp[0]", null, 'required', null, 'client');
+
+ $radioarray[] = $mform->createElement('static', 'makelasthelpiconshowup', '');
+ $mform->addGroup($radioarray, "formatchoices", '', $separators, false);
+ $mform->addRule("formatchoices", null, 'required', null, 'client');
// Export options.
$mform->addElement('header', 'general', get_string('general', 'form'));
diff --git a/question/import_form.php b/question/import_form.php
index 323aea7f9da..b9e46198ff4 100644
--- a/question/import_form.php
+++ b/question/import_form.php
@@ -38,7 +38,8 @@ require_once($CFG->libdir . '/formslib.php');
class question_import_form extends moodleform {
protected function definition() {
- global $COURSE;
+ global $OUTPUT;
+
$mform = $this->_form;
$defaultcategory = $this->_customdata['defaultcategory'];
@@ -49,19 +50,21 @@ class question_import_form extends moodleform {
$fileformatnames = get_import_export_formats('import');
$radioarray = array();
- $i = 0 ;
+ $separators = array();
foreach ($fileformatnames as $shortname => $fileformatname) {
- $currentgrp1 = array();
- $currentgrp1[] = $mform->createElement('radio', 'format', '', $fileformatname, $shortname);
- $mform->addGroup($currentgrp1, "formathelp[{$i}]", '', array('
'), false);
+ $radioarray[] = $mform->createElement('radio', 'format', '', $fileformatname, $shortname);
+ $separator = '';
if (get_string_manager()->string_exists('pluginname_help', 'qformat_' . $shortname)) {
- $mform->addHelpButton("formathelp[{$i}]", 'pluginname', 'qformat_' . $shortname);
+ $separator .= $OUTPUT->help_icon('pluginname', 'qformat_' . $shortname);
}
-
- $i++ ;
+ $separator .= '
';
+ $separators[] = $separator;
}
- $mform->addRule("formathelp[0]", null, 'required', null, 'client');
+
+ $radioarray[] = $mform->createElement('static', 'makelasthelpiconshowup', '');
+ $mform->addGroup($radioarray, "formatchoices", '', $separators, false);
+ $mform->addRule("formatchoices", null, 'required', null, 'client');
// Import options.
$mform->addElement('header','general', get_string('general', 'form'));