From 79e3dd8e3c106fedb29ce5edf90db5bc3790745c Mon Sep 17 00:00:00 2001 From: thepurpleblob Date: Wed, 9 Jul 2008 13:07:29 +0000 Subject: [PATCH] MDL-14431 Changing import/export help to be properly pluggable. --- lang/en_utf8/help/quiz/export.html | 51 ++----------------------- lang/en_utf8/help/quiz/formatqti2.html | 6 +++ lang/en_utf8/help/quiz/formatxhtml.html | 6 +++ question/export_form.php | 9 ++++- question/import_form.php | 13 +++++-- 5 files changed, 31 insertions(+), 54 deletions(-) create mode 100644 lang/en_utf8/help/quiz/formatqti2.html create mode 100644 lang/en_utf8/help/quiz/formatxhtml.html diff --git a/lang/en_utf8/help/quiz/export.html b/lang/en_utf8/help/quiz/export.html index cb5c4296af..d3e6b75497 100644 --- a/lang/en_utf8/help/quiz/export.html +++ b/lang/en_utf8/help/quiz/export.html @@ -11,54 +11,9 @@ You are advised to check exported data before using it in a production environment.

-

The format(s) currently supported are:

- -

GIFT format

- -

GIFT is the most comprehensive import/export format available for exporting - Moodle quiz questions to a text file. It was designed to be an easy - method for teachers writing questions as a text file. It supports Multiple-Choice, - True-False, Short Answer, Matching and Numerical questions, as well as insertion - of a _____ for the "missing word" format. Note that Cloze questions are not - currently supported. Various question-types can be - mixed in a single text file, and the format also supports line comments, question names, - feedback and percentage-weight grades. Below are some examples:

-
-Who's buried in Grant's tomb?{~Grant ~Jefferson =no one}
-
-Grant is {~buried =entombed ~living} in Grant's tomb.
-
-Grant is buried in Grant's tomb.{FALSE}
-
-Who's buried in Grant's tomb?{=no one =nobody}
-
-When was Ulysses S. Grant born?{#1822}
-
- -

More info about the "GIFT" format

- - -

Moodle XML format

- -

This Moodle specific format exports quiz questions in a simple XML format. They -can then be imported into another quiz category or used in some other process such as -an XSLT transformation. The XML format will export images attached to questions (encoded -base64).

- - -

IMS QTI 2.0

- -

Exports in the standard IMS QTI (version 2.0) format. Note that this generates a group of files within - a single 'zip' file.

-

More information on the IMS QTI site - (external site in new window)

- - -

XHTML

- -

Exports the category as a single page of 'strict' XHTML. Each question is clearly placed in its own -<div> tag. If you want to use this page as-is, you will need to at least edit the <form> tag at the -start of the <body> section to provide a suitable action (eg, a 'mailto').

+

A number of file formats are supported. See in the individual help files +and the Moodle Docs +for details.

Import and Export formats are a pluggable resource. Other optional formats may be available in the diff --git a/lang/en_utf8/help/quiz/formatqti2.html b/lang/en_utf8/help/quiz/formatqti2.html new file mode 100644 index 0000000000..fa23647c02 --- /dev/null +++ b/lang/en_utf8/help/quiz/formatqti2.html @@ -0,0 +1,6 @@ +

IMS QTI 2.0

+ +

Exports in the standard IMS QTI (version 2.0) format. Note that this generates a group of files within + a single 'zip' file.

+

More information on the IMS QTI site + (external site in new window)

diff --git a/lang/en_utf8/help/quiz/formatxhtml.html b/lang/en_utf8/help/quiz/formatxhtml.html new file mode 100644 index 0000000000..1b1ecd907a --- /dev/null +++ b/lang/en_utf8/help/quiz/formatxhtml.html @@ -0,0 +1,6 @@ +

XHTML

+ +

Exports the category as a single page of 'strict' XHTML. Each question is clearly placed in its own +<div> tag. If you want to use this page as-is, you will need to at least edit the <form> tag at the +start of the <body> section to provide a suitable action (eg, a 'mailto').

+ diff --git a/question/export_form.php b/question/export_form.php index 785906abf5..11d85135af 100644 --- a/question/export_form.php +++ b/question/export_form.php @@ -15,10 +15,11 @@ class question_export_form extends moodleform { $fileformatnames = get_import_export_formats('export'); $radioarray = array(); foreach ($fileformatnames as $id => $fileformatname) { - $radioarray[] = &MoodleQuickForm::createElement('radio','format','',$fileformatname,$id); + $radioelement = &MoodleQuickForm::createElement('radio','format','',$fileformatname,$id); + $radioelement->setHelpButton(array("format{$id}",$fileformatname,'quiz')); + $radioarray[] = $radioelement; } $mform->addGroup($radioarray,'format','',array('
'),false); - $mform->setHelpButton('format', array('export', get_string('exportquestions', 'quiz'), 'quiz')); $mform->addRule('format',null,'required',null,'client'); //-------------------------------------------------------------------------------- @@ -46,6 +47,10 @@ class question_export_form extends moodleform { $mform->setDefault('exportfilename', $defaultfilename); $mform->setType('exportfilename', PARAM_CLEANFILE); + // set a template for the format select elements + $renderer =& $mform->defaultRenderer(); + $template = "{help} {element}\n"; + $renderer->setGroupElementTemplate($template, 'format'); //-------------------------------------------------------------------------------- $this->add_action_buttons(false, get_string('exportquestions', 'quiz')); diff --git a/question/import_form.php b/question/import_form.php index 9ba63c375c..f417970557 100644 --- a/question/import_form.php +++ b/question/import_form.php @@ -16,12 +16,12 @@ class question_import_form extends moodleform { $fileformatnames = get_import_export_formats('import'); $radioarray = array(); foreach ($fileformatnames as $id => $fileformatname) { - $radioarray[] = &MoodleQuickForm::createElement('radio','format','',$fileformatname,$id ); + $radioelement = &MoodleQuickForm::createElement('radio','format','',$fileformatname,$id ); + $radioelement->setHelpButton(array("format{$id}",$fileformatname,'quiz')); + $radioarray[] = $radioelement; } - $mform->addGroup($radioarray,'format', '', array('
'), false); + $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')); @@ -68,6 +68,11 @@ class question_import_form extends moodleform { //-------------------------------------------------------------------------------- $mform->addElement('static', 'dummy', ''); $mform->closeHeaderBefore('dummy'); + + // set a template for the format select elements + $renderer =& $mform->defaultRenderer(); + $template = "{help} {element}\n"; + $renderer->setGroupElementTemplate($template, 'format'); } function get_importfile_name(){ if ($this->is_submitted() and $this->is_validated()) { -- 2.39.5