mirror of
https://github.com/moodle/moodle.git
synced 2025-01-29 19:50:14 +01:00
MDL-53728 question import/export: improve form structure
This commit is contained in:
parent
aeccf4bd94
commit
f06eacd99d
@ -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('<br />'), 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 .= '<br>';
|
||||
$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'));
|
||||
|
@ -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('<br />'), 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 .= '<br>';
|
||||
$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'));
|
||||
|
Loading…
x
Reference in New Issue
Block a user