From 45b68eef6c04d183fb7fc9adac8808fa6a7cffca Mon Sep 17 00:00:00 2001 From: thepurpleblob Date: Fri, 17 Aug 2007 15:15:21 +0000 Subject: [PATCH] MDL-10876: Import/Export format select list is now a (required) list of radio buttons, with no default --- question/export_form.php | 19 +++++++++++++++---- question/import_form.php | 15 ++++++++++++--- 2 files changed, 27 insertions(+), 7 deletions(-) diff --git a/question/export_form.php b/question/export_form.php index d455055cb..785906abf 100644 --- a/question/export_form.php +++ b/question/export_form.php @@ -11,6 +11,17 @@ class question_export_form extends moodleform { $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('
'),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')); $mform->addElement('questioncategory', 'category', get_string('category','quiz'), compact('contexts')); @@ -26,10 +37,10 @@ class question_export_form extends moodleform { $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); diff --git a/question/import_form.php b/question/import_form.php index e3ef67a3a..30805e2a9 100644 --- a/question/import_form.php +++ b/question/import_form.php @@ -11,6 +11,18 @@ class question_import_form extends moodleform { $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('
'), 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')); @@ -26,9 +38,6 @@ class question_import_form extends moodleform { $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'); -- 2.11.4.GIT