Updated the HEAD build version to 20100513
[moodle.git] / question / export_form.php
CommitLineData
aeb15530 1<?php
515ed4c3 2
3require_once($CFG->libdir.'/formslib.php');
4
5class question_export_form extends moodleform {
6
7 function definition() {
8 $mform =& $this->_form;
9
10 $defaultcategory = $this->_customdata['defaultcategory'];
11 $contexts = $this->_customdata['contexts'];
12 $defaultfilename = $this->_customdata['defaultfilename'];
45b68eef 13//--------------------------------------------------------------------------------
14 $mform->addElement('header','fileformat',get_string('fileformat','quiz'));
15 $fileformatnames = get_import_export_formats('export');
16 $radioarray = array();
05f7f7c1 17 $i = 0 ;
f94902db 18 foreach ($fileformatnames as $shortname => $fileformatname) {
05f7f7c1
PP
19 $currentgrp1 = array();
20 $currentgrp1[] = &$mform->createElement('radio','format','',$fileformatname,$shortname);
21 $mform->addGroup($currentgrp1,"formathelp[$i]",'',array('<br />'),false);
22 $mform->setHelpButton("formathelp[$i]", array("$shortname",$fileformatname,"qformat_$shortname"));
23 $i++ ;
45b68eef 24 }
5a5487ff 25 $mform->addRule("formathelp[0]",null,'required',null,'client');
515ed4c3 26//--------------------------------------------------------------------------------
27 $mform->addElement('header','general', get_string('general', 'form'));
28
29 $mform->addElement('questioncategory', 'category', get_string('category','quiz'), compact('contexts'));
30 $mform->setDefault('category', $defaultcategory);
31 $mform->setHelpButton('category', array('exportcategory', get_string('exportcategory','question'), 'quiz'));
32
33 $categorygroup = array();
34 $categorygroup[] =& $mform->createElement('checkbox', 'cattofile', '', get_string('tofilecategory', 'question'));
35 $categorygroup[] =& $mform->createElement('checkbox', 'contexttofile', '', get_string('tofilecontext', 'question'));
36 $mform->addGroup($categorygroup, 'categorygroup', '', '', false);
37 $mform->disabledIf('categorygroup', 'cattofile', 'notchecked');
38 $mform->setDefault('cattofile', 1);
39 $mform->setDefault('contexttofile', 1);
aeb15530 40
515ed4c3 41
45b68eef 42// $fileformatnames = get_import_export_formats('export');
43// $mform->addElement('select', 'format', get_string('fileformat','quiz'), $fileformatnames);
44// $mform->setDefault('format', 'gift');
45// $mform->setHelpButton('format', array('export', get_string('exportquestions', 'quiz'), 'quiz'));
515ed4c3 46
47 $mform->addElement('text', 'exportfilename', get_string('exportname', 'quiz'), array('size'=>40));
48 $mform->setDefault('exportfilename', $defaultfilename);
bed79931 49 $mform->setType('exportfilename', PARAM_FILE);
515ed4c3 50
aeb15530 51 // set a template for the format select elements
79e3dd8e 52 $renderer =& $mform->defaultRenderer();
53 $template = "{help} {element}\n";
54 $renderer->setGroupElementTemplate($template, 'format');
515ed4c3 55
56//--------------------------------------------------------------------------------
57 $this->add_action_buttons(false, get_string('exportquestions', 'quiz'));
58//--------------------------------------------------------------------------------
59 }
60}
aeb15530 61