Index: lib/moodlelib.php =================================================================== RCS file: /cvsroot/moodle/moodle/lib/moodlelib.php,v retrieving revision 1.960.2.73 diff -u -r1.960.2.73 moodlelib.php --- lib/moodlelib.php 18 Apr 2008 07:55:38 -0000 1.960.2.73 +++ lib/moodlelib.php 19 Apr 2008 13:46:27 -0000 @@ -5077,6 +5077,7 @@ 'enrol_' => array('enrol'), 'filter_' => array('filter'), 'format_' => array('course/format'), + 'qformat_' => array('question/format'), 'qtype_' => array('question/type'), 'report_' => array($CFG->admin.'/report', 'course/report', 'mod/quiz/report'), 'resource_' => array('mod/resource/type'), ------------------------------------------------------------------- Index: question/format.php =================================================================== RCS file: /cvsroot/moodle/moodle/question/format.php,v retrieving revision 1.35.2.6 diff -u -r1.35.2.6 format.php --- question/format.php 9 Apr 2008 03:03:49 -0000 1.35.2.6 +++ question/format.php 19 Apr 2008 13:53:41 -0000 @@ -37,6 +37,13 @@ return false; } + function has_import_help_file() { + return false; + } + function has_export_help_file() { + return false; + } + // Accessor methods /** ------------------------------------------------------------------- Index: lib/questionlib.php =================================================================== RCS file: /cvsroot/moodle/moodle/lib/questionlib.php,v retrieving revision 1.119.2.5 diff -u -r1.119.2.5 questionlib.php --- lib/questionlib.php 28 Feb 2008 12:52:59 -0000 1.119.2.5 +++ lib/questionlib.php 19 Apr 2008 13:58:55 -0000 @@ -1844,21 +1844,29 @@ } $classname = "qformat_$fileformat"; $format_class = new $classname(); + $hashelpfile = false; if ($type=='import') { $provided = $format_class->provide_import(); + $hashelpfile = $format_class->has_import_help_file(); } else { $provided = $format_class->provide_export(); + $hashelpfile = $format_class->has_export_help_file(); } if ($provided) { + $fileformatnames[$fileformat]->fileformat = $fileformat; $formatname = get_string($fileformat, 'quiz'); if ($formatname == "[[$fileformat]]") { + if ($hashelpfile) { + $formatname = get_string($fileformat, 'qformat_'.$fileformat); + } $formatname = $fileformat; // Just use the raw folder name } - $fileformatnames[$fileformat] = $formatname; + $fileformatnames[$fileformat]->formatname = $formatname; + $fileformatnames[$fileformat]->hashelpfile = $hashelpfile; } } - natcasesort($fileformatnames); + //natcasesort($fileformatnames->formatname); return $fileformatnames; } ------------------------------------------------------------------- Index: question/export_form.php =================================================================== RCS file: /cvsroot/moodle/moodle/question/export_form.php,v retrieving revision 1.3.2.1 diff -u -r1.3.2.1 export_form.php --- question/export_form.php 2 Nov 2007 16:20:18 -0000 1.3.2.1 +++ question/export_form.php 19 Apr 2008 14:02:16 -0000 @@ -6,7 +6,6 @@ function definition() { $mform =& $this->_form; - $defaultcategory = $this->_customdata['defaultcategory']; $contexts = $this->_customdata['contexts']; $defaultfilename = $this->_customdata['defaultfilename']; @@ -15,15 +14,20 @@ $fileformatnames = get_import_export_formats('export'); $radioarray = array(); foreach ($fileformatnames as $id => $fileformatname) { - $radioarray[] = &MoodleQuickForm::createElement('radio','format','',$fileformatname,$id); + $formatname = $fileformatname->formatname; + $fileformat = $fileformatname->fileformat; + $hashelpfile = $fileformatname->hashelpfile; + $radioarray[] = &MoodleQuickForm::createElement('radio','format','',$formatname,$id); + if ($hashelpfile) { + end($radioarray)->setHelpButton(array('export', + get_string('exportquestions', 'qformat_'.$fileformat), 'qformat_'.$fileformat)); + } } $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')); $mform->setDefault('category', $defaultcategory); $mform->setHelpButton('category', array('exportcategory', get_string('exportcategory','question'), 'quiz')); @@ -35,21 +39,14 @@ $mform->disabledIf('categorygroup', 'cattofile', 'notchecked'); $mform->setDefault('cattofile', 1); $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')); - $mform->addElement('text', 'exportfilename', get_string('exportname', 'quiz'), array('size'=>40)); $mform->setDefault('exportfilename', $defaultfilename); $mform->setType('exportfilename', PARAM_CLEANFILE); - //-------------------------------------------------------------------------------- $this->add_action_buttons(false, get_string('exportquestions', 'quiz')); //-------------------------------------------------------------------------------- + } } ?> -------------------------------------------------------------------