MDL-11510 added missing fields in new gradebook backup
[moodle-pu.git] / question / export_form.php
blob785906abf51493d03d71d172d1d9499ef715981b
1 <?php //$Id$
3 require_once($CFG->libdir.'/formslib.php');
5 class question_export_form extends moodleform {
7 function definition() {
8 $mform =& $this->_form;
10 $defaultcategory = $this->_customdata['defaultcategory'];
11 $contexts = $this->_customdata['contexts'];
12 $defaultfilename = $this->_customdata['defaultfilename'];
13 //--------------------------------------------------------------------------------
14 $mform->addElement('header','fileformat',get_string('fileformat','quiz'));
15 $fileformatnames = get_import_export_formats('export');
16 $radioarray = array();
17 foreach ($fileformatnames as $id => $fileformatname) {
18 $radioarray[] = &MoodleQuickForm::createElement('radio','format','',$fileformatname,$id);
20 $mform->addGroup($radioarray,'format','',array('<br />'),false);
21 $mform->setHelpButton('format', array('export', get_string('exportquestions', 'quiz'), 'quiz'));
22 $mform->addRule('format',null,'required',null,'client');
24 //--------------------------------------------------------------------------------
25 $mform->addElement('header','general', get_string('general', 'form'));
27 $mform->addElement('questioncategory', 'category', get_string('category','quiz'), compact('contexts'));
28 $mform->setDefault('category', $defaultcategory);
29 $mform->setHelpButton('category', array('exportcategory', get_string('exportcategory','question'), 'quiz'));
31 $categorygroup = array();
32 $categorygroup[] =& $mform->createElement('checkbox', 'cattofile', '', get_string('tofilecategory', 'question'));
33 $categorygroup[] =& $mform->createElement('checkbox', 'contexttofile', '', get_string('tofilecontext', 'question'));
34 $mform->addGroup($categorygroup, 'categorygroup', '', '', false);
35 $mform->disabledIf('categorygroup', 'cattofile', 'notchecked');
36 $mform->setDefault('cattofile', 1);
37 $mform->setDefault('contexttofile', 1);
40 // $fileformatnames = get_import_export_formats('export');
41 // $mform->addElement('select', 'format', get_string('fileformat','quiz'), $fileformatnames);
42 // $mform->setDefault('format', 'gift');
43 // $mform->setHelpButton('format', array('export', get_string('exportquestions', 'quiz'), 'quiz'));
45 $mform->addElement('text', 'exportfilename', get_string('exportname', 'quiz'), array('size'=>40));
46 $mform->setDefault('exportfilename', $defaultfilename);
47 $mform->setType('exportfilename', PARAM_CLEANFILE);
50 //--------------------------------------------------------------------------------
51 $this->add_action_buttons(false, get_string('exportquestions', 'quiz'));
52 //--------------------------------------------------------------------------------