Skip to content

Commit

Permalink
MDL-10876:
Browse files Browse the repository at this point in the history
Import/Export format select list is now a (required) list of radio
buttons, with no default
  • Loading branch information
thepurpleblob committed Aug 17, 2007
1 parent 1a05537 commit 45b68ee
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 7 deletions.
19 changes: 15 additions & 4 deletions question/export_form.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,17 @@ function definition() {
$defaultcategory = $this->_customdata['defaultcategory'];
$contexts = $this->_customdata['contexts'];
$defaultfilename = $this->_customdata['defaultfilename'];
//--------------------------------------------------------------------------------
$mform->addElement('header','fileformat',get_string('fileformat','quiz'));
$fileformatnames = get_import_export_formats('export');
$radioarray = array();
foreach ($fileformatnames as $id => $fileformatname) {
$radioarray[] = &MoodleQuickForm::createElement('radio','format','',$fileformatname,$id);
}
$mform->addGroup($radioarray,'format','',array('<br />'),false);
$mform->setHelpButton('format', array('export', get_string('exportquestions', 'quiz'), 'quiz'));
$mform->addRule('format',null,'required',null,'client');

//--------------------------------------------------------------------------------
$mform->addElement('header','general', get_string('general', 'form'));

Expand All @@ -26,10 +37,10 @@ function definition() {
$mform->setDefault('contexttofile', 1);


$fileformatnames = get_import_export_formats('export');
$mform->addElement('select', 'format', get_string('fileformat','quiz'), $fileformatnames);
$mform->setDefault('format', 'gift');
$mform->setHelpButton('format', array('export', get_string('exportquestions', 'quiz'), 'quiz'));
// $fileformatnames = get_import_export_formats('export');
// $mform->addElement('select', 'format', get_string('fileformat','quiz'), $fileformatnames);
// $mform->setDefault('format', 'gift');
// $mform->setHelpButton('format', array('export', get_string('exportquestions', 'quiz'), 'quiz'));

$mform->addElement('text', 'exportfilename', get_string('exportname', 'quiz'), array('size'=>40));
$mform->setDefault('exportfilename', $defaultfilename);
Expand Down
15 changes: 12 additions & 3 deletions question/import_form.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,18 @@ function definition() {

$defaultcategory = $this->_customdata['defaultcategory'];
$contexts = $this->_customdata['contexts'];

//--------------------------------------------------------------------------------
$mform->addElement('header','fileformat', get_string('fileformat','quiz'));
$fileformatnames = get_import_export_formats('import');
$radioarray = array();
foreach ($fileformatnames as $id => $fileformatname) {
$radioarray[] = &MoodleQuickForm::createElement('radio','format','',$fileformatname,$id );
}
$mform->addGroup($radioarray,'format', '', array('<br />'), false);
$mform->addRule('format', null, 'required', null, 'client' );
$mform->setHelpButton('format', array('import', get_string('importquestions', 'quiz'), 'quiz'));

//--------------------------------------------------------------------------------
$mform->addElement('header','general', get_string('general', 'form'));

Expand All @@ -26,9 +38,6 @@ function definition() {
$mform->setDefault('catfromfile', 1);
$mform->setDefault('contextfromfile', 1);

$fileformatnames = get_import_export_formats('import');
$mform->addElement('select', 'format', get_string('fileformat','quiz'), $fileformatnames);
$mform->setDefault('format', 'gift');

$matchgrades = array();
$matchgrades['error'] = get_string('matchgradeserror','quiz');
Expand Down

0 comments on commit 45b68ee

Please sign in to comment.